drm/xe/gsc: add initial gsc support
Alexander Usyskin
maintainerv3 cover drm/xe/gsc: add initial gsc support
Add initial GSC support for DG1 and DG2. Create mei-gscfi auxiliary device and add support for device created by Xe to the mei-gsc driver.
This series intended to be merged into Xe tree, the only patch that touches char-misc is addition of id and alias in mei-gsc.
V3: Review comments addressed:
- xe_heci_gsc_init mover earlier
- part of init flow moved to dedicated functions
- KDoc fix
V2: Added heci_ to struct and APIs
heci_gsc moved under xe_device as GSC is not under GT
Vitaly Lubart (4):
drm/xe/gsc: add HECI2 register offsets
drm/xe/gsc: add has_heci_gscfi indication to device drm/xe/gsc: add gsc device support
mei: gsc: add support for auxiliary device created by Xe driver
drivers/gpu/drm/xe/Kconfig | 1 + drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/regs/xe_regs.h | 4 + drivers/gpu/drm/xe/xe_device.c | 4 + drivers/gpu/drm/xe/xe_device_types.h | 7 + drivers/gpu/drm/xe/xe_heci_gsc.c | 222 +++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_heci_gsc.h | 35 +++++ drivers/gpu/drm/xe/xe_irq.c | 21 ++- drivers/gpu/drm/xe/xe_pci.c | 9 +- drivers/misc/mei/gsc-me.c | 5 + 10 files changed, 302 insertions(+), 7 deletions(-) create mode 100644 drivers/gpu/drm/xe/xe_heci_gsc.c create mode 100644 drivers/gpu/drm/xe/xe_heci_gsc.h
Signature · 1 line
2.34.1
Alexander Usyskin
maintainerPATCH v3 1/4 drm/xe/gsc: add HECI2 register offsets
From: Vitaly Lubart <[email protected]>
Add HECI2 register offsets for DG1 and DG2 to regs/xe_regs.h
--- drivers/gpu/drm/xe/regs/xe_regs.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/xe/regs/xe_regs.h +4 -0
@@ -33,6 +33,10 @@#define XEHPC_BCS6_RING_BASE 0x3ea000#define XEHPC_BCS7_RING_BASE 0x3ec000#define XEHPC_BCS8_RING_BASE 0x3ee000 + +#define DG1_GSC_HECI2_BASE 0x00259000 +#define DG2_GSC_HECI2_BASE 0x00374000 +#define GSCCS_RING_BASE 0x11a000#define GT_WAIT_SEMAPHORE_INTERRUPT REG_BIT(11)#define GT_CONTEXT_SWITCH_INTERRUPT REG_BIT(8)
Signature · 1 line
2.34.1
Alexander Usyskin
maintainerPATCH v3 2/4 drm/xe/gsc: add has_heci_gscfi indication to device
In reply to Alexander UsyskinFrom: Vitaly Lubart <[email protected]>
Mark support of MEI-GSC interaction per device.
Add has_heci_gscfi indication to xe_device and xe_pci structures. Mark DG1 and DG2 devices as supported.
--- drivers/gpu/drm/xe/xe_device_types.h | 3 +++ drivers/gpu/drm/xe/xe_pci.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_device_types.h +3 -0
@@ -32,6 +32,7 @@ struct xe_ggtt;#define GRAPHICS_VERx100 (xe) ((xe)->info.graphics_verx100)#define MEDIA_VERx100 (xe) ((xe)->info.media_verx100)#define IS_DGFX (xe) ((xe)->info.is_dgfx) +#define HAS_HECI_GSCFI (xe) ((xe)->info.has_heci_gscfi)#define XE_VRAM_FLAGS_NEED64K BIT(0)
@@ -237,6 +238,8 @@ struct xe_device { u8 has_link_copy_engine:1;/** @enable_display: display enabled */ u8 enable_display:1; +/** @has_heci_gscfi: device has heci gscfi */ + u8 has_heci_gscfi:1;#if IS_ENABLED (CONFIG_DRM_XE_DISPLAY )const struct intel_display_device_info *display;
drivers/gpu/drm/xe/xe_pci.c +7 -2
@@ -57,6 +57,7 @@ struct xe_device_desc { u8 require_force_probe:1; u8 is_dgfx:1; u8 has_display:1; + u8 has_heci_gscfi:1; u8 has_llc:1; };
@@ -265,6 +266,7 @@ static const struct xe_device_desc dg1_desc = {PLATFORM (XE_DG1 ), .has_display = true, .require_force_probe = true, + .has_heci_gscfi = 1, };static const u16 dg2_g10_ids[] = {XE_DG2_G10_IDS (NOP ),XE_ATS_M150_IDS (NOP ),0 };
@@ -274,6 +276,7 @@ static const u16 dg2_g12_ids[] = { XE_DG2_G12_IDS(NOP), 0 };#define DG2_FEATURES \ DGFX_FEATURES, \ PLATFORM(XE_DG2), \ + .has_heci_gscfi = 1, \ .subplatforms = (const struct xe_subplatform_desc[]) { \ { XE_SUBPLATFORM_DG2_G10, "G10", dg2_g10_ids }, \ { XE_SUBPLATFORM_DG2_G11, "G11", dg2_g11_ids }, \
@@ -562,6 +565,7 @@ static int xe_info_init(struct xe_device *xe,return -ENODEV ; xe->info.is_dgfx = desc->is_dgfx; + xe->info.has_heci_gscfi = desc->has_heci_gscfi; xe->info.graphics_name = graphics_desc->name; xe->info.media_name = media_desc ? media_desc->name :"none" ; xe->info.has_llc = desc->has_llc;
@@ -703,7 +707,7 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)xe_display_info_init (xe); - drm_dbg(&xe->drm, "%s %s %04x:%04x dgfx:%d gfx:%s (%d.%02d) media:%s (%d.%02d) display:%s dma_m_s:%d tc:%d", + drm_dbg(&xe->drm, "%s %s %04x:%04x dgfx:%d gfx:%s (%d.%02d) media:%s (%d.%02d) display:%s dma_m_s:%d tc:%d gscfi:%d", desc->platform_name, subplatform_desc ? subplatform_desc->name : "", xe->info.devid, xe->info.revid,
@@ -715,7 +719,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) xe->info.media_verx100 /100 , xe->info.media_verx100 %100 ,str_yes_no (xe->info.enable_display), - xe->info.dma_mask_size, xe->info.tile_count); + xe->info.dma_mask_size, xe->info.tile_count, + xe->info.has_heci_gscfi); drm_dbg(&xe->drm, "Stepping = (G:%s, M:%s, D:%s, B:%s)\n", xe_step_name(xe->info.step.graphics),
Signature · 1 line
2.34.1
Alexander Usyskin
maintainerPATCH v3 3/4 drm/xe/gsc: add gsc device support
In reply to Alexander UsyskinFrom: Vitaly Lubart <[email protected]>
Create mei-gscfi auxiliary device and configure interrupts to be consumed by mei-gsc device driver.
--- drivers/gpu/drm/xe/Kconfig | 1 + drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_device.c | 4 + drivers/gpu/drm/xe/xe_device_types.h | 4 + drivers/gpu/drm/xe/xe_heci_gsc.c | 222 +++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_heci_gsc.h | 35 +++++ drivers/gpu/drm/xe/xe_irq.c | 21 ++- 7 files changed, 283 insertions(+), 5 deletions(-) create mode 100644 drivers/gpu/drm/xe/xe_heci_gsc.c create mode 100644 drivers/gpu/drm/xe/xe_heci_gsc.h
drivers/gpu/drm/xe/Kconfig +1 -0
@@ -37,6 +37,7 @@ config DRM_XE select DRM_SCHED select MMU_NOTIFIER select WANT_DEV_COREDUMP + select AUXILIARY_BUS help Experimental driver for Intel Xe series GPUs
drivers/gpu/drm/xe/Makefile +1 -0
@@ -73,6 +73,7 @@ xe-y += xe_bb.o \ xe_guc_log.o \ xe_guc_pc.o \ xe_guc_submit.o \ + xe_heci_gsc.o \ xe_hw_engine.o \ xe_hw_engine_class_sysfs.o \ xe_hw_fence.o \
drivers/gpu/drm/xe/xe_device.c +4 -0
@@ -292,6 +292,8 @@ int xe_device_probe(struct xe_device *xe) goto err_irq_shutdown; } +xe_heci_gsc_init (xe); + err =xe_mmio_probe_vram (xe);if (err) goto err_irq_shutdown;
@@ -365,6 +367,8 @@ void xe_device_remove(struct xe_device *xe)xe_display_fini (xe); +xe_heci_gsc_fini (xe); +xe_irq_shutdown (xe); }
drivers/gpu/drm/xe/xe_device_types.h +4 -0
@@ -13,6 +13,7 @@#include <drm/ttm/ttm_device.h> #include "xe_devcoredump_types.h" +#include "xe_heci_gsc.h" #include "xe_gt_types.h" #include "xe_platform_types.h" #include "xe_step_types.h"
@@ -364,6 +365,9 @@ struct xe_device {*/ struct task_struct *pm_callback_task; +/** @heci_gsc: graphics security controller */ +struct xe_heci_gsc heci_gsc; +/* private: */ #if IS_ENABLED (CONFIG_DRM_XE_DISPLAY )
drivers/gpu/drm/xe/xe_heci_gsc.c new file +222 -0
222 lines not on this page · raw message
drivers/gpu/drm/xe/xe_heci_gsc.h new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2023, Intel Corporation. All rights reserved. +*/ +#ifndef __XE_HECI_GSC_DEV_H__ +#define __XE_HECI_GSC_DEV_H__ + +#include <linux/types.h> + +struct xe_device ; +struct mei_aux_device ; + +/* +* The HECI1 bit corresponds to bit15 and HECI2 to bit14. +* The reason for this is to allow growth for more interfaces in the future. +*/ +#define GSC_IRQ_INTF (_x) BIT(15 - (_x)) + +/** +* struct xe_heci_gsc - graphics security controller for xe, HECI interface +* +* @adev : pointer to mei auxiliary device structure +* @irq : irq number +* +*/ +struct xe_heci_gsc { +struct mei_aux_device *adev; +int irq; +}; + +void xe_heci_gsc_init (struct xe_device *xe); +void xe_heci_gsc_fini (struct xe_device *xe); +void xe_heci_gsc_irq_handler (struct xe_device *xe,u32 iir); + +#endif /* __XE_HECI_GSC_DEV_H__ */
drivers/gpu/drm/xe/xe_irq.c +16 -5
@@ -128,6 +128,7 @@ void xe_irq_enable_hwe(struct xe_gt *gt)struct xe_device *xe =gt_to_xe (gt);u32 ccs_mask, bcs_mask;u32 irqs, dmask, smask; +u32 gsc_mask;if (xe_device_guc_submission_enabled (xe)) { irqs = GT_RENDER_USER_INTERRUPT |
@@ -177,9 +178,13 @@ void xe_irq_enable_hwe(struct xe_gt *gt)xe_mmio_write32 (gt,VCS2_VCS3_INTR_MASK , ~dmask);xe_mmio_write32 (gt,VECS0_VECS1_INTR_MASK , ~dmask); -if (xe_hw_engine_mask_per_class (gt,XE_ENGINE_CLASS_OTHER )) { -xe_mmio_write32 (gt,GUNIT_GSC_INTR_ENABLE , irqs); -xe_mmio_write32 (gt,GUNIT_GSC_INTR_MASK , ~irqs); +if (xe_hw_engine_mask_per_class (gt,XE_ENGINE_CLASS_OTHER )) + gsc_mask = irqs; +else if (HAS_HECI_GSCFI (xe)) + gsc_mask =GSC_IRQ_INTF (1 ); +if (gsc_mask) { +xe_mmio_write32 (gt,GUNIT_GSC_INTR_ENABLE , gsc_mask); +xe_mmio_write32 (gt,GUNIT_GSC_INTR_MASK , ~gsc_mask); } } }
@@ -284,6 +289,11 @@ static void gt_irq_handler(struct xe_tile *tile, instance =INTR_ENGINE_INSTANCE (identity[bit]); intr_vec =INTR_ENGINE_INTR (identity[bit]); +if (class ==XE_ENGINE_CLASS_OTHER && instance ==OTHER_GSC_INSTANCE ) { +xe_heci_gsc_irq_handler (xe, intr_vec); +continue ; + } + engine_gt =pick_engine_gt (tile, class, instance); hwe =xe_gt_hw_engine (engine_gt, class, instance, false);
@@ -470,8 +480,9 @@ static void gt_irq_reset(struct xe_tile *tile)if (ccs_mask & (BIT (2 )|BIT (3 )))xe_mmio_write32 (mmio,CCS2_CCS3_INTR_MASK , ~0 ); -if (tile->media_gt && -xe_hw_engine_mask_per_class (tile->media_gt,XE_ENGINE_CLASS_OTHER )) { +if ((tile->media_gt && +xe_hw_engine_mask_per_class (tile->media_gt,XE_ENGINE_CLASS_OTHER )) || +HAS_HECI_GSCFI (tile_to_xe (tile))) {xe_mmio_write32 (mmio,GUNIT_GSC_INTR_ENABLE ,0 );xe_mmio_write32 (mmio,GUNIT_GSC_INTR_MASK , ~0 ); }
Signature · 1 line
2.34.1
Alexander Usyskin
maintainerPATCH v3 4/4 mei: gsc: add support for auxiliary device created by Xe driver
In reply to Alexander UsyskinFrom: Vitaly Lubart <[email protected]>
Add support for gsc mei auxiliary device created by Xe driver
--- drivers/misc/mei/gsc-me.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/misc/mei/gsc-me.c +5 -0
@@ -292,6 +292,10 @@ static const struct auxiliary_device_id mei_gsc_id_table[] = { .name = "i915.mei-gscfi", .driver_data = MEI_ME_GSCFI_CFG, }, + { + .name = "xe.mei-gscfi", + .driver_data = MEI_ME_GSCFI_CFG, + }, {/* sentinel */ }
@@ -312,4 +316,5 @@ module_auxiliary_driver(mei_gsc_driver);MODULE_AUTHOR ("Intel Corporation" );MODULE_ALIAS ("auxiliary:i915.mei-gsc" );MODULE_ALIAS ("auxiliary:i915.mei-gscfi" ); +MODULE_ALIAS ("auxiliary:xe.mei-gscfi" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.34.1
Patchwork
CI[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe/gsc: add initial gsc support (rev3)
In reply to Alexander Usyskin== Series Details ==
== Series Details ==
Series: drm/xe/gsc: add initial gsc support (rev3)
URL : https://patchwork.freedesktop.org/series/123603/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: b3b5f51b6 fixup! drm/xe/display: Implement display support === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_device_types.h:13
error: drivers/gpu/drm/xe/xe_device_types.h: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_irq.c:128
error: drivers/gpu/drm/xe/xe_irq.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe/gsc: add HECI2 register offsets
Applying: drm/xe/gsc: add has_heci_gscfi indication to device
Applying: drm/xe/gsc: add gsc device support
Patch failed at 0003 drm/xe/gsc: add gsc device support
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".