kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* IOAPIC doesn't handle byte writes
@ 2011-11-22 13:13 Julian Stecklina
  2011-11-22 14:19 ` Avi Kivity
  2011-12-04  9:53 ` Gleb Natapov
  0 siblings, 2 replies; 5+ messages in thread
From: Julian Stecklina @ 2011-11-22 13:13 UTC (permalink / raw)
  To: kvm; +Cc: udo@hypervisor.org

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

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


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: IOAPIC doesn't handle byte writes
  2011-11-22 13:13 Julian Stecklina
@ 2011-11-22 14:19 ` Avi Kivity
  2011-12-04  9:53 ` Gleb Natapov
  1 sibling, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2011-11-22 14:19 UTC (permalink / raw)
  To: Julian Stecklina; +Cc: kvm, udo@hypervisor.org

On 11/22/2011 03:13 PM, Julian Stecklina wrote:
> 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.

Agree, the code is broken.

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

Care to post a patch instead?

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: IOAPIC doesn't handle byte writes
@ 2011-11-22 15:06 Julian Stecklina
  2011-11-23 10:45 ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Julian Stecklina @ 2011-11-22 15:06 UTC (permalink / raw)
  To: KVM devel mailing list

Hello,

Avi Kivity wrote:
> Care to post a patch instead?

Sure. Never hacked KVM, though. Is there a particular reason why the
void *val argument to ioapic_mmio_read/_write is only dereferenced when
ioapic->lock is not held?

Regards, Julian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: IOAPIC doesn't handle byte writes
  2011-11-22 15:06 IOAPIC doesn't handle byte writes Julian Stecklina
@ 2011-11-23 10:45 ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2011-11-23 10:45 UTC (permalink / raw)
  To: Julian Stecklina; +Cc: KVM devel mailing list

On 11/22/2011 05:06 PM, Julian Stecklina wrote:
> Hello,

[please don't drop cc list]

> Avi Kivity wrote:
> > Care to post a patch instead?
>
> Sure. Never hacked KVM, though. Is there a particular reason why the
> void *val argument to ioapic_mmio_read/_write is only dereferenced when
> ioapic->lock is not held?

No particular reason.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: IOAPIC doesn't handle byte writes
  2011-11-22 13:13 Julian Stecklina
  2011-11-22 14:19 ` Avi Kivity
@ 2011-12-04  9:53 ` Gleb Natapov
  1 sibling, 0 replies; 5+ messages in thread
From: Gleb Natapov @ 2011-12-04  9:53 UTC (permalink / raw)
  To: Julian Stecklina; +Cc: kvm, udo@hypervisor.org

On Tue, Nov 22, 2011 at 02:13:02PM +0100, Julian Stecklina wrote:
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-04  9:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-22 15:06 IOAPIC doesn't handle byte writes Julian Stecklina
2011-11-23 10:45 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2011-11-22 13:13 Julian Stecklina
2011-11-22 14:19 ` Avi Kivity
2011-12-04  9:53 ` Gleb Natapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).