From: David Hildenbrand <david@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>, qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, cohuck@redhat.com,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [PATCH] s390x: Properly fetch and test the short psw on diag308 subc 0/1
Date: Tue, 5 Nov 2019 20:29:31 +0100 [thread overview]
Message-ID: <76ba0773-b6da-a73a-0a76-9a23f004a9b7@redhat.com> (raw)
In-Reply-To: <20191105184434.16148-1-frankja@linux.ibm.com>
On 05.11.19 19:44, Janosch Frank wrote:
> We need to actually fetch the cpu mask and set it after checking for
> psw bit 12 instead of completely ignoring it.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> target/s390x/cpu.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 736a7903e2..0acba843a7 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -76,8 +76,15 @@ static bool s390_cpu_has_work(CPUState *cs)
> static void s390_cpu_load_normal(CPUState *s)
> {
> S390CPU *cpu = S390_CPU(s);
> - cpu->env.psw.addr = ldl_phys(s->as, 4) & PSW_MASK_ESA_ADDR;
> - cpu->env.psw.mask = PSW_MASK_32 | PSW_MASK_64;
> + uint64_t spsw = ldq_phys(s->as, 0);
> +
> + /* Mask out bit 12 and instruction address */
> + cpu->env.psw.mask = spsw & 0xfff7ffff80000000UL;
> + cpu->env.psw.addr = spsw & 0x7fffffffUL;
"set it after checking for psw bit 12" does not match your code.
> +
> + if (!(spsw & 0x8000000000000UL)) {
> + s390_program_interrupt(&cpu->env, PGM_SPECIFICATION, 0, RA_IGNORED);
> + }
So, this code is called from s390_machine_reset() via run_on_cpu() - so
not from a helper. There is no state to rewind. This feels wrong to me.
In tcg_s390_program_interrupt(), we do
1. A cpu_restore_state(), which is bad with a ra of 0
2. A cpu_loop_exit(), which is bad, as we are not in the cpu loop.
We *could* do here instead
/* This code is not called from the CPU loop, but via run_on_cpu() */
if (tcg_enabled()) {
/*
* HW injects a PGM exception with ILC 0. We won't rewind.
*/
env->int_pgm_ilen = 2;
trigger_pgm_exception(&cpu->env, PGM_SPECIFICATION);
} else {
kvm_s390_program_interrupt(env_archcpu(&cpu->env),
PGM_SPECIFICATION);
}
BUT I do wonder if we should actually get a PGM_SPECIFICATION for the
*diag* instruction, not on the boot CPU. I think you should check +
inject inside handle_diag_308() instead. Then that complicated handling
is gone.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2019-11-05 19:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 18:44 [PATCH] s390x: Properly fetch and test the short psw on diag308 subc 0/1 Janosch Frank
2019-11-05 19:29 ` David Hildenbrand [this message]
2019-11-05 19:34 ` Janosch Frank
2019-11-05 20:07 ` David Hildenbrand
2019-11-11 13:52 ` Janosch Frank
2019-11-11 14:09 ` David Hildenbrand
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=76ba0773-b6da-a73a-0a76-9a23f004a9b7@redhat.com \
--to=david@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).