From: Bogdan Purcareata <bogdan.purcareata@freescale.com>
To: qemu-devel@nongnu.org
Cc: Mihai Caraman <mihai.caraman@freescale.com>,
Bogdan Purcareata <bogdan.purcareata@freescale.com>
Subject: [Qemu-devel] [PATCH 2/2] kvm-openpic: Filter region add callbacks based on memory region offset
Date: Wed, 3 Sep 2014 13:38:38 -0400 [thread overview]
Message-ID: <1409765918-20425-3-git-send-email-bogdan.purcareata@freescale.com> (raw)
In-Reply-To: <1409765918-20425-1-git-send-email-bogdan.purcareata@freescale.com>
This is done due to the fact that the kvm-openpic region_add 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 to consider
only addresses matching the start of the kvm-openpic memory region.
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
hw/intc/openpic_kvm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c
index e3bce04..b02de40 100644
--- a/hw/intc/openpic_kvm.c
+++ b/hw/intc/openpic_kvm.c
@@ -128,6 +128,11 @@ static void kvm_openpic_region_add(MemoryListener *listener,
return;
}
+ /* Ignore events on regions that are not at the MPIC offset */
+ if (section->offset_within_address_space !=
+ memory_region_address_space_offset(section->mr))
+ return;
+
reg_base = section->offset_within_address_space;
attr.group = KVM_DEV_MPIC_GRP_MISC;
--
1.7.10.4
prev parent reply other threads:[~2014-09-03 10:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 17:38 [Qemu-devel] [PATCH 0/2] kvm: Fix incorrect re-register of in-kernel MPIC Bogdan Purcareata
2014-09-03 17:38 ` [Qemu-devel] [PATCH 1/2] memory: Add MemoryRegion get address space offset helper function Bogdan Purcareata
2014-09-03 17:38 ` Bogdan Purcareata [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=1409765918-20425-3-git-send-email-bogdan.purcareata@freescale.com \
--to=bogdan.purcareata@freescale.com \
--cc=mihai.caraman@freescale.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).