Skip to content

Commit f3aa20a

Browse files
Sainath Grandhilijinxia
authored andcommitted
hv: self-IPI APIC register in x2APIC mode of guest vLAPIC
This patch adds support for self-IPI virtualization when guest uses vLAPIC in x2APIC mode. Tracked-On: #1626 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Reviewed-by: Xu Anthony <anthony.xu@intel.com>
1 parent c85e35d commit f3aa20a

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,6 +2374,18 @@ int veoi_vmexit_handler(struct vcpu *vcpu)
23742374
return 0;
23752375
}
23762376

2377+
static void vlapic_x2apic_self_ipi_handler(struct acrn_vlapic *vlapic)
2378+
{
2379+
struct lapic_regs *lapic;
2380+
uint32_t vector;
2381+
struct vcpu *target_vcpu;
2382+
2383+
lapic = &(vlapic->apic_page);
2384+
vector = lapic->self_ipi.v & 0xFFU;
2385+
target_vcpu = vlapic->vcpu;
2386+
vlapic_set_intr(target_vcpu, vector, LAPIC_TRIG_EDGE);
2387+
}
2388+
23772389
int apic_write_vmexit_handler(struct vcpu *vcpu)
23782390
{
23792391
uint64_t qual;
@@ -2428,6 +2440,11 @@ int apic_write_vmexit_handler(struct vcpu *vcpu)
24282440
case APIC_OFFSET_TIMER_DCR:
24292441
vlapic_dcr_write_handler(vlapic);
24302442
break;
2443+
case APIC_OFFSET_SELF_IPI:
2444+
if (is_x2apic_enabled(vlapic)) {
2445+
vlapic_x2apic_self_ipi_handler(vlapic);
2446+
}
2447+
break;
24312448
default:
24322449
handled = 0;
24332450
pr_err("Unhandled APIC-Write, offset:0x%x", offset);

hypervisor/arch/x86/guest/vlapic_priv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@
8080
#define APIC_OFFSET_TIMER_ICR 0x380U /* Timer's Initial Count */
8181
#define APIC_OFFSET_TIMER_CCR 0x390U /* Timer's Current Count */
8282
#define APIC_OFFSET_TIMER_DCR 0x3E0U /* Timer's Divide Configuration */
83-
83+
#define APIC_OFFSET_SELF_IPI 0x3F0U /* Self IPI Register */
8484

8585
#endif /* VLAPIC_PRIV_H */

hypervisor/include/arch/x86/apicreg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct lapic_regs { /*OFFSET(Hex)*/
7272
struct lapic_reg ccr_timer;/*390*/
7373
struct lapic_reg rsv3[4];
7474
struct lapic_reg dcr_timer;/*3E0*/
75-
struct lapic_reg rsv4;
75+
struct lapic_reg self_ipi; /*3F0*/
7676

7777
/*roundup sizeof current struct to 4KB*/
7878
struct lapic_reg rsv5[192]; /*400 -- FF0*/

0 commit comments

Comments
 (0)