[PATCH 2/2] drm/xe: Update runtime detection of has_flat_ccs

Cavitt, Jonathan jonathan.cavitt at intel.com
Wed Sep 4 16:53:18 UTC 2024


-----Original Message-----
From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Lucas De Marchi
Sent: Wednesday, September 4, 2024 9:23 AM
To: intel-xe at lists.freedesktop.org
Cc: De Marchi, Lucas <lucas.demarchi at intel.com>; Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>; Roper, Matthew D <matthew.d.roper at intel.com>
Subject: [PATCH 2/2] drm/xe: Update runtime detection of has_flat_ccs
> 
> 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.
> 
> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> Cc: Matt Roper <matthew.d.roper at intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

I'm guessing the issue here is that "set" implies that we're manually
changing the value, whereas "probe" means that we're checking what
the correct value should be and adjusting it accordingly?

This is just a rhetorical question to make sure I have the nomenclature
correct, not a blocking statement.

Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt
  
> ---
>  drivers/gpu/drm/xe/xe_device.c | 8 +++++---
>  drivers/gpu/drm/xe/xe_pci.c    | 3 +++
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 1a0d7fdd094b..449b85035d3a 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -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)
> @@ -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;
>  
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 8642c079bc65..94856ed6686a 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -677,7 +677,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;
>  
> -- 
> 2.43.0
> 
> 


More information about the Intel-xe mailing list