Skip to content

Commit

Permalink
drm/xe: Update runtime detection of has_flat_ccs
Browse files Browse the repository at this point in the history
It's confusing to have a *set* function that actually probes the
hardware rather than receiving a parameter. Rename it to *probe* along
with prefix removal and comment in the relevant places that the
has_flat_ccs flag may be overridden in runtime.

While at it, fix the mixed declaration of struct xe_gt.

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240904162238.2831202-2-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
  • Loading branch information
Lucas De Marchi committed Sep 6, 2024
1 parent b43723f commit 0c841e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/gpu/drm/xe/xe_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,17 @@ int xe_device_probe_early(struct xe_device *xe)
return 0;
}

static int xe_device_set_has_flat_ccs(struct xe_device *xe)
static int probe_has_flat_ccs(struct xe_device *xe)
{
struct xe_gt *gt;
u32 reg;
int err;

/* Always enabled/disabled, no runtime check to do */
if (GRAPHICS_VER(xe) < 20 || !xe->info.has_flat_ccs)
return 0;

struct xe_gt *gt = xe_root_mmio_gt(xe);
gt = xe_root_mmio_gt(xe);

err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (err)
Expand Down Expand Up @@ -688,7 +690,7 @@ int xe_device_probe(struct xe_device *xe)
if (err)
goto err;

err = xe_device_set_has_flat_ccs(xe);
err = probe_has_flat_ccs(xe);
if (err)
goto err;

Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/xe/xe_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,10 @@ static int xe_info_init(struct xe_device *xe,
xe->info.has_atomic_enable_pte_bit = graphics_desc->has_atomic_enable_pte_bit;
if (xe->info.platform != XE_PVC)
xe->info.has_device_atomics_on_smem = 1;

/* Runtime detection may change this later */
xe->info.has_flat_ccs = graphics_desc->has_flat_ccs;

xe->info.has_range_tlb_invalidation = graphics_desc->has_range_tlb_invalidation;
xe->info.has_usm = graphics_desc->has_usm;

Expand Down

0 comments on commit 0c841e4

Please sign in to comment.