qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	pbonzini@redhat.com, mst@redhat.com, marcel.apfelbaum@gmail.com,
	eduardo@habkost.net, imammedo@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v4 18/18] hw/i386/isapc.c: replace rom_memory with system_memory
Date: Thu, 10 Jul 2025 16:35:06 +0100	[thread overview]
Message-ID: <6e04c7fc-f390-4245-be27-f5f37924943e@nutanix.com> (raw)
In-Reply-To: <695cf9b8-3e5e-4560-9847-688917796648@linaro.org>

On 10/07/2025 12:05, Philippe Mathieu-Daudé wrote:

> On 10/7/25 12:53, Philippe Mathieu-Daudé wrote:
>> On 10/7/25 10:52, Mark Cave-Ayland wrote:
>>> Now that we can guarantee the isapc machine will never have a PCI 
>>> bus, any
>>> instances of rom_memory can be replaced by system_memory and rom_memory
>>> removed completely.
>>>
>>> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
>>> ---
>>>   hw/i386/isapc.c | 3 +--
>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/hw/i386/isapc.c b/hw/i386/isapc.c
>>> index bb22083821..27c075b5f3 100644
>>> --- a/hw/i386/isapc.c
>>> +++ b/hw/i386/isapc.c
>>> @@ -35,7 +35,6 @@ static void pc_init_isa(MachineState *machine)
>>>       ISABus *isa_bus;
>>>       GSIState *gsi_state;
>>>       MemoryRegion *ram_memory;
>>> -    MemoryRegion *rom_memory = system_memory;
>>>       DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
>>>       uint32_t irq;
>>>       int i;
>>> @@ -73,7 +72,7 @@ static void pc_init_isa(MachineState *machine)
>>>       /* allocate ram and load rom/bios */
>>>       if (!xen_enabled()) {
>>> -        pc_memory_init(pcms, system_memory, rom_memory, 0);
>>> +        pc_memory_init(pcms, system_memory, system_memory, 0);
>>
>> I'd prefer just call here:
>>
>>    x86_bios_rom_init(X86_MACHINE(pcms), "bios.bin", rom_memory, true);
>>
>> and in pc_system_firmware_init(): assert(pcmc->pci_enabled).
>>
>> WDYT?
> 
> What I have in mind (untested):
> 
> -- >8 --
> diff --git a/hw/i386/isapc.c b/hw/i386/isapc.c
> index 27c075b5f32..a7c2146916c 100644
> --- a/hw/i386/isapc.c
> +++ b/hw/i386/isapc.c
> @@ -74,3 +74,4 @@ static void pc_init_isa(MachineState *machine)
>       if (!xen_enabled()) {
> -        pc_memory_init(pcms, system_memory, system_memory, 0);
> +        pc_memory_init(pcms, system_memory, NULL, 0);
> +        x86_bios_rom_init(X86_MACHINE(pcms), "bios.bin", system_memory, 
> true);
>       } else {
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index b2116335752..2952d3ee4ff 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -811,3 +811,3 @@ void pc_memory_init(PCMachineState *pcms,
>                       MemoryRegion *system_memory,
> -                    MemoryRegion *rom_memory,
> +                    MemoryRegion *pci_memory,
>                       uint64_t pci_hole64_size)
> @@ -826,2 +826,3 @@ void pc_memory_init(PCMachineState *pcms,
> 
> +    assert(pcmc->pci_enabled ^ !!pci_memory);
>       assert(machine->ram_size == x86ms->below_4g_mem_size +
> @@ -955,3 +956,5 @@ void pc_memory_init(PCMachineState *pcms,
>       /* Initialize PC system firmware */
> -    pc_system_firmware_init(pcms, rom_memory);
> +    if (pcmc->pci_enabled) {
> +        pc_system_firmware_init(pcms, pci_memory);
> +    }
> 
> @@ -969,3 +972,3 @@ void pc_memory_init(PCMachineState *pcms,
>           }
> -        memory_region_add_subregion_overlap(rom_memory,
> +        memory_region_add_subregion_overlap(pci_memory,
>                                               PC_ROM_MIN_VGA,
> diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
> index 821396c16e9..0c29e4188fc 100644
> --- a/hw/i386/pc_sysfw.c
> +++ b/hw/i386/pc_sysfw.c
> @@ -221,6 +221,3 @@ void pc_system_firmware_init(PCMachineState *pcms,
> 
> -    if (!pcmc->pci_enabled) {
> -        x86_bios_rom_init(X86_MACHINE(pcms), "bios.bin", rom_memory, 
> true);
> -        return;
> -    }
> +    assert(pcmc->pci_enabled);

I think that's a good idea, however the original aim of this series was 
just to do the basic split and tidy-up work (hopefully in time for 10.1).

There is certainly more tidy-up that is possible w.r.t. pc.c, but I 
didn't want to start unraveling that thread right now for fear of this 
series getting too large :/


ATB,

Mark.



  reply	other threads:[~2025-07-10 15:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10  8:52 [PATCH v4 00/18] hw/i386: separate isapc out from pc_piix Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 01/18] hw/i386/pc_piix.c: restrict isapc machine to 32-bit CPUs Mark Cave-Ayland
2025-07-10 10:46   ` Philippe Mathieu-Daudé
2025-07-10 15:28     ` Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 02/18] hw/i386/pc_piix.c: remove include for loader.h Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 03/18] hw/i386/pc_piix.c: duplicate pc_init1() into pc_isa_init() Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 04/18] hw/i386/pc_piix.c: remove pcmc->pci_enabled dependent initialisation from pc_init_isa() Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 05/18] hw/i386/pc_piix.c: remove SMI and piix4_pm " Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 06/18] hw/i386/pc_piix.c: remove SGX " Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 07/18] hw/i386/pc_piix.c: remove nvdimm " Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 08/18] hw/i386/pc_piix.c: simplify RAM size logic in pc_init_isa() Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 09/18] hw/i386/pc_piix.c: hardcode hole64_size to 0 " Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 10/18] hw/i386/pc_piix.c: remove pc_system_flash_cleanup_unused() from pc_init_isa() Mark Cave-Ayland
2025-07-10 10:47   ` Philippe Mathieu-Daudé
2025-07-10  8:52 ` [PATCH v4 11/18] hw/i386/pc_piix.c: always initialise ISA IDE drives in pc_init_isa() Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 12/18] hw/i386/pc_piix.c: assume pcmc->pci_enabled is always false " Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 13/18] hw/i386/pc_piix.c: hardcode pcms->pci_bus to NULL " Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 14/18] hw/i386/pc_piix.c: assume pcmc->pci_enabled is always true in pc_init1() Mark Cave-Ayland
2025-07-10 10:48   ` Philippe Mathieu-Daudé
2025-07-10  8:52 ` [PATCH v4 15/18] hw/i386: move isapc machine to separate isapc.c file Mark Cave-Ayland
2025-07-10  8:52 ` [PATCH v4 16/18] hw/i386/pc_piix.c: remove unused headers after isapc machine split Mark Cave-Ayland
2025-07-10 10:50   ` Philippe Mathieu-Daudé
2025-07-10  8:52 ` [PATCH v4 17/18] hw/i386/pc_piix.c: replace rom_memory with pci_memory Mark Cave-Ayland
2025-07-10 10:49   ` Philippe Mathieu-Daudé
2025-07-10  8:52 ` [PATCH v4 18/18] hw/i386/isapc.c: replace rom_memory with system_memory Mark Cave-Ayland
2025-07-10 10:53   ` Philippe Mathieu-Daudé
2025-07-10 11:05     ` Philippe Mathieu-Daudé
2025-07-10 15:35       ` Mark Cave-Ayland [this message]
2025-07-11 10:28         ` Philippe Mathieu-Daudé

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=6e04c7fc-f390-4245-be27-f5f37924943e@nutanix.com \
    --to=mark.caveayland@nutanix.com \
    --cc=eduardo@habkost.net \
    --cc=imammedo@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.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).