[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 03/16] s390x: protvirt: Support unpack facility
From: |
Christian Borntraeger |
Subject: |
Re: [PATCH v4 03/16] s390x: protvirt: Support unpack facility |
Date: |
Mon, 24 Feb 2020 15:13:55 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 20.02.20 13:56, Janosch Frank wrote:
> When a guest has saved a ipib of type 5 and calls diagnose308 with
> subcode 10, we have to setup the protected processing environment via
> Ultravisor calls. The calls are done by KVM and are exposed via an
> API.
>
> The following steps are necessary:
> 1. Create a VM (register it with the Ultravisor)
> 2. Create secure CPUs for all of our current cpus
maybe rephrase that to reflect the enable/disable change?
> 3. Forward the secure header to the Ultravisor (has all information on
> how to decrypt the image and VM information)
> 4. Protect image pages from the host and decrypt them
> 5. Verify the image integrity
>
> Only after step 5 a protected VM is allowed to run.
>
> Signed-off-by: Janosch Frank <address@hidden>
> Signed-off-by: Christian Borntraeger <address@hidden> [Changes
> to machine]
[...]
> diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
> new file mode 100644
> index 0000000000..8ae20f31c1
> --- /dev/null
> +++ b/hw/s390x/pv.c
> @@ -0,0 +1,106 @@
> +/*
> + * Secure execution functions
> + *
> + * Copyright IBM Corp. 2020
> + * Author(s):
> + * Janosch Frank <address@hidden>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or (at
> + * your option) any later version. See the COPYING file in the top-level
> + * directory.
> + */
> +#include "qemu/osdep.h"
> +#include <sys/ioctl.h>
> +
> +#include <linux/kvm.h>
> +
> +#include "qemu/error-report.h"
> +#include "sysemu/kvm.h"
> +#include "pv.h"
> +
> +const char *cmd_names[] = {
> + "VM_CREATE",
> + "VM_DESTROY",
ENABLE/DISABLE?
> + "VM_SET_SEC_PARAMS",
> + "VM_UNPACK",
> + "VM_VERIFY",
> + "VM_PREP_RESET",
> + "VM_UNSHARE_ALL",
> + NULL
> +};
Wild idea. Not sure if this is acceptable in QEMU.
These strings are only for the error_report, no?
Could we use a MACRO that uses this a as a string and b as the inter value?
-static int s390_pv_cmd(uint32_t cmd, void *data)
+#define S390_PV_CMD(cmd, data) s390_pv_cmd(cmd, #cmd, data)
+static int s390_pv_cmd(uint32_t cmd, const char *name, void *data)
and then replace all calls with S390_PV_CMD. (Of course also change the
error report to use name).
> +
> +static int s390_pv_cmd(uint32_t cmd, void *data)
> +{
> + int rc;
> + struct kvm_pv_cmd pv_cmd = {
> + .cmd = cmd,
> + .data = (uint64_t)data,
> + };
> +
> + rc = kvm_vm_ioctl(kvm_state, KVM_S390_PV_COMMAND, &pv_cmd);
> + if (rc) {
> + error_report("KVM PV command %d (%s) failed: header rc %x rrc %x "
> + "IOCTL rc: %d", cmd, cmd_names[cmd], pv_cmd.rc,
> pv_cmd.rrc,
> + rc);
> + }
> + return rc;
> +}
[...]
Maybe also change the subject. We do more than just unpack.
- Re: [PATCH v4 01/16] Sync pv, (continued)
- [PATCH v4 04/16] s390x: protvirt: Add migration blocker, Janosch Frank, 2020/02/20
- [PATCH v4 02/16] s390x: protvirt: Add diag308 subcodes 8 - 10, Janosch Frank, 2020/02/20
- [PATCH v4 05/16] s390x: protvirt: Handle diag 308 subcodes 0,1,3,4, Janosch Frank, 2020/02/20
- [PATCH v4 03/16] s390x: protvirt: Support unpack facility, Janosch Frank, 2020/02/20
- Re: [PATCH v4 03/16] s390x: protvirt: Support unpack facility,
Christian Borntraeger <=
- [PATCH v4 06/16] s390x: protvirt: KVM intercept changes, Janosch Frank, 2020/02/20
- [PATCH v4 07/16] s390x: Add SIDA memory ops, Janosch Frank, 2020/02/20
- [PATCH v4 08/16] s390x: protvirt: Move STSI data over SIDAD, Janosch Frank, 2020/02/20
- [PATCH v4 09/16] s390x: protvirt: SCLP interpretation, Janosch Frank, 2020/02/20