Re: [PATCH v4] self_tests/kvm: sync_regs test for diag318

Collin Walling
2020-12-07T19:10:16Z

On 12/7/20 11:55 AM, Cornelia Huck wrote:
> On Mon, 7 Dec 2020 10:41:25 -0500
> Collin Walling <walling@linux.ibm.com> wrote:
>
>> The DIAGNOSE 0x0318 instruction, unique to s390x, is a privileged call
>> that must be intercepted via SIE, handled in userspace, and the
>> information set by the instruction is communicated back to KVM.
>>
>> To test the instruction interception, an ad-hoc handler is defined which
>> simply has a VM execute the instruction and then userspace will extract
>> the necessary info. The handler is defined such that the instruction
>> invocation occurs only once. It is up to the caller to determine how the
>> info returned by this handler should be used.
>>
>> The diag318 info is communicated from userspace to KVM via a sync_regs
>> call. This is tested During a sync_regs test, where the diag318 info is
>
> s/During/during/
>
>> requested via the handler, then the info is stored in the appropriate
>> register in KVM via a sync registers call.
>>
>> If KVM does not support diag318, then the tests will print a message
>> stating that diag318 was skipped, and the asserts will simply test
>> against a value of 0.
>>
>> Signed-off-by: Collin Walling <walling@linux.ibm.com>
>> ---
>> tools/testing/selftests/kvm/Makefile | 2 +-
>> .../kvm/include/s390x/diag318_test_handler.h | 13 +++
>> .../kvm/lib/s390x/diag318_test_handler.c | 82 +++++++++++++++++++
>> .../selftests/kvm/s390x/sync_regs_test.c | 16 +++-
>> 4 files changed, 111 insertions(+), 2 deletions(-)
>> create mode 100644 tools/testing/selftests/kvm/include/s390x/diag318_test_handler.h
>> create mode 100644 tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.c
>
> Looks reasonable to me.
>
> Acked-by: Cornelia Huck <cohuck@redhat.com>
>

Thanks. I'll resubmit the entire patch as a reply to the top-most email
with the proposed commit message changes.

--
Regards,
Collin

Stay safe and stay healthy