linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Add quirk for VCA NTB
@ 2019-09-13 12:22 Kitszel, PrzemyslawX
  2019-09-16 16:00 ` Andrew Murray
  0 siblings, 1 reply; 3+ messages in thread
From: Kitszel, PrzemyslawX @ 2019-09-13 12:22 UTC (permalink / raw)
  To: linux-pci; +Cc: Maslowski, Karol

From 863d9ea0d888233dbfcbf52212ae97b2bc557ae6 Mon Sep 17 00:00:00 2001
From: Slawomir Pawlowski <slawomir.pawlowski@intel.com>
Date: Fri, 21 Sep 2018 15:55:12 +0200
Subject: [PATCH] PCI: Add quirk for VCA NTB

Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices
exposing computational units via Non Transparent Bridges (NTB, PEX 87xx).

Similarly to MIC x200, there is need to add DMA aliases to allow buffer
access when IOMMU is enabled.
Following aliases are allowing host device and computational unit to access
each other.
Together those aliases marks whole VCA device as one IOMMU group.

All possible slot numbers (0x20) are used, sine we are unable to tell what
slot is used on other side.
This quirk is intended for both host and computational unit sides.
The VCA devices have up to 5 functions - 4 for DMA channels and one
additional.

Signed-off-by: Slawomir Pawlowski <slawomir.pawlowski@intel.com>
Signed-off-by: Przemek Kitszel <przemyslawx.kitszel@intel.com>
---
 drivers/pci/quirks.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index ded60757a573..349ca28e0ae4 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4062,6 +4062,38 @@ static void quirk_mic_x200_dma_alias(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2260, quirk_mic_x200_dma_alias);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias);
 
+/*
+ * Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices
+ * exposing computational units via Non Transparent Bridges (NTB, PEX 87xx).
+ * Similarly to MIC x200, there is need to add DMA aliases to allow buffer
+ * access when IOMMU is enabled.
+ * Following aliases are allowing host device and computational unit to access
+ * each other. Together those aliases marks whole VCA device as one IOMMU group.
+ * All possible slot numbers (0x20) are used, sine we are unable to tell what
+ * slot is used on other side.
+ * This quirk is intended for both host and computational unit sides.
+ * The VCA devices have up to 5 functions (4 for DMA channels and 1 additional).
+ */
+static void quirk_pex_vca_alias(struct pci_dev *pdev)
+{
+	const unsigned int num_pci_slots = 0x20;
+	unsigned int slot;
+
+	for (slot = 0; slot < num_pci_slots; slot++) {
+		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0));
+		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x1));
+		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x2));
+		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x3));
+		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x4));
+	}
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2954, quirk_pex_vca_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2955, quirk_pex_vca_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2956, quirk_pex_vca_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2958, quirk_pex_vca_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2959, quirk_pex_vca_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x295A, quirk_pex_vca_alias);
+
 /*
  * The IOMMU and interrupt controller on Broadcom Vulcan/Cavium ThunderX2 are
  * associated not at the root bus, but at a bridge below. This quirk avoids
-- 
2.22.0


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

* Re: [PATCH] PCI: Add quirk for VCA NTB
  2019-09-13 12:22 [PATCH] PCI: Add quirk for VCA NTB Kitszel, PrzemyslawX
@ 2019-09-16 16:00 ` Andrew Murray
  2019-09-17  9:16   ` Kitszel, PrzemyslawX
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Murray @ 2019-09-16 16:00 UTC (permalink / raw)
  To: Kitszel, PrzemyslawX; +Cc: linux-pci, Maslowski, Karol

On Fri, Sep 13, 2019 at 12:22:38PM +0000, Kitszel, PrzemyslawX wrote:
> From 863d9ea0d888233dbfcbf52212ae97b2bc557ae6 Mon Sep 17 00:00:00 2001
> From: Slawomir Pawlowski <slawomir.pawlowski@intel.com>
> Date: Fri, 21 Sep 2018 15:55:12 +0200
> Subject: [PATCH] PCI: Add quirk for VCA NTB
> 
> Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices
> exposing computational units via Non Transparent Bridges (NTB, PEX 87xx).
> 
> Similarly to MIC x200, there is need to add DMA aliases to allow buffer
> access when IOMMU is enabled.
> Following aliases are allowing host device and computational unit to access
> each other.
> Together those aliases marks whole VCA device as one IOMMU group.
> 
> All possible slot numbers (0x20) are used, sine we are unable to tell what

s/sine/since/g

Thanks,

Andrew Murray

> slot is used on other side.
> This quirk is intended for both host and computational unit sides.
> The VCA devices have up to 5 functions - 4 for DMA channels and one
> additional.
> 
> Signed-off-by: Slawomir Pawlowski <slawomir.pawlowski@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslawx.kitszel@intel.com>
> ---
>  drivers/pci/quirks.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index ded60757a573..349ca28e0ae4 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -4062,6 +4062,38 @@ static void quirk_mic_x200_dma_alias(struct pci_dev *pdev)
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2260, quirk_mic_x200_dma_alias);
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias);
>  
> +/*
> + * Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices
> + * exposing computational units via Non Transparent Bridges (NTB, PEX 87xx).
> + * Similarly to MIC x200, there is need to add DMA aliases to allow buffer
> + * access when IOMMU is enabled.
> + * Following aliases are allowing host device and computational unit to access
> + * each other. Together those aliases marks whole VCA device as one IOMMU group.
> + * All possible slot numbers (0x20) are used, sine we are unable to tell what
> + * slot is used on other side.
> + * This quirk is intended for both host and computational unit sides.
> + * The VCA devices have up to 5 functions (4 for DMA channels and 1 additional).
> + */
> +static void quirk_pex_vca_alias(struct pci_dev *pdev)
> +{
> +	const unsigned int num_pci_slots = 0x20;
> +	unsigned int slot;
> +
> +	for (slot = 0; slot < num_pci_slots; slot++) {
> +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0));
> +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x1));
> +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x2));
> +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x3));
> +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x4));
> +	}
> +}
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2954, quirk_pex_vca_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2955, quirk_pex_vca_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2956, quirk_pex_vca_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2958, quirk_pex_vca_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2959, quirk_pex_vca_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x295A, quirk_pex_vca_alias);
> +
>  /*
>   * The IOMMU and interrupt controller on Broadcom Vulcan/Cavium ThunderX2 are
>   * associated not at the root bus, but at a bridge below. This quirk avoids
> -- 
> 2.22.0
> 

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

* RE: [PATCH] PCI: Add quirk for VCA NTB
  2019-09-16 16:00 ` Andrew Murray
@ 2019-09-17  9:16   ` Kitszel, PrzemyslawX
  0 siblings, 0 replies; 3+ messages in thread
From: Kitszel, PrzemyslawX @ 2019-09-17  9:16 UTC (permalink / raw)
  To: Andrew Murray; +Cc: linux-pci, Maslowski, Karol

On Mon, Sep 16, 2019 at 6:00:00PM +0000, Andrew Murray wrote:
> On Fri, Sep 13, 2019 at 12:22:38PM +0000, Kitszel, PrzemyslawX wrote:
> > From 863d9ea0d888233dbfcbf52212ae97b2bc557ae6 Mon Sep 17 00:00:00 2001
> > From: Slawomir Pawlowski <slawomir.pawlowski@intel.com>
> > Date: Fri, 21 Sep 2018 15:55:12 +0200
> > Subject: [PATCH] PCI: Add quirk for VCA NTB
> > 
> > Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices
> > exposing computational units via Non Transparent Bridges (NTB, PEX 87xx).
> > 
> > Similarly to MIC x200, there is need to add DMA aliases to allow buffer
> > access when IOMMU is enabled.
> > Following aliases are allowing host device and computational unit to access
> > each other.
> > Together those aliases marks whole VCA device as one IOMMU group.
> > 
> > All possible slot numbers (0x20) are used, sine we are unable to tell what
> 
> s/sine/since/g
> 
> Thanks,
> 
> Andrew Murray
>

Thanks,

I will sent v2 patch in a moment.

Przemek Kitszel

> > slot is used on other side.
> > This quirk is intended for both host and computational unit sides.
> > The VCA devices have up to 5 functions - 4 for DMA channels and one
> > additional.
> > 
> > Signed-off-by: Slawomir Pawlowski <slawomir.pawlowski@intel.com>
> > Signed-off-by: Przemek Kitszel <przemyslawx.kitszel@intel.com>
> > ---
> >  drivers/pci/quirks.c | 32 ++++++++++++++++++++++++++++++++
> >  1 file changed, 32 insertions(+)
> > 
> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> > index ded60757a573..349ca28e0ae4 100644
> > --- a/drivers/pci/quirks.c
> > +++ b/drivers/pci/quirks.c
> > @@ -4062,6 +4062,38 @@ static void quirk_mic_x200_dma_alias(struct pci_dev *pdev)
> >  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2260, quirk_mic_x200_dma_alias);
> >  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias);
> >  
> > +/*
> > + * Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices
> > + * exposing computational units via Non Transparent Bridges (NTB, PEX 87xx).
> > + * Similarly to MIC x200, there is need to add DMA aliases to allow buffer
> > + * access when IOMMU is enabled.
> > + * Following aliases are allowing host device and computational unit to access
> > + * each other. Together those aliases marks whole VCA device as one IOMMU group.
> > + * All possible slot numbers (0x20) are used, sine we are unable to tell what
> > + * slot is used on other side.
> > + * This quirk is intended for both host and computational unit sides.
> > + * The VCA devices have up to 5 functions (4 for DMA channels and 1 additional).
> > + */
> > +static void quirk_pex_vca_alias(struct pci_dev *pdev)
> > +{
> > +	const unsigned int num_pci_slots = 0x20;
> > +	unsigned int slot;
> > +
> > +	for (slot = 0; slot < num_pci_slots; slot++) {
> > +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0));
> > +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x1));
> > +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x2));
> > +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x3));
> > +		pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x4));
> > +	}
> > +}
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2954, quirk_pex_vca_alias);
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2955, quirk_pex_vca_alias);
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2956, quirk_pex_vca_alias);
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2958, quirk_pex_vca_alias);
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2959, quirk_pex_vca_alias);
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x295A, quirk_pex_vca_alias);
> > +
> >  /*
> >   * The IOMMU and interrupt controller on Broadcom Vulcan/Cavium ThunderX2 are
> >   * associated not at the root bus, but at a bridge below. This quirk avoids
> > -- 
> > 2.22.0
> >

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

end of thread, other threads:[~2019-09-17  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13 12:22 [PATCH] PCI: Add quirk for VCA NTB Kitszel, PrzemyslawX
2019-09-16 16:00 ` Andrew Murray
2019-09-17  9:16   ` Kitszel, PrzemyslawX

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).