From 4f98cb03a7ab771482cd2eae40d8cdfe98d7c585 Mon Sep 17 00:00:00 2001 From: Mingqiang Chi Date: Mon, 9 Sep 2019 16:07:42 +0800 Subject: [PATCH] hv:move down the structure intr_source Now the structures(union source & struct intr_source) are defined in ptdev.h,they are used in vtd.c and assign.c, vtd is the hardware layer and ptdev is the upper-layer module from the modularization perspective, this patch move down these structures to avoid reversed dependency. Tracked-On: #1842 Signed-off-by: Mingqiang Chi Reviewed-by: Jason Chen CJ Acked-by: Eddie Dong --- hypervisor/arch/x86/cpu.c | 1 + hypervisor/arch/x86/guest/assign.c | 1 + hypervisor/arch/x86/vtd.c | 1 + hypervisor/include/arch/x86/vtd.h | 13 ++++++++++++- hypervisor/include/common/ptdev.h | 11 ----------- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 4b4145a77..c497e22a8 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/hypervisor/arch/x86/guest/assign.c b/hypervisor/arch/x86/guest/assign.c index 6165cf7e7..459813992 100644 --- a/hypervisor/arch/x86/guest/assign.c +++ b/hypervisor/arch/x86/guest/assign.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c index 402ab5f9b..7f30891cd 100644 --- a/hypervisor/arch/x86/vtd.c +++ b/hypervisor/arch/x86/vtd.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/hypervisor/include/arch/x86/vtd.h b/hypervisor/include/arch/x86/vtd.h index 3a52d4d4f..3e376eece 100644 --- a/hypervisor/include/arch/x86/vtd.h +++ b/hypervisor/include/arch/x86/vtd.h @@ -6,7 +6,8 @@ #ifndef VTD_H #define VTD_H -#include +#include +#include /* * Intel IOMMU register specification per version 1.0 public spec. */ @@ -56,6 +57,16 @@ struct iommu_domain { bool iommu_snoop; }; +union source { + uint16_t ioapic_id; + union pci_bdf msi; +}; + +struct intr_source { + bool is_msi; + union source src; +}; + static inline uint8_t dmar_ver_major(uint64_t version) { return (((uint8_t)version & 0xf0U) >> 4U); diff --git a/hypervisor/include/common/ptdev.h b/hypervisor/include/common/ptdev.h index 0a328589e..c7f497099 100644 --- a/hypervisor/include/common/ptdev.h +++ b/hypervisor/include/common/ptdev.h @@ -8,7 +8,6 @@ #define PTDEV_H #include #include -#include #include #define PTDEV_INTR_MSI (1U << 0U) @@ -25,16 +24,6 @@ union source_id (name) = {.msi_id = {.bdf = (a), .entry_nr = (b)} } #define DEFINE_IOAPIC_SID(name, a, b) \ union source_id (name) = {.intx_id = {.pin = (a), .src = (b)} } -union source { - uint16_t ioapic_id; - union pci_bdf msi; -}; - -struct intr_source { - bool is_msi; - union source src; -}; - union irte_index { uint16_t index; struct {