[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [Patch v3 13/30] s390x/sclp: factor out preparation of cpu
From: |
David Hildenbrand |
Subject: |
[Qemu-devel] [Patch v3 13/30] s390x/sclp: factor out preparation of cpu entries |
Date: |
Wed, 24 Aug 2016 20:10:49 +0200 |
Let's factor out the common code of "read cpu info" and "read scp
info". This will make the introduction of new cpu entry fields easier.
Acked-by: Cornelia Huck <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/s390x/sclp.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index fca37f5..15d7114 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -29,6 +29,16 @@ static inline SCLPDevice *get_sclp_device(void)
return SCLP(object_resolve_path_type("", TYPE_SCLP, NULL));
}
+static void prepare_cpu_entries(SCLPDevice *sclp, CPUEntry *entry, int count)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ entry[i].address = i;
+ entry[i].type = 0;
+ }
+}
+
/* Provide information about the configuration, CPUs and storage */
static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
{
@@ -37,7 +47,6 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
CPUState *cpu;
int cpu_count = 0;
- int i = 0;
int rnsize, rnmax;
int slots = MIN(machine->ram_slots, s390_get_memslot_count(kvm_state));
@@ -50,10 +59,7 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
read_info->offset_cpu = cpu_to_be16(offsetof(ReadInfo, entries));
read_info->highest_cpu = cpu_to_be16(max_cpus);
- for (i = 0; i < cpu_count; i++) {
- read_info->entries[i].address = i;
- read_info->entries[i].type = 0;
- }
+ prepare_cpu_entries(sclp, read_info->entries, cpu_count);
read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO |
SCLP_HAS_PCI_RECONFIG);
@@ -304,7 +310,6 @@ static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *sccb)
ReadCpuInfo *cpu_info = (ReadCpuInfo *) sccb;
CPUState *cpu;
int cpu_count = 0;
- int i = 0;
CPU_FOREACH(cpu) {
cpu_count++;
@@ -318,10 +323,7 @@ static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB
*sccb)
cpu_info->offset_standby = cpu_to_be16(cpu_info->offset_configured
+ cpu_info->nr_configured*sizeof(CPUEntry));
- for (i = 0; i < cpu_count; i++) {
- cpu_info->entries[i].address = i;
- cpu_info->entries[i].type = 0;
- }
+ prepare_cpu_entries(sclp, cpu_info->entries, cpu_count);
sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
}
--
2.6.6
- [Qemu-devel] [Patch v3 01/30] qmp: details about CPU definitions in query-cpu-definitions, (continued)
- [Qemu-devel] [Patch v3 01/30] qmp: details about CPU definitions in query-cpu-definitions, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 23/30] s390x/kvm: let the CPU model control CMM(A), David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 15/30] s390x/sclp: indicate sclp features, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 19/30] linux-headers: update against kvm/next, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 05/30] s390x/cpumodel: generate CPU feature lists for CPU models, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 14/30] s390x/sclp: introduce sclp feature blocks, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 10/30] s390x/cpumodel: expose features and feature groups as properties, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 07/30] s390x/cpumodel: introduce CPU feature group definitions, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 04/30] s390x/cpumodel: introduce CPU features, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 12/30] s390x/cpumodel: check and apply the CPU model, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 13/30] s390x/sclp: factor out preparation of cpu entries,
David Hildenbrand <=
- [Qemu-devel] [Patch v3 22/30] s390x/kvm: disable host model for problematic compat machines, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 02/30] s390x/cpumodel: "host" and "qemu" as CPU subclasses, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 28/30] s390x/cpumodel: implement QMP interface "query-cpu-model-expansion", David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 29/30] s390x/cpumodel: implement QMP interface "query-cpu-model-comparison", David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 17/30] s390x/sclp: propagate the mha via sclp, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 11/30] s390x/cpumodel: let the CPU model handle feature checks, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 30/30] s390x/cpumodel: implement QMP interface "query-cpu-model-baseline", David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 03/30] s390x/cpumodel: expose CPU class properties, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 18/30] s390x/sclp: propagate hmfai, David Hildenbrand, 2016/08/24
- [Qemu-devel] [Patch v3 08/30] s390x/cpumodel: register defined CPU models as subclasses, David Hildenbrand, 2016/08/24