|
|
9bac43 |
From 6c787760c9ce1b5101c29e43de38d8e1974be482 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Suraj Jitindar Singh <sursingh@redhat.com>
|
|
|
9bac43 |
Date: Tue, 13 Feb 2018 04:12:28 +0100
|
|
|
9bac43 |
Subject: [PATCH 11/15] target/ppc: introduce the PPC_BIT() macro
|
|
|
9bac43 |
MIME-Version: 1.0
|
|
|
9bac43 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9bac43 |
Content-Transfer-Encoding: 8bit
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Suraj Jitindar Singh <sursingh@redhat.com>
|
|
|
9bac43 |
Message-id: <1518495150-24134-8-git-send-email-sursingh@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78989
|
|
|
9bac43 |
O-Subject: [RHEL7.5 qemu-kvm-rhev PATCH 7/9] target/ppc: introduce the PPC_BIT() macro
|
|
|
9bac43 |
Bugzilla: 1532050
|
|
|
9bac43 |
RH-Acked-by: David Gibson <dgibson@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
From: Cédric Le Goater <clg@kaod.org>
|
|
|
9bac43 |
|
|
|
9bac43 |
and use them in a couple of obvious places. Other macros will be used
|
|
|
9bac43 |
in the model of the XIVE interrupt controller.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Cédric Le Goater <clg@kaod.org>
|
|
|
9bac43 |
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
9bac43 |
(cherry picked from commit 2a83f9976efa9a85e8ceb9d1035a68f25c321334)
|
|
|
9bac43 |
|
|
|
9bac43 |
Conflicts: none
|
|
|
9bac43 |
|
|
|
9bac43 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1532050
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Suraj Jitindar Singh <sursingh@redhat.com>
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
target/ppc/cpu.h | 105 +++++++++++++++++++++++++++++--------------------------
|
|
|
9bac43 |
1 file changed, 56 insertions(+), 49 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
|
|
|
9bac43 |
index 9b107e4..7453250 100644
|
|
|
9bac43 |
--- a/target/ppc/cpu.h
|
|
|
9bac43 |
+++ b/target/ppc/cpu.h
|
|
|
9bac43 |
@@ -87,6 +87,13 @@
|
|
|
9bac43 |
#define PPC_ELF_MACHINE EM_PPC
|
|
|
9bac43 |
#endif
|
|
|
9bac43 |
|
|
|
9bac43 |
+#define PPC_BIT(bit) (0x8000000000000000UL >> (bit))
|
|
|
9bac43 |
+#define PPC_BIT32(bit) (0x80000000UL >> (bit))
|
|
|
9bac43 |
+#define PPC_BIT8(bit) (0x80UL >> (bit))
|
|
|
9bac43 |
+#define PPC_BITMASK(bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
|
|
|
9bac43 |
+#define PPC_BITMASK32(bs, be) ((PPC_BIT32(bs) - PPC_BIT32(be)) | \
|
|
|
9bac43 |
+ PPC_BIT32(bs))
|
|
|
9bac43 |
+
|
|
|
9bac43 |
/*****************************************************************************/
|
|
|
9bac43 |
/* Exception vectors definitions */
|
|
|
9bac43 |
enum {
|
|
|
9bac43 |
@@ -371,10 +378,10 @@ struct ppc_slb_t {
|
|
|
9bac43 |
#define MSR_LE 0 /* Little-endian mode 1 hflags */
|
|
|
9bac43 |
|
|
|
9bac43 |
/* LPCR bits */
|
|
|
9bac43 |
-#define LPCR_VPM0 (1ull << (63 - 0))
|
|
|
9bac43 |
-#define LPCR_VPM1 (1ull << (63 - 1))
|
|
|
9bac43 |
-#define LPCR_ISL (1ull << (63 - 2))
|
|
|
9bac43 |
-#define LPCR_KBV (1ull << (63 - 3))
|
|
|
9bac43 |
+#define LPCR_VPM0 PPC_BIT(0)
|
|
|
9bac43 |
+#define LPCR_VPM1 PPC_BIT(1)
|
|
|
9bac43 |
+#define LPCR_ISL PPC_BIT(2)
|
|
|
9bac43 |
+#define LPCR_KBV PPC_BIT(3)
|
|
|
9bac43 |
#define LPCR_DPFD_SHIFT (63 - 11)
|
|
|
9bac43 |
#define LPCR_DPFD (0x7ull << LPCR_DPFD_SHIFT)
|
|
|
9bac43 |
#define LPCR_VRMASD_SHIFT (63 - 16)
|
|
|
9bac43 |
@@ -382,41 +389,41 @@ struct ppc_slb_t {
|
|
|
9bac43 |
/* P9: Power-saving mode Exit Cause Enable (Upper Section) Mask */
|
|
|
9bac43 |
#define LPCR_PECE_U_SHIFT (63 - 19)
|
|
|
9bac43 |
#define LPCR_PECE_U_MASK (0x7ull << LPCR_PECE_U_SHIFT)
|
|
|
9bac43 |
-#define LPCR_HVEE (1ull << (63 - 17)) /* Hypervisor Virt Exit Enable */
|
|
|
9bac43 |
+#define LPCR_HVEE PPC_BIT(17) /* Hypervisor Virt Exit Enable */
|
|
|
9bac43 |
#define LPCR_RMLS_SHIFT (63 - 37)
|
|
|
9bac43 |
#define LPCR_RMLS (0xfull << LPCR_RMLS_SHIFT)
|
|
|
9bac43 |
-#define LPCR_ILE (1ull << (63 - 38))
|
|
|
9bac43 |
+#define LPCR_ILE PPC_BIT(38)
|
|
|
9bac43 |
#define LPCR_AIL_SHIFT (63 - 40) /* Alternate interrupt location */
|
|
|
9bac43 |
#define LPCR_AIL (3ull << LPCR_AIL_SHIFT)
|
|
|
9bac43 |
-#define LPCR_UPRT (1ull << (63 - 41)) /* Use Process Table */
|
|
|
9bac43 |
-#define LPCR_EVIRT (1ull << (63 - 42)) /* Enhanced Virtualisation */
|
|
|
9bac43 |
-#define LPCR_ONL (1ull << (63 - 45))
|
|
|
9bac43 |
-#define LPCR_LD (1ull << (63 - 46)) /* Large Decrementer */
|
|
|
9bac43 |
-#define LPCR_P7_PECE0 (1ull << (63 - 49))
|
|
|
9bac43 |
-#define LPCR_P7_PECE1 (1ull << (63 - 50))
|
|
|
9bac43 |
-#define LPCR_P7_PECE2 (1ull << (63 - 51))
|
|
|
9bac43 |
-#define LPCR_P8_PECE0 (1ull << (63 - 47))
|
|
|
9bac43 |
-#define LPCR_P8_PECE1 (1ull << (63 - 48))
|
|
|
9bac43 |
-#define LPCR_P8_PECE2 (1ull << (63 - 49))
|
|
|
9bac43 |
-#define LPCR_P8_PECE3 (1ull << (63 - 50))
|
|
|
9bac43 |
-#define LPCR_P8_PECE4 (1ull << (63 - 51))
|
|
|
9bac43 |
+#define LPCR_UPRT PPC_BIT(41) /* Use Process Table */
|
|
|
9bac43 |
+#define LPCR_EVIRT PPC_BIT(42) /* Enhanced Virtualisation */
|
|
|
9bac43 |
+#define LPCR_ONL PPC_BIT(45)
|
|
|
9bac43 |
+#define LPCR_LD PPC_BIT(46) /* Large Decrementer */
|
|
|
9bac43 |
+#define LPCR_P7_PECE0 PPC_BIT(49)
|
|
|
9bac43 |
+#define LPCR_P7_PECE1 PPC_BIT(50)
|
|
|
9bac43 |
+#define LPCR_P7_PECE2 PPC_BIT(51)
|
|
|
9bac43 |
+#define LPCR_P8_PECE0 PPC_BIT(47)
|
|
|
9bac43 |
+#define LPCR_P8_PECE1 PPC_BIT(48)
|
|
|
9bac43 |
+#define LPCR_P8_PECE2 PPC_BIT(49)
|
|
|
9bac43 |
+#define LPCR_P8_PECE3 PPC_BIT(50)
|
|
|
9bac43 |
+#define LPCR_P8_PECE4 PPC_BIT(51)
|
|
|
9bac43 |
/* P9: Power-saving mode Exit Cause Enable (Lower Section) Mask */
|
|
|
9bac43 |
#define LPCR_PECE_L_SHIFT (63 - 51)
|
|
|
9bac43 |
#define LPCR_PECE_L_MASK (0x1full << LPCR_PECE_L_SHIFT)
|
|
|
9bac43 |
-#define LPCR_PDEE (1ull << (63 - 47)) /* Privileged Doorbell Exit EN */
|
|
|
9bac43 |
-#define LPCR_HDEE (1ull << (63 - 48)) /* Hyperv Doorbell Exit Enable */
|
|
|
9bac43 |
-#define LPCR_EEE (1ull << (63 - 49)) /* External Exit Enable */
|
|
|
9bac43 |
-#define LPCR_DEE (1ull << (63 - 50)) /* Decrementer Exit Enable */
|
|
|
9bac43 |
-#define LPCR_OEE (1ull << (63 - 51)) /* Other Exit Enable */
|
|
|
9bac43 |
-#define LPCR_MER (1ull << (63 - 52))
|
|
|
9bac43 |
-#define LPCR_GTSE (1ull << (63 - 53)) /* Guest Translation Shootdown */
|
|
|
9bac43 |
-#define LPCR_TC (1ull << (63 - 54))
|
|
|
9bac43 |
-#define LPCR_HEIC (1ull << (63 - 59)) /* HV Extern Interrupt Control */
|
|
|
9bac43 |
-#define LPCR_LPES0 (1ull << (63 - 60))
|
|
|
9bac43 |
-#define LPCR_LPES1 (1ull << (63 - 61))
|
|
|
9bac43 |
-#define LPCR_RMI (1ull << (63 - 62))
|
|
|
9bac43 |
-#define LPCR_HVICE (1ull << (63 - 62)) /* HV Virtualisation Int Enable */
|
|
|
9bac43 |
-#define LPCR_HDICE (1ull << (63 - 63))
|
|
|
9bac43 |
+#define LPCR_PDEE PPC_BIT(47) /* Privileged Doorbell Exit EN */
|
|
|
9bac43 |
+#define LPCR_HDEE PPC_BIT(48) /* Hyperv Doorbell Exit Enable */
|
|
|
9bac43 |
+#define LPCR_EEE PPC_BIT(49) /* External Exit Enable */
|
|
|
9bac43 |
+#define LPCR_DEE PPC_BIT(50) /* Decrementer Exit Enable */
|
|
|
9bac43 |
+#define LPCR_OEE PPC_BIT(51) /* Other Exit Enable */
|
|
|
9bac43 |
+#define LPCR_MER PPC_BIT(52)
|
|
|
9bac43 |
+#define LPCR_GTSE PPC_BIT(53) /* Guest Translation Shootdown */
|
|
|
9bac43 |
+#define LPCR_TC PPC_BIT(54)
|
|
|
9bac43 |
+#define LPCR_HEIC PPC_BIT(59) /* HV Extern Interrupt Control */
|
|
|
9bac43 |
+#define LPCR_LPES0 PPC_BIT(60)
|
|
|
9bac43 |
+#define LPCR_LPES1 PPC_BIT(61)
|
|
|
9bac43 |
+#define LPCR_RMI PPC_BIT(62)
|
|
|
9bac43 |
+#define LPCR_HVICE PPC_BIT(62) /* HV Virtualisation Int Enable */
|
|
|
9bac43 |
+#define LPCR_HDICE PPC_BIT(63)
|
|
|
9bac43 |
|
|
|
9bac43 |
#define msr_sf ((env->msr >> MSR_SF) & 1)
|
|
|
9bac43 |
#define msr_isf ((env->msr >> MSR_ISF) & 1)
|
|
|
9bac43 |
@@ -507,22 +514,22 @@ struct ppc_slb_t {
|
|
|
9bac43 |
#define FSCR_IC_TAR 8
|
|
|
9bac43 |
|
|
|
9bac43 |
/* Exception state register bits definition */
|
|
|
9bac43 |
-#define ESR_PIL (1 << (63 - 36)) /* Illegal Instruction */
|
|
|
9bac43 |
-#define ESR_PPR (1 << (63 - 37)) /* Privileged Instruction */
|
|
|
9bac43 |
-#define ESR_PTR (1 << (63 - 38)) /* Trap */
|
|
|
9bac43 |
-#define ESR_FP (1 << (63 - 39)) /* Floating-Point Operation */
|
|
|
9bac43 |
-#define ESR_ST (1 << (63 - 40)) /* Store Operation */
|
|
|
9bac43 |
-#define ESR_AP (1 << (63 - 44)) /* Auxiliary Processor Operation */
|
|
|
9bac43 |
-#define ESR_PUO (1 << (63 - 45)) /* Unimplemented Operation */
|
|
|
9bac43 |
-#define ESR_BO (1 << (63 - 46)) /* Byte Ordering */
|
|
|
9bac43 |
-#define ESR_PIE (1 << (63 - 47)) /* Imprecise exception */
|
|
|
9bac43 |
-#define ESR_DATA (1 << (63 - 53)) /* Data Access (Embedded page table) */
|
|
|
9bac43 |
-#define ESR_TLBI (1 << (63 - 54)) /* TLB Ineligible (Embedded page table) */
|
|
|
9bac43 |
-#define ESR_PT (1 << (63 - 55)) /* Page Table (Embedded page table) */
|
|
|
9bac43 |
-#define ESR_SPV (1 << (63 - 56)) /* SPE/VMX operation */
|
|
|
9bac43 |
-#define ESR_EPID (1 << (63 - 57)) /* External Process ID operation */
|
|
|
9bac43 |
-#define ESR_VLEMI (1 << (63 - 58)) /* VLE operation */
|
|
|
9bac43 |
-#define ESR_MIF (1 << (63 - 62)) /* Misaligned instruction (VLE) */
|
|
|
9bac43 |
+#define ESR_PIL PPC_BIT(36) /* Illegal Instruction */
|
|
|
9bac43 |
+#define ESR_PPR PPC_BIT(37) /* Privileged Instruction */
|
|
|
9bac43 |
+#define ESR_PTR PPC_BIT(38) /* Trap */
|
|
|
9bac43 |
+#define ESR_FP PPC_BIT(39) /* Floating-Point Operation */
|
|
|
9bac43 |
+#define ESR_ST PPC_BIT(40) /* Store Operation */
|
|
|
9bac43 |
+#define ESR_AP PPC_BIT(44) /* Auxiliary Processor Operation */
|
|
|
9bac43 |
+#define ESR_PUO PPC_BIT(45) /* Unimplemented Operation */
|
|
|
9bac43 |
+#define ESR_BO PPC_BIT(46) /* Byte Ordering */
|
|
|
9bac43 |
+#define ESR_PIE PPC_BIT(47) /* Imprecise exception */
|
|
|
9bac43 |
+#define ESR_DATA PPC_BIT(53) /* Data Access (Embedded page table) */
|
|
|
9bac43 |
+#define ESR_TLBI PPC_BIT(54) /* TLB Ineligible (Embedded page table) */
|
|
|
9bac43 |
+#define ESR_PT PPC_BIT(55) /* Page Table (Embedded page table) */
|
|
|
9bac43 |
+#define ESR_SPV PPC_BIT(56) /* SPE/VMX operation */
|
|
|
9bac43 |
+#define ESR_EPID PPC_BIT(57) /* External Process ID operation */
|
|
|
9bac43 |
+#define ESR_VLEMI PPC_BIT(58) /* VLE operation */
|
|
|
9bac43 |
+#define ESR_MIF PPC_BIT(62) /* Misaligned instruction (VLE) */
|
|
|
9bac43 |
|
|
|
9bac43 |
/* Transaction EXception And Summary Register bits */
|
|
|
9bac43 |
#define TEXASR_FAILURE_PERSISTENT (63 - 7)
|
|
|
9bac43 |
@@ -1990,7 +1997,7 @@ void ppc_compat_add_property(Object *obj, const char *name,
|
|
|
9bac43 |
#define HID0_DEEPNAP (1 << 24) /* pre-2.06 */
|
|
|
9bac43 |
#define HID0_DOZE (1 << 23) /* pre-2.06 */
|
|
|
9bac43 |
#define HID0_NAP (1 << 22) /* pre-2.06 */
|
|
|
9bac43 |
-#define HID0_HILE (1ull << (63 - 19)) /* POWER8 */
|
|
|
9bac43 |
+#define HID0_HILE PPC_BIT(19) /* POWER8 */
|
|
|
9bac43 |
|
|
|
9bac43 |
/*****************************************************************************/
|
|
|
9bac43 |
/* PowerPC Instructions types definitions */
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|