From patchwork Thu Oct 19 21:18:03 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: 735616 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1731103wro; Thu, 19 Oct 2023 14:23:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpcpcDKghrrPbcDr7b30ddkSWgvcpvoUpj01jl7T+dJ6rWjbIahBmwalefqwkn6BQCDorl X-Received: by 2002:a25:258c:0:b0:d9a:d78f:a007 with SMTP id l134-20020a25258c000000b00d9ad78fa007mr3540000ybl.46.1697750616329; Thu, 19 Oct 2023 14:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697750616; cv=none; d=google.com; s=arc-20160816; b=uU+z2wpThfMSdOjVaacsR01j4HLxUQJqDZNollzEBp9vjLG493qpaTLH+Kjs3jeH42 BzPajWB4sYTarB+HEFYNmvBmYzuTWQJYIvgga/qCj4BG3fD541e5YAxeuhxTbkH+HgwI HQUQ1xfSGqQ2LZIbe//pPtYeRz33t1HRNfY7ASggumsK0xAAeTNJyq0Mg2GvuGBCfIAh jOxka7prE9UsC/VvmhqmsAW+Wy3v7tiX4KMjQZn0+aF3X6b8Tijmed6N1z9zbQzC5kGO RtM2Gc426U5Mdp0ePF1LVHy5mT0vEXCGXq4rcNG4VginTCab2zTIp/a/VvWIQmAdH0Va amEQ== 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=QiDSBb1U1Y6ntpHTs6MX3TQXj3gIN80QBkiJrswp04U=; fh=/VuZmIqr4bR18HTgg1hSyedIsQzndzO0C0UCJ5egpbw=; b=E50hTx3qzuOJMq5RiUCQ+Rv9xAQDTHblMQl0kQa7SYX8hGBVtrnZLvP+iIlr48AL8Y uSKPelQVcsSpXTvsMNXX8oZ15XVFiLZCrcC4i/ZrOVQy+2r/90lHteRoOviFiCUHUjKa QKvYAtFUCWVaWdTKs7cRvnC16IMH/zo66XqYeEz7zdlhCNgnnKDKPQevESIoqsgFre72 sh4DDwANHrAQYmIGQGQmsYCQ6Xwvk3piw6NMxZa55qXZQ+GGFdm8+vqeTAJwolumg7uZ zOuB3dUrgjrl7OPh8m9SknvIk8HDNZhH3C4UqBSNJVc9u969A7NVH0A8IKx36BPhGpp2 dRQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UeTn10uh; 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 do8-20020a056214096800b0066d14432c26si347795qvb.146.2023.10.19.14.23.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2023 14:23:36 -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=UeTn10uh; 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 1qtaTU-0003qM-06; Thu, 19 Oct 2023 17:22:36 -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 1qtaTS-0003pe-VP for qemu-devel@nongnu.org; Thu, 19 Oct 2023 17:22:34 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtaTR-0000eX-8g for qemu-devel@nongnu.org; Thu, 19 Oct 2023 17:22:34 -0400 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2c5039d4e88so1766551fa.3 for ; Thu, 19 Oct 2023 14:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697750551; x=1698355351; 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=QiDSBb1U1Y6ntpHTs6MX3TQXj3gIN80QBkiJrswp04U=; b=UeTn10uhHgomNxL3kTLEuknBBuI9wRb/rnqKau1RgOeWZd+1BQZN2O2t1brhCNFVgE KfQN1/r8P97CShIb0cT2+UKfhti03Z/lSVTGXhGzLfD0PsfkDW103m93xcj2rzKcwZJi zudwgENHSEr0PH14WuLOA2GXBDNh9FJj063Ych7oUrIEWsQNuc7zCPdpUXcVl8CnAvqH jlwkhl/6+/Cb86+rnp4VdO/uQAwRph67H5XJHBGL293M4TQOrlQn4NCPVTMsxhEydObr 4NUfP+hzzUCh3y37dFk8O87WniJOoSID58NOvtti7GZHfE4KhZf06dI8jxcxyt02QT+0 r2Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697750551; x=1698355351; 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=QiDSBb1U1Y6ntpHTs6MX3TQXj3gIN80QBkiJrswp04U=; b=vDrag6GwVZfYoD5cw2WrtkrL+N5lVsGo8zjfXa7gkrUKPp3327Mi3W4kuVWjXagGSQ lUxVVHKz7OLCwCJyKNSy3AMW256b/Q6zB/SWC/PzqB38PPhm+K//VaipiB19NWnBcYan tXwFjxpkJjV+9Lc3S8fj6O5Ca12N4YgSx/PZ7cyuA+6rRi4I4++Bpnn/DIji9Co+xaaa nB/xUBNY9Sn4cKwayW/UEI0IkOTUEO21B0gXVU8v0Gm/ozodB5dZ2Zc0d5gQD/I5X8c1 GrcIqnsc4PxY3ckw+11PNbQ1aRy1TYgdxOdDTx+ciUsLxAZPaynatc9glspANqSranCm 1bUQ== X-Gm-Message-State: AOJu0Yzt+GcE9EBYMPITEw+xCPyd3pYo5Cn4cJjkG4UBO09gy577lhXy 9fKjidFYXrp3/WVxIWiiFOx7KTpu75ydlsWCLz5UXw== X-Received: by 2002:a05:651c:1a29:b0:2b9:ee3e:2412 with SMTP id by41-20020a05651c1a2900b002b9ee3e2412mr122813ljb.22.1697750551506; Thu, 19 Oct 2023 14:22:31 -0700 (PDT) Received: from m1x-phil.lan (176-131-216-177.abo.bbox.fr. [176.131.216.177]) by smtp.gmail.com with ESMTPSA id r9-20020a05600c158900b0040776008abdsm508640wmf.40.2023.10.19.14.22.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Oct 2023 14:22:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S . Tsirkin" Subject: [PULL 38/46] hw/isa: Realize ISA bridge device before accessing it Date: Thu, 19 Oct 2023 23:18:03 +0200 Message-ID: <20231019211814.30576-39-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019211814.30576-1-philmd@linaro.org> References: <20231019211814.30576-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=philmd@linaro.org; helo=mail-lj1-x22b.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 unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Message-Id: <20231019071611.98885-9-philmd@linaro.org> --- 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; }