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

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe/soc_remapper: Use SoC remapper helper from VSEC code

Since different drivers can use SoC remapper, modify VSEC code to
access SoC remapper via a helper that would synchronize such accesses.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Link: https://patch.msgid.link/20251223183943.3175941-7-umesh.nerlige.ramappa@intel.com

+45 -6
-3
drivers/gpu/drm/xe/regs/xe_pmt.h
··· 18 18 #define BMG_TELEMETRY_BASE_OFFSET 0xE0000 19 19 #define BMG_TELEMETRY_OFFSET (SOC_BASE + BMG_TELEMETRY_BASE_OFFSET) 20 20 21 - #define SG_REMAP_INDEX1 XE_REG(SOC_BASE + 0x08) 22 - #define SG_REMAP_BITS REG_GENMASK(31, 24) 23 - 24 21 #define BMG_MODS_RESIDENCY_OFFSET (0x4D0) 25 22 #define BMG_G2_RESIDENCY_OFFSET (0x530) 26 23 #define BMG_G6_RESIDENCY_OFFSET (0x538)
+13
drivers/gpu/drm/xe/regs/xe_soc_remapper_regs.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* 3 + * Copyright © 2025 Intel Corporation 4 + */ 5 + #ifndef _XE_SOC_REMAPPER_REGS_H_ 6 + #define _XE_SOC_REMAPPER_REGS_H_ 7 + 8 + #include "xe_regs.h" 9 + 10 + #define SG_REMAP_INDEX1 XE_REG(SOC_BASE + 0x08) 11 + #define SG_REMAP_TELEM_MASK REG_GENMASK(31, 24) 12 + 13 + #endif
+5
drivers/gpu/drm/xe/xe_device_types.h
··· 334 334 u8 has_pxp:1; 335 335 /** @info.has_range_tlb_inval: Has range based TLB invalidations */ 336 336 u8 has_range_tlb_inval:1; 337 + /** @info.has_soc_remapper_telem: Has SoC remapper telemetry support */ 338 + u8 has_soc_remapper_telem:1; 337 339 /** @info.has_sriov: Supports SR-IOV */ 338 340 u8 has_sriov:1; 339 341 /** @info.has_usm: Device has unified shared memory support */ ··· 584 582 struct { 585 583 /** @soc_remapper.lock: Serialize access to SoC Remapper's index registers */ 586 584 spinlock_t lock; 585 + 586 + /** @soc_remapper.set_telem_region: Set telemetry index */ 587 + void (*set_telem_region)(struct xe_device *xe, u32 index); 587 588 } soc_remapper; 588 589 589 590 /**
+3
drivers/gpu/drm/xe/xe_pci.c
··· 370 370 .has_i2c = true, 371 371 .has_late_bind = true, 372 372 .has_pre_prod_wa = 1, 373 + .has_soc_remapper_telem = true, 373 374 .has_sriov = true, 374 375 .has_mem_copy_instr = true, 375 376 .max_gt_per_tile = 2, ··· 422 421 .has_mbx_power_limits = true, 423 422 .has_mert = true, 424 423 .has_pre_prod_wa = 1, 424 + .has_soc_remapper_telem = true, 425 425 .has_sriov = true, 426 426 .max_gt_per_tile = 2, 427 427 .require_force_probe = true, ··· 694 692 xe->info.has_page_reclaim_hw_assist = desc->has_page_reclaim_hw_assist; 695 693 xe->info.has_pre_prod_wa = desc->has_pre_prod_wa; 696 694 xe->info.has_pxp = desc->has_pxp; 695 + xe->info.has_soc_remapper_telem = desc->has_soc_remapper_telem; 697 696 xe->info.has_sriov = xe_configfs_primary_gt_allowed(to_pci_dev(xe->drm.dev)) && 698 697 desc->has_sriov; 699 698 xe->info.has_mem_copy_instr = desc->has_mem_copy_instr;
+1
drivers/gpu/drm/xe/xe_pci_types.h
··· 53 53 u8 has_pre_prod_wa:1; 54 54 u8 has_page_reclaim_hw_assist:1; 55 55 u8 has_pxp:1; 56 + u8 has_soc_remapper_telem:1; 56 57 u8 has_sriov:1; 57 58 u8 needs_scratch:1; 58 59 u8 skip_guc_pc:1;
+19 -1
drivers/gpu/drm/xe/xe_soc_remapper.c
··· 3 3 * Copyright © 2025 Intel Corporation 4 4 */ 5 5 6 + #include "regs/xe_soc_remapper_regs.h" 7 + #include "xe_mmio.h" 6 8 #include "xe_soc_remapper.h" 9 + 10 + static void xe_soc_remapper_set_region(struct xe_device *xe, struct xe_reg reg, 11 + u32 mask, u32 val) 12 + { 13 + guard(spinlock_irqsave)(&xe->soc_remapper.lock); 14 + xe_mmio_rmw32(xe_root_tile_mmio(xe), reg, mask, val); 15 + } 16 + 17 + static void xe_soc_remapper_set_telem_region(struct xe_device *xe, u32 index) 18 + { 19 + xe_soc_remapper_set_region(xe, SG_REMAP_INDEX1, SG_REMAP_TELEM_MASK, 20 + REG_FIELD_PREP(SG_REMAP_TELEM_MASK, index)); 21 + } 7 22 8 23 /** 9 24 * xe_soc_remapper_init() - Initialize SoC remapper ··· 30 15 */ 31 16 int xe_soc_remapper_init(struct xe_device *xe) 32 17 { 33 - spin_lock_init(&xe->soc_remapper.lock); 18 + if (xe->info.has_soc_remapper_telem) { 19 + spin_lock_init(&xe->soc_remapper.lock); 20 + xe->soc_remapper.set_telem_region = xe_soc_remapper_set_telem_region; 21 + } 34 22 35 23 return 0; 36 24 }
+4 -2
drivers/gpu/drm/xe/xe_vsec.c
··· 158 158 159 159 guard(mutex)(&xe->pmt.lock); 160 160 161 + if (!xe->soc_remapper.set_telem_region) 162 + return -ENODEV; 163 + 161 164 /* indicate that we are not at an appropriate power level */ 162 165 if (!xe_pm_runtime_get_if_active(xe)) 163 166 return -ENODATA; 164 167 165 168 /* set SoC re-mapper index register based on GUID memory region */ 166 - xe_mmio_rmw32(xe_root_tile_mmio(xe), SG_REMAP_INDEX1, SG_REMAP_BITS, 167 - REG_FIELD_PREP(SG_REMAP_BITS, mem_region)); 169 + xe->soc_remapper.set_telem_region(xe, mem_region); 168 170 169 171 memcpy_fromio(data, telem_addr, count); 170 172 xe_pm_runtime_put(xe);