Skip to content

Commit e02cea8

Browse files
ausyskindceraolo
authored andcommitted
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 <[email protected]> Reviewed-by: Rodrigo Vivi <[email protected]> Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 45d30c8 commit e02cea8

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

drivers/gpu/drm/xe/xe_device_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct xe_pat_ops;
4444
#define MEDIA_VERx100(xe) ((xe)->info.media_verx100)
4545
#define IS_DGFX(xe) ((xe)->info.is_dgfx)
4646
#define HAS_HECI_GSCFI(xe) ((xe)->info.has_heci_gscfi)
47+
#define HAS_HECI_CSCFI(xe) ((xe)->info.has_heci_cscfi)
4748

4849
#define XE_VRAM_FLAGS_NEED64K BIT(0)
4950

@@ -289,6 +290,8 @@ struct xe_device {
289290
u8 skip_pcode:1;
290291
/** @info.has_heci_gscfi: device has heci gscfi */
291292
u8 has_heci_gscfi:1;
293+
/** @info.has_heci_cscfi: device has heci cscfi */
294+
u8 has_heci_cscfi:1;
292295
/** @info.skip_guc_pc: Skip GuC based PM feature init */
293296
u8 skip_guc_pc:1;
294297
/** @info.has_atomic_enable_pte_bit: Device has atomic enable PTE bit */

drivers/gpu/drm/xe/xe_heci_gsc.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void xe_heci_gsc_fini(struct xe_device *xe)
9292
{
9393
struct xe_heci_gsc *heci_gsc = &xe->heci_gsc;
9494

95-
if (!HAS_HECI_GSCFI(xe))
95+
if (!HAS_HECI_GSCFI(xe) && !HAS_HECI_CSCFI(xe))
9696
return;
9797

9898
if (heci_gsc->adev) {
@@ -177,12 +177,14 @@ void xe_heci_gsc_init(struct xe_device *xe)
177177
const struct heci_gsc_def *def;
178178
int ret;
179179

180-
if (!HAS_HECI_GSCFI(xe))
180+
if (!HAS_HECI_GSCFI(xe) && !HAS_HECI_CSCFI(xe))
181181
return;
182182

183183
heci_gsc->irq = -1;
184184

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) {
186188
def = &heci_gsc_def_pvc;
187189
} else if (xe->info.platform == XE_DG2) {
188190
def = &heci_gsc_def_dg2;
@@ -232,3 +234,23 @@ void xe_heci_gsc_irq_handler(struct xe_device *xe, u32 iir)
232234
if (ret)
233235
drm_err_ratelimited(&xe->drm, "error handling GSC irq: %d\n", ret);
234236
}
237+
238+
void xe_heci_csc_irq_handler(struct xe_device *xe, u32 iir)
239+
{
240+
int ret;
241+
242+
if ((iir & CSC_IRQ_INTF(1)) == 0)
243+
return;
244+
245+
if (!HAS_HECI_CSCFI(xe)) {
246+
drm_warn_once(&xe->drm, "CSC irq: not supported");
247+
return;
248+
}
249+
250+
if (xe->heci_gsc.irq < 0)
251+
return;
252+
253+
ret = generic_handle_irq(xe->heci_gsc.irq);
254+
if (ret)
255+
drm_err_ratelimited(&xe->drm, "error handling GSC irq: %d\n", ret);
256+
}

drivers/gpu/drm/xe/xe_heci_gsc.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ struct xe_device;
1111
struct mei_aux_device;
1212

1313
/*
14-
* The HECI1 bit corresponds to bit15 and HECI2 to bit14.
14+
* GSC HECI1 bit corresponds to bit15 and HECI2 to bit14.
1515
* The reason for this is to allow growth for more interfaces in the future.
1616
*/
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))
1823

1924
/**
2025
* struct xe_heci_gsc - graphics security controller for xe, HECI interface
@@ -31,5 +36,6 @@ struct xe_heci_gsc {
3136
void xe_heci_gsc_init(struct xe_device *xe);
3237
void xe_heci_gsc_fini(struct xe_device *xe);
3338
void xe_heci_gsc_irq_handler(struct xe_device *xe, u32 iir);
39+
void xe_heci_csc_irq_handler(struct xe_device *xe, u32 iir);
3440

3541
#endif /* __XE_HECI_GSC_DEV_H__ */

drivers/gpu/drm/xe/xe_irq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ static irqreturn_t dg1_irq_handler(int irq, void *arg)
459459
* the primary tile.
460460
*/
461461
if (id == 0) {
462+
if (HAS_HECI_CSCFI(xe))
463+
xe_heci_csc_irq_handler(xe, master_ctl);
462464
xe_display_irq_handler(xe, master_ctl);
463465
gu_misc_iir = gu_misc_irq_ack(xe, master_ctl);
464466
}

drivers/gpu/drm/xe/xe_pci.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct xe_device_desc {
5959

6060
u8 has_display:1;
6161
u8 has_heci_gscfi:1;
62+
u8 has_heci_cscfi:1;
6263
u8 has_llc:1;
6364
u8 has_mmio_ext:1;
6465
u8 has_sriov:1;
@@ -345,6 +346,7 @@ static const struct xe_device_desc bmg_desc = {
345346
PLATFORM(BATTLEMAGE),
346347
.has_display = true,
347348
.require_force_probe = true,
349+
.has_heci_cscfi = 1,
348350
};
349351

350352
#undef PLATFORM
@@ -606,6 +608,7 @@ static int xe_info_init_early(struct xe_device *xe,
606608

607609
xe->info.is_dgfx = desc->is_dgfx;
608610
xe->info.has_heci_gscfi = desc->has_heci_gscfi;
611+
xe->info.has_heci_cscfi = desc->has_heci_cscfi;
609612
xe->info.has_llc = desc->has_llc;
610613
xe->info.has_mmio_ext = desc->has_mmio_ext;
611614
xe->info.has_sriov = desc->has_sriov;
@@ -815,7 +818,7 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
815818
if (err)
816819
return err;
817820

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",
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 cscfi:%d",
819822
desc->platform_name,
820823
subplatform_desc ? subplatform_desc->name : "",
821824
xe->info.devid, xe->info.revid,
@@ -828,7 +831,7 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
828831
xe->info.media_verx100 % 100,
829832
str_yes_no(xe->info.enable_display),
830833
xe->info.dma_mask_size, xe->info.tile_count,
831-
xe->info.has_heci_gscfi);
834+
xe->info.has_heci_gscfi, xe->info.has_heci_cscfi);
832835

833836
drm_dbg(&xe->drm, "Stepping = (G:%s, M:%s, D:%s, B:%s)\n",
834837
xe_step_name(xe->info.step.graphics),

0 commit comments

Comments
 (0)