From patchwork Wed Jan 4 22:04:41 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: 639059 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1975656pvb; Wed, 4 Jan 2023 14:52:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXtZp6LT7iMLT+u5DGEUuo8UYnYgw/wBsMWDjHLC3rUtbaOVRpbKzX0HUfXE8oJXy+agR6XV X-Received: by 2002:a05:6214:1383:b0:531:a8f3:e8db with SMTP id pp3-20020a056214138300b00531a8f3e8dbmr29114093qvb.47.1672872743523; Wed, 04 Jan 2023 14:52:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672872743; cv=none; d=google.com; s=arc-20160816; b=fsWLSyNIAeFceWBrU2OWm3/18H3fskEKw9hp8Decn2m6qyUdbwRVMqgggP9IBmF5ET vstLxb2k+RUqyjyCh2eRDSDMOL5SIiV7PiK7oCNJvRW39uQCYv2xoIb6eZIf59Ca0IRd AR2L/51tH3MQSqle73PaHTN3AggAEwzA47Vw69gIFI6upfbtige3WlOHam1mXPbnVXp3 LcqgAyKN8iteBWk5DKIufzS8tHl4wFMXItN97jXdcS12TDcmSVd9nsmG5EhbbYPHhm3K SUNM9zNvGC5ePOcSsgGpScW+znjSShIiG4ZubEDWzI2owg6gVgoMOmU/NQSIPq32B4n4 qfkw== 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=KN4KqLlugVC+0veh/qHwh2dos/FPn9LDhOhs/UvtQDw=; b=o2BXhhD5vVx6ITngJD1KW2GUaFIOOdO2BuYf/JgcOFE41wdRNWSVYw7mQmfqpuW/vL /w/TT5ESX5b0shWjehElOSYSdksVe57ii1dcbaP+5DdkedTRTpeoLyjt2a7uhQGhf/L6 6JKWzOG1ChNbH2/yQ7v/OGOhaz4pIeEJGKAiSMubEw3Hu7BioYJwe3zIimX0l4+aOlq7 0ujjWr9CMti1xONY1X9PG8OxDkXieWahMQ9uUsvD3I7TqQtKyRlMWEiB5HpK6jWMyQU2 Q5FrhaYkBY5qMp7nZiq+Og4vKDbk0omDQDietRgQ1eAo7ajMXImWupvWlgRRrpBCLI2X +GWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z1BU4aoI; 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 x188-20020a3795c5000000b006ff0211b876si17272267qkd.158.2023.01.04.14.52.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jan 2023 14:52:23 -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=z1BU4aoI; 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 1pDBuD-0001ai-PL; Wed, 04 Jan 2023 17:06:41 -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 1pDBuB-0001Vq-Lx for qemu-devel@nongnu.org; Wed, 04 Jan 2023 17:06:39 -0500 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDBu9-000629-4d for qemu-devel@nongnu.org; Wed, 04 Jan 2023 17:06:39 -0500 Received: by mail-ej1-x631.google.com with SMTP id vm8so79060635ejc.2 for ; Wed, 04 Jan 2023 14:06:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=KN4KqLlugVC+0veh/qHwh2dos/FPn9LDhOhs/UvtQDw=; b=z1BU4aoIPYdDRqTnlx0V3zv0CD9t+NMAhobtS9j6dghWzkl+GBC3imIxlMpvEMyTyU lH9DINmyyjI0M06yICDcJ0uuJfyxGMn6C6buPS+HRN243d7qRriWbRLUs8VQGni7kkJ4 jsmxMl+qeS9DoEuv+rX6n/5MX7uVBrdRy33dmARiikb6K+I2xUVS44eVKFStxOZn7XQ4 4AWA5tW0P5HYeFms0rGALBKAVKOI4O/Hyvtl5b3KCEfAsaJB/O3NTHvs/bH5U18E1E7a TLhTQ95AueMkRyXyfe82e94wv8pwaHGl30G0WfbMv71x1G5BHTcLXi5SWwnRZOeDA9rh WpJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=KN4KqLlugVC+0veh/qHwh2dos/FPn9LDhOhs/UvtQDw=; b=EufsYtHvUlGGetqwMocNtErm8FvcLAbpLZSRifaAbrwI9k1bmkc6/NNq+mjFcSRo9D mjTbBok+y775ZSLMJfgUl+0CSrftFwhtsDllRrH8WPnVop26i5GFOfnNQooAZy1hzMyJ eQ5bShCg45HJBEe1m4lElUor46qolhFdCrQTXeuBs56cyJqgOkRmIj4gdUBZybOdINrJ AJqPXN+X8oJaaq7qL2yKpf3BiUoQABeXFYks6UaJbS7UiSAIEvpYcCqm6hv4wzyUzMYy Y2B4Fj235Gxe86Liw42w/fhKrNkhAG0sTavcSGdjdTeYcaMxYki1tBvPT5tcrMt6NQvi MAkA== X-Gm-Message-State: AFqh2ko1ItJjM8MXIs1rXptPRALyRct/eysWrhA62cwpLrkPyctiig4r uUP7h86fz2gy9WlJLQEwBYVvNeqEqxuRHQyc X-Received: by 2002:a17:907:d387:b0:7c1:6fd3:1ef3 with SMTP id vh7-20020a170907d38700b007c16fd31ef3mr41602526ejc.33.1672869995411; Wed, 04 Jan 2023 14:06:35 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id co5-20020a0564020c0500b00483dd234ac6sm12958847edb.96.2023.01.04.14.06.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Jan 2023 14:06:35 -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 12/20] hw/mips: Open-code pflash_cfi01_register() Date: Wed, 4 Jan 2023 23:04:41 +0100 Message-Id: <20230104220449.41337-13-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230104220449.41337-1-philmd@linaro.org> References: <20230104220449.41337-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.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 pflash_cfi01_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove to remove pflash_cfi01_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/mips/malta.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 43fbb97799..e690f13bdb 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1222,7 +1222,6 @@ void mips_malta_init(MachineState *machine) const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; - PFlashCFI01 *fl; MemoryRegion *system_memory = get_system_memory(); MemoryRegion *ram_low_preio = g_new(MemoryRegion, 1); MemoryRegion *ram_low_postio; @@ -1286,12 +1285,11 @@ void mips_malta_init(MachineState *machine) /* Load firmware in flash / BIOS. */ dinfo = drive_get(IF_PFLASH, 0, fl_idx); - fl = pflash_cfi01_register(FLASH_ADDRESS, "mips_malta.bios", - FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - 65536, - 4, 0x0000, 0x0000, 0x0000, 0x0000, be); - dev = DEVICE(fl); + dev = pflash_cfi01_create("mips_malta.bios", FLASH_SIZE, + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, + 65536, 4, + 0x0000, 0x0000, 0x0000, 0x0000, be); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, FLASH_ADDRESS); bios = pflash_cfi01_get_memory(dev); fl_idx++; if (kernel_filename) {