From nobody Sun Nov 9 15:10:36 2025 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 1550753781121880.9854913345033; Thu, 21 Feb 2019 04:56:21 -0800 (PST) Received: from localhost ([127.0.0.1]:59698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwnte-0003U2-1P for importer@patchew.org; Thu, 21 Feb 2019 07:56:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwnl8-0004iZ-TK for qemu-devel@nongnu.org; Thu, 21 Feb 2019 07:47:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwnl4-00062o-VH for qemu-devel@nongnu.org; Thu, 21 Feb 2019 07:47:26 -0500 Received: from mx2.rt-rk.com ([89.216.37.149]:37875 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwnl3-00061G-3W for qemu-devel@nongnu.org; Thu, 21 Feb 2019 07:47:21 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 8E5CA1A22B6; Thu, 21 Feb 2019 13:46:12 +0100 (CET) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 5E9AF1A22D5; Thu, 21 Feb 2019 13:46:12 +0100 (CET) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2019 13:45:58 +0100 Message-Id: <1550753160-15142-7-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550753160-15142-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1550753160-15142-1-git-send-email-aleksandar.markovic@rt-rk.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PULL 6/8] 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: peter.maydell@linaro.org, amarkovic@wavecomp.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan 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=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- 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 9f33582..dde4437 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.7.4