diff mbox series

[kvm-unit-tests,v2,6/6] lib: s390x: smp: Remove smp_sigp_retry

Message ID 20220311173822.1234617-7-farman@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x SIGP fixes | expand

Commit Message

Eric Farman March 11, 2022, 5:38 p.m. UTC
The SIGP instruction presents a CC0 when an order is accepted,
though the work for the order may be performed asynchronously.
While any such work is outstanding, nearly any other SIGP order
sent to the same CPU will be returned with a CC2.

Currently, there are two library functions that perform a SIGP,
one which retries a SIGP that gets a CC2, and one which doesn't.
In practice, the users of this functionality want the CC2 to be
handled by the library itself, rather than determine whether it
needs to retry the request or not.

To avoid confusion, let's convert the smp_sigp() routine to
perform the sigp_retry() logic, and then convert any users of
smp_sigp_retry() to smp_sigp(). This of course means that the
external _retry() interface can be removed for simplicity.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
 lib/s390x/smp.c | 14 ++++----------
 lib/s390x/smp.h |  1 -
 s390x/smp.c     |  4 ++--
 3 files changed, 6 insertions(+), 13 deletions(-)

Comments

Nico Boehr March 15, 2022, 7:20 a.m. UTC | #1
On Fri, 2022-03-11 at 18:38 +0100, Eric Farman wrote:
> The SIGP instruction presents a CC0 when an order is accepted,
> though the work for the order may be performed asynchronously.
> While any such work is outstanding, nearly any other SIGP order
> sent to the same CPU will be returned with a CC2.
> 
> Currently, there are two library functions that perform a SIGP,
> one which retries a SIGP that gets a CC2, and one which doesn't.
> In practice, the users of this functionality want the CC2 to be
> handled by the library itself, rather than determine whether it
> needs to retry the request or not.
> 
> To avoid confusion, let's convert the smp_sigp() routine to
> perform the sigp_retry() logic, and then convert any users of
> smp_sigp_retry() to smp_sigp(). This of course means that the
> external _retry() interface can be removed for simplicity.
> 
> Signed-off-by: Eric Farman <farman@linux.ibm.com>

Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
diff mbox series

Patch

diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c
index 5be29d36..a0495cd9 100644
--- a/lib/s390x/smp.c
+++ b/lib/s390x/smp.c
@@ -40,12 +40,6 @@  int smp_query_num_cpus(void)
 }
 
 int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status)
-{
-	check_idx(idx);
-	return sigp(cpus[idx].addr, order, parm, status);
-}
-
-int smp_sigp_retry(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status)
 {
 	check_idx(idx);
 	return sigp_retry(cpus[idx].addr, order, parm, status);
@@ -78,7 +72,7 @@  bool smp_cpu_stopped(uint16_t idx)
 {
 	uint32_t status;
 
-	if (smp_sigp_retry(idx, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED)
+	if (smp_sigp(idx, SIGP_SENSE, 0, &status) != SIGP_CC_STATUS_STORED)
 		return false;
 	return !!(status & (SIGP_STATUS_CHECK_STOP|SIGP_STATUS_STOPPED));
 }
@@ -99,7 +93,7 @@  static int smp_cpu_stop_nolock(uint16_t idx, bool store)
 	if (idx == 0)
 		return -1;
 
-	if (smp_sigp_retry(idx, order, 0, NULL))
+	if (smp_sigp(idx, order, 0, NULL))
 		return -1;
 
 	while (!smp_cpu_stopped(idx))
@@ -251,11 +245,11 @@  static int smp_cpu_setup_nolock(uint16_t idx, struct psw psw)
 	if (cpus[idx].active)
 		return -1;
 
-	smp_sigp_retry(idx, SIGP_INITIAL_CPU_RESET, 0, NULL);
+	smp_sigp(idx, SIGP_INITIAL_CPU_RESET, 0, NULL);
 
 	lc = alloc_pages_flags(1, AREA_DMA31);
 	cpus[idx].lowcore = lc;
-	smp_sigp_retry(idx, SIGP_SET_PREFIX, (unsigned long )lc, NULL);
+	smp_sigp(idx, SIGP_SET_PREFIX, (unsigned long )lc, NULL);
 
 	/* Copy all exception psws. */
 	memcpy(lc, cpus[0].lowcore, 512);
diff --git a/lib/s390x/smp.h b/lib/s390x/smp.h
index 24a0e2e0..df184cb8 100644
--- a/lib/s390x/smp.h
+++ b/lib/s390x/smp.h
@@ -52,6 +52,5 @@  int smp_cpu_setup(uint16_t idx, struct psw psw);
 void smp_teardown(void);
 void smp_setup(void);
 int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status);
-int smp_sigp_retry(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status);
 
 #endif
diff --git a/s390x/smp.c b/s390x/smp.c
index 913da155..81e02195 100644
--- a/s390x/smp.c
+++ b/s390x/smp.c
@@ -266,7 +266,7 @@  static void test_reset_initial(void)
 	smp_cpu_start(1, psw);
 	wait_for_flag();
 
-	smp_sigp_retry(1, SIGP_INITIAL_CPU_RESET, 0, NULL);
+	smp_sigp(1, SIGP_INITIAL_CPU_RESET, 0, NULL);
 	smp_sigp(1, SIGP_STORE_STATUS_AT_ADDRESS, (uintptr_t)status, NULL);
 
 	report_prefix_push("clear");
@@ -316,7 +316,7 @@  static void test_reset(void)
 	smp_sigp(1, SIGP_EXTERNAL_CALL, 0, NULL);
 	smp_cpu_start(1, psw);
 
-	smp_sigp_retry(1, SIGP_CPU_RESET, 0, NULL);
+	smp_sigp(1, SIGP_CPU_RESET, 0, NULL);
 	report(smp_cpu_stopped(1), "cpu stopped");
 
 	set_flag(0);