[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v3 04/14] memory_region_present: return false if addr
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v3 04/14] memory_region_present: return false if address is not found in child MemoryRegion |
Date: |
Sun, 9 Mar 2014 21:19:46 +0200 |
From: Igor Mammedov <address@hidden>
Windows XP shows COM2 port as non functional in
"Device Manager" although no COM2 port backing device
is present in QEMU.
This regression is really due to
3bb28b7208b349e7a1b326e3c6ef9efac1d462bf?
memory: Provide separate handling of unassigned io ports accesses
That is caused by the fact that QEMU reports to
OSPM that device is present by setting 5th bit in
PII4XPM.pci_conf[0x67] register when COM2 doesn't
exist.
It happens due to memory_region_present(io_as, 0x2f8)
returning false positive since 0x2f8 address eventually
translates into catchall io_as address space.
Fix memory_region_present(parent, addr) by returning
true only if addr maps into a MemoryRegion within
parent (excluding parent itself), to match its
doc comment.
While at it fix copy/paste error in
memory_region_present() doc comment.
Note: this is a temporary hack: we really need better handling for
unassigned regions, we should avoid fallback regions since they are bad
for performance (breaking radix tree assumption that the data structure
is sparsely populated); for memory we need to fix this to implement PCI
master abort properly, anyway.
Cc: Jan Kiszka <address@hidden>
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/exec/memory.h | 6 +++---
memory.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 9101fc3..c084db2 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -836,13 +836,13 @@ void memory_region_set_alias_offset(MemoryRegion *mr,
hwaddr offset);
/**
- * memory_region_present: translate an address/size relative to a
- * MemoryRegion into a #MemoryRegionSection.
+ * memory_region_present: checks if an address relative to a @parent
+ * translates into #MemoryRegion within @parent
*
* Answer whether a #MemoryRegion within @parent covers the address
* @addr.
*
- * @parent: a MemoryRegion within which @addr is a relative address
+ * @parent: a #MemoryRegion within which @addr is a relative address
* @addr: the area within @parent to be searched
*/
bool memory_region_present(MemoryRegion *parent, hwaddr addr);
diff --git a/memory.c b/memory.c
index 59ecc28..3f1df23 100644
--- a/memory.c
+++ b/memory.c
@@ -1562,7 +1562,7 @@ static FlatRange *flatview_lookup(FlatView *view,
AddrRange addr)
bool memory_region_present(MemoryRegion *parent, hwaddr addr)
{
MemoryRegion *mr = memory_region_find(parent, addr, 1).mr;
- if (!mr) {
+ if (!mr || (mr == parent)) {
return false;
}
memory_region_unref(mr);
--
MST
- [Qemu-devel] [PULL v3 00/14] acpi,pc,pci,virtio,memory bug fixes, Michael S. Tsirkin, 2014/03/09
- [Qemu-devel] [PULL v3 01/14] acpi-build: append description for non-hotplug, Michael S. Tsirkin, 2014/03/09
- [Qemu-devel] [PULL v3 02/14] acpi-test-data: update expected files, Michael S. Tsirkin, 2014/03/09
- [Qemu-devel] [PULL v3 03/14] virtio-net: remove function calls from assert, Michael S. Tsirkin, 2014/03/09
- [Qemu-devel] [PULL v3 04/14] memory_region_present: return false if address is not found in child MemoryRegion,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v3 06/14] Rework --name to use QemuOpts, Michael S. Tsirkin, 2014/03/09
- [Qemu-devel] [PULL v3 05/14] PCIE: fix regression with coldplugged multifunction device, Michael S. Tsirkin, 2014/03/09
- [Qemu-devel] [PULL v3 08/14] Add a 'name' parameter to qemu_thread_create, Michael S. Tsirkin, 2014/03/09
- Re: [Qemu-devel] [PULL v3 08/14] Add a 'name' parameter to qemu_thread_create, Jan Kiszka, 2014/03/11
- [Qemu-devel] [PATCH] qemu-thread-posix: Fix build against older glibc version, Jan Kiszka, 2014/03/11
- Re: [Qemu-devel] [PATCH] qemu-thread-posix: Fix build against older glibc version, Peter Maydell, 2014/03/11
- Re: [Qemu-devel] [PATCH] qemu-thread-posix: Fix build against older glibc version, Dr. David Alan Gilbert, 2014/03/11
- Re: [Qemu-devel] [PATCH] qemu-thread-posix: Fix build against older glibc version, Peter Maydell, 2014/03/11
- Re: [Qemu-devel] [PATCH] qemu-thread-posix: Fix build against older glibc version, Dr. David Alan Gilbert, 2014/03/11
- Re: [Qemu-devel] [PATCH] qemu-thread-posix: Fix build against older glibc version, Peter Maydell, 2014/03/11