From: David Matlack <dmatlack@google.com>
To: Vipin Sharma <vipinsh@google.com>
Cc: seanjc@google.com, pbonzini@redhat.com, vkuznets@redhat.com,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] KVM: selftests: Move hypercall() to hyper.h
Date: Mon, 7 Nov 2022 10:30:44 -0800 [thread overview]
Message-ID: <Y2lO1HQtaMBCGpcZ@google.com> (raw)
In-Reply-To: <20221105045704.2315186-6-vipinsh@google.com>
On Fri, Nov 04, 2022 at 09:57:03PM -0700, Vipin Sharma wrote:
> hypercall() can be used by other hyperv tests, move it to hyperv.h.
>
> Signed-off-by: Vipin Sharma <vipinsh@google.com>
> ---
> .../selftests/kvm/include/x86_64/hyperv.h | 17 +++++++++++++++++
> .../selftests/kvm/x86_64/hyperv_features.c | 17 -----------------
> 2 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/include/x86_64/hyperv.h b/tools/testing/selftests/kvm/include/x86_64/hyperv.h
> index 9d8c325af1d9..87d8d9e444f7 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/hyperv.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/hyperv.h
> @@ -199,4 +199,21 @@ static inline uint64_t hv_linux_guest_id(void)
> ((uint64_t)LINUX_VERSION_CODE << 16);
> }
>
> +static inline uint8_t hypercall(u64 control, vm_vaddr_t input_address,
> + vm_vaddr_t output_address, uint64_t *hv_status)
> +{
> + uint8_t vector;
> +
> + /* Note both the hypercall and the "asm safe" clobber r9-r11. */
> + asm volatile("mov %[output_address], %%r8\n\t"
> + KVM_ASM_SAFE("vmcall")
> + : "=a" (*hv_status),
> + "+c" (control), "+d" (input_address),
> + KVM_ASM_SAFE_OUTPUTS(vector)
> + : [output_address] "r"(output_address),
> + "a" (-EFAULT)
> + : "cc", "memory", "r8", KVM_ASM_SAFE_CLOBBERS);
> + return vector;
> +}
Since this function is Hyper-V specific it probably makes sense to
rename it to hyperv_hypercall() as part of moving it to library, e.g. to
differentiate it from kvm_hypercall().
> +
> #endif /* !SELFTEST_KVM_HYPERV_H */
> diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_features.c b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
> index b5a42cf1ad9d..31b22ee07dfb 100644
> --- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c
> +++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
> @@ -13,23 +13,6 @@
> #include "processor.h"
> #include "hyperv.h"
>
> -static inline uint8_t hypercall(u64 control, vm_vaddr_t input_address,
> - vm_vaddr_t output_address, uint64_t *hv_status)
> -{
> - uint8_t vector;
> -
> - /* Note both the hypercall and the "asm safe" clobber r9-r11. */
> - asm volatile("mov %[output_address], %%r8\n\t"
> - KVM_ASM_SAFE("vmcall")
> - : "=a" (*hv_status),
> - "+c" (control), "+d" (input_address),
> - KVM_ASM_SAFE_OUTPUTS(vector)
> - : [output_address] "r"(output_address),
> - "a" (-EFAULT)
> - : "cc", "memory", "r8", KVM_ASM_SAFE_CLOBBERS);
> - return vector;
> -}
> -
> struct msr_data {
> uint32_t idx;
> bool available;
> --
> 2.38.1.273.g43a17bfeac-goog
>
next prev parent reply other threads:[~2022-11-07 18:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 4:56 [PATCH 0/6] Add Hyper-v extended hypercall support in KVM Vipin Sharma
2022-11-05 4:56 ` [PATCH 1/6] KVM: x86: hyper-v: Use common code for hypercall userspace exit Vipin Sharma
2022-11-05 4:57 ` [PATCH 2/6] KVM: x86: hyper-v: Add extended hypercall support in Hyper-v Vipin Sharma
2022-11-05 4:57 ` [PATCH 3/6] KVM: selftests: Test Hyper-V extended hypercall enablement Vipin Sharma
2022-11-07 18:27 ` David Matlack
2022-11-08 1:46 ` Vipin Sharma
2022-11-05 4:57 ` [PATCH 4/6] KVM: selftests: Make Hyper-V guest OS ID common Vipin Sharma
2022-11-07 19:08 ` David Matlack
2022-11-08 1:45 ` Vipin Sharma
2022-11-08 17:56 ` David Matlack
2022-11-09 13:48 ` Vitaly Kuznetsov
2022-11-09 18:52 ` Vipin Sharma
2022-11-09 20:18 ` Sean Christopherson
2022-11-10 10:02 ` Vitaly Kuznetsov
2022-11-05 4:57 ` [PATCH 5/6] KVM: selftests: Move hypercall() to hyper.h Vipin Sharma
2022-11-07 18:30 ` David Matlack [this message]
2022-11-08 1:48 ` Vipin Sharma
2022-11-08 17:40 ` David Matlack
2022-11-09 13:46 ` Vitaly Kuznetsov
2022-11-05 4:57 ` [PATCH 6/6] KVM: selftests: Test Hyper-V extended hypercall exit to userspace Vipin Sharma
2022-11-07 19:01 ` David Matlack
2022-11-08 2:04 ` Vipin Sharma
2022-11-08 17:44 ` David Matlack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y2lO1HQtaMBCGpcZ@google.com \
--to=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=vipinsh@google.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).