From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>
Cc: kvm@vger.kernel.org, seiden@linux.ibm.com, nrb@linux.ibm.com,
scgl@linux.ibm.com, thuth@redhat.com
Subject: Re: [kvm-unit-tests PATCH v2 4/7] lib: s390x: sie: Improve validity handling and make it vm specific
Date: Thu, 20 Oct 2022 11:18:23 +0200 [thread overview]
Message-ID: <20221020111823.0ed95d51@p-imbrenda> (raw)
In-Reply-To: <20221020090009.2189-5-frankja@linux.ibm.com>
On Thu, 20 Oct 2022 09:00:06 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:
> The current library doesn't support running multiple vms at once as it
> stores the validity once and not per vm. Let's move the validity
> handling into the vm and introduce a new function to retrieve the vir.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
> Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> lib/s390x/sie.c | 27 ++++++++++++++-------------
> lib/s390x/sie.h | 6 ++++--
> 2 files changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c
> index 00aff713..3fee3def 100644
> --- a/lib/s390x/sie.c
> +++ b/lib/s390x/sie.c
> @@ -15,19 +15,22 @@
> #include <libcflat.h>
> #include <alloc_page.h>
>
> -static bool validity_expected;
> -static uint16_t vir; /* Validity interception reason */
> -
> -void sie_expect_validity(void)
> +void sie_expect_validity(struct vm *vm)
> {
> - validity_expected = true;
> - vir = 0;
> + vm->validity_expected = true;
> }
>
> -void sie_check_validity(uint16_t vir_exp)
> +uint16_t sie_get_validity(struct vm *vm)
> {
> + assert(vm->sblk->icptcode == ICPT_VALIDITY);
> + return vm->sblk->ipb >> 16;
> +}
> +
> +void sie_check_validity(struct vm *vm, uint16_t vir_exp)
> +{
> + uint16_t vir = sie_get_validity(vm);
> +
> report(vir_exp == vir, "VALIDITY: %x", vir);
> - vir = 0;
> }
>
> void sie_handle_validity(struct vm *vm)
> @@ -35,11 +38,9 @@ void sie_handle_validity(struct vm *vm)
> if (vm->sblk->icptcode != ICPT_VALIDITY)
> return;
>
> - vir = vm->sblk->ipb >> 16;
> -
> - if (!validity_expected)
> - report_abort("VALIDITY: %x", vir);
> - validity_expected = false;
> + if (!vm->validity_expected)
> + report_abort("VALIDITY: %x", sie_get_validity(vm));
> + vm->validity_expected = false;
> }
>
> void sie(struct vm *vm)
> diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h
> index de91ea5a..320c4218 100644
> --- a/lib/s390x/sie.h
> +++ b/lib/s390x/sie.h
> @@ -233,14 +233,16 @@ struct vm {
> struct vm_uv uv; /* PV UV information */
> /* Ptr to first guest page */
> uint8_t *guest_mem;
> + bool validity_expected;
> };
>
> extern void sie_entry(void);
> extern void sie_exit(void);
> extern void sie64a(struct kvm_s390_sie_block *sblk, struct vm_save_area *save_area);
> void sie(struct vm *vm);
> -void sie_expect_validity(void);
> -void sie_check_validity(uint16_t vir_exp);
> +void sie_expect_validity(struct vm *vm);
> +uint16_t sie_get_validity(struct vm *vm);
> +void sie_check_validity(struct vm *vm, uint16_t vir_exp);
> void sie_handle_validity(struct vm *vm);
> void sie_guest_sca_create(struct vm *vm);
> void sie_guest_create(struct vm *vm, uint64_t guest_mem, uint64_t guest_mem_len);
next prev parent reply other threads:[~2022-10-20 9:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 9:00 [kvm-unit-tests PATCH v2 0/7] s390x: PV fixups Janosch Frank
2022-10-20 9:00 ` [kvm-unit-tests PATCH v2 1/7] s390x: snippets: asm: Add a macro to write an exception PSW Janosch Frank
2022-10-20 9:14 ` Claudio Imbrenda
2022-10-20 9:00 ` [kvm-unit-tests PATCH v2 2/7] s390x: MAKEFILE: Use $< instead of pathsubst Janosch Frank
2022-10-20 9:14 ` Claudio Imbrenda
2022-10-20 9:00 ` [kvm-unit-tests PATCH v2 3/7] s390x: Add a linker script to assembly snippets Janosch Frank
2022-10-20 10:02 ` Claudio Imbrenda
2022-10-20 9:00 ` [kvm-unit-tests PATCH v2 4/7] lib: s390x: sie: Improve validity handling and make it vm specific Janosch Frank
2022-10-20 9:18 ` Claudio Imbrenda [this message]
2022-10-20 9:00 ` [kvm-unit-tests PATCH v2 5/7] lib: s390x: Use a new asce for each PV guest Janosch Frank
2022-10-20 9:25 ` Claudio Imbrenda
2022-10-20 11:27 ` Janosch Frank
2022-10-20 11:46 ` Claudio Imbrenda
2022-10-20 9:00 ` [kvm-unit-tests PATCH v2 6/7] lib: s390x: Enable reusability of VMs that were in PV mode Janosch Frank
2022-10-20 9:26 ` Claudio Imbrenda
2022-10-20 9:00 ` [kvm-unit-tests PATCH v2 7/7] lib: s390x: sie: Properly populate SCA Janosch Frank
2022-10-20 9:50 ` Claudio Imbrenda
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=20221020111823.0ed95d51@p-imbrenda \
--to=imbrenda@linux.ibm.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