From 84783d4f953fc1c4383e78f50bf14171cc67d3d5 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Wed, 19 Dec 2007 14:14:21 +0800
Subject: [PATCH] kvm/ia64: Add tr operation routines for ia64.

This patches creates kvm_tr.S, which used as tr operations(insert/purge).
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
 arch/ia64/kvm/kvm_tr.S |   82 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 82 insertions(+), 0 deletions(-)
 create mode 100644 arch/ia64/kvm/kvm_tr.S

diff --git a/arch/ia64/kvm/kvm_tr.S b/arch/ia64/kvm/kvm_tr.S
new file mode 100644
index 0000000..c48cac0
--- /dev/null
+++ b/arch/ia64/kvm/kvm_tr.S
@@ -0,0 +1,82 @@
+/*
+ * kvm_tr.S: Utility for TR operation
+ *
+ * 	Copyright (C) 2007 Intel Corperation
+ * 	Zhang Xiantao <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.
+ */
+#include <asm/asmmacro.h>
+
+/*  __kvm_insert_idtr(trnum, vaddr, paddr, ps)
+ *  Ensure irq is disabled before called here!!!
+ *  Description:  Insert mapping into ITR & DTR with current region ID.
+ *  trnum: tr number
+ *  vaddr: virtual address (format refers to IFA format, in SDV Vol2 4.1.1.5
+ *  paddr: physical address (format refers to GR format, in SDV Vol2 4.1.1.5
+ *  ps: log 2 of page size
+ */
+GLOBAL_ENTRY (__kvm_insert_idtr)
+    .regstk 4,0,0,0
+	rsm	psr.ic
+	;;
+	srlz.d
+	;;
+	shl	in3=in3, 2
+	;;
+	mov	cr.itir=in3
+	mov	cr.ifa=in1
+	;;
+    	ptr.i in1,in3
+    	;;
+    	srlz.i
+    	;;
+	itr.i	itr[in0]=in2
+	;;
+	srlz.i
+	;;
+    	ptr.d in1,in3
+    	;;
+    	srlz.d
+    	;;
+	itr.d	dtr[in0]=in2
+	;;
+	srlz.d
+	;;
+	ssm psr.ic
+	;;
+	srlz.d
+	;;
+	br.ret.sptk b0
+END(__kvm_insert_idtr)
+
+ /*  __kvm_purge_dtr_rr(vaddr, ps,)
+ *  vaddr: virtual address (format refers to IFA format, in SDV Vol2 4.1.1.5
+ *  ps: log 2 of page size
+ */
+
+GLOBAL_ENTRY(__kvm_purge_idtr)
+    .regstk 2,0,0,0
+	shl in1 = in1,2
+	;;
+	ptr.i in0,in1
+	;;
+	srlz.i
+	ptr.d in0,in1
+	;;
+	srlz.d
+	;;
+	br.ret.sptk b0
+END(__kvm_purge_idtr)
+
-- 
1.5.2

