Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.12-rc7 115 lines 2.5 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * tools/testing/selftests/kvm/lib/kvm_util_internal.h 4 * 5 * Copyright (C) 2018, Google LLC. 6 */ 7 8#ifndef SELFTEST_KVM_UTIL_INTERNAL_H 9#define SELFTEST_KVM_UTIL_INTERNAL_H 10 11#include "sparsebit.h" 12 13struct userspace_mem_region { 14 struct kvm_userspace_memory_region region; 15 struct sparsebit *unused_phy_pages; 16 int fd; 17 off_t offset; 18 void *host_mem; 19 void *mmap_start; 20 size_t mmap_size; 21 struct list_head list; 22}; 23 24struct vcpu { 25 struct list_head list; 26 uint32_t id; 27 int fd; 28 struct kvm_run *state; 29 struct kvm_dirty_gfn *dirty_gfns; 30 uint32_t fetch_index; 31 uint32_t dirty_gfns_count; 32}; 33 34struct kvm_vm { 35 int mode; 36 unsigned long type; 37 int kvm_fd; 38 int fd; 39 unsigned int pgtable_levels; 40 unsigned int page_size; 41 unsigned int page_shift; 42 unsigned int pa_bits; 43 unsigned int va_bits; 44 uint64_t max_gfn; 45 struct list_head vcpus; 46 struct list_head userspace_mem_regions; 47 struct sparsebit *vpages_valid; 48 struct sparsebit *vpages_mapped; 49 bool has_irqchip; 50 bool pgd_created; 51 vm_paddr_t pgd; 52 vm_vaddr_t gdt; 53 vm_vaddr_t tss; 54 vm_vaddr_t idt; 55 vm_vaddr_t handlers; 56 uint32_t dirty_ring_size; 57}; 58 59struct vcpu *vcpu_find(struct kvm_vm *vm, uint32_t vcpuid); 60 61/* 62 * Virtual Translation Tables Dump 63 * 64 * Input Args: 65 * stream - Output FILE stream 66 * vm - Virtual Machine 67 * indent - Left margin indent amount 68 * 69 * Output Args: None 70 * 71 * Return: None 72 * 73 * Dumps to the FILE stream given by @stream, the contents of all the 74 * virtual translation tables for the VM given by @vm. 75 */ 76void virt_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent); 77 78/* 79 * Register Dump 80 * 81 * Input Args: 82 * stream - Output FILE stream 83 * regs - Registers 84 * indent - Left margin indent amount 85 * 86 * Output Args: None 87 * 88 * Return: None 89 * 90 * Dumps the state of the registers given by @regs, to the FILE stream 91 * given by @stream. 92 */ 93void regs_dump(FILE *stream, struct kvm_regs *regs, uint8_t indent); 94 95/* 96 * System Register Dump 97 * 98 * Input Args: 99 * stream - Output FILE stream 100 * sregs - System registers 101 * indent - Left margin indent amount 102 * 103 * Output Args: None 104 * 105 * Return: None 106 * 107 * Dumps the state of the system registers given by @sregs, to the FILE stream 108 * given by @stream. 109 */ 110void sregs_dump(FILE *stream, struct kvm_sregs *sregs, uint8_t indent); 111 112struct userspace_mem_region * 113memslot2region(struct kvm_vm *vm, uint32_t memslot); 114 115#endif /* SELFTEST_KVM_UTIL_INTERNAL_H */