Re: [PATCH 5/9] iommu: Introduce fault notifier API
From: Jacob Pan
Date: Wed Jun 28 2017 - 12:15:04 EST
On Wed, 28 Jun 2017 12:16:03 +0200
Joerg Roedel <joro@xxxxxxxxxx> wrote:
> On Tue, Jun 27, 2017 at 12:47:59PM -0700, Jacob Pan wrote:
> > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> > index d973555..07cfd92 100644
> > --- a/drivers/iommu/iommu.c
> > +++ b/drivers/iommu/iommu.c
> > @@ -48,6 +48,7 @@ struct iommu_group {
> > struct list_head devices;
> > struct mutex mutex;
> > struct blocking_notifier_head notifier;
> > + struct blocking_notifier_head fault_notifier;
>
> Do you really need a notifier chain here? Will there ever be more than
> one callback registered to it?
>
yes, this notifier chain is shared by all devices under a group. the
event contains device info which notifier callbacks can filter.
> > +struct iommu_fault_event {
> > + struct device *dev;
>
> Putting a 'struct device *' member in a uapi struct looks
> fundamentally wrong.
>
>
my mistake, it was originally (RFC) not in uapi but with the
consideration of using vfio to expose it to user space I have moved it
to uapi. But you are right, it should be some other forms of device
representation used by vfio. VFIO layer has to do the translation and
inject that into the guest. In kernel driver users can use struct
device to identify the faulting device.
>
> Joerg
>
[Jacob Pan]