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"
25 #define TYPE_X86_IOMMU_DEVICE ("x86-iommu")
26 #define X86_IOMMU_DEVICE(obj) \
27 OBJECT_CHECK(X86IOMMUState, (obj), TYPE_X86_IOMMU_DEVICE)
28 #define X86_IOMMU_CLASS(klass) \
29 OBJECT_CLASS_CHECK(X86IOMMUClass, (klass), TYPE_X86_IOMMU_DEVICE)
30 #define X86_IOMMU_GET_CLASS(obj) \
31 OBJECT_GET_CLASS(X86IOMMUClass, obj, TYPE_X86_IOMMU_DEVICE)
33 #define X86_IOMMU_PCI_DEVFN_MAX 256
35 typedef struct X86IOMMUState X86IOMMUState
;
36 typedef struct X86IOMMUClass X86IOMMUClass
;
38 struct X86IOMMUClass
{
39 SysBusDeviceClass parent
;
40 /* Intel/AMD specific realize() hook */
41 DeviceRealize realize
;
44 struct X86IOMMUState
{