cryptospore / rpms / qemu-kvm

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