[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAA03e5G1wMBrP_1+YS2TZxRpcdJQ6CqxRqry8FQpq_PJcCS0jw@mail.gmail.com>
Date: Tue, 7 Dec 2021 14:47:40 -0800
From: Marc Orr <marcorr@...gle.com>
To: Peter Gonda <pgonda@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>
Subject: Re: [PATCH] selftests: sev_migrate_tests: Fix sev_ioctl()
On Tue, Dec 7, 2021 at 12:10 PM Peter Gonda <pgonda@...gle.com> wrote:
>
> TEST_ASSERT in SEV ioctl was allowing errors because it checked return
> value was good OR the FW error code was OK. This TEST_ASSERT should
> require both (aka. AND) values are OK. Removes the LAUNCH_START from the
> mirror VM because this call correctly fails because mirror VMs cannot
> call this command.
>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Sean Christopherson <seanjc@...gle.com>
> Cc: Marc Orr <marcorr@...gle.com>
> Signed-off-by: Peter Gonda <pgonda@...gle.com>
> ---
> tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c b/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
> index 29b18d565cf4..8e1b1e737cb1 100644
> --- a/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
> +++ b/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
> @@ -31,7 +31,7 @@ static void sev_ioctl(int vm_fd, int cmd_id, void *data)
> int ret;
>
> ret = ioctl(vm_fd, KVM_MEMORY_ENCRYPT_OP, &cmd);
> - TEST_ASSERT((ret == 0 || cmd.error == SEV_RET_SUCCESS),
> + TEST_ASSERT(ret == 0 && cmd.error == SEV_RET_SUCCESS,
> "%d failed: return code: %d, errno: %d, fw error: %d",
> cmd_id, ret, errno, cmd.error);
> }
> @@ -228,9 +228,6 @@ static void sev_mirror_create(int dst_fd, int src_fd)
> static void test_sev_mirror(bool es)
> {
> struct kvm_vm *src_vm, *dst_vm;
> - struct kvm_sev_launch_start start = {
> - .policy = es ? SEV_POLICY_ES : 0
> - };
> int i;
>
> src_vm = sev_vm_create(es);
> @@ -241,7 +238,7 @@ static void test_sev_mirror(bool es)
> /* Check that we can complete creation of the mirror VM. */
> for (i = 0; i < NR_MIGRATE_TEST_VCPUS; ++i)
> vm_vcpu_add(dst_vm, i);
> - sev_ioctl(dst_vm->fd, KVM_SEV_LAUNCH_START, &start);
> +
> if (es)
> sev_ioctl(dst_vm->fd, KVM_SEV_LAUNCH_UPDATE_VMSA, NULL);
>
> --
> 2.34.1.400.ga245620fadb-goog
>
+1 to Sean's feedback.
Otherwise:
Reviewed-by: Marc Orr <marcorr@...gle.com>
Powered by blists - more mailing lists