History log of /kvm-unit-tests/lib/x86/ (Results 1 – 25 of 394)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
36fb9e8421-Feb-2025 Sean Christopherson <seanjc@google.com>

x86: Include libcflat.h in atomic.h for u64 typedef

Include libcflat.h in x86's atomic.h to pick up the u64 typedef, which is
used to define atomic64_t. The missing include results in build errors

x86: Include libcflat.h in atomic.h for u64 typedef

Include libcflat.h in x86's atomic.h to pick up the u64 typedef, which is
used to define atomic64_t. The missing include results in build errors if
a test includes atomic.h without (or before) libcflat.h.

lib/x86/atomic.h:162:1: error: unknown type name ‘u64’
162 | u64 atomic64_cmpxchg(atomic64_t *v, u64 old, u64 new);

Link: https://lore.kernel.org/r/20250221204148.2171418-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

0164d75901-Jul-2024 Binbin Wu <binbin.wu@linux.intel.com>

x86: Add test cases for LAM_{U48,U57}

This unit test covers:
1. CR3 LAM bits toggles.
2. Memory/MMIO access with user mode address containing LAM metadata.

Signed-off-by: Binbin Wu <binbin.wu@linux

x86: Add test cases for LAM_{U48,U57}

This unit test covers:
1. CR3 LAM bits toggles.
2. Memory/MMIO access with user mode address containing LAM metadata.

Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Chao Gao <chao.gao@intel.com>
Link: https://lore.kernel.org/r/20240701073010.91417-5-binbin.wu@linux.intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

14520f8e01-Jul-2024 Robert Hoo <robert.hu@linux.intel.com>

x86: Add test case for LAM_SUP

This unit test covers:
1. CR4.LAM_SUP toggles.
2. Memory & MMIO access with supervisor mode address with LAM metadata.
3. INVLPG memory operand doesn't contain LAM met

x86: Add test case for LAM_SUP

This unit test covers:
1. CR4.LAM_SUP toggles.
2. Memory & MMIO access with supervisor mode address with LAM metadata.
3. INVLPG memory operand doesn't contain LAM meta data, if the address
is non-canonical form then the INVLPG is the same as a NOP (no #GP).
4. INVPCID memory operand (descriptor pointer) could contain LAM meta data,
however, the address in the descriptor should be canonical.

In x86/unittests.cfg, add 2 test cases/guest conf, with and without LAM.

LAM feature spec: https://cdrdv2.intel.com/v1/dl/getContent/671368,
Chapter LINEAR ADDRESS MASKING (LAM)

Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
Co-developed-by: Binbin Wu <binbin.wu@linux.intel.com>
Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Chao Gao <chao.gao@intel.com>
Link: https://lore.kernel.org/r/20240701073010.91417-4-binbin.wu@linux.intel.com
[sean: s/set/get for the helper, smush tests, call it "lam", use "-cpu max"]
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

0a6b8b7d01-Jul-2024 Binbin Wu <binbin.wu@linux.intel.com>

x86: Allow setting of CR3 LAM bits if LAM supported

If LINEAR ADDRESS MASKING (LAM) is supported, VM entry allows CR3.LAM_U48
(bit 62) and CR3.LAM_U57 (bit 61) to be set in CR3 field.

Change the te

x86: Allow setting of CR3 LAM bits if LAM supported

If LINEAR ADDRESS MASKING (LAM) is supported, VM entry allows CR3.LAM_U48
(bit 62) and CR3.LAM_U57 (bit 61) to be set in CR3 field.

Change the test result expectations when setting CR3.LAM_U48 or CR3.LAM_U57
on vmlaunch tests when LAM is supported.

Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Chao Gao <chao.gao@intel.com>
Link: https://lore.kernel.org/r/20240701073010.91417-3-binbin.wu@linux.intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

8d1acfe415-Feb-2025 Xiong Zhang <xiong.y.zhang@intel.com>

x86: pmu: Remove duplicate code in pmu_init()

There are totally same code in pmu_init() helper, remove the duplicate
code.

Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Xiong Zhang

x86: pmu: Remove duplicate code in pmu_init()

There are totally same code in pmu_init() helper, remove the duplicate
code.

Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Reviewed-by: Mingwei Zhang <mizhang@google.com>
Link: https://lore.kernel.org/r/20250215013636.1214612-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

d467e65921-Feb-2025 Sean Christopherson <seanjc@google.com>

x86: Move SMP #defines from apic-defs.h to smp.h

Now that the __ASSEMBLY__ versus __ASSEMBLER_ mess is sorted out, move
the SMP related #defines from apic-defs.h to smp.h, and drop the comment
that

x86: Move SMP #defines from apic-defs.h to smp.h

Now that the __ASSEMBLY__ versus __ASSEMBLER_ mess is sorted out, move
the SMP related #defines from apic-defs.h to smp.h, and drop the comment
that explains the hackery.

Opportunistically make REALMODE_GDT_LOWMEM visible to assembly code as
well, and drop efistart64.S's local copy.

Link: https://lore.kernel.org/r/20250221233832.2251456-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

c8a8a35821-Feb-2025 Hang SU <darcysail@gmail.com>

x86: replace segment selector magic number with macro definition

Add assembly check in desc.h, to replace segment selector
magic number with macro definition.

Signed-off-by: Hang SU <darcy.sh@antgr

x86: replace segment selector magic number with macro definition

Add assembly check in desc.h, to replace segment selector
magic number with macro definition.

Signed-off-by: Hang SU <darcy.sh@antgroup.com>
Link: https://lore.kernel.org/r/20250221225406.2228938-4-seanjc@google.com
[sean: fix KERNEL_CS vs. KERNEL_CS32 goof]
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

f372d35f21-Feb-2025 Sean Christopherson <seanjc@google.com>

x86: Commit to using __ASSEMBLER__ instead of __ASSEMBLY__

Convert all two of x86's anti-assembly #ifdefs from __ASSEMBLY__ to
__ASSEMBLER__. Usage of __ASSEMBLY__ was inherited blindly from the Li

x86: Commit to using __ASSEMBLER__ instead of __ASSEMBLY__

Convert all two of x86's anti-assembly #ifdefs from __ASSEMBLY__ to
__ASSEMBLER__. Usage of __ASSEMBLY__ was inherited blindly from the Linux
kernel, and must be manually defined, e.g. through build rules or with
explicit #defines in assembly code. __ASSEMBLER__ on the other hand is
automatically defined by the compiler when preprocessing assembly, i.e.
doesn't require manually #defines for the code to function correctly.

Convert only x86 for the time being, as x86 doesn't actually rely on
__ASSEMBLY__ (a clever observer will note that it's never #defined on x86).
E.g. trying to include x86's page.h doesn't work as is. All other
architectures actually rely on __ASSEMBLY__, and will be dealt with
separately.

Note, while only gcc appears to officially document __ASSEMBLER__, clang
has followed suit since at least clang 6.0, and clang 6.0 doesn't come
remotely close to being able to comple KVM-Unit-Tests.

Link: https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros
Link: https://lore.kernel.org/r/20250221225406.2228938-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

4c5d371321-Feb-2025 Sean Christopherson <seanjc@google.com>

x86: Move descriptor table selector #defines to the top of desc.h

Hoist the selector #defines in desc.h to the very top so that they can be
exposed to assembly code with minimal #ifdefs.

No functio

x86: Move descriptor table selector #defines to the top of desc.h

Hoist the selector #defines in desc.h to the very top so that they can be
exposed to assembly code with minimal #ifdefs.

No functional change intended.

Link: https://lore.kernel.org/r/20250221225406.2228938-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

f6257e2415-Feb-2025 Maxim Levitsky <mlevitsk@redhat.com>

x86: Add testcases for writing (non)canonical LA57 values to MSRs and bases

Extend the LA57 test to thoroughly validate the canonical checks that are
done when setting various MSRs and CPU registers

x86: Add testcases for writing (non)canonical LA57 values to MSRs and bases

Extend the LA57 test to thoroughly validate the canonical checks that are
done when setting various MSRs and CPU registers. CPUs that support LA57
have convoluted behavior when it comes to canonical checks. Writes to
MSRs, descriptor table bases, and for TLB invalidation instructions,
don't consult CR4.LA57, and so a value that is 57-bit canonical but not
48-bit canonical is allowed irrespective of CR4.LA57 if the CPU supports
5-level paging.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20240907005440.500075-5-mlevitsk@redhat.com
Co-developed-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20250215013018.1210432-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

b88e90e615-Feb-2025 Maxim Levitsky <mlevitsk@redhat.com>

x86: Move struct invpcid_desc descriptor to processor.h

Move struct invpcid_desc descriptor to processor.h so that it can be used
in tests that are external to pcid.c.

Signed-off-by: Maxim Levitsky

x86: Move struct invpcid_desc descriptor to processor.h

Move struct invpcid_desc descriptor to processor.h so that it can be used
in tests that are external to pcid.c.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20240907005440.500075-4-mlevitsk@redhat.com
Link: https://lore.kernel.org/r/20250215013018.1210432-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

b1f3eec115-Feb-2025 Maxim Levitsky <mlevitsk@redhat.com>

x86: Add a few functions for gdt manipulation

Add a few functions that will be used to manipulate various
segment bases that are loaded via GDT.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>

x86: Add a few functions for gdt manipulation

Add a few functions that will be used to manipulate various
segment bases that are loaded via GDT.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20240907005440.500075-3-mlevitsk@redhat.com
Link: https://lore.kernel.org/r/20250215013018.1210432-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

5047281a15-Feb-2025 Maxim Levitsky <mlevitsk@redhat.com>

x86: Add _safe() and _fep_safe() variants to segment base load instructions

Add _safe() and _fep_safe() helpers for segment/base instructions; the
helpers will be used to validate various ways of se

x86: Add _safe() and _fep_safe() variants to segment base load instructions

Add _safe() and _fep_safe() helpers for segment/base instructions; the
helpers will be used to validate various ways of setting the segment bases
and GDT/LDT bases.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20240907005440.500075-2-mlevitsk@redhat.com
Link: https://lore.kernel.org/r/20250215013018.1210432-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

b94ace2e15-Feb-2025 Sean Christopherson <seanjc@google.com>

x86: Increase per-CPU stack/data area to 12KiB

Increase the size of the per-CPU stack/data area from one page to three,
i.e. from 4KiB to 12KiB. KVM-Unit-Tests currently places the per-CPU data
at

x86: Increase per-CPU stack/data area to 12KiB

Increase the size of the per-CPU stack/data area from one page to three,
i.e. from 4KiB to 12KiB. KVM-Unit-Tests currently places the per-CPU data
at the bottom of the stack page, i.e. the stack "page" is actually a page
minus the size of the per-CPU area. And of course there's no guard page
or buffer in between the two, and so overflowing the stack clobbers per-CPU
data and sends tests into the weeds in weird ways.

Punt on less awful infrastructure, and settle for fixing the most egregious
problem of tests having less than 4KiB of stack to work with.

Link: https://lore.kernel.org/r/20250215012032.1206409-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

2821b32d15-Feb-2025 Sean Christopherson <seanjc@google.com>

x86: Add a macro for the size of the per-CPU stack/data area

Add a macro to define the size of the per-CPU stack/data area so that it's
somewhat possible to make sense of the madness.

Link: https:/

x86: Add a macro for the size of the per-CPU stack/data area

Add a macro to define the size of the per-CPU stack/data area so that it's
somewhat possible to make sense of the madness.

Link: https://lore.kernel.org/r/20250215012032.1206409-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

2f3c028614-Feb-2025 Nicolas Saenz Julienne <nsaenz@amazon.com>

x86: Make set/clear_bit() atomic

x86 is the only architecture that defines set/clear_bit() as non-atomic.
This makes it incompatible with arch-agnostic code that might implicitly
require atomicity.

x86: Make set/clear_bit() atomic

x86 is the only architecture that defines set/clear_bit() as non-atomic.
This makes it incompatible with arch-agnostic code that might implicitly
require atomicity. And it was observed to corrupt the 'online_cpus'
bitmap, as non BSP CPUs perform RmWs on the bitmap concurrently during
bring up. See:

ap_start64()
save_id()
set_bit(apic_id(), online_cpus)

Address this by making set/clear_bit() atomic.

Signed-off-by: Nicolas Saenz Julienne <nsaenz@amazon.com>
Link: https://lore.kernel.org/r/20250214173644.22895-1-nsaenz@amazon.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


/kvm-unit-tests/.gitlab-ci.yml
/kvm-unit-tests/Makefile
/kvm-unit-tests/README.md
/kvm-unit-tests/arm/Makefile.arm64
/kvm-unit-tests/arm/cstart.S
/kvm-unit-tests/arm/cstart64.S
/kvm-unit-tests/arm/fpu.c
/kvm-unit-tests/arm/pmu.c
/kvm-unit-tests/arm/selftest.c
/kvm-unit-tests/arm/unittests.cfg
/kvm-unit-tests/common/sieve.c
/kvm-unit-tests/configure
/kvm-unit-tests/lib/arm/asm/arm-smccc.h
/kvm-unit-tests/lib/arm/asm/pgtable.h
/kvm-unit-tests/lib/arm/asm/psci.h
/kvm-unit-tests/lib/arm/psci.c
/kvm-unit-tests/lib/arm/setup.c
/kvm-unit-tests/lib/arm64/asm/arm-smccc.h
/kvm-unit-tests/lib/arm64/asm/esr.h
/kvm-unit-tests/lib/arm64/asm/processor.h
/kvm-unit-tests/lib/arm64/asm/sysreg.h
/kvm-unit-tests/lib/arm64/processor.c
/kvm-unit-tests/lib/asm-generic/page.h
/kvm-unit-tests/lib/cpumask.h
/kvm-unit-tests/lib/libcflat.h
/kvm-unit-tests/lib/limits.h
/kvm-unit-tests/lib/memregions.h
/kvm-unit-tests/lib/on-cpus.c
/kvm-unit-tests/lib/on-cpus.h
/kvm-unit-tests/lib/powerpc/asm/hcall.h
/kvm-unit-tests/lib/powerpc/asm/processor.h
/kvm-unit-tests/lib/powerpc/asm/reg.h
/kvm-unit-tests/lib/powerpc/asm/smp.h
/kvm-unit-tests/lib/powerpc/io.c
/kvm-unit-tests/lib/powerpc/processor.c
/kvm-unit-tests/lib/powerpc/rtas.c
/kvm-unit-tests/lib/powerpc/setup.c
/kvm-unit-tests/lib/ppc64/asm/mmu.h
/kvm-unit-tests/lib/ppc64/asm/page.h
/kvm-unit-tests/lib/ppc64/asm/pgtable-hwdef.h
/kvm-unit-tests/lib/ppc64/asm/pgtable.h
/kvm-unit-tests/lib/ppc64/mmu.c
/kvm-unit-tests/lib/ppc64/opal-calls.S
/kvm-unit-tests/lib/rand.c
/kvm-unit-tests/lib/rand.h
/kvm-unit-tests/lib/report.c
/kvm-unit-tests/lib/riscv/asm-offsets.c
/kvm-unit-tests/lib/riscv/asm/asm.h
/kvm-unit-tests/lib/riscv/asm/csr.h
/kvm-unit-tests/lib/riscv/asm/delay.h
/kvm-unit-tests/lib/riscv/asm/io.h
/kvm-unit-tests/lib/riscv/asm/mmu.h
/kvm-unit-tests/lib/riscv/asm/processor.h
/kvm-unit-tests/lib/riscv/asm/sbi.h
/kvm-unit-tests/lib/riscv/asm/setup.h
/kvm-unit-tests/lib/riscv/asm/stack.h
/kvm-unit-tests/lib/riscv/asm/timer.h
/kvm-unit-tests/lib/riscv/delay.c
/kvm-unit-tests/lib/riscv/mmu.c
/kvm-unit-tests/lib/riscv/processor.c
/kvm-unit-tests/lib/riscv/sbi.c
/kvm-unit-tests/lib/riscv/setjmp.S
/kvm-unit-tests/lib/riscv/setup.c
/kvm-unit-tests/lib/riscv/smp.c
/kvm-unit-tests/lib/riscv/stack.c
/kvm-unit-tests/lib/riscv/timer.c
/kvm-unit-tests/lib/s390x/asm/arch_def.h
/kvm-unit-tests/lib/s390x/asm/cpacf.h
/kvm-unit-tests/lib/s390x/asm/facility.h
/kvm-unit-tests/lib/s390x/asm/sie-arch.h
/kvm-unit-tests/lib/s390x/sie-icpt.c
/kvm-unit-tests/lib/s390x/sie-icpt.h
/kvm-unit-tests/lib/s390x/sie.c
/kvm-unit-tests/lib/s390x/sie.h
/kvm-unit-tests/lib/s390x/snippet-exit.h
/kvm-unit-tests/lib/setjmp.h
/kvm-unit-tests/lib/stack.c
/kvm-unit-tests/lib/stack.h
/kvm-unit-tests/lib/vmalloc.c
/kvm-unit-tests/lib/vmalloc.h
processor.h
/kvm-unit-tests/powerpc/Makefile.common
/kvm-unit-tests/powerpc/Makefile.ppc64
/kvm-unit-tests/powerpc/atomics.c
/kvm-unit-tests/powerpc/interrupts.c
/kvm-unit-tests/powerpc/mmu.c
/kvm-unit-tests/powerpc/sieve.c
/kvm-unit-tests/powerpc/sprs.c
/kvm-unit-tests/powerpc/timebase.c
/kvm-unit-tests/powerpc/tm.c
/kvm-unit-tests/powerpc/unittests.cfg
/kvm-unit-tests/riscv/Makefile
/kvm-unit-tests/riscv/cstart.S
/kvm-unit-tests/riscv/sbi-asm.S
/kvm-unit-tests/riscv/sbi-tests.h
/kvm-unit-tests/riscv/sbi.c
/kvm-unit-tests/riscv/unittests.cfg
/kvm-unit-tests/s390x/Makefile
/kvm-unit-tests/s390x/cpu-sie.S
/kvm-unit-tests/s390x/cpu.S
/kvm-unit-tests/s390x/diag258.c
/kvm-unit-tests/s390x/edat.c
/kvm-unit-tests/s390x/pv-diags.c
/kvm-unit-tests/s390x/pv-icptcode.c
/kvm-unit-tests/s390x/pv-ipl.c
/kvm-unit-tests/s390x/sie-dat.c
/kvm-unit-tests/s390x/snippets/Makefile
/kvm-unit-tests/s390x/snippets/c/sie-dat.c
/kvm-unit-tests/s390x/snippets/c/stfle.c
/kvm-unit-tests/s390x/snippets/lib/snippet-exit.h
/kvm-unit-tests/s390x/stfle-sie.c
/kvm-unit-tests/s390x/unittests.cfg
/kvm-unit-tests/scripts/check-patch.py
/kvm-unit-tests/scripts/checkpatch.pl
/kvm-unit-tests/x86/asyncpf.c
/kvm-unit-tests/x86/debug.c
/kvm-unit-tests/x86/pmu_lbr.c
/kvm-unit-tests/x86/svm.h
/kvm-unit-tests/x86/svm_tests.c
/kvm-unit-tests/x86/unittests.cfg
/kvm-unit-tests/x86/vmx.c
/kvm-unit-tests/x86/vmx_tests.c
386ed5c211-Dec-2023 Oliver Upton <oliver.upton@linux.dev>

nVMX: add test for posted interrupts

Test virtual posted interrupts under the following conditions:

- vTPR[7:4] >= VECTOR[7:4]: Expect the L2 interrupt to be blocked.
The bit correspondin

nVMX: add test for posted interrupts

Test virtual posted interrupts under the following conditions:

- vTPR[7:4] >= VECTOR[7:4]: Expect the L2 interrupt to be blocked.
The bit corresponding to the posted interrupt should be set in L2's
vIRR. Test with a running guest.

- vTPR[7:4] < VECTOR[7:4]: Expect the interrupt to be delivered and the
ISR to execute once. Test with a running and halted guest.

Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Co-developed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Link: https://lore.kernel.org/r/20231211185552.3856862-6-jmattson@google.com
[sean: add a dedicated SPIN_IRR op to clarify and enhance coverage]
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

a917f7c711-Dec-2023 Marc Orr <marc.orr@gmail.com>

nVMX: test nested "virtual-interrupt delivery"

Add test coverage for recognizing and delivering virtual interrupts via
VMX's "virtual-interrupt delivery" feature, in the following two scenarios:

nVMX: test nested "virtual-interrupt delivery"

Add test coverage for recognizing and delivering virtual interrupts via
VMX's "virtual-interrupt delivery" feature, in the following two scenarios:

1. There's a pending interrupt at VM-entry.
2. There's a pending interrupt during TPR virtualization.

Signed-off-by: Marc Orr (Google) <marc.orr@gmail.com>
Co-developed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Co-developed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Link: https://lore.kernel.org/r/20231211185552.3856862-3-jmattson@google.com
[sean: omit from base 'vmx' test]
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

fc17d52706-Mar-2024 Sean Christopherson <seanjc@google.com>

x86/pmu: Iterate over adaptive PEBS flag combinations

Iterate over all possible combinations of adaptive PEBS flags, instead of
simply testing each flag individually. There are currently only 16
po

x86/pmu: Iterate over adaptive PEBS flag combinations

Iterate over all possible combinations of adaptive PEBS flags, instead of
simply testing each flag individually. There are currently only 16
possible combinations, i.e. there's no reason not to exhaustively test
every one.

Opportunistically rename PEBS_DATACFG_GP to PEBS_DATACFG_GPRS to
differentiate it from general purposes *counters*, which KVM also tends to
abbreviate as "GP".

Tested-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Link: https://lore.kernel.org/r/20240306230153.786365-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

51b8794617-Apr-2024 Mingwei Zhang <mizhang@google.com>

x86: Add FEP support on read/write register instructions

Add FEP support on read/write register instructions to enable testing rdmsr
and wrmsr when force emulation is turned on.

Suggested-by: Sean

x86: Add FEP support on read/write register instructions

Add FEP support on read/write register instructions to enable testing rdmsr
and wrmsr when force emulation is turned on.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Mingwei Zhang <mizhang@google.com>
Link: https://lore.kernel.org/r/20240417232906.3057638-2-mizhang@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

3ed8e38208-Jan-2024 Dan Wu <dan1.wu@intel.com>

x86/asyncpf: Update async page fault test for IRQ-based "page ready"

KVM switched to use interrupt for 'page ready' APF event since Linux v5.10
and the legacy mechanism using #PF was deprecated. Int

x86/asyncpf: Update async page fault test for IRQ-based "page ready"

KVM switched to use interrupt for 'page ready' APF event since Linux v5.10
and the legacy mechanism using #PF was deprecated. Interrupt-based
'page-ready' notification requires KVM_ASYNC_PF_DELIVERY_AS_INT to be set
as well in MSR_KVM_ASYNC_PF_EN to enable asyncpf.

Update asyncpf.c for the new interrupt-based notification to check for
(KVM_FEATURE_ASYNC_PF && KVM_FEATURE_ASYNC_PF_INT) support, and implement
interrupt-based 'page-ready' handler with the necessary struct changes.

To run this test, add the QEMU option "-cpu host" to check CPUID, since
KVM_FEATURE_ASYNC_PF_INT can't be detected without "-cpu host".

Opportunistically update the "help" section to describe how to setup
cgroups for cgroup v1 vs. v2.

Signed-off-by: Dan Wu <dan1.wu@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20240108063014.41117-1-dan1.wu@intel.com
[sean: report skip instead of fail if no async #PFs occur, massage changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

95a9408804-May-2024 Nicholas Piggin <npiggin@gmail.com>

lib: Use vmalloc.h for setup_mmu definition

There is no good reason to put setup_vm in libcflat.h when it's
defined in vmalloc.h.

Acked-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Nich

lib: Use vmalloc.h for setup_mmu definition

There is no good reason to put setup_vm in libcflat.h when it's
defined in vmalloc.h.

Acked-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-ID: <20240504122841.1177683-24-npiggin@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>

show more ...


/kvm-unit-tests/.gitlab-ci.yml
/kvm-unit-tests/.shellcheckrc
/kvm-unit-tests/.travis.yml
/kvm-unit-tests/MAINTAINERS
/kvm-unit-tests/Makefile
/kvm-unit-tests/README.md
/kvm-unit-tests/arm/efi/run
/kvm-unit-tests/arm/gic.c
/kvm-unit-tests/arm/unittests.cfg
/kvm-unit-tests/common/memory-verify.c
/kvm-unit-tests/common/selftest-migration.c
/kvm-unit-tests/common/sieve.c
/kvm-unit-tests/configure
/kvm-unit-tests/docs/unittests.txt
/kvm-unit-tests/lib/efi.c
/kvm-unit-tests/lib/elf.h
/kvm-unit-tests/lib/libcflat.h
/kvm-unit-tests/lib/migrate.c
/kvm-unit-tests/lib/migrate.h
/kvm-unit-tests/lib/powerpc/asm/processor.h
/kvm-unit-tests/lib/powerpc/asm/reg.h
/kvm-unit-tests/lib/powerpc/asm/rtas.h
/kvm-unit-tests/lib/powerpc/asm/setup.h
/kvm-unit-tests/lib/powerpc/asm/smp.h
/kvm-unit-tests/lib/powerpc/hcall.c
/kvm-unit-tests/lib/powerpc/io.c
/kvm-unit-tests/lib/powerpc/io.h
/kvm-unit-tests/lib/powerpc/processor.c
/kvm-unit-tests/lib/powerpc/rtas.c
/kvm-unit-tests/lib/powerpc/setup.c
/kvm-unit-tests/lib/powerpc/smp.c
/kvm-unit-tests/lib/ppc64/asm-offsets.c
/kvm-unit-tests/lib/ppc64/asm/atomic.h
/kvm-unit-tests/lib/ppc64/asm/barrier.h
/kvm-unit-tests/lib/ppc64/asm/opal.h
/kvm-unit-tests/lib/ppc64/asm/ptrace.h
/kvm-unit-tests/lib/ppc64/asm/stack.h
/kvm-unit-tests/lib/ppc64/opal-calls.S
/kvm-unit-tests/lib/ppc64/opal.c
/kvm-unit-tests/lib/ppc64/stack.c
/kvm-unit-tests/lib/report.c
/kvm-unit-tests/lib/riscv/asm/setup.h
/kvm-unit-tests/lib/riscv/setup.c
/kvm-unit-tests/lib/riscv/stack.c
/kvm-unit-tests/lib/s390x/asm/sigp.h
/kvm-unit-tests/lib/s390x/asm/uv.h
/kvm-unit-tests/lib/s390x/css.h
/kvm-unit-tests/lib/s390x/io.c
/kvm-unit-tests/lib/s390x/uv.c
/kvm-unit-tests/lib/s390x/uv.h
/kvm-unit-tests/lib/stack.c
/kvm-unit-tests/lib/stack.h
vm.h
/kvm-unit-tests/powerpc/Makefile.common
/kvm-unit-tests/powerpc/Makefile.ppc64
/kvm-unit-tests/powerpc/cstart64.S
/kvm-unit-tests/powerpc/emulator.c
/kvm-unit-tests/powerpc/interrupts.c
/kvm-unit-tests/powerpc/memory-verify.c
/kvm-unit-tests/powerpc/run
/kvm-unit-tests/powerpc/selftest.c
/kvm-unit-tests/powerpc/smp.c
/kvm-unit-tests/powerpc/spapr_vpa.c
/kvm-unit-tests/powerpc/sprs.c
/kvm-unit-tests/powerpc/tm.c
/kvm-unit-tests/powerpc/unittests.cfg
/kvm-unit-tests/riscv/Makefile
/kvm-unit-tests/riscv/cstart.S
/kvm-unit-tests/riscv/efi/crt0-efi-riscv64.S
/kvm-unit-tests/riscv/efi/elf_riscv64_efi.lds
/kvm-unit-tests/riscv/efi/reloc_riscv64.c
/kvm-unit-tests/riscv/efi/run
/kvm-unit-tests/riscv/run
/kvm-unit-tests/riscv/sbi.c
/kvm-unit-tests/riscv/unittests.cfg
/kvm-unit-tests/run_tests.sh
/kvm-unit-tests/s390x/Makefile
/kvm-unit-tests/s390x/cmm.c
/kvm-unit-tests/s390x/emulator.c
/kvm-unit-tests/s390x/memory-verify.c
/kvm-unit-tests/s390x/migration-cmm.c
/kvm-unit-tests/s390x/migration-skey.c
/kvm-unit-tests/s390x/migration.c
/kvm-unit-tests/s390x/mvpg.c
/kvm-unit-tests/s390x/run
/kvm-unit-tests/s390x/sclp.c
/kvm-unit-tests/s390x/selftest.c
/kvm-unit-tests/s390x/snippets/c/flat.lds.S
/kvm-unit-tests/s390x/unittests.cfg
/kvm-unit-tests/scripts/arch-run.bash
/kvm-unit-tests/scripts/common.bash
/kvm-unit-tests/scripts/mkstandalone.sh
/kvm-unit-tests/scripts/runtime.bash
/kvm-unit-tests/scripts/s390x/func.bash
/kvm-unit-tests/x86/pmu.c
/kvm-unit-tests/x86/pmu_lbr.c
/kvm-unit-tests/x86/unittests.cfg
/kvm-unit-tests/x86/vmexit.c
/kvm-unit-tests/x86/vmware_backdoors.c
a8a78d7505-Mar-2024 Andrew Jones <andrew.jones@linux.dev>

treewide: lib/stack: Fix backtrace

We should never pass the result of __builtin_frame_address(0) to
another function since the compiler is within its rights to pop the
frame to which it points befor

treewide: lib/stack: Fix backtrace

We should never pass the result of __builtin_frame_address(0) to
another function since the compiler is within its rights to pop the
frame to which it points before making the function call, as may be
done for tail calls. Nobody has complained about backtrace(), so
likely all compilations have been inlining backtrace_frame(), not
dropping the frame on the tail call, or nobody is looking at traces.
However, for riscv, when built for EFI, it does drop the frame on the
tail call, and it was noticed. Preemptively fix backtrace() for all
architectures.

Fixes: 52266791750d ("lib: backtrace printing")
Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...


/kvm-unit-tests/.gitlab-ci.yml
/kvm-unit-tests/MAINTAINERS
/kvm-unit-tests/Makefile
/kvm-unit-tests/arm/Makefile.common
/kvm-unit-tests/arm/efi/crt0-efi-aarch64.S
/kvm-unit-tests/arm/efi/elf_aarch64_efi.lds
/kvm-unit-tests/arm/efi/run
/kvm-unit-tests/arm/micro-bench.c
/kvm-unit-tests/arm/pmu.c
/kvm-unit-tests/arm/run
/kvm-unit-tests/arm/selftest.c
/kvm-unit-tests/arm/sieve.c
/kvm-unit-tests/common/selftest-migration.c
/kvm-unit-tests/common/sieve.c
/kvm-unit-tests/configure
/kvm-unit-tests/lib/arm/asm/gic-v2.h
/kvm-unit-tests/lib/arm/asm/gic-v3.h
/kvm-unit-tests/lib/arm/asm/gic.h
/kvm-unit-tests/lib/arm/asm/setup.h
/kvm-unit-tests/lib/arm/asm/smp.h
/kvm-unit-tests/lib/arm/io.c
/kvm-unit-tests/lib/arm/mmu.c
/kvm-unit-tests/lib/arm/setup.c
/kvm-unit-tests/lib/arm/smp.c
/kvm-unit-tests/lib/arm/stack.c
/kvm-unit-tests/lib/arm64/processor.c
/kvm-unit-tests/lib/arm64/stack.c
/kvm-unit-tests/lib/cpumask.h
/kvm-unit-tests/lib/ctype.h
/kvm-unit-tests/lib/efi.c
/kvm-unit-tests/lib/elf.h
/kvm-unit-tests/lib/ldiv32.c
/kvm-unit-tests/lib/linux/const.h
/kvm-unit-tests/lib/linux/efi.h
/kvm-unit-tests/lib/memregions.c
/kvm-unit-tests/lib/memregions.h
/kvm-unit-tests/lib/migrate.c
/kvm-unit-tests/lib/migrate.h
/kvm-unit-tests/lib/on-cpus.c
/kvm-unit-tests/lib/on-cpus.h
/kvm-unit-tests/lib/powerpc/asm/ppc_asm.h
/kvm-unit-tests/lib/powerpc/asm/processor.h
/kvm-unit-tests/lib/powerpc/asm/reg.h
/kvm-unit-tests/lib/powerpc/asm/time.h
/kvm-unit-tests/lib/powerpc/hcall.c
/kvm-unit-tests/lib/powerpc/processor.c
/kvm-unit-tests/lib/powerpc/setup.c
/kvm-unit-tests/lib/powerpc/smp.c
/kvm-unit-tests/lib/ppc64/asm/ptrace.h
/kvm-unit-tests/lib/ppc64/asm/reg.h
/kvm-unit-tests/lib/ppc64/asm/time.h
/kvm-unit-tests/lib/riscv/.gitignore
/kvm-unit-tests/lib/riscv/asm-offsets.c
/kvm-unit-tests/lib/riscv/asm/asm-offsets.h
/kvm-unit-tests/lib/riscv/asm/barrier.h
/kvm-unit-tests/lib/riscv/asm/bitops.h
/kvm-unit-tests/lib/riscv/asm/bug.h
/kvm-unit-tests/lib/riscv/asm/csr.h
/kvm-unit-tests/lib/riscv/asm/io.h
/kvm-unit-tests/lib/riscv/asm/isa.h
/kvm-unit-tests/lib/riscv/asm/memory_areas.h
/kvm-unit-tests/lib/riscv/asm/mmu.h
/kvm-unit-tests/lib/riscv/asm/page.h
/kvm-unit-tests/lib/riscv/asm/pgtable.h
/kvm-unit-tests/lib/riscv/asm/processor.h
/kvm-unit-tests/lib/riscv/asm/ptrace.h
/kvm-unit-tests/lib/riscv/asm/sbi.h
/kvm-unit-tests/lib/riscv/asm/setup.h
/kvm-unit-tests/lib/riscv/asm/smp.h
/kvm-unit-tests/lib/riscv/asm/spinlock.h
/kvm-unit-tests/lib/riscv/asm/stack.h
/kvm-unit-tests/lib/riscv/bitops.c
/kvm-unit-tests/lib/riscv/io.c
/kvm-unit-tests/lib/riscv/isa.c
/kvm-unit-tests/lib/riscv/mmu.c
/kvm-unit-tests/lib/riscv/processor.c
/kvm-unit-tests/lib/riscv/sbi.c
/kvm-unit-tests/lib/riscv/setup.c
/kvm-unit-tests/lib/riscv/smp.c
/kvm-unit-tests/lib/riscv/stack.c
/kvm-unit-tests/lib/s390x/asm/arch_def.h
/kvm-unit-tests/lib/s390x/asm/cpacf.h
/kvm-unit-tests/lib/s390x/asm/interrupt.h
/kvm-unit-tests/lib/s390x/asm/mem.h
/kvm-unit-tests/lib/s390x/hardware.c
/kvm-unit-tests/lib/s390x/interrupt.c
/kvm-unit-tests/lib/s390x/mmu.c
/kvm-unit-tests/lib/s390x/sclp-console.c
/kvm-unit-tests/lib/s390x/sclp.h
/kvm-unit-tests/lib/s390x/sie.c
/kvm-unit-tests/lib/s390x/sie.h
/kvm-unit-tests/lib/s390x/snippet.h
/kvm-unit-tests/lib/s390x/stack.c
/kvm-unit-tests/lib/s390x/stsi.h
/kvm-unit-tests/lib/stack.h
/kvm-unit-tests/lib/string.c
/kvm-unit-tests/lib/string.h
stack.c
/kvm-unit-tests/powerpc/Makefile.common
/kvm-unit-tests/powerpc/cstart64.S
/kvm-unit-tests/powerpc/emulator.c
/kvm-unit-tests/powerpc/flat.lds
/kvm-unit-tests/powerpc/run
/kvm-unit-tests/powerpc/selftest-migration.c
/kvm-unit-tests/powerpc/spapr_hcall.c
/kvm-unit-tests/powerpc/spapr_vpa.c
/kvm-unit-tests/powerpc/sprs.c
/kvm-unit-tests/powerpc/tm.c
/kvm-unit-tests/powerpc/unittests.cfg
/kvm-unit-tests/riscv/Makefile
/kvm-unit-tests/riscv/cstart.S
/kvm-unit-tests/riscv/flat.lds
/kvm-unit-tests/riscv/run
/kvm-unit-tests/riscv/sbi.c
/kvm-unit-tests/riscv/selftest.c
/kvm-unit-tests/riscv/sieve.c
/kvm-unit-tests/riscv/unittests.cfg
/kvm-unit-tests/run_tests.sh
/kvm-unit-tests/s390x/Makefile
/kvm-unit-tests/s390x/mvpg-sie.c
/kvm-unit-tests/s390x/run
/kvm-unit-tests/s390x/sclp.c
/kvm-unit-tests/s390x/selftest-migration.c
/kvm-unit-tests/s390x/selftest.c
/kvm-unit-tests/s390x/sie-dat.c
/kvm-unit-tests/s390x/sie.c
/kvm-unit-tests/s390x/sieve.c
/kvm-unit-tests/s390x/snippets/c/sie-dat.c
/kvm-unit-tests/s390x/snippets/c/sie-dat.h
/kvm-unit-tests/s390x/spec_ex-sie.c
/kvm-unit-tests/s390x/spec_ex.c
/kvm-unit-tests/s390x/topology.c
/kvm-unit-tests/s390x/unittests.cfg
/kvm-unit-tests/scripts/arch-run.bash
/kvm-unit-tests/scripts/common.bash
/kvm-unit-tests/scripts/kernel-doc
/kvm-unit-tests/scripts/pretty_print_stacks.py
/kvm-unit-tests/scripts/runtime.bash
/kvm-unit-tests/x86/emulator64.c
/kvm-unit-tests/x86/hyperv.h
/kvm-unit-tests/x86/hyperv_clock.c
/kvm-unit-tests/x86/hyperv_connections.c
/kvm-unit-tests/x86/hyperv_stimer.c
/kvm-unit-tests/x86/hyperv_synic.c
/kvm-unit-tests/x86/msr.c
/kvm-unit-tests/x86/pmu.c
/kvm-unit-tests/x86/pmu_pebs.c
/kvm-unit-tests/x86/sieve.c
/kvm-unit-tests/x86/svm_tests.c
/kvm-unit-tests/x86/unittests.cfg
/kvm-unit-tests/x86/vmx_tests.c
6a49efdb13-Apr-2023 Mathias Krause <minipli@grsecurity.net>

x86/fault_test: Preserve exception handler

fault_test() replaces the exception handler for in-kernel tests with a
longjmp() based exception handling. However, it leaves the exception
handler in plac

x86/fault_test: Preserve exception handler

fault_test() replaces the exception handler for in-kernel tests with a
longjmp() based exception handling. However, it leaves the exception
handler in place which may confuse later test code triggering the same
exception without installing a handler first.

Fix this be restoring the previous exception handler, as running the
longjmp() handler out of context will lead to no good.

Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Link: https://lore.kernel.org/r/20230413184219.36404-11-minipli@grsecurity.net
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

47a84f2713-Apr-2023 Mathias Krause <minipli@grsecurity.net>

x86/run_in_user: Reload SS after successful return

Complement commit 663f9e447b98 ("x86: Fix a #GP from occurring in
usermode library's exception handlers") and restore SS on a regular
return as wel

x86/run_in_user: Reload SS after successful return

Complement commit 663f9e447b98 ("x86: Fix a #GP from occurring in
usermode library's exception handlers") and restore SS on a regular
return as well.

The INT-based "syscall" will make it get loaded with the NULL selector
(see SDM Vol. 1, Interrupt and Exception Behavior in 64-Bit Mode: "The
new SS is set to NULL if there is a change in CPL.") which reduces the
coverage provided by emulator64.c's "mov null, %%ss" test, as SS is
already loaded with the NULL selector.

Fix this by loading SS with KERNEL_DS after a successful userland
function call as well, as we already do in case of exceptions.

Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Link: https://lore.kernel.org/r/20230413184219.36404-10-minipli@grsecurity.net
[sean: use "rm" constraint, rephrase impact on emulator64's test]
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

12345678910>>...16