[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/4] pci: use pci_config_header in pci.c
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [PATCH 4/4] pci: use pci_config_header in pci.c |
Date: |
Mon, 06 Oct 2008 18:04:41 +0200 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080723) |
Anthony Liguori wrote:
> Gerd Hoffmann wrote:
>> Well. That assumes the guests always use the correct in{b,w,l}
>> instruction to access the config space values, i.e. never ever try to
>> use two inb reads for a 16bit value for example. Or a inw for the lower
>> 16 bits of a 32bit value because they know the high bits are zero anyway.
>>
>> I have my doubts that this is a sane expectation.
>
> The config space seems organized by data size so you could always just
> take care of this in the accessors. That is, if you get a byte access
> to a 32-bit value, you would do something like:
>
> (cpu_to_le32(d->config + (addr & ~3)) >> (8 * (addr % 4))) & 0xFF;
>
> Not the prettiest thing in the world, but it would work.
-ETOO_MUCH_MAGIC.
I want make the code more readable, that would go into the wrong
direction IMHO. I think it is much more sane to explicitly call the
byteswapping macros in the code. And add sparse checking support to
qemu so we have some way to check correctness without taking the
struct-trick route.
cheers,
Gerd
[Qemu-devel] [PATCH 2/4] pci: add config space struct (from qemu-xen)., Gerd Hoffmann, 2008/10/01
[Qemu-devel] [PATCH 3/4] pci: add default pci subsystem id for all devices., Gerd Hoffmann, 2008/10/01
Re: [Qemu-devel] [PATCH 1/4] add byteordered types to qemu., Christoph Hellwig, 2008/10/02
- Re: [Qemu-devel] [PATCH 1/4] add byteordered types to qemu., Gerd Hoffmann, 2008/10/02
- Re: [Qemu-devel] [PATCH 1/4] add byteordered types to qemu., Christoph Hellwig, 2008/10/02
- Re: [Qemu-devel] [PATCH 1/4] add byteordered types to qemu., Gerd Hoffmann, 2008/10/02
- Re: [Qemu-devel] [PATCH 1/4] add byteordered types to qemu., Christoph Hellwig, 2008/10/02
- Re: [Qemu-devel] [PATCH 1/4] add byteordered types to qemu., Gerd Hoffmann, 2008/10/02
- Re: [Qemu-devel] [PATCH 1/4] add byteordered types to qemu., Anthony Liguori, 2008/10/02
- Re: [Qemu-devel] [PATCH 1/4] add byteordered types to qemu., Gerd Hoffmann, 2008/10/06