public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH kernel v3] PCI/DOE: Support discovery version 2
@ 2024-03-07  2:20 Alexey Kardashevskiy
  2024-03-07  5:06 ` Kuppuswamy Sathyanarayanan
  2024-04-09 14:33 ` Bjorn Helgaas
  0 siblings, 2 replies; 8+ messages in thread
From: Alexey Kardashevskiy @ 2024-03-07  2:20 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-kernel, Bjorn Helgaas, Ira Weiny, Dan Williams,
	Jonathan Cameron, Lukas Wunner, Alexey Kardashevskiy

PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in
the DOE Discovery Request Data Object Contents (3rd DW) as:

15:8 DOE Discovery Version – must be 02h if the Capability Version in
the Data Object Exchange Extended Capability is 02h or greater.

Add support for the version on devices with the DOE v2 capability.

Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
---
Changes:
v3:
* updated subject line
* dropped "DISCOVER_" from the new field macro

v2:
* added the section number to the commit log
---
 include/uapi/linux/pci_regs.h |  1 +
 drivers/pci/doe.c             | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index a39193213ff2..fbca743b2b86 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -1144,6 +1144,7 @@
 #define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH		0x0003ffff
 
 #define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX		0x000000ff
+#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER		0x0000ff00
 #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID		0x0000ffff
 #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL		0x00ff0000
 #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX	0xff000000
diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c
index 61f0531d2b1d..c94c2b0767f3 100644
--- a/drivers/pci/doe.c
+++ b/drivers/pci/doe.c
@@ -381,11 +381,13 @@ static void pci_doe_task_complete(struct pci_doe_task *task)
 	complete(task->private);
 }
 
-static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 *index, u16 *vid,
+static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8 *index, u16 *vid,
 			     u8 *protocol)
 {
 	u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
-				    *index);
+				    *index) |
+			 FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER,
+				    (capver >= 2) ? 2 : 0);
 	__le32 request_pl_le = cpu_to_le32(request_pl);
 	__le32 response_pl_le;
 	u32 response_pl;
@@ -419,13 +421,16 @@ static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb)
 {
 	u8 index = 0;
 	u8 xa_idx = 0;
+	u32 hdr = 0;
+
+	pci_read_config_dword(doe_mb->pdev, doe_mb->cap_offset, &hdr);
 
 	do {
 		int rc;
 		u16 vid;
 		u8 prot;
 
-		rc = pci_doe_discovery(doe_mb, &index, &vid, &prot);
+		rc = pci_doe_discovery(doe_mb, PCI_EXT_CAP_VER(hdr), &index, &vid, &prot);
 		if (rc)
 			return rc;
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2
  2024-03-07  2:20 [PATCH kernel v3] PCI/DOE: Support discovery version 2 Alexey Kardashevskiy
@ 2024-03-07  5:06 ` Kuppuswamy Sathyanarayanan
  2024-03-07  6:09   ` Alexey Kardashevskiy
  2024-04-09 14:33 ` Bjorn Helgaas
  1 sibling, 1 reply; 8+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2024-03-07  5:06 UTC (permalink / raw)
  To: Alexey Kardashevskiy, linux-pci
  Cc: linux-kernel, Bjorn Helgaas, Ira Weiny, Dan Williams,
	Jonathan Cameron, Lukas Wunner


On 3/6/24 6:20 PM, Alexey Kardashevskiy wrote:
> PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in
> the DOE Discovery Request Data Object Contents (3rd DW) as:
>
> 15:8 DOE Discovery Version – must be 02h if the Capability Version in
> the Data Object Exchange Extended Capability is 02h or greater.

Does this change fix any functional issue? If yes, please add Fixes:
tag and probably CC stable?

>
> Add support for the version on devices with the DOE v2 capability.
>
> Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
> ---
Change wise looks fine to me.

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> Changes:
> v3:
> * updated subject line
> * dropped "DISCOVER_" from the new field macro
>
> v2:
> * added the section number to the commit log
> ---
>  include/uapi/linux/pci_regs.h |  1 +
>  drivers/pci/doe.c             | 11 ++++++++---
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index a39193213ff2..fbca743b2b86 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -1144,6 +1144,7 @@
>  #define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH		0x0003ffff
>  
>  #define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX		0x000000ff
> +#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER		0x0000ff00
>  #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID		0x0000ffff
>  #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL		0x00ff0000
>  #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX	0xff000000
> diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c
> index 61f0531d2b1d..c94c2b0767f3 100644
> --- a/drivers/pci/doe.c
> +++ b/drivers/pci/doe.c
> @@ -381,11 +381,13 @@ static void pci_doe_task_complete(struct pci_doe_task *task)
>  	complete(task->private);
>  }
>  
> -static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 *index, u16 *vid,
> +static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8 *index, u16 *vid,
>  			     u8 *protocol)
>  {
>  	u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
> -				    *index);
> +				    *index) |
> +			 FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER,
> +				    (capver >= 2) ? 2 : 0);
>  	__le32 request_pl_le = cpu_to_le32(request_pl);
>  	__le32 response_pl_le;
>  	u32 response_pl;
> @@ -419,13 +421,16 @@ static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb)
>  {
>  	u8 index = 0;
>  	u8 xa_idx = 0;
> +	u32 hdr = 0;
> +
> +	pci_read_config_dword(doe_mb->pdev, doe_mb->cap_offset, &hdr);
>  
>  	do {
>  		int rc;
>  		u16 vid;
>  		u8 prot;
>  
> -		rc = pci_doe_discovery(doe_mb, &index, &vid, &prot);
> +		rc = pci_doe_discovery(doe_mb, PCI_EXT_CAP_VER(hdr), &index, &vid, &prot);
>  		if (rc)
>  			return rc;
>  

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2
  2024-03-07  5:06 ` Kuppuswamy Sathyanarayanan
@ 2024-03-07  6:09   ` Alexey Kardashevskiy
  2024-03-07  6:22     ` Sathyanarayanan Kuppuswamy Natarajan
  0 siblings, 1 reply; 8+ messages in thread
From: Alexey Kardashevskiy @ 2024-03-07  6:09 UTC (permalink / raw)
  To: Kuppuswamy Sathyanarayanan, linux-pci
  Cc: linux-kernel, Bjorn Helgaas, Ira Weiny, Dan Williams,
	Jonathan Cameron, Lukas Wunner



On 7/3/24 16:06, Kuppuswamy Sathyanarayanan wrote:
> 
> On 3/6/24 6:20 PM, Alexey Kardashevskiy wrote:
>> PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in
>> the DOE Discovery Request Data Object Contents (3rd DW) as:
>>
>> 15:8 DOE Discovery Version – must be 02h if the Capability Version in
>> the Data Object Exchange Extended Capability is 02h or greater.
> 
> Does this change fix any functional issue? If yes, please add Fixes:
> tag and probably CC stable?

The issue is that before this patch the DOE driver was following PCIe 
r6.0 and it was not working on a device with DOE cap v2 added in r6.1. 
Is it "fixes"?


>>
>> Add support for the version on devices with the DOE v2 capability.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
>> ---
> Change wise looks fine to me.
> 
> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

Thanks!

>> Changes:
>> v3:
>> * updated subject line
>> * dropped "DISCOVER_" from the new field macro
>>
>> v2:
>> * added the section number to the commit log
>> ---
>>   include/uapi/linux/pci_regs.h |  1 +
>>   drivers/pci/doe.c             | 11 ++++++++---
>>   2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
>> index a39193213ff2..fbca743b2b86 100644
>> --- a/include/uapi/linux/pci_regs.h
>> +++ b/include/uapi/linux/pci_regs.h
>> @@ -1144,6 +1144,7 @@
>>   #define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH		0x0003ffff
>>   
>>   #define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX		0x000000ff
>> +#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER		0x0000ff00
>>   #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID		0x0000ffff
>>   #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL		0x00ff0000
>>   #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX	0xff000000
>> diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c
>> index 61f0531d2b1d..c94c2b0767f3 100644
>> --- a/drivers/pci/doe.c
>> +++ b/drivers/pci/doe.c
>> @@ -381,11 +381,13 @@ static void pci_doe_task_complete(struct pci_doe_task *task)
>>   	complete(task->private);
>>   }
>>   
>> -static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 *index, u16 *vid,
>> +static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8 *index, u16 *vid,
>>   			     u8 *protocol)
>>   {
>>   	u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
>> -				    *index);
>> +				    *index) |
>> +			 FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER,
>> +				    (capver >= 2) ? 2 : 0);
>>   	__le32 request_pl_le = cpu_to_le32(request_pl);
>>   	__le32 response_pl_le;
>>   	u32 response_pl;
>> @@ -419,13 +421,16 @@ static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb)
>>   {
>>   	u8 index = 0;
>>   	u8 xa_idx = 0;
>> +	u32 hdr = 0;
>> +
>> +	pci_read_config_dword(doe_mb->pdev, doe_mb->cap_offset, &hdr);
>>   
>>   	do {
>>   		int rc;
>>   		u16 vid;
>>   		u8 prot;
>>   
>> -		rc = pci_doe_discovery(doe_mb, &index, &vid, &prot);
>> +		rc = pci_doe_discovery(doe_mb, PCI_EXT_CAP_VER(hdr), &index, &vid, &prot);
>>   		if (rc)
>>   			return rc;
>>   
> 

-- 
Alexey


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2
  2024-03-07  6:09   ` Alexey Kardashevskiy
@ 2024-03-07  6:22     ` Sathyanarayanan Kuppuswamy Natarajan
  2024-03-14  0:59       ` Alexey Kardashevskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Sathyanarayanan Kuppuswamy Natarajan @ 2024-03-07  6:22 UTC (permalink / raw)
  To: Alexey Kardashevskiy
  Cc: linux-pci, linux-kernel, Bjorn Helgaas, Ira Weiny, Dan Williams,
	Jonathan Cameron, Lukas Wunner

On Wed, Mar 6, 2024 at 10:09 PM Alexey Kardashevskiy <aik@amd.com> wrote:
>
>
>
> On 7/3/24 16:06, Kuppuswamy Sathyanarayanan wrote:
> >
> > On 3/6/24 6:20 PM, Alexey Kardashevskiy wrote:
> >> PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in
> >> the DOE Discovery Request Data Object Contents (3rd DW) as:
> >>
> >> 15:8 DOE Discovery Version – must be 02h if the Capability Version in
> >> the Data Object Exchange Extended Capability is 02h or greater.
> >
> > Does this change fix any functional issue? If yes, please add Fixes:
> > tag and probably CC stable?
>
> The issue is that before this patch the DOE driver was following PCIe
> r6.0 and it was not working on a device with DOE cap v2 added in r6.1.
> Is it "fixes"?
>

Since you are enabling support for the newer spec version, I think it will not
fall under bug fix. But it might be qualified for the stable branch.
It depends on
whether you want to support this device in older(stable) kernels.

>
> >>
> >> Add support for the version on devices with the DOE v2 capability.
> >>
> >> Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
> >> ---
> > Change wise looks fine to me.
> >
> > Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>
> Thanks!
>
> >> Changes:
> >> v3:
> >> * updated subject line
> >> * dropped "DISCOVER_" from the new field macro
> >>
> >> v2:
> >> * added the section number to the commit log
> >> ---
> >>   include/uapi/linux/pci_regs.h |  1 +
> >>   drivers/pci/doe.c             | 11 ++++++++---
> >>   2 files changed, 9 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> >> index a39193213ff2..fbca743b2b86 100644
> >> --- a/include/uapi/linux/pci_regs.h
> >> +++ b/include/uapi/linux/pci_regs.h
> >> @@ -1144,6 +1144,7 @@
> >>   #define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH                0x0003ffff
> >>
> >>   #define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX               0x000000ff
> >> +#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER          0x0000ff00
> >>   #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID         0x0000ffff
> >>   #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL            0x00ff0000
> >>   #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX  0xff000000
> >> diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c
> >> index 61f0531d2b1d..c94c2b0767f3 100644
> >> --- a/drivers/pci/doe.c
> >> +++ b/drivers/pci/doe.c
> >> @@ -381,11 +381,13 @@ static void pci_doe_task_complete(struct pci_doe_task *task)
> >>      complete(task->private);
> >>   }
> >>
> >> -static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 *index, u16 *vid,
> >> +static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8 *index, u16 *vid,
> >>                           u8 *protocol)
> >>   {
> >>      u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
> >> -                                *index);
> >> +                                *index) |
> >> +                     FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER,
> >> +                                (capver >= 2) ? 2 : 0);
> >>      __le32 request_pl_le = cpu_to_le32(request_pl);
> >>      __le32 response_pl_le;
> >>      u32 response_pl;
> >> @@ -419,13 +421,16 @@ static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb)
> >>   {
> >>      u8 index = 0;
> >>      u8 xa_idx = 0;
> >> +    u32 hdr = 0;
> >> +
> >> +    pci_read_config_dword(doe_mb->pdev, doe_mb->cap_offset, &hdr);
> >>
> >>      do {
> >>              int rc;
> >>              u16 vid;
> >>              u8 prot;
> >>
> >> -            rc = pci_doe_discovery(doe_mb, &index, &vid, &prot);
> >> +            rc = pci_doe_discovery(doe_mb, PCI_EXT_CAP_VER(hdr), &index, &vid, &prot);
> >>              if (rc)
> >>                      return rc;
> >>
> >
>
> --
> Alexey
>


-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2
  2024-03-07  6:22     ` Sathyanarayanan Kuppuswamy Natarajan
@ 2024-03-14  0:59       ` Alexey Kardashevskiy
  2024-03-14  6:49         ` Kuppuswamy Sathyanarayanan
  0 siblings, 1 reply; 8+ messages in thread
From: Alexey Kardashevskiy @ 2024-03-14  0:59 UTC (permalink / raw)
  To: Sathyanarayanan Kuppuswamy Natarajan
  Cc: linux-pci, linux-kernel, Bjorn Helgaas, Ira Weiny, Dan Williams,
	Jonathan Cameron, Lukas Wunner



On 7/3/24 17:22, Sathyanarayanan Kuppuswamy Natarajan wrote:
> On Wed, Mar 6, 2024 at 10:09 PM Alexey Kardashevskiy <aik@amd.com> wrote:
>>
>>
>>
>> On 7/3/24 16:06, Kuppuswamy Sathyanarayanan wrote:
>>>
>>> On 3/6/24 6:20 PM, Alexey Kardashevskiy wrote:
>>>> PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in
>>>> the DOE Discovery Request Data Object Contents (3rd DW) as:
>>>>
>>>> 15:8 DOE Discovery Version – must be 02h if the Capability Version in
>>>> the Data Object Exchange Extended Capability is 02h or greater.
>>>
>>> Does this change fix any functional issue? If yes, please add Fixes:
>>> tag and probably CC stable?
>>
>> The issue is that before this patch the DOE driver was following PCIe
>> r6.0 and it was not working on a device with DOE cap v2 added in r6.1.
>> Is it "fixes"?
>>
> 
> Since you are enabling support for the newer spec version, I think it will not
> fall under bug fix. But it might be qualified for the stable branch.
> It depends on
> whether you want to support this device in older(stable) kernels.


I am going to need lot more stuff (TSM, IDE, TDISP) in addition to this 
but it is coming much later so there is no point in pushing this alone 
to older kernels. Thanks,


-- 
Alexey


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2
  2024-03-14  0:59       ` Alexey Kardashevskiy
@ 2024-03-14  6:49         ` Kuppuswamy Sathyanarayanan
  2024-04-09  8:25           ` Alexey Kardashevskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2024-03-14  6:49 UTC (permalink / raw)
  To: Alexey Kardashevskiy, Sathyanarayanan Kuppuswamy Natarajan
  Cc: linux-pci, linux-kernel, Bjorn Helgaas, Ira Weiny, Dan Williams,
	Jonathan Cameron, Lukas Wunner


On 3/13/24 5:59 PM, Alexey Kardashevskiy wrote:
>
>
> On 7/3/24 17:22, Sathyanarayanan Kuppuswamy Natarajan wrote:
>> On Wed, Mar 6, 2024 at 10:09 PM Alexey Kardashevskiy <aik@amd.com> wrote:
>>>
>>>
>>>
>>> On 7/3/24 16:06, Kuppuswamy Sathyanarayanan wrote:
>>>>
>>>> On 3/6/24 6:20 PM, Alexey Kardashevskiy wrote:
>>>>> PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in
>>>>> the DOE Discovery Request Data Object Contents (3rd DW) as:
>>>>>
>>>>> 15:8 DOE Discovery Version – must be 02h if the Capability Version in
>>>>> the Data Object Exchange Extended Capability is 02h or greater.
>>>>
>>>> Does this change fix any functional issue? If yes, please add Fixes:
>>>> tag and probably CC stable?
>>>
>>> The issue is that before this patch the DOE driver was following PCIe
>>> r6.0 and it was not working on a device with DOE cap v2 added in r6.1.
>>> Is it "fixes"?
>>>
>>
>> Since you are enabling support for the newer spec version, I think it will not
>> fall under bug fix. But it might be qualified for the stable branch.
>> It depends on
>> whether you want to support this device in older(stable) kernels.
>
>
> I am going to need lot more stuff (TSM, IDE, TDISP) in addition to this but it is coming much later so there is no point in pushing this alone to older kernels. Thanks,
>
>
Got it.

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>


-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2
  2024-03-14  6:49         ` Kuppuswamy Sathyanarayanan
@ 2024-04-09  8:25           ` Alexey Kardashevskiy
  0 siblings, 0 replies; 8+ messages in thread
From: Alexey Kardashevskiy @ 2024-04-09  8:25 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, linux-kernel, Ira Weiny, Dan Williams,
	Jonathan Cameron, Lukas Wunner, Kuppuswamy Sathyanarayanan,
	Sathyanarayanan Kuppuswamy Natarajan

Ping? Is this going anywhere? Thanks,


On 14/3/24 17:49, Kuppuswamy Sathyanarayanan wrote:
> 
> On 3/13/24 5:59 PM, Alexey Kardashevskiy wrote:
>>
>>
>> On 7/3/24 17:22, Sathyanarayanan Kuppuswamy Natarajan wrote:
>>> On Wed, Mar 6, 2024 at 10:09 PM Alexey Kardashevskiy <aik@amd.com> wrote:
>>>>
>>>>
>>>>
>>>> On 7/3/24 16:06, Kuppuswamy Sathyanarayanan wrote:
>>>>>
>>>>> On 3/6/24 6:20 PM, Alexey Kardashevskiy wrote:
>>>>>> PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in
>>>>>> the DOE Discovery Request Data Object Contents (3rd DW) as:
>>>>>>
>>>>>> 15:8 DOE Discovery Version – must be 02h if the Capability Version in
>>>>>> the Data Object Exchange Extended Capability is 02h or greater.
>>>>>
>>>>> Does this change fix any functional issue? If yes, please add Fixes:
>>>>> tag and probably CC stable?
>>>>
>>>> The issue is that before this patch the DOE driver was following PCIe
>>>> r6.0 and it was not working on a device with DOE cap v2 added in r6.1.
>>>> Is it "fixes"?
>>>>
>>>
>>> Since you are enabling support for the newer spec version, I think it will not
>>> fall under bug fix. But it might be qualified for the stable branch.
>>> It depends on
>>> whether you want to support this device in older(stable) kernels.
>>
>>
>> I am going to need lot more stuff (TSM, IDE, TDISP) in addition to this but it is coming much later so there is no point in pushing this alone to older kernels. Thanks,
>>
>>
> Got it.
> 
> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> 
> 

-- 
Alexey


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2
  2024-03-07  2:20 [PATCH kernel v3] PCI/DOE: Support discovery version 2 Alexey Kardashevskiy
  2024-03-07  5:06 ` Kuppuswamy Sathyanarayanan
@ 2024-04-09 14:33 ` Bjorn Helgaas
  1 sibling, 0 replies; 8+ messages in thread
From: Bjorn Helgaas @ 2024-04-09 14:33 UTC (permalink / raw)
  To: Alexey Kardashevskiy
  Cc: linux-pci, linux-kernel, Bjorn Helgaas, Ira Weiny, Dan Williams,
	Jonathan Cameron, Lukas Wunner

On Thu, Mar 07, 2024 at 01:20:06PM +1100, Alexey Kardashevskiy wrote:
> PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in
> the DOE Discovery Request Data Object Contents (3rd DW) as:
> 
> 15:8 DOE Discovery Version – must be 02h if the Capability Version in
> the Data Object Exchange Extended Capability is 02h or greater.
> 
> Add support for the version on devices with the DOE v2 capability.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@amd.com>

Applied with Sathy's reviewed-by to pci/doe for v6.10, thanks!

> ---
> Changes:
> v3:
> * updated subject line
> * dropped "DISCOVER_" from the new field macro
> 
> v2:
> * added the section number to the commit log
> ---
>  include/uapi/linux/pci_regs.h |  1 +
>  drivers/pci/doe.c             | 11 ++++++++---
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index a39193213ff2..fbca743b2b86 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -1144,6 +1144,7 @@
>  #define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH		0x0003ffff
>  
>  #define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX		0x000000ff
> +#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER		0x0000ff00
>  #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID		0x0000ffff
>  #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL		0x00ff0000
>  #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX	0xff000000
> diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c
> index 61f0531d2b1d..c94c2b0767f3 100644
> --- a/drivers/pci/doe.c
> +++ b/drivers/pci/doe.c
> @@ -381,11 +381,13 @@ static void pci_doe_task_complete(struct pci_doe_task *task)
>  	complete(task->private);
>  }
>  
> -static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 *index, u16 *vid,
> +static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8 *index, u16 *vid,
>  			     u8 *protocol)
>  {
>  	u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
> -				    *index);
> +				    *index) |
> +			 FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER,
> +				    (capver >= 2) ? 2 : 0);
>  	__le32 request_pl_le = cpu_to_le32(request_pl);
>  	__le32 response_pl_le;
>  	u32 response_pl;
> @@ -419,13 +421,16 @@ static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb)
>  {
>  	u8 index = 0;
>  	u8 xa_idx = 0;
> +	u32 hdr = 0;
> +
> +	pci_read_config_dword(doe_mb->pdev, doe_mb->cap_offset, &hdr);
>  
>  	do {
>  		int rc;
>  		u16 vid;
>  		u8 prot;
>  
> -		rc = pci_doe_discovery(doe_mb, &index, &vid, &prot);
> +		rc = pci_doe_discovery(doe_mb, PCI_EXT_CAP_VER(hdr), &index, &vid, &prot);
>  		if (rc)
>  			return rc;
>  
> -- 
> 2.41.0
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-09 14:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07  2:20 [PATCH kernel v3] PCI/DOE: Support discovery version 2 Alexey Kardashevskiy
2024-03-07  5:06 ` Kuppuswamy Sathyanarayanan
2024-03-07  6:09   ` Alexey Kardashevskiy
2024-03-07  6:22     ` Sathyanarayanan Kuppuswamy Natarajan
2024-03-14  0:59       ` Alexey Kardashevskiy
2024-03-14  6:49         ` Kuppuswamy Sathyanarayanan
2024-04-09  8:25           ` Alexey Kardashevskiy
2024-04-09 14:33 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox