Lines Matching +full:- +full:- +full:disable +full:- +full:attr
4 * Copyright (c) 2003-2007 Jocelyn Mayer
24 #include "qemu/cpu-float.h"
25 #include "exec/cpu-common.h"
26 #include "exec/cpu-defs.h"
27 #include "exec/cpu-interrupt.h"
28 #include "cpu-qom.h"
43 #define PPC_BIT_NR(bit) (63 - (bit))
45 #define PPC_BIT32_NR(bit) (31 - (bit))
48 #define PPC_BITMASK(bs, be) ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
49 #define PPC_BITMASK32(bs, be) ((PPC_BIT32(bs) - PPC_BIT32(be)) | \
51 #define PPC_BITMASK8(bs, be) ((PPC_BIT8(bs) - PPC_BIT8(be)) | PPC_BIT8(bs))
60 #define MASK_TO_LSH(m) (__builtin_ffsll(m) - 1)
68 POWERPC_EXCP_NONE = -1,
77 POWERPC_EXCP_FPU = 7, /* Floating-point unavailable exception */
81 POWERPC_EXCP_FIT = 11, /* Fixed-interval timer interrupt */
87 POWERPC_EXCP_SPEU = 32, /* SPE/embedded floating-point unavailable */
88 POWERPC_EXCP_EFPDI = 33, /* Embedded floating-point data interrupt */
89 POWERPC_EXCP_EFPRI = 34, /* Embedded floating-point round interrupt */
110 /* Vectors 75-76 are 601 specific exceptions */
118 POWERPC_EXCP_FPA = 81, /* Floating-point assist exception */
161 POWERPC_EXCP_ALIGN_LE = 0x03, /* Multiple little-endian access */
165 POWERPC_EXCP_ALIGN_INSN = 0x07, /* Pref. insn x-ing 64-byte boundary */
287 #define PPC_INPUT(env) ((env)->bus_model)
304 /* SPR access micro-ops generations callbacks */
371 uint32_t attr; /* Storage attributes */ member
405 #define SEGMENT_MASK_256M (~((1ULL << SEGMENT_SHIFT_256M) - 1))
408 #define SEGMENT_MASK_1T (~((1ULL << SEGMENT_SHIFT_1T) - 1))
427 #define MSR_SF PPC_BIT_NR(0) /* Sixty-four-bit mode hflags */
428 #define MSR_TAG PPC_BIT_NR(1) /* Tag-active mode (POWERx ?) */
429 #define MSR_ISF PPC_BIT_NR(2) /* Sixty-four-bit interrupt mode on 630 */
437 #define MSR_UCLE PPC_BIT_NR(37) /* User-mode cache lock enable for BookE */
447 #define MSR_ILE PPC_BIT_NR(47) /* Interrupt little-endian mode */
453 #define MSR_SE PPC_BIT_NR(53) /* Single-step trace enable x hflags */
469 #define MSR_LE PPC_BIT_NR(63) /* Little-endian mode 1 hflags */
522 * FE0 and FE1 bits are not side-by-side
537 #define MMCR0_FC14 PPC_BIT(58) /* PMC Freeze Counters 1-4 bit */
538 #define MMCR0_FC56 PPC_BIT(59) /* PMC Freeze Counters 5-6 bit */
556 #define MMCRA_BHRBRD PPC_BIT(26) /* BHRB Recording Disable */
563 #define MMCR1_PMC1EVT_EXTR (64 - MMCR1_PMC1SEL_START - MMCR1_EVT_SIZE)
565 #define MMCR1_PMC2EVT_EXTR (64 - MMCR1_PMC2SEL_START - MMCR1_EVT_SIZE)
567 #define MMCR1_PMC3EVT_EXTR (64 - MMCR1_PMC3SEL_START - MMCR1_EVT_SIZE)
569 #define MMCR1_PMC4EVT_EXTR (64 - MMCR1_PMC4SEL_START - MMCR1_EVT_SIZE)
577 /* External Event-based Exception Enable */
579 /* Performance Monitor Event-based Exception Enable */
581 /* External Event-based Exception Occurred */
583 /* Performance Monitor Event-based Exception Occurred */
592 #define LPCR_DPFD_SHIFT (63 - 11)
594 #define LPCR_VRMASD_SHIFT (63 - 16)
596 /* P9: Power-saving mode Exit Cause Enable (Upper Section) Mask */
597 #define LPCR_PECE_U_SHIFT (63 - 19)
600 #define LPCR_RMLS_SHIFT (63 - 37) /* RMLS (removed in ISA v3.0) */
604 #define LPCR_AIL_SHIFT (63 - 40) /* Alternate interrupt location */
619 /* P9: Power-saving mode Exit Cause Enable (Lower Section) Mask */
620 #define LPCR_PECE_L_SHIFT (63 - 51)
674 /* Not permitted due to no-execute or guard bit set */
690 #define SRR1_WAKESCOM 0x00080000 /* SCOM not in power-saving mode */
692 /* SRR1[46:47] power-saving exit mode */
701 #define FSCR_EBB (63 - 56) /* Event-Based Branch Facility */
702 #define FSCR_TAR (63 - 55) /* Target Address Register */
703 #define FSCR_SCV (63 - 51) /* System call vectored */
706 #define FSCR_IC_POS (63 - 7)
719 #define ESR_FP PPC_BIT(39) /* Floating-Point Operation */
734 #define TEXASR_FAILURE_PERSISTENT (63 - 7)
735 #define TEXASR_DISALLOWED (63 - 8)
736 #define TEXASR_NESTING_OVERFLOW (63 - 9)
737 #define TEXASR_FOOTPRINT_OVERFLOW (63 - 10)
738 #define TEXASR_SELF_INDUCED_CONFLICT (63 - 11)
739 #define TEXASR_NON_TRANSACTIONAL_CONFLICT (63 - 12)
740 #define TEXASR_TRANSACTION_CONFLICT (63 - 13)
741 #define TEXASR_TRANSLATION_INVALIDATION_CONFLICT (63 - 14)
742 #define TEXASR_IMPLEMENTATION_SPECIFIC (63 - 15)
743 #define TEXASR_INSTRUCTION_FETCH_CONFLICT (63 - 16)
744 #define TEXASR_ABORT (63 - 31)
745 #define TEXASR_SUSPENDED (63 - 32)
746 #define TEXASR_PRIVILEGE_HV (63 - 34)
747 #define TEXASR_PRIVILEGE_PR (63 - 35)
748 #define TEXASR_FAILURE_SUMMARY (63 - 36)
749 #define TEXASR_TFIAR_EXACT (63 - 37)
750 #define TEXASR_ROT (63 - 38)
751 #define TEXASR_TRANSACTION_LEVEL (63 - 52) /* 12 bits */
784 /* Using "LPAR per core" mode (as opposed to per-thread) */
791 * Bits for env->hflags.
806 HFLAGS_BE = 9, /* MSR_BE -- from elsewhere on embedded ppc */
807 HFLAGS_SE = 10, /* MSR_SE -- from elsewhere on embedded ppc */
813 HFLAGS_PMC_OTHER = 18, /* PMC other than PMC5-6 is enabled */
819 HFLAGS_IMMU_IDX = 26, /* 26..28 -- the composite immu_idx */
820 HFLAGS_DMMU_IDX = 29, /* 29..31 -- the composite dmmu_idx */
825 #define FPSCR_DRN2 PPC_BIT_NR(29) /* Decimal Floating-Point rounding ctrl. */
826 #define FPSCR_DRN1 PPC_BIT_NR(30) /* Decimal Floating-Point rounding ctrl. */
827 #define FPSCR_DRN0 PPC_BIT_NR(31) /* Decimal Floating-Point rounding ctrl. */
828 #define FPSCR_FX PPC_BIT_NR(32) /* Floating-point exception summary */
829 #define FPSCR_FEX PPC_BIT_NR(33) /* Floating-point enabled exception summ.*/
830 #define FPSCR_VX PPC_BIT_NR(34) /* Floating-point invalid op. excp. summ.*/
831 #define FPSCR_OX PPC_BIT_NR(35) /* Floating-point overflow exception */
832 #define FPSCR_UX PPC_BIT_NR(36) /* Floating-point underflow exception */
833 #define FPSCR_ZX PPC_BIT_NR(37) /* Floating-point zero divide exception */
834 #define FPSCR_XX PPC_BIT_NR(38) /* Floating-point inexact exception */
835 #define FPSCR_VXSNAN PPC_BIT_NR(39) /* Floating-point invalid op. excp (sNan)*/
836 #define FPSCR_VXISI PPC_BIT_NR(40) /* Floating-point invalid op. excp (inf) */
837 #define FPSCR_VXIDI PPC_BIT_NR(41) /* Floating-point invalid op. excp (inf) */
838 #define FPSCR_VXZDZ PPC_BIT_NR(42) /* Floating-point invalid op. excp (zero)*/
839 #define FPSCR_VXIMZ PPC_BIT_NR(43) /* Floating-point invalid op. excp (inf) */
840 #define FPSCR_VXVC PPC_BIT_NR(44) /* Floating-point invalid op. excp (comp)*/
841 #define FPSCR_FR PPC_BIT_NR(45) /* Floating-point fraction rounded */
842 #define FPSCR_FI PPC_BIT_NR(46) /* Floating-point fraction inexact */
843 #define FPSCR_C PPC_BIT_NR(47) /* Floating-point result class descriptor*/
844 #define FPSCR_FL PPC_BIT_NR(48) /* Floating-point less than or negative */
845 #define FPSCR_FG PPC_BIT_NR(49) /* Floating-point greater than or neg. */
846 #define FPSCR_FE PPC_BIT_NR(50) /* Floating-point equal or zero */
847 #define FPSCR_FU PPC_BIT_NR(51) /* Floating-point unordered or NaN */
848 #define FPSCR_FPCC PPC_BIT_NR(51) /* Floating-point condition code */
849 #define FPSCR_FPRF PPC_BIT_NR(51) /* Floating-point result flags */
850 #define FPSCR_VXSOFT PPC_BIT_NR(53) /* Floating-point invalid op. excp (soft)*/
851 #define FPSCR_VXSQRT PPC_BIT_NR(54) /* Floating-point invalid op. excp (sqrt)*/
852 #define FPSCR_VXCVI PPC_BIT_NR(55) /* Floating-point invalid op. excp (int) */
853 #define FPSCR_VE PPC_BIT_NR(56) /* Floating-point invalid op. excp enable*/
854 #define FPSCR_OE PPC_BIT_NR(57) /* Floating-point overflow excp. enable */
855 #define FPSCR_UE PPC_BIT_NR(58) /* Floating-point underflow excp. enable */
856 #define FPSCR_ZE PPC_BIT_NR(59) /* Floating-point zero divide excp enable*/
857 #define FPSCR_XE PPC_BIT_NR(60) /* Floating-point inexact excp. enable */
858 #define FPSCR_NI PPC_BIT_NR(61) /* Floating-point non-IEEE mode */
860 #define FPSCR_RN0 PPC_BIT_NR(63) /* Floating-point rounding control */
912 /* the exception bits which can be cleared by mcrfs - includes FX */
924 #define VSCR_NJ 16 /* Vector non-java */
1248 /* used to speed-up TLB assist handlers */
1273 int tlb_per_way; /* Speed-up helper: used to avoid divisions at run time */
1280 bool tlb_dirty; /* Set to non-zero when modifying TLB */
1281 bool kvm_sw_tlb; /* non-zero if KVM SW TLB API is active */
1291 /* Composite status for PMC[1-6] enabled and counting insns or cycles. */
1298 /* Non-zero if and only if VSCR_SAT should be set */
1369 * they can be changed with various side-band operations like qmp cont,
1393 * exception on a transition from 0 to 1 (watchdog or fixed-interval timer)
1429 if ((POWERPC_CPU(cs)->env.chip_index == \
1430 POWERPC_CPU(cs_sibling)->env.chip_index) && \
1431 (POWERPC_CPU(cs)->env.core_index == \
1432 POWERPC_CPU(cs_sibling)->env.core_index))
1436 env->fit_period[0] = (a_); \
1437 env->fit_period[1] = (b_); \
1438 env->fit_period[2] = (c_); \
1439 env->fit_period[3] = (d_); \
1444 env->wdt_period[0] = (a_); \
1445 env->wdt_period[1] = (b_); \
1446 env->wdt_period[2] = (c_); \
1447 env->wdt_period[3] = (d_); \
1508 uint64_t lpcr_pm; /* Power-saving mode Exit Cause Enable bits */
1529 return !POWERPC_CPU(cs)->env.has_smt_siblings; in ppc_cpu_core_single_threaded()
1534 return !(POWERPC_CPU(cs)->env.flags & POWERPC_FLAG_SMT_1LPAR) || in ppc_cpu_lpar_single_threaded()
1564 #define TYPE_PPC_VIRTUAL_HYPERVISOR "ppc-virtual-hypervisor"
1570 return cpu->vhyp_class->cpu_in_nested(cpu); in DECLARE_OBJ_CHECKERS()
1613 /* Time-base and decrementer management */
1657 gprv = env->gpr[gprn]; in ppc_dump_gpr()
1658 if (env->flags & POWERPC_FLAG_SPE) { in ppc_dump_gpr()
1664 gprv |= (uint64_t)env->gprh[gprn] << 32; in ppc_dump_gpr()
1681 return (env->hflags >> (ifetch ? HFLAGS_IMMU_IDX : HFLAGS_DMMU_IDX)) & 7; in ppc_env_mmu_index()
1727 #define xer_so (env->so)
1728 #define xer_cmp ((env->xer >> XER_CMP) & 0xFF)
1729 #define xer_bc ((env->xer >> XER_BC) & 0x7F)
2289 /* Disable MAS Interrupt Updates for Hypervisor */
2291 /* Disable Guest TLB Management Instructions */
2297 /* Disable Embedded Hypervisor Debug */
2311 #define L1CSR0_CUL 0x00000400 /* (D-)Cache Unable to Lock */
2312 #define L1CSR0_DCLFR 0x00000100 /* D-Cache Lock Flash Reset */
2317 #define L1CSR1_ICUL 0x00000400 /* I-Cache Unable to Lock */
2318 #define L1CSR1_ICLFR 0x00000100 /* I-Cache Lock Flash Reset */
2328 #define HID0_DEEPNAP (1 << 24) /* pre-2.06 */
2329 #define HID0_DOZE (1 << 23) /* pre-2.06 */
2330 #define HID0_NAP (1 << 22) /* pre-2.06 */
2363 /* Fixed-point unit extensions */
2373 /* Floating-point unit extensions */
2376 /* New floating-point extensions (PowerPC 2.0x) */
2390 /* PowerPC 2.03 SPE single-precision floating-point extension */
2392 /* PowerPC 2.03 SPE double-precision floating-point extension */
2493 /* Byte-reversed, indexed, double-word load and store */
2681 PPC_INTERRUPT_EBB = 0x80000, /* Event-based Branch exception */
2691 PCR_VEC_DIS = PPC_BIT(0), /* Vec. disable (bit NA since POWER8) */
2692 PCR_VSX_DIS = PPC_BIT(1), /* VSX disable (bit NA since POWER8) */
2693 PCR_TM_DIS = PPC_BIT(2), /* Trans. memory disable (POWER8) */
2744 #define is_isa300(ctx) (!!(ctx->insns_flags2 & PPC2_ISA300))
2749 * All 64-bit server processors compliant with arch 2.x, ie. 970 and newer,
2752 #define is_book3s_arch2x(ctx) (!!((ctx)->insns_flags & PPC_SEGMENT_64B))
2766 uintptr_t tlbl = (uintptr_t)env->tlb.tlbm; in booke206_tlbm_id()
2768 return (tlbml - tlbl) / sizeof(env->tlb.tlbm[0]); in booke206_tlbm_id()
2773 uint32_t tlbncfg = env->spr[SPR_BOOKE_TLB0CFG + tlbn]; in booke206_tlb_size()
2780 uint32_t tlbncfg = env->spr[SPR_BOOKE_TLB0CFG + tlbn]; in booke206_tlb_ways()
2806 return tlbid & (booke206_tlb_ways(env, tlbn) - 1); in booke206_tlbm_to_way()
2818 way &= ways - 1; in booke206_get_tlbm()
2820 ea &= (1 << (tlb_bits - ways_bits)) - 1; in booke206_get_tlbm()
2832 return &env->tlb.tlbm[r]; in booke206_get_tlbm()
2840 if ((env->spr[SPR_MMUCFG] & MMUCFG_MAVN) == MMUCFG_MAVN_V2) { in booke206_tlbnps()
2842 ret = env->spr[SPR_BOOKE_TLB0PS + tlbn]; in booke206_tlbnps()
2844 uint32_t tlbncfg = env->spr[SPR_BOOKE_TLB0CFG + tlbn]; in booke206_tlbnps()
2860 int32_t tsize = -1; in booke206_fixed_size_tlbn()
2863 if ((env->spr[SPR_BOOKE_TLB0PS + tlbn]) & (1ULL << i)) { in booke206_fixed_size_tlbn()
2864 if (tsize == -1) { in booke206_fixed_size_tlbn()
2873 assert(tsize != -1); in booke206_fixed_size_tlbn()
2874 tlb->mas1 &= ~MAS1_TSIZE_MASK; in booke206_fixed_size_tlbn()
2875 tlb->mas1 |= ((uint32_t)tsize) << MAS1_TSIZE_SHIFT; in booke206_fixed_size_tlbn()
2880 return cpu->env.tlb_type == TLB_6XX; in ppc_is_split_tlb()
2886 if (env->mmu_model == POWERPC_MMU_BOOKE206) { in msr_is_64bit()
2900 (start + nregs > 32 && (rx >= start || rx < start + nregs - 32)); in lsw_reg_in_range()
2917 #define VsrB(i) u8[15 - (i)]
2918 #define VsrSB(i) s8[15 - (i)]
2919 #define VsrH(i) u16[7 - (i)]
2920 #define VsrSH(i) s16[7 - (i)]
2921 #define VsrW(i) u32[3 - (i)]
2922 #define VsrSW(i) s32[3 - (i)]
2923 #define VsrD(i) u64[1 - (i)]
2924 #define VsrSD(i) s64[1 - (i)]
2925 #define VsrHF(i) f16[7 - (i)]
2926 #define VsrSF(i) f32[3 - (i)]
2927 #define VsrDF(i) f64[1 - (i)]
2978 return cpu->env.spr_cb[spr].name != NULL; in ppc_has_spr()
2986 CPUPPCState *env = &cpu->env; in ppc_interrupts_little_endian()
2989 if (hv && env->has_hv_mode) { in ppc_interrupts_little_endian()
2991 ile = !!(env->spr[SPR_HID0] & HID0_POWER9_HILE); in ppc_interrupts_little_endian()
2993 ile = !!(env->spr[SPR_HID0] & HID0_HILE); in ppc_interrupts_little_endian()
2996 } else if (pcc->lpcr_mask & LPCR_ILE) { in ppc_interrupts_little_endian()
2997 ile = !!(env->spr[SPR_LPCR] & LPCR_ILE); in ppc_interrupts_little_endian()
2999 ile = FIELD_EX64(env->msr, MSR, ILE); in ppc_interrupts_little_endian()
3042 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \