From patchwork Wed Feb 21 21:16:02 2024 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: 774518 Delivered-To: patch@linaro.org Received: by 2002:a5d:6ac2:0:b0:33b:4db1:f5b3 with SMTP id u2csp459613wrw; Wed, 21 Feb 2024 13:19:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU29iz1D8TIxIfXT9C0M+Cd7tyxIFh77XJGQAA689E0yuYWoejk33yBIOUoyRecIocli8IgzoYu29YXhgJnfYo6 X-Google-Smtp-Source: AGHT+IEUj5ec1V0AYHz1cG33k70weYZEZS5owaSqtrN73AzMZLvP7WIUn+3nVhMKSchgJBfNqL1u X-Received: by 2002:ac8:59c6:0:b0:42e:24c4:ca0c with SMTP id f6-20020ac859c6000000b0042e24c4ca0cmr8066617qtf.60.1708550359924; Wed, 21 Feb 2024 13:19:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708550359; cv=none; d=google.com; s=arc-20160816; b=O0AKu6NXkb54XP73TXONZVb99zsMXq6NTkenkO/egSyBKkhL9Lejy91EDtOTgoKbkL Ks7kQAkX3tcMOmNBg1xr4G1A2YHLJZ/4Aswgeg3quM4q/3/OztdIKZpOMkXxRC34kfK4 Q1FRMBJTaMjYIICBygdUq/beBeJwWhXXo2ZnMbWc+ZQJG/le5DiW1YaFaJPCVqv1gQ/g v69qOifsUlGI4CjZEHGAHYF0/K9u3F46P3mKbtBcy/KSso3lW3L0a6vnM/CX6eYcTiCO 66wv32M1aQYyT075e/ECZg5aeg6XbfOokePbNLpJXETYFPEC0mM04U2cxURMnw78w9xC k5+A== 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=krMCnSm7PN59WBp42omeBRDoSFldcCIH3sGDX1JOTwc=; fh=NlbHjPHTM0NETPCnAyZXzfU4vwje2f5YofplVfqt1rY=; b=KC8LOZsJun/5XD2sOcs33r2WWizejkJd8btWynpGrpaSGG4muMFKVjvmhunHbECWAR xVyg3CmSWkoMdguSfBjMVpHGf7XhDOPIfns5bejmd2ZTAMnGd/L9T1vpcvSoTtnlWMnF ITPj07q7U8TR1IVJtZ0FAwOe3DKSNUHXgX9PL9NNy2VErwfP0ErmcMlOADHbCZFg893d NjUSm7MT/Yt4AT8sVcUCUwJ3HwYHKZlAwErHpnsRG40Fu7wUH3rtDBvxCOrC8/A1bZTg RG8rKXaRvm1bSEdy25Rw0OECrzMqWXaEOStM5do5pslAEkMQE6gS+M/aYm3+4iACC7Cz uOCw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jKfhZQRb; 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 s1-20020a05622a018100b0042c7297f3d4si11222026qtw.650.2024.02.21.13.19.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Feb 2024 13:19:19 -0800 (PST) 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=jKfhZQRb; 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 1rctxw-0002tn-Fd; Wed, 21 Feb 2024 16:17:20 -0500 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 1rctxU-0002JV-9X for qemu-devel@nongnu.org; Wed, 21 Feb 2024 16:16:53 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rctxM-0000mi-Lv for qemu-devel@nongnu.org; Wed, 21 Feb 2024 16:16:51 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33ce8cbf465so3658823f8f.3 for ; Wed, 21 Feb 2024 13:16:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708550202; x=1709155002; 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=krMCnSm7PN59WBp42omeBRDoSFldcCIH3sGDX1JOTwc=; b=jKfhZQRbt1eKbTCvF9Je8+ri8dt6VB+D+IRj6Cu2tlUepxVWMweW3sE05LdIuZyqmF hpeHylPBYwllg71C0ze4o5r5T/Tq+dK6tDZg5yQTVLIIxmHtVvI1x4X6d3pDazLC3oYT g5sBdBRJf4OsYxu7QtP5Ybgf8d3k3IXLneL2Psup+KKJFibLI9ewVk5gMgAehZ91sfRw nS7vRy5CtUfHuoBT9g0Ca5Y4Em1mcaEPIWdeEOozTIWq/Hg41znfaP0H1bM5lUCTeD5g A56/36hxPf+902Vrhc22+qgV/ZOdNtmP2xgmEmSu9lRiX+tj7wqrO7uE3ECqem5vicJy 5N4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550202; x=1709155002; 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=krMCnSm7PN59WBp42omeBRDoSFldcCIH3sGDX1JOTwc=; b=R9A+/bvLOSgm58RTnyp+Hin0OKsMclXgmYHulwFSprfsTtC5OxxfB8P7peQFIz87SW 0sK7KxIVFb0u/b6ZYKcVAEoIYSBIKXYeQaEVnBsurf5PLeH7vidgtyIJ9blGqNHz0tx/ nJwjVPWrGLx30ITrugH+o3+5TAlJgo7x+zFn7CkkEEG3mlmigP7KwNyNgVytwNsjJkqo TnG2v1rJo1OOqadpE+xvYgINSFV4q31QnR4kczCS+cWQkjpTMDNdzkm0+mHelWdGNyPK QPpozTgQnzh4zf0LOdC5suhnYOGibLzDtSTc5sMLr0h/K77+Kj14Sxmq2tUWGjUh/ixi SBhw== X-Gm-Message-State: AOJu0Yz802VBcgnItScxw1FaRXixu/WwXrWCMfeeoxtSYuXLDo6VvOiv +hkjS6B/dgOMF/flExuhqNsqVSqrlA+x2lnXvKjqC2H8GVKvrsCZU7Kb5OsASOXPiGg0i9pxme8 JHNw= X-Received: by 2002:a5d:648e:0:b0:33d:3bc2:7acc with SMTP id o14-20020a5d648e000000b0033d3bc27accmr9430955wri.11.1708550202692; Wed, 21 Feb 2024 13:16:42 -0800 (PST) Received: from m1x-phil.lan ([176.187.211.34]) by smtp.gmail.com with ESMTPSA id ba20-20020a0560001c1400b0033d640c8942sm7735227wrb.10.2024.02.21.13.16.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 21 Feb 2024 13:16:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Richard Henderson , "Michael S. Tsirkin" , Marcel Apfelbaum , Aleksandar Rikalo , Gerd Hoffmann , kvm@vger.kernel.org Subject: [PULL 02/25] hw/sysbus: Inline and remove sysbus_add_io() Date: Wed, 21 Feb 2024 22:16:02 +0100 Message-ID: <20240221211626.48190-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240221211626.48190-1-philmd@linaro.org> References: <20240221211626.48190-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 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_add_io(...) is a simple wrapper to memory_region_add_subregion(get_system_io(), ...). It is used in 3 places; inline it directly. Rationale: we want to move to an explicit I/O bus, rather that an implicit one. Besides in heterogeneous setup we can have more than one I/O bus. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Message-Id: <20240216150441.45681-1-philmd@linaro.org> --- include/hw/sysbus.h | 2 -- hw/core/sysbus.c | 6 ------ hw/i386/kvmvapic.c | 2 +- hw/mips/mipssim.c | 2 +- hw/nvram/fw_cfg.c | 5 +++-- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 3564b7b6a2..14dbc22d0c 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -83,8 +83,6 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr); void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, int priority); void sysbus_mmio_unmap(SysBusDevice *dev, int n); -void sysbus_add_io(SysBusDevice *dev, hwaddr addr, - MemoryRegion *mem); MemoryRegion *sysbus_address_space(SysBusDevice *dev); bool sysbus_realize(SysBusDevice *dev, Error **errp); diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 35f902b582..9f1d5b2d6d 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -298,12 +298,6 @@ static char *sysbus_get_fw_dev_path(DeviceState *dev) return g_strdup(qdev_fw_name(dev)); } -void sysbus_add_io(SysBusDevice *dev, hwaddr addr, - MemoryRegion *mem) -{ - memory_region_add_subregion(get_system_io(), addr, mem); -} - MemoryRegion *sysbus_address_space(SysBusDevice *dev) { return get_system_memory(); diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index f2b0aff479..3be64fba3b 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -727,7 +727,7 @@ static void vapic_realize(DeviceState *dev, Error **errp) VAPICROMState *s = VAPIC(dev); memory_region_init_io(&s->io, OBJECT(s), &vapic_ops, s, "kvmvapic", 2); - sysbus_add_io(sbd, VAPIC_IO_PORT, &s->io); + memory_region_add_subregion(get_system_io(), VAPIC_IO_PORT, &s->io); sysbus_init_ioports(sbd, VAPIC_IO_PORT, 2); option_rom[nb_option_roms].name = "kvmvapic.bin"; diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index a12427b6c8..57c8c33e2b 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -226,7 +226,7 @@ mips_mipssim_init(MachineState *machine) qdev_prop_set_uint8(dev, "endianness", DEVICE_LITTLE_ENDIAN); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[4]); - sysbus_add_io(SYS_BUS_DEVICE(dev), 0x3f8, + memory_region_add_subregion(get_system_io(), 0x3f8, sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0)); } diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index e85493d513..6d6b17462d 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -1142,6 +1142,7 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase, SysBusDevice *sbd; FWCfgIoState *ios; FWCfgState *s; + MemoryRegion *iomem = get_system_io(); bool dma_requested = dma_iobase && dma_as; dev = qdev_new(TYPE_FW_CFG_IO); @@ -1155,7 +1156,7 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase, sbd = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(sbd, &error_fatal); ios = FW_CFG_IO(dev); - sysbus_add_io(sbd, iobase, &ios->comb_iomem); + memory_region_add_subregion(iomem, iobase, &ios->comb_iomem); s = FW_CFG(dev); @@ -1163,7 +1164,7 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase, /* 64 bits for the address field */ s->dma_as = dma_as; s->dma_addr = 0; - sysbus_add_io(sbd, dma_iobase, &s->dma_iomem); + memory_region_add_subregion(iomem, dma_iobase, &s->dma_iomem); } return s;