- Oct 31, 2021
-
-
Zixuan Wang authored
This commit provides initial support for x86 test cases to boot from UEFI: 1. UEFI compiler flags are added to Makefile 2. A new TARGET_EFI macro is added to turn on/off UEFI startup code 3. Previous Multiboot setup code is refactored and updated for supporting UEFI, including the following changes: 1. x86/efi/crt0-efi-x86_64.S: provides entry point and jumps to setup code in lib/efi.c. 2. lib/efi.c: performs UEFI setup, calls arch-related setup functions, then jumps to test case main() function 3. lib/x86/setup.c: provides arch-related setup under UEFI To build test cases for UEFI, please first install the GNU-EFI library. Check x86/efi/README.md for more details. This commit is tested by a simple test calling report() and report_summayr(). This commit does not include such a test to avoid unnecessary files added into git history. To build and run this test in UEFI (assuming file name is x86/dummy.c): ./configure --target-efi make x86/dummy.efi ./x86/efi/run ./x86/dummy.efi To use the default Multiboot instead of UEFI: ./configure make x86/dummy.flat ./x86/run ./x86/dummy.flat Some x86 test cases require additional fixes to work in UEFI, e.g., converting to position independent code (PIC), setting up page tables, etc. This commit does not provide these fixes, so compiling and running UEFI test cases other than x86/dummy.c may trigger compiler errors or QEMU crashes. These test cases will be fixed by the follow-up commits in this series. The following code is ported from github.com/rhdrjones/kvm-unit-tests - ./configure: 'target-efi'-related code See original code: - Repo: https://github.com/rhdrjones/kvm-unit-tests - Branch: target-efi Co-developed-by:
Varad Gautam <varad.gautam@suse.com> Signed-off-by:
Varad Gautam <varad.gautam@suse.com> Signed-off-by:
Zixuan Wang <zixuanwang@google.com> Message-Id: <20211004204931.1537823-6-zxwang42@gmail.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Zixuan Wang authored
To build x86 test cases with UEFI, we need to borrow some source code from GNU-EFI, which includes the initialization code and linker scripts. This commit only copies the source code, without any modification. These source code files are not used by KVM-Unit-Tests in this commit. The following source code is copied from GNU-EFI: 1. x86/efi/elf_x86_64_efi.lds 2. x86/efi/reloc_x86_64.c 3. x86/efi/crt0-efi-x86_64.S We put these EFI-related files under a new dir `x86/efi` because: 1. EFI-related code is easy to find 2. EFI-related code is separated from the original code in `x86/` 3. EFI-related code can still reuse the Makefile and test case code in its parent dir `x86/` GNU-EFI repo and version: GIT URL: https://git.code.sf.net/p/gnu-efi/code Commit ID: 4fe83e102674 Website: https://sourceforge.net/p/gnu-efi/code/ci/4fe83e/tree/ Co-developed-by:
Varad Gautam <varad.gautam@suse.com> Signed-off-by:
Varad Gautam <varad.gautam@suse.com> Signed-off-by:
Zixuan Wang <zixuanwang@google.com> Message-Id: <20211004204931.1537823-5-zxwang42@gmail.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Varad Gautam authored
This commit implements helper functions that call UEFI services and assist the boot up process. Signed-off-by:
Varad Gautam <varad.gautam@suse.com> Reviewed-by:
Andrew Jones <drjones@redhat.com> Message-Id: <20211004204931.1537823-4-zxwang42@gmail.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Varad Gautam authored
Copy UEFI-related definitions from Linux, so the follow-up commits can develop UEFI function calls based on these definitions, without relying on GNU-EFI library. Signed-off-by:
Varad Gautam <varad.gautam@suse.com> Message-Id: <20211004204931.1537823-3-zxwang42@gmail.com> Signed-off-by:
Zixuan Wang <zxwang42@gmail.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Oct 21, 2021
-
-
Paolo Bonzini authored
Move the GDT and TSS data structures from x86/cstart.S to lib/x86/desc.c, for consistency with the 64-bit version. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Zixuan Wang authored
Move the GDT and TSS data structures from x86/cstart64.S to lib/x86/desc.c, so that the follow-up UEFI support commits can reuse these definitions, without re-defining them in UEFI's boot up assembly code. Signed-off-by:
Zixuan Wang <zixuanwang@google.com> Message-Id: <20211004204931.1537823-2-zxwang42@gmail.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The ring3 switch code relied on a special stack page that was used for the ring0 stack during the ring3 part of the test. This special stack page was used if an exception handler ran during the ring3 part of the test. This method is quite complex; it is easier to just use the same stack for the "outer" part of the test and the exception handler. To do so, store esp/rsp in the TSS just before doing the PUSH/IRET sequence. On 64-bit, the TSS can also be used to restore rsp after coming back from ring3. Unifying the three copies of the ring switching code is left as an exercise to the reader. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
There's no need to distinguish gdt32 and gdt64, since the same C functions operate on both and selector numbers are mostly unified between 32- and 64-bit versions. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Move the IDT data structures from x86/cstart.S and x86/cstart64.S to lib/x86/desc.c, so that the follow-up UEFI support commits can reuse these definitions, without re-defining them in UEFI's boot up assembly code. Extracted by a patch by Zixuan Wang <zxwang42@gmail.com> and ported to 32-bit too. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
tss_descr is declared as a struct descriptor_table_ptr but it is actualy pointing to an _entry_ in the GDT. Also it is different per CPU, but tss_descr does not recognize that. Fix both by reusing the code (already present e.g. in the vmware_backdoors test) that extracts the base from the GDT entry; and also provide a helper to retrieve the limit, which is needed in vmx.c. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Use the same names and definitions (apart from the high base field) for GDT descriptors in both 32-bit and 64-bit code. The next patch will also reuse gdt_entry_t in the 16-byte struct definition, for now some duplication remains. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The low four bits of the fourth argument are unused, make them zero in all the callers. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Look them up using a gdt_entry_t pointer, so that the address of the descriptor is correct even for "odd" selectors (e.g. 0x98). Rename the struct from segment_desc64 to system_desc64, highlighting that it is only used in the case of S=0 (system descriptor). Rename the "limit" bitfield to "limit2", matching the convention used for the various parts of the base field. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Oct 20, 2021
-
-
Oliver Upton authored
Signed-off-by:
Oliver Upton <oupton@google.com> Message-Id: <20211019225351.970397-2-oupton@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Oliver Upton authored
The safe_halt() library function simply performs an 'sti; hlt' instruction sequence. There are several places where bare inline assembly was used instead of this helper. Replace all open-coded implementations with the helper. No functional change intended. Signed-off-by:
Oliver Upton <oupton@google.com> Message-Id: <20211019225351.970397-1-oupton@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Daniele Ahmed authored
If an MSR description is provided as input by the user, run the test against that MSR. This allows the user to run tests on custom MSR's. Otherwise run all default tests. This is to validate custom MSR handling in user space with an easy-to-use tool. This kvm-unit-test submodule is a perfect fit. I'm extending it with a mode that takes an MSR index and a value to test arbitrary MSR accesses. Signed-off-by:
Daniele Ahmed <ahmeddan@amazon.com> Message-Id: <20210927153028.27680-3-ahmeddan@amazon.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Daniele Ahmed authored
Move the generic MSR test logic to its own function. Signed-off-by:
Daniele Ahmed <ahmeddan@amazon.com> Message-Id: <20210927153028.27680-2-ahmeddan@amazon.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Andrew Jones authored
Signed-off-by:
Andrew Jones <drjones@redhat.com> Reviewed-by:
Daniele Ahmed <ahmeddan@amazon.com> Message-Id: <20211013164259.88281-3-drjones@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Andrew Jones authored
Fixes: 4ceb02bf ("compiler: Add builtin overflow flag and predicate wrappers") Signed-off-by:
Andrew Jones <drjones@redhat.com> Reviewed-by:
Daniele Ahmed <ahmeddan@amazon.com> Message-Id: <20211013164259.88281-2-drjones@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The apic_reg_virt_test and virt_x2apic_mode_test tests are already run separately by the "vmx_apicv_test" suite, remove them from the main suite "vmx". Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Oct 18, 2021
-
-
Paolo Bonzini authored
s390x-pull-2021-10-18 See merge request kvm-unit-tests/kvm-unit-tests!18
-
Janosch Frank authored
The comma makes no sense, so let's remove it. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com>
-
Janosch Frank authored
The variable names for the snippet objects are of gigantic length so let's define a few macros to make them easier to read. Also add a standard PSW which should be used to start the snippet. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Janosch Frank authored
Somehow the ";" got into that patch and now complicates compilation. Let's remove it and put the constant in braces. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Thomas Huth authored
In the long run, we want to use parts of the libc like memset() etc., too. However, to be able to link it correctly, we have to provide some stub functions like puts() and exit() to avoid that too much other stuff from the lib folder gets pulled into the binaries, which we cannot provide in the snippets (like the sclp support). Signed-off-by:
Thomas Huth <thuth@redhat.com> Message-Id: <20211008092649.959956-1-thuth@redhat.com> Link: https://lore.kernel.org/kvm/20211008092649.959956-1-thuth@redhat.com/ Reviewed-by:
Janosch Frank <frankja@linux.ibm.com> Signed-off-by:
Janosch Frank <frankja@linux.ibm.com>
-
Janosch Frank authored
We have a stack, so why not define it and be a step closer to include the lib into the snippets. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Janosch Frank authored
On success r2 + 1 should be 0, let's also check for that. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Janosch Frank authored
We have them defined as hex constants in lib/s390x/asm/arch_def.h so why not print them as hex values? Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Janis Schoetterl-Glausch authored
Currently there is only one callee passing a non zero key, but having the argument will be useful in the future. Signed-off-by:
Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com> Link: https://lore.kernel.org/kvm/20211007085027.13050-1-frankja@linux.ibm.com/T/#md3064e13e876e0418a16f0d5a5bd9a6f2adebfd9 Signed-off-by:
Janosch Frank <frankja@linux.ibm.com>
-
Janosch Frank authored
Every time something goes wrong in a way we don't expect, we need to add debug prints to some UVC to get the unexpected return code. Let's just put the printing behind a macro so we can enable it if needed via a simple switch. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Janosch Frank authored
Let's only return 0/1 for success/failure respectively. If needed we can later add rc/rrc pointers so we can check for the reasons of cc==1 cases like we do in the kernel. As share() might also be used in snippets it's best not to use prints to avoid linking problems so lets remove the report_info(). Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Acked-by:
Thomas Huth <thuth@redhat.com>
-
Janosch Frank authored
Firmware will not give us the expected return code on z15 so let's fence it for the z15 machine generation. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Acked-by:
Thomas Huth <thuth@redhat.com>
-
Janosch Frank authored
RC 0x100 is not an error but a notice that we could have gotten more data from the Ultravisor if we had asked for it. So let's tolerate them in our tests. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Acked-by:
Thomas Huth <thuth@redhat.com>
-
Thomas Huth authored
The guest_instr variable is not used, which was likely a copy-n-paste issue from the s390x/sie.c test. Signed-off-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Janosch Frank <frankja@linux.ibm.com> Link: https://lore.kernel.org/kvm/6b4b6ae0-6cee-e435-189a-8657159de97f@linux.ibm.com/T/#m8390c674f1b6a9fdf8055189d039c60c99a6899a Message-Id: <20211007072136.768459-1-thuth@redhat.com> Signed-off-by:
Janosch Frank <frankja@linux.ibm.com>
-
David Hildenbrand authored
... used to be broken in TCG, so let's add a very simple test for SSKE and ISKE. In order to test RRBE as well, introduce a helper to call the machine instruction. Signed-off-by:
David Hildenbrand <david@redhat.com> Message-Id: <20210903162537.57178-1-david@redhat.com> Link: https://lore.kernel.org/kvm/20210903162537.57178-1-david@redhat.com/ Reviewed-by:
Janosch Frank <frankja@linux.ibm.com> Signed-off-by:
Janosch Frank <frankja@linux.ibm.com>
-
- Oct 13, 2021
-
-
Janosch Frank authored
Right now we only get told the kind of program exception as well as the PSW at the point where it happened. For addressing exceptions the PSW is not always enough so let's print the TEID which contains the failing address and flags that tell us more about the kind of address exception. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Janosch Frank authored
We had bits and masks defined and don't necessarily need both. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Thomas Huth <thuth@redhat.com>
-
Janosch Frank authored
space change UV home addresses don't require us to be in home space but we need to have it set up so hw/fw can use the home asce to translate home virtual addresses. Hence we add a comment why we're setting up the home asce and remove the address space since it's unneeded. Signed-off-by:
Janosch Frank <frankja@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Acked-by:
Thomas Huth <thuth@redhat.com>
-
- Oct 12, 2021
-
-
Andrew Jones authored
LPI allocation requires that the redistributors are configured first. It's unlikely that offline cpus have had their redistributors configured, so filter them out right away. Also, assert on any cpu, not just the calling cpu, in gicv3_lpi_alloc_tables() when we detect a unit test failed to follow instructions. Improve the assert with a hint message while we're at it. Cc: Eric Auger <eric.auger@redhat.com> Reviewed-by:
Eric Auger <eric.auger@redhat.com> Message-Id: <20211011160420.26785-1-drjones@redhat.com> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
- Oct 11, 2021
-
-
Add a command line arg to arm/micro-bench to set the mmio_addr to other values besides the default QEMU one. Default to the QEMU value if no arg is passed. Signed-off-by:
Ricardo Koller <ricarkol@google.com> Message-Id: <20211008174022.3028983-1-ricarkol@google.com> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-