Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 496203b1 authored by Isaku Yamahata's avatar Isaku Yamahata Committed by Tony Luck
Browse files

ia64/pv_ops/xen: paravirtualize read/write ar.itc and ar.itm



paravirtualize ar.itc and ar.itm in order to support save/restore.

Signed-off-by: default avatarIsaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 94752a79
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -113,6 +113,27 @@
.endm
#define MOV_FROM_PSR(pred, reg, clob)	__MOV_FROM_PSR pred, reg, clob

/* assuming ar.itc is read with interrupt disabled. */
#define MOV_FROM_ITC(pred, pred_clob, reg, clob)		\
(pred)	movl clob = XSI_ITC_OFFSET;				\
	;;							\
(pred)	ld8 clob = [clob];					\
(pred)	mov reg = ar.itc;					\
	;;							\
(pred)	add reg = reg, clob;					\
	;;							\
(pred)	movl clob = XSI_ITC_LAST;				\
	;;							\
(pred)	ld8 clob = [clob];					\
	;;							\
(pred)	cmp.geu.unc pred_clob, p0 = clob, reg;			\
	;;							\
(pred_clob)	add reg = 1, clob;				\
	;;							\
(pred)	movl clob = XSI_ITC_LAST;				\
	;;							\
(pred)	st8 [clob] = reg


#define MOV_TO_IFA(reg, clob)	\
	movl clob = XSI_IFA;	\
+9 −0
Original line number Diff line number Diff line
@@ -209,6 +209,15 @@ struct mapped_regs {
			unsigned long krs[8];	/* kernel registers */
			unsigned long tmp[16];	/* temp registers
						   (e.g. for hyperprivops) */

			/* itc paravirtualization
			 * vAR.ITC = mAR.ITC + itc_offset
			 * itc_last is one which was lastly passed to
			 * the guest OS in order to prevent it from
			 * going backwords.
			 */
			unsigned long itc_offset;
			unsigned long itc_last;
		};
	};
};
+10 −1
Original line number Diff line number Diff line

#ifdef CONFIG_VIRT_CPU_ACCOUNTING
/* read ar.itc in advance, and use it before leaving bank 0 */
#define XEN_ACCOUNT_GET_STAMP		\
	MOV_FROM_ITC(pUStk, p6, r20, r2);
#else
#define XEN_ACCOUNT_GET_STAMP
#endif

/*
 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves
 * the minimum state necessary that allows us to turn psr.ic back
@@ -123,7 +132,7 @@
	;;											\
.mem.offset 0,0; st8.spill [r16]=r2,16;								\
.mem.offset 8,0; st8.spill [r17]=r3,16;								\
	ACCOUNT_GET_STAMP									\
	XEN_ACCOUNT_GET_STAMP									\
	adds r2=IA64_PT_REGS_R16_OFFSET,r1;							\
	;;											\
	EXTRA;											\
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@
#define XSI_BANK1_R16			(XSI_BASE + XSI_BANK1_R16_OFS)
#define XSI_BANKNUM			(XSI_BASE + XSI_BANKNUM_OFS)
#define XSI_IHA				(XSI_BASE + XSI_IHA_OFS)
#define XSI_ITC_OFFSET			(XSI_BASE + XSI_ITC_OFFSET_OFS)
#define XSI_ITC_LAST			(XSI_BASE + XSI_ITC_LAST_OFS)
#endif

#ifndef __ASSEMBLY__
+2 −0
Original line number Diff line number Diff line
@@ -316,5 +316,7 @@ void foo(void)
	DEFINE_MAPPED_REG_OFS(XSI_BANK1_R16_OFS, bank1_regs[0]);
	DEFINE_MAPPED_REG_OFS(XSI_B0NATS_OFS, vbnat);
	DEFINE_MAPPED_REG_OFS(XSI_B1NATS_OFS, vnat);
	DEFINE_MAPPED_REG_OFS(XSI_ITC_OFFSET_OFS, itc_offset);
	DEFINE_MAPPED_REG_OFS(XSI_ITC_LAST_OFS, itc_last);
#endif /* CONFIG_XEN */
}
Loading