public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	david@redhat.com, thuth@redhat.com, seiden@linux.ibm.com,
	mhartmay@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH 4/8] s390x: uv: Add more UV call functions
Date: Tue, 23 Nov 2021 11:56:43 +0100	[thread overview]
Message-ID: <20211123115643.57829808@p-imbrenda> (raw)
In-Reply-To: <20211123103956.2170-5-frankja@linux.ibm.com>

On Tue, 23 Nov 2021 10:39:52 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> To manage protected guests we need a few more UV calls:
>    * import / export
>    * destroy page
>    * set SE header
>    * set cpu state
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  lib/s390x/asm/uv.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 85 insertions(+)
> 
> diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h
> index 8baf896f..6e331211 100644
> --- a/lib/s390x/asm/uv.h
> +++ b/lib/s390x/asm/uv.h
> @@ -33,6 +33,7 @@
>  #define UVC_CMD_DESTROY_SEC_CPU		0x0121
>  #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_SET_SEC_CONF_PARAMS	0x0300
>  #define UVC_CMD_UNPACK_IMG		0x0301
>  #define UVC_CMD_VERIFY_IMG		0x0302
> @@ -256,6 +257,63 @@ static inline int uv_remove_shared(unsigned long addr)
>  	return share(addr, UVC_CMD_REMOVE_SHARED_ACCESS);
>  }
>  
> +static inline int uv_cmd_nodata(uint64_t handle, uint16_t cmd, uint16_t *rc, uint16_t *rrc)
> +{
> +	struct uv_cb_nodata uvcb = {
> +		.header.cmd = cmd,
> +		.header.len = sizeof(uvcb),
> +		.handle = handle,
> +	};
> +	int cc;
> +
> +	assert(handle);
> +	cc = uv_call(0, (uint64_t)&uvcb);
> +	*rc = uvcb.header.rc;
> +	*rrc = uvcb.header.rrc;
> +	return cc;
> +}
> +
> +static inline int uv_import(uint64_t handle, unsigned long gaddr)
> +{
> +	struct uv_cb_cts uvcb = {
> +		.header.cmd = UVC_CMD_CONV_TO_SEC_STOR,
> +		.header.len = sizeof(uvcb),
> +		.guest_handle = handle,
> +		.gaddr = gaddr,
> +	};
> +
> +	return uv_call(0, (uint64_t)&uvcb);
> +}
> +
> +static inline int uv_export(unsigned long paddr)
> +{
> +	struct uv_cb_cfs uvcb = {
> +		.header.cmd = UVC_CMD_CONV_FROM_SEC_STOR,
> +		.header.len = sizeof(uvcb),
> +		.paddr = paddr
> +	};
> +
> +	return uv_call(0, (u64)&uvcb);
> +}
> +
> +/*
> + * Requests the Ultravisor to destroy a guest page and make it
> + * accessible to the host. The destroy clears the page instead of
> + * exporting.
> + *
> + * @paddr: Absolute host address of page to be destroyed
> + */
> +static inline int uv_destroy_page(unsigned long paddr)
> +{
> +	struct uv_cb_cfs uvcb = {
> +		.header.cmd = UVC_CMD_DESTR_SEC_STOR,
> +		.header.len = sizeof(uvcb),
> +		.paddr = paddr
> +	};
> +
> +	return uv_call(0, (uint64_t)&uvcb);
> +}
> +
>  struct uv_cb_cpu_set_state {
>  	struct uv_cb_header header;
>  	u64 reserved08[2];
> @@ -270,4 +328,31 @@ struct uv_cb_cpu_set_state {
>  #define PV_CPU_STATE_CHKSTP	3
>  #define PV_CPU_STATE_OPR_LOAD	5
>  
> +static inline int uv_set_cpu_state(uint64_t handle, uint8_t state)
> +{
> +	struct uv_cb_cpu_set_state uvcb = {
> +		.header.cmd = UVC_CMD_CPU_SET_STATE,
> +		.header.len = sizeof(uvcb),
> +		.cpu_handle = handle,
> +		.state = state,
> +	};
> +
> +	assert(handle);
> +	return uv_call(0, (uint64_t)&uvcb);
> +}
> +
> +static inline int uv_set_se_hdr(uint64_t handle, void *hdr, size_t len)
> +{
> +	struct uv_cb_ssc uvcb = {
> +		.header.cmd = UVC_CMD_SET_SEC_CONF_PARAMS,
> +		.header.len = sizeof(uvcb),
> +		.sec_header_origin = (uint64_t)hdr,
> +		.sec_header_len = len,
> +		.guest_handle = handle,
> +	};
> +
> +	assert(handle);
> +	return uv_call(0, (uint64_t)&uvcb);
> +}
> +
>  #endif


  reply	other threads:[~2021-11-23 11:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 10:39 [kvm-unit-tests PATCH 0/8] s390x: sie: Add PV snippet support Janosch Frank
2021-11-23 10:39 ` [kvm-unit-tests PATCH 1/8] lib: s390x: sie: Add sca allocation and freeing Janosch Frank
2021-11-23 10:51   ` Claudio Imbrenda
2021-11-23 10:39 ` [kvm-unit-tests PATCH 2/8] s390x: sie: Add PV fields to SIE control block Janosch Frank
2021-11-23 10:52   ` Claudio Imbrenda
2021-11-23 10:39 ` [kvm-unit-tests PATCH 3/8] s390x: sie: Add UV information into VM struct Janosch Frank
2021-11-23 10:54   ` Claudio Imbrenda
2021-11-23 12:49     ` Janosch Frank
2021-11-23 10:39 ` [kvm-unit-tests PATCH 4/8] s390x: uv: Add more UV call functions Janosch Frank
2021-11-23 10:56   ` Claudio Imbrenda [this message]
2021-11-23 10:39 ` [kvm-unit-tests PATCH 5/8] s390x: lib: Extend UV library with PV guest management Janosch Frank
2021-11-23 11:13   ` Claudio Imbrenda
2021-11-23 10:39 ` [kvm-unit-tests PATCH 6/8] lib: s390: sie: Add PV guest register handling Janosch Frank
2021-11-23 11:14   ` Claudio Imbrenda
2021-11-23 10:39 ` [kvm-unit-tests PATCH 7/8] s390x: snippets: Add PV support Janosch Frank
2021-11-23 11:22   ` Claudio Imbrenda
2021-11-26 13:28     ` Janosch Frank
2021-12-03  9:29       ` Janosch Frank
2022-01-13 13:10         ` Janosch Frank
2022-01-13 13:17           ` Claudio Imbrenda
2021-11-23 10:39 ` [kvm-unit-tests PATCH 8/8] s390x: sie: Add PV diag test Janosch Frank
2021-11-23 11:41   ` 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=20211123115643.57829808@p-imbrenda \
    --to=imbrenda@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mhartmay@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