diff mbox series

ocxl: Fix access to the AFU Descriptor Data

Message ID 1534150891-19394-1-git-send-email-clombard@linux.vnet.ibm.com (mailing list archive)
State Superseded, archived
Headers show
Series ocxl: Fix access to the AFU Descriptor Data | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success next/apply_patch Successfully applied
snowpatch_ozlabs/checkpatch success Test checkpatch on branch next
snowpatch_ozlabs/build-ppc64le success Test build-ppc64le on branch next
snowpatch_ozlabs/build-ppc64be success Test build-ppc64be on branch next
snowpatch_ozlabs/build-ppc64e success Test build-ppc64e on branch next
snowpatch_ozlabs/build-ppc32 success Test build-ppc32 on branch next

Commit Message

Christophe Lombard Aug. 13, 2018, 9:01 a.m. UTC
From: Christophe Lombard <christophe_lombard@fr.ibm.cm>

The AFU Information DVSEC capability is a means to extract common,
general information about all of the AFUs associated with a Function
independent of the specific functionality that each AFU provides.

This patch fixes the access to the AFU Descriptor Data indexed by the
AFU Info Index field.

Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")

Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
---
 drivers/misc/ocxl/config.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Andrew Donnellan Aug. 13, 2018, 9:48 a.m. UTC | #1
On 13/08/18 19:01, Christophe Lombard wrote:
> From: Christophe Lombard <christophe_lombard@fr.ibm.cm>

Your git committer email should probably match your sign-off email.

> 
> The AFU Information DVSEC capability is a means to extract common,
> general information about all of the AFUs associated with a Function
> independent of the specific functionality that each AFU provides.
> 
> This patch fixes the access to the AFU Descriptor Data indexed by the
> AFU Info Index field.
> 
> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
> 
> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>

This looks like it should go to stable? I assume the reason we haven't 
noticed this previously is because we have not been testing with 
multi-AFU cards.

> ---
>   drivers/misc/ocxl/config.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c
> index 2e30de9..de01623 100644
> --- a/drivers/misc/ocxl/config.c
> +++ b/drivers/misc/ocxl/config.c
> @@ -280,7 +280,9 @@ int ocxl_config_check_afu_index(struct pci_dev *dev,
>   	u32 val;
>   	int rc, templ_major, templ_minor, len;
>   
> -	pci_write_config_word(dev, fn->dvsec_afu_info_pos, afu_idx);
> +	pci_write_config_word(dev,
> +			      fn->dvsec_afu_info_pos + OCXL_DVSEC_AFU_INFO_AFU_IDX,
> +			      afu_idx);

pci_write_config_byte() would be more appropriate here (see 
ocxl_config_read_afu() at line 454)

>   	rc = read_afu_info(dev, fn, OCXL_DVSEC_TEMPL_VERSION, &val);
>   	if (rc)
>   		return rc;
>
Frederic Barrat Aug. 13, 2018, 10:21 a.m. UTC | #2
Le 13/08/2018 à 11:48, Andrew Donnellan a écrit :
> On 13/08/18 19:01, Christophe Lombard wrote:
>> From: Christophe Lombard <christophe_lombard@fr.ibm.cm>
> 
> Your git committer email should probably match your sign-off email.
> 
>>
>> The AFU Information DVSEC capability is a means to extract common,
>> general information about all of the AFUs associated with a Function
>> independent of the specific functionality that each AFU provides.
>>
>> This patch fixes the access to the AFU Descriptor Data indexed by the
>> AFU Info Index field.
>>
>> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
>>
>> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
> 
> This looks like it should go to stable? I assume the reason we haven't 
> noticed this previously is because we have not been testing with 
> multi-AFU cards.

Yes, it's hidden until we have more than one AFU per function. Also, the 
field we overwrite at the wrong offset is read-only, so it goes undetected.

   Fred




> 
>> ---
>>   drivers/misc/ocxl/config.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c
>> index 2e30de9..de01623 100644
>> --- a/drivers/misc/ocxl/config.c
>> +++ b/drivers/misc/ocxl/config.c
>> @@ -280,7 +280,9 @@ int ocxl_config_check_afu_index(struct pci_dev *dev,
>>       u32 val;
>>       int rc, templ_major, templ_minor, len;
>> -    pci_write_config_word(dev, fn->dvsec_afu_info_pos, afu_idx);
>> +    pci_write_config_word(dev,
>> +                  fn->dvsec_afu_info_pos + OCXL_DVSEC_AFU_INFO_AFU_IDX,
>> +                  afu_idx);
> 
> pci_write_config_byte() would be more appropriate here (see 
> ocxl_config_read_afu() at line 454)
> 
>>       rc = read_afu_info(dev, fn, OCXL_DVSEC_TEMPL_VERSION, &val);
>>       if (rc)
>>           return rc;
>>
>
Christophe Lombard Aug. 13, 2018, 1:42 p.m. UTC | #3
Le 13/08/2018 à 11:48, Andrew Donnellan a écrit :
> On 13/08/18 19:01, Christophe Lombard wrote:
>> From: Christophe Lombard <christophe_lombard@fr.ibm.cm>
> 
> Your git committer email should probably match your sign-off email.
> 
>>
>> The AFU Information DVSEC capability is a means to extract common,
>> general information about all of the AFUs associated with a Function
>> independent of the specific functionality that each AFU provides.
>>
>> This patch fixes the access to the AFU Descriptor Data indexed by the
>> AFU Info Index field.
>>
>> Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
>>
>> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
> 
> This looks like it should go to stable? I assume the reason we haven't 
> noticed this previously is because we have not been testing with 
> multi-AFU cards.
> 
>> ---
>>   drivers/misc/ocxl/config.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c
>> index 2e30de9..de01623 100644
>> --- a/drivers/misc/ocxl/config.c
>> +++ b/drivers/misc/ocxl/config.c
>> @@ -280,7 +280,9 @@ int ocxl_config_check_afu_index(struct pci_dev *dev,
>>       u32 val;
>>       int rc, templ_major, templ_minor, len;
>> -    pci_write_config_word(dev, fn->dvsec_afu_info_pos, afu_idx);
>> +    pci_write_config_word(dev,
>> +                  fn->dvsec_afu_info_pos + OCXL_DVSEC_AFU_INFO_AFU_IDX,
>> +                  afu_idx);
> 
> pci_write_config_byte() would be more appropriate here (see 
> ocxl_config_read_afu() at line 454)
> 
>>       rc = read_afu_info(dev, fn, OCXL_DVSEC_TEMPL_VERSION, &val);
>>       if (rc)
>>           return rc;
>>
> 

right. Thanks for the review.
diff mbox series

Patch

diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c
index 2e30de9..de01623 100644
--- a/drivers/misc/ocxl/config.c
+++ b/drivers/misc/ocxl/config.c
@@ -280,7 +280,9 @@  int ocxl_config_check_afu_index(struct pci_dev *dev,
 	u32 val;
 	int rc, templ_major, templ_minor, len;
 
-	pci_write_config_word(dev, fn->dvsec_afu_info_pos, afu_idx);
+	pci_write_config_word(dev,
+			      fn->dvsec_afu_info_pos + OCXL_DVSEC_AFU_INFO_AFU_IDX,
+			      afu_idx);
 	rc = read_afu_info(dev, fn, OCXL_DVSEC_TEMPL_VERSION, &val);
 	if (rc)
 		return rc;