[v3,1/1] kvm-unit-tests: s390: add cpu model checks
diff mbox series

Message ID 20190726065412.175785-1-borntraeger@de.ibm.com
State New
Headers show
Series
  • [v3,1/1] kvm-unit-tests: s390: add cpu model checks
Related show

Commit Message

Christian Borntraeger July 26, 2019, 6:54 a.m. UTC
This adds a check for documented stfle dependencies.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
V2->V3:
	- add 135,129
	- add spaces between number and curly braces
	- simplify check
 s390x/Makefile      |  1 +
 s390x/cpumodel.c    | 58 +++++++++++++++++++++++++++++++++++++++++++++
 s390x/unittests.cfg |  3 +++
 3 files changed, 62 insertions(+)
 create mode 100644 s390x/cpumodel.c

Comments

Thomas Huth July 26, 2019, 7:44 a.m. UTC | #1
Could you check your settings in your local git repo? Normally, there
should be something like:

[format]
	subjectprefix = kvm-unit-tests PATCH

so that the patches are created with the correct prefix. In your mails,
the prefix seems to be missing completely.

On 26/07/2019 08.54, Christian Borntraeger wrote:
> This adds a check for documented stfle dependencies.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> V2->V3:
> 	- add 135,129
> 	- add spaces between number and curly braces
> 	- simplify check
>  s390x/Makefile      |  1 +
>  s390x/cpumodel.c    | 58 +++++++++++++++++++++++++++++++++++++++++++++
>  s390x/unittests.cfg |  3 +++
>  3 files changed, 62 insertions(+)
>  create mode 100644 s390x/cpumodel.c
> 
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 1f21ddb9c943..574a9a20824d 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -11,6 +11,7 @@ tests += $(TEST_DIR)/cmm.elf
>  tests += $(TEST_DIR)/vector.elf
>  tests += $(TEST_DIR)/gs.elf
>  tests += $(TEST_DIR)/iep.elf
> +tests += $(TEST_DIR)/cpumodel.elf
>  tests_binary = $(patsubst %.elf,%.bin,$(tests))
>  
>  all: directories test_cases test_cases_binary
> diff --git a/s390x/cpumodel.c b/s390x/cpumodel.c
> new file mode 100644
> index 000000000000..1e4cc39026b9
> --- /dev/null
> +++ b/s390x/cpumodel.c
> @@ -0,0 +1,58 @@
> +/*
> + * Test the known dependencies for facilities
> + *
> + * Copyright 2019 IBM Corp.
> + *
> + * Authors:
> + *    Christian Borntraeger <borntraeger@de.ibm.com>
> + *
> + * This code is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Library General Public License version 2.
> + */
> +
> +#include <asm/facility.h>
> +
> +static int dep[][2] = {
> +	/* from SA22-7832-11 4-98 facility indications */
> +	{   4,   3 },
> +	{   5,   3 },
> +	{   5,   4 },
> +	{  19,  18 },
> +	{  37,  42 },
> +	{  43,  42 },
> +	{  73,  49 },
> +	{ 134, 129 },
> +	{ 135, 129 },
> +	{ 139,  25 },
> +	{ 139,  28 },
> +	{ 146,  76 },
> +	/* indirectly documented in description */
> +	{  78,   8 },  /* EDAT */
> +	/* new dependencies from gen15 */
> +	{  61,  45 },
> +	{ 148, 129 },
> +	{ 148, 135 },
> +	{ 152, 129 },
> +	{ 152, 134 },
> +	{ 155,  76 },
> +	{ 155,  77 },
> +};
> +
> +int main(void)
> +{
> +	int i;
> +
> +	report_prefix_push("cpumodel");
> +
> +	report_prefix_push("dependency");
> +	for (i = 0; i < ARRAY_SIZE(dep); i++) {
> +		if (test_facility(dep[i][0])) {
> +			report("%d implies %d", test_facility(dep[i][1]),
> +				dep[i][0], dep[i][1]);
> +		} else {
> +			report_skip("facility %d not present", dep[i][0]);
> +		}
> +	}
> +	report_prefix_pop();

It would be nice to have another report_prefix_pop() for the "cpumodel",
but since we're done here anyway, I guess it's also ok without it.

> +	return report_summary();
> +}
> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
> index 546b1f281f8f..db58bad5a038 100644
> --- a/s390x/unittests.cfg
> +++ b/s390x/unittests.cfg
> @@ -61,3 +61,6 @@ file = gs.elf
>  
>  [iep]
>  file = iep.elf
> +
> +[cpumodel]
> +file = cpumodel.elf
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>
Janosch Frank July 26, 2019, 7:53 a.m. UTC | #2
On 7/26/19 8:54 AM, Christian Borntraeger wrote:
> This adds a check for documented stfle dependencies.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> V2->V3:
> 	- add 135,129
> 	- add spaces between number and curly braces
> 	- simplify check
>  s390x/Makefile      |  1 +
>  s390x/cpumodel.c    | 58 +++++++++++++++++++++++++++++++++++++++++++++
>  s390x/unittests.cfg |  3 +++
>  3 files changed, 62 insertions(+)
>  create mode 100644 s390x/cpumodel.c
> 
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 1f21ddb9c943..574a9a20824d 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -11,6 +11,7 @@ tests += $(TEST_DIR)/cmm.elf
>  tests += $(TEST_DIR)/vector.elf
>  tests += $(TEST_DIR)/gs.elf
>  tests += $(TEST_DIR)/iep.elf
> +tests += $(TEST_DIR)/cpumodel.elf
>  tests_binary = $(patsubst %.elf,%.bin,$(tests))
>  
>  all: directories test_cases test_cases_binary
> diff --git a/s390x/cpumodel.c b/s390x/cpumodel.c
> new file mode 100644
> index 000000000000..1e4cc39026b9
> --- /dev/null
> +++ b/s390x/cpumodel.c
> @@ -0,0 +1,58 @@
> +/*
> + * Test the known dependencies for facilities
> + *
> + * Copyright 2019 IBM Corp.
> + *
> + * Authors:
> + *    Christian Borntraeger <borntraeger@de.ibm.com>
> + *
> + * This code is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Library General Public License version 2.
> + */
> +
> +#include <asm/facility.h>
> +
> +static int dep[][2] = {
> +	/* from SA22-7832-11 4-98 facility indications */
> +	{   4,   3 },
> +	{   5,   3 },
> +	{   5,   4 },
> +	{  19,  18 },
> +	{  37,  42 },
> +	{  43,  42 },
> +	{  73,  49 },
> +	{ 134, 129 },
> +	{ 135, 129 },
> +	{ 139,  25 },
> +	{ 139,  28 },
> +	{ 146,  76 },
> +	/* indirectly documented in description */
> +	{  78,   8 },  /* EDAT */
> +	/* new dependencies from gen15 */
> +	{  61,  45 },
> +	{ 148, 129 },
> +	{ 148, 135 },
> +	{ 152, 129 },
> +	{ 152, 134 },
> +	{ 155,  76 },
> +	{ 155,  77 },

I'd generally appreciate comments for the left part of the bits.
At some point I have to look up bit 50, it says it is only meaningful
with bit 73, but there's no hard requirement from the wording.

> +};
> +
> +int main(void)
> +{
> +	int i;
> +
> +	report_prefix_push("cpumodel");
> +
> +	report_prefix_push("dependency");
> +	for (i = 0; i < ARRAY_SIZE(dep); i++) {
> +		if (test_facility(dep[i][0])) {
> +			report("%d implies %d", test_facility(dep[i][1]),
> +				dep[i][0], dep[i][1]);
> +		} else {
> +			report_skip("facility %d not present", dep[i][0]);
> +		}
> +	}
> +	report_prefix_pop();

There's a pop missing and formatting therefore doesn't match the pushs.

> +	return report_summary();
> +}

Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
> index 546b1f281f8f..db58bad5a038 100644
> --- a/s390x/unittests.cfg
> +++ b/s390x/unittests.cfg
> @@ -61,3 +61,6 @@ file = gs.elf
>  
>  [iep]
>  file = iep.elf
> +
> +[cpumodel]
> +file = cpumodel.elf
>

Patch
diff mbox series

diff --git a/s390x/Makefile b/s390x/Makefile
index 1f21ddb9c943..574a9a20824d 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -11,6 +11,7 @@  tests += $(TEST_DIR)/cmm.elf
 tests += $(TEST_DIR)/vector.elf
 tests += $(TEST_DIR)/gs.elf
 tests += $(TEST_DIR)/iep.elf
+tests += $(TEST_DIR)/cpumodel.elf
 tests_binary = $(patsubst %.elf,%.bin,$(tests))
 
 all: directories test_cases test_cases_binary
diff --git a/s390x/cpumodel.c b/s390x/cpumodel.c
new file mode 100644
index 000000000000..1e4cc39026b9
--- /dev/null
+++ b/s390x/cpumodel.c
@@ -0,0 +1,58 @@ 
+/*
+ * Test the known dependencies for facilities
+ *
+ * Copyright 2019 IBM Corp.
+ *
+ * Authors:
+ *    Christian Borntraeger <borntraeger@de.ibm.com>
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License version 2.
+ */
+
+#include <asm/facility.h>
+
+static int dep[][2] = {
+	/* from SA22-7832-11 4-98 facility indications */
+	{   4,   3 },
+	{   5,   3 },
+	{   5,   4 },
+	{  19,  18 },
+	{  37,  42 },
+	{  43,  42 },
+	{  73,  49 },
+	{ 134, 129 },
+	{ 135, 129 },
+	{ 139,  25 },
+	{ 139,  28 },
+	{ 146,  76 },
+	/* indirectly documented in description */
+	{  78,   8 },  /* EDAT */
+	/* new dependencies from gen15 */
+	{  61,  45 },
+	{ 148, 129 },
+	{ 148, 135 },
+	{ 152, 129 },
+	{ 152, 134 },
+	{ 155,  76 },
+	{ 155,  77 },
+};
+
+int main(void)
+{
+	int i;
+
+	report_prefix_push("cpumodel");
+
+	report_prefix_push("dependency");
+	for (i = 0; i < ARRAY_SIZE(dep); i++) {
+		if (test_facility(dep[i][0])) {
+			report("%d implies %d", test_facility(dep[i][1]),
+				dep[i][0], dep[i][1]);
+		} else {
+			report_skip("facility %d not present", dep[i][0]);
+		}
+	}
+	report_prefix_pop();
+	return report_summary();
+}
diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
index 546b1f281f8f..db58bad5a038 100644
--- a/s390x/unittests.cfg
+++ b/s390x/unittests.cfg
@@ -61,3 +61,6 @@  file = gs.elf
 
 [iep]
 file = iep.elf
+
+[cpumodel]
+file = cpumodel.elf