From nobody Sat May 18 21:45:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620749750; cv=none; d=zohomail.com; s=zohoarc; b=VSzrxgt03VmivGgJQSN6f2IMcSilLlU60bCZgiBoCgGHMmOxlY4/aHWq0sXkHXnbzvVnk+Q0e2+l7PYDcd4NWXHZoaxilX0eLcwTf9UrxV6vif0xpMhY4EldbNT5L379DA3dfaunF6nxHA6VyQ/AXDz8CkQb/O3578q5L9H99+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620749750; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=htAjo2GS8BtMQHaSpcJt9cMrsO0yCT7qU8z7oOuRmAY=; b=D0jl9coAQDYGZOEmXIna/Iy/9vbi3vNqtYJosSlLcM1YjUs+odbPB+CxvJAMP600/uQDyvW4lhyyRPRRQrGFJtV9xbJM0vVWGUDHgLC3EUNhA50r5LVc7SEZ9P5bHbHQ4kqbwd6EpS+k7eOIzSIf2573yf/nDJTiNxPVq9sCjCI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1620749750776802.2094571339404; Tue, 11 May 2021 09:15:50 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-ma-UR3uaPfKvxFHqAgixVQ-1; Tue, 11 May 2021 12:15:27 -0400 Received: by mail-wm1-f71.google.com with SMTP id d9-20020a1cb4090000b02901494f55f719so2513217wmf.9 for ; Tue, 11 May 2021 09:15:27 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (39.red-81-40-121.staticip.rima-tde.net. [81.40.121.39]) by smtp.gmail.com with ESMTPSA id x8sm27289226wru.70.2021.05.11.09.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 09:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620749748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=htAjo2GS8BtMQHaSpcJt9cMrsO0yCT7qU8z7oOuRmAY=; b=Cx/AfAUJg55bC5QBULciiCQYbw6s8TdvHTfv86IqO372dPaAoc0BHY3YYkfcgLxtDE76rp mK42zsqU4ZSfUXCwZkkO+MCItwu8pTnw8CUm87DVpFdD+fLsHdphzJMza/j6UR1YqONhPN KiSTy9HDsfmzeXDfKbbylyjKGt5sRno= X-MC-Unique: ma-UR3uaPfKvxFHqAgixVQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=htAjo2GS8BtMQHaSpcJt9cMrsO0yCT7qU8z7oOuRmAY=; b=dzDqir1X5wlzJ89natT9m1Uf2KbD2QUb74ZuBboPAmq397mPPNiS1UGRKJ++Pa7XvA X7yzG2+GSf2/uevYb70KDwOHuogZ4Bn3MVrE9Rjw2MI4LdIaRA/bkZF6ExqcOy2dIWFY oRgWtemjL7b5SIbPiREXrMZrgy3idBoUBG6UzTbKs0LLOGtU0T+SDpomNgnMHqQUeicu Mb7evz2Va8d8Z09S0gYAytvOBTcxmRCNqnPTFazx+Eq0vnTdz3OaNU6jIPIL4U4YleiY i56eCC8wRq3eSqH/Z/1IipUMpFh8tlFPgVFIPTx0kfsh+I7YptvHEuEGiJeEZVs9HhQ5 FHyw== X-Gm-Message-State: AOAM5320+ENIFLYt9uxyvvLZ04UzONA+0sSs7EWFuOKBiX/uxz2KhMJK T2nBloBLEMLt/zGmZF2wMGoRYgcRPx7qapK8Wqw9r83RYs812DehHKaSpmMC3YtMFMiVEXMpPW+ ibmqOw3FsunAP5w== X-Received: by 2002:a5d:45cb:: with SMTP id b11mr39459620wrs.343.1620749726071; Tue, 11 May 2021 09:15:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTSK3g2wBGq5wt10Os/NTw/+Hj9SlFtkqQEpCHMtP88sLP4+OqvgjtZiMKwyAoiC9lEWFN3A== X-Received: by 2002:a5d:45cb:: with SMTP id b11mr39459598wrs.343.1620749725961; Tue, 11 May 2021 09:15:25 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 1/2] hw/block/pflash_cfi02: Set romd mode in pflash_cfi02_realize() Date: Tue, 11 May 2021 18:15:03 +0200 Message-Id: <20210511161504.3076204-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210511161504.3076204-1-philmd@redhat.com> References: <20210511161504.3076204-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 The ROMD mode isn't related to mapping setup. Ideally we'd set this mode when the state machine resets, but for now simply move it to pflash_cfi02_realize() to not introduce logical change. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210325120921.858993-2-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/block/pflash_cfi02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 25c053693ce..35e30bb812c 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -173,7 +173,6 @@ static void pflash_setup_mappings(PFlashCFI02 *pfl) "pflash-alias", &pfl->orig_mem, 0, size); memory_region_add_subregion(&pfl->mem, i * size, &pfl->mem_mapping= s[i]); } - pfl->rom_mode =3D true; } =20 static void pflash_reset_state_machine(PFlashCFI02 *pfl) @@ -917,6 +916,7 @@ static void pflash_cfi02_realize(DeviceState *dev, Erro= r **errp) /* Allocate memory for a bitmap for sectors being erased. */ pfl->sector_erase_map =3D bitmap_new(pfl->total_sectors); =20 + pfl->rom_mode =3D true; pflash_setup_mappings(pfl); sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem); =20 --=20 2.26.3 From nobody Sat May 18 21:45:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620749737; cv=none; d=zohomail.com; s=zohoarc; b=mkS52X4zTOWSRZu07P73ETplYwwfEK/2CnvBsX0nrpC7/OcTmIhAHK1P+iM5MwLPT9Fot7v3ARgOpPxu80XAGgtN/5IrO5OCXeNMEbBxh/E+rFtW8DHJXL0lzxNn5ibT5p8WQEkLhV0gDrcuRB8l0VrpV8JktpwPUD0NNb1xv7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620749737; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=6CFSni+4vz0cgF3Gg/EQbT91OiEpSWI1f9QDUFXctQg=; b=KjCttlCu6tqWNj23e2k+t5zmmClKmUwBjzgQVv+sA0Iybvgulww7I0qmPQKWFiHwh5AplHYoC3WoChlH90kBXTiFOpOH9CmS1SCqItKfi1tKVgy0WVoQpOBQjrsWRIvzBZu5qGrUmCaedTTWizUK81Ro4pKB4lhU0zWMRR6r3cw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620749737576798.1073514237759; Tue, 11 May 2021 09:15:37 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-217-p1tWsyQNO4eMxNxSyweVrg-1; Tue, 11 May 2021 12:15:31 -0400 Received: by mail-wm1-f72.google.com with SMTP id b16-20020a7bc2500000b029014587f5376dso596893wmj.1 for ; Tue, 11 May 2021 09:15:31 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (39.red-81-40-121.staticip.rima-tde.net. [81.40.121.39]) by smtp.gmail.com with ESMTPSA id w22sm3588180wmc.13.2021.05.11.09.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 09:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620749735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6CFSni+4vz0cgF3Gg/EQbT91OiEpSWI1f9QDUFXctQg=; b=O35HC7GWLB/2TrIrf/bmWO2YD5XPI4UO+aprVqXclkjD60ftVGaCeuyCbMT2pQHHQ/tUyt GZxUFRGWngbwZxdUaAo/OSHE5NfaIBXO4sEMWP0UrfFBCEHmIShmcLHfRiL2QTvB8O6zu+ jX1f/3vEbkQVAafjh44cQH/rHtS70j4= X-MC-Unique: p1tWsyQNO4eMxNxSyweVrg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6CFSni+4vz0cgF3Gg/EQbT91OiEpSWI1f9QDUFXctQg=; b=ottF+Co+CNjJawDYMm9/3K0uDTk1CbuoT14i09ASUREM+RwyX5HBAtiqirVbMBJMA5 HR1I7k8m4Ewwx/XjXidumiRoFdQmHWA9ozvmMazTkWC+RY1H04siRqTS37gyEMY0xGw2 uhKjURuUCM48AsItZ/jYQW6Kl93ok5OGCrP/fUYCTwqD+Y/B7s0d0NmdCB18r71b+tDs pZfZTOh+3i+dI/SJgUlT646QQ3mYezE8EooMrSqP33/6otwMXs4iOeMIjnXKCgLm0z3k a6PF6z6HKKTTcRxF2cAGMPnRWCrd6qL1dhT6zv6f5IFgf1Cc4u1iIBrXsy0EmwQzgvCT Woyg== X-Gm-Message-State: AOAM533bygUfpb2puFpBD/4yYCNJebSFM6e5eDuq9o1PUtULZg24VM4i AOWyYKv6h37riAubVfsedfCd2ODWijw1RHFPCXK+gacmxh0Y2WWYumcbnaDwJi0fyhegVY0spJI EAeNabqUlqeatNA== X-Received: by 2002:a1c:ed03:: with SMTP id l3mr34283968wmh.130.1620749730519; Tue, 11 May 2021 09:15:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypdBC3zwxV3pXWEzX8zLL/KpN3ukckNzsQ2rxjQQKAw4qn7KwdsmtsjqKZmrqyNJxMV8yEWw== X-Received: by 2002:a1c:ed03:: with SMTP id l3mr34283945wmh.130.1620749730346; Tue, 11 May 2021 09:15:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 2/2] hw/block/pflash_cfi02: Do not create aliases when not necessary Date: Tue, 11 May 2021 18:15:04 +0200 Message-Id: <20210511161504.3076204-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210511161504.3076204-1-philmd@redhat.com> References: <20210511161504.3076204-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 When no mapping is requested, it is pointless to create alias regions. Only create them when multiple mappings are requested to simplify the memory layout. The flatview is not changed. For example using 'qemu-system-sh4 -M r2d -S -monitor stdio', * before: (qemu) info mtree address-space: memory 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-0000000000ffffff (prio 0, i/o): pflash 0000000000000000-0000000000ffffff (prio 0, romd): alias pflash-alia= s @r2d.flash 0000000000000000-0000000000ffffff 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram (qemu) info mtree -f FlatView #0 AS "memory", root: system AS "cpu-memory-0", root: system Root memory region: system 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram * after: (qemu) info mtree address-space: memory 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram (qemu) info mtree -f FlatView #0 AS "memory", root: system AS "cpu-memory-0", root: system Root memory region: system 0000000000000000-0000000000ffffff (prio 0, romd): r2d.flash 0000000004000000-000000000400003f (prio 0, i/o): r2d-fpga 000000000c000000-000000000fffffff (prio 0, ram): r2d.sdram Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210325120921.858993-3-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/block/pflash_cfi02.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 35e30bb812c..02c514fb6e0 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -917,8 +917,12 @@ static void pflash_cfi02_realize(DeviceState *dev, Err= or **errp) pfl->sector_erase_map =3D bitmap_new(pfl->total_sectors); =20 pfl->rom_mode =3D true; - pflash_setup_mappings(pfl); - sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem); + if (pfl->mappings > 1) { + pflash_setup_mappings(pfl); + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem); + } else { + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->orig_mem); + } =20 timer_init_ns(&pfl->timer, QEMU_CLOCK_VIRTUAL, pflash_timer, pfl); pfl->status =3D 0; --=20 2.26.3