diff mbox

[05/18] KVM/MIPS32-VZ: VZ-ASE assembler wrapper functions to set GuestIDs

Message ID 1368942460-15577-6-git-send-email-sanjayl@kymasys.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sanjay Lal May 19, 2013, 5:47 a.m. UTC
Signed-off-by: Sanjay Lal <sanjayl@kymasys.com>
---
 arch/mips/kvm/kvm_vz_locore.S | 74 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 arch/mips/kvm/kvm_vz_locore.S

Comments

Sergei Shtylyov May 19, 2013, 1:36 p.m. UTC | #1
Hello.

On 19-05-2013 9:47, Sanjay Lal wrote:

> Signed-off-by: Sanjay Lal <sanjayl@kymasys.com>
> ---
>   arch/mips/kvm/kvm_vz_locore.S | 74 +++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 74 insertions(+)
>   create mode 100644 arch/mips/kvm/kvm_vz_locore.S

> diff --git a/arch/mips/kvm/kvm_vz_locore.S b/arch/mips/kvm/kvm_vz_locore.S
> new file mode 100644
> index 0000000..6d037d7
> --- /dev/null
> +++ b/arch/mips/kvm/kvm_vz_locore.S
> @@ -0,0 +1,74 @@
> +/*
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License.  See the file "COPYING" in the main directory of this archive
> + * for more details.
> + *
> + * KVM/MIPS: Assembler support for hardware virtualization extensions
> + *
> + * Copyright (C) 2012  MIPS Technologies, Inc.  All rights reserved.
> + * Authors: Yann Le Du <ledu@kymasys.com>
> + */
> +
> +#include <asm/asm.h>
> +#include <asm/asmmacro.h>
> +#include <asm/regdef.h>
> +#include <asm/mipsregs.h>
> +#include <asm/asm-offsets.h>
> +#include <asm/mipsvzregs.h>
> +
> +#define MIPSX(name)	mips32_ ## name
> +
> +/*
> + * This routine sets GuestCtl1.RID to GUESTCTL1_VZ_ROOT_GUESTID
> + * Inputs: none
> + */
> +LEAF(MIPSX(ClearGuestRID))
> +	.set	push
> +	.set	mips32r2
> +	.set	noreorder
> +	mfc0	t0, CP0_GUESTCTL1
> +	addiu	t1, zero, GUESTCTL1_VZ_ROOT_GUESTID
> +	ins	t0, t1, GUESTCTL1_RID_SHIFT, GUESTCTL1_RID_WIDTH
> +	mtc0	t0, CP0_GUESTCTL1 # Set GuestCtl1.RID = GUESTCTL1_VZ_ROOT_GUESTID
> +	ehb
> +	j	ra

    Not jr?

> +	nop					# BD Slot

    Instruction in the delay slot is usually indented by extra space.

> +	.set    pop
> +END(MIPSX(ClearGuestRID))
> +
> +
> +/*
> + * This routine sets GuestCtl1.RID to a new value
> + * Inputs: a0 = new GuestRID value (right aligned)
> + */
> +LEAF(MIPSX(SetGuestRID))
> +	.set	push
> +	.set	mips32r2
> +	.set	noreorder
> +	mfc0	t0, CP0_GUESTCTL1
> +	ins 	t0, a0, GUESTCTL1_RID_SHIFT, GUESTCTL1_RID_WIDTH
> +	mtc0	t0, CP0_GUESTCTL1		# Set GuestCtl1.RID
> +	ehb
> +	j	ra
> +	nop					# BD Slot

    Same here...

> +	.set	pop
> +END(MIPSX(SetGuestRID))
> +
> +
> +	/*
> +	 * This routine sets GuestCtl1.RID to GuestCtl1.ID
> +	 * Inputs: none
> +	 */
> +LEAF(MIPSX(SetGuestRIDtoGuestID))
> +	.set	push
> +	.set	mips32r2
> +	.set	noreorder
> +	mfc0	t0, CP0_GUESTCTL1		# Get current GuestID
> +	ext 	t1, t0, GUESTCTL1_ID_SHIFT, GUESTCTL1_ID_WIDTH
> +	ins 	t0, t1, GUESTCTL1_RID_SHIFT, GUESTCTL1_RID_WIDTH
> +	mtc0	t0, CP0_GUESTCTL1		# Set GuestCtl1.RID = GuestCtl1.ID
> +	ehb
> +	j	ra
> +	nop 					# BD Slot

    ... and here.

> +	.set	pop
> +END(MIPSX(SetGuestRIDtoGuestID))

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/mips/kvm/kvm_vz_locore.S b/arch/mips/kvm/kvm_vz_locore.S
new file mode 100644
index 0000000..6d037d7
--- /dev/null
+++ b/arch/mips/kvm/kvm_vz_locore.S
@@ -0,0 +1,74 @@ 
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * KVM/MIPS: Assembler support for hardware virtualization extensions
+ *
+ * Copyright (C) 2012  MIPS Technologies, Inc.  All rights reserved.
+ * Authors: Yann Le Du <ledu@kymasys.com>
+ */
+
+#include <asm/asm.h>
+#include <asm/asmmacro.h>
+#include <asm/regdef.h>
+#include <asm/mipsregs.h>
+#include <asm/asm-offsets.h>
+#include <asm/mipsvzregs.h>
+
+#define MIPSX(name)	mips32_ ## name
+
+/* 
+ * This routine sets GuestCtl1.RID to GUESTCTL1_VZ_ROOT_GUESTID
+ * Inputs: none
+ */
+LEAF(MIPSX(ClearGuestRID))
+	.set	push
+	.set	mips32r2
+	.set	noreorder
+	mfc0	t0, CP0_GUESTCTL1
+	addiu	t1, zero, GUESTCTL1_VZ_ROOT_GUESTID
+	ins	t0, t1, GUESTCTL1_RID_SHIFT, GUESTCTL1_RID_WIDTH
+	mtc0	t0, CP0_GUESTCTL1 # Set GuestCtl1.RID = GUESTCTL1_VZ_ROOT_GUESTID
+	ehb
+	j	ra
+	nop					# BD Slot
+	.set    pop
+END(MIPSX(ClearGuestRID))
+
+
+/* 
+ * This routine sets GuestCtl1.RID to a new value
+ * Inputs: a0 = new GuestRID value (right aligned)
+ */
+LEAF(MIPSX(SetGuestRID))
+	.set	push
+	.set	mips32r2
+	.set	noreorder
+	mfc0	t0, CP0_GUESTCTL1
+	ins 	t0, a0, GUESTCTL1_RID_SHIFT, GUESTCTL1_RID_WIDTH
+	mtc0	t0, CP0_GUESTCTL1		# Set GuestCtl1.RID
+	ehb
+	j	ra
+	nop					# BD Slot
+	.set	pop
+END(MIPSX(SetGuestRID))
+
+
+	/*
+	 * This routine sets GuestCtl1.RID to GuestCtl1.ID
+	 * Inputs: none
+	 */
+LEAF(MIPSX(SetGuestRIDtoGuestID))
+	.set	push
+	.set	mips32r2
+	.set	noreorder
+	mfc0	t0, CP0_GUESTCTL1		# Get current GuestID
+	ext 	t1, t0, GUESTCTL1_ID_SHIFT, GUESTCTL1_ID_WIDTH
+	ins 	t0, t1, GUESTCTL1_RID_SHIFT, GUESTCTL1_RID_WIDTH
+	mtc0	t0, CP0_GUESTCTL1		# Set GuestCtl1.RID = GuestCtl1.ID
+	ehb
+	j	ra
+	nop 					# BD Slot
+	.set	pop
+END(MIPSX(SetGuestRIDtoGuestID))