[PATCH 4/6] platform/x86/intel/pmt: Add quirk for BAR0 offset adjustment

David E. Box david.e.box at linux.intel.com
Thu May 30 20:59:57 UTC 2024


On Fri, 2024-05-10 at 16:59 -0400, Michael J. Ruhl wrote:
> The offset for the discovery table is based on the P2SB bar.
> If this bar is not available, the parent driver may need to
> adjust the offset,
> 
> Add a quirk to allow for this adjustment.

I'm not a fan of using base_addr in this was to adjust the offset. There was a
version that provided a separate base_adjust field to adjust the offset. Is this
change only needed for DG2?

David

> 
> Signed-off-by: Michael J. Ruhl <michael.j.ruhl at intel.com>
> ---
>  drivers/platform/x86/intel/pmt/class.c     | 3 +++
>  drivers/platform/x86/intel/pmt/telemetry.c | 2 +-
>  drivers/platform/x86/intel/vsec.c          | 2 +-
>  include/linux/intel_vsec.h                 | 3 +++
>  4 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/pmt/class.c
> b/drivers/platform/x86/intel/pmt/class.c
> index 62e36dd89137..957cf74234da 100644
> --- a/drivers/platform/x86/intel/pmt/class.c
> +++ b/drivers/platform/x86/intel/pmt/class.c
> @@ -349,6 +349,9 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry,
> struct intel_pmt_namespa
>  	if (IS_ERR(entry->disc_table))
>  		return PTR_ERR(entry->disc_table);
>  
> +	if (intel_vsec_dev->quirks & VSEC_QUIRK_P2SB_OFFSET)
> +		entry->base_addr = intel_vsec_dev->base_addr;
> +
>  	ret = ns->pmt_header_decode(entry, dev);
>  	if (ret)
>  		return ret;
> diff --git a/drivers/platform/x86/intel/pmt/telemetry.c
> b/drivers/platform/x86/intel/pmt/telemetry.c
> index c9feac859e57..7be9f9746363 100644
> --- a/drivers/platform/x86/intel/pmt/telemetry.c
> +++ b/drivers/platform/x86/intel/pmt/telemetry.c
> @@ -77,7 +77,7 @@ static int pmt_telem_header_decode(struct intel_pmt_entry
> *entry,
>  
>  	header->access_type = TELEM_ACCESS(readl(disc_table));
>  	header->guid = readl(disc_table + TELEM_GUID_OFFSET);
> -	header->base_offset = readl(disc_table + TELEM_BASE_OFFSET);
> +	header->base_offset = readl(disc_table + TELEM_BASE_OFFSET) + entry-
> >base_addr;
>  
>  	/* Size is measured in DWORDS, but accessor returns bytes */
>  	header->size = TELEM_SIZE(readl(disc_table));
> diff --git a/drivers/platform/x86/intel/vsec.c
> b/drivers/platform/x86/intel/vsec.c
> index 5378da9354b6..5a0dfc21eb0f 100644
> --- a/drivers/platform/x86/intel/vsec.c
> +++ b/drivers/platform/x86/intel/vsec.c
> @@ -185,7 +185,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct
> intel_vsec_header *he
>  	if (quirks & VSEC_QUIRK_TABLE_SHIFT)
>  		header->offset >>= TABLE_OFFSET_SHIFT;
>  
> -	if (info->base_addr)
> +	if (!(quirks & VSEC_QUIRK_P2SB_OFFSET) && info->base_addr)
>  		base_addr = info->base_addr;
>  	else
>  		base_addr = pdev->resource[header->tbir].start;
> diff --git a/include/linux/intel_vsec.h b/include/linux/intel_vsec.h
> index 04f915a1ba0b..68e3a42040e8 100644
> --- a/include/linux/intel_vsec.h
> +++ b/include/linux/intel_vsec.h
> @@ -65,6 +65,9 @@ enum intel_vsec_quirks {
>  
>  	/* Platforms requiring quirk in the auxiliary driver */
>  	VSEC_QUIRK_EARLY_HW     = BIT(4),
> +
> +	/* Broken P2SB access work around */
> +	VSEC_QUIRK_P2SB_OFFSET  = BIT(5),
>  };
>  
>  struct pmt_callbacks {



More information about the Intel-xe mailing list