From nobody Tue Nov 18 10:38:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) client-ip=209.85.221.49; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f49.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1609455019; cv=none; d=zohomail.com; s=zohoarc; b=KcR9Y0FcCZINjpDd5vcS1QJqZz56kdebdJRYQ91uuIFL6G03F/e+/5Vjg5FJT9NHa29Y1PVvLAeGxwiJd3OkAumFu/ld3/+O1bdQabzyV/mwErUD0tvR9Zvl/JWpLxZFfUhv1K5gLZEPzzGSA0dpMSRjfPAM2hnuebAG6HpBLig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609455019; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/CZdAhxdZnoENonIoHzd7f1sQJAHt0dXIOFmHph9mF8=; b=H3ywOYIUhQfVMIYzPl0Q5nDfVIYo1mPOxzF1wtaXbYSB2bUBttvB4jGUGXYpMWRiQOoS1jwr2mr6453uzVjSi/pHEgI+NWdDMzobgp8AR8TdjpzF3VMAKbT7TaDVRhnf5Z9lRudIJ0O9G++LD/foadnAQ4H6gLVIODrg/gYP0Sw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.zohomail.com with SMTPS id 1609455019479489.9962451457469; Thu, 31 Dec 2020 14:50:19 -0800 (PST) Received: by mail-wr1-f49.google.com with SMTP id t16so21050446wra.3 for ; Thu, 31 Dec 2020 14:50:18 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (239.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.239]) by smtp.gmail.com with ESMTPSA id s63sm15819299wms.18.2020.12.31.14.50.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Dec 2020 14:50:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/CZdAhxdZnoENonIoHzd7f1sQJAHt0dXIOFmHph9mF8=; b=Irr1/szBywhnnMeBE4QFxAMIlivuta+Dqz75Sk8ph105KIh8q4BXte9VKFceYt1JOH 4ynSGqAk8w2sAYhdm3b3nvKn8HLXnfpp3peMK9enPRca0wagoAzeRJKLSRB4oVmniU3Z PrudWdwdPqQa+FiJaeybq/RQy1qAsvzL5Q5BrBthKv4R1FJQ1DLkPCWbeq0+VuaIxe3w qsAv/xZRuLHSfQmX8r4ANRgg9PF0/792YbTuC4FCWXeIfB+r4e1GnumowuCs5T1Cii0H TTgHOtGAz0cBBMRurgf9nXPAvLFMheBBBTfYgQZ/6D9mLBzVXLggEqXV47N/PCBvigSS 9uUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/CZdAhxdZnoENonIoHzd7f1sQJAHt0dXIOFmHph9mF8=; b=srEdyAYgebmiIxHO6Rj12viWOY04k/+C3v4vy7v5iaEh2dg+w+OyYLdhDlOpQtujB+ 6KoM9r5K5O6CZNlkLX3YWm9dOllDMONTeudkOZKB6Zs23URMfmCYQzfVY5mAQ0aMHN8m QU9yg16JhY+pnWsm6TBRsVcJCmxwuFuV/PSazEWFJCVHTybEkXPlANL2RunY2hY+Tqpr D1E2ZyL65AticgSQcth3bCQ/U2ELnBPreQECwgpmG7j72ppliGfmf6cFUFHSrShpsr29 abx6leVKUkx4OlBochEAAumUsFQK96cVxx5hMPwxXXWAVE96fPoYlADesoTX21nNOc5F SjUg== X-Gm-Message-State: AOAM532WCHa+zBPd02S0+QE8r4XbV+J5KhsBXmLLNq1Xjqvxa3nXPplg TpBRvKanOcr+k5TjxKD8wuY= X-Google-Smtp-Source: ABdhPJwXubpBVxE6BSa1eUEB+/eXVQKGRFoxMt7sLhy0fpcpPsTsWYilcOllcQfUiMDijE/0IBZg1Q== X-Received: by 2002:a5d:5227:: with SMTP id i7mr67978145wra.68.1609455017745; Thu, 31 Dec 2020 14:50:17 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Aleksandar Rikalo , Aurelien Jarno , Huacai Chen Subject: [PATCH 13/18] hw/pci-host/bonito: Create PCI regions in bonito_host_realize() Date: Thu, 31 Dec 2020 23:49:06 +0100 Message-Id: <20201231224911.1467352-14-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201231224911.1467352-1-f4bug@amsat.org> References: <20201231224911.1467352-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) The PCI regions belong to the 'host' device, not the PCI function. Move the PCI regions creation there. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/bonito.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 1c88ccc6af8..4dcaa2fa8bb 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -654,6 +654,7 @@ static void bonito_host_realize(DeviceState *dev, Error= **errp) { PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(dev); + MemoryRegion *pcimem_alias =3D g_new(MemoryRegion, 1); =20 memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_= SIZE); phb->bus =3D pci_register_root_bus(dev, "pci", @@ -662,6 +663,14 @@ static void bonito_host_realize(DeviceState *dev, Erro= r **errp) PCI_DEVFN(5, 0), 32, TYPE_PCI_BUS); =20 create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB); + + memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias", + &bs->pci_mem, 0, BONITO_PCIHI_SIZE); + memory_region_add_subregion(get_system_memory(), + BONITO_PCIHI_BASE, pcimem_alias); + create_unimplemented_device("PCI_2", + (hwaddr)BONITO_PCIHI_BASE + BONITO_PCIHI_S= IZE, + 2 * GiB); } =20 static void bonito_pci_realize(PCIDevice *dev, Error **errp) @@ -669,8 +678,6 @@ static void bonito_pci_realize(PCIDevice *dev, Error **= errp) BonitoPciState *s =3D PCI_BONITO(dev); SysBusDevice *sysbus =3D SYS_BUS_DEVICE(s->pcihost); PCIHostState *phb =3D PCI_HOST_BRIDGE(s->pcihost); - BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(s->pcihost); - MemoryRegion *pcimem_alias =3D g_new(MemoryRegion, 1); =20 assert(!target_words_bigendian()); /* FIXME not supported */ =20 @@ -732,14 +739,6 @@ static void bonito_pci_realize(PCIDevice *dev, Error *= *errp) create_unimplemented_device("IOCS[3]", BONITO_DEV_BASE + 3 * 256 * KiB, 256 * KiB); =20 - memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias", - &bs->pci_mem, 0, BONITO_PCIHI_SIZE); - memory_region_add_subregion(get_system_memory(), - BONITO_PCIHI_BASE, pcimem_alias); - create_unimplemented_device("PCI_2", - (hwaddr)BONITO_PCIHI_BASE + BONITO_PCIHI_S= IZE, - 2 * GiB); - /* set the default value of north bridge pci config */ pci_set_word(dev->config + PCI_COMMAND, 0x0000); pci_set_word(dev->config + PCI_STATUS, 0x0000); --=20 2.26.2