From nobody Mon Feb 9 06:50:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550492260556166.89805970774432; Mon, 18 Feb 2019 04:17:40 -0800 (PST) Received: from localhost ([127.0.0.1]:57297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvhrd-0000Cv-JF for importer@patchew.org; Mon, 18 Feb 2019 07:17:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvhng-00062G-SC for qemu-devel@nongnu.org; Mon, 18 Feb 2019 07:13:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvhne-0006ce-9g for qemu-devel@nongnu.org; Mon, 18 Feb 2019 07:13:32 -0500 Received: from zero.eik.bme.hu ([152.66.115.2]:27818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvhna-0006XS-2O for qemu-devel@nongnu.org; Mon, 18 Feb 2019 07:13:27 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 08F3E7456B9; Mon, 18 Feb 2019 13:13:23 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id D68A07456B3; Mon, 18 Feb 2019 13:13:22 +0100 (CET) Message-Id: In-Reply-To: References: From: BALATON Zoltan Date: Mon, 18 Feb 2019 13:01:41 +0100 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH v2 1/3] hw/pci-host/bonito.c: Add PCI mem region mapped at the correct address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , philmd@redhat.com, Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Stop using system memory as PCI memory otherwise devices such as VGA that have regions mapped to PCI memory clash with RAM. Use a separate memory region for PCI memory and map it to the correct address in system memory which allows PCI mem regions to show at the correct address where clients expect them. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud\ufffd\ufffd Tested-by: Philippe Mathieu-Daud\ufffd\ufffd --- v2: add mem region to BonitoState instead of allocating it hw/pci-host/bonito.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 9f33582706..dde4437595 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -217,6 +217,7 @@ struct BonitoState { PCIHostState parent_obj; qemu_irq *pic; PCIBonitoState *pci_dev; + MemoryRegion pci_mem; }; =20 #define TYPE_BONITO_PCI_HOST_BRIDGE "Bonito-pcihost" @@ -598,11 +599,15 @@ static const VMStateDescription vmstate_bonito =3D { static void bonito_pcihost_realize(DeviceState *dev, Error **errp) { PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); + BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(dev); =20 + memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCILO_= SIZE); phb->bus =3D pci_register_root_bus(DEVICE(dev), "pci", pci_bonito_set_irq, pci_bonito_map_ir= q, - dev, get_system_memory(), get_system_= io(), + dev, &bs->pci_mem, get_system_io(), 0x28, 32, TYPE_PCI_BUS); + memory_region_add_subregion(get_system_memory(), BONITO_PCILO_BASE, + &bs->pci_mem); } =20 static void bonito_realize(PCIDevice *dev, Error **errp) --=20 2.13.7