Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/gsc: add Battlemage support

Add heci_cscfi support bit for new CSC engine type.
It has same mmio offsets as DG2 GSC but separate interrupt flow.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240708084906.2827024-1-alexander.usyskin@intel.com

authored by

Alexander Usyskin and committed by
Daniele Ceraolo Spurio
e02cea83 45d30c82

+43 -7
+3
drivers/gpu/drm/xe/xe_device_types.h
··· 44 44 #define MEDIA_VERx100(xe) ((xe)->info.media_verx100) 45 45 #define IS_DGFX(xe) ((xe)->info.is_dgfx) 46 46 #define HAS_HECI_GSCFI(xe) ((xe)->info.has_heci_gscfi) 47 + #define HAS_HECI_CSCFI(xe) ((xe)->info.has_heci_cscfi) 47 48 48 49 #define XE_VRAM_FLAGS_NEED64K BIT(0) 49 50 ··· 290 289 u8 skip_pcode:1; 291 290 /** @info.has_heci_gscfi: device has heci gscfi */ 292 291 u8 has_heci_gscfi:1; 292 + /** @info.has_heci_cscfi: device has heci cscfi */ 293 + u8 has_heci_cscfi:1; 293 294 /** @info.skip_guc_pc: Skip GuC based PM feature init */ 294 295 u8 skip_guc_pc:1; 295 296 /** @info.has_atomic_enable_pte_bit: Device has atomic enable PTE bit */
+25 -3
drivers/gpu/drm/xe/xe_heci_gsc.c
··· 92 92 { 93 93 struct xe_heci_gsc *heci_gsc = &xe->heci_gsc; 94 94 95 - if (!HAS_HECI_GSCFI(xe)) 95 + if (!HAS_HECI_GSCFI(xe) && !HAS_HECI_CSCFI(xe)) 96 96 return; 97 97 98 98 if (heci_gsc->adev) { ··· 177 177 const struct heci_gsc_def *def; 178 178 int ret; 179 179 180 - if (!HAS_HECI_GSCFI(xe)) 180 + if (!HAS_HECI_GSCFI(xe) && !HAS_HECI_CSCFI(xe)) 181 181 return; 182 182 183 183 heci_gsc->irq = -1; 184 184 185 - if (xe->info.platform == XE_PVC) { 185 + if (xe->info.platform == XE_BATTLEMAGE) { 186 + def = &heci_gsc_def_dg2; 187 + } else if (xe->info.platform == XE_PVC) { 186 188 def = &heci_gsc_def_pvc; 187 189 } else if (xe->info.platform == XE_DG2) { 188 190 def = &heci_gsc_def_dg2; ··· 224 222 225 223 if (!HAS_HECI_GSCFI(xe)) { 226 224 drm_warn_once(&xe->drm, "GSC irq: not supported"); 225 + return; 226 + } 227 + 228 + if (xe->heci_gsc.irq < 0) 229 + return; 230 + 231 + ret = generic_handle_irq(xe->heci_gsc.irq); 232 + if (ret) 233 + drm_err_ratelimited(&xe->drm, "error handling GSC irq: %d\n", ret); 234 + } 235 + 236 + void xe_heci_csc_irq_handler(struct xe_device *xe, u32 iir) 237 + { 238 + int ret; 239 + 240 + if ((iir & CSC_IRQ_INTF(1)) == 0) 241 + return; 242 + 243 + if (!HAS_HECI_CSCFI(xe)) { 244 + drm_warn_once(&xe->drm, "CSC irq: not supported"); 227 245 return; 228 246 } 229 247
+8 -2
drivers/gpu/drm/xe/xe_heci_gsc.h
··· 11 11 struct mei_aux_device; 12 12 13 13 /* 14 - * The HECI1 bit corresponds to bit15 and HECI2 to bit14. 14 + * GSC HECI1 bit corresponds to bit15 and HECI2 to bit14. 15 15 * The reason for this is to allow growth for more interfaces in the future. 16 16 */ 17 - #define GSC_IRQ_INTF(_x) BIT(15 - (_x)) 17 + #define GSC_IRQ_INTF(_x) BIT(15 - (_x)) 18 + 19 + /* 20 + * CSC HECI1 bit corresponds to bit9 and HECI2 to bit10. 21 + */ 22 + #define CSC_IRQ_INTF(_x) BIT(9 + (_x)) 18 23 19 24 /** 20 25 * struct xe_heci_gsc - graphics security controller for xe, HECI interface ··· 36 31 void xe_heci_gsc_init(struct xe_device *xe); 37 32 void xe_heci_gsc_fini(struct xe_device *xe); 38 33 void xe_heci_gsc_irq_handler(struct xe_device *xe, u32 iir); 34 + void xe_heci_csc_irq_handler(struct xe_device *xe, u32 iir); 39 35 40 36 #endif /* __XE_HECI_GSC_DEV_H__ */
+2
drivers/gpu/drm/xe/xe_irq.c
··· 459 459 * the primary tile. 460 460 */ 461 461 if (id == 0) { 462 + if (HAS_HECI_CSCFI(xe)) 463 + xe_heci_csc_irq_handler(xe, master_ctl); 462 464 xe_display_irq_handler(xe, master_ctl); 463 465 gu_misc_iir = gu_misc_irq_ack(xe, master_ctl); 464 466 }
+5 -2
drivers/gpu/drm/xe/xe_pci.c
··· 59 59 60 60 u8 has_display:1; 61 61 u8 has_heci_gscfi:1; 62 + u8 has_heci_cscfi:1; 62 63 u8 has_llc:1; 63 64 u8 has_mmio_ext:1; 64 65 u8 has_sriov:1; ··· 346 345 PLATFORM(BATTLEMAGE), 347 346 .has_display = true, 348 347 .require_force_probe = true, 348 + .has_heci_cscfi = 1, 349 349 }; 350 350 351 351 #undef PLATFORM ··· 608 606 609 607 xe->info.is_dgfx = desc->is_dgfx; 610 608 xe->info.has_heci_gscfi = desc->has_heci_gscfi; 609 + xe->info.has_heci_cscfi = desc->has_heci_cscfi; 611 610 xe->info.has_llc = desc->has_llc; 612 611 xe->info.has_mmio_ext = desc->has_mmio_ext; 613 612 xe->info.has_sriov = desc->has_sriov; ··· 818 815 if (err) 819 816 return err; 820 817 821 - 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", 818 + 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 cscfi:%d", 822 819 desc->platform_name, 823 820 subplatform_desc ? subplatform_desc->name : "", 824 821 xe->info.devid, xe->info.revid, ··· 831 828 xe->info.media_verx100 % 100, 832 829 str_yes_no(xe->info.enable_display), 833 830 xe->info.dma_mask_size, xe->info.tile_count, 834 - xe->info.has_heci_gscfi); 831 + xe->info.has_heci_gscfi, xe->info.has_heci_cscfi); 835 832 836 833 drm_dbg(&xe->drm, "Stepping = (G:%s, M:%s, D:%s, B:%s)\n", 837 834 xe_step_name(xe->info.step.graphics),