aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2016-11-11 16:35:15 +0100
committerKevin O'Connor <kevin@koconnor.net>2016-11-21 10:08:14 -0500
commitb98c6586c0c3d519359d6e751ecb3e637e82dbcb (patch)
tree883f6aff152720522bad505eebc476f2ba872ffc
parentc5e56b2ffe439b919d5e622374c1aa70af4e1911 (diff)
downloadseabios-b98c6586c0c3d519359d6e751ecb3e637e82dbcb.tar.gz
seabios-b98c6586c0c3d519359d6e751ecb3e637e82dbcb.tar.xz
seabios-b98c6586c0c3d519359d6e751ecb3e637e82dbcb.zip
drop "etc/boot-cpus" fw_cfg file and reuse legacy QEMU_CFG_NB_CPUS
since QEMU_CFG_NB_CPUS not going away anytime soon and serves the same purpose as just added "etc/boot-cpus" fw_cfg drop support for "etc/boot-cpus" while this code is not in use yet (i.e. QEMU with "etc/boot-cpus" hasn't been released) and reuse QEMU_CFG_NB_CPUS instead of it. Signed-off-by: Igor Mammedov <imammedo@redhat.com>
-rw-r--r--src/fw/paravirt.c37
-rw-r--r--src/fw/paravirt.h1
-rw-r--r--src/fw/smp.c2
3 files changed, 7 insertions, 33 deletions
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
index 125066d..6de70f6 100644
--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -205,6 +205,7 @@ qemu_platform_setup(void)
#define QEMU_CFG_UUID 0x02
#define QEMU_CFG_NUMA 0x0d
#define QEMU_CFG_BOOT_MENU 0x0e
+#define QEMU_CFG_NB_CPUS 0x05
#define QEMU_CFG_MAX_CPUS 0x0f
#define QEMU_CFG_FILE_DIR 0x19
#define QEMU_CFG_ARCH_LOCAL 0x8000
@@ -319,40 +320,14 @@ qemu_romfile_add(char *name, int select, int skip, int size)
romfile_add(&qfile->file);
}
-static int
-qemu_romfile_get_fwcfg_entry(char *name, int *select)
-{
- struct romfile_s *file = romfile_find(name);
- if (!file)
- return 0;
- struct qemu_romfile_s *qfile;
- qfile = container_of(file, struct qemu_romfile_s, file);
- if (select)
- *select = qfile->select;
- return file->size;
-}
-
-static int boot_cpus_sel;
-static int boot_cpus_file_sz;
-
-u16
-qemu_init_present_cpus_count(void)
-{
- u16 smp_count = romfile_loadint("etc/boot-cpus",
- rtc_read(CMOS_BIOS_SMP_COUNT) + 1);
- boot_cpus_file_sz =
- qemu_romfile_get_fwcfg_entry("etc/boot-cpus", &boot_cpus_sel);
- return smp_count;
-}
-
u16
qemu_get_present_cpus_count(void)
{
- u16 smp_count;
- if (!boot_cpus_file_sz) {
- smp_count = rtc_read(CMOS_BIOS_SMP_COUNT) + 1;
- } else {
- qemu_cfg_read_entry(&smp_count, boot_cpus_sel, boot_cpus_file_sz);
+ u16 smp_count = 0;
+ qemu_cfg_read_entry(&smp_count, QEMU_CFG_NB_CPUS, sizeof(smp_count));
+ u16 cmos_cpu_count = rtc_read(CMOS_BIOS_SMP_COUNT) + 1;
+ if (smp_count < cmos_cpu_count) {
+ smp_count = cmos_cpu_count;
}
return smp_count;
}
diff --git a/src/fw/paravirt.h b/src/fw/paravirt.h
index 6f26fd0..d8eb7c4 100644
--- a/src/fw/paravirt.h
+++ b/src/fw/paravirt.h
@@ -52,7 +52,6 @@ void qemu_preinit(void);
void qemu_platform_setup(void);
void qemu_cfg_init(void);
-u16 qemu_init_present_cpus_count(void);
u16 qemu_get_present_cpus_count(void);
#endif
diff --git a/src/fw/smp.c b/src/fw/smp.c
index bcbad69..46d1da1 100644
--- a/src/fw/smp.c
+++ b/src/fw/smp.c
@@ -176,7 +176,7 @@ smp_setup(void)
return;
MaxCountCPUs = romfile_loadint("etc/max-cpus", 0);
- u16 smp_count = qemu_init_present_cpus_count();
+ u16 smp_count = qemu_get_present_cpus_count();
if (MaxCountCPUs < smp_count)
MaxCountCPUs = smp_count;