* [PATCH] PCI: Add ACS quirk for Wangxun NICs
@ 2023-02-01 10:47 Mengyuan Lou
2023-02-01 15:37 ` Bjorn Helgaas
0 siblings, 1 reply; 7+ messages in thread
From: Mengyuan Lou @ 2023-02-01 10:47 UTC (permalink / raw)
To: netdev; +Cc: linux-pci, Mengyuan Lou
The Wangxun 1G/10G NICs may be multi-function devices. They do
not advertise ACS capability.
Add an ACS quirk for these devices so the functions can be in
independent IOMMU groups.
Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
---
drivers/pci/quirks.c | 20 ++++++++++++++++++++
include/linux/pci_ids.h | 2 ++
2 files changed, 22 insertions(+)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 285acc4aaccc..9daa4a07c67d 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4835,6 +4835,24 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags)
PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
}
+/*
+ * Wangxun 10G/1G nics have no ACS capability.
+ * But the implementation could block peer-to-peer transactions between them
+ * and provide ACS-like functionality.
+ */
+static int pci_quirk_wangxun_nic_acs(struct pci_dev *dev, u16 acs_flags)
+{
+ switch (dev->device) {
+ case 0x0100 ... 0x010F:
+ case 0x1001:
+ case 0x2001:
+ return pci_acs_ctrl_enabled(acs_flags,
+ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
+ }
+
+ return false;
+}
+
static const struct pci_dev_acs_enabled {
u16 vendor;
u16 device;
@@ -4980,6 +4998,8 @@ static const struct pci_dev_acs_enabled {
{ PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs },
/* Zhaoxin Root/Downstream Ports */
{ PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs },
+ /* Wangxun nics */
+ { PCI_VENDOR_ID_WANGXUN, PCI_ANY_ID, pci_quirk_wangxun_nic_acs },
{ 0 }
};
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index b362d90eb9b0..bc8f484cdcf3 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -3012,6 +3012,8 @@
#define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b
#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
+#define PCI_VENDOR_ID_WANGXUN 0x8088
+
#define PCI_VENDOR_ID_SCALEMP 0x8686
#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
--
2.39.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: Add ACS quirk for Wangxun NICs
2023-02-01 10:47 [PATCH] PCI: Add ACS quirk for Wangxun NICs Mengyuan Lou
@ 2023-02-01 15:37 ` Bjorn Helgaas
0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2023-02-01 15:37 UTC (permalink / raw)
To: Mengyuan Lou; +Cc: netdev, linux-pci
On Wed, Feb 01, 2023 at 06:47:03PM +0800, Mengyuan Lou wrote:
> The Wangxun 1G/10G NICs may be multi-function devices. They do
> not advertise ACS capability.
> Add an ACS quirk for these devices so the functions can be in
> independent IOMMU groups.
Thanks for the patch!
The commit log and the code comment do not explicitly say that the
hardware implementation blocks transactions between functions.
Can you clarify this by verifying (a) you have direct knowledge that
the hardware *does* block those transactions, and (b) that the
following text is accurate:
The Wangxun 1G/10G NICs may be multi-function devices. They do not
advertise an ACS capability, but the hardware implementation always
blocks peer-to-peer transactions between the functions.
Add an ACS quirk for these devices so the functions can be in
independent IOMMU groups.
> + * Wangxun 10G/1G nics have no ACS capability.
> + * But the implementation could block peer-to-peer transactions between them
> + * and provide ACS-like functionality.
Also, if the following comment is accurate, please incorporate it:
Wangxun 10G/1G NICs have no ACS capability, but on multi-function
devices, the hardware does block peer-to-peer transactions between
the functions and provides ACS-like functionality.
"Implementation *could* block peer-to-peer transactions" doesn't say
whether it actually *does*.
If this all makes sense, please repost the patch with updated text. I
don't want to update it myself because I don't know anything about the
NICs and I don't want to make assumptions.
Bjorn
> + */
> +static int pci_quirk_wangxun_nic_acs(struct pci_dev *dev, u16 acs_flags)
> +{
> + switch (dev->device) {
> + case 0x0100 ... 0x010F:
> + case 0x1001:
> + case 0x2001:
> + return pci_acs_ctrl_enabled(acs_flags,
> + PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
> + }
> +
> + return false;
> +}
> +
> static const struct pci_dev_acs_enabled {
> u16 vendor;
> u16 device;
> @@ -4980,6 +4998,8 @@ static const struct pci_dev_acs_enabled {
> { PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs },
> /* Zhaoxin Root/Downstream Ports */
> { PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs },
> + /* Wangxun nics */
> + { PCI_VENDOR_ID_WANGXUN, PCI_ANY_ID, pci_quirk_wangxun_nic_acs },
> { 0 }
> };
>
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index b362d90eb9b0..bc8f484cdcf3 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -3012,6 +3012,8 @@
> #define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b
> #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
>
> +#define PCI_VENDOR_ID_WANGXUN 0x8088
> +
> #define PCI_VENDOR_ID_SCALEMP 0x8686
> #define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
>
> --
> 2.39.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: Add ACS quirk for Wangxun NICs
2023-02-07 10:24 Mengyuan Lou
2023-02-07 17:38 ` Simon Horman
@ 2023-02-14 0:07 ` Bjorn Helgaas
1 sibling, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2023-02-14 0:07 UTC (permalink / raw)
To: Mengyuan Lou; +Cc: netdev, linux-pci
On Tue, Feb 07, 2023 at 06:24:19PM +0800, Mengyuan Lou wrote:
> Wangxun has verified there is no peer-to-peer between functions for the
> below selection of SFxxx, RP1000 and RP2000 NICS.
> They may be multi-function device, but the hardware does not advertise
> ACS capability.
>
> Add an ACS quirk for these devices so the functions can be in
> independent IOMMU groups.
>
> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
Applied to pci/virtualization for v6.3, thanks!
> ---
> drivers/pci/quirks.c | 22 ++++++++++++++++++++++
> include/linux/pci_ids.h | 2 ++
> 2 files changed, 24 insertions(+)
>
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 285acc4aaccc..13290048beda 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -4835,6 +4835,26 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags)
> PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
> }
>
> +/*
> + * Wangxun 10G/1G NICs have no ACS capability, and on multi-function
> + * devices, peer-to-peer transactions are not be used between the functions.
> + * So add an ACS quirk for below devices to isolate functions.
> + * SFxxx 1G NICs(em).
> + * RP1000/RP2000 10G NICs(sp).
> + */
> +static int pci_quirk_wangxun_nic_acs(struct pci_dev *dev, u16 acs_flags)
> +{
> + switch (dev->device) {
> + case 0x0100 ... 0x010F:
> + case 0x1001:
> + case 0x2001:
> + return pci_acs_ctrl_enabled(acs_flags,
> + PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
> + }
> +
> + return false;
> +}
> +
> static const struct pci_dev_acs_enabled {
> u16 vendor;
> u16 device;
> @@ -4980,6 +5000,8 @@ static const struct pci_dev_acs_enabled {
> { PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs },
> /* Zhaoxin Root/Downstream Ports */
> { PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs },
> + /* Wangxun nics */
> + { PCI_VENDOR_ID_WANGXUN, PCI_ANY_ID, pci_quirk_wangxun_nic_acs },
> { 0 }
> };
>
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index b362d90eb9b0..bc8f484cdcf3 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -3012,6 +3012,8 @@
> #define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b
> #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
>
> +#define PCI_VENDOR_ID_WANGXUN 0x8088
> +
> #define PCI_VENDOR_ID_SCALEMP 0x8686
> #define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
>
> --
> 2.39.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: Add ACS quirk for Wangxun NICs
2023-02-08 2:16 ` mengyuanlou
@ 2023-02-08 8:20 ` Simon Horman
0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2023-02-08 8:20 UTC (permalink / raw)
To: mengyuanlou; +Cc: netdev, linux-pci, helgaas
On Wed, Feb 08, 2023 at 10:16:13AM +0800, mengyuanlou@net-swift.com wrote:
>
>
> > 2023年2月8日 01:38,Simon Horman <simon.horman@corigine.com> 写道:
> >
> > On Tue, Feb 07, 2023 at 06:24:19PM +0800, Mengyuan Lou wrote:
> >> Wangxun has verified there is no peer-to-peer between functions for the
> >> below selection of SFxxx, RP1000 and RP2000 NICS.
> >> They may be multi-function device, but the hardware does not advertise
> >> ACS capability.
> >>
> >> Add an ACS quirk for these devices so the functions can be in
> >> independent IOMMU groups.
> >>
> >> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
> >
> > ...
> >
> >> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> >> index b362d90eb9b0..bc8f484cdcf3 100644
> >> --- a/include/linux/pci_ids.h
> >> +++ b/include/linux/pci_ids.h
> >> @@ -3012,6 +3012,8 @@
> >> #define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b
> >> #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
> >>
> >> +#define PCI_VENDOR_ID_WANGXUN 0x8088
> >> +
> >
> > nit: this is already present in drivers/net/ethernet/wangxun/libwx/wx_type.h
> > perhaps it can be removed from there as a follow-up ?
> It will be removed in a later patch.
Perfect, thanks.
> >> #define PCI_VENDOR_ID_SCALEMP 0x8686
> >> #define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: Add ACS quirk for Wangxun NICs
2023-02-07 17:38 ` Simon Horman
@ 2023-02-08 2:16 ` mengyuanlou
2023-02-08 8:20 ` Simon Horman
0 siblings, 1 reply; 7+ messages in thread
From: mengyuanlou @ 2023-02-08 2:16 UTC (permalink / raw)
To: Simon Horman; +Cc: netdev, linux-pci, helgaas
> 2023年2月8日 01:38,Simon Horman <simon.horman@corigine.com> 写道:
>
> On Tue, Feb 07, 2023 at 06:24:19PM +0800, Mengyuan Lou wrote:
>> Wangxun has verified there is no peer-to-peer between functions for the
>> below selection of SFxxx, RP1000 and RP2000 NICS.
>> They may be multi-function device, but the hardware does not advertise
>> ACS capability.
>>
>> Add an ACS quirk for these devices so the functions can be in
>> independent IOMMU groups.
>>
>> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
>
> ...
>
>> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
>> index b362d90eb9b0..bc8f484cdcf3 100644
>> --- a/include/linux/pci_ids.h
>> +++ b/include/linux/pci_ids.h
>> @@ -3012,6 +3012,8 @@
>> #define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b
>> #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
>>
>> +#define PCI_VENDOR_ID_WANGXUN 0x8088
>> +
>
> nit: this is already present in drivers/net/ethernet/wangxun/libwx/wx_type.h
> perhaps it can be removed from there as a follow-up ?
It will be removed in a later patch.
>
>> #define PCI_VENDOR_ID_SCALEMP 0x8686
>> #define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
>>
>> --
>> 2.39.1
>>
>
Best Regards,
Mengyuanlou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] PCI: Add ACS quirk for Wangxun NICs
2023-02-07 10:24 Mengyuan Lou
@ 2023-02-07 17:38 ` Simon Horman
2023-02-08 2:16 ` mengyuanlou
2023-02-14 0:07 ` Bjorn Helgaas
1 sibling, 1 reply; 7+ messages in thread
From: Simon Horman @ 2023-02-07 17:38 UTC (permalink / raw)
To: Mengyuan Lou; +Cc: netdev, linux-pci, helgaas
On Tue, Feb 07, 2023 at 06:24:19PM +0800, Mengyuan Lou wrote:
> Wangxun has verified there is no peer-to-peer between functions for the
> below selection of SFxxx, RP1000 and RP2000 NICS.
> They may be multi-function device, but the hardware does not advertise
> ACS capability.
>
> Add an ACS quirk for these devices so the functions can be in
> independent IOMMU groups.
>
> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
...
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index b362d90eb9b0..bc8f484cdcf3 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -3012,6 +3012,8 @@
> #define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b
> #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
>
> +#define PCI_VENDOR_ID_WANGXUN 0x8088
> +
nit: this is already present in drivers/net/ethernet/wangxun/libwx/wx_type.h
perhaps it can be removed from there as a follow-up ?
> #define PCI_VENDOR_ID_SCALEMP 0x8686
> #define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
>
> --
> 2.39.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] PCI: Add ACS quirk for Wangxun NICs
@ 2023-02-07 10:24 Mengyuan Lou
2023-02-07 17:38 ` Simon Horman
2023-02-14 0:07 ` Bjorn Helgaas
0 siblings, 2 replies; 7+ messages in thread
From: Mengyuan Lou @ 2023-02-07 10:24 UTC (permalink / raw)
To: netdev; +Cc: linux-pci, helgaas, Mengyuan Lou
Wangxun has verified there is no peer-to-peer between functions for the
below selection of SFxxx, RP1000 and RP2000 NICS.
They may be multi-function device, but the hardware does not advertise
ACS capability.
Add an ACS quirk for these devices so the functions can be in
independent IOMMU groups.
Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>
---
drivers/pci/quirks.c | 22 ++++++++++++++++++++++
include/linux/pci_ids.h | 2 ++
2 files changed, 24 insertions(+)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 285acc4aaccc..13290048beda 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4835,6 +4835,26 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags)
PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
}
+/*
+ * Wangxun 10G/1G NICs have no ACS capability, and on multi-function
+ * devices, peer-to-peer transactions are not be used between the functions.
+ * So add an ACS quirk for below devices to isolate functions.
+ * SFxxx 1G NICs(em).
+ * RP1000/RP2000 10G NICs(sp).
+ */
+static int pci_quirk_wangxun_nic_acs(struct pci_dev *dev, u16 acs_flags)
+{
+ switch (dev->device) {
+ case 0x0100 ... 0x010F:
+ case 0x1001:
+ case 0x2001:
+ return pci_acs_ctrl_enabled(acs_flags,
+ PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
+ }
+
+ return false;
+}
+
static const struct pci_dev_acs_enabled {
u16 vendor;
u16 device;
@@ -4980,6 +5000,8 @@ static const struct pci_dev_acs_enabled {
{ PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs },
/* Zhaoxin Root/Downstream Ports */
{ PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs },
+ /* Wangxun nics */
+ { PCI_VENDOR_ID_WANGXUN, PCI_ANY_ID, pci_quirk_wangxun_nic_acs },
{ 0 }
};
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index b362d90eb9b0..bc8f484cdcf3 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -3012,6 +3012,8 @@
#define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b
#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
+#define PCI_VENDOR_ID_WANGXUN 0x8088
+
#define PCI_VENDOR_ID_SCALEMP 0x8686
#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
--
2.39.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-02-14 0:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01 10:47 [PATCH] PCI: Add ACS quirk for Wangxun NICs Mengyuan Lou
2023-02-01 15:37 ` Bjorn Helgaas
2023-02-07 10:24 Mengyuan Lou
2023-02-07 17:38 ` Simon Horman
2023-02-08 2:16 ` mengyuanlou
2023-02-08 8:20 ` Simon Horman
2023-02-14 0:07 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).