From patchwork Thu Oct 19 07:16:04 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: 735515 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1378188wro; Thu, 19 Oct 2023 00:18:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/tggi8bXCNwUWhPa7YtlTHPHXaeBRsdO+t6iwHGhFxVnjJ7QFQJGjFu/qKWcE3G2GRR5i X-Received: by 2002:a05:6214:cca:b0:66d:20f5:23cb with SMTP id 10-20020a0562140cca00b0066d20f523cbmr1698705qvx.5.1697699918136; Thu, 19 Oct 2023 00:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697699918; cv=none; d=google.com; s=arc-20160816; b=rhUmXYZFa3ifWTbVIUrl5F3l/cdm2ohy8swq3ATmzV8lxa3xAj4P0VR2Cq5r0HKBGW FcBDXLRMZbSIkvUYe8ItCVizXvSFtHQZaIDN1VS6C3JjVQlKS6IAm7c3bq0MmPaE9S4F f8uJnzTPRDnx3raeNg/KEFBNSH6dXa1gYLNkv9fsvfkK8AoTAlya6FI8UFwUqE7owzxz f9o3xoqkITucxSnYC5+XNIpayn1fCqqoR/HLqbB2zNsF4HfxwzYwxSUcJ44zFqKOXtUe Qeh33OZF8i0z7zlfcBzYc7ftkNkHBSpbAe8qfq/xFmRr6QzlK32YcOA6xfmAzpLQfDqc 0StA== 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=U89S9kSKuyZ/3CV61Or9NVPwfS9oQzSn+IyXDgGKbBI=; fh=6jYKO1R8PvzdW4tN+W/XYlQifBf+lht0eG+bQc5OUAg=; b=Y0FBrQnWkLAefnHJcSYpfDLvdAriWpMISzQ2hIJfwNCbpIA8p2iz48FNaZSR17lqof xk19OKdE9L1tn3W+KJk82qJwLJ99izR/tzH75CZRwE3p211VtQgngt2IWWXEvt+waYmc 2POoVvbpYnSwKGR4iuHquVin9uax99N6GcGE+6UvwM0wQMh9yOzAvYmZk8xWjk1h/zEw nBnafeqHvGZALavyN+uV2cHn2cYreq7OQ2Q9uSvI+Y8AYc3Nm03mwHA2L9lTN7XwWQiL 66pdVLDJhfxMuorbwNqzjlYe4CaHtt8uluvsTTY5Yy+s3iNcDHF5V0R/8Rc4TzMn6EEq IlMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lxAwCtZg; 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 oo25-20020a056214451900b0065ae2cc68f3si1203660qvb.387.2023.10.19.00.18.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2023 00:18:38 -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=lxAwCtZg; 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 1qtNIF-0006PC-96; Thu, 19 Oct 2023 03:18:11 -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 1qtNHW-0005bz-W3 for qemu-devel@nongnu.org; Thu, 19 Oct 2023 03:17:23 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtNHV-0003HV-3J for qemu-devel@nongnu.org; Thu, 19 Oct 2023 03:17:22 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32db188e254so3105832f8f.0 for ; Thu, 19 Oct 2023 00:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697699839; x=1698304639; 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=U89S9kSKuyZ/3CV61Or9NVPwfS9oQzSn+IyXDgGKbBI=; b=lxAwCtZgYcfK3pY1DoFeS/QZcZxNGrAS1zjJY2p0FJ1W8ebdFmEoAE1/4gEpHYt9JM q1IAkUbTr+ATcY+/acJLhPNOW8cf7xygf4KpKxBp0M7DSUM/u3G7dJ2LqUKRSTpbTxFe tO8aA2bryf/+UOL6aF8y8fKuO4LzQGJu2nZPLuDRmU0KsKDCB8JSUQBg+xJ/KVjoFcte 3O3DVa0SRtxKzwkRih/9uEV4UzeIINs/q+7CRxWl5j/af2YO6BvDPPVxYtVKuIoqjJYB Urxk05P7l3pYFhWMmXUw+/Ot8pZmI3ciyeiyblfrfoztv86X9GIwyCwtPmj7E0TLfpNH H7OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697699839; x=1698304639; 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=U89S9kSKuyZ/3CV61Or9NVPwfS9oQzSn+IyXDgGKbBI=; b=v2iXbpPGInPSar5NxLHWpoxBhcf1saJqlR40/esx7fO9m3bDmgPfY+VxMS/IHKhz3A OlnyR8OtvhKTp7XJ++seHaaccs+aBnnkOb3QgzZaNbY/+fnxnBsMgjE6dx2+HxiAZjRK UPUfbA5dLqHE/qNfHSDX3PXs4YM6h333qF4mdoM0w81G4sjbCl0rtEpfTTGsiF9ARcJ4 M8oDcCCfTcCiN++MwsB3Ay7VD3cDpZt0udN1yr786SGgQhBgkVPh5JTfjf5WD+5tTT4w It0zySg9SZS8ikAh6nhNh9ADCgJal0fkvOsZFMu3nNyTNV1hjfFp1aJiJGEv0XGtoXs1 BD9A== X-Gm-Message-State: AOJu0YyQcNv6IlAT4WvHX0/6WS59F4WMlAUkxAy9nFbD9RoedZXZeBBY lnlxY5WyzRU6//fJaRB4DNXgzRnzOgm6RuCvzNHNIw== X-Received: by 2002:adf:f50d:0:b0:32d:b114:fc96 with SMTP id q13-20020adff50d000000b0032db114fc96mr790162wro.37.1697699839316; Thu, 19 Oct 2023 00:17:19 -0700 (PDT) Received: from localhost.localdomain (92.red-88-28-12.dynamicip.rima-tde.net. [88.28.12.92]) by smtp.gmail.com with ESMTPSA id e11-20020adffd0b000000b0032dbf26e7aesm3754965wrr.65.2023.10.19.00.17.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Oct 2023 00:17:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Ilya Leoshkevich , Halil Pasic , Huacai Chen , Beniamino Galvani , Thomas Huth , Jiaxun Yang , Marcel Apfelbaum , qemu-arm@nongnu.org, Mark Cave-Ayland , Eric Farman , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-s390x@nongnu.org, Strahinja Jankovic , Richard Henderson , Markus Armbruster , Song Gao , Eduardo Habkost , Peter Xu , Sergio Lopez , Christian Borntraeger , David Hildenbrand , Peter Maydell , "Michael S. Tsirkin" , Jason Wang Subject: [PATCH v2 06/12] hw/acpi: Realize ACPI_GED sysbus device before accessing it Date: Thu, 19 Oct 2023 09:16:04 +0200 Message-ID: <20231019071611.98885-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019071611.98885-1-philmd@linaro.org> References: <20231019071611.98885-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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 Reviewed-by: Michael S. Tsirkin --- 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; }