[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 12/39] hw/riscv/virt.c: reduce virt_use_kvm_aia() usage
From: |
Alistair Francis |
Subject: |
[PULL v2 12/39] hw/riscv/virt.c: reduce virt_use_kvm_aia() usage |
Date: |
Fri, 20 Dec 2024 11:54:12 +1000 |
From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
In create_fdt_sockets() we have the following pattern:
if (kvm_enabled() && virt_use_kvm_aia(s)) {
(... do stuff ...)
} else {
(... do other stuff ...)
}
if (kvm_enabled() && virt_use_kvm_aia(s)) {
(... do more stuff ...)
} else {
(... do more other stuff)
}
Do everything in a single if/else clause to reduce the usage of
virt_use_kvm_aia() helper and to make the code a bit less repetitive.
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20241119191706.718860-3-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
hw/riscv/virt.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 5d058511be..e54e1257c0 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -783,6 +783,10 @@ static void create_fdt_sockets(RISCVVirtState *s, const
MemMapEntry *memmap,
msi_m_phandle, msi_s_phandle, phandle,
&intc_phandles[0], xplic_phandles,
ms->smp.cpus);
+
+ *irq_mmio_phandle = xplic_phandles[0];
+ *irq_virtio_phandle = xplic_phandles[0];
+ *irq_pcie_phandle = xplic_phandles[0];
} else {
phandle_pos = ms->smp.cpus;
for (socket = (socket_count - 1); socket >= 0; socket--) {
@@ -800,13 +804,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const
MemMapEntry *memmap,
s->soc[socket].num_harts);
}
}
- }
- if (kvm_enabled() && virt_use_kvm_aia(s)) {
- *irq_mmio_phandle = xplic_phandles[0];
- *irq_virtio_phandle = xplic_phandles[0];
- *irq_pcie_phandle = xplic_phandles[0];
- } else {
for (socket = 0; socket < socket_count; socket++) {
if (socket == 0) {
*irq_mmio_phandle = xplic_phandles[socket];
--
2.47.1
- [PULL v2 04/39] hw/riscv/riscv-iommu: parametrize CAP.IGS, (continued)
- [PULL v2 04/39] hw/riscv/riscv-iommu: parametrize CAP.IGS, Alistair Francis, 2024/12/19
- [PULL v2 05/39] hw/riscv: add riscv-iommu-sys platform device, Alistair Francis, 2024/12/19
- [PULL v2 06/39] hw/riscv/virt: Add IOMMU as platform device if the option is set, Alistair Francis, 2024/12/19
- [PULL v2 07/39] hw/riscv/virt.c, riscv-iommu-sys.c: add MSIx support, Alistair Francis, 2024/12/19
- [PULL v2 08/39] hw/riscv/riscv-iommu: implement reset protocol, Alistair Francis, 2024/12/19
- [PULL v2 09/39] docs/specs: add riscv-iommu-sys information, Alistair Francis, 2024/12/19
- [PULL v2 10/39] target/riscv: Add Tenstorrent Ascalon CPU, Alistair Francis, 2024/12/19
- [PULL v2 13/39] hw/riscv/virt.c: rename helper to virt_use_kvm_aia_aplic_imsic(), Alistair Francis, 2024/12/19
- [PULL v2 15/39] hw/riscv/virt.c, riscv_aplic.c: add 'emulated_aplic' helpers, Alistair Francis, 2024/12/19
- [PULL v2 11/39] hw/intc/riscv_aplic: rename is_kvm_aia(), Alistair Francis, 2024/12/19
- [PULL v2 12/39] hw/riscv/virt.c: reduce virt_use_kvm_aia() usage,
Alistair Francis <=
- [PULL v2 14/39] target/riscv/kvm: consider irqchip_split() in aia_create(), Alistair Francis, 2024/12/19
- [PULL v2 17/39] target/riscv/kvm: remove irqchip_split() restriction, Alistair Francis, 2024/12/19
- [PULL v2 16/39] hw/intc/riscv_aplic: add kvm_msicfgaddr for split mode aplic-imsic, Alistair Francis, 2024/12/19
- [PULL v2 18/39] docs: update riscv/virt.rst with kernel-irqchip=split support, Alistair Francis, 2024/12/19
- [PULL v2 19/39] hw/riscv: Add Microblaze V generic board, Alistair Francis, 2024/12/19
- [PULL v2 20/39] qtest: allow SPCR acpi table changes, Alistair Francis, 2024/12/19
- [PULL v2 21/39] hw/acpi: Upgrade ACPI SPCR table to support SPCR table revision 4 format, Alistair Francis, 2024/12/19
- [PULL v2 22/39] tests/qtest/bios-tables-test: Update virt SPCR golden reference for RISC-V, Alistair Francis, 2024/12/19
- [PULL v2 24/39] hw/char/riscv_htif: Explicit little-endian implementation, Alistair Francis, 2024/12/19
- [PULL v2 29/39] target/riscv: Add svukte extension capability variable, Alistair Francis, 2024/12/19