From patchwork Wed Jan 4 22:04:29 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: 1721636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=pCKy3Vgc; dkim-atps=neutral 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 4NnQ0G6ktsz23dq for ; Thu, 5 Jan 2023 09:54:38 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDBss-0008LG-LO; Wed, 04 Jan 2023 17:05:18 -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 1pDBsZ-0008BQ-MA for qemu-devel@nongnu.org; Wed, 04 Jan 2023 17:05:03 -0500 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDBsW-0004zc-UY for qemu-devel@nongnu.org; Wed, 04 Jan 2023 17:04:59 -0500 Received: by mail-ej1-x632.google.com with SMTP id qk9so85775164ejc.3 for ; Wed, 04 Jan 2023 14:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TFfnwjftSBTQtlrSBz3RLCltb8prEkxU+BRsjCrCgtQ=; b=pCKy3Vgcn9frgL1Z6PKfnlIn4yF3aXjidG7SLKuNXzFpa3mU8tY2cNUadw4pji+k0F jvpcI50AwZiG3VGGcq9ma6u2qDa7eHF+2i8kQFHVey8/mdD64bhVe9IxFoIN7pJgyEf9 2c7BWfk0pHq4Ja3VgwFKR6baxop3v5zgBfBmdwkLjZCalagvZxady8XUc2k0Biwihz8s CEJEEa6hlHhcbuSTswJ32VaW4KbPzupRCjO94mOhv0UuY/HIlezodfZJvRsu2ij2a1NM oKjxWkEjZPwRP+CDs82l4DPEDA57dMMt1e/I0mPPx/wMggcz0N8AyNqo2FMG0IOfNmG3 hv2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TFfnwjftSBTQtlrSBz3RLCltb8prEkxU+BRsjCrCgtQ=; b=AvS0pEGx6EdsuGPF6knKPMuSwQkN/Ou45vF8UF05GMHYqicUNvljmYMpeAyXiilej1 3dSowrpgfqwl5G6ZcIFWz0XE7mBQ6InfM0zqlzkHFkwdst3maeG2uMimUFA9RMqkPJED 12a07+6uimzAHfK5R9d2QmKvV4qx70jQzLrXjMBkjJzxhn/DVOQHoT46z13SZkcatWEB iAti38cfnwTbPRXzZfsCuvJrPs6ehq4lu+LXRwogBr2QfWy8mH7K9tPL21HsBoIDxbDf l6oQz1EmCiPWS8CzHqBGEQ+098rIy9g7FXSMidyaUmQ9XtlwtwdbKPsv26Qsy9yy6w/K Ln9A== X-Gm-Message-State: AFqh2kp//yXrASoDUuzG334StLRB4r/5Aqwf8LBQa8f/A/va35FSdYMO 0jZJ3I5P7PWIIlplwTi347OmPjv7ukX/E92+ X-Google-Smtp-Source: AMrXdXv8vYeyfvNZ6wMfRLyd7GkFBEmpWbZ4qZ0RgO9hI3ghNmrgaXrH0twPL68Bf7bsOSPFBGU6ow== X-Received: by 2002:a17:907:c48d:b0:7c0:fe60:be12 with SMTP id tp13-20020a170907c48d00b007c0fe60be12mr38960273ejc.25.1672869894693; Wed, 04 Jan 2023 14:04:54 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id i16-20020a170906115000b008373f9ea148sm15784340eja.71.2023.01.04.14.04.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Jan 2023 14:04:54 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , Antony Pavlov , Jan Kiszka , Marcel Apfelbaum , Hanna Reitz , Bernhard Beschow , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Paolo Bonzini , qemu-ppc@nongnu.org, Mark Burton , Richard Henderson , Magnus Damm , "Michael S. Tsirkin" , Bin Meng , Max Filippov , Aurelien Jarno , Eduardo Habkost , Palmer Dabbelt , Radoslaw Biernacki , Jiaxun Yang , "Edgar E. Iglesias" , Xiaojuan Yang , Peter Maydell , qemu-block@nongnu.org, qemu-riscv@nongnu.org, Yoshinori Sato , Alistair Francis , qemu-arm@nongnu.org, Leif Lindholm , Kevin Wolf Subject: [PATCH 00/20] hw: Remove implicit sysbus_mmio_map() from pflash APIs Date: Wed, 4 Jan 2023 23:04:29 +0100 Message-Id: <20230104220449.41337-1-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.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 Paving the road toward heterogeneous QEMU, the limitations of having a single machine sysbus become more apparent. The sysbus_mmio_map() API forces the caller to map a sysbus device to an address on the system bus (system bus here is the root MemoryRegion returned by get_system_memory() ). This is not practical when each core has its own address space and group of cores have access to a part of the peripherals. Experimenting with the PFLASH devices. Here the fix is quite easy, we split the pflash_cfi_register() -- which does the implicit sysbus mapping -- into an explicit qdev pflash_cfi_create() followed by the sysbus_mmio_map() call. Since we were touching the PFLASH API, we restricted the PFlashCFI0X structures to their models. The API now deals with a generic qdev pointer (DeviceState*). First 15 patches deal with the CFI type 1 model, then the last 5 with the type 2. The patch logic is mostly: - extract pflash_cfi_create() from pflash_cfi_register() - open-code pflash_cfi_register() for each hw/${ARCH}/ - remove unused pflash_cfi_register() - reduce PFlashCFI0x structure scope Please review, Phil. Philippe Mathieu-Daudé (20): hw/block: Pass DeviceState to pflash_cfi01_get_blk() hw/block: Use pflash_cfi01_get_blk() in pflash_cfi01_legacy_drive() hw/block: Pass DeviceState to pflash_cfi01_get_memory() hw/arm: Use generic DeviceState instead of PFlashCFI01 hw/loongarch: Use generic DeviceState instead of PFlashCFI01 hw/riscv: Use generic DeviceState instead of PFlashCFI01 hw/i386: Use generic DeviceState instead of PFlashCFI01 hw/xtensa: Use generic DeviceState instead of PFlashCFI01 hw/block: Factor pflash_cfi01_create() out of pflash_cfi01_register() hw/arm: Open-code pflash_cfi01_register() hw/microblaze: Open-code pflash_cfi01_register() hw/mips: Open-code pflash_cfi01_register() hw/ppc: Open-code pflash_cfi01_register() hw/block: Remove unused pflash_cfi01_register() hw/block: Make PFlashCFI01 QOM declaration internal hw/block: Factor pflash_cfi02_create() out of pflash_cfi02_register() hw/arm: Open-code pflash_cfi02_register() hw/sh4: Open-code pflash_cfi02_register() hw/block: Remove unused pflash_cfi02_register() hw/block: Make PFlashCFI02 QOM declaration internal hw/arm/collie.c | 15 ++++--- hw/arm/digic_boards.c | 14 +++--- hw/arm/gumstix.c | 19 +++++--- hw/arm/mainstone.c | 13 +++--- hw/arm/musicpal.c | 13 +++--- hw/arm/omap_sx1.c | 22 +++++---- hw/arm/sbsa-ref.c | 8 ++-- hw/arm/versatilepb.c | 13 +++--- hw/arm/vexpress.c | 12 +++-- hw/arm/virt.c | 6 +-- hw/arm/xilinx_zynq.c | 10 ++--- hw/arm/z2.c | 10 +++-- hw/block/pflash_cfi01.c | 35 ++++++++------- hw/block/pflash_cfi02.c | 25 +++++------ hw/i386/pc_sysfw.c | 6 +-- hw/loongarch/virt.c | 9 ++-- hw/microblaze/petalogix_ml605_mmu.c | 8 ++-- hw/microblaze/petalogix_s3adsp1800_mmu.c | 8 ++-- hw/mips/malta.c | 13 +++--- hw/ppc/e500.c | 2 +- hw/ppc/sam460ex.c | 12 +++-- hw/ppc/virtex_ml507.c | 7 +-- hw/riscv/virt.c | 7 +-- hw/sh4/r2d.c | 9 ++-- hw/xtensa/xtfpga.c | 6 +-- include/hw/arm/virt.h | 3 +- include/hw/block/flash.h | 57 ++++++++++++------------ include/hw/i386/pc.h | 3 +- include/hw/loongarch/virt.h | 3 +- include/hw/riscv/virt.h | 3 +- 30 files changed, 200 insertions(+), 171 deletions(-)