diff --git a/Fixed-the-issue-where-qemu-specifies-the-boot-order.patch b/Fixed-the-issue-where-qemu-specifies-the-boot-order.patch new file mode 100644 index 0000000000000000000000000000000000000000..9dc0afd025c7aae8aac71c6b8ccb7166dbb9941a --- /dev/null +++ b/Fixed-the-issue-where-qemu-specifies-the-boot-order.patch @@ -0,0 +1,144 @@ +From 6a12ae43ce56fea2e7b365b4c7fb26aec44efa06 Mon Sep 17 00:00:00 2001 +From: lixianglai +Date: Wed, 23 Aug 2023 07:10:25 -0400 +Subject: [PATCH] Fixed the issue where qemu specifies the boot order + +Fixed the issue that the device path of bootorder +in the generated fw_cfg was abnormal because the +PCIeHost device did not initialize the memory space +of sysbus, which caused the QEMU boot order to not +take effect. + +Change-Id: Ifde4c8b8432c5c8748c1b38a3c33bafef4f24083 +Signed-off-by: lixianglai +--- + hw/loongarch/larch_3a.c | 16 ---------------- + hw/loongarch/ls7a_nb.c | 33 +++++++++++++++++++++++++++++---- + include/hw/loongarch/larch.h | 6 ++++++ + include/hw/loongarch/ls7a.h | 2 ++ + 4 files changed, 37 insertions(+), 20 deletions(-) + +diff --git a/hw/loongarch/larch_3a.c b/hw/loongarch/larch_3a.c +index 95bb224664..cd82e898ae 100644 +--- a/hw/loongarch/larch_3a.c ++++ b/hw/loongarch/larch_3a.c +@@ -81,12 +81,6 @@ + + #define TARGET_REALPAGE_MASK (TARGET_PAGE_MASK << 2) + +-#ifdef CONFIG_KVM +-#define LS_ISA_IO_SIZE 0x02000000 +-#else +-#define LS_ISA_IO_SIZE 0x00010000 +-#endif +- + #ifdef CONFIG_KVM + #define align(x) (((x) + 63) & ~63) + #else +@@ -1623,8 +1617,6 @@ static void ls3a5k_init(MachineState *args) + ram_addr_t ram_size = args->ram_size; + MemoryRegion *address_space_mem = get_system_memory(); + ram_addr_t offset = 0; +- MemoryRegion *isa_io = g_new(MemoryRegion, 1); +- MemoryRegion *isa_mem = g_new(MemoryRegion, 1); + MachineState *machine = args; + MachineClass *mc = MACHINE_GET_CLASS(machine); + LoongarchMachineState *lsms = LoongarchMACHINE(machine); +@@ -1802,14 +1794,6 @@ static void ls3a5k_init(MachineState *args) + &machine->device_memory->mr); + } + +- memory_region_init_alias(isa_io, NULL, "isa-io", get_system_io(), 0, +- LS_ISA_IO_SIZE); +- memory_region_init(isa_mem, NULL, "isa-mem", PCIE_MEMORY_SIZE); +- memory_region_add_subregion(get_system_memory(), lsmc->isa_io_base, +- isa_io); +- memory_region_add_subregion(get_system_memory(), PCIE_MEMORY_BASE, +- isa_mem); +- + if (!strcmp(lsmc->bridge_name, "ls7a")) { + /*Initialize the 7A IO interrupt subsystem*/ + DeviceState *ls7a_dev; +diff --git a/hw/loongarch/ls7a_nb.c b/hw/loongarch/ls7a_nb.c +index 933b3f2869..7a3613bf56 100644 +--- a/hw/loongarch/ls7a_nb.c ++++ b/hw/loongarch/ls7a_nb.c +@@ -148,16 +148,41 @@ static PCIBus *pci_ls7a_init(MachineState *machine, DeviceState *dev, + { + LoongarchMachineState *lsms = LoongarchMACHINE(machine); + LoongarchMachineClass *lsmc = LoongarchMACHINE_GET_CLASS(lsms); ++ LS7APCIEHost *pciehost = LS7A_PCIE_HOST_BRIDGE(dev); + PCIExpressHost *e; ++ SysBusDevice *sysbus; + PCIHostState *phb; ++ MemoryRegion *mmio_alias; + + e = PCIE_HOST_BRIDGE(dev); ++ sysbus = SYS_BUS_DEVICE(e); + phb = PCI_HOST_BRIDGE(e); +- phb->bus = pci_register_root_bus( +- dev, "pcie.0", pci_ls7a_set_irq, pci_ls7a_map_irq, pic, +- get_system_memory(), get_system_io(), (1 << 3), 128, TYPE_PCIE_BUS); ++ ++ sysbus_init_mmio(sysbus, &e->mmio); ++ ++ memory_region_init(&pciehost->io_mmio, OBJECT(pciehost), ++ "pciehost-mmio", UINT64_MAX); ++ sysbus_init_mmio(sysbus, &pciehost->io_mmio); ++ mmio_alias = g_new0(MemoryRegion, 1); ++ memory_region_init_alias(mmio_alias, OBJECT(dev), "pcie-mmio", ++ &pciehost->io_mmio, PCIE_MEMORY_BASE, ++ PCIE_MEMORY_SIZE); ++ memory_region_add_subregion(get_system_memory(), ++ PCIE_MEMORY_BASE, mmio_alias); ++ ++ memory_region_init(&pciehost->io_ioport, OBJECT(pciehost), ++ "pciehost-ioport", LS_ISA_IO_SIZE); ++ sysbus_init_mmio(sysbus, &pciehost->io_ioport); ++ ++ sysbus_mmio_map(sysbus, 2, LS3A5K_ISA_IO_BASE); ++ ++ ++ phb->bus = pci_register_root_bus(dev, "pcie.0", pci_ls7a_set_irq, ++ pci_ls7a_map_irq, pic, ++ &pciehost->io_mmio, &pciehost->io_ioport, ++ (1 << 3), 128, TYPE_PCIE_BUS); ++ /*update pcie config memory*/ + pcie_host_mmcfg_update(e, true, lsmc->pciecfg_base, LS_PCIECFG_SIZE); +- DPRINTF("------ %d\n", __LINE__); + + pci_bus_set_route_irq_fn(phb->bus, ls7a_route_intx_pin_to_irq); + +diff --git a/include/hw/loongarch/larch.h b/include/hw/loongarch/larch.h +index a9f8dea9f5..a401892844 100644 +--- a/include/hw/loongarch/larch.h ++++ b/include/hw/loongarch/larch.h +@@ -40,6 +40,12 @@ + #define LOONGARCH_HOTPLUG_MEM_ALIGN (1ULL << 28) + #define LOONGARCH_MAX_RAM_SLOTS 10 + ++#ifdef CONFIG_KVM ++#define LS_ISA_IO_SIZE 0x02000000 ++#else ++#define LS_ISA_IO_SIZE 0x00010000 ++#endif ++ + /* Memory types: */ + #define SYSTEM_RAM 1 + #define SYSTEM_RAM_RESERVED 2 +diff --git a/include/hw/loongarch/ls7a.h b/include/hw/loongarch/ls7a.h +index e1f3c8d032..31165cb877 100644 +--- a/include/hw/loongarch/ls7a.h ++++ b/include/hw/loongarch/ls7a.h +@@ -140,6 +140,8 @@ + typedef struct LS7APCIState LS7APCIState; + typedef struct LS7APCIEHost { + PCIExpressHost parent_obj; ++ MemoryRegion io_ioport; ++ MemoryRegion io_mmio; + LS7APCIState *pci_dev; + } LS7APCIEHost; + +-- +2.27.0 + diff --git a/qemu.spec b/qemu.spec index 59d59b9e35051ca3ec15d452fde05b6bffb4b36e..16a67d9da37e9367ea6322a048e5c8e0966eb50f 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 6.2.0 -Release: 74 +Release: 75 Epoch: 10 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -543,6 +543,7 @@ Patch0531: qga-Fix-suspend-on-Linux-guests-without-systemd.patch Patch0532: vhost-vdpa-do-not-cleanup-the-vdpa-vhost-net-structu.patch Patch0533: virtio-crypto-verify-src-dst-buffer-length-for-sym-r.patch Patch0534: sw_64-Added-sw64-architecture-related-updates.patch +Patch0535: Fixed-the-issue-where-qemu-specifies-the-boot-order.patch BuildRequires: flex BuildRequires: gcc @@ -1099,6 +1100,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Thu Aug 24 2023 - 10:6.2.0-75 +- loongarch: Fixed the issue where qemu specifies the boot order + * Tue Aug 15 2023 - 10:6.2.0-74 - sw_64: Added sw64 architecture related updates - virtio-crypto: verify src&dst buffer length for sym request