OSDN Git Service

KVM: selftests: Add string formatting options to ucall
authorAaron Lewis <aaronlewis@google.com>
Sat, 29 Jul 2023 00:36:16 +0000 (17:36 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 2 Aug 2023 21:41:59 +0000 (14:41 -0700)
commit57e5c1fef5ecc7c346ff971817ba6985643e0a24
tree9193c25240ea5f4b5ae450c26f1bd470d7a2677e
parent215a681710a554b224d743e4a9cd68965889713c
KVM: selftests: Add string formatting options to ucall

Add more flexibility to guest debugging and testing by adding
GUEST_PRINTF() and GUEST_ASSERT_FMT() to the ucall framework.

Add a sized buffer to the ucall structure to hold the formatted string,
i.e. to allow the guest to easily resolve the string, and thus avoid the
ugly pattern of the host side having to make assumptions about the desired
format, as well as having to pass around a large number of parameters.

The buffer size was chosen to accommodate most use cases, and based on
similar usage.  E.g. printf() uses the same size buffer in
arch/x86/boot/printf.c.  And 1KiB ought to be enough for anybody.

Signed-off-by: Aaron Lewis <aaronlewis@google.com>
[sean: massage changelog, wrap macro param in ()]
Link: https://lore.kernel.org/r/20230729003643.1053367-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/ucall_common.h
tools/testing/selftests/kvm/lib/ucall_common.c