|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH 4/4] pci: use pci_config_header in pci.c |
Date: | Thu, 02 Oct 2008 10:52:29 -0500 |
User-agent: | Thunderbird 2.0.0.16 (X11/20080919) |
Gerd Hoffmann wrote:
Anthony Liguori wrote:Because the config structure is loaded after pci_register device and because the MMIO callbacks into the config space? If you look at pci_default_read_config(), it actually does conversion from le to host CPU because that's what MMIO callbacks expect.Yep.If you simply removed this, it would work.Ah, *now* I see what you mean. 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.
Of course, you'll have to audit each caller of pci_register_device() and make sure their config's get changed too.Sure, that would be a *big* task & patch.
Actually, it's not. I did a quick grep, noone seems to pass in a config_read accessor. Only config_write is ever passed and it only seems to be to used to add callbacks when particular config values are written. pci_default_config_write is still used to do the actual write.
Regards, Anthony Liguori
cheers, Gerd
[Prev in Thread] | Current Thread | [Next in Thread] |