mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V0.1 2/3] selftests: sev_migrate_tests: Fix sev_ioctl()
@ 2021-12-09 18:24 Peter Gonda
  0 siblings, 0 replies; only message in thread
From: Peter Gonda @ 2021-12-09 18:24 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Peter Gonda, Paolo Bonzini, Sean Christopherson, Marc Orr

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.

Currently issues with the PSP driver functions mean the firmware error
is not always reset to SEV_RET_SUCCESS when a call is successful.
Mainly sev_platform_init() doesn't correctly set the fw error if the
platform has already been initialized.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Marc Orr <marcorr@google.com>
Signed-off-by: Peter Gonda <pgonda@google.com>
---

V0.1
 * Removes extra whitespace line.
 * Corrects patch description.

---
 tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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 fbc742b42145..4bb960ca6486 100644
--- a/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
+++ b/tools/testing/selftests/kvm/x86_64/sev_migrate_tests.c
@@ -30,8 +30,9 @@ 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);
 }
-- 
2.34.1.400.ga245620fadb-goog


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-09 18:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09 18:24 [PATCH V0.1 2/3] selftests: sev_migrate_tests: Fix sev_ioctl() Peter Gonda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®