From patchwork Mon Jan 9 12:08:30 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: 640624 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2102843pvb; Mon, 9 Jan 2023 04:24:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXsfA1sTGPRSl0RMqV6THmQc+mBgPZ8uRCXqFZnrwC1N3yTHPvL+tHzADbtEaGZv72mpLluO X-Received: by 2002:a05:622a:1f13:b0:3a5:3234:cc7b with SMTP id ca19-20020a05622a1f1300b003a53234cc7bmr92901555qtb.65.1673267089186; Mon, 09 Jan 2023 04:24:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267089; cv=none; d=google.com; s=arc-20160816; b=nOQvqVAyDYabahtfiNXWKndFBPVnkk2BsWcAKvjJxPz6CK5jDQGNWApYeYJh0hpEFb K7l1d10aj5yfGKMkSPnA1PM2SPLodY+u3xwK/uyyDs9JpkhGt6Xe4Qig06t14dVa9I7j EklfqNzTs3sVh9mU2PqXR0g71C6uatUxnTD65EzBb7avfMp11FRSACUt18JUbbu4kE24 UNxx0sIGLOSEpnmDk330tQzwAK76hDJZV6BKQlGsQv/5drTF0PjVo4tN6ye+m0z97fAd UFb628dDEpjji5QCj1diELVCLo077oENnG0MgcXh6d7mluWSxrGksbLvkXZVLV+V9/or b+9Q== 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=GrtKRjVCEXmnX65xOqafU/4NBjLWdOq8NqX2Mi8y/bQ=; b=0umVZZL18h2tmNYkBNC4uTVID9Ssg/nzCHEzGYlOjiv3wqoojyhlbgWF4d4ZTcUA7J mU41v4bxCcf51/yP+SN90MvIRte2/Q4RdKGiXdN4ndcN4Wq3PXu8JSJavW8Qwhg+XFnX VcpxJbX9DEfzVf8NBcDf2y0yNNniNRnishw5HgTC0Xc8HIgChud2LU/dKDMORP8KzfjR 2Eub5B1g/U6cV9Djc7FNnzyDakCaT0dZAtRF/wd1g0fEBPyxjBZgU6io3CsJmMavPl49 0iozB23YI1KDf6ov342zAXnnY1/7pIcgnkRyL/3qzCAZ4J5SE7LykilrtBRZ03dPcPVB hgqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vWiqiUge; 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 gd22-20020a05622a5c1600b003a81bb6a1c4si4455777qtb.406.2023.01.09.04.24.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:24:49 -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=vWiqiUge; 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 1pEqz2-0000YR-VM; Mon, 09 Jan 2023 07:10:33 -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 1pEqyd-0000P9-Vp for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:12 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEqyY-0006qD-3S for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:06 -0500 Received: by mail-wr1-x433.google.com with SMTP id d17so7940579wrs.2 for ; Mon, 09 Jan 2023 04:10:01 -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=GrtKRjVCEXmnX65xOqafU/4NBjLWdOq8NqX2Mi8y/bQ=; b=vWiqiUgel9gqgFUMk2dMTHnaIgThkHBREXtOZXsU6EXQs3kSu9VWAgILixHYtfSUFx s+FyoYULt2UIF7k67DNcJGSK8Iq+xnQ+wNsAJvNF06dtWj7E3F1KXEYUEhJXP6zaB2Ch 9M7Vcl2Y7fTvS17Ym5/wTa0f8iUg+lk+zN6GJd9je9Usgm2HErr6D7Bh74rawr4dZlp4 1gHuTNi7CI0ZSCoeWiHhGQ1UKHmSUgaod7FHLAUrHadVazkKJdUascBxV4p0NULNHrCC KibeLmJuLPvD4Q6jxiQBr7W0suh0hkRw+/Vx24GvgQFs5rQ72WPYXeTtACBZ2IVwf9OU D/XQ== 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=GrtKRjVCEXmnX65xOqafU/4NBjLWdOq8NqX2Mi8y/bQ=; b=gT0IhO8HrRULK38dXjVoC3bqeNPAhzah6jTdFXrcQgLDv4d6t3uyrSdbey2/pxoRhX 71U9Pr/eDtIEvb10BGiKJTcjEzhQm0j/mfAgkQVjeAkWdUo5H5pcWkMHO/rwSQ+GadDr ihm7CoPcq9NaWWNwkefTHHroXq+DESK0OMdQXOXmPp7gtXrWJL7X2ALdCFmkICQ8FQss eM5Nk/hiTW3S+Ghuc5tQHM8+PMXi975Az+o2ZDR9Vt2amqcfkOQXNL/qkKYbQdrP9y38 vbPUP3Rj9hpvBInbb61RYILpY8SmBu1wBGxLweIipjLuRJef5XFiVmqybFjqUNMUmJ34 Cv/A== X-Gm-Message-State: AFqh2kop2/UNulnFoCEUPBBdjqmTUadtS1xjYlpVGa63VJVbt/Jt4ygi cOoMlFu3OFZ3KgLefqnR+Yx2sIl4aODNsuaO X-Received: by 2002:adf:d084:0:b0:278:29ac:f894 with SMTP id y4-20020adfd084000000b0027829acf894mr31387214wrh.64.1673266200602; Mon, 09 Jan 2023 04:10:00 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id c18-20020adffb52000000b0025e86026866sm9874017wrs.0.2023.01.09.04.09.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:10:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 18/21] hw/mips: Open-code pflash_cfi01_register() Date: Mon, 9 Jan 2023 13:08:30 +0100 Message-Id: <20230109120833.3330-19-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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, T_SPF_TEMPERROR=0.01 autolearn=ham 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 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é --- hw/mips/malta.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 9657f7f6da..4605b06b3b 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1223,7 +1223,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; @@ -1287,12 +1286,16 @@ 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, - FLASH_SECTOR_SIZE, - 4, 0x0000, 0x0000, 0x0000, 0x0000, be); - dev = DEVICE(fl); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "mips_malta.bios"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 4); + qdev_prop_set_bit(dev, "big-endian", be); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, FLASH_ADDRESS); bios = pflash_cfi01_get_memory(dev); fl_idx++; if (kernel_filename) {