| 1 | /** |
| 2 | * Copyright © 2022 Oracle and/or its affiliates. |
| 3 | * |
| 4 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 5 | * See the COPYING file in the top-level directory. |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | #ifndef REMOTE_IOMMU_H |
| 10 | #define REMOTE_IOMMU_H |
| 11 | |
| 12 | #include "hw/pci/pci_bus.h" |
| 13 | #include "hw/pci/pci.h" |
| 14 | |
| 15 | #ifndef INT2VOIDP |
| 16 | #define INT2VOIDP(i) (void *)(uintptr_t)(i) |
| 17 | #endif |
| 18 | |
| 19 | typedef struct RemoteIommuElem { |
| 20 | MemoryRegion *mr; |
| 21 | |
| 22 | AddressSpace as; |
| 23 | } RemoteIommuElem; |
| 24 | |
| 25 | #define TYPE_REMOTE_IOMMU "x-remote-iommu" |
| 26 | OBJECT_DECLARE_SIMPLE_TYPE(RemoteIommu, REMOTE_IOMMU) |
| 27 | |
| 28 | struct RemoteIommu { |
| 29 | Object parent; |
| 30 | |
| 31 | GHashTable *elem_by_devfn; |
| 32 | |
| 33 | QemuMutex lock; |
| 34 | }; |
| 35 | |
| 36 | void remote_iommu_setup(PCIBus *pci_bus); |
| 37 | |
| 38 | void remote_iommu_unplug_dev(PCIDevice *pci_dev); |
| 39 | |
| 40 | #endif |