RE: [patch 21/32] NTB/msi: Convert to msi_on_each_desc()

From: Tian, Kevin
Date: Sat Dec 11 2021 - 20:56:40 EST


> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Sent: Saturday, December 11, 2021 9:05 PM
>
> Kevin,
>
> On Sat, Dec 11 2021 at 07:44, Kevin Tian wrote:
> >> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> >> On Fri, Dec 10 2021 at 08:39, Jason Gunthorpe wrote:
> >> > It is clever, we don't have an vIOMMU that supplies vIR today, so by
> >> > definition all guests are excluded and only bare metal works.
> >>
> >> Dammit. Now you spilled the beans. :)
> >
> > Unfortunately we do have that today. Qemu supports IR for
> > both AMD and Intel vIOMMU.
>
> can you point me to the code?
>
> All I can find is drivers/iommu/virtio-iommu.c but I can't find anything
> vIR related there.
>

Well, virtio-iommu is a para-virtualized vIOMMU implementations.

In reality there are also fully emulated vIOMMU implementations (e.g.
Qemu fully emulates Intel/AMD/ARM IOMMUs). In those configurations
the IR logic in existing iommu drivers just apply:

drivers/iommu/intel/irq_remapping.c
drivers/iommu/amd/iommu.c
...

As I replied in another mail, the 1st vIR implementation was introduced
to Qemu back to 2016:

commit 1121e0afdcfa0cd40e36bd3acff56a3fac4f70fd
Author: Peter Xu <peterx@xxxxxxxxxx>
Date: Thu Jul 14 13:56:13 2016 +0800

x86-iommu: introduce "intremap" property

Adding one property for intel-iommu devices to specify whether we should
support interrupt remapping. By default, IR is disabled. To enable it,
we should use (take Intel IOMMU as example):

-device intel_iommu,intremap=on

This property can be shared by Intel and future AMD IOMMUs.

Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
Reviewed-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>

Thanks
Kevin