From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: frankja@linux.ibm.com, thuth@redhat.com, david@redhat.com,
nrb@linux.ibm.com, scgl@linux.ibm.com, seiden@linux.ibm.com
Subject: [kvm-unit-tests PATCH v1 4/5] s390x: firq: avoid hardcoded CPU addresses
Date: Fri, 28 Jan 2022 19:54:48 +0100 [thread overview]
Message-ID: <20220128185449.64936-5-imbrenda@linux.ibm.com> (raw)
In-Reply-To: <20220128185449.64936-1-imbrenda@linux.ibm.com>
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/firq.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/s390x/firq.c b/s390x/firq.c
index fb9a2906..14d0d102 100644
--- a/s390x/firq.c
+++ b/s390x/firq.c
@@ -33,6 +33,7 @@ static void wait_for_sclp_int(void)
*/
static void test_wait_state_delivery(void)
{
+ uint16_t cpu1, cpu2;
struct psw psw;
SCCBHeader *h;
int ret;
@@ -44,16 +45,14 @@ static void test_wait_state_delivery(void)
goto out;
}
- if (stap()) {
- report_skip("need to start on CPU #0");
- goto out;
- }
+ cpu1 = smp_cpu_addr_from_idx(1);
+ cpu2 = smp_cpu_addr_from_idx(2);
/*
* We want CPU #2 to be stopped. This should be the case at this
* point, however, we want to sense if it even exists as well.
*/
- ret = smp_cpu_stop(2);
+ ret = smp_cpu_stop(cpu2);
if (ret) {
report_skip("CPU #2 not found");
goto out;
@@ -68,10 +67,10 @@ static void test_wait_state_delivery(void)
/* Start CPU #1 and let it wait for the interrupt. */
psw.mask = extract_psw_mask();
psw.addr = (unsigned long)wait_for_sclp_int;
- ret = smp_cpu_setup(1, psw);
+ ret = smp_cpu_setup(cpu1, psw);
if (ret) {
sclp_clear_busy();
- report_skip("cpu #1 not found");
+ report_skip("CPU #1 not found");
goto out;
}
@@ -85,7 +84,7 @@ static void test_wait_state_delivery(void)
* will take some time as well and smp_cpu_setup() returns when we're
* either already in wait_for_sclp_int() or just about to execute it.
*/
- while(smp_sense_running_status(1));
+ while(smp_sense_running_status(cpu1));
h = alloc_pages_flags(0, AREA_DMA31);
h->length = 4096;
@@ -106,7 +105,7 @@ static void test_wait_state_delivery(void)
out_destroy:
free_page(h);
- smp_cpu_destroy(1);
+ smp_cpu_destroy(cpu1);
out:
report_prefix_pop();
}
--
2.34.1
next prev parent reply other threads:[~2022-01-28 18:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 18:54 [kvm-unit-tests PATCH v1 0/5] s390x: smp: avoid hardcoded CPU addresses Claudio Imbrenda
2022-01-28 18:54 ` [kvm-unit-tests PATCH v1 1/5] lib: s390x: smp: add functions to work with CPU indexes Claudio Imbrenda
2022-01-31 13:50 ` David Hildenbrand
2022-02-02 16:55 ` Steffen Eiden
2022-02-03 13:33 ` Claudio Imbrenda
2022-01-28 18:54 ` [kvm-unit-tests PATCH v1 2/5] lib: s390x: smp: guarantee that boot CPU has index 0 Claudio Imbrenda
2022-01-31 13:55 ` David Hildenbrand
2022-02-03 11:41 ` Claudio Imbrenda
2022-01-28 18:54 ` [kvm-unit-tests PATCH v1 3/5] s390x: smp: avoid hardcoded CPU addresses Claudio Imbrenda
2022-01-28 18:54 ` Claudio Imbrenda [this message]
2022-01-28 18:54 ` [kvm-unit-tests PATCH v1 5/5] s390x: skrf: " Claudio Imbrenda
2022-02-03 8:45 ` [kvm-unit-tests PATCH v1 0/5] s390x: smp: " Janosch Frank
2022-02-03 13:37 ` Claudio Imbrenda
2022-02-03 15:23 ` Janosch Frank
2022-02-03 15:48 ` Claudio Imbrenda
2022-02-04 15:01 ` Janosch Frank
2022-02-04 15:14 ` Claudio Imbrenda
2022-02-04 15:37 ` Janosch Frank
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220128185449.64936-5-imbrenda@linux.ibm.com \
--to=imbrenda@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=scgl@linux.ibm.com \
--cc=seiden@linux.ibm.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).