File tree Expand file tree Collapse file tree 6 files changed +50
-0
lines changed Expand file tree Collapse file tree 6 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,7 @@ HW_C_SRCS += arch/x86/ioapic.c
229
229
HW_C_SRCS += arch/x86/lapic.c
230
230
HW_C_SRCS += arch/x86/cpu.c
231
231
HW_C_SRCS += arch/x86/cpu_caps.c
232
+ HW_C_SRCS += arch/x86/platform_caps.c
232
233
HW_C_SRCS += arch/x86/security.c
233
234
HW_C_SRCS += arch/x86/mmu.c
234
235
HW_C_SRCS += arch/x86/e820.c
Original file line number Diff line number Diff line change 31
31
#include <sbuf.h>
32
32
#include <pci_dev.h>
33
33
#include <vacpi.h>
34
+ #include <platform_caps.h>
34
35
35
36
vm_sw_loader_t vm_sw_loader ;
36
37
@@ -115,6 +116,20 @@ bool is_rt_vm(const struct acrn_vm *vm)
115
116
return ((vm_config -> guest_flags & GUEST_FLAG_RT ) != 0U );
116
117
}
117
118
119
+ /**
120
+ * @brief VT-d PI posted mode can possibly be used for PTDEVs assigned
121
+ * to this VM if platform supports VT-d PI AND lapic passthru is not configured
122
+ * for this VM.
123
+ * However, as we can only post single destination IRQ, so meeting these 2 conditions
124
+ * does not necessarily mean posted mode will be used for all PTDEVs belonging
125
+ * to the VM, unless the IRQ is single-destination for the specific PTDEV
126
+ * @pre vm != NULL
127
+ */
128
+ bool is_pi_capable (const struct acrn_vm * vm )
129
+ {
130
+ return (platform_caps .pi && (!is_lapic_pt_configured (vm )));
131
+ }
132
+
118
133
static struct acrn_vm * get_highest_severity_vm (void )
119
134
{
120
135
uint16_t vm_id , highest_vm_id = 0U ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2020 Intel Corporation. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+
7
+ #include <types.h>
8
+ #include <platform_caps.h>
9
+
10
+ struct platform_caps_x86 platform_caps = {.pi = true};
Original file line number Diff line number Diff line change 23
23
#include <vm_config.h>
24
24
#include <pci.h>
25
25
#include <vm.h>
26
+ #include <platform_caps.h>
26
27
27
28
#define DBG_IOMMU 0
28
29
@@ -208,6 +209,7 @@ static inline uint16_t vmid_to_domainid(uint16_t vm_id)
208
209
209
210
static int32_t dmar_register_hrhd (struct dmar_drhd_rt * dmar_unit );
210
211
static struct dmar_drhd_rt * device_to_dmaru (uint8_t bus , uint8_t devfun );
212
+
211
213
static int32_t register_hrhd_units (void )
212
214
{
213
215
struct dmar_drhd_rt * drhd_rt ;
@@ -226,6 +228,10 @@ static int32_t register_hrhd_units(void)
226
228
if (ret != 0 ) {
227
229
break ;
228
230
}
231
+
232
+ if ((iommu_cap_pi (drhd_rt -> cap ) == 0U ) || (!is_apicv_advanced_feature_supported ())) {
233
+ platform_caps .pi = false;
234
+ }
229
235
}
230
236
231
237
return ret ;
Original file line number Diff line number Diff line change @@ -263,6 +263,7 @@ void vrtc_init(struct acrn_vm *vm);
263
263
264
264
bool is_lapic_pt_configured (const struct acrn_vm * vm );
265
265
bool is_rt_vm (const struct acrn_vm * vm );
266
+ bool is_pi_capable (const struct acrn_vm * vm );
266
267
bool has_rt_vm (void );
267
268
bool is_highest_severity_vm (const struct acrn_vm * vm );
268
269
bool vm_hide_mtrr (const struct acrn_vm * vm );
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2020 Intel Corporation. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+
7
+ #ifndef PLATFORM_CAPS_H
8
+ #define PLATFORM_CAPS_H
9
+
10
+ struct platform_caps_x86 {
11
+ /* true if posted interrupt is supported by all IOMMUs */
12
+ bool pi ;
13
+ };
14
+
15
+ extern struct platform_caps_x86 platform_caps ;
16
+
17
+ #endif /* PLATFORM_CAPS_H */
You can’t perform that action at this time.
0 commit comments