* [PATCH] hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled
@ 2024-02-13 4:19 Philippe Mathieu-Daudé
2024-02-13 18:03 ` Richard Henderson
2024-02-15 17:52 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-13 4:19 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Eduardo Habkost, Bernhard Beschow,
Marcel Apfelbaum, Paolo Bonzini, Michael S. Tsirkin,
Philippe Mathieu-Daudé
We can not create the Q35 machine without PCI, so simplify
pc_q35_init() removing pointless checks.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/pc_q35.c | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 7ca3f465e0..5923621845 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -130,8 +130,7 @@ static void pc_q35_init(MachineState *machine)
ISADevice *rtc_state;
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *system_io = get_system_io();
- MemoryRegion *pci_memory;
- MemoryRegion *rom_memory;
+ MemoryRegion *pci_memory = g_new(MemoryRegion, 1);
GSIState *gsi_state;
ISABus *isa_bus;
int i;
@@ -143,6 +142,8 @@ static void pc_q35_init(MachineState *machine)
bool keep_pci_slot_hpc;
uint64_t pci_hole64_size = 0;
+ assert(pcmc->pci_enabled);
+
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
* and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
* also known as MMCFG).
@@ -189,16 +190,6 @@ static void pc_q35_init(MachineState *machine)
kvmclock_create(pcmc->kvmclock_create_always);
}
- /* pci enabled */
- if (pcmc->pci_enabled) {
- pci_memory = g_new(MemoryRegion, 1);
- memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
- rom_memory = pci_memory;
- } else {
- pci_memory = NULL;
- rom_memory = system_memory;
- }
-
pc_guest_info_init(pcms);
if (pcmc->smbios_defaults) {
@@ -212,14 +203,13 @@ static void pc_q35_init(MachineState *machine)
/* create pci host bus */
phb = OBJECT(qdev_new(TYPE_Q35_HOST_DEVICE));
- if (pcmc->pci_enabled) {
- pci_hole64_size = object_property_get_uint(phb,
- PCI_HOST_PROP_PCI_HOLE64_SIZE,
- &error_abort);
- }
+ pci_hole64_size = object_property_get_uint(phb,
+ PCI_HOST_PROP_PCI_HOLE64_SIZE,
+ &error_abort);
/* allocate ram and load rom/bios */
- pc_memory_init(pcms, system_memory, rom_memory, pci_hole64_size);
+ memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
+ pc_memory_init(pcms, system_memory, pci_memory, pci_hole64_size);
object_property_add_child(OBJECT(machine), "q35", phb);
object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM,
@@ -243,7 +233,7 @@ static void pc_q35_init(MachineState *machine)
pcms->bus = host_bus;
/* irq lines */
- gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled);
+ gsi_state = pc_gsi_create(&x86ms->gsi, true);
/* create ISA bus */
lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC),
@@ -286,9 +276,7 @@ static void pc_q35_init(MachineState *machine)
pc_i8259_create(isa_bus, gsi_state->i8259_irq);
}
- if (pcmc->pci_enabled) {
- ioapic_init_gsi(gsi_state, "q35");
- }
+ ioapic_init_gsi(gsi_state, "q35");
if (tcg_enabled()) {
x86_register_ferr_irq(x86ms->gsi[13]);
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled
2024-02-13 4:19 [PATCH] hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled Philippe Mathieu-Daudé
@ 2024-02-13 18:03 ` Richard Henderson
2024-02-15 17:52 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2024-02-13 18:03 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Eduardo Habkost, Bernhard Beschow, Marcel Apfelbaum,
Paolo Bonzini, Michael S. Tsirkin
On 2/12/24 18:19, Philippe Mathieu-Daudé wrote:
> We can not create the Q35 machine without PCI, so simplify
> pc_q35_init() removing pointless checks.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/i386/pc_q35.c | 32 ++++++++++----------------------
> 1 file changed, 10 insertions(+), 22 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled
2024-02-13 4:19 [PATCH] hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled Philippe Mathieu-Daudé
2024-02-13 18:03 ` Richard Henderson
@ 2024-02-15 17:52 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-15 17:52 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Eduardo Habkost, Bernhard Beschow,
Marcel Apfelbaum, Paolo Bonzini, Michael S. Tsirkin
On 13/2/24 05:19, Philippe Mathieu-Daudé wrote:
> We can not create the Q35 machine without PCI, so simplify
> pc_q35_init() removing pointless checks.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/i386/pc_q35.c | 32 ++++++++++----------------------
> 1 file changed, 10 insertions(+), 22 deletions(-)
Patch queued.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-15 17:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-13 4:19 [PATCH] hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled Philippe Mathieu-Daudé
2024-02-13 18:03 ` Richard Henderson
2024-02-15 17:52 ` Philippe Mathieu-Daudé
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).