From nobody Wed Nov 19 08:22:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1615333858; cv=none; d=zohomail.com; s=zohoarc; b=gGCfv9gaHbZG88mz8Avdqznocejx7Tx5M+NK78IhdQOsJL+fsWasabc3ifJAzxPu7lGNyd3sBonaV0aN+LNHf8YzJRM3tfPO9bdvY8/w6OAZJWc5fGR7wGZKgbIi5h1UjW1w1/LIWwPREP4YnVAmGF5qyd8QeJ5470c/5Q0Tp4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615333858; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=m6hiB0Ry4U+40peR1g9DMU6zeYRKlNPh+KKp/RGq7bo=; b=aIyIfmmJ240lYThPm9kdnQE1LvqyYOWteLyXfLRpDPJN9Wyrp98OPuCfBHNbcJb1Pl0d3pS11j5WC3/z+4QNrRaYtOyVWk0JAZOHyK+FKMzwePhb+BqKQQG85q/TtNBGbloUtad4++fYRCCp5AavC8xvCmwMsuhraSy440jNhPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1615333858843210.98903784947288; Tue, 9 Mar 2021 15:50:58 -0800 (PST) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-368-kNrSXGi7Pjy_K0jwSlCa9Q-1; Tue, 09 Mar 2021 18:50:53 -0500 Received: by mail-ed1-f70.google.com with SMTP id w16so7547396edc.22 for ; Tue, 09 Mar 2021 15:50:53 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id qo25sm1705379ejb.93.2021.03.09.15.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 15:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615333857; 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=m6hiB0Ry4U+40peR1g9DMU6zeYRKlNPh+KKp/RGq7bo=; b=MJ2dKC35E//uYsDpT3hI2IAKKkJ7QaQm6j8e5S2STAjIABsizaa8EsbKFaknjG9GiT14Nx Qum6choXPZoLlzk6CN6mfH3Sk7+/+u3hB5OIKWWam4zpiin6TLVAJ2CRwkE4PJIrQZetPz LjWbyzp4+gui1M9YnyG8aNXhENktk0w= X-MC-Unique: kNrSXGi7Pjy_K0jwSlCa9Q-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=m6hiB0Ry4U+40peR1g9DMU6zeYRKlNPh+KKp/RGq7bo=; b=p7T9oQAKNR0TFuR35i5qgzV9JNqCRL6z70AkMQmNcApvcWXFm08A00QohidOqciTNO d8uz1uHTvqo0yi5+CBg/QlpMLqnng3I3UGC0R/FWHR2t+xBCTek7Zt2PfZ+uDck3rJzL w15yP/AqLIeNyrRIONXyFfk7BRdxbD6gyOFG/nakHV7XX3oikMvZwmKRdTrtfNRHHWWd Gl7hQFgao9+ln0klbW+0aF1vW3IERlkR3wibFyDDXBoLutY5E+6INlJNpjo5U1T5lGD0 fOgOdZsyExMu0CTi+LhAlqK5VDSgFEXsbcz/B2E9SxQ7aHJq6ckSc5thPko0NDIgSjWq R0tg== X-Gm-Message-State: AOAM533SaYVckkgirWsQV8RIVE9Y9wA5uky8nGW5Er5iBerJFAtfinOb vrpZCL3Lz3wpmPwlyuBZnqyS7SVajlSGCJ4oJBaM5VHWa9KDVh8dgAXpKdVo8MQbkYPDoKAJUKn 8lJwWbNs+Ctwv5Q== X-Received: by 2002:a17:906:4d44:: with SMTP id b4mr585779ejv.338.1615333852546; Tue, 09 Mar 2021 15:50:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhpJFHaX+Nz2j5x4uC5whRpvKqGT7q4Sw6OBlrjk3szSME4l5+uOFdZeahZvrYAKy1C10Rkg== X-Received: by 2002:a17:906:4d44:: with SMTP id b4mr585766ejv.338.1615333852397; Tue, 09 Mar 2021 15:50:52 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alistair Francis , Max Reitz , Kevin Wolf , Stephen Checkoway , David Edmondson , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 4/9] hw/block/pflash_cfi02: Set rom_mode to true in pflash_setup_mappings() Date: Wed, 10 Mar 2021 00:50:23 +0100 Message-Id: <20210309235028.912078-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210309235028.912078-1-philmd@redhat.com> References: <20210309235028.912078-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) There is only one call to pflash_setup_mappings(). Convert 'rom_mode' to boolean and set it to true directly within pflash_setup_mappings(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Bin Meng --- hw/block/pflash_cfi02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 845f50ed99b..5f949b4c792 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -108,7 +108,7 @@ struct PFlashCFI02 { MemoryRegion mem; MemoryRegion *mem_mappings; /* array; one per mapping */ MemoryRegion orig_mem; - int rom_mode; + bool rom_mode; int read_counter; /* used for lazy switch-back to rom mode */ int sectors_to_erase; uint64_t erase_time_remaining; @@ -181,6 +181,7 @@ 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_register_memory(PFlashCFI02 *pfl, int rom_mode) @@ -927,7 +928,6 @@ static void pflash_cfi02_realize(DeviceState *dev, Erro= r **errp) pfl->sector_erase_map =3D bitmap_new(pfl->total_sectors); =20 pflash_setup_mappings(pfl); - pfl->rom_mode =3D 1; sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem); =20 timer_init_ns(&pfl->timer, QEMU_CLOCK_VIRTUAL, pflash_timer, pfl); --=20 2.26.2