diff mbox series

[3/3] powerpc/pseries: Fixup config space size of OpenCAPI devices

Message ID 20191022075247.16266-4-clombard@linux.vnet.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series ocxl: Support for an 0penCAPI device in a QEMU guest. | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (6b450d0404ca83dc131dadffd40c5aa6f7a603af)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (612ee81b9461475b5a5612c2e8d71559dd3c7920)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (3b7c59a1950c75f2c0152e5a9cd77675b09233d6)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (d10f60ae27d26d811e2a1bb39ded47df96d7499f)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (f3c452cfc59c817950b150b51ec2b33409d7640b)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Christophe Lombard Oct. 22, 2019, 7:52 a.m. UTC
Fix up the pci config size of the OpenCAPI PCIe devices in the pseries
environment.
Most of OpenCAPI PCIe devices have 4096 bytes of configuration space.

Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/pci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Andrew Donnellan Nov. 5, 2019, 5:01 a.m. UTC | #1
On 22/10/19 6:52 pm, christophe lombard wrote:
> Fix up the pci config size of the OpenCAPI PCIe devices in the pseries
> environment.
> Most of OpenCAPI PCIe devices have 4096 bytes of configuration space.

It's not "most of", it's "all" - the OpenCAPI Discovery and 
Configuration Spec requires the use of extended capabilities that fall 
in the 0x100-0xFFF range.

> 
> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
> ---
>   arch/powerpc/platforms/pseries/pci.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
> index 1eae1d09980c..3397784767b0 100644
> --- a/arch/powerpc/platforms/pseries/pci.c
> +++ b/arch/powerpc/platforms/pseries/pci.c
> @@ -291,6 +291,15 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
>   DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
>   			 fixup_winbond_82c105);
>   
> +static void fixup_opencapi_cfg_size(struct pci_dev *pdev)
> +{
> +	if (!machine_is(pseries))
> +		return;
> +
> +	pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
> +}
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IBM, 0x062b, fixup_opencapi_cfg_size);

An OpenCAPI device can have any PCI ID, is there a particular reason 
we're limiting this to 1014:062b? On PowerNV, we check the PHB type to 
determine whether the device is OpenCAPI or not, what's the equivalent 
for pseries?

> +
>   int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
>   {
>   	struct device_node *dn, *pdn;
>
Christophe Lombard Nov. 7, 2019, 8:46 a.m. UTC | #2
On 05/11/2019 06:01, Andrew Donnellan wrote:
> On 22/10/19 6:52 pm, christophe lombard wrote:
>> Fix up the pci config size of the OpenCAPI PCIe devices in the pseries
>> environment.
>> Most of OpenCAPI PCIe devices have 4096 bytes of configuration space.
> 
> It's not "most of", it's "all" - the OpenCAPI Discovery and 
> Configuration Spec requires the use of extended capabilities that fall 
> in the 0x100-0xFFF range.
> 
>>
>> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
>> ---
>>   arch/powerpc/platforms/pseries/pci.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/powerpc/platforms/pseries/pci.c 
>> b/arch/powerpc/platforms/pseries/pci.c
>> index 1eae1d09980c..3397784767b0 100644
>> --- a/arch/powerpc/platforms/pseries/pci.c
>> +++ b/arch/powerpc/platforms/pseries/pci.c
>> @@ -291,6 +291,15 @@ static void fixup_winbond_82c105(struct pci_dev* 
>> dev)
>>   DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, 
>> PCI_DEVICE_ID_WINBOND_82C105,
>>                fixup_winbond_82c105);
>> +static void fixup_opencapi_cfg_size(struct pci_dev *pdev)
>> +{
>> +    if (!machine_is(pseries))
>> +        return;
>> +
>> +    pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
>> +}
>> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IBM, 0x062b, 
>> fixup_opencapi_cfg_size);
> 
> An OpenCAPI device can have any PCI ID, is there a particular reason 
> we're limiting this to 1014:062b? On PowerNV, we check the PHB type to 
> determine whether the device is OpenCAPI or not, what's the equivalent 
> for pseries?
> 

Thanks for the review. For pseries, there is no specific OpenCapi PHB 
type which constraints this kind of request.
We are working to found an other solution.

>> +
>>   int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
>>   {
>>       struct device_node *dn, *pdn;
>>
>
Greg Kurz Nov. 9, 2019, 1:07 p.m. UTC | #3
On Thu, 7 Nov 2019 09:46:25 +0100
christophe lombard <clombard@linux.vnet.ibm.com> wrote:

> On 05/11/2019 06:01, Andrew Donnellan wrote:
> > On 22/10/19 6:52 pm, christophe lombard wrote:
> >> Fix up the pci config size of the OpenCAPI PCIe devices in the pseries
> >> environment.
> >> Most of OpenCAPI PCIe devices have 4096 bytes of configuration space.
> > 
> > It's not "most of", it's "all" - the OpenCAPI Discovery and 
> > Configuration Spec requires the use of extended capabilities that fall 
> > in the 0x100-0xFFF range.
> > 
> >>
> >> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
> >> ---
> >>   arch/powerpc/platforms/pseries/pci.c | 9 +++++++++
> >>   1 file changed, 9 insertions(+)
> >>
> >> diff --git a/arch/powerpc/platforms/pseries/pci.c 
> >> b/arch/powerpc/platforms/pseries/pci.c
> >> index 1eae1d09980c..3397784767b0 100644
> >> --- a/arch/powerpc/platforms/pseries/pci.c
> >> +++ b/arch/powerpc/platforms/pseries/pci.c
> >> @@ -291,6 +291,15 @@ static void fixup_winbond_82c105(struct pci_dev* 
> >> dev)
> >>   DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, 
> >> PCI_DEVICE_ID_WINBOND_82C105,
> >>                fixup_winbond_82c105);
> >> +static void fixup_opencapi_cfg_size(struct pci_dev *pdev)
> >> +{
> >> +    if (!machine_is(pseries))
> >> +        return;
> >> +
> >> +    pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
> >> +}
> >> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IBM, 0x062b, 
> >> fixup_opencapi_cfg_size);
> > 
> > An OpenCAPI device can have any PCI ID, is there a particular reason 
> > we're limiting this to 1014:062b? On PowerNV, we check the PHB type to 
> > determine whether the device is OpenCAPI or not, what's the equivalent 
> > for pseries?
> > 
> 
> Thanks for the review. For pseries, there is no specific OpenCapi PHB 
> type which constraints this kind of request.
> We are working to found an other solution.
> 

Well... we have an old PAPR+ addendum draft that mentions an "open-capi"
PHB type. The specification was never finalized and AFAIK PowerVM doesn't
support the OpenCAPI interface, so we didn't stick to the addendum during
our in-house prototyping. But now that we want to upstream things, I think
we should probably come up with a dedicated PHB type.

> >> +
> >>   int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
> >>   {
> >>       struct device_node *dn, *pdn;
> >>
> > 
>
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 1eae1d09980c..3397784767b0 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -291,6 +291,15 @@  static void fixup_winbond_82c105(struct pci_dev* dev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
 			 fixup_winbond_82c105);
 
+static void fixup_opencapi_cfg_size(struct pci_dev *pdev)
+{
+	if (!machine_is(pseries))
+		return;
+
+	pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_IBM, 0x062b, fixup_opencapi_cfg_size);
+
 int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
 	struct device_node *dn, *pdn;