From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>
Cc: kvm@vger.kernel.org, nrb@linux.ibm.com, borntraeger@de.ibm.com,
thuth@redhat.com, david@redhat.com, schlameuss@linux.ibm.com,
linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH v2 1/1] s390x: pv: Add test for large host pages backing
Date: Wed, 20 Nov 2024 18:36:58 +0100 [thread overview]
Message-ID: <20241120183658.5e5f5ce7@p-imbrenda> (raw)
In-Reply-To: <1ae6d8ef-fde6-4673-9727-4117a08dfe46@linux.ibm.com>
On Wed, 20 Nov 2024 17:33:48 +0100
Janosch Frank <frankja@linux.ibm.com> wrote:
> On 11/11/24 1:15 PM, Claudio Imbrenda wrote:
> > Add a new test to check that the host can use 1M large pages to back
> > protected guests when the corresponding feature is present.
> >
> > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> > ---
> > s390x/Makefile | 2 +
> > lib/s390x/asm/arch_def.h | 1 +
> > lib/s390x/asm/uv.h | 18 ++
> > s390x/pv-edat1.c | 463 +++++++++++++++++++++++++++++++++++
> > s390x/snippets/c/pv-memhog.c | 59 +++++
> > 5 files changed, 543 insertions(+)
> > create mode 100644 s390x/pv-edat1.c
> > create mode 100644 s390x/snippets/c/pv-memhog.c
> >
> > diff --git a/s390x/Makefile b/s390x/Makefile
> > index 23342bd6..c5c6f92c 100644
> > --- a/s390x/Makefile
> > +++ b/s390x/Makefile
> > @@ -48,6 +48,7 @@ tests += $(TEST_DIR)/sie-dat.elf
> > pv-tests += $(TEST_DIR)/pv-diags.elf
> > pv-tests += $(TEST_DIR)/pv-icptcode.elf
> > pv-tests += $(TEST_DIR)/pv-ipl.elf
> > +pv-tests += $(TEST_DIR)/pv-edat1.elf
> >
> > ifneq ($(HOST_KEY_DOCUMENT),)
> > ifneq ($(GEN_SE_HEADER),)
> > @@ -137,6 +138,7 @@ $(TEST_DIR)/pv-icptcode.elf: pv-snippets += $(SNIPPET_DIR)/asm/icpt-loop.gbin
> > $(TEST_DIR)/pv-icptcode.elf: pv-snippets += $(SNIPPET_DIR)/asm/loop.gbin
> > $(TEST_DIR)/pv-icptcode.elf: pv-snippets += $(SNIPPET_DIR)/asm/pv-icpt-vir-timing.gbin
> > $(TEST_DIR)/pv-ipl.elf: pv-snippets += $(SNIPPET_DIR)/asm/pv-diag-308.gbin
> > +$(TEST_DIR)/pv-edat1.elf: pv-snippets += $(SNIPPET_DIR)/c/pv-memhog.gbin
> >
> > ifneq ($(GEN_SE_HEADER),)
> > snippets += $(pv-snippets)
> > diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> > index 745a3387..481ede8f 100644
> > --- a/lib/s390x/asm/arch_def.h
> > +++ b/lib/s390x/asm/arch_def.h
> > @@ -249,6 +249,7 @@ extern struct lowcore lowcore;
> > #define PGM_INT_CODE_REGION_FIRST_TRANS 0x39
> > #define PGM_INT_CODE_REGION_SECOND_TRANS 0x3a
> > #define PGM_INT_CODE_REGION_THIRD_TRANS 0x3b
> > +#define PGM_INT_CODE_SECURE_PAGE_SIZE 0x3c
> > #define PGM_INT_CODE_SECURE_STOR_ACCESS 0x3d
> > #define PGM_INT_CODE_NON_SECURE_STOR_ACCESS 0x3e
> > #define PGM_INT_CODE_SECURE_STOR_VIOLATION 0x3f
> > diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h
> > index 611dcd3f..7527be48 100644
> > --- a/lib/s390x/asm/uv.h
> > +++ b/lib/s390x/asm/uv.h
> > @@ -35,6 +35,7 @@
> > #define UVC_CMD_CONV_TO_SEC_STOR 0x0200
> > #define UVC_CMD_CONV_FROM_SEC_STOR 0x0201
> > #define UVC_CMD_DESTR_SEC_STOR 0x0202
> > +#define UVC_CMD_VERIFY_LARGE_FRAME 0x0203
> > #define UVC_CMD_SET_SEC_CONF_PARAMS 0x0300
> > #define UVC_CMD_UNPACK_IMG 0x0301
> > #define UVC_CMD_VERIFY_IMG 0x0302
> > @@ -74,6 +75,11 @@ enum uv_cmds_inst {
> > BIT_UVC_CMD_PIN_PAGE_SHARED = 21,
> > BIT_UVC_CMD_UNPIN_PAGE_SHARED = 22,
> > BIT_UVC_CMD_ATTESTATION = 28,
> > + BIT_UVC_CMD_VERIFY_LARGE_FRAME = 32,
> > +};
> > +
> > +enum uv_features {
> > + BIT_UV_1M_BACKING = 6,
> > };
> >
> > struct uv_cb_header {
> > @@ -312,6 +318,18 @@ static inline int uv_import(uint64_t handle, unsigned long gaddr)
> > return uv_call(0, (uint64_t)&uvcb);
> > }
> >
> > +static inline int uv_merge(uint64_t handle, unsigned long gaddr)
> > +{
> > + struct uv_cb_cts uvcb = {
> > + .header.cmd = UVC_CMD_VERIFY_LARGE_FRAME,
> > + .header.len = sizeof(uvcb),
> > + .guest_handle = handle,
> > + .gaddr = gaddr,
> > + };
> > +
> > + return uv_call(0, (uint64_t)&uvcb);
> > +}
>
> I don't understand why you added this to the lib if you're not using it
> even once since you have your own function that returns more data.
I don't remember :D
I'll have a closer look
>
> Are you expecting other tests to regularly need this UVC?
> The attestation test for instance added the constants but no function
> since the call is basically only used for one test.
>
>
>
prev parent reply other threads:[~2024-11-20 17:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 12:15 [kvm-unit-tests PATCH v2 1/1] s390x: pv: Add test for large host pages backing Claudio Imbrenda
2024-11-19 15:48 ` Christoph Schlameuss
2024-11-19 18:01 ` Claudio Imbrenda
2024-11-20 16:33 ` Janosch Frank
2024-11-20 17:36 ` Claudio Imbrenda [this message]
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=20241120183658.5e5f5ce7@p-imbrenda \
--to=imbrenda@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=schlameuss@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