From patchwork Wed Oct 18 14:11:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735059 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1016677wro; Wed, 18 Oct 2023 07:12:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTKIRyZyrov0zHxPgEkCvXqD4HDTdu0UMm3VF2itkKuI18Ts6ChxCafjaqR5FiOtk3kTHm X-Received: by 2002:a05:620a:470c:b0:775:9bc4:133a with SMTP id bs12-20020a05620a470c00b007759bc4133amr6208087qkb.10.1697638379126; Wed, 18 Oct 2023 07:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638379; cv=none; d=google.com; s=arc-20160816; b=hPBwtEOe7dqQi6HjGhSSZ/2aQjFkFfw7re+H5Mcr9jSbkhwgPcuKZrPbqukx9jCcVO QASOTdDqohRU+oGIXSrMexgrGGgG59gVPCOwgQVMKHy9Dy3i4Pss3+C9HKVc3/xvMjVe BwnuweFwSEPUTCGTX+9OUVnHwEN+BBK8sCcGBrHsQmmqpfhDnYRExeai7E+H8ZdZPfkn BbWzgMixLUzQl0hw+0bvebgrV6okcy95wcKz3PFiO1/dkZ/KVfdtYy0haALeaKmXr/3r l2NAONVO4YW7XUtsnZA9IYwWs4vt8VjL+eTDeGyNitiA0GofbuHBDUD5hH3iYrrpIior p21w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ehToEO0OS6e+ZoKHCVyGegzWxdjPGpE7iPcfW8fCv8Y=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=vgAw2Tbom3OZUtJWPZIJHoITz617P+31LnpipT6jRcjuaXMoGuGplEAqyuMXuKduf8 azC8iSHBxaaUP6nrKU+aoQn/VLKX+5LbMepBNeNcNv0MBERjkAqvWxILs9OOInsJVylq 3OGGkHFsxObe3KIfnZ8PVgtHbupK/y7RoaMYNWahr4YYTrmnLf2LvyTo0DgQeBAFW9pf 5UU/A9eNwVRilc/NbCMxPDrDDJMRh1PRSBae+nr9TsU2q3qz6LNMrP0Ad1//1X9EXf7F JNpnw2rjtsr0kIv9/7MRUGgbomQL6gdbYihhesc3Z64iNVPg4G1J6snz2W8tXc+3A39Z n49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PRyJI27i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id az11-20020a05620a170b00b007726499db83si2810108qkb.229.2023.10.18.07.12.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:12:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PRyJI27i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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, Error **errp) /* set up MMIO */ memory_region_init_io(&s->mmio, OBJECT(s), &mmio_mem_ops, s, "amdvi-mmio", 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); } From patchwork Wed Oct 18 14:11:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735062 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1016877wro; Wed, 18 Oct 2023 07:13:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELqI5ajyLwD9MTDE7zFK9bGPjMAYtrjS3I06pAPkVTcjPQdxVv18lqhIt5BsXsjnkNpdRQ X-Received: by 2002:ad4:5745:0:b0:66d:352e:b2ef with SMTP id q5-20020ad45745000000b0066d352eb2efmr5559697qvx.61.1697638400458; Wed, 18 Oct 2023 07:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638400; cv=none; d=google.com; s=arc-20160816; b=gdDpFJQiRmSSbCCRp4YfUwoa4/iJV6VMOLioLZHRAKoM8xpbj3Q86Prl7zTfPuSY77 lpmEEi5sHpndnAPnI49bcnCserAP/9+Ps8U+r1WDau8SPV9PmgZIrrPnIlU5TdkpLZmU MFqbcASy1MUkdngmD7Ynf30OIEFMELzpsrsd6vYJ39A4ch3F58372uDSIZmKWG96T83V bx1dWduKg6kzIe5iY5YrebLxYcbBw23wLbD7OKgjcM2BEXCmoW32UEXNohEFnlXhsWjU 4AJK8oe/G9Cqb96Ena7IrQMwuzWsDoYeUT3zVDk7GipqQwkEc4X4uTMaUVCB9KaxMr5H YZaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=poPJ+bMANM3F4WTSkIKk7d4BzsQMnyYxPL7gQ+lwFeU=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=UaijJ5kJAAGjiv05iL+4JowGuWMFprj8007Mfvy/TeuULxp/xbjD/qHm1FK8FdjEvN IrheDlcPTIPKDUx1kKgiBF1TxE39gRuWSevJL4R2O70uQ6uGfr70WaZ5KI7q933wjcGd sCF0ddEgWsdUolVQbagHlC6+Dj7qgQntWlnLPiGwOZ9IVFRycDEqhry/96FbFKeNMuxL +9MvGJ8z7p2ZN5LOFrGTE5ULEOKanCfFh2hnuV+lMBOo6RV57USGubECU5lsAuqdUls9 Ce41r9Sls2JTQXnpZL93Pv00AUAgR5A5DCjdFpH78/5p3aEFd53qrBW28apILm5lBAEQ o9gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zLjopPIi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ep8-20020a05621418e800b0065af2518773si2616234qvb.89.2023.10.18.07.13.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:13:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zLjopPIi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 **errp) 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); /* 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 **errp) 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 = g_hash_table_new_full(vtd_iotlb_hash, vtd_iotlb_equal, g_free, g_free); s->vtd_address_spaces = g_hash_table_new_full(vtd_as_hash, vtd_as_equal, 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 = vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPIC); From patchwork Wed Oct 18 14:11:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735068 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017359wro; Wed, 18 Oct 2023 07:14:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHw3A39Mq0rGEKSDylmmADtcS0NqkbjTZSUbFirmGgSEfaSq/Jvl8k84WpeJePlp8M+60Kf X-Received: by 2002:ac8:7c4e:0:b0:415:138e:d858 with SMTP id o14-20020ac87c4e000000b00415138ed858mr4842558qtv.60.1697638448230; Wed, 18 Oct 2023 07:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638448; cv=none; d=google.com; s=arc-20160816; b=SPELv4LJBUKx6u133yblAmumX7N7st7/hpOcYvUi347r5OhrF3306oe2aAYuHq+Xp2 wCGJ58HLRuH6gXSnQJMezrTd+5LLzWn5Tj2rpP3ZPVfOWlJz0ky8syMxGVxoYduS9ZWJ DS0erlF3zfV713aga/ofMOieKVn94TrauH8HcUKmwCdWBInLSwNVnST2MCu9qTOVXhkw fbyqc6TVpbvbC4Lh2VNW0CtZinCRmdaH6fWThCJ1y8yIfNb7ImnF4maw8yFIsSf2nrcR pMAlTXXWU9fB8JrnIq4PmIW/Oqs/b6hQsGoARWD6puJoc9xSUouoweq6O2Can2RwRTe7 puZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OG/eTeWn+OzUtyx8iBSPb0Amcuu5LlJ9K/x3TvIXfKM=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=D+2c7zCszl3azftfdXxAWw6CifKDlI5nnf3AjaV8ZFIrMv4T0+JFZm6/46Dm/50cKQ NU2A4dmEx2p6eRaL+3Q31mncJvLodN2AKCJ0XDOtmDpsw0R4oV3V4//XO8/hvOCvzXr3 ooZ78NQTUAu7rkWVDLMwM0YG3GxQsJGIPsqhKikZkicRwTKFBgzg3E6XIlxJ6BmMTklJ XlEE0lz6L/JBAWI6P3toIOmiuDtrnekZAIrnMpHiwNFMojDva7SND23Q6DjrA0A/yHmh gvc8MpTCl4FLrM+Zdu1SfVC35E+ki007fVqyJ9n0gHHZCOMdFMNWlo28e4l4gbL4pYUs gBqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O6XBzWAG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c17-20020a05622a059100b0041812c64665si2786213qtb.793.2023.10.18.07.14.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:14:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O6XBzWAG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 = AW_R40_DRAMC(dev); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); 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 *dev, Error **errp) exit(1); } - /* 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); /* @@ -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); } static Property allwinner_r40_dramc_properties[] = { From patchwork Wed Oct 18 14:11:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735060 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1016704wro; Wed, 18 Oct 2023 07:13:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGno/rnhO4gCpJnJcHWw+KuiIX1ITTXcorkiEK5qrkXCaOme39kTIJZ7i8opjb7BQLagO/H X-Received: by 2002:a05:622a:134c:b0:418:1bd0:fa0 with SMTP id w12-20020a05622a134c00b004181bd00fa0mr6211557qtk.51.1697638381544; Wed, 18 Oct 2023 07:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638381; cv=none; d=google.com; s=arc-20160816; b=J5misSVcb4OSXRpC84QRM6CA+cpv9xfreV3ggaMw3bNb58NqycP9v7TG/d3DBUllSS EnAeivCPqQRVXrHwlT8pDotVASz2gMA79HV2Pn5sNJ8CiOH0ehWMqrPxocVAxHazAWk/ Ftw5/U3QFP63QO4SDTXNxKIPFHuAdjD55kaJqyELMLK7lGvBYcndmGwpwmXQw2LkQ4Xa yntVJvxXXT3TnFPUEn4vcdFYnCwM68zF00j5OIOSjqBwg6CvDkd7R9d0Zs8tw7X/kJF+ oiBCCcCMCe7OMuzeUm4mcaz6iscXyTvZj8vNK+iST8CuqAJ18cgm+vy038UODXDBZoRx ZGFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U5zian4RrM8OBn3rj31JdRNyc5wh1SA22kx5TYn7Hao=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=hmhXVZtc7Kvk6fHj4gxG4vTWYZdKA6oc7+olHYZTXZ7kmfz84HWvQFvVMDWc5k2f+D FSlqtIYpdTxtww8aWnC/Ck5sLI8bws5vicZPxtSrqCQvMhOuUUbPWjfqLVKHchS+U33j 6nbsM1M9y1bKHl5iQ2vxSJo0Ajn5WkAfV8jMxAY7HR+qvdOKsWJhmJQqqWa5IfRyX6KU l9qkWOMc0VYoCFtdjsiML73Lg4+irL+ganpK8PFx4lnaJl/tGdh55t0SPuaLgRwElxAg KHlCdgJZkRSXp+8BFTbary2S3bDUL6r0Or0jrpy9OxXnnClP7LT6B31orr7hLbUfh+QQ /+SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B3URizAA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g2-20020ac87d02000000b0041cc13be9dbsi599310qtb.679.2023.10.18.07.13.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:13:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B3URizAA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 = AW_R40_DRAMC(dev); - SysBusDevice *sbd = SYS_BUS_DEVICE(dev); 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); } - /* 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); /* * We only support DRAM size up to 1G now, so prepare a high memory page - * after 1G for dualrank detect. index = 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); } static void allwinner_r40_dramc_init(Object *obj) From patchwork Wed Oct 18 14:11:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735063 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017048wro; Wed, 18 Oct 2023 07:13:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcF6anyAgTdsIMy+CKR+uVhY1XpVO8j6qhciwtxH5bK1wKywYnNZc3NGpG0hGvI+nWQ9mD X-Received: by 2002:a05:620a:44d3:b0:778:922e:fa7f with SMTP id y19-20020a05620a44d300b00778922efa7fmr2779636qkp.28.1697638415886; Wed, 18 Oct 2023 07:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638415; cv=none; d=google.com; s=arc-20160816; b=nLknLQRjeb4PYcJpBQHp2+TSvFvBJ9ASTyU5PIsqm0Eouma2Xprm09aWAStfAXKtF8 WCS0uWJDnYgDDd5k6rAo8OxlEoZZQoKbbEIkg4cZ7dof5t0uPTyN4DKKuOupwZhsFK+w NbSQhm7byUwT/jdKZZaz5Ej318JvLX7yuuu7iC3VHI0qlOzfpLczwJ8Wrnkb1wJVpa7p dUccbKRWcdW4ODAL2Wtm4YTj68c7iL8ra9rlBT3GaH+Ru0EbQpErBVfCiPCNJOyq4xlF WUoZJsvrLyCellLKk4/SAUoEfWNPTb47G5jsUasxrOGQf8Uzv0MDwsEVKuRnARHeKWcm pbQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TSfRH1Mn/Aw6tTtb5T5VxnnMQOYFdF9NNCqc+8Way/E=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=YIF5I/NpEqOb4afyzp1Snf/H8osJ29N2uiet0tX0UPyEsaIWlfi+rTvxZuL4dP/yAz qNqu7UFAhe9kSRTnic95EaJfFcvsUb41k/ZV2rsl1jyFqFHSTpAwAvY/IIYZa155Xl86 WZX1UWxU8OAStovi+7rAUOe1KypWJC/4qJny+ck07PbTpLAVkzxavR5xhh4ezlf7EVeR GdghR7sCsaErZ0Znbr9RtbUslG2IYClOEECQcgxDQ03Xbj3h4mqoyOYzXXS5zSu4f/Xz OXaKb6X9jKCuhM+1SJM0jQ1dYOSFH51MgVwzD5rEP2WMxSnwXq/MWB/8JU0kQDb78C7b B91Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lwkKHYgK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bq7-20020a05620a468700b0076d74f9006dsi2850148qkb.330.2023.10.18.07.13.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:13:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lwkKHYgK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é --- 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 = PCI_BONITO(dev); - SysBusDevice *sysbus = SYS_BUS_DEVICE(s->pcihost); PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost); BonitoState *bs = s->pcihost; MemoryRegion *pcimem_alias = 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_SIZE); - 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_BASE, + &s->iomem); /* 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); /* 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_SIZE); - sysbus_init_mmio(sysbus, &phb->data_mem); - sysbus_mmio_map(sysbus, 2, BONITO_SPCICONFIG_BASE); + memory_region_add_subregion(get_system_memory(), BONITO_SPCICONFIG_BASE, + &phb->data_mem); create_unimplemented_device("bonito", BONITO_REG_BASE, BONITO_REG_SIZE); 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); /* 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); create_unimplemented_device("ROMCS", BONITO_FLASH_BASE, 60 * MiB); /* 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); /* add pci local io mapping */ 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, From patchwork Wed Oct 18 14:11:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735069 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017403wro; Wed, 18 Oct 2023 07:14:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTg9GCkK+6mAGFHj3GXe0pN8cKIVomBXrEQ4KFuxkgZncboYD4cCwwnurQY0XRyoQtipsT X-Received: by 2002:a25:b2a4:0:b0:d9a:5476:20d7 with SMTP id k36-20020a25b2a4000000b00d9a547620d7mr5226922ybj.22.1697638451848; Wed, 18 Oct 2023 07:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638451; cv=none; d=google.com; s=arc-20160816; b=X8Btn+mKtdzFH5j/D/R5PbiAjFsRfOYMlNn5+xaIvCBsaeVVP5GSEdpK9vm/yZ2DwF /OBFiWiJy9bJyy48moQwzAE8whiZj3SE7eRSgHPPJyk1W51Ki0aDf9O0xfOzFsTdcy46 HV5aFUSZ5Nwela7RDJo+SdTRWof867kdxGORhrgEtH5dkkLQerDbwwdaRQ9tDDZVa6Xp SysZLSE+LSUts8t7sffwAsyRFLePCch8TnS5ArXOSOqdBXhkY/55izTmUye12eUvh6r3 TSizCH5mumB8VyrDGLpeP21JdWObvEHGLbBbGFvM/he8pgBTaR15kqI8ROp0lZ9RFyeR gf5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4BhH2UDoy2g409CWMZ269iEOOSKpvxQS8Grq3jMtP+0=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=xaPUByK4jxxP+Fe5PHgPqUZr7nArQdMyplOKqNdHP+JDzG6Mmgo181A3iDXUxvjwBq SXNwZjj+qruzoHHkgx4wSyX32v0aF/W0H7XW+tMUUZx4rPlzpVs9RjVncjT2ebKsiLxS babmZH0dTIwg9R5KZ3AxmxvxC8lXQDKrBhRwlOqIAieGTsDb5bTzgHoyW9zXidvDkOQa ktiQqLJW0OZq8zWem2loNlxDw7q0CE6fJc2AWrEgf/djgNQlLVKppgasHuyuU1QSOlWD KH7kkZUhvRztUI5UaPjWnQHFGAac//a2AIcDFX2UswKb3ZB1aRUttpdzfX5u0Dk1hLZ9 pHvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="D6h/oXSi"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h9-20020ac85849000000b004181b8ae8edsi2935441qth.246.2023.10.18.07.14.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:14:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="D6h/oXSi"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daudé 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(VirtMachineState *vms) dev = qdev_new(TYPE_ACPI_GED); qdev_prop_set_uint32(dev, "ged-event", event); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_ACPI_GED].base); 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)); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - return dev; } 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 = 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 = HOTPLUG_HANDLER(dev); } 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_pic, LoongArchMachineState } dev = qdev_new(TYPE_ACPI_GED); qdev_prop_set_uint32(dev, "ged-event", event); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); /* 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_pic, LoongArchMachineState sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(pch_pic, VIRT_SCI_IRQ - VIRT_GSI_BASE)); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); return dev; } From patchwork Wed Oct 18 14:11:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735071 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017574wro; Wed, 18 Oct 2023 07:14:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7XxasVhvlTyT1Mgg9T+k2DOue+eje3612IzLcfAC7FKTWuBizXj0ouVAUbeB1KAXvqjXH X-Received: by 2002:a05:6214:29e5:b0:65b:21c8:2d74 with SMTP id jv5-20020a05621429e500b0065b21c82d74mr5833761qvb.6.1697638469195; Wed, 18 Oct 2023 07:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638469; cv=none; d=google.com; s=arc-20160816; b=tJmYaDcry2yPStW+GVJ335/BR26/2srqcLUkVV8dq3Rt9G5WUghePYHkuHRsmN+UB3 F/49f6gseVHImcGeVtDwkVL3Iyl9sTv81HI+lRhXl/hMhOZ+7tckDCJncRYnMZ48oAeZ 4poiGJKhWeY6rhUhJHdxehm81YkjGUpwnJx8tq8xtchWI+gZPsSaMcMYKhctYuDznTRc tDeWHgLr4R2dvOCO9UB5o4+7uzcjiDtA3Vk40joBAhX6S+zD0JoYp7PDWCqvu7OjjgTP BcAE00Nn2ys1T2XSzbWlYy7axsbEHvZeIRkdEI+k/4Dk2TYAA8NPhhAWhIxF64u8gi8u lNCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HkmiVBp/zutORpRQJRGohvqORFK1Jt4bFBInADm6Rqg=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=TN6hZnaJMXYoRwphzvZtOd4JfckkJRR07YGuLQwuon0adaGsiKXt0kGBNM7uXMKohd 92r4zYe3BmwlhACq+SQCXMEFFodfnGAJaFZByYL2vFcWM2pVYLxcEJfRG0/FWwIHvsgj zTDe5nYaKZgOmz2peNQu3ECTHixbRZkTQhCLvEqVwjFI8RDnxtQJHWj0jz5AtcqakAFq fh5/iFelsohCdXZcCpAGlDK1l0rAziS7C/SOsuWS1fC2wWoU18zY6CrxICcZjLUZKBiD azBWqBdzTf2TBb9SknPwbwLBdeh4PdjaKIk9YxpV5bwJU/Tr3L+K4vxUCtX2G5GUlpzc K2WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KtoBNDHz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s12-20020a05620a254c00b0076cf3531349si2885243qko.760.2023.10.18.07.14.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KtoBNDHz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daudé 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; dev = 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); for (i = 0; i < NUM_GICV2M_SPIS; i++) { sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, From patchwork Wed Oct 18 14:11:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735064 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017136wro; Wed, 18 Oct 2023 07:13:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFS/fUK/AOuLScDHujECmHT6pJ8sV9BZMn5qZJIAPuCjGpw8ErZoihCKVo55qu8pTuMD9+y X-Received: by 2002:a05:620a:3188:b0:76f:6a9:18a9 with SMTP id bi8-20020a05620a318800b0076f06a918a9mr5928170qkb.28.1697638424774; Wed, 18 Oct 2023 07:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638424; cv=none; d=google.com; s=arc-20160816; b=r3ROCP9rzNqmMegFFEE07IzoSJQPQ8jNLhnWS3Q49o+G0CkHCMLSiPuX8OfwM2i5Ay MdcwI1ZadjpNQgfq85BCIiOrHMUafhcgDC+8SVkb7DuqGJhfjDYwayH/dy7e01FBq8ji E1zZRMlNzUIWRUtKeU1iZ/RgX/HkVigvVLOUhll2m1BKWsBR5kv9phLUwG2uEhiX0NBg FDzoyqct5IGpmTXeVLYrMVGEZw9L/uhJi70H2jh+4w2ugvB5RP2oU9BVJyyLCNpbdmLo cjabcuGJJaVq1MsEaWCmYLOBTSdEGJXahVw2KYu2Y8ZRuRS9KBz8hxKYMNBUIht5uJie aYpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZILeqkGygukHiY0i/7/5ShUVzUpektIiLzkPM1b17vA=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=H3H+00pZNzIdd1XIHS/C5nQYkNp/Nhv11sPmchfqxTFLdcsZYyI875LJ6qEwdbOydM f0CC+dAzvwcfzV3a6rzl3J4MZKmQ14JLDj+YD8cvhn+z0thHBiRBEJCY4b/3RRXgTFe1 nMlO5A6a9HYUYzZS+8wwhbapavK6aeMVPimuKNV4NqyPW2pD6s2lERfHoBVkfxrTUAo9 4SPa0vne+brlzpHLqQ/WgPsWhh1OECprqyVoG9O4+789VzOeWzR7xSTzl2w2Yg50suK8 6DYOXw7/xtd36tDyGwnHPMuvt8HxHfWoFlc+vHHy+v6gZx0TPoVAiG03/mZl+1wpvFaM b1+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GkvykVO/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id oq37-20020a05620a612500b0077597c8aa84si2579521qkn.599.2023.10.18.07.13.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:13:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GkvykVO/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daudé --- 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 = { ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space, MemoryRegion *address_space_io, Error **errp) { + DeviceState *bridge = NULL; + if (isabus) { error_setg(errp, "Can't create a second ISA bus"); return NULL; } if (!dev) { - dev = qdev_new("isabus-bridge"); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + bridge = qdev_new("isabus-bridge"); + dev = bridge; } isabus = ISA_BUS(qbus_new(TYPE_ISA_BUS, dev, NULL)); isabus->address_space = address_space; isabus->address_space_io = address_space_io; + + if (bridge) { + sysbus_realize_and_unref(SYS_BUS_DEVICE(bridge), &error_fatal); + } + return isabus; } From patchwork Wed Oct 18 14:11:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735070 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017533wro; Wed, 18 Oct 2023 07:14:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYzi9GCEhONc1ANYnI8LjqfU0ImmUC3s/wMn8HNk9NLWJkmN0qAuHxQyyqbhmkgIPdid9p X-Received: by 2002:a05:620a:2411:b0:765:a77c:7219 with SMTP id d17-20020a05620a241100b00765a77c7219mr6424226qkn.0.1697638463899; Wed, 18 Oct 2023 07:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638463; cv=none; d=google.com; s=arc-20160816; b=qJJx7hcc0pY+yvQuQPmniwIh+WoW4GKqXSvFBkRpSKab3/wSLnyOO0BfYL34L49gIE ODiBvE1CB3xLcVZhSrXaKXNlqRn+M0PDp9HxWny24bU/vpUjJqgH7HcPQOH+WxO4NhmR cJANgqBT1gI8AB7Goc3i3hIDRyzSEMN+lUHgQqkYuQATnituVXjiPZj5D/Z8patEVVMk Uf7q6ffDUp+wiEGJ8X2PEQM2JMd+QEqPECoHhvlRpfRhY9BD763z0f6lboW2D/3cvs1X a0sTpMPLgfwVrHD31qWoPOn/ZQFS3hdCBdEzG57+DOwkmDIFBzmDfHBtP0kd6DPDRUV4 H9fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5QjYWheBMzRDx+1pua16/AosP+NmrpkNMedodm6UtRk=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=I+cv/NV0kz2n8GL+aO0qPSr775KTF27uruefnlXc2i9JpRt8hXgJ3Ay/TTo8QVp6RJ qOhmbEEPpZfbAvmXsMZiLjEx12NHqxJMkYmWbSZ/UnO4QmSzpI8i5PfbGsRUR04krsaN QOTAqOO9GFDniTOEwfnnQCMA40pshrCzwKqlCeh1cJ3zund//fj6Fdz8J/HVvBZS7N+E NUxik/Q2ysPGbEtUeL4fIPrWxtCo3+xUXWOo4+/QXjxYhF/KhTsGFPohMmu8fM0Nz4iS QsELwNakh1H6VeK2iCwXnpVmg1CVhDN900/+TKinMQr1mskmgWN6oswMXJcaK8V6IPqQ H7Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=di3V6Bbd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h10-20020a05620a400a00b00774374a31c2si2899219qko.374.2023.10.18.07.14.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:14:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=di3V6Bbd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daudé --- 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 = { VirtualCssBus *virtual_css_bus_init(void) { - VirtualCssBus *cbus; BusState *bus; DeviceState *dev; @@ -103,19 +102,19 @@ VirtualCssBus *virtual_css_bus_init(void) dev = 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); /* Create bus on bridge device */ bus = qbus_new(TYPE_VIRTUAL_CSS_BUS, dev, "virtual-css"); - cbus = VIRTUAL_CSS_BUS(bus); /* Enable hotplugging */ qbus_set_hotplug_handler(bus, OBJECT(dev)); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + css_register_io_adapters(CSS_IO_ADAPTER_VIRTIO, true, false, 0, &error_abort); - return cbus; + return VIRTUAL_CSS_BUS(bus); } /***************** Virtual-css Bus Bridge Device ********************/ From patchwork Wed Oct 18 14:11:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735067 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017189wro; Wed, 18 Oct 2023 07:13:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrrAedN/WJoZ8Ctui3uttMoXvKv4dShNkOpc9CxW3+M0lsgWp3npNFM23xeGwXG0EL6zc1 X-Received: by 2002:a0d:c047:0:b0:5a8:72ee:463d with SMTP id b68-20020a0dc047000000b005a872ee463dmr4856281ywd.49.1697638429770; Wed, 18 Oct 2023 07:13:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638429; cv=none; d=google.com; s=arc-20160816; b=MZDFOQKFiAMq4AP+xY9MYvCZ5t35hQ43hyzTK6SDC+Xlk5zUCTOUgskydeeKZH4ZGy cAGxHjNGS8R3PzD8LbVs49tqTL+jYYFWT8Bgnma+pm5Nc5tAnWkITQl4HPXJZhpHOIkQ fvGlhxr4RQo/Nm/iitNH+r78/W8KoW+PkhGIqD8MJMk9bdAz0/K+wV/WOGKYi821YYv+ xqEcGT0ITakrLx1Ymm41Nv5nv713y38QYP/UetrJLc6MOn3ILXxG/UmHSmUkvgN3qQ2b l3Wi0UBUofUpeqRqBiNlpFX4D8v/zkfaUy0QLr9TsOsCiUoRmoystnKixjyNhIP3zJnN UYjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HdVcxCWktT39vzMZdxBJ8XXhyBvhi+GxO2un0WHgbj0=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=zXHCdWyqmukLR8vwuPhfc3pZLIVPal0sH4wdzs34ChOxIGOWxgGDD/omX6HTcC6Yya CS6k17aIQ3+m5Nw3GkD244RhOYFn2SuD4ekw1PMjdBvgLnnwyElG5KaEEB7cPpg612Gz wWoIXUQ0wHpiqCHMn4D3BNkmsLf9C6rbGYlZnWFBR/QLxkS/gz8OjChi/vLWOeYIHJm+ imNmwsgtvMIr/Drpvv3SnAzwjoOTbVtvCRtoXH2XVyJpAU+j1ywR0GeyH7l6/Tk3ApmK AOsKdzteomkFvAOEJa2B+ibf+cvtekP+13+7z/BV1l22MapMH1BMhALLUFaNDjYlTORC 4OUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N7gxpKTj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q3-20020a0ce9c3000000b0066d054257a6si2649734qvo.476.2023.10.18.07.13.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:13:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N7gxpKTj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org qbus_new() should not be called on realized device. Signed-off-by: Philippe Mathieu-Daudé 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" 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; + if (parent->realized) { + error_report("qbus_new(type:%s parent:%s, name:%s) but parent realized", + typename, object_get_typename(OBJECT(parent)), name); + abort(); + } + bus = BUS(object_new(typename)); qbus_init_internal(bus, parent, name); From patchwork Wed Oct 18 14:11:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735065 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017173wro; Wed, 18 Oct 2023 07:13:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9lNubBfG1vlcw1SQtB2RST/isPbrCwWjPbv6JH2cECty+Pkjvq7rdeAyVEdgrdYL8c3fq X-Received: by 2002:ad4:5fce:0:b0:66d:4a22:d7cd with SMTP id jq14-20020ad45fce000000b0066d4a22d7cdmr7011420qvb.60.1697638428464; Wed, 18 Oct 2023 07:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638428; cv=none; d=google.com; s=arc-20160816; b=wUKfhaVE3PcurL9p8dcqx1ozuN3leJzKuED0xECR+9y38ondu01RMd2eGmUjlMeE5v ESseflTVHmIzAfj1K2nb4uwxPvzgAA379mj+pF8Qvug+VT7Fu6RAr4zw7bZCiCharMT4 BTrMqj79bg6BQK/JDzwwXFknMojGeCDzonGJYScaaxKDHyIRDfpEWIf71yQCUCTaYwRl jGrDjZPhpIhopnM0r3VGI0zP+wWZOCrg/qLDWS+iYf0tlmzj9nf/e4MVLSMyi+SwGcs5 pu85sg0gjn3DwwvnBjyDaxVTMgXsawuhBhiClpR86S23pn40LgxssqXqi2DZhAubmqX/ IfGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H6bLxBklXqCA6pp1eqkZHUbqa8cn5QQGHgcnGcbF5xE=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=Lc+dCbxsqVHcbFtCWTJep+OwDKBsj3/qcI4xAePGSdBDX/IDvOKqt9SMAmTXIPEfTi fDS3/RWTLOZC5jIJgd3KJLmQX7RsYGW4NTGoZE6WQMlEzxFDSXObtAPqYQBR27toGXUy MWO5VLf3N+MHxHs8Fx2VXa4f1XqP1ZjimsT84RBnejFL47P9hXLmGBdqCRHVS9+BM3r6 9gFXTa60VaUt9EJ3WtxluQZDOnAiJ89Rijnn/U5UZEPuSocbHxPM+WJLkaAe4aI/qmdO FM9ItbccPqvSb3fhBSS0ELCvMkyg3ZrxR2ZryvnRWOnYrwizmwonb61IyuigOTzm+/FR Yq2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pr7rXlRz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u12-20020a0ced2c000000b00655e4826736si2608180qvq.69.2023.10.18.07.13.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pr7rXlRz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sysbus_init_mmio() should not be called on realized device. Signed-off-by: Philippe Mathieu-Daudé 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; 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 = dev->num_mmio++; dev->mmio[n].addr = -1; dev->mmio[n].memory = memory; From patchwork Wed Oct 18 14:11:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735066 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1017177wro; Wed, 18 Oct 2023 07:13:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGu2HcfHjnqFY4eNwkSKGrd+0CUK6RFoRDK1T7/QWen4Un/mUz8LG+xJH1irvguUBXScFV X-Received: by 2002:a05:620a:8398:b0:76f:5b9:3f32 with SMTP id pb24-20020a05620a839800b0076f05b93f32mr5283201qkn.19.1697638428852; Wed, 18 Oct 2023 07:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638428; cv=none; d=google.com; s=arc-20160816; b=LFJK9BI4D77mJT3eeEnNe5vWlYIIGF9JetizRXDuvIdqw7IaFe4QSqqfafbgHcDsrd hdkutHethEpcUqbA5gG/5BHNeOpPZrITGbEg6yKz5R7D+6WpZxbcqIshbnCYax8JlcQN kxqeJuaAESHosYC7MjKaJHUl4TyZAJgAYGT6keejPl8hYkxAdLFviFSUyuD7hADlTths o52iJBVcYfYrAs0swpr2YOAFF7hNDJfCK7KFiAOazGe3KAI7cWcQMTJ/byPP5O+79O2L 7mfOvG0UikJ3HQPS8hExTgsU1NIwmn+oAgqx3c58X/Hw+m/8rhSuN9Y14lthJzF3HDyY /5PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=III6J63m6TXPzGkHNGeaIlMVjIpH5ItVsLY/wuEjMjM=; fh=ANIikQnX6ADG7FYuHYnQUKFZKV9+VnxLLzGv0RFOlfg=; b=k3imiLlehlP3XGDSmGjZFpXII3myXS+hVG45zXfvkZ2lXPGUCwlPYLHgE3iTmRUKvT tal5yyRbFjQOq+pYZcfMrKeBa3b8EB8PXLRZpx51qBEhs55mj7UQ1sDfQskuEaEh8DjA 2ECNtIiJu4l5H5zFgWlqNpaRKuyjeWH+sYv3J9hhKnk+hJ4DOAJl9da+exOdXJNs5/pJ 2VZ0czjlc2yfJ7TcrBFMaTc43C8wMqAAGWL3HlYkdslUt1uyROvhj52SpRqwAZZ9Bm2k jdntexYu3QSXu76bUj8yc6mqwzVNYM+dtyn2QaEuLoUjvxdKQcSsigmotNbbLsqdtD6j tRDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WcRJDmg5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f15-20020a05620a408f00b00775b023f298si3050388qko.139.2023.10.18.07.13.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 07:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WcRJDmg5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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_Mathieu-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_P=2E_Berrang=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org sysbus_mmio_map() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daudé 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 >= 0 && n < dev->num_mmio); + if (!DEVICE(dev)->realized) { + error_report("sysbus_mmio_map(type:%s, index:%d, addr:0x%"HWADDR_PRIx"," + " prio:%d) but object is not realized", + object_get_typename(OBJECT(dev)), n, addr, priority); + abort(); + } + if (dev->mmio[n].addr == addr) { /* ??? region already mapped here. */ return;