[PATCH v7 0/5] VIRTIO-IOMMU probe request support and MSI bypass on ARM

Eric Auger posted 5 patches 3 years, 9 months ago
Test FreeBSD passed
Test docker-quick@centos7 passed
Test checkpatch passed
Test docker-mingw@fedora passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200629070404.10969-1-eric.auger@redhat.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, "Daniel P. Berrangé" <berrange@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Eric Auger <eric.auger@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>
include/exec/memory.h            |   6 ++
include/hw/arm/virt.h            |   7 ++
include/hw/qdev-properties.h     |   3 +
include/hw/virtio/virtio-iommu.h |   2 +
include/qemu/typedefs.h          |   1 +
hw/arm/virt.c                    |  30 ++++++++
hw/core/qdev-properties.c        |  89 ++++++++++++++++++++++++
hw/virtio/virtio-iommu-pci.c     |  11 +++
hw/virtio/virtio-iommu.c         | 114 +++++++++++++++++++++++++++++--
hw/virtio/trace-events           |   1 +
10 files changed, 260 insertions(+), 4 deletions(-)
[PATCH v7 0/5] VIRTIO-IOMMU probe request support and MSI bypass on ARM
Posted by Eric Auger 3 years, 9 months ago
By default the virtio-iommu translates MSI transactions. This
behavior is inherited from ARM SMMU. However the virt machine
code knows where the MSI doorbells are, so we can easily
declare those regions as VIRTIO_IOMMU_RESV_MEM_T_MSI. With that
setting the guest iommu subsystem will not need to map MSIs.
This setup will simplify the VFIO integration.

In this series, the ITS or GICV2M doorbells are declared as
HW MSI regions to be bypassed by the VIRTIO-IOMMU.

This also paves the way to the x86 integration where the MSI
region, [0xFEE00000,0xFEEFFFFF], will be exposed by the q35
machine.  However this will be handled in a separate series
when not-DT support gets resolved.

Best Regards

Eric

This series can be found at:
https://github.com/eauger/qemu/tree/v5.0.0-virtio-iommu-msi-bypass-v7

History:

v6 -> v7:
- fix the hint message
- put the assert again on probe request

v5 -> v6:
- do not hardcode start/end addresses of doorbells
- check reserved region type on realize()

v4 -> v5:
- Take into account some additional comments from Markus:
  - reserved region type becomes an unsigned + some comment/desc
    rewording
  - assert if the type is not RESERVED or MSI

v3 -> v4:
- collected Jean and markus's R-bs
- tool into account all Markus' comments in [1/5] (except removal of
  goto)
- use ':' as delimitor instead of commas
- add example in 4/5 commit message as suggested by Markus

v2 -> v3:
- Introduce VIRT_MSI_CTRL_NONE in VirtMSIControllerType
- do not fill the remainder of the probe buffer

v1 -> v2:
- check which MSI controller is in use and advertise the
  corresponding MSI doorbell
- managed for both ITS and GICv2M
- various fixes spotted by Peter and Jean-Philippe, see
  individual logs

v1: Most of those patches were respinned from
  [PATCH for-5.0 v11 00/20] VIRTIO-IOMMU device
  except the last one which is new


Eric Auger (5):
  qdev: Introduce DEFINE_PROP_RESERVED_REGION
  virtio-iommu: Implement RESV_MEM probe request
  virtio-iommu: Handle reserved regions in the translation process
  virtio-iommu-pci: Add array of Interval properties
  hw/arm/virt: Let the virtio-iommu bypass MSIs

 include/exec/memory.h            |   6 ++
 include/hw/arm/virt.h            |   7 ++
 include/hw/qdev-properties.h     |   3 +
 include/hw/virtio/virtio-iommu.h |   2 +
 include/qemu/typedefs.h          |   1 +
 hw/arm/virt.c                    |  30 ++++++++
 hw/core/qdev-properties.c        |  89 ++++++++++++++++++++++++
 hw/virtio/virtio-iommu-pci.c     |  11 +++
 hw/virtio/virtio-iommu.c         | 114 +++++++++++++++++++++++++++++--
 hw/virtio/trace-events           |   1 +
 10 files changed, 260 insertions(+), 4 deletions(-)

-- 
2.20.1


Re: [PATCH v7 0/5] VIRTIO-IOMMU probe request support and MSI bypass on ARM
Posted by Peter Maydell 3 years, 9 months ago
On Mon, 29 Jun 2020 at 08:04, Eric Auger <eric.auger@redhat.com> wrote:
>
> By default the virtio-iommu translates MSI transactions. This
> behavior is inherited from ARM SMMU. However the virt machine
> code knows where the MSI doorbells are, so we can easily
> declare those regions as VIRTIO_IOMMU_RESV_MEM_T_MSI. With that
> setting the guest iommu subsystem will not need to map MSIs.
> This setup will simplify the VFIO integration.
>
> In this series, the ITS or GICV2M doorbells are declared as
> HW MSI regions to be bypassed by the VIRTIO-IOMMU.
>
> This also paves the way to the x86 integration where the MSI
> region, [0xFEE00000,0xFEEFFFFF], will be exposed by the q35
> machine.  However this will be handled in a separate series
> when not-DT support gets resolved.
>
> Best Regards
>
> Eric



Applied to target-arm.next, thanks.

-- PMM

Re: [PATCH v7 0/5] VIRTIO-IOMMU probe request support and MSI bypass on ARM
Posted by Auger Eric 3 years, 9 months ago
Hi,

On 6/29/20 9:03 AM, Eric Auger wrote:
> By default the virtio-iommu translates MSI transactions. This
> behavior is inherited from ARM SMMU. However the virt machine
> code knows where the MSI doorbells are, so we can easily
> declare those regions as VIRTIO_IOMMU_RESV_MEM_T_MSI. With that
> setting the guest iommu subsystem will not need to map MSIs.
> This setup will simplify the VFIO integration.
> 
> In this series, the ITS or GICV2M doorbells are declared as
> HW MSI regions to be bypassed by the VIRTIO-IOMMU.
> 
> This also paves the way to the x86 integration where the MSI
> region, [0xFEE00000,0xFEEFFFFF], will be exposed by the q35
> machine.  However this will be handled in a separate series
> when not-DT support gets resolved.
> 
> Best Regards
> 
> Eric
> 
> This series can be found at:
> https://github.com/eauger/qemu/tree/v5.0.0-virtio-iommu-msi-bypass-v7

A gentle reminder to make sure this series does not get forgotten before
the freeze.

Best Regards

Eric
> 
> History:
> 
> v6 -> v7:
> - fix the hint message
> - put the assert again on probe request
> 
> v5 -> v6:
> - do not hardcode start/end addresses of doorbells
> - check reserved region type on realize()
> 
> v4 -> v5:
> - Take into account some additional comments from Markus:
>   - reserved region type becomes an unsigned + some comment/desc
>     rewording
>   - assert if the type is not RESERVED or MSI
> 
> v3 -> v4:
> - collected Jean and markus's R-bs
> - tool into account all Markus' comments in [1/5] (except removal of
>   goto)
> - use ':' as delimitor instead of commas
> - add example in 4/5 commit message as suggested by Markus
> 
> v2 -> v3:
> - Introduce VIRT_MSI_CTRL_NONE in VirtMSIControllerType
> - do not fill the remainder of the probe buffer
> 
> v1 -> v2:
> - check which MSI controller is in use and advertise the
>   corresponding MSI doorbell
> - managed for both ITS and GICv2M
> - various fixes spotted by Peter and Jean-Philippe, see
>   individual logs
> 
> v1: Most of those patches were respinned from
>   [PATCH for-5.0 v11 00/20] VIRTIO-IOMMU device
>   except the last one which is new
> 
> 
> Eric Auger (5):
>   qdev: Introduce DEFINE_PROP_RESERVED_REGION
>   virtio-iommu: Implement RESV_MEM probe request
>   virtio-iommu: Handle reserved regions in the translation process
>   virtio-iommu-pci: Add array of Interval properties
>   hw/arm/virt: Let the virtio-iommu bypass MSIs
> 
>  include/exec/memory.h            |   6 ++
>  include/hw/arm/virt.h            |   7 ++
>  include/hw/qdev-properties.h     |   3 +
>  include/hw/virtio/virtio-iommu.h |   2 +
>  include/qemu/typedefs.h          |   1 +
>  hw/arm/virt.c                    |  30 ++++++++
>  hw/core/qdev-properties.c        |  89 ++++++++++++++++++++++++
>  hw/virtio/virtio-iommu-pci.c     |  11 +++
>  hw/virtio/virtio-iommu.c         | 114 +++++++++++++++++++++++++++++--
>  hw/virtio/trace-events           |   1 +
>  10 files changed, 260 insertions(+), 4 deletions(-)
> 


Re: [PATCH v7 0/5] VIRTIO-IOMMU probe request support and MSI bypass on ARM
Posted by Michael S. Tsirkin 3 years, 9 months ago
On Mon, Jun 29, 2020 at 09:03:59AM +0200, Eric Auger wrote:
> By default the virtio-iommu translates MSI transactions. This
> behavior is inherited from ARM SMMU. However the virt machine
> code knows where the MSI doorbells are, so we can easily
> declare those regions as VIRTIO_IOMMU_RESV_MEM_T_MSI. With that
> setting the guest iommu subsystem will not need to map MSIs.
> This setup will simplify the VFIO integration.
> 
> In this series, the ITS or GICV2M doorbells are declared as
> HW MSI regions to be bypassed by the VIRTIO-IOMMU.
> 
> This also paves the way to the x86 integration where the MSI
> region, [0xFEE00000,0xFEEFFFFF], will be exposed by the q35
> machine.  However this will be handled in a separate series
> when not-DT support gets resolved.


virtio things:

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>


ARM tree makes sense for this, right?


> Best Regards
> 
> Eric
> 
> This series can be found at:
> https://github.com/eauger/qemu/tree/v5.0.0-virtio-iommu-msi-bypass-v7
> 
> History:
> 
> v6 -> v7:
> - fix the hint message
> - put the assert again on probe request
> 
> v5 -> v6:
> - do not hardcode start/end addresses of doorbells
> - check reserved region type on realize()
> 
> v4 -> v5:
> - Take into account some additional comments from Markus:
>   - reserved region type becomes an unsigned + some comment/desc
>     rewording
>   - assert if the type is not RESERVED or MSI
> 
> v3 -> v4:
> - collected Jean and markus's R-bs
> - tool into account all Markus' comments in [1/5] (except removal of
>   goto)
> - use ':' as delimitor instead of commas
> - add example in 4/5 commit message as suggested by Markus
> 
> v2 -> v3:
> - Introduce VIRT_MSI_CTRL_NONE in VirtMSIControllerType
> - do not fill the remainder of the probe buffer
> 
> v1 -> v2:
> - check which MSI controller is in use and advertise the
>   corresponding MSI doorbell
> - managed for both ITS and GICv2M
> - various fixes spotted by Peter and Jean-Philippe, see
>   individual logs
> 
> v1: Most of those patches were respinned from
>   [PATCH for-5.0 v11 00/20] VIRTIO-IOMMU device
>   except the last one which is new
> 
> 
> Eric Auger (5):
>   qdev: Introduce DEFINE_PROP_RESERVED_REGION
>   virtio-iommu: Implement RESV_MEM probe request
>   virtio-iommu: Handle reserved regions in the translation process
>   virtio-iommu-pci: Add array of Interval properties
>   hw/arm/virt: Let the virtio-iommu bypass MSIs
> 
>  include/exec/memory.h            |   6 ++
>  include/hw/arm/virt.h            |   7 ++
>  include/hw/qdev-properties.h     |   3 +
>  include/hw/virtio/virtio-iommu.h |   2 +
>  include/qemu/typedefs.h          |   1 +
>  hw/arm/virt.c                    |  30 ++++++++
>  hw/core/qdev-properties.c        |  89 ++++++++++++++++++++++++
>  hw/virtio/virtio-iommu-pci.c     |  11 +++
>  hw/virtio/virtio-iommu.c         | 114 +++++++++++++++++++++++++++++--
>  hw/virtio/trace-events           |   1 +
>  10 files changed, 260 insertions(+), 4 deletions(-)
> 
> -- 
> 2.20.1


Re: [PATCH v7 0/5] VIRTIO-IOMMU probe request support and MSI bypass on ARM
Posted by Auger Eric 3 years, 9 months ago
Hi Michael,

On 7/2/20 1:28 PM, Michael S. Tsirkin wrote:
> On Mon, Jun 29, 2020 at 09:03:59AM +0200, Eric Auger wrote:
>> By default the virtio-iommu translates MSI transactions. This
>> behavior is inherited from ARM SMMU. However the virt machine
>> code knows where the MSI doorbells are, so we can easily
>> declare those regions as VIRTIO_IOMMU_RESV_MEM_T_MSI. With that
>> setting the guest iommu subsystem will not need to map MSIs.
>> This setup will simplify the VFIO integration.
>>
>> In this series, the ITS or GICV2M doorbells are declared as
>> HW MSI regions to be bypassed by the VIRTIO-IOMMU.
>>
>> This also paves the way to the x86 integration where the MSI
>> region, [0xFEE00000,0xFEEFFFFF], will be exposed by the q35
>> machine.  However this will be handled in a separate series
>> when not-DT support gets resolved.
> 
> 
> virtio things:
> 
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> 
> 
> ARM tree makes sense for this, right?

Yes I think so.

Thanks

Eric
> 
> 
>> Best Regards
>>
>> Eric
>>
>> This series can be found at:
>> https://github.com/eauger/qemu/tree/v5.0.0-virtio-iommu-msi-bypass-v7
>>
>> History:
>>
>> v6 -> v7:
>> - fix the hint message
>> - put the assert again on probe request
>>
>> v5 -> v6:
>> - do not hardcode start/end addresses of doorbells
>> - check reserved region type on realize()
>>
>> v4 -> v5:
>> - Take into account some additional comments from Markus:
>>   - reserved region type becomes an unsigned + some comment/desc
>>     rewording
>>   - assert if the type is not RESERVED or MSI
>>
>> v3 -> v4:
>> - collected Jean and markus's R-bs
>> - tool into account all Markus' comments in [1/5] (except removal of
>>   goto)
>> - use ':' as delimitor instead of commas
>> - add example in 4/5 commit message as suggested by Markus
>>
>> v2 -> v3:
>> - Introduce VIRT_MSI_CTRL_NONE in VirtMSIControllerType
>> - do not fill the remainder of the probe buffer
>>
>> v1 -> v2:
>> - check which MSI controller is in use and advertise the
>>   corresponding MSI doorbell
>> - managed for both ITS and GICv2M
>> - various fixes spotted by Peter and Jean-Philippe, see
>>   individual logs
>>
>> v1: Most of those patches were respinned from
>>   [PATCH for-5.0 v11 00/20] VIRTIO-IOMMU device
>>   except the last one which is new
>>
>>
>> Eric Auger (5):
>>   qdev: Introduce DEFINE_PROP_RESERVED_REGION
>>   virtio-iommu: Implement RESV_MEM probe request
>>   virtio-iommu: Handle reserved regions in the translation process
>>   virtio-iommu-pci: Add array of Interval properties
>>   hw/arm/virt: Let the virtio-iommu bypass MSIs
>>
>>  include/exec/memory.h            |   6 ++
>>  include/hw/arm/virt.h            |   7 ++
>>  include/hw/qdev-properties.h     |   3 +
>>  include/hw/virtio/virtio-iommu.h |   2 +
>>  include/qemu/typedefs.h          |   1 +
>>  hw/arm/virt.c                    |  30 ++++++++
>>  hw/core/qdev-properties.c        |  89 ++++++++++++++++++++++++
>>  hw/virtio/virtio-iommu-pci.c     |  11 +++
>>  hw/virtio/virtio-iommu.c         | 114 +++++++++++++++++++++++++++++--
>>  hw/virtio/trace-events           |   1 +
>>  10 files changed, 260 insertions(+), 4 deletions(-)
>>
>> -- 
>> 2.20.1
> 
> 


Re: [PATCH v7 0/5] VIRTIO-IOMMU probe request support and MSI bypass on ARM
Posted by Michael S. Tsirkin 3 years, 9 months ago
On Thu, Jul 02, 2020 at 02:01:46PM +0200, Auger Eric wrote:
> Hi Michael,
> 
> On 7/2/20 1:28 PM, Michael S. Tsirkin wrote:
> > On Mon, Jun 29, 2020 at 09:03:59AM +0200, Eric Auger wrote:
> >> By default the virtio-iommu translates MSI transactions. This
> >> behavior is inherited from ARM SMMU. However the virt machine
> >> code knows where the MSI doorbells are, so we can easily
> >> declare those regions as VIRTIO_IOMMU_RESV_MEM_T_MSI. With that
> >> setting the guest iommu subsystem will not need to map MSIs.
> >> This setup will simplify the VFIO integration.
> >>
> >> In this series, the ITS or GICV2M doorbells are declared as
> >> HW MSI regions to be bypassed by the VIRTIO-IOMMU.
> >>
> >> This also paves the way to the x86 integration where the MSI
> >> region, [0xFEE00000,0xFEEFFFFF], will be exposed by the q35
> >> machine.  However this will be handled in a separate series
> >> when not-DT support gets resolved.
> > 
> > 
> > virtio things:
> > 
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > 
> > ARM tree makes sense for this, right?
> 
> Yes I think so.
> 
> Thanks
> 
> Eric


Okay. Feel free to merge through ARM tree pls.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> > 
> > 
> >> Best Regards
> >>
> >> Eric
> >>
> >> This series can be found at:
> >> https://github.com/eauger/qemu/tree/v5.0.0-virtio-iommu-msi-bypass-v7
> >>
> >> History:
> >>
> >> v6 -> v7:
> >> - fix the hint message
> >> - put the assert again on probe request
> >>
> >> v5 -> v6:
> >> - do not hardcode start/end addresses of doorbells
> >> - check reserved region type on realize()
> >>
> >> v4 -> v5:
> >> - Take into account some additional comments from Markus:
> >>   - reserved region type becomes an unsigned + some comment/desc
> >>     rewording
> >>   - assert if the type is not RESERVED or MSI
> >>
> >> v3 -> v4:
> >> - collected Jean and markus's R-bs
> >> - tool into account all Markus' comments in [1/5] (except removal of
> >>   goto)
> >> - use ':' as delimitor instead of commas
> >> - add example in 4/5 commit message as suggested by Markus
> >>
> >> v2 -> v3:
> >> - Introduce VIRT_MSI_CTRL_NONE in VirtMSIControllerType
> >> - do not fill the remainder of the probe buffer
> >>
> >> v1 -> v2:
> >> - check which MSI controller is in use and advertise the
> >>   corresponding MSI doorbell
> >> - managed for both ITS and GICv2M
> >> - various fixes spotted by Peter and Jean-Philippe, see
> >>   individual logs
> >>
> >> v1: Most of those patches were respinned from
> >>   [PATCH for-5.0 v11 00/20] VIRTIO-IOMMU device
> >>   except the last one which is new
> >>
> >>
> >> Eric Auger (5):
> >>   qdev: Introduce DEFINE_PROP_RESERVED_REGION
> >>   virtio-iommu: Implement RESV_MEM probe request
> >>   virtio-iommu: Handle reserved regions in the translation process
> >>   virtio-iommu-pci: Add array of Interval properties
> >>   hw/arm/virt: Let the virtio-iommu bypass MSIs
> >>
> >>  include/exec/memory.h            |   6 ++
> >>  include/hw/arm/virt.h            |   7 ++
> >>  include/hw/qdev-properties.h     |   3 +
> >>  include/hw/virtio/virtio-iommu.h |   2 +
> >>  include/qemu/typedefs.h          |   1 +
> >>  hw/arm/virt.c                    |  30 ++++++++
> >>  hw/core/qdev-properties.c        |  89 ++++++++++++++++++++++++
> >>  hw/virtio/virtio-iommu-pci.c     |  11 +++
> >>  hw/virtio/virtio-iommu.c         | 114 +++++++++++++++++++++++++++++--
> >>  hw/virtio/trace-events           |   1 +
> >>  10 files changed, 260 insertions(+), 4 deletions(-)
> >>
> >> -- 
> >> 2.20.1
> > 
> >