From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638379; cv=none; d=zohomail.com; s=zohoarc; b=hv8KAH0ffVMwaYG515vfhkhZ5T/TsNjKknFkVS6CYhZhvkdp5WLIhgwUKF61UcSYHcIcWepsOkrn5hqpwUeRcnMvDmkM6ewUkamvX7p+eHjD7dPniiOiPEgEWQjAgq/84HwdH1GAPeRVwsP+wnuERJBncMgYLKls3Ckdmfqsxso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638379; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ehToEO0OS6e+ZoKHCVyGegzWxdjPGpE7iPcfW8fCv8Y=; b=gaV4LWSzMLsTCicsJClUgZ1/KH1DevajA8tTiHk94LlZuOJPR6nyXCocg08wipkTx9s7AJedM6DPMxyTdWafoKSkEfD+w8xYFhiEUCkbaYVq/FM9gppChS7m//AAK06R9NKrPUe+Q4mtARtjc6GyPv7LigvS1+lJZlTbX9Dlp3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638379409674.5997409848627; Wed, 18 Oct 2023 07:12:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7Hb-0006Yl-SK; Wed, 18 Oct 2023 10:12:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7HP-0006R4-JN for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:13 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7HK-0004m0-Uw for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:10 -0400 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-99c1c66876aso1116988466b.2 for ; Wed, 18 Oct 2023 07:12:06 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id j26-20020a170906255a00b009c503bf61c9sm1746799ejb.165.2023.10.18.07.12.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638324; x=1698243124; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ehToEO0OS6e+ZoKHCVyGegzWxdjPGpE7iPcfW8fCv8Y=; b=PRyJI27iRVjAL4qoajKCnKH4BOcJr8fFUCpFwhYOqsvClwaQzGSUdFS3AbG9UmcezV wy8WSi8x2FlR4WyaqRo4IIHcxR5wkgZyr09v4tAeWx0Xvx419wULGrpxPRvgZbs3cTVr Z9vEaTgA0xzYzeaPNVuKR/08G98yc16/OaIMnc27KpetuJQnB65Xvh4NMN4OZHejCcLY KRkAHTFHOZ1rjnGaio97xvX8+vQ8vqXQSnG3fMVqPP7o9GvCEFvtVdQAA38sYP5u2zKh AwCjCJVQccPObSWzFiw6iGepsZMafTo7+wZWV5GdTLiREWtApDFalB1/RLHv9kNh4v0N F/Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638324; x=1698243124; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ehToEO0OS6e+ZoKHCVyGegzWxdjPGpE7iPcfW8fCv8Y=; b=V7K1pEwUMVJxJhdK+Nl0eZ0ztaaIzxdlhIga0yi8PDH0mRMb2qrX3p9WaLVEt6XTf1 FwlcpwUqQ8gHLlAqhDjznpfHVU1WrLTxLjGtWjYcvLSGh+sUPDs1BsiXY2Zo8I0pUOhB fdhL72cnpteCZS5VcKFzYlgOSRhEcQW9T9f9agZLaOc1stxB0IN+/VVOy+7TP3gvFkbA FWFezg3idCrXUPEtxKsNCcTGIH27RKhX6xj6tbtMdL3fYUDKX+NCtro6OSFfuvf+IMiO x55S4QQDLNBD1qGTfywG0UxZT2vtxyMdOAAdeDIEcrRExBmnUOa4SSzRgACPFlrcu1I7 EPjQ== X-Gm-Message-State: AOJu0YwBMjpkBn7SgnEwwRk27l3rXNLDv14HXWirv9rNnxasLpbGM66X IDck4Tt26dIhskdNh/mO1f1XUNi1jMY8m5oGFyk= X-Google-Smtp-Source: AGHT+IGpORwcOgVOXLUgftcUBi24IzgEK2qyeNY49+UAOAtF2ov/IsicmmNY1TbupuqzQF2bRy3S5w== X-Received: by 2002:a17:907:7ba0:b0:9bf:20e0:bfe8 with SMTP id ne32-20020a1709077ba000b009bf20e0bfe8mr4137350ejc.9.1697638324267; Wed, 18 Oct 2023 07:12:04 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 01/12] hw/i386/amd_iommu: Do not use SysBus API to map local MMIO region Date: Wed, 18 Oct 2023 16:11:39 +0200 Message-ID: <20231018141151.87466-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=philmd@linaro.org; helo=mail-ej1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638380899100003 There is no point in exposing an internal MMIO region via SysBus and directly mapping it in the very same device. Just map it without using the SysBus API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin --- hw/i386/amd_iommu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 8d0f2f99dd..7965415b47 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1579,9 +1579,8 @@ static void amdvi_sysbus_realize(DeviceState *dev, Er= ror **errp) /* set up MMIO */ memory_region_init_io(&s->mmio, OBJECT(s), &mmio_mem_ops, s, "amdvi-mm= io", AMDVI_MMIO_SIZE); - - sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->mmio); - sysbus_mmio_map(SYS_BUS_DEVICE(s), 0, AMDVI_BASE_ADDR); + memory_region_add_subregion(get_system_memory(), AMDVI_BASE_ADDR, + &s->mmio); pci_setup_iommu(bus, amdvi_host_dma_iommu, s); amdvi_init(s); } --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638400; cv=none; d=zohomail.com; s=zohoarc; b=M3sLyrbBl9cN+TpyWSXQGxv/IRaVPAIxvpWG3lHI+MQ4oBzTjPxO+W3wzCvBpsVhqC+x1dYkqx5kBQnDRBg7DVPoymEeY0jFSa/DUsUrVrlgCzHynh96cnvkZptQhC+mYsfic7oV6t40AeLhEy4c9C3XKXzEvBebE5BgG7F6zaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638400; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=poPJ+bMANM3F4WTSkIKk7d4BzsQMnyYxPL7gQ+lwFeU=; b=SmBTb8fmX2La9kvEtc9zyNEXgheLCmiMwrgep8M2hmq5bkTv8VEu4JBYSUv2y7S04wVtmVpPOc0Cp33wyVq5Bnfy2XFAI4F7v+ISf7EwCBVKNfPqyyv59N2oCW9cuFI0OfjAH44pGeDr5ITwZq1dwCdOGnjweN15z0MHsujg+dQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638400831872.6735191463858; Wed, 18 Oct 2023 07:13:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7Hg-0006df-3N; Wed, 18 Oct 2023 10:12:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7HV-0006UV-5F for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:20 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7HS-0004mc-9O for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:16 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-53ed4688b9fso5435337a12.0 for ; Wed, 18 Oct 2023 07:12:13 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id jt24-20020a170906dfd800b009b9977867fbsm1748529ejc.109.2023.10.18.07.12.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638332; x=1698243132; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=poPJ+bMANM3F4WTSkIKk7d4BzsQMnyYxPL7gQ+lwFeU=; b=zLjopPIifT36n5nFcapJFlzMHhgOBP48e2+Z1PZ1IRk1VkflpRd8BDmz5eX4sROu2+ 4nhc173G/9+XDDFxdJjCmIzCZNQAI8sWcs1ssahUHT0l1TuVGDZomK9odYRyj27Gbe7U kp2yIJeC3pzNMyJRr3LxdSfnmh3fwH3Gq4GZqaukisUekN3RIR/LtEEvGUVWxHxh7EqN 8KY92s8K/CI6wXAO1MvVE1fZpO9QyGaMvDbriBfEwVy0BPgxLJ+6VeyV/YM/QXu2PAJ9 hMWn55cbBTvoe8xQtWEWqgLCdeu1M1n1i4a4nuPMtcvHww+lL0g85Sy6EahmlnMbKzhf aHQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638332; x=1698243132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=poPJ+bMANM3F4WTSkIKk7d4BzsQMnyYxPL7gQ+lwFeU=; b=s/qhq7OvFRZQnmvKuSZhwfmcqcUnAhMUT6y/16wN/18/eefoZRiRVV6f9PtwjSKS5P 22UNrfxhXEHNkpVb6ZWpkbwyMyckZb2r7AFt0KDjKRtnC3d2NHHLOxL2MoxuN3PvWERO e03r4WU9qgxQKjflVNQH6KjnQaolK/4oigPrS/l5wZF0prNs8aHR5UmlciiEEFi1Mjhc pRFlkeIKHeTPTqWrGISSdePN7d2sAXmk2l0XTLGHYV1S9fw8nF3mX+Cs8f5p+J2Ulhfv m9qZHoCcJX801Q78h1MA0p9TVumujctQphUxRde4VOe07PJsvLxKxiiX9O7vj66WvtFU O/Kg== X-Gm-Message-State: AOJu0YxQDiLthAT5DZJlIf4vzdZYKmuB7eCliBSuKFHA77ziPwkUah4k ea160/ZAGs2n3fH7jgNTCOHOD1vd5i9innl1iHM= X-Google-Smtp-Source: AGHT+IGvRzK7AZsaMO1eaXzPeJ2zNokdr1fKTMPDzyT94moeXuisZIt1dwQdij9y/I7hth++zfyYOw== X-Received: by 2002:a17:906:c105:b0:9be:aebc:d479 with SMTP id do5-20020a170906c10500b009beaebcd479mr4429521ejc.19.1697638332227; Wed, 18 Oct 2023 07:12:12 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 02/12] hw/i386/intel_iommu: Do not use SysBus API to map local MMIO region Date: Wed, 18 Oct 2023 16:11:40 +0200 Message-ID: <20231018141151.87466-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638402796100001 There is no point in exposing an internal MMIO region via SysBus and directly mapping it in the very same device. Just map it without using the SysBus API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 2c832ab68b..e4f6cedcb1 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4134,6 +4134,8 @@ static void vtd_realize(DeviceState *dev, Error **err= p) qemu_mutex_init(&s->iommu_lock); memory_region_init_io(&s->csrmem, OBJECT(s), &vtd_mem_ops, s, "intel_iommu", DMAR_REG_SIZE); + memory_region_add_subregion(get_system_memory(), + Q35_HOST_BRIDGE_IOMMU_ADDR, &s->csrmem); =20 /* Create the shared memory regions by all devices */ memory_region_init(&s->mr_nodmar, OBJECT(s), "vtd-nodmar", @@ -4148,15 +4150,12 @@ static void vtd_realize(DeviceState *dev, Error **e= rrp) memory_region_add_subregion_overlap(&s->mr_nodmar, VTD_INTERRUPT_ADDR_FIRST, &s->mr_ir, 1); - - sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->csrmem); /* No corresponding destroy */ s->iotlb =3D g_hash_table_new_full(vtd_iotlb_hash, vtd_iotlb_equal, g_free, g_free); s->vtd_address_spaces =3D g_hash_table_new_full(vtd_as_hash, vtd_as_eq= ual, g_free, g_free); vtd_init(s); - sysbus_mmio_map(SYS_BUS_DEVICE(s), 0, Q35_HOST_BRIDGE_IOMMU_ADDR); pci_setup_iommu(bus, vtd_host_dma_iommu, dev); /* Pseudo address space under root PCI bus. */ x86ms->ioapic_as =3D vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPI= C); --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638448; cv=none; d=zohomail.com; s=zohoarc; b=N5fPeNv9a8T795PrTg0GgUNMte38BNDPQgWI4Ef1BfmnYZkfieo4Edo+nDrfdlqw9krFnqTqU7IodByEWhc7vKU0RvpfW4DQdnVHQCTRBadN+giJmPY/k/R3elf+8dHP+ZhNit/n01t9j7FVqESs8SMI9y5LC48gm6cvNwbO5XY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638448; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OG/eTeWn+OzUtyx8iBSPb0Amcuu5LlJ9K/x3TvIXfKM=; b=RJRU5B4UelMw7Bd6A+I9Wyn4ECiasm+1hTZsOcl+MBiE5txkRbOjll5e7pIg25sdgNQT+3DhbrIUXz48ZLFZR97lrLLHjbScsCHK8/FC/cb6uqVW7z1oPEUUGKTgHLQRqNcvj5cwM4Cgo8YhWX6F+DhuuP1qoB+F1FKghNZcXJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638448711942.7290706935319; Wed, 18 Oct 2023 07:14:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7Hg-0006ea-Dp; Wed, 18 Oct 2023 10:12:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7Hc-0006bw-Ve for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:25 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7Ha-0004oZ-3a for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:24 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9b9faf05f51so1061804766b.2 for ; Wed, 18 Oct 2023 07:12:21 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id 2-20020a170906224200b009c6e58437dasm1783529ejr.37.2023.10.18.07.12.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638340; x=1698243140; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OG/eTeWn+OzUtyx8iBSPb0Amcuu5LlJ9K/x3TvIXfKM=; b=O6XBzWAGJEbDYnp9Qhkf44wboosoFezSlnL8AqWEa0PHlRXYOAcefz8acs0DWCpZI/ mCzDQk2xfLucil+lpXTbCG6wSM2zfoatCIsVfjk2goQk8pMVtMg5Kxwm9NZmWUYChIWW JigeAgt+IB36yuvcRoOaInA20B9d1qIHTUZGKeEffM93+fX37G/ZI+mM1jHS4J4Vu1QU w/wFJws+AtB6OfG8Q8kacOC715s36oqWFPtJiEAs7ctmNs9dZI0bAuefYRboZT9ggR1B gOLpLdH6X2T71a8bGBe9560bYMj8buKRkGYJjN0hXwXsVZg2xuClVQ5iNtdWp4b7qIhd jRfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638340; x=1698243140; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OG/eTeWn+OzUtyx8iBSPb0Amcuu5LlJ9K/x3TvIXfKM=; b=AiKcEUDCsQj0M0/qvZqRPsXshxUL2uvSOrVo1hLBLdH49I6DkTnRZ9X9uWQI4s3Nyr 3eUpHi2bZPW3jcW/fidDSYUQHDqTLJjkqxo3Wo1gdOh6UGeYes1/+uxrw4TNcUjPpLB/ QE0ORgMPdHaOOUGLS1cw/kDVUpMlX+ZHNuvtLxTmUQ+NWs7sHJSFc5lRnzKTeGIzRflx YYt5BSdMfF9YbCU/eLEsf8aVMV9w7AwJ3XZHDoxxu0Cnl0VvMybVLpzLJBNaoncHenTt lhgrWYS04joenD4AdAe4Fo7mvtUVUWkKJr+ZuRMGMl/vZC363M08kydEsgRiQ4BXGKFE ymGw== X-Gm-Message-State: AOJu0YzxmM/4TPGJ9glcCnc4q9zxGWk6PfSY6LKvHFIKfzptYuIjYq6d MY7+4w2Pmiox9hfUt+yCb6363sO3QFffRlZzx+8= X-Google-Smtp-Source: AGHT+IFFhseKzBpfBoZ5nmkWhC9OVraNp+4L/k01QPK0eJmjTN3QoKDolKoQXl81U6xmWjLdbCEuLg== X-Received: by 2002:a17:907:98e:b0:9bd:fa48:83c5 with SMTP id bf14-20020a170907098e00b009bdfa4883c5mr3938988ejc.70.1697638340025; Wed, 18 Oct 2023 07:12:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 03/12] hw/misc/allwinner-dramc: Move sysbus_mmio_map call from init -> realize Date: Wed, 18 Oct 2023 16:11:41 +0200 Message-ID: <20231018141151.87466-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638450908100001 In order to make the next commit trivial, move the sysbus_init_mmio() call in allwinner_r40_dramc_init() just before the corresponding sysbus_mmio_map_overlap() call in allwinner_r40_dramc_realize(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin --- hw/misc/allwinner-r40-dramc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/misc/allwinner-r40-dramc.c b/hw/misc/allwinner-r40-dramc.c index 6944f84455..2cc0254a55 100644 --- a/hw/misc/allwinner-r40-dramc.c +++ b/hw/misc/allwinner-r40-dramc.c @@ -414,6 +414,7 @@ static void allwinner_r40_dramc_reset(DeviceState *dev) static void allwinner_r40_dramc_realize(DeviceState *dev, Error **errp) { AwR40DramCtlState *s =3D AW_R40_DRAMC(dev); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 if (!get_match_ddr(s->ram_size)) { error_report("%s: ram-size %u MiB is not supported", @@ -421,8 +422,12 @@ static void allwinner_r40_dramc_realize(DeviceState *d= ev, Error **errp) exit(1); } =20 - /* detect_cells */ - sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s), 3, s->ram_addr, 10); + /* R40 support max 2G memory but we only support up to 1G now. index 3= */ + memory_region_init_io(&s->detect_cells, OBJECT(s), + &allwinner_r40_detect_ops, s, + "DRAMCELLS", 1 * GiB); + sysbus_init_mmio(sbd, &s->detect_cells); + sysbus_mmio_map_overlap(sbd, 3, s->ram_addr, 10); memory_region_set_enabled(&s->detect_cells, false); =20 /* @@ -458,12 +463,6 @@ static void allwinner_r40_dramc_init(Object *obj) &allwinner_r40_dramphy_ops, s, "DRAMPHY", 4 * KiB); sysbus_init_mmio(sbd, &s->dramphy_iomem); - - /* R40 support max 2G memory but we only support up to 1G now. index 3= */ - memory_region_init_io(&s->detect_cells, OBJECT(s), - &allwinner_r40_detect_ops, s, - "DRAMCELLS", 1 * GiB); - sysbus_init_mmio(sbd, &s->detect_cells); } =20 static Property allwinner_r40_dramc_properties[] =3D { --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638381; cv=none; d=zohomail.com; s=zohoarc; b=FxyyCUtCUqMoKf0vgukT+oRcajoo5tR3RPv6ie3PCqeEh+bGyiRXs0ttLguCF42WjYdSjTipulFmoQIr6NNhR8hu+J1PU0x1EdTbMoWj4NxDQubimYZIt9irQ6FhGwib3bsnq7fEvKFG6ByyfpFDCg/KqUlNuREYE6FK1+wy4ko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638381; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=U5zian4RrM8OBn3rj31JdRNyc5wh1SA22kx5TYn7Hao=; b=JWSpRhYd7N6YkDFhvMxlux2Xoe9UDnjkG53SS58aK8s2yZCCbjKkmodWe/9oEeP138m8RyDBDBRcS0A7X8lkq9+6gRdcr922H9dqB1kROUmwqwOy5n3BArzELRQu40DSAND7142opFKwJLYTQxCPeSiFkQt7vCLji23LN3cl6cw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638381667713.6416832158862; Wed, 18 Oct 2023 07:13:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7Hl-0006lE-Ez; Wed, 18 Oct 2023 10:12:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7Hk-0006km-Gc for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:32 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7Hi-0004ph-1E for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:32 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9be7e3fa1daso728907366b.3 for ; Wed, 18 Oct 2023 07:12:29 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id q20-20020a170906145400b009c387ff67bdsm1795642ejc.22.2023.10.18.07.12.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638347; x=1698243147; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U5zian4RrM8OBn3rj31JdRNyc5wh1SA22kx5TYn7Hao=; b=B3URizAA0sNJB5/H0eeDF8cIO7XCncVZNMCsDuRKCO6uX+jqTYyqqgV5H+eySIClKM SuBtfxWvXx1GW2XeTw+PdB8Vu+3flEkcEYsJ+twiyQ5nb2mTlddNgwSa7ynRpHBquKx7 y39UP9gK8L5znYdS4wzyb8ixr7C5781fOs2I8VXIEziunfMtUtKCboQt+Q3MCUN89zJu U1fmgwTHAPwzrSIjRX+r1tax/orRWJCKLSXaNrbhmrwudN01wxe9+05gs8/a5Q7mqTxK VNk8zV2uDDgke8NHrNliejfBTyC9GZD3SC5yWCGmVzMiUgjjlMEXflFcu1CmZEjC2tjI PELw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638347; x=1698243147; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U5zian4RrM8OBn3rj31JdRNyc5wh1SA22kx5TYn7Hao=; b=e2sISf7Ru5ydG3nJ5JB2mSjY7s0E6QOaGAxQfMb16SejMQtoTFUDBCJslnSWNfAJK/ MmXAzfKOb2f1YepiBVUULco9rCyxN76Nyv/AtYhobHHMxQRZgd3tet+2eOTi9Cu3nJfb x05cPQb3b/LY7+S/9o6XJ/M82zjSgaSibFZVt2v2QrV+ZHN0FK/LZhmlyW/rTfFtzRY1 HWtLiiY8Lwwhi+eCR8J4YnTeo4gt9r0HlLTjs4fpYgRHEgrGYV5Ytbzi1nEXTnXOh40l 1SKVU9/ekOTDydcZv5z7CQVFeKlAhy7evR06DCSzxW5AVqFSDhtf6PY3l1Az7VTd7V0E rRmw== X-Gm-Message-State: AOJu0YwpPQx6e++WsHK7RtyeaB7reVCcMD9PsWx/43LR0iuebbtOJmH5 1vbsVkM8kY0LDBicsQW+O6yHHBsS4cGEqj2nnzc= X-Google-Smtp-Source: AGHT+IHYCSEUQKVZcas0DvgTW2/YKlCfbIArdhMOhM9c5+/Xb4vaTJ8qHwuuGAtkVGLFdv4jyAn+8g== X-Received: by 2002:a17:907:25c1:b0:9be:ef46:6b9c with SMTP id ae1-20020a17090725c100b009beef466b9cmr4047074ejc.70.1697638347467; Wed, 18 Oct 2023 07:12:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 04/12] hw/misc/allwinner-dramc: Do not use SysBus API to map local MMIO region Date: Wed, 18 Oct 2023 16:11:42 +0200 Message-ID: <20231018141151.87466-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=philmd@linaro.org; helo=mail-ej1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638383012100007 There is no point in exposing an internal MMIO region via SysBus and directly mapping it in the very same device. Just map it without using the SysBus API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin --- hw/misc/allwinner-r40-dramc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/misc/allwinner-r40-dramc.c b/hw/misc/allwinner-r40-dramc.c index 2cc0254a55..3d81ddb2e1 100644 --- a/hw/misc/allwinner-r40-dramc.c +++ b/hw/misc/allwinner-r40-dramc.c @@ -414,7 +414,6 @@ static void allwinner_r40_dramc_reset(DeviceState *dev) static void allwinner_r40_dramc_realize(DeviceState *dev, Error **errp) { AwR40DramCtlState *s =3D AW_R40_DRAMC(dev); - SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 if (!get_match_ddr(s->ram_size)) { error_report("%s: ram-size %u MiB is not supported", @@ -422,23 +421,23 @@ static void allwinner_r40_dramc_realize(DeviceState *= dev, Error **errp) exit(1); } =20 - /* R40 support max 2G memory but we only support up to 1G now. index 3= */ + /* R40 support max 2G memory but we only support up to 1G now. */ memory_region_init_io(&s->detect_cells, OBJECT(s), &allwinner_r40_detect_ops, s, "DRAMCELLS", 1 * GiB); - sysbus_init_mmio(sbd, &s->detect_cells); - sysbus_mmio_map_overlap(sbd, 3, s->ram_addr, 10); + memory_region_add_subregion_overlap(get_system_memory(), s->ram_addr, + &s->detect_cells, 10); memory_region_set_enabled(&s->detect_cells, false); =20 /* * We only support DRAM size up to 1G now, so prepare a high memory pa= ge - * after 1G for dualrank detect. index =3D 4 + * after 1G for dualrank detect. */ memory_region_init_io(&s->dram_high, OBJECT(s), &allwinner_r40_dualrank_detect_ops, s, "DRAMHIGH", KiB); - sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->dram_high); - sysbus_mmio_map(SYS_BUS_DEVICE(s), 4, s->ram_addr + GiB); + memory_region_add_subregion(get_system_memory(), s->ram_addr + GiB, + &s->dram_high); } =20 static void allwinner_r40_dramc_init(Object *obj) --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638416; cv=none; d=zohomail.com; s=zohoarc; b=GuAjMUA+BK+HLTjHReKa5AvcKu+Sq1EnNZRY8aojeNVzklDRx6raje3A7BRDfQeuxpA0/N+aSpqpaqw5Uegtakf+BAsXNE2haCelyXV9aHkWbUMGMOhdZrfCf9rcUfRyNe32sY5s40qtigVhVKpMYRbsjgvbqMukljOIzLSEBXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638416; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TSfRH1Mn/Aw6tTtb5T5VxnnMQOYFdF9NNCqc+8Way/E=; b=WcLkbTKhCt6saMVyz3ZGl3RzCr32TjG+ww5NoOUp1tSW2GPOV0Kp7DGRI76G4huTKLg+9uNF6cfxwoDFYrQmj/hJF757U93azk117exU2EnNWiTUO3a9/zAtacyj1LzaoS7rvivtTUcKzNMHTEjNs8SZXui+BZsTz4sTOIjDN+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638416248407.56454146650697; Wed, 18 Oct 2023 07:13:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7Hv-00073o-NA; Wed, 18 Oct 2023 10:12:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7Hu-00071c-87 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:42 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7Hp-0004qw-OS for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:41 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-53e08e439c7so11430535a12.0 for ; Wed, 18 Oct 2023 07:12:37 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id bo16-20020a170906d05000b00977eec7b7e8sm1789807ejb.68.2023.10.18.07.12.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638355; x=1698243155; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TSfRH1Mn/Aw6tTtb5T5VxnnMQOYFdF9NNCqc+8Way/E=; b=lwkKHYgKKj0R8UF0CI4jj2lGpuPwtI65KpxbY9nc7EUajilR2EB0Laen810Svf6Gw2 3y6UIcUWXWQGpS5SECHG6MfSwLxtKC3wnNmHRHzcCbDQq+BL6c/AOs28AErfJfl40FlM n0ofhmsUjwrqgIJM9Ij1QKtGBzAryr1TmHiqu6+JdNwL5davfNxeKgEq/05ad6HyZo9L 3rSbLkNO8xVqq+f05SJK0r9QTcy6iB0I50qay7f9tuyp8DGUmjyZVUcNo+dRkVnzLpRz /2IOezgw+azmspJJ6GY4/zi8EcDsp+ydrF/dvOx0uXWyUspIVRR3LhQA9j/aKx5+3+S3 oQgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638355; x=1698243155; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TSfRH1Mn/Aw6tTtb5T5VxnnMQOYFdF9NNCqc+8Way/E=; b=nwxRM0ZbA9kiy9+3RcamoV7ln3kl9R6tzwq9NkNgxtmGl+dzhWTq2Lp2ASx0yGq1+Z jHpNF4KVC6Mvr8tJz4BD82Ug44c1laoTp8wQB7Sh5wTr5aP3Xeer53/BuN8Xo7rOD1vb SHx3w1kCVx5pmZIx+J298Q+Y/w0PVTxbx3v+iS9oD/gDE2XlOa3YTqgYC9zkhE8nUUBj qq6ejIYayh7kn+m+qQemvX5an/xS4hWmEXA4OIifX4PQ4FiNmP/8b9mj+RO9unjwxPCS 1tFMKP3S6eOa1dfzqpYuK8Fc4wu72Hy586r1MyBAuUNdl5y+XpBLjjUy1sklh/G7Kf7z DswA== X-Gm-Message-State: AOJu0YxvciUcy9apRAxOXTsgdMfg7Ox5DHlRzdTna9Jw9VNSGm9BE5Pw SJ0HX5TnIMjf+VdW64rzUjk0P029K/wDtEhpE8E= X-Google-Smtp-Source: AGHT+IFzukzia+V0+5Swwm35uF6LdYO7kKDj2x+IJAbYviiJCXXtpuGWVM+k1FIvF4DoJIVA8N4Q8Q== X-Received: by 2002:a17:907:7211:b0:9ad:df85:97ae with SMTP id dr17-20020a170907721100b009addf8597aemr4253962ejc.66.1697638355445; Wed, 18 Oct 2023 07:12:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 05/12] hw/pci-host/bonito: Do not use SysBus API to map local MMIO region Date: Wed, 18 Oct 2023 16:11:43 +0200 Message-ID: <20231018141151.87466-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638416842100001 There is no point in exposing an internal MMIO region via SysBus and directly mapping it in the very same device. Just map it without using the SysBus API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin --- hw/pci-host/bonito.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index ee6cb85e97..3b803bcad3 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -654,7 +654,6 @@ static void bonito_host_realize(DeviceState *dev, Error= **errp) static void bonito_pci_realize(PCIDevice *dev, Error **errp) { PCIBonitoState *s =3D PCI_BONITO(dev); - SysBusDevice *sysbus =3D SYS_BUS_DEVICE(s->pcihost); PCIHostState *phb =3D PCI_HOST_BRIDGE(s->pcihost); BonitoState *bs =3D s->pcihost; MemoryRegion *pcimem_alias =3D g_new(MemoryRegion, 1); @@ -668,48 +667,48 @@ static void bonito_pci_realize(PCIDevice *dev, Error = **errp) /* set the north bridge register mapping */ memory_region_init_io(&s->iomem, OBJECT(s), &bonito_ops, s, "north-bridge-register", BONITO_INTERNAL_REG_SIZ= E); - sysbus_init_mmio(sysbus, &s->iomem); - sysbus_mmio_map(sysbus, 0, BONITO_INTERNAL_REG_BASE); + memory_region_add_subregion(get_system_memory(), BONITO_INTERNAL_REG_B= ASE, + &s->iomem); =20 /* set the north bridge pci configure mapping */ memory_region_init_io(&phb->conf_mem, OBJECT(s), &bonito_pciconf_ops, = s, "north-bridge-pci-config", BONITO_PCICONFIG_SIZE= ); - sysbus_init_mmio(sysbus, &phb->conf_mem); - sysbus_mmio_map(sysbus, 1, BONITO_PCICONFIG_BASE); + memory_region_add_subregion(get_system_memory(), BONITO_PCICONFIG_BASE, + &phb->conf_mem); =20 /* set the south bridge pci configure mapping */ memory_region_init_io(&phb->data_mem, OBJECT(s), &bonito_spciconf_ops,= s, "south-bridge-pci-config", BONITO_SPCICONFIG_SIZ= E); - sysbus_init_mmio(sysbus, &phb->data_mem); - sysbus_mmio_map(sysbus, 2, BONITO_SPCICONFIG_BASE); + memory_region_add_subregion(get_system_memory(), BONITO_SPCICONFIG_BAS= E, + &phb->data_mem); =20 create_unimplemented_device("bonito", BONITO_REG_BASE, BONITO_REG_SIZE= ); =20 memory_region_init_io(&s->iomem_ldma, OBJECT(s), &bonito_ldma_ops, s, "ldma", 0x100); - sysbus_init_mmio(sysbus, &s->iomem_ldma); - sysbus_mmio_map(sysbus, 3, 0x1fe00200); + memory_region_add_subregion(get_system_memory(), 0x1fe00200, + &s->iomem_ldma); =20 /* PCI copier */ memory_region_init_io(&s->iomem_cop, OBJECT(s), &bonito_cop_ops, s, "cop", 0x100); - sysbus_init_mmio(sysbus, &s->iomem_cop); - sysbus_mmio_map(sysbus, 4, 0x1fe00300); + memory_region_add_subregion(get_system_memory(), 0x1fe00300, + &s->iomem_cop); =20 create_unimplemented_device("ROMCS", BONITO_FLASH_BASE, 60 * MiB); =20 /* Map PCI IO Space 0x1fd0 0000 - 0x1fd1 0000 */ memory_region_init_alias(&s->bonito_pciio, OBJECT(s), "isa_mmio", get_system_io(), 0, BONITO_PCIIO_SIZE); - sysbus_init_mmio(sysbus, &s->bonito_pciio); - sysbus_mmio_map(sysbus, 5, BONITO_PCIIO_BASE); + memory_region_add_subregion(get_system_memory(), BONITO_PCIIO_BASE, + &s->bonito_pciio); =20 /* add pci local io mapping */ =20 memory_region_init_alias(&s->bonito_localio, OBJECT(s), "IOCS[0]", get_system_io(), 0, 256 * KiB); - sysbus_init_mmio(sysbus, &s->bonito_localio); - sysbus_mmio_map(sysbus, 6, BONITO_DEV_BASE); + memory_region_add_subregion(get_system_memory(), BONITO_DEV_BASE, + &s->bonito_localio); create_unimplemented_device("IOCS[1]", BONITO_DEV_BASE + 1 * 256 * KiB, 256 * KiB); create_unimplemented_device("IOCS[2]", BONITO_DEV_BASE + 2 * 256 * KiB, --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638452; cv=none; d=zohomail.com; s=zohoarc; b=NrAicwT9GRsaThaa+C/tcha3juFUFQotMeQgD6B4JpTe2GHYkT/voi81QB0HKJQl7+5mA+xO4KcKPumBUzXMZgj5X1aUndd1eaU1ucaog5Cqn7RW57flUbnmosTzpmGZnXFT/kkUFLm/dYO9oM3L/IQMSmlXFuRvJMnfBQDOQUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638452; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4BhH2UDoy2g409CWMZ269iEOOSKpvxQS8Grq3jMtP+0=; b=Ar9Xt2fbhrE7wCxHgk23QTMRGS7PTmXTZj8pDYCzEmXiY1GJN+yGq9gIpKVW+mc/yWb/wAzvX9COKpZB7Dp99K7Tpnp4AojIt+KM7ysPAcXw9LM1lnHEYOx3GsgZcE938otCuZub1UJ5DMGcj6TsnZKsMuj0O9xXUKp1uQdi79U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638452236989.5523519515493; Wed, 18 Oct 2023 07:14:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7I1-0007GF-Mh; Wed, 18 Oct 2023 10:12:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7I0-0007CL-4b for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:48 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7Hx-0004re-Fq for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:47 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-507b9408c61so3261582e87.0 for ; Wed, 18 Oct 2023 07:12:45 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id p4-20020a170906b20400b009c7518b131dsm1046127ejz.196.2023.10.18.07.12.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638363; x=1698243163; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4BhH2UDoy2g409CWMZ269iEOOSKpvxQS8Grq3jMtP+0=; b=D6h/oXSi/2L6NwPWT9G6O3IjvkMmmvh2AYXXS0UFHeahlOnL7jecYyfQ4XhLRf+wiM ofg4wuo/oi6wYjEqH0VsN1R4E0jhN0QKa38BrqW6cMCXNM2sSewRs+Qy6tPZPaejoDWk XXGNRe0FIFyqS2zju1E2G2juZwPXl/Cds1AzyF/4eWQE/nQMC4579CuEW2pqFyqpoalm WoQv/v6WIcYObJ8lczL3l8k16NREwl4ZFCcHGoKk01KFmH1HvYvc//ZhF+22ED0W/s9l JrNfvteL2K422jjJogKk2FAslgevueGo9KH/uEY+dFeRQCBTQU93q/2cXPop8KGtT731 Khcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638363; x=1698243163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4BhH2UDoy2g409CWMZ269iEOOSKpvxQS8Grq3jMtP+0=; b=df+hAST8Hrgo72eXb7rxJEYAKj2B8al9Zgff1glduowPNW5elmBXsTNW3D/uC1JwAG 9dzj9tdYH9Cb2kcbldYZtzQQQU1w/CNB3HjoReVZXwUC+2bjV/pQaxQI73jIFxzlG/3y Wnj28B/4ar6ZDgJOUYX9SUJdDcfAb9gzRclhj2EsYKUpPptGXbT+9ZVgiZ8m9PqbXZcv 722zoZv91TjDdaxYYp3UB1lUL2cmQ5dUBiB4qf/yupDv83cKxfL6F9KNZt2IES8HKx/L 22XJ+CjJ7sLoyU2vrx33wlzWvqr6h+kwoUZkJelnPhumeqa9NekgvyXXh+6QcKkNz6cq K/vA== X-Gm-Message-State: AOJu0Yz9Kw+0pNl11Q/CZd30q6mvIFuFlvJtzMpLI1dX7mvkvyiAQrGD RNsPTOs034H6xcM050fBLTC3jTbbbRg6j+6WrvM= X-Google-Smtp-Source: AGHT+IGQeDdB/cQFMWJB2rmqEUa17OqthMWMf+usbLT/S4HNJ93X+GPhMOqByh+BDGA30rlVN2JdeQ== X-Received: by 2002:a05:6512:73:b0:505:79f2:5c6c with SMTP id i19-20020a056512007300b0050579f25c6cmr3668824lfo.6.1697638363554; Wed, 18 Oct 2023 07:12:43 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 06/12] hw/acpi: Realize ACPI_GED sysbus device before accessing it Date: Wed, 18 Oct 2023 16:11:44 +0200 Message-ID: <20231018141151.87466-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=philmd@linaro.org; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638452973100005 sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- hw/arm/virt.c | 3 +-- hw/i386/microvm.c | 2 +- hw/loongarch/virt.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 15e74249f9..02c7a7ff3c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -647,13 +647,12 @@ static inline DeviceState *create_acpi_ged(VirtMachin= eState *vms) =20 dev =3D qdev_new(TYPE_ACPI_GED); qdev_prop_set_uint32(dev, "ged-event", event); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_ACPI_GED].bas= e); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, vms->memmap[VIRT_PCDIMM_ACPI].= base); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(vms->gic, = irq)); =20 - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - return dev; } =20 diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index b9c93039e2..ca55aecc3b 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -206,12 +206,12 @@ static void microvm_devices_init(MicrovmMachineState = *mms) if (x86_machine_is_acpi_enabled(x86ms)) { DeviceState *dev =3D qdev_new(TYPE_ACPI_GED); qdev_prop_set_uint32(dev, "ged-event", ACPI_GED_PWR_DOWN_EVT); + sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, GED_MMIO_BASE); /* sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, GED_MMIO_BASE_MEMHP); */ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, GED_MMIO_BASE_REGS); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, x86ms->gsi[GED_MMIO_IRQ]); - sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); x86ms->acpi_dev =3D HOTPLUG_HANDLER(dev); } =20 diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 2952fe452e..4b7dc67a2d 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -412,6 +412,7 @@ static DeviceState *create_acpi_ged(DeviceState *pch_pi= c, LoongArchMachineState } dev =3D qdev_new(TYPE_ACPI_GED); qdev_prop_set_uint32(dev, "ged-event", event); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 /* ged event */ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, VIRT_GED_EVT_ADDR); @@ -422,7 +423,6 @@ static DeviceState *create_acpi_ged(DeviceState *pch_pi= c, LoongArchMachineState =20 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(pch_pic, VIRT_SCI_IRQ - VIRT_GSI_B= ASE)); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); return dev; } =20 --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638470; cv=none; d=zohomail.com; s=zohoarc; b=HJWdTCz2rMywpqiK04HFR55+hXVlmoSl34x3wl9DClZ6Hd9h+s7rySN2lkbbrLjjbgkDSrdOYD2r+H5q0vqITl3jyk6uzajE1ZYclyuSuKU//oGRV0aPXTHLm/NpnmSNYnoYhEIAf0+tTCsikY7v9hDAy8r5zO9wxpJ8vp8cLIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638470; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HkmiVBp/zutORpRQJRGohvqORFK1Jt4bFBInADm6Rqg=; b=FyZXNYEuBoiKMS1aAsQJT20rAInX7W7aYxPPYvPMngNIYAwF/h+5Xxnfh7aZfX7mNtI4f6V9Qpm9g6DnL5lX699YS7AS9PcWiFv/lI3LZ22o19b9CnYOVaq471D9PDacxQ7+tWqxEGXnvrBkcI2ly1tOQ/PLPXQCWEWHHeF9y6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638470256238.85342645270123; Wed, 18 Oct 2023 07:14:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7IA-00088d-IG; Wed, 18 Oct 2023 10:12:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7I8-0007tq-NO for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:56 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7I6-0004sO-I9 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:12:56 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-99de884ad25so1112145566b.3 for ; Wed, 18 Oct 2023 07:12:53 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id o9-20020a170906358900b009ae587ce128sm1704610ejb.216.2023.10.18.07.12.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638371; x=1698243171; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HkmiVBp/zutORpRQJRGohvqORFK1Jt4bFBInADm6Rqg=; b=KtoBNDHzjLh/xScZkQ9Q2ifN78dNENGoqdZ9k3Ii858DEwmn+Y3suyCZATcX1m304m rUfLwPsUiVdWufCOF4rEdk3LOWaTzJQ6CBDSvr+v+O2+HkVibNFLjqKCpaYifUiqUAxC o08JhLs5YW+qtXWU3YuXSL46wHb7LL0Nqf2+2MfjZaECrRk2BgVmTjvU9C+M7u+PXdYk gmwCq8FyUfdB2ljjVR1ehtymzHB+gb/izQfSjgtWu8oBTpVD3WLAS9s/oNLhtJJuuYcm tnmnY230tMSBQ6CABR6VeFXU5KyIO6+RDJu4lbYWi6xUYHGYdT+H1tAG8Cy3UFA23Y/O 03sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638371; x=1698243171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HkmiVBp/zutORpRQJRGohvqORFK1Jt4bFBInADm6Rqg=; b=Hzuvayl4PQeeYfxufqGxgRjPk1k7WxLgGC/TM9FBZUmpaKtIKFfr6QuxqQssBjVJHc bDIwCqOUDOLbO0j93cADipv+N90BPLJJdDHIII13r+Qme4mkPW1yqmQT6yu0TMdKsRTl CPkGDWWR0zRTyRWOzeDnjQzwmwdSAjaD2qeWY3jm86ZsWyHRE06i5MwNj84pXeq8SOm1 CqCSLOctRHWmdhRKFcgnCz1jBcPA04sITxXPejjN2zGj1tHj+601jolul4lcwflyTFZv ZxJmTV/P0lWZdHdCQzZwJTsoCs7Oh4ph8MeiE0BUQ5a+2O2oc7zCfMtiF+kS00BiiDA4 jabw== X-Gm-Message-State: AOJu0Yz3qHAXvEA/YTJZ5jAOmEhLuhKtcTkT3kYpAYQsqbLB6hm5OT9j FVM3BWdtgLmxJdrreMlsrlTuVbAQdxFTpMpqEsY= X-Google-Smtp-Source: AGHT+IEl2ckZ7vQxPuRronT67dLSdRZ06scBCTpUl9TjeFQL39UZitRWISrKRy2a6ljzgSB81ztHWQ== X-Received: by 2002:a17:907:6ea8:b0:9bd:a063:39d2 with SMTP id sh40-20020a1709076ea800b009bda06339d2mr4943796ejc.16.1697638371529; Wed, 18 Oct 2023 07:12:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 07/12] hw/arm/virt: Realize ARM_GICV2M sysbus device before accessing it Date: Wed, 18 Oct 2023 16:11:45 +0200 Message-ID: <20231018141151.87466-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638471173100001 sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- hw/arm/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 02c7a7ff3c..5b08a98f07 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -690,10 +690,10 @@ static void create_v2m(VirtMachineState *vms) DeviceState *dev; =20 dev =3D qdev_new("arm-gicv2m"); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_GIC_V2M].base= ); qdev_prop_set_uint32(dev, "base-spi", irq); qdev_prop_set_uint32(dev, "num-spi", NUM_GICV2M_SPIS); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_GIC_V2M].base= ); =20 for (i =3D 0; i < NUM_GICV2M_SPIS; i++) { sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638425; cv=none; d=zohomail.com; s=zohoarc; b=QPymTRD9KUOG3MylqGKlr8EijH2tGXnYtY41BSxUQQf96ko6gVIBt9mvpaY8IX5jlKQjjPjbKgf8uC92WdJTRTwXctEG/4eNy4MO/GntKW4g77DsmzM43g4CYSrXJ2nitpUr4doKozNXs8Z/NcsrAGjZIv1E3RbZNVg9OdMMvuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638425; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZILeqkGygukHiY0i/7/5ShUVzUpektIiLzkPM1b17vA=; b=eqCMxSXZxTo3vOrnWKt6YJ5nxSuC1kQLMKCq6fb9pduaSCS75XJ6uzwC9NBrY9RkUz/36ldtXfgXGajSFFDN/Aq7WlpCCCII0TvVa2D/iALBQt7PE4twn9nGX4eA8RrdQtelFL9RtzB2DNCBJqUtRK07Nqs5HQzf0/b/QjgRI5c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638425296738.7175383787458; Wed, 18 Oct 2023 07:13:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7IH-00005S-6B; Wed, 18 Oct 2023 10:13:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7IF-0008NQ-Ck for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:03 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7ID-0004tJ-Pd for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:03 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-53dfc28a2afso11718461a12.1 for ; Wed, 18 Oct 2023 07:13:01 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id me8-20020a170906aec800b009928b4e3b9fsm1773362ejb.114.2023.10.18.07.12.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638379; x=1698243179; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZILeqkGygukHiY0i/7/5ShUVzUpektIiLzkPM1b17vA=; b=GkvykVO/tpHPvHE39Kpi/Oa26nVqZBjh0pXar1Fe2u5CtkYEPfAUmQhV/sKMxzMMbE AwncAyRQ+utZ6TRkm7B0OwFZs+RMGHDBa4bah5atk6XMLalzA1rC+fEu6b/GK+6CO4Sa oiXEsHxFL7no8m9UIj2Wy2yogukyESlDajKRoPMg1nOISR0z7RMhx8EE4r9JnjvgX9Q7 rJ0Um92lT2ZN6TW++r6jK/f0rfiKQkrVrKOmkqE/bNnaH3ADZgCalwO9haLe5R4eHjPy LlrrNCt0p9At7ybG+K5GWSiAbcBcK4jhJs3lhZC1cUv28s4zefnKlZPuZJDa2W7Lkvch KzTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638379; x=1698243179; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZILeqkGygukHiY0i/7/5ShUVzUpektIiLzkPM1b17vA=; b=X/Mrk8oQLVGxfhGQo5UV5C/Y9xY+w8ymkEyuRugXJdLVONQD7n5Fz2FPOHovOfkeBK bqYxtwnQYcIKKNeFRdxbxP5n5mVAvFYMH0wf0y70/mK0MMzhaajglh/NFYaaTJuuHfwB PV6RiurGuS7Axgu2NW03fX5x3gPItQCbUxj/Ahpjr47p6OALGoRLvgvRpfmMAlZjjaU8 QXIT6oSg0YsTJxnDKxNLHkTaF2V3hLpgO+n8OVITnhfvk29VpBV2/gqp6u2ho8Iy2GfK 8MUIeP8rvdOt2oLozPeav1uYNhqYhFZRPla0vXEnfauUeJblkdF9NSNUkDpz9C2EQNUb hFXg== X-Gm-Message-State: AOJu0YyBRDG9s2LrfcfMWBgwjH6axKbQioRzj+RIOLaNkuckMIBnMb9z 9lhZfTZrups2NAsLbI2fy8b5ZJYhDH3K1ljiyw0= X-Google-Smtp-Source: AGHT+IEW66Yc9NUizlK38UliDOpJLfQ0tfDVH9jsBsCmZlBTOOHR3JKdFzEM6HD+/x3NMB0x3GjLKA== X-Received: by 2002:a17:907:983:b0:9c5:844f:a7f4 with SMTP id bf3-20020a170907098300b009c5844fa7f4mr4019629ejc.35.1697638379616; Wed, 18 Oct 2023 07:12:59 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 08/12] hw/isa: Realize ISA BUS sysbus device before accessing it Date: Wed, 18 Oct 2023 16:11:46 +0200 Message-ID: <20231018141151.87466-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638426917100001 sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin --- hw/isa/isa-bus.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index a289eccfb1..f1e0f14007 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -52,18 +52,25 @@ static const TypeInfo isa_bus_info =3D { ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space, MemoryRegion *address_space_io, Error **errp) { + DeviceState *bridge =3D NULL; + if (isabus) { error_setg(errp, "Can't create a second ISA bus"); return NULL; } if (!dev) { - dev =3D qdev_new("isabus-bridge"); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + bridge =3D qdev_new("isabus-bridge"); + dev =3D bridge; } =20 isabus =3D ISA_BUS(qbus_new(TYPE_ISA_BUS, dev, NULL)); isabus->address_space =3D address_space; isabus->address_space_io =3D address_space_io; + + if (bridge) { + sysbus_realize_and_unref(SYS_BUS_DEVICE(bridge), &error_fatal); + } + return isabus; } =20 --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638464; cv=none; d=zohomail.com; s=zohoarc; b=DBvfWLGHWgtJh2hlivkPBAfnqmsJr3v2vRT7JrPr0nTYXgypAdNNrXJw99uv9fS8M46oi+BeU0xDyT9iB2KMF84fzCFYiBQmL/GeYf9dsuNXbRV70a0uwvay5vXK9dJD3zT5Sa4SkWr+un9rWdan/m4IN47+lKVbURiTDuIg0D8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638464; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5QjYWheBMzRDx+1pua16/AosP+NmrpkNMedodm6UtRk=; b=EW2/aFfWKp0nzeuzBS8/WSSP/Km/jxYvX3t4UC9cQLDXilvlxE0KqhBLLwArtsZbCoo4di31r/7Rw4O4Xew6pC1ZwVw9zAEMWSLjsj0sg9TKXSP92pRbmlk2BXZSJvkMvn1/svflkJ07YlrfczEbPHVpC+bYMtKnutyIVp6Ju8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638464132405.69374781659303; Wed, 18 Oct 2023 07:14:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7IQ-0000cF-H7; Wed, 18 Oct 2023 10:13:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7IO-0000Y2-7a for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:12 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7IL-0004u9-Ow for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:11 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-9adb9fa7200so1435695366b.0 for ; Wed, 18 Oct 2023 07:13:09 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id fi10-20020a170906da0a00b0098669cc16b2sm1753999ejb.83.2023.10.18.07.13.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:13:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638387; x=1698243187; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5QjYWheBMzRDx+1pua16/AosP+NmrpkNMedodm6UtRk=; b=di3V6BbdVruqxTchq4NR9tUEEqcWl6eQgprs6b5/8dCF5QTUt5LNOOPtb7acxhVDQ7 6O3Jw/laLyBrjvX00bos53GPOvbOop/aigO+rvkrZu8NJow1uc1TOUAzoxntrh5/tpVS At41nmiHIVbjtOv2bbSUw7IHcAVXjGXiT0w5MrN8lMwKR/FZl8bjHGH010KntQBAfFpg ZeEzxojJcZd8h/8bZik19prC9Yk4s5aOxvYog2JkcQzwvwmtQaLnNQK/etUf/3s5OoMy U2pfS0J+Y4LNcQzi611GhoFqWezKJMnAZdGWpk8VbTyuIz7iY9O5kEC/pVO0HGB5Y417 XAVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638387; x=1698243187; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5QjYWheBMzRDx+1pua16/AosP+NmrpkNMedodm6UtRk=; b=Rt7gD3QopXERVoDGJF7k2bwTtEPiwYioEuRcfZI5uMSqiLsUeastuQjW9s3Jvn2iIg 3M3NDeShLr9bhve5ggGpB9OYkl1MKZOH4z8mSbJRNG5ZMoImZ4X+xYvy8WYQvQ64JTpC xGyEhEiZN76mgRe2JDSE5gRP5oHHNP+FW0Czasol0h/nksJm8ieDZwLBOZO+W/hYhHSV C4Aut/Q4nyScXpF+VrpxczEyf1gQXopoBlYszQX409gAb1hH0KURILrpyID+HPyWSZPA uaF+APAkvYx09emtNqwbOcD49O/YOmtHtD/XE4kO6qa7ODlpoUh5AFxuSCqS4k4AnQDQ hQOw== X-Gm-Message-State: AOJu0YzWTsmZlFBclXzQisc/rbv96Qh/xEWLj1IxpCNzzoNZ8+VVA/dJ tIW3NNGd3edDfyQ3IPzvCN9uqByIACw0gonjIJw= X-Google-Smtp-Source: AGHT+IGjlTWHpCOMT0QFUjuIGmJMfOY/C6d5YoCal4txOEFUGOMZeulJD8ipLal8AWH4HNNr9d+Npg== X-Received: by 2002:a17:907:86ac:b0:9ad:8641:e91b with SMTP id qa44-20020a17090786ac00b009ad8641e91bmr4831802ejc.11.1697638387711; Wed, 18 Oct 2023 07:13:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 09/12] hw/s390x/css-bridge: Realize sysbus device before accessing it Date: Wed, 18 Oct 2023 16:11:47 +0200 Message-ID: <20231018141151.87466-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638465034100001 sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin --- hw/s390x/css-bridge.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/s390x/css-bridge.c b/hw/s390x/css-bridge.c index 4017081d49..15d26efc95 100644 --- a/hw/s390x/css-bridge.c +++ b/hw/s390x/css-bridge.c @@ -95,7 +95,6 @@ static const TypeInfo virtual_css_bus_info =3D { =20 VirtualCssBus *virtual_css_bus_init(void) { - VirtualCssBus *cbus; BusState *bus; DeviceState *dev; =20 @@ -103,19 +102,19 @@ VirtualCssBus *virtual_css_bus_init(void) dev =3D qdev_new(TYPE_VIRTUAL_CSS_BRIDGE); object_property_add_child(qdev_get_machine(), TYPE_VIRTUAL_CSS_BRIDGE, OBJECT(dev)); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 /* Create bus on bridge device */ bus =3D qbus_new(TYPE_VIRTUAL_CSS_BUS, dev, "virtual-css"); - cbus =3D VIRTUAL_CSS_BUS(bus); =20 /* Enable hotplugging */ qbus_set_hotplug_handler(bus, OBJECT(dev)); =20 + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + css_register_io_adapters(CSS_IO_ADAPTER_VIRTIO, true, false, 0, &error_abort); =20 - return cbus; + return VIRTUAL_CSS_BUS(bus); } =20 /***************** Virtual-css Bus Bridge Device ********************/ --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638430; cv=none; d=zohomail.com; s=zohoarc; b=h4WIOxapZX+Uk98s9T8oHYIzN18h4VgFnySVEBiBbGQejspF3feL2GUELJoJgtOR3eDLaOhTUvCji29sXc4EUh17uroNdiGRiviyIHt3nHJiCAFXaP4LduYO3Za3OEBt+CM9ShFJ9FRtvFCVsOQncxVhL2MslwSZOP1sjQkEfKs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638430; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HdVcxCWktT39vzMZdxBJ8XXhyBvhi+GxO2un0WHgbj0=; b=ec+4eXiHtkvXozxLBRsoEdO3OVxnH3o07sCUp+P3OllCXWUG9cAyMOqdhsiqLVwfP1dx03xO3jZc/suRO3YOSxE0MlAAUveD93HVgj/p+71BT9wbbH6yRAHqjPwaTK1O1GZHEGYYIh9sDD3k4D82a6XCenU9JjhDqdUh41yZifs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169763843008582.64591679717023; Wed, 18 Oct 2023 07:13:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7Ib-0001SI-7A; Wed, 18 Oct 2023 10:13:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7IY-00010d-VQ for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:22 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7IT-0004uw-E9 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:22 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-50797cf5b69so7074374e87.2 for ; Wed, 18 Oct 2023 07:13:16 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id s23-20020a50d497000000b0053dfd3519f4sm2933046edi.22.2023.10.18.07.13.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638395; x=1698243195; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HdVcxCWktT39vzMZdxBJ8XXhyBvhi+GxO2un0WHgbj0=; b=N7gxpKTjgD05fXEbaT1N6TVkXMRa3HHGW9Dcx4ZtDMuHct1IywVCHDBDdFkkpVAzOd X8G6j9+qYOt4I1Sw/jM/bgkMAUVR/y3WEYNUt+sv6LH/XnswXaJcCp49ZkMxwrWM7hV4 WPgOzJCW1YW9OzGyMDUTa4sQ9S0vnP5kDjQqwHkYlTo05TU6zm5PER3G5MEvYG4Cng7M etDIn+0qNXHwXwZHTt8lVQiZKkMeqBaVqc5BXOeEjvlqsvVmbv8JBs4ATo++w/Mr3xSL vmI7mz9bkgMmhvIP5Cyd5g+0237gmDoHc0TDmRd37lGHFdowqYDPBhv4LA/aX8LmbnHR Hj9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638395; x=1698243195; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HdVcxCWktT39vzMZdxBJ8XXhyBvhi+GxO2un0WHgbj0=; b=SVTdohCp9gzikZtxRes4AZF0qV4puH6OBYvpXi18Ymn2OOsBsOTXHOMIx4bQ1ENmqP jRNs6I/7dRpmCLpXA9JI3pnR2T4/6ugJJrXXTD9XKK6JMn0CtHuxyw2Q1zzF9AbhRVI2 bJFxTfMXpC6w6UyjacFVJ0tT5t6iz979GUyWOriMj9ZQvxcXvocVbcX73iT4pK6H0hEV AvDl4Zl/0I200l2y2qRPzcbEFKChBVTOjmBAfIcD9unh0/W63yDODVEUJac9Zju0iuJ1 6+FIjU8X9vl3uvODS0wFC/m0OK0JxO6NrPEEMUc8SjD0bHq9teV4tv1diugqTxGzoKiF ARTw== X-Gm-Message-State: AOJu0YyWut6FLDpiaRSPJPPRL8KPfSrtfzNIbWdT5+Flvf2e3RZhsRwD bttr1Cs25+MdqKfX0FqW48CtdV/saTLx1auKMQw= X-Google-Smtp-Source: AGHT+IE8xPSrZq7CBsw2bMWAkHoT7sqvlumWoOpWRK3y5mGvkqfIzUK09Dz2IHSV0PFECHL6gQUZTw== X-Received: by 2002:a19:7503:0:b0:503:38fe:4598 with SMTP id y3-20020a197503000000b0050338fe4598mr4328425lfe.64.1697638395402; Wed, 18 Oct 2023 07:13:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 10/12] hw/qdev: Ensure parent device is not realized before adding bus Date: Wed, 18 Oct 2023 16:11:48 +0200 Message-ID: <20231018141151.87466-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638430874100008 qbus_new() should not be called on realized device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- hw/core/bus.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/core/bus.c b/hw/core/bus.c index c7831b5293..c92d07667b 100644 --- a/hw/core/bus.c +++ b/hw/core/bus.c @@ -21,6 +21,7 @@ #include "hw/qdev-properties.h" #include "qemu/ctype.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "qapi/error.h" =20 void qbus_set_hotplug_handler(BusState *bus, Object *handler) @@ -163,6 +164,12 @@ BusState *qbus_new(const char *typename, DeviceState *= parent, const char *name) { BusState *bus; =20 + if (parent->realized) { + error_report("qbus_new(type:%s parent:%s, name:%s) but parent real= ized", + typename, object_get_typename(OBJECT(parent)), name); + abort(); + } + bus =3D BUS(object_new(typename)); qbus_init_internal(bus, parent, name); =20 --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638428; cv=none; d=zohomail.com; s=zohoarc; b=GcjjF68uGLQ8jAQHsBi4k3lQdY6uemHRYpEqDtgovuenxxxijZA4tDm8/0bBclHfiTqcaY3SLevhLb4RRm10qgBAO60vC/qpEPJmAE6Pq81OVjM9tVtflLSgUMdeVF7mUItHOL3+Z8hiyIHbfyIMkvF1p3+pR+UvEu7oOPDF1EM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638428; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H6bLxBklXqCA6pp1eqkZHUbqa8cn5QQGHgcnGcbF5xE=; b=JxvGh0XhFFFUBtqs+n0fT3sai38Yf9kf2k2nxD88mX6weHWN328NgDfvB9e+k/lSnX8UsRFiPU9py/60kFQCF3Z3DGNAyoT91z2xZAvGNw18tVa1/GFDzqP8KZuGmwpUccX1O5J12QzoeCExfVC6Gq7w93IuGi+KyDoJLGs0c5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638428700754.5233976303307; Wed, 18 Oct 2023 07:13:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7Ig-0002OR-Te; Wed, 18 Oct 2023 10:13:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7Ie-00020C-Ce for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:28 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7Ib-0004xI-LJ for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:28 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9bda758748eso822338566b.2 for ; Wed, 18 Oct 2023 07:13:25 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id j14-20020a170906104e00b009c5c5c2c5a4sm1738187ejj.219.2023.10.18.07.13.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638403; x=1698243203; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H6bLxBklXqCA6pp1eqkZHUbqa8cn5QQGHgcnGcbF5xE=; b=pr7rXlRzw/5V1Q8g12Xg/OAdV/9ZNftxz898sD/B9jJ7X6WoLormgH5nXixN+UsR6Z GIvO3XGw/YhZR5cCwhLFYMtPx3lYPsf5Ea8NYLNiz1lH2UTBpJmeRR2MaQkW7GdRWByl nv+e01OmDT9zDQa3br6Za8NN9ZT8NNK+MouAvsfQ7n5xQrS7UnjtBuuH1iuwY0epRMCE KNV7elM11EfAlp4vzL0dq3oyiZqz/XB9RZALSCKzOTQ3Jida1xZAjeVvSdJX6Kbcpx9Y gZW8QrgX1t8koH+ME19XZlQSCkTW7fvI20ZR1kBNQxpaWXp+POe73fh6TLigakgzygR/ GQ8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638403; x=1698243203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H6bLxBklXqCA6pp1eqkZHUbqa8cn5QQGHgcnGcbF5xE=; b=ZXA08am9Zk7DoyoStUV2CTBet+RPiPFHSMMUiEAbIC1KB6jy8w079M2ZS867XKWuNJ AY78LMw9T7Pq6/RjjOI7Y5PAQFKJnOJJvslvkb3E25TOaMexwN/jxKtCOGOy35gqnx17 yx7nAhp89dYkWIebqSEKrp6lNS7fwerVUqKmsa9aJcViC9N+7UAtCAdfucN8qRYM+FW8 5XJY8zwjFH9fmB2mwTMi4Fw6CNBMSkPSqF7OfmxzTrLBN6Nt910KTWzMBBM1ks17QyM3 J0nfnd0kcL0WZwrKrez6bRnB1ijrYEW5RLXvT2P0erMI6sXJDhRFux4T1cgIh9m/yMiG KTdw== X-Gm-Message-State: AOJu0YyBCK1hqiaEOdzYbfQ3eKPPBtu4dYBHBO/Ls2i/CLmnbojoPoNf OZH3duJPDbSNzYORw5qJzZx6DgL+URGdg+G3R68= X-Google-Smtp-Source: AGHT+IG/ucOvbNZk25CI+4yODJyfXOga1fSUDEHRF7sTPE9JfgKk8U9UNOU1bSXC0MxcoyckUGUOkg== X-Received: by 2002:a17:907:968c:b0:9bf:30e8:5bfd with SMTP id hd12-20020a170907968c00b009bf30e85bfdmr4613711ejc.48.1697638403486; Wed, 18 Oct 2023 07:13:23 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 11/12] hw/sysbus: Ensure device is not realized before adding MMIO region Date: Wed, 18 Oct 2023 16:11:49 +0200 Message-ID: <20231018141151.87466-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638430826100007 sysbus_init_mmio() should not be called on realized device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- hw/core/sysbus.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 35f902b582..ce54e2c416 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -192,6 +192,11 @@ void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion = *memory) int n; =20 assert(dev->num_mmio < QDEV_MAX_MMIO); + if (DEVICE(dev)->realized) { + error_report("sysbus_init_mmio(type:%s) but object is realized", + object_get_typename(OBJECT(dev))); + abort(); + } n =3D dev->num_mmio++; dev->mmio[n].addr =3D -1; dev->mmio[n].memory =3D memory; --=20 2.41.0 From nobody Wed Nov 27 17:48:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697638429; cv=none; d=zohomail.com; s=zohoarc; b=ZVf2rVyEINiWQ3zJcRigkBt4Le80rC6B3OPMDfmaPVtlnQ67lLbzt9UhcZueUawhjVWnX5kPkexe5os/PaBzHKGS+FOaunGWMkargoWAvO4bbJF+XbkdluuZrfwLOo6UTCjEBeRf84iTzVbtEU6r0ud+ecQ1pUoVnzJPQxNlMcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697638429; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=III6J63m6TXPzGkHNGeaIlMVjIpH5ItVsLY/wuEjMjM=; b=dA3OmwIjE91eEtnPkDMqJIyOhx2Rw36RL0QgU8Sj9UhTeAofADpPgjlfOpkEVWWoxJ2C/kOrYz4vyYO+c6wVRHCE3aJ631vBAL6dYmE42h1VyJUtVuffihOdk8oyI0i4r0zbP/KzIxP5ljn4SmjXiSqyB9XklcQXAFpPHrW2sPc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697638429155765.1526462377296; Wed, 18 Oct 2023 07:13:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qt7Io-00036V-26; Wed, 18 Oct 2023 10:13:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qt7Im-0002qq-F1 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:36 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qt7Ik-0004yy-KR for qemu-devel@nongnu.org; Wed, 18 Oct 2023 10:13:36 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-53e16f076b3so13148830a12.0 for ; Wed, 18 Oct 2023 07:13:34 -0700 (PDT) Received: from m1x-phil.lan (gyl59-h01-176-171-218-149.dsl.sta.abo.bbox.fr. [176.171.218.149]) by smtp.gmail.com with ESMTPSA id t3-20020a1709064f0300b009c3f1b3e988sm1734423eju.90.2023.10.18.07.13.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 18 Oct 2023 07:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697638411; x=1698243211; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=III6J63m6TXPzGkHNGeaIlMVjIpH5ItVsLY/wuEjMjM=; b=WcRJDmg5KTLuWJ+FhW+WLf2lwM8zZ7S5OCn+ylDZi2SN2LF5LLPC2QRBnIdb5FD/KA Rj1JEuVx3GVAihiK8Le+AL9WbqkIOWTEnUyHxP9wsTssX/cLAY+xvozGZdYMref/x33F +7g/rUzDGK7K1UL7fMIkb6ylwF9Var05F423cyJYDbcyjkv9nOCq0vdKZWyAaexTi9Yw ynH4z1cNH9F2yOP9yks9r9NZX/F9mTGbaAMPPbPl4B4l8AmU5Z7NYcjqusYKg/5+WIKl wJiz4lRQEvDeJSrTxhL7WQtgSLw+53M+OnfsCOtdWrFGivHp292Hr2isKJmen4sdli2q o3SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697638411; x=1698243211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=III6J63m6TXPzGkHNGeaIlMVjIpH5ItVsLY/wuEjMjM=; b=Rpasx2LDxTzh7VfoPDPUTa9YEL0pOtkto2Lr0GcgEJMfeVftZ5Z9ERyMpTiEC7Pi2C lL/GJ/2OLfcoR/Sz4g/tup1ESz3VW6Ug6fDbH0fMxWKIe7Uf+BHmFGBaxIFo0I87at5A fK+IxfGj1GZAENaDqzApCwGw42d177ueZ16AsRAJj7treKwb3I3CTJXZhz4rzG0yiYkA LUqOCIgU4wLqy40wJZUr6lTf0wOtKd5cyk+sDFWiK8xqUQSzU4KDtYmoqaQ2juGyBqTl 30XVrItllggx6qCjonVnfFOVNF8lymLyJw/w5xvAJlxrTi9A1jXJ/UdGw0T1KFeWUzTa f8mA== X-Gm-Message-State: AOJu0YwZpE/Eir0Kzm/BzS5+HgV8JB2qtLZI4FmwNctiVUqaF5HQW/jw iADscy6um82CI3mGp6P6XbcmT/b9LfmLAOZxAMs= X-Google-Smtp-Source: AGHT+IHFXVrnJjpBkzC/RyaQ86259GrscbtKPhqODfrn0Svehpjam42pT9DwSl/dNQGiOIxO9MRRLA== X-Received: by 2002:a17:907:ea1:b0:9bf:c00f:654a with SMTP id ho33-20020a1709070ea100b009bfc00f654amr4948996ejc.24.1697638411390; Wed, 18 Oct 2023 07:13:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Eric Farman , Peter Xu , "Michael S. Tsirkin" , Halil Pasic , Jiaxun Yang , Strahinja Jankovic , Eduardo Habkost , Sergio Lopez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Marcel Apfelbaum , Jason Wang , qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Ilya Leoshkevich , Song Gao , Huacai Chen , Beniamino Galvani , Christian Borntraeger , Thomas Huth , David Hildenbrand , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 12/12] hw/sysbus: Ensure device is realized before mapping it Date: Wed, 18 Oct 2023 16:11:50 +0200 Message-ID: <20231018141151.87466-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018141151.87466-1-philmd@linaro.org> References: <20231018141151.87466-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697638430874100009 sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Reviewed-by: Thomas Huth --- hw/core/sysbus.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index ce54e2c416..a46828a808 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "hw/sysbus.h" #include "monitor/monitor.h" #include "exec/address-spaces.h" @@ -132,6 +133,13 @@ static void sysbus_mmio_map_common(SysBusDevice *dev, = int n, hwaddr addr, { assert(n >=3D 0 && n < dev->num_mmio); =20 + if (!DEVICE(dev)->realized) { + error_report("sysbus_mmio_map(type:%s, index:%d, addr:0x%"HWADDR_P= RIx"," + " prio:%d) but object is not realized", + object_get_typename(OBJECT(dev)), n, addr, priority); + abort(); + } + if (dev->mmio[n].addr =3D=3D addr) { /* ??? region already mapped here. */ return; --=20 2.41.0