Re: [PATCH 0/10] IOMMU: Make iommu_ops per-bus_type

Joerg Roedel
2011-09-07T19:29:31Z

On Wed, Sep 07, 2011 at 11:48:40AM -0700, Greg KH wrote:
> On Wed, Sep 07, 2011 at 05:41:43PM +0200, Joerg Roedel wrote:
> > Diffstat:
> >
> > arch/ia64/kvm/kvm-ia64.c | 3 +-
> > arch/x86/kvm/x86.c | 3 +-
> > drivers/base/bus.c | 16 ++++++++++
> > drivers/iommu/amd_iommu.c | 2 +-
> > drivers/iommu/intel-iommu.c | 2 +-
> > drivers/iommu/iommu.c | 58 ++++++++++++++++++++++++------------
> > drivers/iommu/msm_iommu.c | 2 +-
> > drivers/iommu/omap-iommu.c | 2 +-
> > drivers/media/video/omap3isp/isp.c | 2 +-
> > include/linux/device.h | 9 +++++
> > include/linux/iommu.h | 21 +++++++------
> > virt/kvm/iommu.c | 4 +-
> > 12 files changed, 86 insertions(+), 38 deletions(-)
>
> So the overall work here makes for more code, right? I fail to see the
> benifit, what am I missing?

Yes, the code that moves code out of the IOMMU drivers is not included
here. This is only the infrastructure for future code generalization in
the IOMMU driver. That is why the iommu_bus_init() function in patch 2
is still empty :)
For example, the IOMMU drivers on x86 implement device-notifier
callbacks to know when devices are added or removed to do iommu-specific
setup. The iommu drivers also scan over the devices on a bus to do
initialization. All this device-walking code and the notifiers can be
moved to generic IOMMU code leaving only the specific setup routines in
the iommu drivers.

Regards,

Joerg