qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Tom Musta <tommusta@gmail.com>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	Anton Blanchard <anton@samba.org>,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PULL 04/32] Add MSR VSX and Associated Exception
Date: Fri, 20 Dec 2013 02:00:26 +0100	[thread overview]
Message-ID: <1387501254-60704-5-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1387501254-60704-1-git-send-email-agraf@suse.de>

From: Tom Musta <tommusta@gmail.com>

This patch adds support for the VSX bit of the PowerPC Machine
State Register (MSR) as well as the corresponding VSX Unavailable
exception.

The VSX bit is added to the defined bits masks of the Power7 and
Power8 CPU models.

Signed-off-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/cpu.h            | 4 ++++
 target-ppc/excp_helper.c    | 5 +++++
 target-ppc/translate.c      | 6 ++++++
 target-ppc/translate_init.c | 5 +++--
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 826172b..bb84767 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -236,6 +236,8 @@ enum {
     POWERPC_EXCP_NMEXTBR  = 91, /* Non maskable external breakpoint          */
     POWERPC_EXCP_ITLBE    = 92, /* Instruction TLB error                     */
     POWERPC_EXCP_DTLBE    = 93, /* Data TLB error                            */
+    /* VSX Unavailable (Power ISA 2.06 and later)                            */
+    POWERPC_EXCP_VSXU     = 94, /* VSX Unavailable                           */
     /* EOL                                                                   */
     POWERPC_EXCP_NB       = 96,
     /* QEMU exceptions: used internally during code translation              */
@@ -427,6 +429,7 @@ struct ppc_slb_t {
 #define MSR_VR   25 /* altivec available                            x hflags */
 #define MSR_SPE  25 /* SPE enable for BookE                         x hflags */
 #define MSR_AP   23 /* Access privilege state on 602                  hflags */
+#define MSR_VSX  23 /* Vector Scalar Extension (ISA 2.06 and later) x hflags */
 #define MSR_SA   22 /* Supervisor access mode on 602                  hflags */
 #define MSR_KEY  19 /* key bit on 603e                                       */
 #define MSR_POW  18 /* Power management                                      */
@@ -467,6 +470,7 @@ struct ppc_slb_t {
 #define msr_vr   ((env->msr >> MSR_VR)   & 1)
 #define msr_spe  ((env->msr >> MSR_SPE)  & 1)
 #define msr_ap   ((env->msr >> MSR_AP)   & 1)
+#define msr_vsx  ((env->msr >> MSR_VSX)  & 1)
 #define msr_sa   ((env->msr >> MSR_SA)   & 1)
 #define msr_key  ((env->msr >> MSR_KEY)  & 1)
 #define msr_pow  ((env->msr >> MSR_POW)  & 1)
diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
index c959460..26c57d9 100644
--- a/target-ppc/excp_helper.c
+++ b/target-ppc/excp_helper.c
@@ -390,6 +390,11 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
             new_msr |= (target_ulong)MSR_HVB;
         }
         goto store_current;
+    case POWERPC_EXCP_VSXU:       /* VSX unavailable exception               */
+        if (lpes1 == 0) {
+            new_msr |= (target_ulong)MSR_HVB;
+        }
+        goto store_current;
     case POWERPC_EXCP_PIT:       /* Programmable interval timer interrupt    */
         LOG_EXCP("PIT exception\n");
         goto store_next;
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 66c7771..415f5d1 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -195,6 +195,7 @@ typedef struct DisasContext {
 #endif
     int fpu_enabled;
     int altivec_enabled;
+    int vsx_enabled;
     int spe_enabled;
     ppc_spr_t *spr_cb; /* Needed to check rights for mfspr/mtspr */
     int singlestep_enabled;
@@ -9759,6 +9760,11 @@ static inline void gen_intermediate_code_internal(PowerPCCPU *cpu,
         ctx.altivec_enabled = msr_vr;
     else
         ctx.altivec_enabled = 0;
+    if ((env->flags & POWERPC_FLAG_VSX) && msr_vsx) {
+        ctx.vsx_enabled = msr_vsx;
+    } else {
+        ctx.vsx_enabled = 0;
+    }
     if ((env->flags & POWERPC_FLAG_SE) && msr_se)
         ctx.singlestep_enabled = CPU_SINGLE_STEP;
     else
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index e224815..35d1389 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -3061,6 +3061,7 @@ static void init_excp_POWER7 (CPUPPCState *env)
     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
+    env->excp_vectors[POWERPC_EXCP_VSXU]     = 0x00000F40;
     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
     env->excp_vectors[POWERPC_EXCP_MAINT]    = 0x00001600;
     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001700;
@@ -7236,7 +7237,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)
                        PPC_SEGMENT_64B | PPC_SLBI |
                        PPC_POPCNTB | PPC_POPCNTWD;
     pcc->insns_flags2 = PPC2_VSX | PPC2_DFP | PPC2_DBRX | PPC2_ISA205;
-    pcc->msr_mask = 0x800000000204FF37ULL;
+    pcc->msr_mask = 0x800000000284FF37ULL;
     pcc->mmu_model = POWERPC_MMU_2_06;
 #if defined(CONFIG_SOFTMMU)
     pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
@@ -7274,7 +7275,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)
                        PPC_SEGMENT_64B | PPC_SLBI |
                        PPC_POPCNTB | PPC_POPCNTWD;
     pcc->insns_flags2 = PPC2_VSX | PPC2_DFP | PPC2_DBRX;
-    pcc->msr_mask = 0x800000000204FF36ULL;
+    pcc->msr_mask = 0x800000000284FF36ULL;
     pcc->mmu_model = POWERPC_MMU_2_06;
 #if defined(CONFIG_SOFTMMU)
     pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
-- 
1.8.1.4

  parent reply	other threads:[~2013-12-20  1:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20  1:00 [Qemu-devel] [PULL 00/32] ppc patch queue 2013-12-20 Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 01/32] target-ppc: add stubs for KVM breakpoints Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 02/32] powerpc: add PVR mask support Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 03/32] Declare and Enable VSX Alexander Graf
2013-12-20  1:00 ` Alexander Graf [this message]
2013-12-20  1:00 ` [Qemu-devel] [PULL 05/32] Add VSX Instruction Decoders Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 06/32] Add VSR to Global Registers Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 07/32] Add lxvd2x Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 08/32] Add stxvd2x Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 09/32] Add xxpermdi Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 10/32] Add lxsdx Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 11/32] Add lxvdsx Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 12/32] Add lxvw4x Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 13/32] Add stxsdx Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 14/32] Add stxvw4x Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 15/32] target-ppc: move POWER7+ to a separate family Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 16/32] spapr-rtas: replace return code constants with macros Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 17/32] spapr-rtas: add ibm, (get|set)-system-parameter Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 18/32] PPC: Use default pci bus name for grackle and heathrow Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 19/32] spapr: tie spapr-nvram to -pflash Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 20/32] roms: Flush icache when writing roms to guest memory Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 21/32] Add VSX Scalar Move Instructions Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 22/32] Add VSX Vector " Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 23/32] Add Power7 VSX Logical Instructions Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 24/32] Add xxmrgh/xxmrgl Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 25/32] Add xxsel Alexander Graf
2013-12-20  6:54   ` Stefan Weil
2013-12-20  9:26     ` Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 26/32] Add xxspltw Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 27/32] Add xxsldwi Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 28/32] PPC: Add VSX to hflags Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 29/32] device_tree: s/qemu_devtree/qemu_fdt globally Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 30/32] device_tree: qemu_fdt_setprop: Rename val_array arg Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 31/32] spapr: make sure RMA is in first mode of first memory node Alexander Graf
2013-12-20  1:00 ` [Qemu-devel] [PULL 32/32] spapr: limit numa memory regions by ram size Alexander Graf
2013-12-23 18:08 ` [Qemu-devel] [PULL 00/32] ppc patch queue 2013-12-20 Andreas Färber
2013-12-23 18:10   ` Alexander Graf
2013-12-24 15:19     ` Tom Musta

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=1387501254-60704-5-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=anton@samba.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=tommusta@gmail.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;
as well as URLs for NNTP newsgroup(s).