[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] PPC: openpic_kvm: Filter region callbacks based
From: |
Bogdan Purcareata |
Subject: |
[Qemu-devel] [PATCH 2/2] PPC: openpic_kvm: Filter region callbacks based on memory region offset |
Date: |
Wed, 3 Sep 2014 14:36:15 -0400 |
This is done due to the fact that the kvm-openpic region_{add,del} callbacks
can be invoked for sections generated from other memory regions as well. These
callbacks should handle only requests for the kvm-openpic memory region.
The patch fixes a bug on target-ppc occuring when the "e500-pci-bar0" memory
region is added. This memory region registers an alias to the "e500-ccsr" memory
region, which further contains the "kvm-openpic" subregion. Due to this alias,
the kvm_openpic_region_add is called once more, with an offset within the
"e500-pci-bar" memory region. This generates the remapping of the
in-kernel MPIC at a wrong offset.
The fix consists in an additional filter in kvm_openpic_region_{add,del} to
consider only addresses matching the start of the kvm-openpic memory region.
Signed-off-by: Bogdan Purcareata <address@hidden>
Signed-off-by: Mihai Caraman <address@hidden>
---
hw/intc/openpic_kvm.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c
index e3bce04..45d8736 100644
--- a/hw/intc/openpic_kvm.c
+++ b/hw/intc/openpic_kvm.c
@@ -124,7 +124,9 @@ static void kvm_openpic_region_add(MemoryListener *listener,
}
/* Ignore events on regions that are not us */
- if (section->mr != &opp->mem) {
+ if (section->mr != &opp->mem ||
+ section->offset_within_address_space !=
+ memory_region_address_space_offset(section->mr)) {
return;
}
@@ -151,7 +153,9 @@ static void kvm_openpic_region_del(MemoryListener *listener,
int ret;
/* Ignore events on regions that are not us */
- if (section->mr != &opp->mem) {
+ if (section->mr != &opp->mem ||
+ section->offset_within_address_space !=
+ memory_region_address_space_offset(section->mr)) {
return;
}
--
1.7.10.4
Re: [Qemu-devel] [Qemu-ppc] [PATCH 0/2] PPC: kvm: Fix incorrect remapping of in-kernel MPIC, Alexander Graf, 2014/09/05
Re: [Qemu-devel] [Qemu-ppc] [PATCH 0/2] PPC: kvm: Fix incorrect remapping of in-kernel MPIC, Alexander Graf, 2014/09/05