tools/testing/selftests/kvm/include/x86/kvm_util_arch.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/include/x86/kvm_util_arch.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/kvm/include/x86/kvm_util_arch.h- Extension
.h- Size
- 1507 bytes
- Lines
- 74
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdbool.hstdint.hkvm_util_types.htest_util.h
Detected Declarations
struct pte_masksstruct kvm_mmu_archstruct kvm_mmustruct kvm_vm_archfunction __vm_arch_has_protected_memory
Annotated Snippet
struct pte_masks {
u64 present;
u64 writable;
u64 user;
u64 readable;
u64 executable;
u64 accessed;
u64 dirty;
u64 huge;
u64 nx;
u64 c;
u64 s;
u64 always_set;
};
struct kvm_mmu_arch {
struct pte_masks pte_masks;
};
struct kvm_mmu;
struct kvm_vm_arch {
gva_t gdt;
gva_t tss;
gva_t idt;
u64 c_bit;
u64 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)
#define vcpu_arch_put_guest(mem, __val) \
do { \
const typeof(mem) val = (__val); \
\
if (!is_forced_emulation_enabled || guest_random_bool(&guest_rng)) { \
(mem) = val; \
} else if (guest_random_bool(&guest_rng)) { \
__asm__ __volatile__(KVM_FEP "mov %1, %0" \
: "+m" (mem) \
: "r" (val) : "memory"); \
} else { \
u64 __old = READ_ONCE(mem); \
\
__asm__ __volatile__(KVM_FEP LOCK_PREFIX "cmpxchg %[new], %[ptr]" \
: [ptr] "+m" (mem), [old] "+a" (__old) \
: [new]"r" (val) : "memory", "cc"); \
} \
} while (0)
#endif // SELFTEST_KVM_UTIL_ARCH_H
Annotation
- Immediate include surface: `stdbool.h`, `stdint.h`, `kvm_util_types.h`, `test_util.h`.
- Detected declarations: `struct pte_masks`, `struct kvm_mmu_arch`, `struct kvm_mmu`, `struct kvm_vm_arch`, `function __vm_arch_has_protected_memory`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.