diff mbox series

[kvm-unit-tests,v1,5/5] s390x: skrf: avoid hardcoded CPU addresses

Message ID 20220128185449.64936-6-imbrenda@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: smp: avoid hardcoded CPU addresses | expand

Commit Message

Claudio Imbrenda Jan. 28, 2022, 6:54 p.m. UTC
Use the recently introduced smp_cpu_addr_from_idx to discover the
addresses of the CPUs to use in the test, instead of using hardcoded
values. This makes the test more portable.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 s390x/skrf.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/s390x/skrf.c b/s390x/skrf.c
index ca4efbf1..bd0abba0 100644
--- a/s390x/skrf.c
+++ b/s390x/skrf.c
@@ -164,6 +164,7 @@  static void test_exception_ext_new(void)
 		.mask = extract_psw_mask(),
 		.addr = (unsigned long)ecall_setup
 	};
+	uint16_t cpu1;
 
 	report_prefix_push("exception external new");
 	if (smp_query_num_cpus() < 2) {
@@ -171,14 +172,15 @@  static void test_exception_ext_new(void)
 		report_prefix_pop();
 		return;
 	}
+	cpu1 = smp_cpu_addr_from_idx(1);
 
-	smp_cpu_setup(1, psw);
+	smp_cpu_setup(cpu1, psw);
 	wait_for_flag();
 	set_flag(0);
 
-	sigp(1, SIGP_EXTERNAL_CALL, 0, NULL);
+	sigp(cpu1, SIGP_EXTERNAL_CALL, 0, NULL);
 	wait_for_flag();
-	smp_cpu_stop(1);
+	smp_cpu_stop(cpu1);
 	report_prefix_pop();
 }