# HG changeset patch
# User dietmar.hahn@xxxxxxxxxxxxxxxxxxx
# Node ID 4a1fb436f97d189b43fe8e8c573d9ea6e978d735
# Parent  51a42f8c2b4848e731895ed5ad42e5512ec8cd86
Added IA64_INST_KEY_MISS_VECTOR and IA64_DATA_KEY_MISS_VECTOR
to ia64_handle_reflection.
Added using the key in handling XEN_IA64_OPTF_IDENT_MAP_REG7 in PV.

Signed-off-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxxxxxxx>

diff -r 51a42f8c2b48 -r 4a1fb436f97d xen/arch/ia64/xen/faults.c
--- a/xen/arch/ia64/xen/faults.c	Fri Jul 27 07:45:05 2007 +0200
+++ b/xen/arch/ia64/xen/faults.c	Fri Jul 27 07:56:50 2007 +0200
@@ -572,6 +572,12 @@ ia64_handle_reflection(unsigned long ifa
 	BUG_ON(!(psr & IA64_PSR_CPL));
 
 	switch (vector) {
+	case 6:
+		vector = IA64_INST_KEY_MISS_VECTOR;
+		break;
+	case 7:
+		vector = IA64_DATA_KEY_MISS_VECTOR;
+		break;
 	case 8:
 		vector = IA64_DIRTY_BIT_VECTOR;
 		break;
diff -r 51a42f8c2b48 -r 4a1fb436f97d xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c	Fri Jul 27 07:45:05 2007 +0200
+++ b/xen/arch/ia64/xen/vcpu.c	Fri Jul 27 07:56:50 2007 +0200
@@ -1623,7 +1623,7 @@ IA64FAULT vcpu_translate(VCPU * vcpu, u6
 			 u64 * pteval, u64 * itir, u64 * iha)
 {
 	unsigned long region = address >> 61;
-	unsigned long pta, rid, rr;
+	unsigned long pta, rid, rr, key = 0;
 	union pte_flags pte;
 	TR_ENTRY *trp;
 
@@ -1716,6 +1716,7 @@ IA64FAULT vcpu_translate(VCPU * vcpu, u6
 		    region == 7 && ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL) {
 			pte.val = address & _PAGE_PPN_MASK;
 			pte.val = pte.val | optf->im_reg7.pgprot;
+			key = optf->im_reg7.key;
 			goto out;
 		}
 		return is_data ? IA64_ALT_DATA_TLB_VECTOR :
@@ -1741,7 +1742,7 @@ IA64FAULT vcpu_translate(VCPU * vcpu, u6
 
 	/* found mapping in guest VHPT! */
 out:
-	*itir = rr & RR_PS_MASK;
+	*itir = (rr & RR_PS_MASK) | (key << IA64_ITIR_KEY);
 	*pteval = pte.val;
 	perfc_incr(vhpt_translate);
 	return IA64_NO_FAULT;