From: Alex Williamson <alex.williamson@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/5] pci-assign: Clean up assigned_dev_pci_read/write_config
Date: Thu, 28 Apr 2011 08:54:08 -0600 [thread overview]
Message-ID: <1304002448.3125.12.camel@x201> (raw)
In-Reply-To: <4DB97DDF.7020106@siemens.com>
On Thu, 2011-04-28 at 16:46 +0200, Jan Kiszka wrote:
> On 2011-04-28 16:29, Alex Williamson wrote:
> > On Thu, 2011-04-28 at 10:59 +0200, Jan Kiszka wrote:
> >> Use rages_overlap and proper constants to match the access range against
> > ^^^^^ typo - only if you resend
> >
> >> regions that need special handling. This also fixes yet uncaught
> >> high-byte write access to the command register. Moreover, use more
> >> constants instead of magic numbers.
> >>
> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> >> ---
> >> hw/device-assignment.c | 39 +++++++++++++++++++++++++++++----------
> >> 1 files changed, 29 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/hw/device-assignment.c b/hw/device-assignment.c
> >> index 606d725..3481c93 100644
> >> --- a/hw/device-assignment.c
> >> +++ b/hw/device-assignment.c
> >> @@ -404,13 +404,20 @@ static void assigned_dev_pci_write_config(PCIDevice *d, uint32_t address,
> >> return assigned_device_pci_cap_write_config(d, address, val, len);
> >> }
> >>
> >> - if (address == 0x4) {
> >> + if (ranges_overlap(address, len, PCI_COMMAND, 2)) {
> >> pci_default_write_config(d, address, val, len);
> >> /* Continue to program the card */
> >> }
> >>
> >> - if ((address >= 0x10 && address <= 0x24) || address == 0x30 ||
> >> - address == 0x34 || address == 0x3c || address == 0x3d) {
> >> + /*
> >> + * Catch access to
> >> + * - base address registers
> >> + * - ROM base address & capability pointer
> >> + * - interrupt line & pin
> >> + */
> >> + if (ranges_overlap(address, len, PCI_BASE_ADDRESS_0, 24) ||
> >> + ranges_overlap(address, len, PCI_ROM_ADDRESS, 8) ||
> >
> > Should this be 5 bytes instead of 8? I'm not sure why we'd add catching
> > these reserved fields, but not those immediately after this range.
>
> Yes, that's asking for clarification: Should we allow direct access to
> the complete reserved space or virtualize it? Depending on this, the
> proper value should be 5 or 14 (the latter would also save one
> ranges_overlap).
I vote for 5 here since a cleanup patch shouldn't have behavior changes
hidden in it. I don't see any great value in virtualizing reserved
bits. It seems like it could only make things not work if a vendor was
stupid enough to hide something in there. Thanks,
Alex
next prev parent reply other threads:[~2011-04-28 14:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 8:59 [PATCH 0/5] qemu-kvm: pci-assign: Some more cleanups Jan Kiszka
2011-04-28 8:59 ` [PATCH 1/5] pci-assign: Clean up assigned_dev_pci_read/write_config Jan Kiszka
2011-04-28 14:29 ` Alex Williamson
2011-04-28 14:46 ` Jan Kiszka
2011-04-28 14:54 ` Alex Williamson [this message]
2011-04-28 15:06 ` Jan Kiszka
2011-04-28 15:46 ` Jan Kiszka
2011-04-28 8:59 ` [PATCH 2/5] pci-assign: Move merge_bits Jan Kiszka
2011-04-28 8:59 ` [PATCH 3/5] pci-assign: Fix dword read at PCI_COMMAND Jan Kiszka
2011-04-28 14:51 ` Alex Williamson
2011-04-28 15:36 ` Jan Kiszka
2011-04-28 8:59 ` [PATCH 4/5] pci-assign: Remove suspicious hunk from assigned_dev_pci_read_config Jan Kiszka
2011-04-28 8:59 ` [PATCH 5/5] pci-assign: Convert need_emulate_cmd into a bitmask Jan Kiszka
2011-04-28 9:34 ` [PATCH 0/5] qemu-kvm: pci-assign: Some more cleanups Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2010-12-13 23:25 [PATCH 0/5] pci-assign: Host IRQ sharing suppport + some fixes and cleanups Jan Kiszka
2010-12-13 23:25 ` [PATCH 1/5] pci-assign: Clean up assigned_dev_pci_read/write_config Jan Kiszka
2010-12-13 23:53 ` Alex Williamson
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=1304002448.3125.12.camel@x201 \
--to=alex.williamson@redhat.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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).