Commit 2b7deea3 authored by Sean Christopherson's avatar Sean Christopherson

Revert "kvm: selftests: move base kvm_util.h declarations to kvm_util_base.h"

Effectively revert the movement of code from kvm_util.h => kvm_util_base.h,
as the TL;DR of the justification for the move was to avoid #idefs and/or
circular dependencies between what ended up being ucall_common.h and what
was (and now again, is), kvm_util.h.

But avoiding #ifdef and circular includes is trivial: don't do that.  The
cost of removing kvm_util_base.h is a few extra includes of ucall_common.h,
but that cost is practically nothing.  On the other hand, having a "base"
version of a header that is really just the header itself is confusing,
and makes it weird/hard to choose names for headers that actually are
"base" headers, e.g. to hold core KVM selftests typedefs.

For all intents and purposes, this reverts commit
7d9a662e.
Reviewed-by: default avatarAckerley Tng <ackerleytng@google.com>
Link: https://lore.kernel.org/r/20240314232637.2538648-2-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 87aa264c
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "gic.h" #include "gic.h"
#include "processor.h" #include "processor.h"
#include "timer_test.h" #include "timer_test.h"
#include "ucall_common.h"
#include "vgic.h" #include "vgic.h"
#define GICD_BASE_GPA 0x8000000ULL #define GICD_BASE_GPA 0x8000000ULL
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include "timer_test.h" #include "timer_test.h"
#include "ucall_common.h"
struct test_args test_args = { struct test_args test_args = {
.nr_vcpus = NR_VCPUS_DEF, .nr_vcpus = NR_VCPUS_DEF,
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "test_util.h" #include "test_util.h"
#include "memstress.h" #include "memstress.h"
#include "guest_modes.h" #include "guest_modes.h"
#include "ucall_common.h"
#include "userfaultfd_util.h" #include "userfaultfd_util.h"
#ifdef __NR_userfaultfd #ifdef __NR_userfaultfd
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "test_util.h" #include "test_util.h"
#include "memstress.h" #include "memstress.h"
#include "guest_modes.h" #include "guest_modes.h"
#include "ucall_common.h"
#ifdef __aarch64__ #ifdef __aarch64__
#include "aarch64/vgic.h" #include "aarch64/vgic.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "test_util.h" #include "test_util.h"
#include "guest_modes.h" #include "guest_modes.h"
#include "processor.h" #include "processor.h"
#include "ucall_common.h"
#define DIRTY_MEM_BITS 30 /* 1G */ #define DIRTY_MEM_BITS 30 /* 1G */
#define PAGE_SHIFT_4K 12 #define PAGE_SHIFT_4K 12
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "kvm_util.h"
#include "test_util.h" #include "test_util.h"
#include "kvm_util_base.h"
static void test_file_read_write(int fd) static void test_file_read_write(int fd)
{ {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "test_util.h" #include "test_util.h"
#include "kvm_util.h" #include "kvm_util.h"
#include "processor.h" #include "processor.h"
#include "ucall_common.h"
struct guest_vals { struct guest_vals {
uint64_t a; uint64_t a;
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#define SELFTEST_KVM_PROCESSOR_H #define SELFTEST_KVM_PROCESSOR_H
#include "kvm_util.h" #include "kvm_util.h"
#include "ucall_common.h"
#include <linux/stringify.h> #include <linux/stringify.h>
#include <linux/types.h> #include <linux/types.h>
#include <asm/sysreg.h> #include <asm/sysreg.h>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#ifndef SELFTEST_KVM_UCALL_H #ifndef SELFTEST_KVM_UCALL_H
#define SELFTEST_KVM_UCALL_H #define SELFTEST_KVM_UCALL_H
#include "kvm_util_base.h" #include "kvm_util.h"
#define UCALL_EXIT_REASON KVM_EXIT_MMIO #define UCALL_EXIT_REASON KVM_EXIT_MMIO
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#ifndef SELFTEST_KVM_UCALL_H #ifndef SELFTEST_KVM_UCALL_H
#define SELFTEST_KVM_UCALL_H #define SELFTEST_KVM_UCALL_H
#include "kvm_util_base.h" #include "kvm_util.h"
#define UCALL_EXIT_REASON KVM_EXIT_S390_SIEIC #define UCALL_EXIT_REASON KVM_EXIT_S390_SIEIC
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
#include <linux/kvm_para.h> #include <linux/kvm_para.h>
#include <linux/stringify.h> #include <linux/stringify.h>
#include "../kvm_util.h" #include "kvm_util.h"
#include "ucall_common.h"
extern bool host_cpu_is_intel; extern bool host_cpu_is_intel;
extern bool host_cpu_is_amd; extern bool host_cpu_is_amd;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#ifndef SELFTEST_KVM_UCALL_H #ifndef SELFTEST_KVM_UCALL_H
#define SELFTEST_KVM_UCALL_H #define SELFTEST_KVM_UCALL_H
#include "kvm_util_base.h" #include "kvm_util.h"
#define UCALL_EXIT_REASON KVM_EXIT_IO #define UCALL_EXIT_REASON KVM_EXIT_IO
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "kvm_util.h" #include "kvm_util.h"
#include "processor.h" #include "processor.h"
#include "guest_modes.h" #include "guest_modes.h"
#include "ucall_common.h"
#define TEST_MEM_SLOT_INDEX 1 #define TEST_MEM_SLOT_INDEX 1
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "guest_modes.h" #include "guest_modes.h"
#include "kvm_util.h" #include "kvm_util.h"
#include "processor.h" #include "processor.h"
#include "ucall_common.h"
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/sizes.h> #include <linux/sizes.h>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "test_util.h" #include "test_util.h"
#include "kvm_util.h" #include "kvm_util.h"
#include "processor.h" #include "processor.h"
#include "ucall_common.h"
#include <assert.h> #include <assert.h>
#include <sched.h> #include <sched.h>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "kvm_util.h" #include "kvm_util.h"
#include "memstress.h" #include "memstress.h"
#include "processor.h" #include "processor.h"
#include "ucall_common.h"
struct memstress_args memstress_args; struct memstress_args memstress_args;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "kvm_util.h" #include "kvm_util.h"
#include "processor.h" #include "processor.h"
#include "ucall_common.h"
#define DEFAULT_RISCV_GUEST_STACK_VADDR_MIN 0xac0000 #define DEFAULT_RISCV_GUEST_STACK_VADDR_MIN 0xac0000
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
#include "kvm_util.h"
#include "linux/types.h" #include "linux/types.h"
#include "linux/bitmap.h" #include "linux/bitmap.h"
#include "linux/atomic.h" #include "linux/atomic.h"
#include "kvm_util.h"
#include "ucall_common.h"
#define GUEST_UCALL_FAILED -1 #define GUEST_UCALL_FAILED -1
struct ucall_header { struct ucall_header {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "kvm_util.h" #include "kvm_util.h"
#include "processor.h" #include "processor.h"
#include "timer_test.h" #include "timer_test.h"
#include "ucall_common.h"
static int timer_irq = IRQ_S_TIMER; static int timer_irq = IRQ_S_TIMER;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "kvm_util.h" #include "kvm_util.h"
#include "processor.h" #include "processor.h"
#include "test_util.h" #include "test_util.h"
#include "ucall_common.h"
/* /*
* Any bug related to task migration is likely to be timing-dependent; perform * Any bug related to task migration is likely to be timing-dependent; perform
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "test_util.h" #include "test_util.h"
#include "kvm_util.h" #include "kvm_util.h"
#include "kselftest.h" #include "kselftest.h"
#include "ucall_common.h"
#define MAIN_PAGE_COUNT 512 #define MAIN_PAGE_COUNT 512
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "test_util.h" #include "test_util.h"
#include "kvm_util.h" #include "kvm_util.h"
#include "kselftest.h" #include "kselftest.h"
#include "ucall_common.h"
enum mop_target { enum mop_target {
LOGICAL, LOGICAL,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "test_util.h" #include "test_util.h"
#include "kvm_util.h" #include "kvm_util.h"
#include "kselftest.h" #include "kselftest.h"
#include "ucall_common.h"
#define PAGE_SHIFT 12 #define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT) #define PAGE_SIZE (1 << PAGE_SHIFT)
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "test_util.h" #include "test_util.h"
#include "kvm_util.h" #include "kvm_util.h"
#include "processor.h" #include "processor.h"
#include "ucall_common.h"
#define NR_VCPUS 4 #define NR_VCPUS 4
#define ST_GPA_BASE (1 << 30) #define ST_GPA_BASE (1 << 30)
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "test_util.h" #include "test_util.h"
#include "memstress.h" #include "memstress.h"
#include "guest_modes.h" #include "guest_modes.h"
#include "ucall_common.h"
#define VCPUS 2 #define VCPUS 2
#define SLOTS 2 #define SLOTS 2
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* Test for KVM_CAP_EXIT_ON_EMULATION_FAILURE. * Test for KVM_CAP_EXIT_ON_EMULATION_FAILURE.
*/ */
#include "flds_emulation.h" #include "flds_emulation.h"
#include "test_util.h" #include "test_util.h"
#include "ucall_common.h"
#define MMIO_GPA 0x700000000 #define MMIO_GPA 0x700000000
#define MMIO_GVA MMIO_GPA #define MMIO_GVA MMIO_GPA
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include "kvm_util_base.h"
#include "kvm_util.h" #include "kvm_util.h"
#include "mce.h" #include "mce.h"
#include "processor.h" #include "processor.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment