Kernel KVM-PPC virtualization development
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org, Laurent Vivier <lvivier@redhat.com>
Cc: kvm-ppc@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>
Subject: [kvm-unit-tests PATCH] powerpc/sprs: Test POWER9 specific registers
Date: Thu, 13 Jul 2017 07:03:27 +0000	[thread overview]
Message-ID: <1499929407-29601-1-git-send-email-thuth@redhat.com> (raw)

Most of the SPRS are the same as on POWER8, so we can re-use
the PowerISA 2.07 functions and simply amend the additional
registers afterwards.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 powerpc/sprs.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/powerpc/sprs.c b/powerpc/sprs.c
index 39644fa..73de2b6 100644
--- a/powerpc/sprs.c
+++ b/powerpc/sprs.c
@@ -126,6 +126,17 @@ static void set_sprs_book3s_207(uint64_t val)
 	mtspr(815, val);	/* TAR */
 }
 
+/* SPRs from PowerISA 3.00 Book III */
+static void set_sprs_book3s_300(uint64_t val)
+{
+	set_sprs_book3s_207(val);
+	mtspr(48, val);		/* PIDR */
+	mtspr(158, val);	/* GSR */
+	mtspr(813, val);	/* LMRR */
+	mtspr(814, val);	/* LMSER */
+	mtspr(823, val);	/* PSSCR */
+}
+
 static void set_sprs(uint64_t val)
 {
 	uint32_t pvr = mfspr(287);	/* Processor Version Register */
@@ -143,6 +154,9 @@ static void set_sprs(uint64_t val)
 	case 0x4d:			/* POWER8 */
 		set_sprs_book3s_207(val);
 		break;
+	case 0x4e:			/* POWER9 */
+		set_sprs_book3s_300(val);
+		break;
 	default:
 		puts("Warning: Unknown processor version!\n");
 	}
@@ -218,6 +232,16 @@ static void get_sprs_book3s_207(uint64_t *v)
 	v[815] = mfspr(815);	/* TAR */
 }
 
+static void get_sprs_book3s_300(uint64_t *v)
+{
+	get_sprs_book3s_207(v);
+	v[48] = mfspr(48);	/* PIDR */
+	v[158] = mfspr(158);	/* GSR */
+	v[813] = mfspr(813);	/* LMRR */
+	v[814] = mfspr(814);	/* LMSER */
+	v[823] = mfspr(823);	/* PSSCR */
+}
+
 static void get_sprs(uint64_t *v)
 {
 	uint32_t pvr = mfspr(287);	/* Processor Version Register */
@@ -235,6 +259,9 @@ static void get_sprs(uint64_t *v)
 	case 0x4d:			/* POWER8 */
 		get_sprs_book3s_207(v);
 		break;
+	case 0x4e:			/* POWER9 */
+		get_sprs_book3s_300(v);
+		break;
 	}
 }
 
-- 
1.8.3.1


             reply	other threads:[~2017-07-13  7:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13  7:03 Thomas Huth [this message]
2017-07-21 11:17 ` [kvm-unit-tests PATCH] powerpc/sprs: Test POWER9 specific registers Laurent Vivier
2017-07-21 11:32   ` Thomas Huth

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=1499929407-29601-1-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=rkrcmar@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox