123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- /*
- * kvm_host.h: used for kvm module, and hold ia64-specific sections.
- *
- * Copyright (C) 2007, Intel Corporation.
- *
- * Xiantao Zhang <xiantao.zhang@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- */
- #ifndef __ASM_KVM_HOST_H
- #define __ASM_KVM_HOST_H
- #define KVM_MEMORY_SLOTS 32
- /* memory slots that does not exposed to userspace */
- #define KVM_PRIVATE_MEM_SLOTS 4
- #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
- /* define exit reasons from vmm to kvm*/
- #define EXIT_REASON_VM_PANIC 0
- #define EXIT_REASON_MMIO_INSTRUCTION 1
- #define EXIT_REASON_PAL_CALL 2
- #define EXIT_REASON_SAL_CALL 3
- #define EXIT_REASON_SWITCH_RR6 4
- #define EXIT_REASON_VM_DESTROY 5
- #define EXIT_REASON_EXTERNAL_INTERRUPT 6
- #define EXIT_REASON_IPI 7
- #define EXIT_REASON_PTC_G 8
- #define EXIT_REASON_DEBUG 20
- /*Define vmm address space and vm data space.*/
- #define KVM_VMM_SIZE (__IA64_UL_CONST(16)<<20)
- #define KVM_VMM_SHIFT 24
- #define KVM_VMM_BASE 0xD000000000000000
- #define VMM_SIZE (__IA64_UL_CONST(8)<<20)
- /*
- * Define vm_buffer, used by PAL Services, base address.
- * Note: vm_buffer is in the VMM-BLOCK, the size must be < 8M
- */
- #define KVM_VM_BUFFER_BASE (KVM_VMM_BASE + VMM_SIZE)
- #define KVM_VM_BUFFER_SIZE (__IA64_UL_CONST(8)<<20)
- /*
- * kvm guest's data area looks as follow:
- *
- * +----------------------+ ------- KVM_VM_DATA_SIZE
- * | vcpu[n]'s data | | ___________________KVM_STK_OFFSET
- * | | | / |
- * | .......... | | /vcpu's struct&stack |
- * | .......... | | /---------------------|---- 0
- * | vcpu[5]'s data | | / vpd |
- * | vcpu[4]'s data | |/-----------------------|
- * | vcpu[3]'s data | / vtlb |
- * | vcpu[2]'s data | /|------------------------|
- * | vcpu[1]'s data |/ | vhpt |
- * | vcpu[0]'s data |____________________________|
- * +----------------------+ |
- * | memory dirty log | |
- * +----------------------+ |
- * | vm's data struct | |
- * +----------------------+ |
- * | | |
- * | | |
- * | | |
- * | | |
- * | | |
- * | | |
- * | | |
- * | vm's p2m table | |
- * | | |
- * | | |
- * | | | |
- * vm's data->| | | |
- * +----------------------+ ------- 0
- * To support large memory, needs to increase the size of p2m.
- * To support more vcpus, needs to ensure it has enough space to
- * hold vcpus' data.
- */
- #define KVM_VM_DATA_SHIFT 26
- #define KVM_VM_DATA_SIZE (__IA64_UL_CONST(1) << KVM_VM_DATA_SHIFT)
- #define KVM_VM_DATA_BASE (KVM_VMM_BASE + KVM_VM_DATA_SIZE)
- #define KVM_P2M_BASE KVM_VM_DATA_BASE
- #define KVM_P2M_SIZE (__IA64_UL_CONST(24) << 20)
- #define VHPT_SHIFT 16
- #define VHPT_SIZE (__IA64_UL_CONST(1) << VHPT_SHIFT)
- #define VHPT_NUM_ENTRIES (__IA64_UL_CONST(1) << (VHPT_SHIFT-5))
- #define VTLB_SHIFT 16
- #define VTLB_SIZE (__IA64_UL_CONST(1) << VTLB_SHIFT)
- #define VTLB_NUM_ENTRIES (1UL << (VHPT_SHIFT-5))
- #define VPD_SHIFT 16
- #define VPD_SIZE (__IA64_UL_CONST(1) << VPD_SHIFT)
- #define VCPU_STRUCT_SHIFT 16
- #define VCPU_STRUCT_SIZE (__IA64_UL_CONST(1) << VCPU_STRUCT_SHIFT)
- /*
- * This must match KVM_IA64_VCPU_STACK_{SHIFT,SIZE} arch/ia64/include/asm/kvm.h
- */
- #define KVM_STK_SHIFT 16
- #define KVM_STK_OFFSET (__IA64_UL_CONST(1)<< KVM_STK_SHIFT)
- #define KVM_VM_STRUCT_SHIFT 19
- #define KVM_VM_STRUCT_SIZE (__IA64_UL_CONST(1) << KVM_VM_STRUCT_SHIFT)
- #define KVM_MEM_DIRY_LOG_SHIFT 19
- #define KVM_MEM_DIRTY_LOG_SIZE (__IA64_UL_CONST(1) << KVM_MEM_DIRY_LOG_SHIFT)
- #ifndef __ASSEMBLY__
- /*Define the max vcpus and memory for Guests.*/
- #define KVM_MAX_VCPUS (KVM_VM_DATA_SIZE - KVM_P2M_SIZE - KVM_VM_STRUCT_SIZE -\
- KVM_MEM_DIRTY_LOG_SIZE) / sizeof(struct kvm_vcpu_data)
- #define KVM_MAX_MEM_SIZE (KVM_P2M_SIZE >> 3 << PAGE_SHIFT)
- #define VMM_LOG_LEN 256
- #include <linux/types.h>
- #include <linux/mm.h>
- #include <linux/kvm.h>
- #include <linux/kvm_para.h>
- #include <linux/kvm_types.h>
- #include <asm/pal.h>
- #include <asm/sal.h>
- #include <asm/page.h>
- struct kvm_vcpu_data {
- char vcpu_vhpt[VHPT_SIZE];
- char vcpu_vtlb[VTLB_SIZE];
- char vcpu_vpd[VPD_SIZE];
- char vcpu_struct[VCPU_STRUCT_SIZE];
- };
- struct kvm_vm_data {
- char kvm_p2m[KVM_P2M_SIZE];
- char kvm_vm_struct[KVM_VM_STRUCT_SIZE];
- char kvm_mem_dirty_log[KVM_MEM_DIRTY_LOG_SIZE];
- struct kvm_vcpu_data vcpu_data[KVM_MAX_VCPUS];
- };
- #define VCPU_BASE(n) (KVM_VM_DATA_BASE + \
- offsetof(struct kvm_vm_data, vcpu_data[n]))
- #define KVM_VM_BASE (KVM_VM_DATA_BASE + \
- offsetof(struct kvm_vm_data, kvm_vm_struct))
- #define KVM_MEM_DIRTY_LOG_BASE KVM_VM_DATA_BASE + \
|