drm/xe: Remove double pageflip
PATCH 1/10 drm/xe: Remove double pageflip
This is already handled below by fixup_initial_plane_config.
--- drivers/gpu/drm/xe/display/xe_plane_initial.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/gpu/drm/xe/display/xe_plane_initial.c +0 -10
@@ -194,8 +194,6 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,to_intel_plane (crtc->base.primary);struct intel_plane_state *plane_state =to_intel_plane_state (plane->base.state); -struct intel_crtc_state *crtc_state = -to_intel_crtc_state (crtc->base.state);struct drm_framebuffer *fb;struct i915_vma *vma;
@@ -241,14 +239,6 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc,atomic_or (plane->frontbuffer_bit, &to_intel_frontbuffer (fb)->bits); plane_config->vma = vma; - -/* -* Flip to the newly created mapping ASAP, so we can re-use the -* first part of GGTT for WOPCM, prevent flickering, and prevent -* the lookup of sysmem scratch pages. -*/ - plane->check_plane (crtc_state, plane_state); - plane->async_flip (NULL , plane, crtc_state, plane_state, true);return ; nofb:
Signature · 1 line
2.45.2
PATCH 2/10 drm/xe/display: Add intel_plane_initial_vblank_wait
We're changing the driver to have no interrupts during early init for Xe, so we poll the PIPE_FRMSTMSMP counter instead.
--- drivers/gpu/drm/i915/display/intel_display.c | 6 +++--- .../drm/i915/display/intel_plane_initial.c | 9 ++++++++- .../drm/i915/display/intel_plane_initial.h | 1 + drivers/gpu/drm/xe/display/xe_plane_initial.c | 19 ++++++++++++++++++- 4 files changed, 30 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +3 -3
@@ -794,7 +794,7 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc,if ((crtc_state->active_planes & ~BIT (PLANE_CURSOR )) ==0 &&hsw_ips_disable (crtc_state)) { crtc_state->ips_enabled = false; -intel_crtc_wait_for_next_vblank (crtc); +intel_plane_initial_vblank_wait (plane); }/*
@@ -808,7 +808,7 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc,*/ if (HAS_GMCH (dev_priv) &&intel_set_memory_cxsr (dev_priv, false)) -intel_crtc_wait_for_next_vblank (crtc); +intel_plane_initial_vblank_wait (plane);/* * Gen2 reports pipe underruns whenever all planes are disabled.
@@ -818,7 +818,7 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc,intel_set_cpu_fifo_underrun_reporting (dev_priv, crtc->pipe, false);intel_plane_disable_arm (NULL , plane, crtc_state); -intel_crtc_wait_for_next_vblank (crtc); +intel_plane_initial_vblank_wait (plane); }unsigned int
drivers/gpu/drm/i915/display/intel_plane_initial.c +8 -1
@@ -14,6 +14,13 @@#include "intel_frontbuffer.h" #include "intel_plane_initial.h" +void intel_plane_initial_vblank_wait(plane);(struct intel_plane *plane) +{ + struct intel_crtc *crtc = intel_crtc_for_pipe(to_intel_display(plane), plane->pipe); + + intel_crtc_wait_for_next_vblank(crtc); +} + static bool intel_reuse_initial_plane_obj(struct intel_crtc *this, const struct intel_initial_plane_config plane_configs[],
@@ -438,7 +445,7 @@ void intel_initial_plane_config(struct drm_i915_private *i915)intel_find_initial_plane_obj (crtc, plane_configs);if (i915->display.funcs.display->fixup_initial_plane_config (crtc, plane_config)) -intel_crtc_wait_for_next_vblank (crtc); +intel_initial_vblank_wait (crtc);plane_config_fini (plane_config); }
drivers/gpu/drm/i915/display/intel_plane_initial.h +1 -0
@@ -8,6 +8,7 @@struct drm_i915_private ; +void intel_plane_initial_vblank_wait (struct intel_plane *plane);void intel_initial_plane_config (struct drm_i915_private *i915);#endif
drivers/gpu/drm/xe/display/xe_plane_initial.c +18 -1
@@ -8,7 +8,9 @@#include "regs/xe_gtt_defs.h" #include "xe_ggtt.h" +#include "xe_mmio.h" +#include "i915_reg.h" #include "intel_atomic_plane.h" #include "intel_crtc.h" #include "intel_display.h"
@@ -22,6 +24,21 @@#include <generated/xe_wa_oob.h> +void intel_plane_initial_vblank_wait (struct intel_plane *plane) +{ +/* Early xe has no irq */ +struct xe_device *xe =to_xe_device (plane->base.dev); +struct xe_reg pipe_frmtmstmp =XE_REG (i915_mmio_reg_offset (PIPE_FRMTMSTMP (plane->pipe))); +u32 timestamp; +int ret; + + timestamp =xe_mmio_read32 (xe_root_tile_mmio (xe), pipe_frmtmstmp); + + ret =xe_mmio_wait32_not (xe_root_tile_mmio (xe), pipe_frmtmstmp, ~0U , timestamp,40000U , ×tamp, false); +if (ret <0 ) +drm_warn (&xe->drm,"waiting for early vblank failed with %i\n" , ret); +} + static bool intel_reuse_initial_plane_obj(struct intel_crtc *this, const struct intel_initial_plane_config plane_configs[],
@@ -293,7 +310,7 @@ void intel_initial_plane_config(struct drm_i915_private *i915)intel_find_initial_plane_obj (crtc, plane_configs);if (i915->display.funcs.display->fixup_initial_plane_config (crtc, plane_config)) -intel_crtc_wait_for_next_vblank (crtc); +intel_plane_initial_vblank_wait (to_intel_plane (crtc->base.primary));plane_config_fini (plane_config); }
Signature · 1 line
2.45.2
PATCH 3/10 drm/xe: Move suballocator init to after display init
In reply to Maarten LankhorstNo allocations should be done before we have had a chance to preserve the display fb.
--- drivers/gpu/drm/xe/xe_device.c | 6 ++++++ drivers/gpu/drm/xe/xe_tile.c | 12 ++++++++---- drivers/gpu/drm/xe/xe_tile.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_device.c +6 -0
@@ -739,6 +739,12 @@ int xe_device_probe(struct xe_device *xe)if (err) goto err; +for_each_tile (tile, xe, id) { + err =xe_tile_init (tile); +if (err) + goto err; + } +for_each_gt (gt, xe, id) { last_gt = id;
drivers/gpu/drm/xe/xe_tile.c +8 -4
@@ -170,10 +170,6 @@ int xe_tile_init_noalloc(struct xe_tile *tile)if (err)return err; - tile->mem.kernel_bb_pool =xe_sa_bo_manager_init (tile,SZ_1M ,16 ); -if (IS_ERR (tile->mem.kernel_bb_pool)) -return PTR_ERR (tile->mem.kernel_bb_pool); -xe_wa_apply_tile_workarounds (tile); err =xe_tile_sysfs_init (tile);
@@ -181,6 +177,14 @@ int xe_tile_init_noalloc(struct xe_tile *tile)return 0 ; } +int xe_tile_init (struct xe_tile *tile) +{ + tile->mem.kernel_bb_pool =xe_sa_bo_manager_init (tile,SZ_1M ,16 ); +if (IS_ERR (tile->mem.kernel_bb_pool)) +return PTR_ERR (tile->mem.kernel_bb_pool); + +return 0 ; +}void xe_tile_migrate_wait (struct xe_tile *tile) {xe_migrate_wait (tile->migrate);
drivers/gpu/drm/xe/xe_tile.h +1 -0
@@ -12,6 +12,7 @@ struct xe_tile;int xe_tile_init_early (struct xe_tile *tile,struct xe_device *xe,u8 id);int xe_tile_init_noalloc (struct xe_tile *tile); +int xe_tile_init (struct xe_tile *tile);void xe_tile_migrate_wait (struct xe_tile *tile);
Signature · 1 line
2.45.2
PATCH 4/10 drm/xe: Defer irq init until after xe_display_init_noaccel
In reply to Maarten LankhorstTechnically, I believe this means that xe_display_init_noirq and xe_display_init_noaccel can be merged together now.
--- drivers/gpu/drm/xe/xe_device.c | 12 ++++-------- drivers/gpu/drm/xe/xe_tile.c | 7 +++++++ 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/xe/xe_device.c +4 -8
@@ -41,7 +41,6 @@#include "xe_hw_engine_group.h" #include "xe_hwmon.h" #include "xe_irq.h" -#include "xe_memirq.h" #include "xe_mmio.h" #include "xe_module.h" #include "xe_observation.h"
@@ -682,9 +681,6 @@ int xe_device_probe(struct xe_device *xe) err =xe_ggtt_init_early (tile->mem.ggtt);if (err)return err; - err =xe_memirq_init (&tile->memirq); -if (err) -return err; }for_each_gt (gt, xe, id) {
@@ -704,10 +700,6 @@ int xe_device_probe(struct xe_device *xe)if (err)return err; - err =xe_irq_install (xe); -if (err) - goto err; - err =probe_has_flat_ccs (xe);if (err) goto err;
@@ -745,6 +737,10 @@ int xe_device_probe(struct xe_device *xe) goto err; } + err =xe_irq_install (xe); +if (err) + goto err; +for_each_gt (gt, xe, id) { last_gt = id;
drivers/gpu/drm/xe/xe_tile.c +7 -0
@@ -10,6 +10,7 @@#include "xe_device.h" #include "xe_ggtt.h" #include "xe_gt.h" +#include "xe_memirq.h" #include "xe_migrate.h" #include "xe_pcode.h" #include "xe_sa.h"
@@ -179,6 +180,12 @@ int xe_tile_init_noalloc(struct xe_tile *tile)int xe_tile_init (struct xe_tile *tile) { +int err; + + err =xe_memirq_init (&tile->memirq); +if (err) +return err; + tile->mem.kernel_bb_pool =xe_sa_bo_manager_init (tile,SZ_1M ,16 );if (IS_ERR (tile->mem.kernel_bb_pool))return PTR_ERR (tile->mem.kernel_bb_pool);
Signature · 1 line
2.45.2
PATCH 5/10 drm/xe/display: Use a single early init call for display
In reply to Maarten LankhorstInstead of 3 different calls, it should be safe to unify to a single call now. This makes the init sequence cleaner, and display less tangled.
--- drivers/gpu/drm/xe/display/xe_display.c | 72 +++++++------------------ drivers/gpu/drm/xe/display/xe_display.h | 8 +-- drivers/gpu/drm/xe/xe_device.c | 10 +--- 3 files changed, 23 insertions(+), 67 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +20 -52
@@ -100,31 +100,7 @@ int xe_display_create(struct xe_device *xe)return drmm_add_action_or_reset (&xe->drm, display_destroy,NULL ); } -static void xe_display_fini_nommio (struct drm_device *dev,void *dummy) -{ -struct xe_device *xe =to_xe_device (dev); - -if (!xe->info.probe_display) -return ; - -intel_power_domains_cleanup (xe); -} - -int xe_display_init_nommio (struct xe_device *xe) -{ -if (!xe->info.probe_display) -return 0 ; - -/* Fake uncore lock */ -spin_lock_init (&xe->uncore.lock); - -/* This must be called before any calls to HAS_PCH_* */ -intel_detect_pch (xe); - -return drmm_add_action_or_reset (&xe->drm, xe_display_fini_nommio, xe); -} - -static void xe_display_fini_noirq (void *arg) +static void xe_display_fini_early (void *arg) {struct xe_device *xe = arg;struct intel_display *display = &xe->display;
@@ -132,11 +108,13 @@ static void xe_display_fini_noirq(void *arg)if (!xe->info.probe_display)return ; +intel_display_driver_remove_nogem (xe);intel_display_driver_remove_noirq (xe);intel_opregion_cleanup (display); +intel_power_domains_cleanup (xe); } -int xe_display_init_noirq (struct xe_device *xe) +int xe_display_init_early (struct xe_device *xe) {struct intel_display *display = &xe->display;int err;
@@ -144,6 +122,12 @@ int xe_display_init_noirq(struct xe_device *xe)if (!xe->info.probe_display)return 0 ; +/* Fake uncore lock */ +spin_lock_init (&xe->uncore.lock); + +/* This must be called before any calls to HAS_PCH_* */ +intel_detect_pch (xe); +intel_display_driver_early_probe (xe);/* Early display init.. */
@@ -160,36 +144,20 @@ int xe_display_init_noirq(struct xe_device *xe)intel_display_device_info_runtime_init (xe); err =intel_display_driver_probe_noirq (xe); -if (err) { -intel_opregion_cleanup (display); -return err; - } - -return devm_add_action_or_reset (xe->drm.dev, xe_display_fini_noirq, xe); -} - -static void xe_display_fini_noaccel (void *arg) -{ -struct xe_device *xe = arg; - -if (!xe->info.probe_display) -return ; - -intel_display_driver_remove_nogem (xe); -} - -int xe_display_init_noaccel (struct xe_device *xe) -{ -int err; - -if (!xe->info.probe_display) -return 0 ; +if (err) + goto err_opregion; err =intel_display_driver_probe_nogem (xe);if (err) -return err; + goto err_noirq; -return devm_add_action_or_reset (xe->drm.dev, xe_display_fini_noaccel, xe); +return devm_add_action_or_reset (xe->drm.dev, xe_display_fini_early, xe); +err_noirq: +intel_display_driver_remove_noirq (xe); +intel_power_domains_cleanup (xe); +err_opregion: +intel_opregion_cleanup (display); +return err; }int xe_display_init (struct xe_device *xe)
drivers/gpu/drm/xe/display/xe_display.h +2 -6
@@ -20,9 +20,7 @@ int xe_display_create(struct xe_device *xe);int xe_display_probe (struct xe_device *xe); -int xe_display_init_nommio (struct xe_device *xe); -int xe_display_init_noirq (struct xe_device *xe); -int xe_display_init_noaccel (struct xe_device *xe); +int xe_display_init_early (struct xe_device *xe);int xe_display_init (struct xe_device *xe);void xe_display_fini (struct xe_device *xe);
@@ -53,9 +51,7 @@ static inline int xe_display_create(struct xe_device *xe) { return 0; }static inline int xe_display_probe (struct xe_device *xe) {return 0 ; } -static inline int xe_display_init_nommio (struct xe_device *xe) {return 0 ; } -static inline int xe_display_init_noirq (struct xe_device *xe) {return 0 ; } -static inline int xe_display_init_noaccel (struct xe_device *xe) {return 0 ; } +static inline int xe_display_init_early (struct xe_device *xe) {return 0 ; }static inline int xe_display_init (struct xe_device *xe) {return 0 ; }static inline void xe_display_fini (struct xe_device *xe) {}
drivers/gpu/drm/xe/xe_device.c +1 -9
@@ -641,10 +641,6 @@ int xe_device_probe(struct xe_device *xe)return err; xe->info.mem_region_mask =1 ; - err =xe_display_init_nommio (xe); -if (err) -return err; - err =xe_set_dma_info (xe);if (err)return err;
@@ -696,10 +692,6 @@ int xe_device_probe(struct xe_device *xe)if (err)return err; - err =xe_display_init_noirq (xe); -if (err) -return err; - err =probe_has_flat_ccs (xe);if (err) goto err;
@@ -727,7 +719,7 @@ int xe_device_probe(struct xe_device *xe)* This is the reason the first allocation needs to be done * inside display. */ - err =xe_display_init_noaccel (xe); + err =xe_display_init_early (xe);if (err) goto err;
Signature · 1 line
2.45.2
PATCH 6/10 drm/xe/sriov: Move VF bootstrap and query_config to vf_guc_init
In reply to Maarten LankhorstWe want to split up GUC init to an alloc and noalloc part to keep the init path the same for VF and !VF as much as possible.
Everything in vf_guc_init should be done as early as possible, otherwise VRAM probing becomes impossible.
--- drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 1 - drivers/gpu/drm/xe/xe_guc.c | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/xe/xe_gt_sriov_vf.c +0 -1
@@ -885,7 +885,6 @@ u32 xe_gt_sriov_vf_read32(struct xe_gt *gt, struct xe_reg reg)struct vf_runtime_reg *rr;xe_gt_assert (gt,IS_SRIOV_VF (gt_to_xe (gt))); -xe_gt_assert (gt, gt->sriov.vf.pf_version.major);xe_gt_assert (gt, !reg.vf);if (reg.addr ==GMD_ID .addr) {
drivers/gpu/drm/xe/xe_guc.c +9 -8
@@ -300,6 +300,7 @@ static int xe_guc_realloc_post_hwconfig(struct xe_guc *guc)static int vf_guc_init (struct xe_guc *guc) { +struct xe_gt *gt =guc_to_gt (guc);int err;xe_guc_comm_init_early (guc);
@@ -312,6 +313,14 @@ static int vf_guc_init(struct xe_guc *guc)if (err)return err; + err =xe_gt_sriov_vf_bootstrap (gt); +if (err) +return err; + + err =xe_gt_sriov_vf_query_config (gt); +if (err) +return err; +return 0 ; }
@@ -752,14 +761,6 @@ static int vf_guc_min_load_for_hwconfig(struct xe_guc *guc)struct xe_gt *gt =guc_to_gt (guc);int ret; - ret =xe_gt_sriov_vf_bootstrap (gt); -if (ret) -return ret; - - ret =xe_gt_sriov_vf_query_config (gt); -if (ret) -return ret; - ret =xe_guc_hwconfig_init (guc);if (ret)return ret;
Signature · 1 line
2.45.2
PATCH 7/10 drm/xe: Simplify GuC early initialisation
In reply to Maarten LankhorstAdd a 2-stage GuC init. An early one for everything that is needed for VF, and a full one that loads GuC and is allowed to do allocations.
--- drivers/gpu/drm/xe/tests/xe_guc_relay_test.c | 2 +- drivers/gpu/drm/xe/xe_device.c | 16 ------ drivers/gpu/drm/xe/xe_gt.c | 9 +++- drivers/gpu/drm/xe/xe_guc.c | 51 ++++++++++++-------- drivers/gpu/drm/xe/xe_guc.h | 1 + drivers/gpu/drm/xe/xe_guc_ct.c | 28 +++++++---- drivers/gpu/drm/xe/xe_guc_ct.h | 1 + drivers/gpu/drm/xe/xe_guc_relay.c | 6 +-- drivers/gpu/drm/xe/xe_guc_relay.h | 2 +- drivers/gpu/drm/xe/xe_huc.h | 1 + drivers/gpu/drm/xe/xe_uc.c | 21 ++++++++ drivers/gpu/drm/xe/xe_uc.h | 1 + 12 files changed, 88 insertions(+), 51 deletions(-)
drivers/gpu/drm/xe/tests/xe_guc_relay_test.c +1 -1
@@ -42,7 +42,7 @@ static int relay_test_init(struct kunit *test)kunit_activate_static_stub (test, relay_get_totalvfs, replacement_relay_get_totalvfs); -KUNIT_ASSERT_EQ (test,xe_guc_relay_init (relay),0 ); +KUNIT_ASSERT_EQ (test,xe_guc_relay_init_noalloc (relay),0 );KUNIT_EXPECT_TRUE (test,relay_is_ready (relay)); relay->last_rid =TEST_RID -1 ;
drivers/gpu/drm/xe/xe_device.c +0 -16
@@ -655,25 +655,9 @@ int xe_device_probe(struct xe_device *xe) err =xe_gt_init_early (gt);if (err)return err; - -/* -* Only after this point can GT-specific MMIO operations -* (including things like communication with the GuC) -* be performed. -*/ -xe_gt_mmio_init (gt); }for_each_tile (tile, xe, id) { -if (IS_SRIOV_VF (xe)) { -xe_guc_comm_init_early (&tile->primary_gt->uc.guc); - err =xe_gt_sriov_vf_bootstrap (tile->primary_gt); -if (err) -return err; - err =xe_gt_sriov_vf_query_config (tile->primary_gt); -if (err) -return err; - } err =xe_ggtt_init_early (tile->mem.ggtt);if (err)return err;
drivers/gpu/drm/xe/xe_gt.c +8 -1
@@ -386,7 +386,14 @@ int xe_gt_init_early(struct xe_gt *gt)xe_force_wake_init_gt (gt,gt_to_fw (gt));spin_lock_init (>->global_invl_lock); -return 0 ; +/* +* Only after this point can GT-specific MMIO operations +* (including things like communication with the GuC) +* be performed. +*/ +xe_gt_mmio_init (gt); + +return xe_uc_init_noalloc (>->uc); }static void dump_pat_on_error (struct xe_gt *gt)
drivers/gpu/drm/xe/xe_guc.c +32 -19
90 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc.h +1 -0
@@ -26,6 +26,7 @@struct drm_printer ;void xe_guc_comm_init_early (struct xe_guc *guc); +int xe_guc_init_noalloc (struct xe_guc *guc);int xe_guc_init (struct xe_guc *guc);int xe_guc_init_post_hwconfig (struct xe_guc *guc);int xe_guc_post_load_init (struct xe_guc *guc);
drivers/gpu/drm/xe/xe_guc_ct.c +18 -10
@@ -203,12 +203,10 @@ static void primelockdep(struct xe_guc_ct *ct)fs_reclaim_release (GFP_KERNEL ); } -int xe_guc_ct_init (struct xe_guc_ct *ct) +int xe_guc_ct_init_noalloc (struct xe_guc_ct *ct) {struct xe_device *xe =ct_to_xe (ct);struct xe_gt *gt =ct_to_gt (ct); -struct xe_tile *tile =gt_to_tile (gt); -struct xe_bo *bo;int err;xe_gt_assert (gt, !(guc_ct_size () %PAGE_SIZE ));
@@ -234,6 +232,23 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)primelockdep (ct); + err =drmm_add_action_or_reset (&xe->drm, guc_ct_fini, ct); +if (err) +return err; + +xe_gt_assert (gt, ct->state ==XE_GUC_CT_STATE_NOT_INITIALIZED ); + ct->state =XE_GUC_CT_STATE_DISABLED ; +return 0 ; +} +ALLOW_ERROR_INJECTION (xe_guc_ct_init_noalloc,ERRNO );/* See xe_pci_probe() */ + +int xe_guc_ct_init (struct xe_guc_ct *ct) +{ +struct xe_device *xe =ct_to_xe (ct); +struct xe_gt *gt =ct_to_gt (ct); +struct xe_tile *tile =gt_to_tile (gt); +struct xe_bo *bo; + bo = xe_managed_bo_create_pin_map(xe, tile, guc_ct_size(), XE_BO_FLAG_SYSTEM | XE_BO_FLAG_GGTT |
@@ -242,13 +257,6 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)return PTR_ERR (bo); ct->bo = bo; - - err =drmm_add_action_or_reset (&xe->drm, guc_ct_fini, ct); -if (err) -return err; - -xe_gt_assert (gt, ct->state ==XE_GUC_CT_STATE_NOT_INITIALIZED ); - ct->state =XE_GUC_CT_STATE_DISABLED ;return 0 ; }ALLOW_ERROR_INJECTION (xe_guc_ct_init,ERRNO );/* See xe_pci_probe() */
drivers/gpu/drm/xe/xe_guc_ct.h +1 -0
@@ -11,6 +11,7 @@struct drm_printer ;struct xe_device ; +int xe_guc_ct_init_noalloc (struct xe_guc_ct *ct);int xe_guc_ct_init (struct xe_guc_ct *ct);int xe_guc_ct_enable (struct xe_guc_ct *ct);void xe_guc_ct_disable (struct xe_guc_ct *ct);
drivers/gpu/drm/xe/xe_guc_relay.c +3 -3
@@ -322,7 +322,7 @@ static void __fini_relay(struct drm_device *drm, void *arg) }/** -* xe_guc_relay_init - Initialize a &xe_guc_relay +* xe_guc_relay_init_noalloc - Initialize a &xe_guc_relay * @relay: the &xe_guc_relay to initialize * * Initialize remaining members of &xe_guc_relay that may depend
@@ -330,7 +330,7 @@ static void __fini_relay(struct drm_device *drm, void *arg)* * Return: 0 on success or a negative error code on failure. */ -int xe_guc_relay_init (struct xe_guc_relay *relay) +int xe_guc_relay_init_noalloc (struct xe_guc_relay *relay) {const int XE_RELAY_MEMPOOL_MIN_NUM =1 ;struct xe_device *xe =relay_to_xe (relay);
@@ -356,7 +356,7 @@ int xe_guc_relay_init(struct xe_guc_relay *relay)return drmm_add_action_or_reset (&xe->drm, __fini_relay, relay); } -ALLOW_ERROR_INJECTION (xe_guc_relay_init,ERRNO );/* See xe_pci_probe() */ +ALLOW_ERROR_INJECTION (xe_guc_relay_init_noalloc,ERRNO );/* See xe_pci_probe() */ static u32 to_relay_error (int err) {
drivers/gpu/drm/xe/xe_guc_relay.h +1 -1
@@ -11,7 +11,7 @@struct xe_guc_relay ; -int xe_guc_relay_init (struct xe_guc_relay *relay); +int xe_guc_relay_init_noalloc (struct xe_guc_relay *relay);int xe_guc_relay_send_to_pf (struct xe_guc_relay *relay,const u32 *msg,u32 len,u32 *buf,u32 buf_size);
drivers/gpu/drm/xe/xe_huc.h +1 -0
@@ -17,6 +17,7 @@ enum xe_huc_auth_types { XE_HUC_AUTH_TYPES_COUNT }; +int xe_huc_init_noalloc (struct xe_huc *huc);int xe_huc_init (struct xe_huc *huc);int xe_huc_init_post_hwconfig (struct xe_huc *huc);int xe_huc_upload (struct xe_huc *huc);
drivers/gpu/drm/xe/xe_uc.c +21 -0
@@ -32,6 +32,27 @@ uc_to_xe(struct xe_uc *uc) }/* Should be called once at driver load only */ +int xe_uc_init_noalloc (struct xe_uc *uc) +{ +int ret; + +/* +* We call the GuC/HuC/GSC init functions even if GuC submission is off +* to correctly move our tracking of the FW state to "disabled". +*/ + ret =xe_guc_init_noalloc (&uc->guc); +if (ret) + goto err; + +/* HuC and GSC have no early dependencies and can be completely initialised during full xe_uc_init(). */ + +return 0 ; + +err: +xe_gt_err (uc_to_gt (uc),"Failed to early initialize uC (%pe)\n" ,ERR_PTR (ret)); +return ret; +} +int xe_uc_init (struct xe_uc *uc) {int ret;
drivers/gpu/drm/xe/xe_uc.h +1 -0
@@ -8,6 +8,7 @@struct xe_uc ; +int xe_uc_init_noalloc (struct xe_uc *uc);int xe_uc_init (struct xe_uc *uc);int xe_uc_init_hwconfig (struct xe_uc *uc);int xe_uc_init_post_hwconfig (struct xe_uc *uc);
Signature · 1 line
2.45.2
PATCH 8/10 drm/xe: Make it possible to read instance0 MCR registers after xe_gt_mcr_init_early
In reply to Maarten LankhorstAfter mcr_init_early, we need to be able to do VRAM and CCS probing without hwconfig probe. Fortunately the relevant registers are all instance 0, which fortunately means no dependencies on further initialisation is required.
--- drivers/gpu/drm/xe/xe_gt_mcr.c | 47 ++++++++++++++++++-------------- drivers/gpu/drm/xe/xe_gt_types.h | 2 ++ 2 files changed, 29 insertions(+), 20 deletions(-)
drivers/gpu/drm/xe/xe_gt_mcr.c +27 -20
@@ -413,12 +413,6 @@ static void init_steering_sqidi_psmi(struct xe_gt *gt) gt->steering[SQIDI_PSMI ].instance_target = select &0x1 ; } -static void init_steering_inst0 (struct xe_gt *gt) -{ - gt->steering[INSTANCE0 ].group_target =0 ;/* unused */ - gt->steering[INSTANCE0 ].instance_target =0 ;/* unused */ -} - static const struct { const char *name; void (*init)(struct xe_gt *gt);
@@ -429,7 +423,7 @@ static const struct { [DSS] = { "DSS", init_steering_dss }, [OADDRM] = { "OADDRM / GPMXMT", init_steering_oaddrm }, [SQIDI_PSMI] = { "SQIDI_PSMI", init_steering_sqidi_psmi }, - [INSTANCE0] = { "INSTANCE 0", init_steering_inst0 }, + [INSTANCE0] = { "INSTANCE 0", NULL }, [IMPLICIT_STEERING] = { "IMPLICIT", NULL }, };
@@ -439,25 +433,17 @@ static const struct {* * Perform early software only initialization of the MCR lock to allow * the synchronization on accessing the STEER_SEMAPHORE register and -* use the xe_gt_mcr_multicast_write() function. +* use the xe_gt_mcr_multicast_write() function, plus the minimum +* safe MCR registers required for VRAM/CCS probing. */ void xe_gt_mcr_init_early (struct xe_gt *gt) { +struct xe_device *xe =gt_to_xe (gt); +BUILD_BUG_ON (IMPLICIT_STEERING +1 !=NUM_STEERING_TYPES );BUILD_BUG_ON (ARRAY_SIZE (xe_steering_types) !=NUM_STEERING_TYPES );spin_lock_init (>->mcr_lock); -} - -/** -* xe_gt_mcr_init - Normal initialization of the MCR support -* @gt: GT structure -* -* Perform normal initialization of the MCR for all usages. -*/ -void xe_gt_mcr_init (struct xe_gt *gt) -{ -struct xe_device *xe =gt_to_xe (gt);if (IS_SRIOV_VF (xe))return ;
@@ -498,10 +484,27 @@ void xe_gt_mcr_init(struct xe_gt *gt) } } +/* Mark instance 0 as initialised, we need this early for VRAM and CCS probe. */ + gt->steering[INSTANCE0 ].initialised = true; +} + +/** +* xe_gt_mcr_init - Normal initialization of the MCR support +* @gt: GT structure +* +* Perform normal initialization of the MCR for all usages. +*/ +void xe_gt_mcr_init (struct xe_gt *gt) +{ +if (IS_SRIOV_VF (gt_to_xe (gt))) +return ; +/* Select non-terminated steering target for each type */ -for (int i =0 ; i <NUM_STEERING_TYPES ; i++) +for (int i =0 ; i <NUM_STEERING_TYPES ; i++) { + gt->steering[i].initialised = true;if (gt->steering[i].ranges && xe_steering_types[i].init) xe_steering_types[i].init (gt); + } }/**
@@ -563,6 +566,10 @@ static bool xe_gt_mcr_get_nonterminated_steering(struct xe_gt *gt,for (int i =0 ; gt->steering[type].ranges[i].end >0 ; i++) {if (xe_mmio_in_range (>->mmio, >->steering[type].ranges[i], reg)) { +drm_WARN (>_to_xe (gt)->drm, !gt->steering[type].initialised, +"Uninitialised usage of MCR register %s/%#x\n" , + xe_steering_types[type].name, reg.addr); + *group = gt->steering[type].group_target; *instance = gt->steering[type].instance_target;return true;
drivers/gpu/drm/xe/xe_gt_types.h +2 -0
@@ -375,6 +375,8 @@ struct xe_gt {u16 group_target;/** @steering.instance_target: instance to steer accesses to */ u16 instance_target; +/** @steering.initialised: Whether this steering range is initialised */ +bool initialised; } steering[NUM_STEERING_TYPES ];/**
Signature · 1 line
2.45.2
PATCH 9/10 drm/xe: Split init of xe_gt_init_hwconfig to xe_gt_init and *_early
In reply to Maarten LankhorstNow that we added the separate step of initialising GUC in xe_gt_init_early, it should be ok to initialise the minimum during early init, and the rest after allocations are allowed.
--- drivers/gpu/drm/xe/xe_device.c | 6 ---- drivers/gpu/drm/xe/xe_gt.c | 66 +++++++++++++++++----------------- drivers/gpu/drm/xe/xe_gt.h | 1 - 3 files changed, 32 insertions(+), 41 deletions(-)
drivers/gpu/drm/xe/xe_device.c +0 -6
@@ -663,12 +663,6 @@ int xe_device_probe(struct xe_device *xe)return err; } -for_each_gt (gt, xe, id) { - err =xe_gt_init_hwconfig (gt); -if (err) -return err; - } - err =xe_devcoredump_init (xe);if (err)return err;
drivers/gpu/drm/xe/xe_gt.c +32 -34
90 lines not on this page · raw message
drivers/gpu/drm/xe/xe_gt.h +0 -1
@@ -28,7 +28,6 @@ static inline bool xe_fault_inject_gt_reset(void) }struct xe_gt *xe_gt_alloc (struct xe_tile *tile); -int xe_gt_init_hwconfig (struct xe_gt *gt);int xe_gt_init_early (struct xe_gt *gt);int xe_gt_init (struct xe_gt *gt);void xe_gt_mmio_init (struct xe_gt *gt);
Signature · 1 line
2.45.2
PATCH 10/10 fixup! drm/xe/display: Add intel_plane_initial_vblank_wait
In reply to Maarten LankhorstFrom: Maarten Lankhorst <[email protected]>
--- drivers/gpu/drm/i915/display/intel_plane_initial.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_plane_initial.c +3 -3
@@ -14,9 +14,9 @@#include "intel_frontbuffer.h" #include "intel_plane_initial.h" -void intel_plane_initial_vblank_wait(plane);(struct intel_plane *plane) +void intel_plane_initial_vblank_wait (struct intel_plane *plane) { - struct intel_crtc *crtc = intel_crtc_for_pipe(to_intel_display(plane), plane->pipe); +struct intel_crtc *crtc =intel_crtc_for_pipe (to_intel_display (plane->base.dev), plane->pipe);intel_crtc_wait_for_next_vblank (crtc); }
@@ -445,7 +445,7 @@ void intel_initial_plane_config(struct drm_i915_private *i915)intel_find_initial_plane_obj (crtc, plane_configs);if (i915->display.funcs.display->fixup_initial_plane_config (crtc, plane_config)) -intel_initial_vblank_wait (crtc); +intel_plane_initial_vblank_wait (to_intel_plane (crtc->base.primary));plane_config_fini (plane_config); }
Signature · 1 line
2.45.2
Patchwork
CI✗ CI.Patch_applied: failure for series starting with [01/10] drm/xe: Remove double pageflip
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: series starting with [01/10] drm/xe: Remove double pageflip
URL : https://patchwork.freedesktop.org/series/141007/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 49ab426a2349 drm-tip: 2024y-11m-06d-14h-30m-54s UTC integration manifest === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_gt.c:415
error: drivers/gpu/drm/xe/xe_gt.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/xe: Remove double pageflip
Applying: drm/xe/display: Add intel_plane_initial_vblank_wait
Applying: drm/xe: Move suballocator init to after display init
Applying: drm/xe: Defer irq init until after xe_display_init_noaccel
Applying: drm/xe/display: Use a single early init call for display
Applying: drm/xe/sriov: Move VF bootstrap and query_config to vf_guc_init
Applying: drm/xe: Simplify GuC early initialisation
Applying: drm/xe: Make it possible to read instance0 MCR registers after xe_gt_mcr_init_early
Applying: drm/xe: Split init of xe_gt_init_hwconfig to xe_gt_init and *_early Patch failed at 0009 drm/xe: Split init of xe_gt_init_hwconfig to xe_gt_init and *_early 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".
Patchwork
CI✗ Fi.CI.BUILD: failure for series starting with [01/10] drm/xe: Remove double pageflip
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: series starting with [01/10] drm/xe: Remove double pageflip
URL : https://patchwork.freedesktop.org/series/141008/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/141008/revisions/1/mbox/ not applied
Applying: drm/xe: Remove double pageflip
Applying: drm/xe/display: Add intel_plane_initial_vblank_wait
Applying: drm/xe: Move suballocator init to after display init
Applying: drm/xe: Defer irq init until after xe_display_init_noaccel
Applying: drm/xe/display: Use a single early init call for display
Applying: drm/xe/sriov: Move VF bootstrap and query_config to vf_guc_init
Applying: drm/xe: Simplify GuC early initialisation
Applying: drm/xe: Make it possible to read instance0 MCR registers after xe_gt_mcr_init_early
Applying: drm/xe: Split init of xe_gt_init_hwconfig to xe_gt_init and *_early
error: sha1 information is lacking or useless (drivers/gpu/drm/xe/xe_device.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0009 drm/xe: Split init of xe_gt_init_hwconfig to xe_gt_init and *_early 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".
Build failed, no error log produced