Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch kvm-arm64/misc-5.18 into kvmarm-master/next

* kvm-arm64/misc-5.18:
: .
: Misc fixes for KVM/arm64 5.18:
:
: - Drop unused kvm parameter to kvm_psci_version()
:
: - Implement CONFIG_DEBUG_LIST at EL2
:
: - Make CONFIG_ARM64_ERRATUM_2077057 default y
:
: - Only do the interrupt dance if we have exited because of an interrupt
:
: - Remove traces of 32bit ARM host support from the documentation
: .
Documentation: KVM: Update documentation to indicate KVM is arm64-only
KVM: arm64: Only open the interrupt window on exit due to an interrupt
KVM: arm64: Enable Cortex-A510 erratum 2077057 by default

Signed-off-by: Marc Zyngier <maz@kernel.org>

+50 -48
+43 -44
Documentation/virt/kvm/api.rst
··· 417 417 ----------------- 418 418 419 419 :Capability: basic 420 - :Architectures: all except ARM, arm64 420 + :Architectures: all except arm64 421 421 :Type: vcpu ioctl 422 422 :Parameters: struct kvm_regs (out) 423 423 :Returns: 0 on success, -1 on error ··· 450 450 ----------------- 451 451 452 452 :Capability: basic 453 - :Architectures: all except ARM, arm64 453 + :Architectures: all except arm64 454 454 :Type: vcpu ioctl 455 455 :Parameters: struct kvm_regs (in) 456 456 :Returns: 0 on success, -1 on error ··· 824 824 ----------------------- 825 825 826 826 :Capability: KVM_CAP_IRQCHIP, KVM_CAP_S390_IRQCHIP (s390) 827 - :Architectures: x86, ARM, arm64, s390 827 + :Architectures: x86, arm64, s390 828 828 :Type: vm ioctl 829 829 :Parameters: none 830 830 :Returns: 0 on success, -1 on error ··· 833 833 On x86, creates a virtual ioapic, a virtual PIC (two PICs, nested), and sets up 834 834 future vcpus to have a local APIC. IRQ routing for GSIs 0-15 is set to both 835 835 PIC and IOAPIC; GSI 16-23 only go to the IOAPIC. 836 - On ARM/arm64, a GICv2 is created. Any other GIC versions require the usage of 836 + On arm64, a GICv2 is created. Any other GIC versions require the usage of 837 837 KVM_CREATE_DEVICE, which also supports creating a GICv2. Using 838 838 KVM_CREATE_DEVICE is preferred over KVM_CREATE_IRQCHIP for GICv2. 839 839 On s390, a dummy irq routing table is created. ··· 846 846 ----------------- 847 847 848 848 :Capability: KVM_CAP_IRQCHIP 849 - :Architectures: x86, arm, arm64 849 + :Architectures: x86, arm64 850 850 :Type: vm ioctl 851 851 :Parameters: struct kvm_irq_level 852 852 :Returns: 0 on success, -1 on error ··· 870 870 of course). 871 871 872 872 873 - ARM/arm64 can signal an interrupt either at the CPU level, or at the 873 + arm64 can signal an interrupt either at the CPU level, or at the 874 874 in-kernel irqchip (GIC), and for in-kernel irqchip can tell the GIC to 875 875 use PPIs designated for specific cpus. The irq field is interpreted 876 876 like this:: ··· 896 896 identified as (256 * vcpu2_index + vcpu_index). Otherwise, vcpu2_index 897 897 must be zero. 898 898 899 - Note that on arm/arm64, the KVM_CAP_IRQCHIP capability only conditions 899 + Note that on arm64, the KVM_CAP_IRQCHIP capability only conditions 900 900 injection of interrupts for the in-kernel irqchip. KVM_IRQ_LINE can always 901 901 be used for a userspace interrupt controller. 902 902 ··· 1087 1087 1088 1088 :Capability: KVM_CAP_VCPU_EVENTS 1089 1089 :Extended by: KVM_CAP_INTR_SHADOW 1090 - :Architectures: x86, arm, arm64 1090 + :Architectures: x86, arm64 1091 1091 :Type: vcpu ioctl 1092 1092 :Parameters: struct kvm_vcpu_event (out) 1093 1093 :Returns: 0 on success, -1 on error ··· 1146 1146 fields contain a valid state. This bit will be set whenever 1147 1147 KVM_CAP_EXCEPTION_PAYLOAD is enabled. 1148 1148 1149 - ARM/ARM64: 1150 - ^^^^^^^^^^ 1149 + ARM64: 1150 + ^^^^^^ 1151 1151 1152 1152 If the guest accesses a device that is being emulated by the host kernel in 1153 1153 such a way that a real device would generate a physical SError, KVM may make ··· 1206 1206 1207 1207 :Capability: KVM_CAP_VCPU_EVENTS 1208 1208 :Extended by: KVM_CAP_INTR_SHADOW 1209 - :Architectures: x86, arm, arm64 1209 + :Architectures: x86, arm64 1210 1210 :Type: vcpu ioctl 1211 1211 :Parameters: struct kvm_vcpu_event (in) 1212 1212 :Returns: 0 on success, -1 on error ··· 1241 1241 exception_has_payload, exception_payload, and exception.pending fields 1242 1242 contain a valid state and shall be written into the VCPU. 1243 1243 1244 - ARM/ARM64: 1245 - ^^^^^^^^^^ 1244 + ARM64: 1245 + ^^^^^^ 1246 1246 1247 1247 User space may need to inject several types of events to the guest. 1248 1248 ··· 1449 1449 --------------------- 1450 1450 1451 1451 :Capability: KVM_CAP_MP_STATE 1452 - :Architectures: x86, s390, arm, arm64, riscv 1452 + :Architectures: x86, s390, arm64, riscv 1453 1453 :Type: vcpu ioctl 1454 1454 :Parameters: struct kvm_mp_state (out) 1455 1455 :Returns: 0 on success; -1 on error ··· 1467 1467 1468 1468 ========================== =============================================== 1469 1469 KVM_MP_STATE_RUNNABLE the vcpu is currently running 1470 - [x86,arm/arm64,riscv] 1470 + [x86,arm64,riscv] 1471 1471 KVM_MP_STATE_UNINITIALIZED the vcpu is an application processor (AP) 1472 1472 which has not yet received an INIT signal [x86] 1473 1473 KVM_MP_STATE_INIT_RECEIVED the vcpu has received an INIT signal, and is ··· 1476 1476 is waiting for an interrupt [x86] 1477 1477 KVM_MP_STATE_SIPI_RECEIVED the vcpu has just received a SIPI (vector 1478 1478 accessible via KVM_GET_VCPU_EVENTS) [x86] 1479 - KVM_MP_STATE_STOPPED the vcpu is stopped [s390,arm/arm64,riscv] 1479 + KVM_MP_STATE_STOPPED the vcpu is stopped [s390,arm64,riscv] 1480 1480 KVM_MP_STATE_CHECK_STOP the vcpu is in a special error state [s390] 1481 1481 KVM_MP_STATE_OPERATING the vcpu is operating (running or halted) 1482 1482 [s390] ··· 1488 1488 in-kernel irqchip, the multiprocessing state must be maintained by userspace on 1489 1489 these architectures. 1490 1490 1491 - For arm/arm64/riscv: 1492 - ^^^^^^^^^^^^^^^^^^^^ 1491 + For arm64/riscv: 1492 + ^^^^^^^^^^^^^^^^ 1493 1493 1494 1494 The only states that are valid are KVM_MP_STATE_STOPPED and 1495 1495 KVM_MP_STATE_RUNNABLE which reflect if the vcpu is paused or not. ··· 1498 1498 --------------------- 1499 1499 1500 1500 :Capability: KVM_CAP_MP_STATE 1501 - :Architectures: x86, s390, arm, arm64, riscv 1501 + :Architectures: x86, s390, arm64, riscv 1502 1502 :Type: vcpu ioctl 1503 1503 :Parameters: struct kvm_mp_state (in) 1504 1504 :Returns: 0 on success; -1 on error ··· 1510 1510 in-kernel irqchip, the multiprocessing state must be maintained by userspace on 1511 1511 these architectures. 1512 1512 1513 - For arm/arm64/riscv: 1514 - ^^^^^^^^^^^^^^^^^^^^ 1513 + For arm64/riscv: 1514 + ^^^^^^^^^^^^^^^^ 1515 1515 1516 1516 The only states that are valid are KVM_MP_STATE_STOPPED and 1517 1517 KVM_MP_STATE_RUNNABLE which reflect if the vcpu should be paused or not. ··· 1780 1780 ------------------------ 1781 1781 1782 1782 :Capability: KVM_CAP_IRQ_ROUTING 1783 - :Architectures: x86 s390 arm arm64 1783 + :Architectures: x86 s390 arm64 1784 1784 :Type: vm ioctl 1785 1785 :Parameters: struct kvm_irq_routing (in) 1786 1786 :Returns: 0 on success, -1 on error 1787 1787 1788 1788 Sets the GSI routing table entries, overwriting any previously set entries. 1789 1789 1790 - On arm/arm64, GSI routing has the following limitation: 1790 + On arm64, GSI routing has the following limitation: 1791 1791 1792 1792 - GSI routing does not apply to KVM_IRQ_LINE but only to KVM_IRQFD. 1793 1793 ··· 2855 2855 ------------------- 2856 2856 2857 2857 :Capability: KVM_CAP_SIGNAL_MSI 2858 - :Architectures: x86 arm arm64 2858 + :Architectures: x86 arm64 2859 2859 :Type: vm ioctl 2860 2860 :Parameters: struct kvm_msi (in) 2861 2861 :Returns: >0 on delivery, 0 if guest blocked the MSI, and -1 on error ··· 3043 3043 -------------- 3044 3044 3045 3045 :Capability: KVM_CAP_IRQFD 3046 - :Architectures: x86 s390 arm arm64 3046 + :Architectures: x86 s390 arm64 3047 3047 :Type: vm ioctl 3048 3048 :Parameters: struct kvm_irqfd (in) 3049 3049 :Returns: 0 on success, -1 on error ··· 3069 3069 irqfd. The KVM_IRQFD_FLAG_RESAMPLE is only necessary on assignment 3070 3070 and need not be specified with KVM_IRQFD_FLAG_DEASSIGN. 3071 3071 3072 - On arm/arm64, gsi routing being supported, the following can happen: 3072 + On arm64, gsi routing being supported, the following can happen: 3073 3073 3074 3074 - in case no routing entry is associated to this gsi, injection fails 3075 3075 - in case the gsi is associated to an irqchip routing entry, ··· 3325 3325 ---------------------- 3326 3326 3327 3327 :Capability: basic 3328 - :Architectures: arm, arm64 3328 + :Architectures: arm64 3329 3329 :Type: vcpu ioctl 3330 3330 :Parameters: struct kvm_vcpu_init (in) 3331 3331 :Returns: 0 on success; -1 on error ··· 3423 3423 ----------------------------- 3424 3424 3425 3425 :Capability: basic 3426 - :Architectures: arm, arm64 3426 + :Architectures: arm64 3427 3427 :Type: vm ioctl 3428 3428 :Parameters: struct kvm_vcpu_init (out) 3429 3429 :Returns: 0 on success; -1 on error ··· 3452 3452 --------------------- 3453 3453 3454 3454 :Capability: basic 3455 - :Architectures: arm, arm64, mips 3455 + :Architectures: arm64, mips 3456 3456 :Type: vcpu ioctl 3457 3457 :Parameters: struct kvm_reg_list (in/out) 3458 3458 :Returns: 0 on success; -1 on error ··· 3479 3479 ----------------------------------------- 3480 3480 3481 3481 :Capability: KVM_CAP_ARM_SET_DEVICE_ADDR 3482 - :Architectures: arm, arm64 3482 + :Architectures: arm64 3483 3483 :Type: vm ioctl 3484 3484 :Parameters: struct kvm_arm_device_address (in) 3485 3485 :Returns: 0 on success, -1 on error ··· 3506 3506 to know about. The id field is an architecture specific identifier for a 3507 3507 specific device. 3508 3508 3509 - ARM/arm64 divides the id field into two parts, a device id and an 3509 + arm64 divides the id field into two parts, a device id and an 3510 3510 address type id specific to the individual device:: 3511 3511 3512 3512 bits: | 63 ... 32 | 31 ... 16 | 15 ... 0 | 3513 3513 field: | 0x00000000 | device id | addr type id | 3514 3514 3515 - ARM/arm64 currently only require this when using the in-kernel GIC 3515 + arm64 currently only require this when using the in-kernel GIC 3516 3516 support for the hardware VGIC features, using KVM_ARM_DEVICE_VGIC_V2 3517 3517 as the device id. When setting the base address for the guest's 3518 3518 mapping of the VGIC virtual CPU and distributor interface, the ioctl ··· 4726 4726 ------------------------------------ 4727 4727 4728 4728 :Capability: KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 4729 - :Architectures: x86, arm, arm64, mips 4729 + :Architectures: x86, arm64, mips 4730 4730 :Type: vm ioctl 4731 4731 :Parameters: struct kvm_clear_dirty_log (in) 4732 4732 :Returns: 0 on success, -1 on error ··· 4838 4838 4.119 KVM_ARM_VCPU_FINALIZE 4839 4839 --------------------------- 4840 4840 4841 - :Architectures: arm, arm64 4841 + :Architectures: arm64 4842 4842 :Type: vcpu ioctl 4843 4843 :Parameters: int feature (in) 4844 4844 :Returns: 0 on success, -1 on error ··· 5920 5920 5921 5921 If exit_reason is KVM_EXIT_SYSTEM_EVENT then the vcpu has triggered 5922 5922 a system-level event using some architecture specific mechanism (hypercall 5923 - or some special instruction). In case of ARM/ARM64, this is triggered using 5923 + or some special instruction). In case of ARM64, this is triggered using 5924 5924 HVC instruction based PSCI call from the vcpu. The 'type' field describes 5925 5925 the system-level event type. The 'flags' field describes architecture 5926 5926 specific flags for the system-level event. ··· 6018 6018 __u64 fault_ipa; 6019 6019 } arm_nisv; 6020 6020 6021 - Used on arm and arm64 systems. If a guest accesses memory not in a memslot, 6021 + Used on arm64 systems. If a guest accesses memory not in a memslot, 6022 6022 KVM will typically return to userspace and ask it to do MMIO emulation on its 6023 6023 behalf. However, for certain classes of instructions, no instruction decode 6024 6024 (direction, length of memory access) is provided, and fetching and decoding ··· 6035 6035 Userspace implementations can query for KVM_CAP_ARM_NISV_TO_USER, and enable 6036 6036 this capability at VM creation. Once this is done, these types of errors will 6037 6037 instead return to userspace with KVM_EXIT_ARM_NISV, with the valid bits from 6038 - the HSR (arm) and ESR_EL2 (arm64) in the esr_iss field, and the faulting IPA 6039 - in the fault_ipa field. Userspace can either fix up the access if it's 6040 - actually an I/O access by decoding the instruction from guest memory (if it's 6041 - very brave) and continue executing the guest, or it can decide to suspend, 6042 - dump, or restart the guest. 6038 + the ESR_EL2 in the esr_iss field, and the faulting IPA in the fault_ipa field. 6039 + Userspace can either fix up the access if it's actually an I/O access by 6040 + decoding the instruction from guest memory (if it's very brave) and continue 6041 + executing the guest, or it can decide to suspend, dump, or restart the guest. 6043 6042 6044 6043 Note that KVM does not skip the faulting instruction as it does for 6045 6044 KVM_EXIT_MMIO, but userspace has to emulate any change to the processing state ··· 6745 6746 6746 6747 7.18 KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 6747 6748 6748 - :Architectures: x86, arm, arm64, mips 6749 + :Architectures: x86, arm64, mips 6749 6750 :Parameters: args[0] whether feature should be enabled or not 6750 6751 6751 6752 Valid flags are:: ··· 7128 7129 8.9 KVM_CAP_ARM_USER_IRQ 7129 7130 ------------------------ 7130 7131 7131 - :Architectures: arm, arm64 7132 + :Architectures: arm64 7132 7133 7133 7134 This capability, if KVM_CHECK_EXTENSION indicates that it is available, means 7134 7135 that if userspace creates a VM without an in-kernel interrupt controller, it ··· 7255 7256 8.19 KVM_CAP_ARM_INJECT_SERROR_ESR 7256 7257 ---------------------------------- 7257 7258 7258 - :Architectures: arm, arm64 7259 + :Architectures: arm64 7259 7260 7260 7261 This capability indicates that userspace can specify (via the 7261 7262 KVM_SET_VCPU_EVENTS ioctl) the syndrome value reported to the guest when it
+1 -1
Documentation/virt/kvm/devices/vcpu.rst
··· 140 140 2. GROUP: KVM_ARM_VCPU_TIMER_CTRL 141 141 ================================= 142 142 143 - :Architectures: ARM, ARM64 143 + :Architectures: ARM64 144 144 145 145 2.1. ATTRIBUTES: KVM_ARM_VCPU_TIMER_IRQ_VTIMER, KVM_ARM_VCPU_TIMER_IRQ_PTIMER 146 146 -----------------------------------------------------------------------------
+1
arch/arm64/Kconfig
··· 682 682 683 683 config ARM64_ERRATUM_2077057 684 684 bool "Cortex-A510: 2077057: workaround software-step corrupting SPSR_EL2" 685 + default y 685 686 help 686 687 This option adds the workaround for ARM Cortex-A510 erratum 2077057. 687 688 Affected Cortex-A510 may corrupt SPSR_EL2 when the a step exception is
+5 -3
arch/arm64/kvm/arm.c
··· 887 887 * context synchronization event) is necessary to ensure that 888 888 * pending interrupts are taken. 889 889 */ 890 - local_irq_enable(); 891 - isb(); 892 - local_irq_disable(); 890 + if (ARM_EXCEPTION_CODE(ret) == ARM_EXCEPTION_IRQ) { 891 + local_irq_enable(); 892 + isb(); 893 + local_irq_disable(); 894 + } 893 895 894 896 guest_timing_exit_irqoff(); 895 897