From patchwork Thu Oct 19 21:17:51 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: 735634 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1732236wro; Thu, 19 Oct 2023 14:26:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSH3hcLuItVXlTqz8fWyiv/w4YcX/yQir5QepHAZp0Q2GQRp0hzZ7KULRQdj6bTQukamy7 X-Received: by 2002:a05:620a:2786:b0:76d:2725:f36f with SMTP id g6-20020a05620a278600b0076d2725f36fmr3149575qkp.71.1697750810948; Thu, 19 Oct 2023 14:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697750810; cv=none; d=google.com; s=arc-20160816; b=Zyry4jZnm2mgDY+ritfPxzL8mlpHYxYt3iLM8ICnrh/IGrchi1YhMbV1/4XiXu1Nex 0Ia7nm2BkYVXUTDbE6G5jYkdKUnjJZQSLrLG5x72X0pJ+i8OW/ARjnUJdPisZrepU6db Gh1XjgOlQzbE7zd2gVQc2OBZxGsITjlA8O9JHi3PRbQ3Ugx2pLqtO68IU6nfoWLeQ0+8 9fG7RFOvY2g3iM/QW1SkGvca/47fS2VApeSn5UKIFHkpB8ymKzBJFAG1lC7PqgKdqU2e MojT8JpJoSFXKa5LMvE3w8cQ/Q44kxss3HAfp62Tqb/zWURfpHbhBwfVMNnVwHYQG9Gt yeWA== 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=VJumrC/z6YrHaNHaQARwXLPWcCx3YWs2e2GnN7n/Vjw=; fh=gPUAZr3rG5AAum2cFS0vXpLjRIjvY8asn41zDrAXuoE=; b=gU/0j7FrsysjUTmpLkVEUK3GJe5A4Fr/9Tt7zwFe5iKBe2/a5XpL0XY2rE/F1+6Lw9 aKl5PPnbG/XNquUET31pv5YbInIPN5lp8C0+eYXa8vYGUKKO+8KmoA0Z+7gQMu1wTa5Q Uhj6X95kqR2qsKz9nig/PDRHqBYLzx5f2m4l2XtdtWWqD1n1ZRAEJTMHb7Ifs0fB+1DQ wVv/5ddXYazECtnnbnPpX/XZNqkIbwOZmM4P+uOehHHbcB7UMyLX2lZL8oTLfy+3+PIb mdM7FYvBs9O15eYCHWvwApoC6OeSF/w92GlG7YabLQ5COGE3K4fW52yXVZ3pvahXjx9M 0KAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cxYeWkNg; 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 h5-20020a05620a244500b0075daf23cc89si262654qkn.248.2023.10.19.14.26.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2023 14:26:50 -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=cxYeWkNg; 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 1qtaSO-0001KI-OH; Thu, 19 Oct 2023 17:21:28 -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 1qtaSK-0001GH-Kz for qemu-devel@nongnu.org; Thu, 19 Oct 2023 17:21:26 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtaSH-0006Ar-Dm for qemu-devel@nongnu.org; Thu, 19 Oct 2023 17:21:24 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40651a72807so1001255e9.1 for ; Thu, 19 Oct 2023 14:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697750470; x=1698355270; 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=VJumrC/z6YrHaNHaQARwXLPWcCx3YWs2e2GnN7n/Vjw=; b=cxYeWkNg8mcEiY1IOAJWxhilVYwleTVqXh0pSa0mnoJQNxdxcOBC9mEBHG/7CV/QB9 i01eDEYlGnmcf6+nK2P1fRBu+96W2TVpR2ht+nzOm+rzyqqkYDvrXXDouI6pRCMS1rJ+ Cf9MHOGg67nGrFLV7cOGSKovyGKQpQoPlZE7qdMff+yBbtWta1AVIjZ7sklSz8cLCbjX iMcCo1wprt3ra0OHk457ECUHe6HtVlYftqbTgRLSBYZt+VMRWkxDWmfoaIjO7lwx2XgI 1UO13MOjXwq++MqSyU9N6UxIU43eFpYj3yDG0qpAle56nZNuzoK1fHNqPjdIq01MO530 VSsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697750470; x=1698355270; 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=VJumrC/z6YrHaNHaQARwXLPWcCx3YWs2e2GnN7n/Vjw=; b=Em3MRE6K6ksKFhLGIh2BDIbyXdmZ5GdKRw/bASNjr1EjtFW2zqVl2fz6Uidr0cMner MIEewIYz4qLSSc9d7aAQJKgqjr1Nu99cOOwbQ6WiojOSqQcm6TLeM3cUGtt3Z9p9CU6Y n32nvwBOtxT5XQ42u+CryZCSt+2KxWV3cSqEOlefkoX92xafvicJqw/s9K4cNa7LHq75 fMOouPeY99VG8AGBql+goU6T+HjLmmFpeivzgxG6fHJWRVnwzX2vRehaVjDisPZgrAwu nM1geCYi4g7SIYqZUeZ67dlWIMdZlPm3f4U3OIT2u8Hf04ch/Kajk9tIlNSAG96vbEdJ /Wfg== X-Gm-Message-State: AOJu0YwKEtEjo1F7UZRYi/N0lLo55G2KClaU+MyWYmeSJBXMj/wh6z8S 3bmr3Pzq6W5ShRYDZVVxMtuo/gWDDlgF7waWHSb8lQ== X-Received: by 2002:a05:600c:3c8d:b0:408:434c:dae7 with SMTP id bg13-20020a05600c3c8d00b00408434cdae7mr94068wmb.2.1697750469858; Thu, 19 Oct 2023 14:21:09 -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 m21-20020a05600c4f5500b0040841e79715sm521538wmq.27.2023.10.19.14.21.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Oct 2023 14:21:09 -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?= , Richard Henderson , Thomas Huth , LIU Zhiwei , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Nicholas Piggin , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= Subject: [PULL 26/46] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region Date: Thu, 19 Oct 2023 23:17:51 +0200 Message-ID: <20231019211814.30576-27-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::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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 There is no point in exposing an internal MMIO region via SysBus and directly mapping it in the very same device. Just map it without using the SysBus API. Transformation done using the following coccinelle script: @@ expression sbdev; expression index; expression addr; expression subregion; @@ - sysbus_init_mmio(sbdev, subregion); ... when != sbdev - sysbus_mmio_map(sbdev, index, addr); + memory_region_add_subregion(get_system_memory(), addr, subregion); Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: LIU Zhiwei Reviewed-by: Cédric Le Goater Message-Id: <20231019131647.19690-5-philmd@linaro.org> --- hw/ppc/pnv_xscom.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c index cf892c9fe8..805b1d0c87 100644 --- a/hw/ppc/pnv_xscom.c +++ b/hw/ppc/pnv_xscom.c @@ -223,14 +223,12 @@ const MemoryRegionOps pnv_xscom_ops = { void pnv_xscom_init(PnvChip *chip, uint64_t size, hwaddr addr) { - SysBusDevice *sbd = SYS_BUS_DEVICE(chip); char *name; name = g_strdup_printf("xscom-%x", chip->chip_id); memory_region_init_io(&chip->xscom_mmio, OBJECT(chip), &pnv_xscom_ops, chip, name, size); - sysbus_init_mmio(sbd, &chip->xscom_mmio); - sysbus_mmio_map(sbd, 0, addr); + memory_region_add_subregion(get_system_memory(), addr, &chip->xscom_mmio); memory_region_init(&chip->xscom, OBJECT(chip), name, size); address_space_init(&chip->xscom_as, &chip->xscom, name);