x2APIC question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Ethin
Member
Member
Posts: 624
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

x2APIC question

Post by Ethin »

Just reading the Intel SDMs, volume 3A, ch. 10, on the APIC. I have a question that I can't seem to find an answer to - if I have an IDT loaded, will the processor call these interrupts when the x2APIC fires them, without me needing to change the interrupt routines or mapping them somewhere else? I can disable the PIC, verify that the APIC is enabled and switch to x2APIC mode, but I don't want mu interrupts getting suddenly broken because I forgot something.
nullplan
Member
Member
Posts: 1643
Joined: Wed Aug 30, 2017 8:24 am

Re: x2APIC question

Post by nullplan »

The x2APIC is merely an interrupt controller. It does not change how the CPU handles interrupts, only how it receives them. The IDT is therefore unaffected.
Carpe diem!
Ethin
Member
Member
Posts: 624
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

Re: x2APIC question

Post by Ethin »

Thanks. Now I just need to figure out how to get QEMU to emulate it...
User avatar
pvc
Member
Member
Posts: 201
Joined: Mon Jan 15, 2018 2:27 pm

Re: x2APIC question

Post by pvc »

QEMU virtualizes x2APIC mode when using KVM (-enable-kvm option). I think, your host CPU has to support x2APIC (which is about guaranteed these days) for this to work. But beware. GDB stub is not very reliable when using KVM.
Ethin
Member
Member
Posts: 624
Joined: Sun Jun 23, 2019 5:36 pm
Location: North Dakota, United States

Re: x2APIC question

Post by Ethin »

I'd use KVM, but I'm trying to find a way to get it to emulate it on all platforms. For some reason, HAXM (on Windows) causes an immeduate VCPU shutdown request for some reason, and I can't find any way of locating HAXM logs. And WHPX doesn't want to work for some reason (even though I have it enabled in windows features). It might be because I disabled it at boot (mainly so windows wouldn't cause pretty much every other VM solution to fail to run properly).
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: x2APIC question

Post by bzt »

Ethin wrote:I'd use KVM, but I'm trying to find a way to get it to emulate it on all platforms.
Try

Code: Select all

-cpu IvyBridge,+x2apic
This works for me, however I'm using KVM too, haven't disabled x2APIC at boot, and I'm running qemu under Linux. You could also try VirtualBox, it supports x2APIC emulation as well.

Cheers,
bzt
bookman
Posts: 3
Joined: Fri Sep 29, 2023 4:00 pm

Re: x2APIC question

Post by bookman »

XV6 for x86 is a good reference, it supports xAPIC, and does not support x2APIC
Post Reply