From: Pavel Machek <pavel@ucw.cz>
To: Avi Kivity <avi@qumranet.com>
Cc: linux-kernel@vger.kernel.org, kvm-devel@lists.sourceforge.net,
Christian Borntraeger <borntraeger@de.ibm.com>
Subject: Re: [PATCH 06/55] KVM: Per-architecture hypercall definitions
Date: Wed, 26 Dec 2007 20:32:26 +0100 [thread overview]
Message-ID: <20071226193226.GA8844@elf.ucw.cz> (raw)
In-Reply-To: <1198667160-22953-7-git-send-email-avi@qumranet.com>
Hi!
> Currently kvm provides hypercalls only for x86* architectures. To
> provide hypercall infrastructure for other kvm architectures I split
> kvm_para.h into a generic header file and architecture specific
> definitions.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Avi Kivity <avi@qumranet.com>
> ---
> include/asm-x86/kvm_para.h | 105 ++++++++++++++++++++++++++++++++++++++++++++
> include/linux/kvm_para.h | 105 +++++---------------------------------------
> 2 files changed, 117 insertions(+), 93 deletions(-)
> create mode 100644 include/asm-x86/kvm_para.h
>
> diff --git a/include/asm-x86/kvm_para.h b/include/asm-x86/kvm_para.h
> new file mode 100644
> index 0000000..c6f3fd8
> --- /dev/null
> +++ b/include/asm-x86/kvm_para.h
> @@ -0,0 +1,105 @@
> +#ifndef __X86_KVM_PARA_H
> +#define __X86_KVM_PARA_H
> +
> +/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It
> + * should be used to determine that a VM is running under KVM.
> + */
> +#define KVM_CPUID_SIGNATURE 0x40000000
so it returns 'KVMKVMKVM' in %rax, too?
> +/* For KVM hypercalls, a three-byte sequence of either the vmrun or the vmmrun
> + * instruction. The hypervisor may replace it with something else but only the
> + * instructions are guaranteed to be supported.
> + *
> + * Up to four arguments may be passed in rbx, rcx, rdx, and rsi respectively.
> + * The hypercall number should be placed in rax and the return
rax? First, this file is shared with i386, AFAICT.
> + * placed in rax. No other registers will be clobbered unless explicited
> + * noted by the particular hypercall.
> + */
> +
> +static inline long kvm_hypercall0(unsigned int nr)
> +{
> + long ret;
> + asm volatile(KVM_HYPERCALL
> + : "=a"(ret)
> + : "a"(nr));
Second, if it is to be placed in rax, nr should be unsigned long?
> +static inline int kvm_para_available(void)
> +{
> + unsigned int eax, ebx, ecx, edx;
> + char signature[13];
> +
> + cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx);
> + memcpy(signature + 0, &ebx, 4);
> + memcpy(signature + 4, &ecx, 4);
> + memcpy(signature + 8, &edx, 4);
> + signature[12] = 0;
> +
ebx|ecx|ed
> + if (strcmp(signature, "KVMKVMKVM") == 0)
> + return 1;
Should the comment say
> +/* This CPUID returns the signature 'KVMKVMKVM\0\0\0' in ebx, ecx, and edx. It
> + * should be used to determine that a VM is running under KVM.
> + */
Plus, I'd use memcmp, and actually test for those zeros, too.
...which probably can be done later, as this is pure move...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
Christian Borntraeger
<borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 06/55] KVM: Per-architecture hypercall definitions
Date: Wed, 26 Dec 2007 20:32:26 +0100 [thread overview]
Message-ID: <20071226193226.GA8844@elf.ucw.cz> (raw)
In-Reply-To: <1198667160-22953-7-git-send-email-avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Hi!
> Currently kvm provides hypercalls only for x86* architectures. To
> provide hypercall infrastructure for other kvm architectures I split
> kvm_para.h into a generic header file and architecture specific
> definitions.
>
> Signed-off-by: Christian Borntraeger <borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
> ---
> include/asm-x86/kvm_para.h | 105 ++++++++++++++++++++++++++++++++++++++++++++
> include/linux/kvm_para.h | 105 +++++---------------------------------------
> 2 files changed, 117 insertions(+), 93 deletions(-)
> create mode 100644 include/asm-x86/kvm_para.h
>
> diff --git a/include/asm-x86/kvm_para.h b/include/asm-x86/kvm_para.h
> new file mode 100644
> index 0000000..c6f3fd8
> --- /dev/null
> +++ b/include/asm-x86/kvm_para.h
> @@ -0,0 +1,105 @@
> +#ifndef __X86_KVM_PARA_H
> +#define __X86_KVM_PARA_H
> +
> +/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It
> + * should be used to determine that a VM is running under KVM.
> + */
> +#define KVM_CPUID_SIGNATURE 0x40000000
so it returns 'KVMKVMKVM' in %rax, too?
> +/* For KVM hypercalls, a three-byte sequence of either the vmrun or the vmmrun
> + * instruction. The hypervisor may replace it with something else but only the
> + * instructions are guaranteed to be supported.
> + *
> + * Up to four arguments may be passed in rbx, rcx, rdx, and rsi respectively.
> + * The hypercall number should be placed in rax and the return
rax? First, this file is shared with i386, AFAICT.
> + * placed in rax. No other registers will be clobbered unless explicited
> + * noted by the particular hypercall.
> + */
> +
> +static inline long kvm_hypercall0(unsigned int nr)
> +{
> + long ret;
> + asm volatile(KVM_HYPERCALL
> + : "=a"(ret)
> + : "a"(nr));
Second, if it is to be placed in rax, nr should be unsigned long?
> +static inline int kvm_para_available(void)
> +{
> + unsigned int eax, ebx, ecx, edx;
> + char signature[13];
> +
> + cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx);
> + memcpy(signature + 0, &ebx, 4);
> + memcpy(signature + 4, &ecx, 4);
> + memcpy(signature + 8, &edx, 4);
> + signature[12] = 0;
> +
ebx|ecx|ed
> + if (strcmp(signature, "KVMKVMKVM") == 0)
> + return 1;
Should the comment say
> +/* This CPUID returns the signature 'KVMKVMKVM\0\0\0' in ebx, ecx, and edx. It
> + * should be used to determine that a VM is running under KVM.
> + */
Plus, I'd use memcmp, and actually test for those zeros, too.
...which probably can be done later, as this is pure move...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2007-12-26 19:32 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-26 11:05 [PATCH 00/55] KVM patch queue review for 2.6.25 merge window (part II) Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 01/55] KVM: Portability: Split kvm_vcpu into arch dependent and independent parts (part 1) Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 02/55] KVM: Move vmx_vcpu_reset() out of vmx_vcpu_setup() Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 03/55] KVM: Add a might_sleep() annotation to gfn_to_page() Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 04/55] KVM: Export PIC reset for kernel device reset Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 05/55] KVM: Split IOAPIC reset function and export for kernel RESET Avi Kivity
2007-12-26 11:05 ` [PATCH 06/55] KVM: Per-architecture hypercall definitions Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 19:32 ` Pavel Machek [this message]
2007-12-26 19:32 ` Pavel Machek
2007-12-27 7:03 ` Avi Kivity
2007-12-27 7:03 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 07/55] KVM: Unmap kernel-allocated memory on slot destruction Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 08/55] KVM: Export memory slot allocation mechanism Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 09/55] KVM: Add kernel-internal memory slots Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 10/55] KVM: Add ioctl to tss address from userspace, Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 11/55] KVM: VMX: Let gcc to choose which registers to save (x86_64) Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 12/55] KVM: VMX: Let gcc to choose which registers to save (i386) Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 13/55] KVM: SVM: Let gcc to choose which registers to save (x86_64) Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 14/55] KVM: SVM: Let gcc to choose which registers to save (i386) Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 15/55] KVM: x86 emulator: don't depend on cr2 for mov abs emulation Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 16/55] KVM: Move page fault processing to common code Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 17/55] KVM: MMU: Topup the mmu memory preallocation caches before emulating an insn Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 18/55] KVM: Portability: Split kvm_vm_ioctl v3 Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 19/55] KVM: Portability: Move memory segmentation to x86.c Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 20/55] KVM: Portability: move get/set_apic_base " Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 21/55] KVM: Portability: Move control register helper functions " Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 22/55] KVM: VMX: Enable memory mapped TPR shadow (FlexPriority) Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 23/55] KVM: Fix gfn_to_page() acquiring mmap_sem twice Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 24/55] KVM: Portability: Move kvm_get/set_msr[_common] to x86.c Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 25/55] KVM: Portability: Move x86 emulation and mmio device hook " Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 26/55] KVM: Portability: Move pio emulation functions " Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 27/55] KVM: x86 emulator: Extract the common code of SrcReg and DstReg Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 28/55] KVM: x86 emulator: centralize decoding of one-byte register access insns Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 29/55] KVM: Simplify decode_register_operand() calling convention Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 30/55] KVM: Make mark_page_dirty() work for aliased pages too Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 31/55] KVM: x86 emulator: Hoist modrm and abs decoding into separate functions Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 32/55] KVM: Portability: Make exported debugfs data architecture-specific Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 33/55] KVM: Portability: Move x86 instruction emulation code to x86.c Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 34/55] KVM: Portability: Move x86 FPU handling " Avi Kivity
2007-12-26 11:05 ` [PATCH 35/55] KVM: Portability: Move x86 vcpu ioctl handlers " Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 36/55] KVM: Add make_page_dirty() to kvm_clear_guest_page() Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 37/55] KVM: VMX: Use vmx to inject real-mode interrupts Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 38/55] KVM: VMX: Read & store IDT_VECTORING_INFO_FIELD Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 39/55] KVM: Fix faults during injection of real-mode interrupts Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 40/55] KVM: VMX: Comment VMX primary/secondary exec ctl definitions Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 41/55] KVM: VMX: wbinvd exiting Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 42/55] KVM: x86 emulator: remove 8 bytes operands emulator for call near instruction Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 43/55] KVM: Simplify CPU_TASKS_FROZEN cpu notifier handling Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 44/55] KVM: add kvm_is_error_hva() Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 45/55] KVM: introduce gfn_to_hva() Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 46/55] KVM: Change kvm_{read,write}_guest() to use copy_{from,to}_user() Avi Kivity
2007-12-26 11:05 ` [PATCH 46/55] KVM: Change kvm_{read, write}_guest() to use copy_{from, to}_user() Avi Kivity
2007-12-26 11:05 ` [PATCH 47/55] KVM: Portability: Move some includes to x86.c Avi Kivity
2007-12-26 11:05 ` [PATCH 48/55] KVM: Portability: Move kvm_x86_ops " Avi Kivity
2007-12-26 11:05 ` [PATCH 49/55] KVM: Portability: Add vcpu and hardware management arch hooks Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 50/55] KVM: Portability: Combine kvm_init and kvm_init_x86 Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 51/55] KVM: Portability: Move x86 specific code from kvm_init() to kvm_arch() Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 52/55] KVM: x86 emulator: modify 'lods', and 'stos' not to depend on CR2 Avi Kivity
2007-12-26 11:05 ` Avi Kivity
2007-12-26 11:05 ` [PATCH 53/55] KVM: Portability: move KVM_CHECK_EXTENSION Avi Kivity
2007-12-26 11:05 ` [PATCH 54/55] KVM: VMX: Consolidate register usage in vmx_vcpu_run() Avi Kivity
2007-12-26 11:06 ` [PATCH 55/55] KVM: Portability: Make kvm_vcpu_ioctl_translate arch dependent Avi Kivity
2007-12-26 11:06 ` Avi Kivity
2007-12-26 20:47 ` [PATCH 00/55] KVM patch queue review for 2.6.25 merge window (part II) Sam Ravnborg
2007-12-27 6:51 ` Avi Kivity
2007-12-27 6:51 ` Avi Kivity
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=20071226193226.GA8844@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=avi@qumranet.com \
--cc=borntraeger@de.ibm.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.