qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH qemu v8 10/14] spapr_vfio_pci: Remove redundant


From: David Gibson
Subject: Re: [Qemu-devel] [PATCH qemu v8 10/14] spapr_vfio_pci: Remove redundant spapr-pci-vfio-host-bridge
Date: Mon, 22 Jun 2015 14:41:06 +1000
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, Jun 18, 2015 at 09:37:32PM +1000, Alexey Kardashevskiy wrote:
> sPAPRTCETable is handling 2 TCE tables already:
> 
> 1) guest view of the TCE table - emulated devices use only this table;
> 
> 2) hardware IOMMU table - VFIO PCI devices use it for actual work but
> it does not replace 1) and it is not visible to the guest.
> The initialization of this table is driven by vfio-pci device,
> DMA map/unmap requests are handled via MemoryListener so there is very
> little to do in spapr-pci-vfio-host-bridge.
> 
> This moves VFIO bits to the generic spapr-pci-host-bridge which allows
> putting emulated and VFIO devices on the same PHB. It is still possible
> to create multiple PHBs and avoid sharing PHB resouces for emulated and
> VFIO devices.
> 
> If there is no VFIO-PCI device attaches, no special ioctls will be called.
> If there are some VFIO-PCI devices attached, PHB may refuse to attach
> another VFIO-PCI device if a VFIO container on the host kernel side
> does not support container sharing.
> 
> This changes spapr-pci-host-bridge to support properties of
> spapr-pci-vfio-host-bridge. This makes spapr-pci-vfio-host-bridge type
> equal to spapr-pci-host-bridge except it has an additional "iommu"
> property for backward compatibility reasons.
> 
> This moves PCI device lookup from spapr_phb_vfio_eeh_set_option() to
> rtas_ibm_set_eeh_option() as we need to know if the device is "vfio-pci"
> and decide whether to call spapr_phb_vfio_eeh_set_option() or not.
> 
> Signed-off-by: Alexey Kardashevskiy <address@hidden>
> Reviewed-by: David Gibson <address@hidden>

I like the idea of merging the two PHB classes.

But.. what if you hotplug a VFIO device on to a PHB that previously
didn't have one.  I don't see anything here that will update has_vfio
and copy the existing TCE tables into VFIO.

[snip]
> @@ -1185,6 +1161,11 @@ static void spapr_phb_realize(DeviceState *dev, Error 
> **errp)
>      uint64_t msi_window_size = 4096;
>      sPAPRTCETable *tcet;
>  
> +    if ((sphb->iommugroupid != -1) &&
> +        object_dynamic_cast(OBJECT(sphb), TYPE_SPAPR_PCI_VFIO_HOST_BRIDGE)) {
> +        error_report("Warning: iommugroupid shall not be used");

That's a rather cryptic error message.  How about
   "Warning: iommugroupid is deprecated and will be ignored"

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: pgp7ELja5X6RO.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]