All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Cc: kvm-ppc-devel
	<kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: [PATCH 3/3] Add powerpc tests
Date: Thu, 18 Oct 2007 15:11:00 -0500	[thread overview]
Message-ID: <1192738260.12849.28.camel@thinkpad> (raw)

This patch contains a small set of simple tests for testing guest
functionality for powerpc.
	

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/user/test/powerpc/io.S b/user/test/powerpc/io.S
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/io.S
@@ -0,0 +1,32 @@
+#define SPRN_MMUCR 0x3b2
+
+#define TLBWORD0 0xf0000210
+#define TLBWORD1 0xf0000000
+#define TLBWORD2 0x00000003
+
+.global _start
+_start:
+	li	r4, 0
+	mtspr	SPRN_MMUCR, r4
+
+	li	r3, 2
+
+	lis	r4, TLBWORD0@h
+	ori	r4, r4, TLBWORD0@l
+	tlbwe	r4, r3, 0
+
+	lis	r4, TLBWORD1@h
+	ori	r4, r4, TLBWORD1@l
+	tlbwe	r4, r3, 1
+
+	lis	r4, TLBWORD2@h
+	ori	r4, r4, TLBWORD2@l
+	tlbwe	r4, r3, 2
+
+	lis	r3, 0xf000
+	lis	r4, 0x1234
+	ori	r4, r4, 0x5678
+	stb	r4, 0(r3)
+	lbz	r5, 0(r3)
+
+	b	.
diff --git a/user/test/powerpc/spin.S b/user/test/powerpc/spin.S
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/spin.S
@@ -0,0 +1,4 @@
+
+.global _start
+_start:
+	b	.
diff --git a/user/test/powerpc/sprg.S b/user/test/powerpc/sprg.S
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/sprg.S
@@ -0,0 +1,7 @@
+
+.global _start
+_start:
+	li	r3, 42
+	mtsprg	0, r3
+	mfsprg	r4, 0
+	b	.
diff --git a/user/test/powerpc/tlbsx.S b/user/test/powerpc/tlbsx.S
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/tlbsx.S
@@ -0,0 +1,33 @@
+#define SPRN_MMUCR 0x3b2
+
+#define TLBWORD0 0x10000210
+#define TLBWORD1 0x10000000
+#define TLBWORD2 0x00000003
+
+.global _start
+_start:
+	li	r4, 0
+	mtspr	SPRN_MMUCR, r4
+
+	li	r3, 23
+
+	lis	r4, TLBWORD0@h
+	ori	r4, r4, TLBWORD0@l
+	tlbwe	r4, r3, 0
+
+	lis	r4, TLBWORD1@h
+	ori	r4, r4, TLBWORD1@l
+	tlbwe	r4, r3, 1
+
+	lis	r4, TLBWORD2@h
+	ori	r4, r4, TLBWORD2@l
+	tlbwe	r4, r3, 2
+
+	lis	r4, 0x1000
+	tlbsx	r5, r4, r0
+	cmpwi	r5, 23
+	beq	good
+	trap
+
+good:
+	b	.
diff --git a/user/test/powerpc/tlbwe.S b/user/test/powerpc/tlbwe.S
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/tlbwe.S
@@ -0,0 +1,27 @@
+#define SPRN_MMUCR 0x3b2
+
+/* Create a mapping at 4MB */
+#define TLBWORD0 0x00400210
+#define TLBWORD1 0x00400000
+#define TLBWORD2 0x00000003
+
+.global _start
+_start:
+	li	r4, 0
+	mtspr	SPRN_MMUCR, r4
+
+	li	r3, 23
+
+	lis	r4, TLBWORD0@h
+	ori	r4, r4, TLBWORD0@l
+	tlbwe	r4, r3, 0
+
+	lis	r4, TLBWORD1@h
+	ori	r4, r4, TLBWORD1@l
+	tlbwe	r4, r3, 1
+
+	lis	r4, TLBWORD2@h
+	ori	r4, r4, TLBWORD2@l
+	tlbwe	r4, r3, 2
+
+	b	.
diff --git a/user/test/powerpc/tlbwe_16KB.S b/user/test/powerpc/tlbwe_16KB.S
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/tlbwe_16KB.S
@@ -0,0 +1,35 @@
+#define SPRN_MMUCR 0x3b2
+
+/* 16KB mapping at 4MB */
+#define TLBWORD0 0x00400220
+#define TLBWORD1 0x00400000
+#define TLBWORD2 0x00000003
+
+.global _start
+_start:
+	li	r4, 0
+	mtspr	SPRN_MMUCR, r4
+
+	li	r3, 5
+
+	lis	r4, TLBWORD0@h
+	ori	r4, r4, TLBWORD0@l
+	tlbwe	r4, r3, 0
+
+	lis	r4, TLBWORD1@h
+	ori	r4, r4, TLBWORD1@l
+	tlbwe	r4, r3, 1
+
+	lis	r4, TLBWORD2@h
+	ori	r4, r4, TLBWORD2@l
+	tlbwe	r4, r3, 2
+
+	/* load from 4MB */
+	lis	r3, 0x0040
+	lwz	r4, 0(r3)
+
+	/* load from 4MB+8KB */
+	ori	r3, r3, 0x2000
+	lwz	r4, 0(r3)
+
+	b	.
diff --git a/user/test/powerpc/tlbwe_hole.S b/user/test/powerpc/tlbwe_hole.S
new file mode 100644
--- /dev/null
+++ b/user/test/powerpc/tlbwe_hole.S
@@ -0,0 +1,27 @@
+#define SPRN_MMUCR 0x3b2
+
+/* Try to map real address 1GB. */
+#define TLBWORD0 0x40000210
+#define TLBWORD1 0x40000000
+#define TLBWORD2 0x00000003
+
+.global _start
+_start:
+	li	r4, 0
+	mtspr	SPRN_MMUCR, r4
+
+	li	r3, 23
+
+	lis	r4, TLBWORD0@h
+	ori	r4, r4, TLBWORD0@l
+	tlbwe	r4, r3, 0
+
+	lis	r4, TLBWORD1@h
+	ori	r4, r4, TLBWORD1@l
+	tlbwe	r4, r3, 1
+
+	lis	r4, TLBWORD2@h
+	ori	r4, r4, TLBWORD2@l
+	tlbwe	r4, r3, 2
+
+	b	.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

             reply	other threads:[~2007-10-18 20:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-18 20:11 Jerone Young [this message]
2007-10-18 21:35 ` [kvm-ppc-devel] [PATCH 3/3] Add powerpc tests Kumar Gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1192738260.12849.28.camel@thinkpad \
    --to=jyoung5-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.