yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 9ac777bc498f6be28cab47c96a1f0822b5a01868 Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <9ac777bc498f6be28cab47c96a1f0822b5a01868.1387298827.git.minovotn@redhat.com>
9ae3a8
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
9ae3a8
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
9ae3a8
From: "Michael S. Tsirkin" <mst@redhat.com>
9ae3a8
Date: Tue, 17 Dec 2013 15:18:44 +0100
9ae3a8
Subject: [PATCH 39/56] i386: define pc guest info
9ae3a8
9ae3a8
RH-Author: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Message-id: <1387293161-4085-40-git-send-email-mst@redhat.com>
9ae3a8
Patchwork-id: 56345
9ae3a8
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 39/57] i386: define pc guest info
9ae3a8
Bugzilla: 1034876
9ae3a8
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
This defines a structure that will be used to fill in acpi tables
9ae3a8
where relevant properties are not yet available using QOM.
9ae3a8
9ae3a8
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
Tested-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
(cherry picked from commit b20c9bd5f6d8860856f6078836d197c6c2e27ef1)
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	include/hw/i386/pc.h
9ae3a8
---
9ae3a8
 include/hw/i386/pc.h |  9 +++++++++
9ae3a8
 hw/i386/pc.c         | 21 +++++++++++++++++++++
9ae3a8
 2 files changed, 30 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/pc.c         | 21 +++++++++++++++++++++
9ae3a8
 include/hw/i386/pc.h |  9 +++++++++
9ae3a8
 2 files changed, 30 insertions(+)
9ae3a8
9ae3a8
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
9ae3a8
index e5ebd52..4d54c0b 100644
9ae3a8
--- a/hw/i386/pc.c
9ae3a8
+++ b/hw/i386/pc.c
9ae3a8
@@ -1042,6 +1042,27 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
9ae3a8
 {
9ae3a8
     PcGuestInfoState *guest_info_state = g_malloc0(sizeof *guest_info_state);
9ae3a8
     PcGuestInfo *guest_info = &guest_info_state->info;
9ae3a8
+    int i, j;
9ae3a8
+
9ae3a8
+    guest_info->ram_size = below_4g_mem_size + above_4g_mem_size;
9ae3a8
+    guest_info->apic_id_limit = pc_apic_id_limit(max_cpus);
9ae3a8
+    guest_info->apic_xrupt_override = kvm_allows_irq0_override();
9ae3a8
+    guest_info->numa_nodes = nb_numa_nodes;
9ae3a8
+    guest_info->node_mem = g_memdup(node_mem, guest_info->numa_nodes *
9ae3a8
+                                    sizeof *guest_info->node_mem);
9ae3a8
+    guest_info->node_cpu = g_malloc0(guest_info->apic_id_limit *
9ae3a8
+                                     sizeof *guest_info->node_cpu);
9ae3a8
+
9ae3a8
+    for (i = 0; i < max_cpus; i++) {
9ae3a8
+        unsigned int apic_id = x86_cpu_apic_id_from_index(i);
9ae3a8
+        assert(apic_id < guest_info->apic_id_limit);
9ae3a8
+        for (j = 0; j < nb_numa_nodes; j++) {
9ae3a8
+            if (test_bit(i, node_cpumask[j])) {
9ae3a8
+                guest_info->node_cpu[apic_id] = j;
9ae3a8
+                break;
9ae3a8
+            }
9ae3a8
+        }
9ae3a8
+    }
9ae3a8
 
9ae3a8
     guest_info_state->machine_done.notify = pc_guest_info_machine_done;
9ae3a8
     qemu_add_machine_init_done_notifier(&guest_info_state->machine_done);
9ae3a8
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
9ae3a8
index abaaf93..ec91fae 100644
9ae3a8
--- a/include/hw/i386/pc.h
9ae3a8
+++ b/include/hw/i386/pc.h
9ae3a8
@@ -11,6 +11,9 @@
9ae3a8
 #include "hw/i386/ioapic.h"
9ae3a8
 
9ae3a8
 #include "qemu/range.h"
9ae3a8
+#include "qemu/bitmap.h"
9ae3a8
+#include "sysemu/sysemu.h"
9ae3a8
+#include "hw/pci/pci.h"
9ae3a8
 
9ae3a8
 /* PC-style peripherals (also used by other machines).  */
9ae3a8
 
9ae3a8
@@ -21,6 +24,12 @@ typedef struct PcPciInfo {
9ae3a8
 
9ae3a8
 struct PcGuestInfo {
9ae3a8
     bool has_pci_info;
9ae3a8
+    hwaddr ram_size;
9ae3a8
+    unsigned apic_id_limit;
9ae3a8
+    bool apic_xrupt_override;
9ae3a8
+    uint64_t numa_nodes;
9ae3a8
+    uint64_t *node_mem;
9ae3a8
+    uint64_t *node_cpu;
9ae3a8
     FWCfgState *fw_cfg;
9ae3a8
 };
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.11.7
9ae3a8