From: Marcelo Tosatti <marcelo@kvack.org>
To: Uri Lublin <uri.lublin@qumranet.com>
Cc: Marcelo Tosatti <marcelo@kvack.org>,
kvm-devel <kvm-devel@lists.sourceforge.net>
Subject: Re: PCI IO regions must be power of two
Date: Wed, 12 Mar 2008 12:59:55 -0300 [thread overview]
Message-ID: <20080312155954.GA26681@dmt> (raw)
In-Reply-To: <64F9B87B6B770947A9F8391472E032160B5F851E@ehost011-8.exch011.intermedia.net>
On Wed, Mar 12, 2008 at 08:39:11AM -0700, Uri Lublin wrote:
> From: Marcelo Tosatti
> >
> >Index: kvm-userspace.hotplug2/qemu/hw/pci.c
> >===================================================================
> >--- kvm-userspace.hotplug2.orig/qemu/hw/pci.c
> >+++ kvm-userspace.hotplug2/qemu/hw/pci.c
> >@@ -236,6 +236,13 @@ void pci_register_io_region(PCIDevice *p
> >
> > if ((unsigned int)region_num >= PCI_NUM_REGIONS)
> > return;
> >+
> >+ /* IO region size must be power of two */
> >+ if (type == PCI_ADDRESS_SPACE_IO && (size & (size-1))) {
>
> Why only for PCI IO regions ? Don't PCI memory regions have the same restriction ?
Yes, they do.
> >+ size = size << 1;
> >+ size &= size-1;
>
> That would not make size a power of 2 (e.g. size=7 --> size=12).
Right, sorry.
I'll resend a patch to have virtio allocate IO regions with proper sizes
and warn if the IO _or_ memory region are not power of two, as Anthony
suggested.
Since this problem is only visible with device hotplug (QEMU will
allocate the region offsets properly during initialization) I'll wait
for that to hit the tree.
Thanks.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
prev parent reply other threads:[~2008-03-12 15:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-11 19:52 PCI IO regions must be power of two Marcelo Tosatti
2008-03-11 20:19 ` Anthony Liguori
2008-03-12 15:39 ` Uri Lublin
2008-03-12 15:59 ` Marcelo Tosatti [this message]
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=20080312155954.GA26681@dmt \
--to=marcelo@kvack.org \
--cc=kvm-devel@lists.sourceforge.net \
--cc=uri.lublin@qumranet.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