Re: [PATCH v3] thunderbolt: Add quirk to disable CLx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Feb 13, 2023 at 12:11:51PM -0600, Sanjay R Mehta wrote:
> From: Sanjay R Mehta <sanju.mehta@xxxxxxx>
> 
> Add QUIRK_NO_CLX to disable the CLx state for hardware which
> doesn't supports it.
> 
> AMD Yellow Carp and Pink Sardine don't support CLx state,
> hence disabling it using QUIRK_NO_CLX.
> 
> Signed-off-by: Sanjay R Mehta <sanju.mehta@xxxxxxx>
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@xxxxxxx>
> ---
>  drivers/thunderbolt/quirks.c | 19 +++++++++++++++++--
>  drivers/thunderbolt/tb.h     | 11 ++++++++---
>  2 files changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/thunderbolt/quirks.c b/drivers/thunderbolt/quirks.c
> index b5f2ec7..47ff4b8 100644
> --- a/drivers/thunderbolt/quirks.c
> +++ b/drivers/thunderbolt/quirks.c
> @@ -20,6 +20,11 @@ static void quirk_dp_credit_allocation(struct tb_switch *sw)
>  	}
>  }
>  
> +static void quirk_clx_disable(struct tb_switch *sw)
> +{
> +	sw->quirks |= QUIRK_NO_CLX;
> +}
> +
>  struct tb_quirk {
>  	u16 hw_vendor_id;
>  	u16 hw_device_id;
> @@ -37,6 +42,13 @@ static const struct tb_quirk tb_quirks[] = {
>  	 * DP buffers.
>  	 */
>  	{ 0x8087, 0x0b26, 0x0000, 0x0000, quirk_dp_credit_allocation },
> +	/*
> +	 * CLx is not supported on AMD USB4 Yellow Carp and Pink Sardine platforms.
> +	 */
> +	{ 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x162e, quirk_clx_disable },
> +	{ 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x162f, quirk_clx_disable },
> +	{ 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x1668, quirk_clx_disable },
> +	{ 0x0000, 0x0000, PCI_VENDOR_ID_AMD, 0x1669, quirk_clx_disable },
>  };
>  
>  /**
> @@ -47,6 +59,7 @@ static const struct tb_quirk tb_quirks[] = {
>   */
>  void tb_check_quirks(struct tb_switch *sw)
>  {
> +	struct tb_nhi *nhi = sw->tb->nhi;
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(tb_quirks); i++) {
> @@ -56,9 +69,11 @@ void tb_check_quirks(struct tb_switch *sw)
>  			continue;
>  		if (q->hw_device_id && q->hw_device_id != sw->config.device_id)
>  			continue;
> -		if (q->vendor && q->vendor != sw->vendor)
> +		if (q->vendor && (q->vendor != sw->vendor &&
> +				  q->vendor != nhi->pdev->vendor))

Can't you use the router ID here not the NHI PCI ID?

>  			continue;
> -		if (q->device && q->device != sw->device)
> +		if (q->device && (q->device != sw->device &&
> +				  q->device != nhi->pdev->device))

Ditto here.



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux