hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/Documentation/virt/kvm/api.rst
....@@ -4036,6 +4036,18 @@
40364036 :Parameters: struct kvm_s390_cmma_log (in, out)
40374037 :Returns: 0 on success, a negative value on error
40384038
4039
+Errors:
4040
+
4041
+ ====== =============================================================
4042
+ ENOMEM not enough memory can be allocated to complete the task
4043
+ ENXIO if CMMA is not enabled
4044
+ EINVAL if KVM_S390_CMMA_PEEK is not set but migration mode was not enabled
4045
+ EINVAL if KVM_S390_CMMA_PEEK is not set but dirty tracking has been
4046
+ disabled (and thus migration mode was automatically disabled)
4047
+ EFAULT if the userspace address is invalid or if no page table is
4048
+ present for the addresses (e.g. when using hugepages).
4049
+ ====== =============================================================
4050
+
40394051 This ioctl is used to get the values of the CMMA bits on the s390
40404052 architecture. It is meant to be used in two scenarios:
40414053
....@@ -4115,12 +4127,6 @@
41154127 mask is unused.
41164128
41174129 values points to the userspace buffer where the result will be stored.
4118
-
4119
-This ioctl can fail with -ENOMEM if not enough memory can be allocated to
4120
-complete the task, with -ENXIO if CMMA is not enabled, with -EINVAL if
4121
-KVM_S390_CMMA_PEEK is not set but migration mode was not enabled, with
4122
--EFAULT if the userspace address is invalid or if no page table is
4123
-present for the addresses (e.g. when using hugepages).
41244130
41254131 4.108 KVM_S390_SET_CMMA_BITS
41264132 ----------------------------
....@@ -6403,3 +6409,63 @@
64036409 guest according to the bits in the KVM_CPUID_FEATURES CPUID leaf
64046410 (0x40000001). Otherwise, a guest may use the paravirtual features
64056411 regardless of what has actually been exposed through the CPUID leaf.
6412
+
6413
+9. Known KVM API problems
6414
+=========================
6415
+
6416
+In some cases, KVM's API has some inconsistencies or common pitfalls
6417
+that userspace need to be aware of. This section details some of
6418
+these issues.
6419
+
6420
+Most of them are architecture specific, so the section is split by
6421
+architecture.
6422
+
6423
+9.1. x86
6424
+--------
6425
+
6426
+``KVM_GET_SUPPORTED_CPUID`` issues
6427
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6428
+
6429
+In general, ``KVM_GET_SUPPORTED_CPUID`` is designed so that it is possible
6430
+to take its result and pass it directly to ``KVM_SET_CPUID2``. This section
6431
+documents some cases in which that requires some care.
6432
+
6433
+Local APIC features
6434
+~~~~~~~~~~~~~~~~~~~
6435
+
6436
+CPU[EAX=1]:ECX[21] (X2APIC) is reported by ``KVM_GET_SUPPORTED_CPUID``,
6437
+but it can only be enabled if ``KVM_CREATE_IRQCHIP`` or
6438
+``KVM_ENABLE_CAP(KVM_CAP_IRQCHIP_SPLIT)`` are used to enable in-kernel emulation of
6439
+the local APIC.
6440
+
6441
+The same is true for the ``KVM_FEATURE_PV_UNHALT`` paravirtualized feature.
6442
+
6443
+CPU[EAX=1]:ECX[24] (TSC_DEADLINE) is not reported by ``KVM_GET_SUPPORTED_CPUID``.
6444
+It can be enabled if ``KVM_CAP_TSC_DEADLINE_TIMER`` is present and the kernel
6445
+has enabled in-kernel emulation of the local APIC.
6446
+
6447
+CPU topology
6448
+~~~~~~~~~~~~
6449
+
6450
+Several CPUID values include topology information for the host CPU:
6451
+0x0b and 0x1f for Intel systems, 0x8000001e for AMD systems. Different
6452
+versions of KVM return different values for this information and userspace
6453
+should not rely on it. Currently they return all zeroes.
6454
+
6455
+If userspace wishes to set up a guest topology, it should be careful that
6456
+the values of these three leaves differ for each CPU. In particular,
6457
+the APIC ID is found in EDX for all subleaves of 0x0b and 0x1f, and in EAX
6458
+for 0x8000001e; the latter also encodes the core id and node id in bits
6459
+7:0 of EBX and ECX respectively.
6460
+
6461
+Obsolete ioctls and capabilities
6462
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6463
+
6464
+KVM_CAP_DISABLE_QUIRKS does not let userspace know which quirks are actually
6465
+available. Use ``KVM_CHECK_EXTENSION(KVM_CAP_DISABLE_QUIRKS2)`` instead if
6466
+available.
6467
+
6468
+Ordering of KVM_GET_*/KVM_SET_* ioctls
6469
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6470
+
6471
+TBD