| 
					
				 | 
			
			
				@@ -162,3 +162,139 @@ struct kvm_vm_data { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #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 + \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				offsetof(struct kvm_vm_data, kvm_mem_dirty_log) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define VHPT_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vhpt)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define VTLB_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vtlb)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define VPD_BASE(n)  (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vpd)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define VCPU_STRUCT_BASE(n)	(VCPU_BASE(n) + \ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				offsetof(struct kvm_vcpu_data, vcpu_struct)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*IO section definitions*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define IOREQ_READ      1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define IOREQ_WRITE     0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define STATE_IOREQ_NONE        0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define STATE_IOREQ_READY       1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define STATE_IOREQ_INPROCESS   2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define STATE_IORESP_READY      3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*Guest Physical address layout.*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_MEM        (0UL << 60) /* Guest pfn is normal mem */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_FRAME_BUFFER   (1UL << 60) /* VGA framebuffer */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_LOW_MMIO       (2UL << 60) /* Low MMIO range */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_PIB        (3UL << 60) /* PIB base */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_IOSAPIC        (4UL << 60) /* IOSAPIC base */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_LEGACY_IO      (5UL << 60) /* Legacy I/O base */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_GFW        (6UL << 60) /* Guest Firmware */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_PHYS_MMIO      (7UL << 60) /* Directed MMIO Range */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_IO_MASK        (7UL << 60) /* Guest pfn is I/O type */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GPFN_INV_MASK       (1UL << 63) /* Guest pfn is invalid */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define INVALID_MFN       (~0UL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define MEM_G   (1UL << 30) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define MEM_M   (1UL << 20) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define MMIO_START       (3 * MEM_G) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define MMIO_SIZE        (512 * MEM_M) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define VGA_IO_START     0xA0000UL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define VGA_IO_SIZE      0x20000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define LEGACY_IO_START  (MMIO_START + MMIO_SIZE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define LEGACY_IO_SIZE   (64 * MEM_M) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define IO_SAPIC_START   0xfec00000UL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define IO_SAPIC_SIZE    0x100000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define PIB_START 0xfee00000UL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define PIB_SIZE 0x200000 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GFW_START        (4 * MEM_G - 16 * MEM_M) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define GFW_SIZE         (16 * MEM_M) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*Deliver mode, defined for ioapic.c*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define dest_Fixed IOSAPIC_FIXED 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define dest_LowestPrio IOSAPIC_LOWEST_PRIORITY 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define NMI_VECTOR      		2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define ExtINT_VECTOR       		0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define NULL_VECTOR     		(-1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define IA64_SPURIOUS_INT_VECTOR    	0x0f 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define VCPU_LID(v) (((u64)(v)->vcpu_id) << 24) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ *Delivery mode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define SAPIC_DELIV_SHIFT      8 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define SAPIC_FIXED            0x0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define SAPIC_LOWEST_PRIORITY  0x1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define SAPIC_PMI              0x2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define SAPIC_NMI              0x4 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define SAPIC_INIT             0x5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define SAPIC_EXTINT           0x7 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * vcpu->requests bit members for arch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define KVM_REQ_PTC_G		32 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define KVM_REQ_RESUME		33 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define KVM_HPAGE_GFN_SHIFT(x)	0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define KVM_NR_PAGE_SIZES	1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define KVM_PAGES_PER_HPAGE(x)	1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+struct kvm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+struct kvm_vcpu; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+struct kvm_mmio_req { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t addr;          /*  physical address		*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t size;          /*  size in bytes		*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t data;          /*  data (or paddr of data)     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint8_t state:4; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint8_t dir:1;          /*  1=read, 0=write             */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*Pal data struct */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+struct kvm_pal_call{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/*In area*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t gr28; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t gr29; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t gr30; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t gr31; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/*Out area*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	struct ia64_pal_retval ret; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* Sal data structure */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+struct kvm_sal_call{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/*In area*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t in0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t in1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t in2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t in3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t in4; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t in5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t in6; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t in7; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	struct sal_ret_values ret; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*Guest change rr6*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+struct kvm_switch_rr6 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t old_rr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	uint64_t new_rr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+union ia64_ipi_a{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	unsigned long val; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unsigned long rv  : 3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unsigned long ir  : 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unsigned long eid : 8; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unsigned long id  : 8; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unsigned long ib_base : 44; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+union ia64_ipi_d { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	unsigned long val; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unsigned long vector : 8; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unsigned long dm  : 3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unsigned long ig  : 53; 
			 |