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
7d9a662ed9.

Reviewed-by: Ackerley Tng <ackerleytng@google.com>
Link: https://lore.kernel.org/r/20240314232637.2538648-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
Sean Christopherson 2024-03-14 16:26:20 -07:00
parent 87aa264cd8
commit 2b7deea3ec
28 changed files with 1156 additions and 12 deletions

View File

@ -10,6 +10,7 @@
#include "gic.h"
#include "processor.h"
#include "timer_test.h"
#include "ucall_common.h"
#include "vgic.h"
#define GICD_BASE_GPA 0x8000000ULL

View File

@ -26,6 +26,7 @@
#include <sys/sysinfo.h>
#include "timer_test.h"
#include "ucall_common.h"
struct test_args test_args = {
.nr_vcpus = NR_VCPUS_DEF,

View File

@ -19,6 +19,7 @@
#include "test_util.h"
#include "memstress.h"
#include "guest_modes.h"
#include "ucall_common.h"
#include "userfaultfd_util.h"
#ifdef __NR_userfaultfd

View File

@ -18,6 +18,7 @@
#include "test_util.h"
#include "memstress.h"
#include "guest_modes.h"
#include "ucall_common.h"
#ifdef __aarch64__
#include "aarch64/vgic.h"

View File

@ -20,6 +20,7 @@
#include "test_util.h"
#include "guest_modes.h"
#include "processor.h"
#include "ucall_common.h"
#define DIRTY_MEM_BITS 30 /* 1G */
#define PAGE_SHIFT_4K 12

View File

@ -17,8 +17,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "kvm_util.h"
#include "test_util.h"
#include "kvm_util_base.h"
static void test_file_read_write(int fd)
{

View File

@ -13,6 +13,7 @@
#include "test_util.h"
#include "kvm_util.h"
#include "processor.h"
#include "ucall_common.h"
struct guest_vals {
uint64_t a;

View File

@ -8,6 +8,8 @@
#define SELFTEST_KVM_PROCESSOR_H
#include "kvm_util.h"
#include "ucall_common.h"
#include <linux/stringify.h>
#include <linux/types.h>
#include <asm/sysreg.h>

View File

@ -2,7 +2,7 @@
#ifndef 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

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
#ifndef 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

View File

@ -18,7 +18,8 @@
#include <linux/kvm_para.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_amd;

View File

@ -2,7 +2,7 @@
#ifndef 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

View File

@ -18,6 +18,7 @@
#include "kvm_util.h"
#include "processor.h"
#include "guest_modes.h"
#include "ucall_common.h"
#define TEST_MEM_SLOT_INDEX 1

View File

@ -11,6 +11,8 @@
#include "guest_modes.h"
#include "kvm_util.h"
#include "processor.h"
#include "ucall_common.h"
#include <linux/bitfield.h>
#include <linux/sizes.h>

View File

@ -7,6 +7,7 @@
#include "test_util.h"
#include "kvm_util.h"
#include "processor.h"
#include "ucall_common.h"
#include <assert.h>
#include <sched.h>

View File

@ -8,6 +8,7 @@
#include "kvm_util.h"
#include "memstress.h"
#include "processor.h"
#include "ucall_common.h"
struct memstress_args memstress_args;

View File

@ -10,6 +10,7 @@
#include "kvm_util.h"
#include "processor.h"
#include "ucall_common.h"
#define DEFAULT_RISCV_GUEST_STACK_VADDR_MIN 0xac0000

View File

@ -1,9 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "kvm_util.h"
#include "linux/types.h"
#include "linux/bitmap.h"
#include "linux/atomic.h"
#include "kvm_util.h"
#include "ucall_common.h"
#define GUEST_UCALL_FAILED -1
struct ucall_header {

View File

@ -11,6 +11,7 @@
#include "kvm_util.h"
#include "processor.h"
#include "timer_test.h"
#include "ucall_common.h"
static int timer_irq = IRQ_S_TIMER;

View File

@ -27,6 +27,7 @@
#include "kvm_util.h"
#include "processor.h"
#include "test_util.h"
#include "ucall_common.h"
/*
* Any bug related to task migration is likely to be timing-dependent; perform

View File

@ -16,6 +16,7 @@
#include "test_util.h"
#include "kvm_util.h"
#include "kselftest.h"
#include "ucall_common.h"
#define MAIN_PAGE_COUNT 512

View File

@ -15,6 +15,7 @@
#include "test_util.h"
#include "kvm_util.h"
#include "kselftest.h"
#include "ucall_common.h"
enum mop_target {
LOGICAL,

View File

@ -8,6 +8,7 @@
#include "test_util.h"
#include "kvm_util.h"
#include "kselftest.h"
#include "ucall_common.h"
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT)

View File

@ -17,6 +17,7 @@
#include "test_util.h"
#include "kvm_util.h"
#include "processor.h"
#include "ucall_common.h"
#define NR_VCPUS 4
#define ST_GPA_BASE (1 << 30)

View File

@ -17,6 +17,7 @@
#include "test_util.h"
#include "memstress.h"
#include "guest_modes.h"
#include "ucall_common.h"
#define VCPUS 2
#define SLOTS 2

View File

@ -5,8 +5,8 @@
* Test for KVM_CAP_EXIT_ON_EMULATION_FAILURE.
*/
#include "flds_emulation.h"
#include "test_util.h"
#include "ucall_common.h"
#define MMIO_GPA 0x700000000
#define MMIO_GVA MMIO_GPA

View File

@ -22,7 +22,6 @@
#include <string.h>
#include <time.h>
#include "kvm_util_base.h"
#include "kvm_util.h"
#include "mce.h"
#include "processor.h"