Skip to contentSkip to conversation

IOAPIC doesn't handle byte writes

DISCUSSION Julian Stecklina 3 participants 3 messages Nov 22, 2011 – Dec 4, 2011 KVM

lore
Share & tools
lore
#0 lore raw

Hello,

KVM emulates an IOAPIC that doesn't handle byte writes to its IOAPIC_REG_SELECT register, although for example the ICH10 spec[1] clearly states that this is an 8-bit register. See
http://www.intel.com/content/dam/doc/datasheet/io-controller-hub-10-family-datasheet.pdf
Table 13-4 on page 433.

The code in question is:

http://git.kernel.org/?p=virt/kvm/kvm.git;a=blob;f=virt/kvm/ioapic.c;h=3eed61eb48675a63dd1f31b0095217ab6bc5f646;hb=HEAD#l323

This breaks IOAPIC code in OSes that adhere to the spec.

I've created a small testcase[1]:

$ qemu-kvm -serial stdio -kernel ioapic
[26303.961804] ioapic: Unsupported size 1
IOAPIC ID  00000000
[26303.970466] ioapic: Unsupported size 1
IOAPIC VER 00000000
Done
qemu: terminating on signal 2
$ qemu-kvm  -no-kvm-irqchip -serial stdio -kernel ioapic 
IOAPIC ID  00000000
IOAPIC VER 00170011
Done
qemu: terminating on signal 2

Expected behavior is that the IOAPIC register is not read as zero with KVM irqchip emulation.

I would file a bug, but the kernel bugzilla seems to be down at the moment.

Regards, Julian

[1] http://os.inf.tu-dresden.de/~jsteckli/tmp/ioapic

#1 lore raw
Quoted 8 lines · Julian Stecklina

Hello,

KVM emulates an IOAPIC that doesn't handle byte writes to its IOAPIC_REG_SELECT register, although for example the ICH10 spec[1] clearly states that this is an 8-bit register. See
http://www.intel.com/content/dam/doc/datasheet/io-controller-hub-10-family-datasheet.pdf
Table 13-4 on page 433.

Quoted 5 lines

The code in question is:

http://git.kernel.org/?p=virt/kvm/kvm.git;a=blob;f=virt/kvm/ioapic.c;h=3eed61eb48675a63dd1f31b0095217ab6bc5f646;hb=HEAD#l323

This breaks IOAPIC code in OSes that adhere to the spec.

Agree, the code is broken.

Quoted 2 lines

I would file a bug, but the kernel bugzilla seems to be down at the moment.

Care to post a patch instead?

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
In reply to Julian Stecklina
Quoted 8 lines · Julian Stecklina

Hello,

KVM emulates an IOAPIC that doesn't handle byte writes to its IOAPIC_REG_SELECT register, although for example the ICH10 spec[1] clearly states that this is an 8-bit register. See
http://www.intel.com/content/dam/doc/datasheet/io-controller-hub-10-family-datasheet.pdf
Table 13-4 on page 433.

The same spec also says that access to data register has to be dword, but new code as of 1b8cf174cf2c0f0c66030fe81af818e9abf4f302 does not enforce this. Old code never enforced it for read too :(

--
Gleb.