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: 1852131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=UeTn10uh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SBLLK3SW4z20cX for ; Fri, 20 Oct 2023 08:23:37 +1100 (AEDT) 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-Google-Smtp-Source: AGHT+IFKtY9UAbvm34SCmjInNz8CpFolg6bUU4+8eFO3q/fyY1O5B7UZtmoaqADsSCCqJrLwvtDkUA== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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; }