Skip to content

Commit a3fdc7a

Browse files
Sainath Grandhiwenlingz
authored andcommitted
hv: Add is_xapic_enabled API to check vLAPIC moe
is_xapic_enabled API returns true if vLAPIC is in xAPIC mode. In all other cases, it returns false. Tracked-On: #3253 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 7cb71a3 commit a3fdc7a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,6 +1998,16 @@ bool is_x2apic_enabled(const struct acrn_vlapic *vlapic)
19981998
return ret;
19991999
}
20002000

2001+
bool is_xapic_enabled(const struct acrn_vlapic *vlapic)
2002+
{
2003+
bool ret = false;
2004+
if ((vlapic_get_apicbase(vlapic) & APICBASE_LAPIC_MODE) == APICBASE_XAPIC) {
2005+
ret = true;
2006+
}
2007+
2008+
return ret;
2009+
}
2010+
20012011
static inline uint32_t x2apic_msr_to_regoff(uint32_t msr)
20022012
{
20032013

hypervisor/include/arch/x86/guest/vlapic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ void vlapic_calc_dest_lapic_pt(struct acrn_vm *vm, uint64_t *dmask, bool is_broa
212212
uint32_t dest, bool phys);
213213
bool is_lapic_pt_enabled(struct acrn_vm *vm);
214214
bool is_x2apic_enabled(const struct acrn_vlapic *vlapic);
215+
bool is_xapic_enabled(const struct acrn_vlapic *vlapic);
215216
/**
216217
* @}
217218
*/

0 commit comments

Comments
 (0)