Re: [PATCH 1/7] KVM ARM: Use KVM_ARM_VCPU_INIT to set target model and features.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 06 Aug 2012 15:29:18 +0300, Avi Kivity <avi@xxxxxxxxxx> wrote:
> On 08/06/2012 10:33 AM, Rusty Russell wrote:
> > +/* Supported Processor Types */
> > +#define KVM_ARM_TARGET_CORTEX_A15	(0xC0F)
> > +
> > +struct kvm_vcpu_init {
> > +	__u32 target;
> > +	__u32 features[7];
> > +};
> > +
> 
> Needs an entry in Documentation/virtual/kvm/api.txt.
> 
> Are there other arm-specific interfaces that want documenting?

Good catch:

Subject: KVM: ARM: Update documentation.
From: Rusty Russell <rusty.russell@xxxxxxxxxx>

Document that we use KVM_GET_MSRS/KVM_SET_MSRS and add
KVM_VCPU_GET_MSR_INDEX_LIST and KVM_ARM_VCPU_INIT.

Signed-off-by: Rusty Russell <rusty.russell@xxxxxxxxxx>

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 79c10fc..f3600ca 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -451,13 +451,14 @@ Support for this has been removed.  Use KVM_SET_GUEST_DEBUG instead.
 4.18 KVM_GET_MSRS
 
 Capability: basic
-Architectures: x86
+Architectures: x86, arm
 Type: vcpu ioctl
 Parameters: struct kvm_msrs (in/out)
 Returns: 0 on success, -1 on error
 
 Reads model-specific registers from the vcpu.  Supported msr indices can
-be obtained using KVM_GET_MSR_INDEX_LIST.
+be obtained using KVM_GET_MSR_INDEX_LIST (x86) or KVM_VCPU_GET_MSR_INDEX_LIST
+(arm).
 
 struct kvm_msrs {
 	__u32 nmsrs; /* number of msrs in entries */
@@ -480,7 +481,7 @@ kvm will fill in the 'data' member.
 4.19 KVM_SET_MSRS
 
 Capability: basic
-Architectures: x86
+Architectures: x86, arm
 Type: vcpu ioctl
 Parameters: struct kvm_msrs (in)
 Returns: 0 on success, -1 on error
@@ -1970,6 +1971,72 @@ the virtualized real-mode area (VRMA) facility, the kernel will
 re-create the VMRA HPTEs on the next KVM_RUN of any vcpu.)
 
 
+4.76 KVM_VCPU_GET_MSR_INDEX_LIST
+
+Capability: basic
+Architectures: arm
+Type: vcpu ioctl
+Parameters: struct kvm_msr_list (in/out)
+Returns: 0 on success; -1 on error
+Errors:
+  E2BIG:     the msr index list is too big to fit in the array specified by
+             the user.
+
+struct kvm_msr_list {
+	__u32 nmsrs; /* number of msrs in entries */
+	__u32 indices[0];
+};
+
+This ioctl returns the guest special registers that are supported, and
+is only valid after KVM_ARM_VCPU_INIT has been performed to initialize
+the vcpu type and features.  It is otherwise the equivalent of the
+x86-specific KVM_GET_MSR_INDEX_LIST, for arm's coprocessor registers
+and other non-register state.
+
+The numbering for the indices for coprocesors is simple: the upper 16
+bits are the coprocessor number.  If it's > 15, it's something else,
+for future expansion.
+
+Bit 15 indicates a 64-bit register.  For 64 bit registers the bottom 4
+bits are CRm, the next 4 are opc1 (just like the MCRR/MRCC instruction
+encoding).  For 32 bit registers, the bottom 4 bits are CRm, the next
+3 are opc2, the next 4 CRn, and the next 3 opc1 (the same order as the
+MRC/MCR instruction encoding, but not the same bit positions).
+
+64-bit coprocessor register:
+       ...|19 18 17 16|15|14 13 12 11 10  9  8| 7  6  5  4 |3  2  1  0|
+  ...0  0 |  cp num   | 1| 0  0  0  0  0  0  0|   opc1     |   CRm    |
+
+32-bit coprocessor register:
+       ...|19 18 17 16|15|14|13 12 11|10  9  8  7 |6  5  4 |3  2  1  0|
+  ...0  0 |  cp num   | 0| 0|  opc1  |    CRn     | opc2   |   CRm    |
+
+Non-coprocessor register:
+
+   | 32 31 30 29 28 27 26 25 24 23 22 21 20|19 18 17 16 15 ...
+   |     < some non-zero value >           | ...
+
+
+4.77 KVM_ARM_VCPU_INIT
+
+Capability: basic
+Architectures: arm
+Type: vcpu ioctl
+Parameters: struct struct kvm_vcpu_init (in)
+Returns: 0 on success; -1 on error
+Errors:
+  EINVAL:    the target is unknown, or the combination of features is invalid.
+  ENOENT:    a features bit specified is unknown.
+
+This tells KVM what type of CPU to present to the guest, and what
+optional features it should have.  This will cause a reset of the cpu
+registers to their initial values.  If this is not called, KVM_RUN will
+return ENOEXEC for that vcpu.
+
+Note that because some registers reflect machine topology, all vcpus
+should be created before this ioctl is invoked.
+
+
 5. The kvm_run structure
 ------------------------
 
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux