Skip to content

Commit

Permalink
Revert "kvm: selftests: move base kvm_util.h declarations to kvm_util…
Browse files Browse the repository at this point in the history
…_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
7d9a662.

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>
  • Loading branch information
sean-jc committed Apr 29, 2024
1 parent 87aa264 commit 2b7deea
Show file tree
Hide file tree
Showing 28 changed files with 1,156 additions and 12 deletions.
1 change: 1 addition & 0 deletions tools/testing/selftests/kvm/aarch64/arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/kvm/arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/kvm/demand_paging_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/kvm/dirty_log_perf_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/kvm/dirty_log_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/kvm/guest_memfd_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/kvm/guest_print_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tools/testing/selftests/kvm/include/aarch64/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/kvm/include/aarch64/ucall.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2b7deea

Please sign in to comment.