diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2013-03-23 11:38:45 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2013-03-23 11:38:45 -0400 |
commit | fb76cff0c95e3e3d449b41d2728f4f50dd19fe72 (patch) | |
tree | 2ae17a23a8cb041ba599583057de7f0257b9afaa /src | |
parent | 5aef563b0ea7fee4402307c95091b988615a2637 (diff) | |
download | seabios-hppa-fb76cff0c95e3e3d449b41d2728f4f50dd19fe72.zip seabios-hppa-fb76cff0c95e3e3d449b41d2728f4f50dd19fe72.tar.gz seabios-hppa-fb76cff0c95e3e3d449b41d2728f4f50dd19fe72.tar.bz2 |
Cleanup QEMU_CFG_NUMA fw_cfg processing - split into two romfile entries.
The QEMU_CFG_NUMA fw_cfg entry is actually two separate tables in one
fw_cfg entry - a table for cpu affinity and a table for the memory
map. Create two romfile entries to make that more clear.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/acpi.c | 25 | ||||
-rw-r--r-- | src/paravirt.c | 7 |
2 files changed, 19 insertions, 13 deletions
@@ -646,14 +646,13 @@ acpi_build_srat_memory(struct srat_memory_affinity *numamem, static void * build_srat(void) { - int filesize; - u64 *numadata = romfile_loadfile("etc/numa-nodes", &filesize); - if (!numadata) - return NULL; - int max_cpu = romfile_loadint("etc/max-cpus", 0); - int nb_numa_nodes = (filesize / sizeof(u64)) - max_cpu; - if (!nb_numa_nodes) - return NULL; + int numadatasize, numacpusize; + u64 *numadata = romfile_loadfile("etc/numa-nodes", &numadatasize); + u64 *numacpumap = romfile_loadfile("etc/numa-cpu-map", &numacpusize); + if (!numadata || !numacpumap) + goto fail; + int max_cpu = numacpusize / sizeof(u64); + int nb_numa_nodes = numadatasize / sizeof(u64); struct system_resource_affinity_table *srat; int srat_size = sizeof(*srat) + @@ -663,8 +662,7 @@ build_srat(void) srat = malloc_high(srat_size); if (!srat) { warn_noalloc(); - free(numadata); - return NULL; + goto fail; } memset(srat, 0, srat_size); @@ -677,7 +675,7 @@ build_srat(void) core->type = SRAT_PROCESSOR; core->length = sizeof(*core); core->local_apic_id = i; - curnode = *numadata++; + curnode = *numacpumap++; core->proximity_lo = curnode; memset(core->proximity_hi, 0, 3); core->local_sapic_eid = 0; @@ -731,7 +729,12 @@ build_srat(void) build_header((void*)srat, SRAT_SIGNATURE, srat_size, 1); free(numadata); + free(numacpumap); return srat; +fail: + free(numadata); + free(numacpumap); + return NULL; } static void * diff --git a/src/paravirt.c b/src/paravirt.c index 4a26c6e..ee6a86e 100644 --- a/src/paravirt.c +++ b/src/paravirt.c @@ -223,8 +223,11 @@ qemu_cfg_legacy(void) // NUMA data u64 numacount; qemu_cfg_read_entry(&numacount, QEMU_CFG_NUMA, sizeof(numacount)); - numacount += romfile_loadint("etc/max-cpus", 0); - qemu_romfile_add("etc/numa-nodes", QEMU_CFG_NUMA, sizeof(numacount) + int max_cpu = romfile_loadint("etc/max-cpus", 0); + qemu_romfile_add("etc/numa-cpu-map", QEMU_CFG_NUMA, sizeof(numacount) + , max_cpu*sizeof(u64)); + qemu_romfile_add("etc/numa-nodes", QEMU_CFG_NUMA + , sizeof(numacount) + max_cpu*sizeof(u64) , numacount*sizeof(u64)); // e820 data |