From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP7zl-00058s-LC for qemu-devel@nongnu.org; Wed, 03 Sep 2014 06:41:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP7zf-0000wV-Kn for qemu-devel@nongnu.org; Wed, 03 Sep 2014 06:40:57 -0400 Received: from mail-bn1lp0145.outbound.protection.outlook.com ([207.46.163.145]:31135 helo=na01-bn1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP7zf-0000wI-7M for qemu-devel@nongnu.org; Wed, 03 Sep 2014 06:40:51 -0400 From: Bogdan Purcareata Date: Wed, 3 Sep 2014 13:38:38 -0400 Message-ID: <1409765918-20425-3-git-send-email-bogdan.purcareata@freescale.com> In-Reply-To: <1409765918-20425-1-git-send-email-bogdan.purcareata@freescale.com> References: <1409765918-20425-1-git-send-email-bogdan.purcareata@freescale.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 2/2] kvm-openpic: Filter region add callbacks based on memory region offset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mihai Caraman , Bogdan Purcareata 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 Signed-off-by: Mihai Caraman --- 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