Re: [PATCH v4 09/34] KVM: selftests: Add a selftest for guest prints and formatted asserts

From: Sean Christopherson
Date: Mon Jul 31 2023 - 13:21:04 EST


On Mon, Jul 31, 2023, Sean Christopherson wrote:
> On Mon, Jul 31, 2023, Andrew Jones wrote:
> > diff --git a/tools/testing/selftests/kvm/include/ucall_common.h b/tools/testing/selftests/kvm/include/ucall_common.h
> > index 4cf69fa8bfba..4adf526dc378 100644
> > --- a/tools/testing/selftests/kvm/include/ucall_common.h
> > +++ b/tools/testing/selftests/kvm/include/ucall_common.h
> > @@ -6,8 +6,19 @@
> > */
> > #ifndef SELFTEST_KVM_UCALL_COMMON_H
> > #define SELFTEST_KVM_UCALL_COMMON_H
> > +#include <linux/kvm.h>
> > #include "test_util.h"
> >
> > +#if defined(__aarch64__)
> > +#define UCALL_EXIT_REASON KVM_EXIT_MMIO
> > +#elif defined(__x86_64__)
> > +#define UCALL_EXIT_REASON KVM_EXIT_IO
> > +#elif defined(__s390x__)
> > +#define UCALL_EXIT_REASON KVM_EXIT_S390_SIEIC
> > +#elif defined(__riscv)
> > +#define UCALL_EXIT_REASON KVM_EXIT_RISCV_SBI
> > +#endif
> > +
> > /* Common ucalls */
> > enum {
> > UCALL_NONE,
> >
> > and then compiled the test for riscv and it passed. I also ran all other
> > riscv tests successfully.
>
> Can I have your SoB for the ucall_common.h patch? I'll write a changelog and fold
> in a separate prep patch for that change.

On second thought, I take that back. I think it makes more sense to add a ucall.h
for each arch and #define the exit type there. All then move all of the
ucall_arch_do_ucall() implementations to ucall.h (except maybe x86 while it has
the horrific save/restore GPRs hack...). That way the #define is colocated with
the code that generates the exit reason.