qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Rudolph <patrick.rudolph@9elements.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, mst@redhat.com, imammedo@redhat.com,
	anisinha@redhat.com, marcel.apfelbaum@gmail.com,
	Patrick Rudolph <patrick.rudolph@9elements.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Eduardo Habkost <eduardo@habkost.net>
Subject: [PATCH 3/3] hw/i386/pc_sysfw: Do not create BIOS region if MTD is present
Date: Wed, 18 Oct 2023 13:52:31 +0200	[thread overview]
Message-ID: <20231018115231.3547102-4-patrick.rudolph@9elements.com> (raw)
In-Reply-To: <20231018115231.3547102-1-patrick.rudolph@9elements.com>

The newly introduced ICH9 SPI MTD controller creates the BIOS
region itself as it needs to update the mmaped BIOS region as
well when the MTD device is updated though the SPI controller.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
 hw/i386/pc_sysfw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index c8d9e71b88..b98077422c 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -211,6 +211,12 @@ void pc_system_firmware_init(PCMachineState *pcms,
         x86_bios_rom_init(MACHINE(pcms), "bios.bin", rom_memory, true);
         return;
     }
+    DriveInfo *dinfo = drive_get(IF_MTD, 0, 0);
+    if (dinfo) {
+        /* SPI flash and BIOS will be emulated by MTD controller */
+        pc_system_flash_cleanup_unused(pcms);
+        return;
+    }
 
     /* Map legacy -drive if=pflash to machine properties */
     for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) {
-- 
2.41.0



  parent reply	other threads:[~2023-10-18 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 11:52 [PATCH 0/3] hw/i386: Add MTD controller on ICH9 Patrick Rudolph
2023-10-18 11:52 ` [PATCH 1/3] hw/isa/ich9: Add SPI controller Patrick Rudolph
2023-10-18 11:52 ` [PATCH 2/3] hw/isa/lpc_ich9: Implement SMI_STS for APMC Patrick Rudolph
2023-10-18 11:52 ` Patrick Rudolph [this message]
2023-10-18 13:47 ` [PATCH 0/3] hw/i386: Add MTD controller on ICH9 Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231018115231.3547102-4-patrick.rudolph@9elements.com \
    --to=patrick.rudolph@9elements.com \
    --cc=anisinha@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=imammedo@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).