History log of /kvm-unit-tests/x86/umip.c (Results 1 – 17 of 17)
Revision Date Author Comments
# 92a6c9b9 18-Jan-2022 Paolo Bonzini <pbonzini@redhat.com>

Merge remote-tracking branch 'upstream/uefi' into master

Merge UEFI test support into the master branch.


# 91abf0b9 10-Nov-2021 Paolo Bonzini <pbonzini@redhat.com>

Merge branch 'gdt-idt-cleanup' into master


# 7bf8144e 31-Oct-2021 Zixuan Wang <zixuanwang@google.com>

x86 UEFI: Convert x86 test cases to PIC

UEFI loads EFI applications to dynamic runtime addresses, so it requires
all applications to be compiled as PIC (position independent code). PIC
does not allo

x86 UEFI: Convert x86 test cases to PIC

UEFI loads EFI applications to dynamic runtime addresses, so it requires
all applications to be compiled as PIC (position independent code). PIC
does not allow the usage of compile time absolute address.

This commit converts multiple x86 test cases to PIC so they can compile
and run in UEFI:

- x86/cet.efi

- x86/emulator.c: x86/emulator.c depends on lib/x86/usermode.c. But
usermode.c contains non-PIC inline assembly code. This commit converts
lib/x86/usermode.c and x86/emulator.c to PIC, so x86/emulator.c can
compile and run in UEFI.

- x86/vmware_backdoors.c: it depends on lib/x86/usermode.c and now works
without modifications

- x86/eventinj.c

- x86/smap.c

- x86/access.c

- x86/umip.c

Signed-off-by: Zixuan Wang <zixuanwang@google.com>
Message-Id: <20211031055634.894263-4-zxwang42@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 7e33895d 21-Oct-2021 Paolo Bonzini <pbonzini@redhat.com>

x86: Move 32-bit GDT and TSS to desc.c

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@redh

x86: Move 32-bit GDT and TSS to desc.c

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>

show more ...


# dbd38004 21-Oct-2021 Zixuan Wang <zixuanwang@google.com>

x86: Move 64-bit GDT and TSS to desc.c

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-

x86: Move 64-bit GDT and TSS to desc.c

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>

show more ...


# 8cd86535 21-Oct-2021 Paolo Bonzini <pbonzini@redhat.com>

x86: get rid of ring0stacktop

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 except

x86: get rid of ring0stacktop

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>

show more ...


# abe6fda7 09-Sep-2021 Bill Wendling <morbo@google.com>

x86: umip: mark do_ring3 as noinline

do_ring3 uses inline asm that defines globally visible labels. Clang
decides that it can inline this function, which causes the assembler to
complain about dupli

x86: umip: mark do_ring3 as noinline

do_ring3 uses inline asm that defines globally visible labels. Clang
decides that it can inline this function, which causes the assembler to
complain about duplicate symbols. Mark the function as "noinline" to
prevent this.

Signed-off-by: Bill Wendling <morbo@google.com>
[sean: call out the globally visible aspect]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210909183207.2228273-7-seanjc@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 49efa0e0 12-May-2020 Thomas Huth <thuth@redhat.com>

Fixes for the umip test

When compiling umip.c with -O2 instead of -O1, there are currently
two problems. First, the compiler complains:

x86/umip.c: In function ‘do_ring3’:
x86/umip.c:162:37:

Fixes for the umip test

When compiling umip.c with -O2 instead of -O1, there are currently
two problems. First, the compiler complains:

x86/umip.c: In function ‘do_ring3’:
x86/umip.c:162:37: error: array subscript 4096 is above array bounds of
‘unsigned char[4096]’ [-Werror=array-bounds]
[user_stack_top]"m"(user_stack[sizeof user_stack]),
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

This can be fixed by initializing the stack to point to one of the last
bytes of the array instead.

The second problem is that some tests are failing - and this is due
to the fact that the GP_ASM macro uses inline asm without the "volatile"
keyword - so that the compiler reorders this code in certain cases
where it should not. Fix it by adding "volatile" here.

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200512094438.17998-1-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 24a4a7c9 22-Jan-2020 Thomas Huth <thuth@redhat.com>

Fixes for the umip test

When compiling umip.c with -O2 instead of -O1, there are currently
two problems. First, the compiler complains:

x86/umip.c: In function ‘do_ring3’:
x86/umip.c:162:37: erro

Fixes for the umip test

When compiling umip.c with -O2 instead of -O1, there are currently
two problems. First, the compiler complains:

x86/umip.c: In function ‘do_ring3’:
x86/umip.c:162:37: error: array subscript 4096 is above array bounds of
‘unsigned char[4096]’ [-Werror=array-bounds]
[user_stack_top]"m"(user_stack[sizeof user_stack]),
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

This can be fixed by initializing the stack to point to one of the last
bytes of the array instead.

The second problem is that some tests are failing - and this is due
to the fact that the GP_ASM macro uses inline asm without the "volatile"
keyword - so that the compiler reorders this code in certain cases
where it should not. Fix it by adding "volatile" here.

Message-Id: <20200122160944.29750-1-thuth@redhat.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>

show more ...


# 31e68df7 08-Jun-2020 Paolo Bonzini <pbonzini@redhat.com>

x86: always set up SMP

Currently setup_vm cannot assume that it can invoke IPIs, and therefore
only initializes CR0/CR3/CR4 on the CPU it runs on. In order to keep the
initialization code clean, le

x86: always set up SMP

Currently setup_vm cannot assume that it can invoke IPIs, and therefore
only initializes CR0/CR3/CR4 on the CPU it runs on. In order to keep the
initialization code clean, let's just call smp_init (and therefore
setup_idt) unconditionally.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# a299895b 06-Dec-2019 Thomas Huth <thuth@redhat.com>

Switch the order of the parameters in report() and report_xfail()

Commit c09c54c66b1df ("lib: use an argument which doesn't require
default argument promotion") fixed a warning that occurs with Clan

Switch the order of the parameters in report() and report_xfail()

Commit c09c54c66b1df ("lib: use an argument which doesn't require
default argument promotion") fixed a warning that occurs with Clang,
but introduced a regression: If the "pass" parameter is a value
which has only set the condition bits in the upper 32 bits of a
64 bit value, the condition is now false since the value is truncated
to "unsigned int" so that the upper bits are simply discarded.

We fixed it by reverting the commit, but that of course also means
trouble with Clang again. We can not use "bool" if it is the last
parameter before the variable argument list. The proper fix is to
swap the parameters around and make the format string the last
parameter.

This patch (except the changes in lib/libcflat.h and lib/report.c
and some rebase conflicts along the way) has basically been created
with following coccinelle script (with some additional manual tweaking
of long and disabled lines afterwards):

@@
expression fmt;
expression pass;
expression list args;
@@
report(
-fmt, pass
+pass, fmt
, args);

@@
expression fmt;
expression pass;
expression list args;
@@
report_xfail(
-fmt, xfail, pass
+xfail, pass, fmt
, args);

Tested-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191206113102.14914-1-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# badc98ca 30-Jul-2019 Krish Sadhukhan <krish.sadhukhan@oracle.com>

kvm-unit-test: x86: Replace cpuid/cpuid_indexed calls with this_cpu_has()

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Signed-off-b

kvm-unit-test: x86: Replace cpuid/cpuid_indexed calls with this_cpu_has()

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# b29804b8 28-Sep-2018 Thomas Huth <thuth@redhat.com>

x86: Declare local functions as "static" and specify argument types

This makes the code compilable with the compiler flags -Wstrict-prototypes
and -Wmissing-prototypes.

Signed-off-by: Thomas Huth <

x86: Declare local functions as "static" and specify argument types

This makes the code compilable with the compiler flags -Wstrict-prototypes
and -Wmissing-prototypes.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1538123582-17442-2-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# b15e79ef 05-Sep-2018 Liran Alon <liran.alon@oracle.com>

x86: UMIP: Fix wrong print of CR4.UMIP bit status

Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20180905232800.10318-1-lira

x86: UMIP: Fix wrong print of CR4.UMIP bit status

Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20180905232800.10318-1-liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# d5d04459 11-Sep-2018 Paolo Bonzini <pbonzini@redhat.com>

x86: umip: skip SMSW test because it fails

SMSW does not cause a VMEXIT and therefore emulated UMIP fails.
Comment out the test.

Suggested-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Paol

x86: umip: skip SMSW test because it fails

SMSW does not cause a VMEXIT and therefore emulated UMIP fails.
Comment out the test.

Suggested-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 49024be1 17-Jul-2018 Peter Xu <peterx@redhat.com>

umip: fix build error

Fix errors like:

x86/umip.c: In function ‘main’:
x86/umip.c:180:20: error: passing argument 1 of ‘test_umip_nogp’ discards ‘const’ qualifier from pointer target type [-Werror=

umip: fix build error

Fix errors like:

x86/umip.c: In function ‘main’:
x86/umip.c:180:20: error: passing argument 1 of ‘test_umip_nogp’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
test_umip_nogp("UMIP=0, CPL=0\n");

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 728e71ee 23-Mar-2018 Paolo Bonzini <pbonzini@redhat.com>

x86: add UMIP test

The UMIP feature can be emulated by KVM, so it's useful to add
a test that it works properly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>