[RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines

Michael Mueller
2015-02-17T14:25:16Z

This patch implements the functions:

- s390_get_proceccor_props()
- s390_set_proceccor_props()

They can be used to request or retrieve processor related information from an accelerator.
That information comprises the cpu identifier, the ICB value and the facility lists.

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
---
target-s390x/cpu-models.c | 36 ++++++++++++++++++++++++++++++++++++
target-s390x/cpu-models.h | 2 ++
2 files changed, 38 insertions(+)

diff --git a/target-s390x/cpu-models.c b/target-s390x/cpu-models.c
index c63b4c2..9bc4d89 100644
--- a/target-s390x/cpu-models.c
+++ b/target-s390x/cpu-models.c
@@ -579,6 +579,42 @@ void s390_cpu_list_entry(gpointer data, gpointer user_data)
}

/**
+ * s390_get_processor_props - retrieves processor properties from
+ * from the currently used accelerator
+ * @prop: address to processor property structure to store the
+ * retrieved processor properties
+ *
+ * Returns: 0 in case of success
+ * -ENOSYS in case the current accelerator has no processor
+ * properties implemented
+ */
+int s390_get_processor_props(S390ProcessorProps *prop)
+{
+ if (kvm_enabled()) {
+ return kvm_s390_get_processor_props(prop);
+ }
+ return -ENOSYS;
+}
+
+/**
+ * s390_set_processor_props - stores processor properties in the
+ * currently used accelerator
+ * @prop: address to processor property structure to store the
+ * retrieved processor properties
+ *
+ * Returns: 0 in case of success
+ * -ENOSYS in case the current accelerator has no processor
+ * properties implemented
+ */
+int s390_set_processor_props(S390ProcessorProps *prop)
+{
+ if (kvm_enabled()) {
+ return kvm_s390_set_processor_props(prop);
+ }
+ return -ENOSYS;
+}
+
+/**
* s390_cpu_classes_initialized - indicates if the all cpu classes and
* their properties have been initialized
*
diff --git a/target-s390x/cpu-models.h b/target-s390x/cpu-models.h
index d41fc37..bc478d8 100644
--- a/target-s390x/cpu-models.h
+++ b/target-s390x/cpu-models.h
@@ -108,6 +108,8 @@ int s390_setup_cpu_classes(AccelId accel, S390MachineProps *prop);
gint s390_cpu_class_asc_order_compare(gconstpointer a, gconstpointer b);
gint s390_cpu_class_desc_order_compare(gconstpointer a, gconstpointer b);
void s390_cpu_list_entry(gpointer data, gpointer user_data);
+int s390_get_processor_props(S390ProcessorProps *prop);
+int s390_set_processor_props(S390ProcessorProps *prop);
bool s390_cpu_classes_initialized(void);
bool s390_test_facility(S390CPUClass *cc, unsigned long nr);
bool s390_probe_mode(void);
--
1.8.3.1