From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 2/3] QEMU/KVM: virtio register pow2 memory regions
Date: Mon, 17 Mar 2008 17:20:15 -0300 [thread overview]
Message-ID: <20080317202125.391559627@localhost.localdomain> (raw)
In-Reply-To: 20080317202013.949027343@localhost.localdomain
[-- Attachment #1: fix-virtio --]
[-- Type: text/plain, Size: 1256 bytes --]
Otherwise the PCI size for such regions will be calculated erroneously.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Index: kvm-userspace.hotplug3/qemu/hw/virtio.c
===================================================================
--- kvm-userspace.hotplug3.orig/qemu/hw/virtio.c
+++ kvm-userspace.hotplug3/qemu/hw/virtio.c
@@ -404,6 +404,7 @@ VirtIODevice *virtio_init_pci(PCIBus *bu
VirtIODevice *vdev;
PCIDevice *pci_dev;
uint8_t *config;
+ uint32_t size;
pci_dev = pci_register_device(bus, name, struct_size,
-1, NULL, NULL);
@@ -441,7 +442,11 @@ VirtIODevice *virtio_init_pci(PCIBus *bu
else
vdev->config = NULL;
- pci_register_io_region(pci_dev, 0, 20 + config_size, PCI_ADDRESS_SPACE_IO,
+ size = 20 + config_size;
+ if (size & (size-1))
+ size = 1 << fls(size);
+
+ pci_register_io_region(pci_dev, 0, size, PCI_ADDRESS_SPACE_IO,
virtio_map);
qemu_register_reset(virtio_reset, vdev);
--
-------------------------------------------------------------------------
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/
next prev parent reply other threads:[~2008-03-17 20:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-17 20:20 [patch 0/3] QEMU: virtio should register power of two sized regions Marcelo Tosatti
2008-03-17 20:20 ` [patch 1/3] QEMU/KVM: add fls() Marcelo Tosatti
2008-03-17 20:20 ` Marcelo Tosatti [this message]
2008-03-17 20:20 ` [patch 3/3] QEMU/KVM: bail out if PCI region is not power of two Marcelo Tosatti
2008-03-18 6:38 ` [patch 0/3] QEMU: virtio should register power of two sized regions Avi Kivity
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=20080317202125.391559627@localhost.localdomain \
--to=mtosatti@redhat.com \
--cc=avi@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
/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