intel_iommu: add support for split irqchip
[qemu.git] / include / hw / i386 / x86-iommu.h
blobfa6ce31b74723f095fa1a17b0712505e7835e85d
1 /*
2 * Common IOMMU interface for X86 platform
4 * Copyright (C) 2016 Peter Xu, Red Hat <peterx@redhat.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef IOMMU_COMMON_H
21 #define IOMMU_COMMON_H
23 #include "hw/sysbus.h"
24 #include "hw/pci/pci.h"
26 #define TYPE_X86_IOMMU_DEVICE ("x86-iommu")
27 #define X86_IOMMU_DEVICE(obj) \
28 OBJECT_CHECK(X86IOMMUState, (obj), TYPE_X86_IOMMU_DEVICE)
29 #define X86_IOMMU_CLASS(klass) \
30 OBJECT_CLASS_CHECK(X86IOMMUClass, (klass), TYPE_X86_IOMMU_DEVICE)
31 #define X86_IOMMU_GET_CLASS(obj) \
32 OBJECT_GET_CLASS(X86IOMMUClass, obj, TYPE_X86_IOMMU_DEVICE)
34 #define X86_IOMMU_PCI_DEVFN_MAX 256
35 #define X86_IOMMU_SID_INVALID (0xffff)
37 typedef struct X86IOMMUState X86IOMMUState;
38 typedef struct X86IOMMUClass X86IOMMUClass;
40 struct X86IOMMUClass {
41 SysBusDeviceClass parent;
42 /* Intel/AMD specific realize() hook */
43 DeviceRealize realize;
44 /* MSI-based interrupt remapping */
45 int (*int_remap)(X86IOMMUState *iommu, MSIMessage *src,
46 MSIMessage *dst, uint16_t sid);
49 struct X86IOMMUState {
50 SysBusDevice busdev;
51 bool intr_supported; /* Whether vIOMMU supports IR */
54 /**
55 * x86_iommu_get_default - get default IOMMU device
56 * @return: pointer to default IOMMU device
58 X86IOMMUState *x86_iommu_get_default(void);
60 #endif