vfio-user: IOMMU support for remote device

Assign separate address space for each device in the remote processes.

Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: afe0b0a97582cdad42b5b25636a29c523265a10a.1655151679.git.jag.raman@oracle.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Jagannathan Raman 2022-06-13 16:26:30 -04:00 committed by Stefan Hajnoczi
parent 90072f29d6
commit 253007d147
5 changed files with 186 additions and 1 deletions

View file

@ -20,6 +20,7 @@
#include "qapi/error.h"
#include "hw/pci/pci_host.h"
#include "hw/remote/iohub.h"
#include "hw/remote/iommu.h"
#include "hw/qdev-core.h"
static void remote_machine_init(MachineState *machine)
@ -99,6 +100,16 @@ static void remote_machine_instance_init(Object *obj)
s->auto_shutdown = true;
}
static void remote_machine_dev_unplug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
qdev_unrealize(dev);
if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
remote_iommu_unplug_dev(PCI_DEVICE(dev));
}
}
static void remote_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@ -107,7 +118,7 @@ static void remote_machine_class_init(ObjectClass *oc, void *data)
mc->init = remote_machine_init;
mc->desc = "Experimental remote machine";
hc->unplug = qdev_simple_device_unplug_cb;
hc->unplug = remote_machine_dev_unplug_cb;
object_class_property_add_bool(oc, "vfio-user",
remote_machine_get_vfio_user,