x86-iommu.h (206d0c24361a083fbdcb2cc86fb75dc8b7f251a2) x86-iommu.h (fb9f592623b0f9bb82a88d68d7921fb581918ef5)
1/*
2 * Common IOMMU interface for X86 platform
3 *
4 * Copyright (C) 2016 Peter Xu, Red Hat <peterx@redhat.com>
5 *
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

--- 23 unchanged lines hidden (view full) ---

32 OBJECT_GET_CLASS(X86IOMMUClass, obj, TYPE_X86_IOMMU_DEVICE)
33
34#define X86_IOMMU_PCI_DEVFN_MAX 256
35#define X86_IOMMU_SID_INVALID (0xffff)
36
37typedef struct X86IOMMUState X86IOMMUState;
38typedef struct X86IOMMUClass X86IOMMUClass;
39
1/*
2 * Common IOMMU interface for X86 platform
3 *
4 * Copyright (C) 2016 Peter Xu, Red Hat <peterx@redhat.com>
5 *
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

--- 23 unchanged lines hidden (view full) ---

32 OBJECT_GET_CLASS(X86IOMMUClass, obj, TYPE_X86_IOMMU_DEVICE)
33
34#define X86_IOMMU_PCI_DEVFN_MAX 256
35#define X86_IOMMU_SID_INVALID (0xffff)
36
37typedef struct X86IOMMUState X86IOMMUState;
38typedef struct X86IOMMUClass X86IOMMUClass;
39
40typedef enum IommuType {
41 TYPE_INTEL,
42 TYPE_AMD,
43 TYPE_NONE
44} IommuType;
45
40struct 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);
47};

--- 14 unchanged lines hidden (view full) ---

62 void *private;
63 QLIST_ENTRY(IEC_Notifier) list;
64};
65typedef struct IEC_Notifier IEC_Notifier;
66
67struct X86IOMMUState {
68 SysBusDevice busdev;
69 bool intr_supported; /* Whether vIOMMU supports IR */
46struct X86IOMMUClass {
47 SysBusDeviceClass parent;
48 /* Intel/AMD specific realize() hook */
49 DeviceRealize realize;
50 /* MSI-based interrupt remapping */
51 int (*int_remap)(X86IOMMUState *iommu, MSIMessage *src,
52 MSIMessage *dst, uint16_t sid);
53};

--- 14 unchanged lines hidden (view full) ---

68 void *private;
69 QLIST_ENTRY(IEC_Notifier) list;
70};
71typedef struct IEC_Notifier IEC_Notifier;
72
73struct X86IOMMUState {
74 SysBusDevice busdev;
75 bool intr_supported; /* Whether vIOMMU supports IR */
76 IommuType type; /* IOMMU type - AMD/Intel */
70 QLIST_HEAD(, IEC_Notifier) iec_notifiers; /* IEC notify list */
71};
72
73/**
74 * x86_iommu_get_default - get default IOMMU device
75 * @return: pointer to default IOMMU device
76 */
77X86IOMMUState *x86_iommu_get_default(void);
78
77 QLIST_HEAD(, IEC_Notifier) iec_notifiers; /* IEC notify list */
78};
79
80/**
81 * x86_iommu_get_default - get default IOMMU device
82 * @return: pointer to default IOMMU device
83 */
84X86IOMMUState *x86_iommu_get_default(void);
85
86/*
87 * x86_iommu_get_type - get IOMMU type
88 */
89IommuType x86_iommu_get_type(void);
90
79/**
80 * x86_iommu_iec_register_notifier - register IEC (Interrupt Entry
81 * Cache) notifiers
82 * @iommu: IOMMU device to register
83 * @fn: IEC notifier hook function
84 * @data: notifier private data
85 */
86void x86_iommu_iec_register_notifier(X86IOMMUState *iommu,

--- 14 unchanged lines hidden ---
91/**
92 * x86_iommu_iec_register_notifier - register IEC (Interrupt Entry
93 * Cache) notifiers
94 * @iommu: IOMMU device to register
95 * @fn: IEC notifier hook function
96 * @data: notifier private data
97 */
98void x86_iommu_iec_register_notifier(X86IOMMUState *iommu,

--- 14 unchanged lines hidden ---