lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 13 Apr 2015 15:56:21 +0200
From:	Michael Mueller <mimu@...ux.vnet.ibm.com>
To:	qemu-devel@...gnu.org, kvm@...r.kernel.org,
	linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	Eduardo Habkost <ehabkost@...hat.com>,
	Gleb Natapov <gleb@...nel.org>, Alexander Graf <agraf@...e.de>,
	Christian Borntraeger <borntraeger@...ibm.com>,
	"Jason J. Herne" <jjherne@...ux.vnet.ibm.com>,
	Cornelia Huck <cornelia.huck@...ibm.com>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Michael Mueller <mimu@...ux.vnet.ibm.com>,
	Andreas Faerber <afaerber@...e.de>,
	Richard Henderson <rth@...ddle.net>,
	Daniel Hansel <daniel.hansel@...ux.vnet.ibm.com>
Subject: [PATCH v5 02/17] Add accelerator id and model name to CPUState

The patch defines ids per accelerator and adds the accel_id and
the model_name to the CPUState. The accel_id is initialized by
common code, the model name needs to be initialized by target
specific code.

Signed-off-by: Michael Mueller <mimu@...ux.vnet.ibm.com>
---
 include/qom/cpu.h |  5 +++++
 qapi-schema.json  |  9 +++++++++
 qom/cpu.c         | 14 ++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 9dafb48..4ffc050 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -236,6 +236,8 @@ struct kvm_run;
  * @mem_io_pc: Host Program Counter at which the memory was accessed.
  * @mem_io_vaddr: Target virtual address at which the memory was accessed.
  * @kvm_fd: vCPU file descriptor for KVM.
+ * @accel_id: accelerator id of this CPU.
+ * @model_name: model name of this CPU
  *
  * State of one CPU core or thread.
  */
@@ -313,6 +315,9 @@ struct CPUState {
        (absolute value) offset as small as possible.  This reduces code
        size, especially for hosts without large memory offsets.  */
     volatile sig_atomic_t tcg_exit_req;
+
+    AccelId accel_id;
+    char *model_name;
 };
 
 QTAILQ_HEAD(CPUTailQ, CPUState);
diff --git a/qapi-schema.json b/qapi-schema.json
index ac9594d..540e520 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2515,6 +2515,15 @@
 ##
 { 'command': 'query-machines', 'returns': ['MachineInfo'] }
 
+# @AccelId
+#
+# Defines accelerator ids
+#
+# Since: 2.4
+##
+{ 'enum': 'AccelId',
+  'data': ['qtest', 'tcg', 'kvm', 'xen'] }
+
 ##
 # @CpuDefinitionInfo:
 #
diff --git a/qom/cpu.c b/qom/cpu.c
index 108bfa2..457afc7 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -67,6 +67,20 @@ CPUState *cpu_generic_init(const char *typename, const char *cpu_model)
         goto out;
     }
 
+    if (tcg_enabled()) {
+        cpu->accel_id = ACCEL_ID_TCG;
+    } else if (kvm_enabled()) {
+        cpu->accel_id = ACCEL_ID_KVM;
+    }
+#ifdef CONFIG_XEN
+    else if (xen_enabled()) {
+        cpu->accel_id = ACCEL_ID_XEN;
+    }
+#endif
+    else {
+        cpu->accel_id = ACCEL_ID_QTEST;
+    }
+
     object_property_set_bool(OBJECT(cpu), true, "realized", &err);
 
 out:
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists