From: Anthony Liguori <anthony@codemonkey.ws>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH 4/4] pci: use pci_config_header in pci.c
Date: Thu, 02 Oct 2008 10:52:29 -0500 [thread overview]
Message-ID: <48E4EE3D.2090503@codemonkey.ws> (raw)
In-Reply-To: <48E47E93.5000605@redhat.com>
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
>
>
>
next prev parent reply other threads:[~2008-10-02 15:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-01 14:12 [Qemu-devel] [PATCH 1/4] add byteordered types to qemu Gerd Hoffmann
2008-10-01 14:12 ` [Qemu-devel] [PATCH 2/4] pci: add config space struct (from qemu-xen) Gerd Hoffmann
2008-10-01 14:12 ` [Qemu-devel] [PATCH 3/4] pci: add default pci subsystem id for all devices Gerd Hoffmann
2008-10-01 14:12 ` [Qemu-devel] [PATCH 4/4] pci: use pci_config_header in pci.c Gerd Hoffmann
2008-10-01 16:30 ` Anthony Liguori
2008-10-01 19:09 ` Gerd Hoffmann
2008-10-01 19:27 ` Anthony Liguori
2008-10-02 7:56 ` Gerd Hoffmann
2008-10-02 15:52 ` Anthony Liguori [this message]
2008-10-06 16:04 ` Gerd Hoffmann
2008-10-02 8:21 ` [Qemu-devel] [PATCH 1/4] add byteordered types to qemu Christoph Hellwig
2008-10-02 12:46 ` Gerd Hoffmann
2008-10-02 12:55 ` Christoph Hellwig
2008-10-02 13:15 ` Gerd Hoffmann
2008-10-02 13:17 ` Christoph Hellwig
2008-10-02 14:08 ` Gerd Hoffmann
2008-10-02 15:55 ` Anthony Liguori
2008-10-06 16:07 ` Gerd Hoffmann
-- strict thread matches above, loose matches on Subject: below --
2008-09-10 11:45 Gerd Hoffmann
2008-09-10 11:45 ` [Qemu-devel] [PATCH 4/4] pci: use pci_config_header in pci.c Gerd Hoffmann
2008-08-28 8:36 [Qemu-devel] [PATCH 1/4] add byteordered types to qemu Gerd Hoffmann
2008-08-28 8:36 ` [Qemu-devel] [PATCH 4/4] pci: use pci_config_header in pci.c Gerd Hoffmann
2008-08-27 13:45 [Qemu-devel] [PATCH 1/4] add byteordered types and accessor functions to qemu Gerd Hoffmann
2008-08-27 13:45 ` [Qemu-devel] [PATCH 4/4] pci: use pci_config_header in pci.c Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48E4EE3D.2090503@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=kraxel@redhat.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).