From patchwork Thu Jul 13 07:03:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 787536 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3x7RcN4rQyz9s74 for ; Thu, 13 Jul 2017 17:03:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750854AbdGMHDb (ORCPT ); Thu, 13 Jul 2017 03:03:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34864 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbdGMHDa (ORCPT ); Thu, 13 Jul 2017 03:03:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D14137CE0C; Thu, 13 Jul 2017 07:03:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D14137CE0C Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D14137CE0C Received: from thh440s.str.redhat.com (dhcp-200-180.str.redhat.com [10.33.200.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1BAB600CD; Thu, 13 Jul 2017 07:03:27 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Laurent Vivier Cc: kvm-ppc@vger.kernel.org, =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [kvm-unit-tests PATCH] powerpc/sprs: Test POWER9 specific registers Date: Thu, 13 Jul 2017 09:03:27 +0200 Message-Id: <1499929407-29601-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 13 Jul 2017 07:03:29 +0000 (UTC) Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org 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 --- 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; } }