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

drm/xe: move memirq out of VF

Up until now only VF used Memory Based Interrupts (memirq).
Moving it out of VF to cater for other usages, specifically MSI-X.

Signed-off-by: Ilia Levi <ilia.levi@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240918053942.1331811-4-illevi@habana.ai

authored by

Ilia Levi and committed by
Michal Wajdeczko
4157849c 6fa86e7a

+17 -20
+1 -1
drivers/gpu/drm/xe/xe_device.c
··· 676 676 err = xe_ggtt_init_early(tile->mem.ggtt); 677 677 if (err) 678 678 return err; 679 - err = xe_memirq_init(&tile->sriov.vf.memirq); 679 + err = xe_memirq_init(&tile->memirq); 680 680 if (err) 681 681 return err; 682 682 }
+3 -3
drivers/gpu/drm/xe/xe_device_types.h
··· 226 226 struct xe_lmtt lmtt; 227 227 } pf; 228 228 struct { 229 - /** @sriov.vf.memirq: Memory Based Interrupts. */ 230 - struct xe_memirq memirq; 231 - 232 229 /** @sriov.vf.ggtt_balloon: GGTT regions excluded from use. */ 233 230 struct xe_ggtt_node *ggtt_balloon[2]; 234 231 } vf; 235 232 } sriov; 233 + 234 + /** @memirq: Memory Based Interrupts. */ 235 + struct xe_memirq memirq; 236 236 237 237 /** @pcode: tile's PCODE */ 238 238 struct {
+1 -1
drivers/gpu/drm/xe/xe_guc.c
··· 866 866 struct xe_gt *gt = guc_to_gt(guc); 867 867 struct xe_tile *tile = gt_to_tile(gt); 868 868 869 - err = xe_memirq_init_guc(&tile->sriov.vf.memirq, guc); 869 + err = xe_memirq_init_guc(&tile->memirq, guc); 870 870 if (err) 871 871 return err; 872 872 } else {
+3 -3
drivers/gpu/drm/xe/xe_irq.c
··· 567 567 568 568 for_each_tile(tile, xe, id) { 569 569 if (xe_device_has_memirq(xe)) 570 - xe_memirq_reset(&tile->sriov.vf.memirq); 570 + xe_memirq_reset(&tile->memirq); 571 571 else 572 572 gt_irq_reset(tile); 573 573 } ··· 610 610 611 611 for_each_tile(tile, xe, id) 612 612 if (xe_device_has_memirq(xe)) 613 - xe_memirq_postinstall(&tile->sriov.vf.memirq); 613 + xe_memirq_postinstall(&tile->memirq); 614 614 615 615 if (GRAPHICS_VERx100(xe) < 1210) 616 616 xelp_intr_enable(xe, true); ··· 653 653 spin_unlock(&xe->irq.lock); 654 654 655 655 for_each_tile(tile, xe, id) 656 - xe_memirq_handler(&tile->sriov.vf.memirq); 656 + xe_memirq_handler(&tile->memirq); 657 657 658 658 return IRQ_HANDLED; 659 659 }
+1 -1
drivers/gpu/drm/xe/xe_lrc.c
··· 599 599 600 600 static void set_memory_based_intr(u32 *regs, struct xe_hw_engine *hwe) 601 601 { 602 - struct xe_memirq *memirq = &gt_to_tile(hwe->gt)->sriov.vf.memirq; 602 + struct xe_memirq *memirq = &gt_to_tile(hwe->gt)->memirq; 603 603 struct xe_device *xe = gt_to_xe(hwe->gt); 604 604 605 605 if (!xe_device_uses_memirq(xe))
+8 -11
drivers/gpu/drm/xe/xe_memirq.c
··· 19 19 #include "xe_hw_engine.h" 20 20 #include "xe_map.h" 21 21 #include "xe_memirq.h" 22 - #include "xe_sriov.h" 23 22 24 23 #define memirq_assert(m, condition) xe_tile_assert(memirq_to_tile(m), condition) 25 24 #define memirq_printk(m, _level, _fmt, ...) \ ··· 37 38 38 39 static struct xe_tile *memirq_to_tile(struct xe_memirq *memirq) 39 40 { 40 - return container_of(memirq, struct xe_tile, sriov.vf.memirq); 41 + return container_of(memirq, struct xe_tile, memirq); 41 42 } 42 43 43 44 static struct xe_device *memirq_to_xe(struct xe_memirq *memirq) ··· 187 188 * 188 189 * These allocations are managed and will be implicitly released on unload. 189 190 * 190 - * Note: This function shall be called only by the VF driver. 191 - * 192 - * If this function fails then VF driver won't be able to operate correctly. 191 + * If this function fails then the driver won't be able to operate correctly. 193 192 * If `Memory Based Interrupts`_ are not used this function will return 0. 194 193 * 195 194 * Return: 0 on success or a negative error code on failure. ··· 214 217 * xe_memirq_source_ptr - Get GGTT's offset of the `Interrupt Source Report Page`_. 215 218 * @memirq: the &xe_memirq to query 216 219 * 217 - * Shall be called only on VF driver when `Memory Based Interrupts`_ are used 220 + * Shall be called when `Memory Based Interrupts`_ are used 218 221 * and xe_memirq_init() didn't fail. 219 222 * 220 223 * Return: GGTT's offset of the `Interrupt Source Report Page`_. ··· 231 234 * xe_memirq_status_ptr - Get GGTT's offset of the `Interrupt Status Report Page`_. 232 235 * @memirq: the &xe_memirq to query 233 236 * 234 - * Shall be called only on VF driver when `Memory Based Interrupts`_ are used 237 + * Shall be called when `Memory Based Interrupts`_ are used 235 238 * and xe_memirq_init() didn't fail. 236 239 * 237 240 * Return: GGTT's offset of the `Interrupt Status Report Page`_. ··· 248 251 * xe_memirq_enable_ptr - Get GGTT's offset of the Interrupt Enable Mask. 249 252 * @memirq: the &xe_memirq to query 250 253 * 251 - * Shall be called only on VF driver when `Memory Based Interrupts`_ are used 254 + * Shall be called when `Memory Based Interrupts`_ are used 252 255 * and xe_memirq_init() didn't fail. 253 256 * 254 257 * Return: GGTT's offset of the Interrupt Enable Mask. ··· 269 272 * Register `Interrupt Source Report Page`_ and `Interrupt Status Report Page`_ 270 273 * to be used by the GuC when `Memory Based Interrupts`_ are required. 271 274 * 272 - * Shall be called only on VF driver when `Memory Based Interrupts`_ are used 275 + * Shall be called when `Memory Based Interrupts`_ are used 273 276 * and xe_memirq_init() didn't fail. 274 277 * 275 278 * Return: 0 on success or a negative error code on failure. ··· 311 314 * 312 315 * This is part of the driver IRQ setup flow. 313 316 * 314 - * This function shall only be used by the VF driver on platforms that use 317 + * This function shall only be used on platforms that use 315 318 * `Memory Based Interrupts`_. 316 319 */ 317 320 void xe_memirq_reset(struct xe_memirq *memirq) ··· 328 331 * 329 332 * This is part of the driver IRQ setup flow. 330 333 * 331 - * This function shall only be used by the VF driver on platforms that use 334 + * This function shall only be used on platforms that use 332 335 * `Memory Based Interrupts`_. 333 336 */ 334 337 void xe_memirq_postinstall(struct xe_memirq *memirq)