1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

serialize instruction before sending an IPI

This commit is contained in:
Stefan Lankes 2017-09-22 00:14:26 +02:00
parent 22991d27c2
commit e5f3ddcffa

View file

@ -247,7 +247,7 @@ void apic_eoi(size_t int_no)
* If the IDT entry that was invoked was greater-than-or-equal to 48,
* then we use the APIC
*/
if (apic_is_enabled() || int_no >= 123) {
if (apic_is_enabled() || int_no >= 48) {
lapic_write(APIC_EOI, 0);
} else {
/*
@ -963,6 +963,11 @@ int ipi_tlb_flush(void)
continue;
LOG_DEBUG("Send IPI to %zd\n", i);
/*
* Make previous memory operations globally visible before
* sending the IPI through x2apic wrmsr. => serializing
*/
mb();
wrmsr(0x830, (i << 32)|APIC_INT_ASSERT|APIC_DM_FIXED|112);
}
irq_nested_enable(flags);
@ -996,7 +1001,7 @@ int ipi_tlb_flush(void)
static void apic_tlb_handler(struct state *s)
{
LOG_DEBUG("Receive IPI at core %d to flush the TLB\n", CORE_ID);
LOG_INFO("Receive IPI at core %d to flush the TLB\n", CORE_ID);
write_cr3(read_cr3());
}
#endif
@ -1009,6 +1014,11 @@ int apic_send_ipi(uint64_t dest, uint8_t irq)
if (has_x2apic()) {
flags = irq_nested_disable();
LOG_DEBUG("send IPI %d to %lld\n", (int)irq, dest);
/*
* Make previous memory operations globally visible before
* sending the IPI through x2apic wrmsr. => serializing
*/
mb();
wrmsr(0x830, (dest << 32)|APIC_INT_ASSERT|APIC_DM_FIXED|irq);
irq_nested_enable(flags);
} else {
@ -1098,7 +1108,7 @@ static void apic_shutdown(struct state* s)
static void apic_wakeup(struct state* s)
{
LOG_DEBUG("Receive wakeup interrupt\n");
LOG_INFO("Receive wakeup interrupt\n");
}
int apic_init(void)