* [PATCHv3] slow_map: minor improvements to ROM BAR handling
@ 2009-12-23 10:07 Michael S. Tsirkin
2009-12-23 19:26 ` Marcelo Tosatti
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2009-12-23 10:07 UTC (permalink / raw)
To: avi, agraf, kvm
ROM BAR can be handled same as regular BAR:
load_option_roms utility will take care of
copying it to RAM as appropriate.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Changes from v2:
replace ?: with an if statement
changes from v1:
make ROM bar read only
hw/device-assignment.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 000fa61..9197dca 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -233,7 +233,10 @@ static void assigned_dev_iomem_map_slow(PCIDevice *pci_dev, int region_num,
int m;
DEBUG("slow map\n");
- m = cpu_register_io_memory(slow_bar_read, slow_bar_write, region);
+ if (region_num == PCI_ROM_SLOT)
+ m = cpu_register_io_memory(slow_bar_read, NULL, region);
+ else
+ m = cpu_register_io_memory(slow_bar_read, slow_bar_write, region);
cpu_register_physical_memory(e_phys, e_size, m);
/* MSI-X MMIO page */
@@ -486,25 +489,23 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
: PCI_BASE_ADDRESS_SPACE_MEMORY;
if (cur_region->size & 0xFFF) {
- fprintf(stderr, "PCI region %d at address 0x%llx "
- "has size 0x%x, which is not a multiple of 4K. "
- "You might experience some performance hit due to that.\n",
- i, (unsigned long long)cur_region->base_addr,
- cur_region->size);
+ if (i != PCI_ROM_SLOT) {
+ fprintf(stderr, "PCI region %d at address 0x%llx "
+ "has size 0x%x, which is not a multiple of 4K. "
+ "You might experience some performance hit "
+ "due to that.\n",
+ i, (unsigned long long)cur_region->base_addr,
+ cur_region->size);
+ }
slow_map = 1;
}
- if (slow_map && (i == PCI_ROM_SLOT)) {
- fprintf(stderr, "ROM not aligned - can't continue\n");
- return -1;
- }
-
/* map physical memory */
pci_dev->v_addrs[i].e_physbase = cur_region->base_addr;
if (i == PCI_ROM_SLOT) {
pci_dev->v_addrs[i].u.r_virtbase =
mmap(NULL,
- (cur_region->size + 0xFFF) & 0xFFFFF000,
+ cur_region->size,
PROT_WRITE | PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE,
0, (off_t) 0);
--
1.6.6.rc1.43.gf55cc
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv3] slow_map: minor improvements to ROM BAR handling
2009-12-23 10:07 [PATCHv3] slow_map: minor improvements to ROM BAR handling Michael S. Tsirkin
@ 2009-12-23 19:26 ` Marcelo Tosatti
0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2009-12-23 19:26 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: avi, agraf, kvm
On Wed, Dec 23, 2009 at 12:07:47PM +0200, Michael S. Tsirkin wrote:
> ROM BAR can be handled same as regular BAR:
> load_option_roms utility will take care of
> copying it to RAM as appropriate.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> Changes from v2:
> replace ?: with an if statement
> changes from v1:
> make ROM bar read only
>
> hw/device-assignment.c | 25 +++++++++++++------------
> 1 files changed, 13 insertions(+), 12 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-23 19:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-23 10:07 [PATCHv3] slow_map: minor improvements to ROM BAR handling Michael S. Tsirkin
2009-12-23 19:26 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox