[PATCH] xio3130_upstream: Add ACS (Access Control Services) capability

Paul Schlacter posted 1 patch 1 year, 8 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
1 file changed, 3 insertions(+)
[PATCH] xio3130_upstream: Add ACS (Access Control Services) capability
Posted by Paul Schlacter 1 year, 8 months ago
If it is a pcie device, check that all devices on the path from

the device to the root complex have ACS enabled, and then the

device will become an iommu_group.

it will have the effect of isolation


Signed-off-by: wlfightup <wlfightup@gmail.com>

---

 hw/pci-bridge/xio3130_upstream.c | 3 +++

 1 file changed, 3 insertions(+)


diff --git a/hw/pci-bridge/xio3130_upstream.c
b/hw/pci-bridge/xio3130_upstream.c

index 5ff46ef050..2df952222b 100644

--- a/hw/pci-bridge/xio3130_upstream.c

+++ b/hw/pci-bridge/xio3130_upstream.c

@@ -37,6 +37,8 @@

 #define XIO3130_SSVID_SSID              0

 #define XIO3130_EXP_OFFSET              0x90

 #define XIO3130_AER_OFFSET              0x100

+#define XIO3130_ACS_OFFSET \

+        (XIO3130_AER_OFFSET + PCI_ERR_SIZEOF)


 static void xio3130_upstream_write_config(PCIDevice *d, uint32_t address,

                                           uint32_t val, int len)

@@ -92,6 +94,7 @@ static void xio3130_upstream_realize(PCIDevice *d, Error
**errp)

         goto err;

     }


+    pcie_acs_init(d, XIO3130_ACS_OFFSET);

     return;


 err:

--

2.24.3 (Apple Git-128)
Re: [PATCH] xio3130_upstream: Add ACS (Access Control Services) capability
Posted by Michael S. Tsirkin 1 year, 8 months ago
On Sun, Aug 14, 2022 at 03:47:49PM +0800, Paul Schlacter wrote:
> If it is a pcie device, check that all devices on the path from
> 
> the device to the root complex have ACS enabled, and then the
> 
> device will become an iommu_group.
> 
> it will have the effect of isolation
> 
> 
> Signed-off-by: wlfightup <wlfightup@gmail.com>

I don't think we can do this unconditionally. Has to have
a property and disabled for old versions.

> ---
> 
>  hw/pci-bridge/xio3130_upstream.c | 3 +++
> 
>  1 file changed, 3 insertions(+)
> 
> 
> diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/
> xio3130_upstream.c
> 
> index 5ff46ef050..2df952222b 100644
> 
> --- a/hw/pci-bridge/xio3130_upstream.c
> 
> +++ b/hw/pci-bridge/xio3130_upstream.c
> 
> @@ -37,6 +37,8 @@
> 
>  #define XIO3130_SSVID_SSID              0
> 
>  #define XIO3130_EXP_OFFSET              0x90
> 
>  #define XIO3130_AER_OFFSET              0x100
> 
> +#define XIO3130_ACS_OFFSET \
> 
> +        (XIO3130_AER_OFFSET + PCI_ERR_SIZEOF)
> 
> 
>  static void xio3130_upstream_write_config(PCIDevice *d, uint32_t address,
> 
>                                            uint32_t val, int len)
> 
> @@ -92,6 +94,7 @@ static void xio3130_upstream_realize(PCIDevice *d, Error
> **errp)
> 
>          goto err;
> 
>      }
> 
> 
> +    pcie_acs_init(d, XIO3130_ACS_OFFSET);
> 
>      return;
> 
> 
>  err:
> 
> --
> 
> 2.24.3 (Apple Git-128)
> 
Re: [PATCH] xio3130_upstream: Add ACS (Access Control Services) capability
Posted by Paul Schlacter 1 year, 8 months ago
What's wrong with not disabling the old version?


On Sun, Aug 14, 2022 at 6:48 PM Michael S. Tsirkin <mst@redhat.com> wrote:

> On Sun, Aug 14, 2022 at 03:47:49PM +0800, Paul Schlacter wrote:
> > If it is a pcie device, check that all devices on the path from
> >
> > the device to the root complex have ACS enabled, and then the
> >
> > device will become an iommu_group.
> >
> > it will have the effect of isolation
> >
> >
> > Signed-off-by: wlfightup <wlfightup@gmail.com>
>
> I don't think we can do this unconditionally. Has to have
> a property and disabled for old versions.
>
> > ---
> >
> >  hw/pci-bridge/xio3130_upstream.c | 3 +++
> >
> >  1 file changed, 3 insertions(+)
> >
> >
> > diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/
> > xio3130_upstream.c
> >
> > index 5ff46ef050..2df952222b 100644
> >
> > --- a/hw/pci-bridge/xio3130_upstream.c
> >
> > +++ b/hw/pci-bridge/xio3130_upstream.c
> >
> > @@ -37,6 +37,8 @@
> >
> >  #define XIO3130_SSVID_SSID              0
> >
> >  #define XIO3130_EXP_OFFSET              0x90
> >
> >  #define XIO3130_AER_OFFSET              0x100
> >
> > +#define XIO3130_ACS_OFFSET \
> >
> > +        (XIO3130_AER_OFFSET + PCI_ERR_SIZEOF)
> >
> >
> >  static void xio3130_upstream_write_config(PCIDevice *d, uint32_t
> address,
> >
> >                                            uint32_t val, int len)
> >
> > @@ -92,6 +94,7 @@ static void xio3130_upstream_realize(PCIDevice *d,
> Error
> > **errp)
> >
> >          goto err;
> >
> >      }
> >
> >
> > +    pcie_acs_init(d, XIO3130_ACS_OFFSET);
> >
> >      return;
> >
> >
> >  err:
> >
> > --
> >
> > 2.24.3 (Apple Git-128)
> >
>
>
Re: [PATCH] xio3130_upstream: Add ACS (Access Control Services) capability
Posted by Michael S. Tsirkin 1 year, 8 months ago
On Sun, Aug 14, 2022 at 11:59:51PM +0800, Paul Schlacter wrote:
> What's wrong with not disabling the old version?

Old versions have to behave in the same way as they did,
or close enough. Changing that breaks migration between
qemu versions.

> 
> 
> On Sun, Aug 14, 2022 at 6:48 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> 
>     On Sun, Aug 14, 2022 at 03:47:49PM +0800, Paul Schlacter wrote:
>     > If it is a pcie device, check that all devices on the path from
>     >
>     > the device to the root complex have ACS enabled, and then the
>     >
>     > device will become an iommu_group.
>     >
>     > it will have the effect of isolation
>     >
>     >
>     > Signed-off-by: wlfightup <wlfightup@gmail.com>
> 
>     I don't think we can do this unconditionally. Has to have
>     a property and disabled for old versions.
> 
>     > ---
>     >
>     >  hw/pci-bridge/xio3130_upstream.c | 3 +++
>     >
>     >  1 file changed, 3 insertions(+)
>     >
>     >
>     > diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/
>     > xio3130_upstream.c
>     >
>     > index 5ff46ef050..2df952222b 100644
>     >
>     > --- a/hw/pci-bridge/xio3130_upstream.c
>     >
>     > +++ b/hw/pci-bridge/xio3130_upstream.c
>     >
>     > @@ -37,6 +37,8 @@
>     >
>     >  #define XIO3130_SSVID_SSID              0
>     >
>     >  #define XIO3130_EXP_OFFSET              0x90
>     >
>     >  #define XIO3130_AER_OFFSET              0x100
>     >
>     > +#define XIO3130_ACS_OFFSET \
>     >
>     > +        (XIO3130_AER_OFFSET + PCI_ERR_SIZEOF)
>     >
>     >
>     >  static void xio3130_upstream_write_config(PCIDevice *d, uint32_t
>     address,
>     >
>     >                                            uint32_t val, int len)
>     >
>     > @@ -92,6 +94,7 @@ static void xio3130_upstream_realize(PCIDevice *d,
>     Error
>     > **errp)
>     >
>     >          goto err;
>     >
>     >      }
>     >
>     >
>     > +    pcie_acs_init(d, XIO3130_ACS_OFFSET);
>     >
>     >      return;
>     >
>     >
>     >  err:
>     >
>     > --
>     >
>     > 2.24.3 (Apple Git-128)
>     >
> 
>