Skip to content

Commit e8069f5

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm updates from Paolo Bonzini: "ARM64: - Eager page splitting optimization for dirty logging, optionally allowing for a VM to avoid the cost of hugepage splitting in the stage-2 fault path. - Arm FF-A proxy for pKVM, allowing a pKVM host to safely interact with services that live in the Secure world. pKVM intervenes on FF-A calls to guarantee the host doesn't misuse memory donated to the hyp or a pKVM guest. - Support for running the split hypervisor with VHE enabled, known as 'hVHE' mode. This is extremely useful for testing the split hypervisor on VHE-only systems, and paves the way for new use cases that depend on having two TTBRs available at EL2. - Generalized framework for configurable ID registers from userspace. KVM/arm64 currently prevents arbitrary CPU feature set configuration from userspace, but the intent is to relax this limitation and allow userspace to select a feature set consistent with the CPU. - Enable the use of Branch Target Identification (FEAT_BTI) in the hypervisor. - Use a separate set of pointer authentication keys for the hypervisor when running in protected mode, as the host is untrusted at runtime. - Ensure timer IRQs are consistently released in the init failure paths. - Avoid trapping CTR_EL0 on systems with Enhanced Virtualization Traps (FEAT_EVT), as it is a register commonly read from userspace. - Erratum workaround for the upcoming AmpereOne part, which has broken hardware A/D state management. RISC-V: - Redirect AMO load/store misaligned traps to KVM guest - Trap-n-emulate AIA in-kernel irqchip for KVM guest - Svnapot support for KVM Guest s390: - New uvdevice secret API - CMM selftest and fixes - fix racy access to target CPU for diag 9c x86: - Fix missing/incorrect #GP checks on ENCLS - Use standard mmu_notifier hooks for handling APIC access page - Drop now unnecessary TR/TSS load after VM-Exit on AMD - Print more descriptive information about the status of SEV and SEV-ES during module load - Add a test for splitting and reconstituting hugepages during and after dirty logging - Add support for CPU pinning in demand paging test - Add support for AMD PerfMonV2, with a variety of cleanups and minor fixes included along the way - Add a "nx_huge_pages=never" option to effectively avoid creating NX hugepage recovery threads (because nx_huge_pages=off can be toggled at runtime) - Move handling of PAT out of MTRR code and dedup SVM+VMX code - Fix output of PIC poll command emulation when there's an interrupt - Add a maintainer's handbook to document KVM x86 processes, preferred coding style, testing expectations, etc. - Misc cleanups, fixes and comments Generic: - Miscellaneous bugfixes and cleanups Selftests: - Generate dependency files so that partial rebuilds work as expected" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (153 commits) Documentation/process: Add a maintainer handbook for KVM x86 Documentation/process: Add a label for the tip tree handbook's coding style KVM: arm64: Fix misuse of KVM_ARM_VCPU_POWER_OFF bit index RISC-V: KVM: Remove unneeded semicolon RISC-V: KVM: Allow Svnapot extension for Guest/VM riscv: kvm: define vcpu_sbi_ext_pmu in header RISC-V: KVM: Expose IMSIC registers as attributes of AIA irqchip RISC-V: KVM: Add in-kernel virtualization of AIA IMSIC RISC-V: KVM: Expose APLIC registers as attributes of AIA irqchip RISC-V: KVM: Add in-kernel emulation of AIA APLIC RISC-V: KVM: Implement device interface for AIA irqchip RISC-V: KVM: Skeletal in-kernel AIA irqchip support RISC-V: KVM: Set kvm_riscv_aia_nr_hgei to zero RISC-V: KVM: Add APLIC related defines RISC-V: KVM: Add IMSIC related defines RISC-V: KVM: Implement guest external interrupt line management KVM: x86: Remove PRIx* definitions as they are solely for user space s390/uv: Update query for secret-UVCs s390/uv: replace scnprintf with sysfs_emit s390/uvdevice: Add 'Lock Secret Store' UVC ...
2 parents eded377 + 255006a commit e8069f5

125 files changed

Lines changed: 8004 additions & 1007 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/arch/arm64/silicon-errata.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ stable kernels.
5252
| Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 |
5353
+----------------+-----------------+-----------------+-----------------------------+
5454
+----------------+-----------------+-----------------+-----------------------------+
55+
| Ampere | AmpereOne | AC03_CPU_38 | AMPERE_ERRATUM_AC03_CPU_38 |
56+
+----------------+-----------------+-----------------+-----------------------------+
57+
+----------------+-----------------+-----------------+-----------------------------+
5558
| ARM | Cortex-A510 | #2457168 | ARM64_ERRATUM_2457168 |
5659
+----------------+-----------------+-----------------+-----------------------------+
5760
| ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_2064142 |

Documentation/process/maintainer-handbooks.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ Contents:
1818
maintainer-netdev
1919
maintainer-soc
2020
maintainer-tip
21+
maintainer-kvm-x86

Documentation/process/maintainer-kvm-x86.rst

Lines changed: 390 additions & 0 deletions
Large diffs are not rendered by default.

Documentation/process/maintainer-tip.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ and can be added to an existing kernel config by running:
455455
Some of these options are x86-specific and can be left out when testing
456456
on other architectures.
457457

458+
.. _maintainer-tip-coding-style:
459+
458460
Coding style notes
459461
------------------
460462

Documentation/virt/kvm/api.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8445,6 +8445,33 @@ structure.
84458445
When getting the Modified Change Topology Report value, the attr->addr
84468446
must point to a byte where the value will be stored or retrieved from.
84478447

8448+
8.40 KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE
8449+
---------------------------------------
8450+
8451+
:Capability: KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE
8452+
:Architectures: arm64
8453+
:Type: vm
8454+
:Parameters: arg[0] is the new split chunk size.
8455+
:Returns: 0 on success, -EINVAL if any memslot was already created.
8456+
8457+
This capability sets the chunk size used in Eager Page Splitting.
8458+
8459+
Eager Page Splitting improves the performance of dirty-logging (used
8460+
in live migrations) when guest memory is backed by huge-pages. It
8461+
avoids splitting huge-pages (into PAGE_SIZE pages) on fault, by doing
8462+
it eagerly when enabling dirty logging (with the
8463+
KVM_MEM_LOG_DIRTY_PAGES flag for a memory region), or when using
8464+
KVM_CLEAR_DIRTY_LOG.
8465+
8466+
The chunk size specifies how many pages to break at a time, using a
8467+
single allocation for each chunk. Bigger the chunk size, more pages
8468+
need to be allocated ahead of time.
8469+
8470+
The chunk size needs to be a valid block size. The list of acceptable
8471+
block sizes is exposed in KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES as a
8472+
64-bit bitmap (each bit describing a block size). The default value is
8473+
0, to disable the eager page splitting.
8474+
84488475
9. Known KVM API problems
84498476
=========================
84508477

Documentation/virt/kvm/x86/mmu.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Shadow pages contain the following information:
205205
role.passthrough:
206206
The page is not backed by a guest page table, but its first entry
207207
points to one. This is set if NPT uses 5-level page tables (host
208-
CR4.LA57=1) and is shadowing L1's 4-level NPT (L1 CR4.LA57=1).
208+
CR4.LA57=1) and is shadowing L1's 4-level NPT (L1 CR4.LA57=0).
209209
gfn:
210210
Either the guest page table containing the translations shadowed by this
211211
page, or the base page frame for linear translations. See role.direct.

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11546,6 +11546,7 @@ M: Sean Christopherson <seanjc@google.com>
1154611546
M: Paolo Bonzini <pbonzini@redhat.com>
1154711547
L: kvm@vger.kernel.org
1154811548
S: Supported
11549+
P: Documentation/process/maintainer-kvm-x86.rst
1154911550
T: git git://git.kernel.org/pub/scm/virt/kvm/kvm.git
1155011551
F: arch/x86/include/asm/kvm*
1155111552
F: arch/x86/include/asm/svm.h

arch/arm64/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,25 @@ menu "Kernel Features"
414414

415415
menu "ARM errata workarounds via the alternatives framework"
416416

417+
config AMPERE_ERRATUM_AC03_CPU_38
418+
bool "AmpereOne: AC03_CPU_38: Certain bits in the Virtualization Translation Control Register and Translation Control Registers do not follow RES0 semantics"
419+
default y
420+
help
421+
This option adds an alternative code sequence to work around Ampere
422+
erratum AC03_CPU_38 on AmpereOne.
423+
424+
The affected design reports FEAT_HAFDBS as not implemented in
425+
ID_AA64MMFR1_EL1.HAFDBS, but (V)TCR_ELx.{HA,HD} are not RES0
426+
as required by the architecture. The unadvertised HAFDBS
427+
implementation suffers from an additional erratum where hardware
428+
A/D updates can occur after a PTE has been marked invalid.
429+
430+
The workaround forces KVM to explicitly set VTCR_EL2.HA to 0,
431+
which avoids enabling unadvertised hardware Access Flag management
432+
at stage-2.
433+
434+
If unsure, say Y.
435+
417436
config ARM64_WORKAROUND_CLEAN_CACHE
418437
bool
419438

arch/arm64/include/asm/cpufeature.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#define MAX_CPU_FEATURES 128
1616
#define cpu_feature(x) KERNEL_HWCAP_ ## x
1717

18+
#define ARM64_SW_FEATURE_OVERRIDE_NOKASLR 0
19+
#define ARM64_SW_FEATURE_OVERRIDE_HVHE 4
20+
1821
#ifndef __ASSEMBLY__
1922

2023
#include <linux/bug.h>
@@ -905,6 +908,7 @@ static inline unsigned int get_vmid_bits(u64 mmfr1)
905908
return 8;
906909
}
907910

911+
s64 arm64_ftr_safe_value(const struct arm64_ftr_bits *ftrp, s64 new, s64 cur);
908912
struct arm64_ftr_reg *get_arm64_ftr_reg(u32 sys_id);
909913

910914
extern struct arm64_ftr_override id_aa64mmfr1_override;
@@ -915,6 +919,8 @@ extern struct arm64_ftr_override id_aa64smfr0_override;
915919
extern struct arm64_ftr_override id_aa64isar1_override;
916920
extern struct arm64_ftr_override id_aa64isar2_override;
917921

922+
extern struct arm64_ftr_override arm64_sw_feature_override;
923+
918924
u32 get_kvm_ipa_limit(void);
919925
void dump_cpu_features(void);
920926

arch/arm64/include/asm/el2_setup.h

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
*/
4444
.macro __init_el2_timers
4545
mov x0, #3 // Enable EL1 physical timers
46+
mrs x1, hcr_el2
47+
and x1, x1, #HCR_E2H
48+
cbz x1, .LnVHE_\@
49+
lsl x0, x0, #10
50+
.LnVHE_\@:
4651
msr cnthctl_el2, x0
4752
msr cntvoff_el2, xzr // Clear virtual offset
4853
.endm
@@ -133,8 +138,15 @@
133138
.endm
134139

135140
/* Coprocessor traps */
136-
.macro __init_el2_nvhe_cptr
141+
.macro __init_el2_cptr
142+
mrs x1, hcr_el2
143+
and x1, x1, #HCR_E2H
144+
cbz x1, .LnVHE_\@
145+
mov x0, #(CPACR_EL1_FPEN_EL1EN | CPACR_EL1_FPEN_EL0EN)
146+
b .Lset_cptr_\@
147+
.LnVHE_\@:
137148
mov x0, #0x33ff
149+
.Lset_cptr_\@:
138150
msr cptr_el2, x0 // Disable copro. traps to EL2
139151
.endm
140152

@@ -210,9 +222,8 @@
210222
__init_el2_gicv3
211223
__init_el2_hstr
212224
__init_el2_nvhe_idregs
213-
__init_el2_nvhe_cptr
225+
__init_el2_cptr
214226
__init_el2_fgt
215-
__init_el2_nvhe_prepare_eret
216227
.endm
217228

218229
#ifndef __KVM_NVHE_HYPERVISOR__
@@ -258,7 +269,17 @@
258269

259270
.Linit_sve_\@: /* SVE register access */
260271
mrs x0, cptr_el2 // Disable SVE traps
272+
mrs x1, hcr_el2
273+
and x1, x1, #HCR_E2H
274+
cbz x1, .Lcptr_nvhe_\@
275+
276+
// VHE case
277+
orr x0, x0, #(CPACR_EL1_ZEN_EL1EN | CPACR_EL1_ZEN_EL0EN)
278+
b .Lset_cptr_\@
279+
280+
.Lcptr_nvhe_\@: // nVHE case
261281
bic x0, x0, #CPTR_EL2_TZ
282+
.Lset_cptr_\@:
262283
msr cptr_el2, x0
263284
isb
264285
mov x1, #ZCR_ELx_LEN_MASK // SVE: Enable full vector

0 commit comments

Comments
 (0)