]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/virtio/virtio-iommu.h
Move QOM typedefs and add missing includes
[mirror_qemu.git] / include / hw / virtio / virtio-iommu.h
CommitLineData
22c37a10
EA
1/*
2 * virtio-iommu device
3 *
4 * Copyright (c) 2020 Red Hat, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2 or later, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#ifndef QEMU_VIRTIO_IOMMU_H
21#define QEMU_VIRTIO_IOMMU_H
22
23#include "standard-headers/linux/virtio_iommu.h"
24#include "hw/virtio/virtio.h"
25#include "hw/pci/pci.h"
db1015e9 26#include "qom/object.h"
22c37a10
EA
27
28#define TYPE_VIRTIO_IOMMU "virtio-iommu-device"
8b4eb09e 29#define TYPE_VIRTIO_IOMMU_PCI "virtio-iommu-device-base"
db1015e9 30typedef struct VirtIOIOMMU VirtIOIOMMU;
22c37a10
EA
31#define VIRTIO_IOMMU(obj) \
32 OBJECT_CHECK(VirtIOIOMMU, (obj), TYPE_VIRTIO_IOMMU)
33
cfb42188
EA
34#define TYPE_VIRTIO_IOMMU_MEMORY_REGION "virtio-iommu-memory-region"
35
22c37a10
EA
36typedef struct IOMMUDevice {
37 void *viommu;
38 PCIBus *bus;
39 int devfn;
40 IOMMUMemoryRegion iommu_mr;
41 AddressSpace as;
42} IOMMUDevice;
43
44typedef struct IOMMUPciBus {
45 PCIBus *bus;
f7795e40 46 IOMMUDevice *pbdev[]; /* Parent array is sparse, so dynamically alloc */
22c37a10
EA
47} IOMMUPciBus;
48
db1015e9 49struct VirtIOIOMMU {
22c37a10
EA
50 VirtIODevice parent_obj;
51 VirtQueue *req_vq;
52 VirtQueue *event_vq;
53 struct virtio_iommu_config config;
54 uint64_t features;
55 GHashTable *as_by_busptr;
cfb42188 56 IOMMUPciBus *iommu_pcibus_by_bus_num[PCI_BUS_MAX];
22c37a10 57 PCIBus *primary_bus;
1733eebb
EA
58 ReservedRegion *reserved_regions;
59 uint32_t nb_reserved_regions;
22c37a10
EA
60 GTree *domains;
61 QemuMutex mutex;
62 GTree *endpoints;
db1015e9 63};
22c37a10
EA
64
65#endif