summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/include/x86_64/kvm_util_arch.h
blob: 41aba476640a34a70e929643627835bb0b7b8d5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef SELFTEST_KVM_UTIL_ARCH_H
#define SELFTEST_KVM_UTIL_ARCH_H

#include <stdbool.h>
#include <stdint.h>

extern bool is_forced_emulation_enabled;

struct kvm_vm_arch {
	uint64_t c_bit;
	uint64_t s_bit;
	int sev_fd;
	bool is_pt_protected;
};

static inline bool __vm_arch_has_protected_memory(struct kvm_vm_arch *arch)
{
	return arch->c_bit || arch->s_bit;
}

#define vm_arch_has_protected_memory(vm) \
	__vm_arch_has_protected_memory(&(vm)->arch)

#endif  // SELFTEST_KVM_UTIL_ARCH_H