[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v14 4/6] cpus: Add new function topology_supports_to
From: |
Babu Moger |
Subject: |
[Qemu-devel] [PATCH v14 4/6] cpus: Add new function topology_supports_topoext |
Date: |
Wed, 13 Jun 2018 21:18:25 -0400 |
Add new function topology_supports_topoext to verify
if we can support topoext feature. Will be used to enable/disable
topoext feature.
Signed-off-by: Babu Moger <address@hidden>
---
accel/tcg/user-exec-stub.c | 5 +++++
cpus.c | 13 +++++++++++++
include/qom/cpu.h | 9 +++++++++
3 files changed, 27 insertions(+)
diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c
index dbcf1ad..715818a 100644
--- a/accel/tcg/user-exec-stub.c
+++ b/accel/tcg/user-exec-stub.c
@@ -11,6 +11,11 @@ void qemu_init_vcpu(CPUState *cpu)
{
}
+int topology_supports_topoext(int max_cores, int max_threads)
+{
+ return true;
+}
+
/* User mode emulation does not support record/replay yet. */
bool replay_exception(void)
diff --git a/cpus.c b/cpus.c
index d1f1629..17f6f4c 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1979,6 +1979,19 @@ static void qemu_dummy_start_vcpu(CPUState *cpu)
QEMU_THREAD_JOINABLE);
}
+/*
+ * Check if we can support topoext feature with this topology
+ * Fail if number of cores are beyond the supported cores
+ * or number of threads are more than supported threads
+ */
+int topology_supports_topoext(int max_cores, int max_threads)
+{
+ if ((smp_cores > max_cores) || (smp_threads > max_threads)) {
+ return false;
+ }
+ return true;
+}
+
void qemu_init_vcpu(CPUState *cpu)
{
cpu->nr_cores = smp_cores;
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 9d3afc6..4ac4d49 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -1004,6 +1004,15 @@ void end_exclusive(void);
*/
void qemu_init_vcpu(CPUState *cpu);
+/**
+ * topology_supports_topoext:
+ * @max_cores: Max cores topoext feature can support
+ * @max_threads: Max threads topoext feature can support
+ *
+ * Return true if topology can be supported else return false
+ */
+int topology_supports_topoext(int max_cores, int max_threads);
+
#define SSTEP_ENABLE 0x1 /* Enable simulated HW single stepping */
#define SSTEP_NOIRQ 0x2 /* Do not use IRQ while single stepping */
#define SSTEP_NOTIMER 0x4 /* Do not Timers while single stepping */
--
1.8.3.1
[Qemu-devel] [PATCH v14 3/6] i386: Disable TOPOEXT feature on pc-2.12, Babu Moger, 2018/06/13
[Qemu-devel] [PATCH v14 1/6] i386: Set TOPOEXT unconditionally for comapatibility, Babu Moger, 2018/06/13