[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC 11/13] pc: pass PCI hole ranges to Guests
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PATCH RFC 11/13] pc: pass PCI hole ranges to Guests |
Date: |
Mon, 13 May 2013 23:01:34 +0300 |
Guest currently has to jump through lots of hoops to guess the PCI hole
ranges. It's fragile, and makes us change BIOS each time we add a new
chipset. Let's report the window in a ROM file, to make BIOS do exactly
what QEMU intends.
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/i386/pc.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 203c683..68d2610 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -997,6 +997,26 @@ static void pc_set_cpu_guest_info(CPUState *cpu, void *arg)
}
}
+/* pci-info ROM file. Little endian format */
+typedef struct PcRomPciInfo {
+ uint64_t w32_min;
+ uint64_t w32_max;
+ uint64_t w64_min;
+ uint64_t w64_max;
+} PcRomPciInfo;
+
+static void pc_fw_cfg_guest_info(PcGuestInfo *guest_info)
+{
+ PcRomPciInfo *info = g_malloc(sizeof *info);
+ info->w32_min = cpu_to_le64(guest_info->pci_info.w32.begin);
+ info->w32_max = cpu_to_le64(guest_info->pci_info.w32.end);
+ info->w64_min = cpu_to_le64(guest_info->pci_info.w64.begin);
+ info->w64_max = cpu_to_le64(guest_info->pci_info.w64.end);
+ /* Pass PCI hole info to guest via a side channel.
+ * Required so guest PCI enumeration does the right thing. */
+ fw_cfg_add_file(guest_info->fw_cfg, "etc/pci-info", info, sizeof *info);
+}
+
typedef struct PcGuestInfoState {
PcGuestInfo info;
Notifier machine_done;
@@ -1008,6 +1028,7 @@ void pc_guest_info_machine_done(Notifier *notifier, void
*data)
PcGuestInfoState *guest_info_state = container_of(notifier,
PcGuestInfoState,
machine_done);
+ pc_fw_cfg_guest_info(&guest_info_state->info);
}
PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
--
MST
- [Qemu-devel] [PATCH RFC 08/13] range: add Range structure, (continued)
- [Qemu-devel] [PATCH RFC 08/13] range: add Range structure, Michael S. Tsirkin, 2013/05/13
- [Qemu-devel] [PATCH RFC 13/13] pc: reuse guest info for legacy fw cfg, Michael S. Tsirkin, 2013/05/13
- [Qemu-devel] [PATCH RFC 09/13] i386: add bios linker/loader, Michael S. Tsirkin, 2013/05/13
- [Qemu-devel] [PATCH RFC 07/13] acpi: pre-compiled ASL files, Michael S. Tsirkin, 2013/05/13
- [Qemu-devel] [PATCH RFC 10/13] i386: generate pc guest info, Michael S. Tsirkin, 2013/05/13
- [Qemu-devel] [PATCH RFC 11/13] pc: pass PCI hole ranges to Guests,
Michael S. Tsirkin <=
- [Qemu-devel] [PATCH RFC 12/13] i386: ACPI table generation code from seabios, Michael S. Tsirkin, 2013/05/13
- Re: [Qemu-devel] [PATCH RFC 00/13] qemu: generate acpi tables for the guest, Anthony Liguori, 2013/05/13
- Re: [Qemu-devel] [PATCH RFC 00/13] qemu: generate acpi tables for the guest, Anthony Liguori, 2013/05/14
- Re: [Qemu-devel] [PATCH RFC 00/13] qemu: generate acpi tables for the guest, Gerd Hoffmann, 2013/05/14