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; }