Lines Matching +full:migration +full:- +full:compat +full:- +full:common
23 #include "kvm-consts.h"
24 #include "qemu/cpu-float.h"
26 #include "cpu-qom.h"
27 #include "exec/cpu-common.h"
28 #include "exec/cpu-defs.h"
29 #include "exec/cpu-interrupt.h"
31 #include "exec/page-protection.h"
32 #include "qapi/qapi-types-common.h"
78 /* ARM-specific interrupt pending bits. */
106 #define ARM_INSN_START_WORD2_MASK ((1 << 26) - 1)
141 * For 32-bit, this is a 128-bit NEON/AdvSIMD register.
142 * For 64-bit, this is a 2048-bit SVE register.
197 * FPST_A32_F16: used for AArch32 half-precision calculations
198 * FPST_A64_F16: used for AArch64 half-precision calculations
200 * FPST_STD_F16: used for half-precision
208 * for half-precision
210 * Half-precision operations are governed by a separate
211 * flush-to-zero control bit in FPSCR:FZ16. We pass a separate
214 * The "Standard FPSCR", ie default-NaN, flush-to-zero,
215 * round-to-nearest and is used by any operations (generally
263 * NZCV are kept in the split out env->CF/VF/NF/ZF, (which have the same
265 * nRW (also known as M[4]) is kept, inverted, in env->aarch64
266 * DAIF (exception masks) are kept in env->daif
267 * BTYPE is kept in env->btype
268 * SM and ZA are kept in env->svcr
269 * all other bits are stored in their correct places in env->pstate
289 /* These hold r8-r12. */
334 uint32_t nsacr; /* Non-secure access control register. */
505 uint32_t c15_i_max; /* Maximum D-cache dirty line index. */
506 uint32_t c15_i_min; /* Minimum D-cache dirty line index. */
507 uint32_t c15_threadid; /* TI debugger thread-ID. */
525 * architecturally-correct value is being read/set.
552 * Fine-Grained Trap registers. We store these as arrays so the
573 * of the Secure and Non-Secure states. (If the CPU doesn't support
576 * and the non-active SP for the current security state in
616 * code which raises an exception must set cs->exception_index and
618 * will then set the guest-visible registers as part of the exception
643 /* Thumb-2 EE state. */
677 uint64_t zcr_el[4]; /* ZCR_EL[1-3] */
678 uint64_t smcr_el[4]; /* SMCR_EL[1-3] */
684 * Contains the 'val' for the second 64-bit register of LDXP, which comes
685 * from the higher address, not the high part of a complete 128-bit value.
688 * semantics of these fields are baked into the migration format.
711 * SME ZA storage -- 256 x 256 byte array, with bytes in host word order,
713 * array, where ZA[N] is in the least-significant bytes of env->zarray[N].
793 env->features |= 1ULL << feature; in set_feature()
798 env->features &= ~(1ULL << feature); in unset_feature()
825 * In map, each set bit is a supported vector length of (bit-number + 1) * 16
851 * kernel and QEMU (for KVM) and between two QEMUs (for migration),
862 /* These are used only for migration: incoming data arrives in
878 * Timer used by the PMU. Its state is restored after migration by
879 * pmu_op_finish() - it does not need other handling during migration
926 /* CPU has M-profile DSP extension */
941 * 0 - disabled, 1 - smc, 2 - hvc
947 /* For v8M, initial value of the Non-secure VTOR */
976 /* QOM property to indicate we should use the back-compat CNTFRQ default */
979 /* QOM property to indicate we should use the back-compat QARMA5 default */
987 /* The instance init functions for implementation-specific subclasses
988 * set these fields to specify the implementation-dependent values of
989 * various constant registers and reset values of non-constant
994 * is used for reset values of non-constant registers; no reset_
1000 * you need to also update the 32-bit and 64-bit versions of the
1089 * big-endian mode). This setting isn't used directly: instead it modifies
1100 /* Used to synchronize KVM and QEMU in-kernel device levels */
1200 * lower exception level. This function does that post-reset CPU setup,
1220 * SVE registers are encoded in KVM's memory in an endianness-invariant format.
1221 * The byte at offset i from the start of the in-memory representation contains
1224 * matches QEMU's representation, which is to use an array of host-endian
1226 * the translation we just need to byte swap the uint64_t's on big-endian hosts.
1257 * Quadwords Minus 1 -- the same scale used for ZCR_ELx.LEN.
1267 return env->aarch64; in is_a64()
1275 * they are enabled) and the guest-visible values. These two calls must
1311 #define SCTLR_nTLSMD_32 (1U << 3) /* v8.2-LSMAOC, AArch32 only */
1314 #define SCTLR_LSMAOE_32 (1U << 4) /* v8.2-LSMAOC, AArch32 only */
1328 #define SCTLR_EnRCTX (1U << 10) /* in v8.0-PredInv */
1330 #define SCTLR_EOS (1U << 11) /* v8.5-ExS */
1349 #define SCTLR_IESB (1U << 21) /* v8.2-IESB, AArch64 only */
1351 #define SCTLR_EIS (1U << 22) /* v8.5-ExS */
1353 #define SCTLR_SPAN (1U << 23) /* v8.1-PAN */
1362 #define SCTLR_nTLSMD_64 (1U << 28) /* v8.2-LSMAOC, AArch64 only */
1364 #define SCTLR_LSMAOE_64 (1U << 29) /* v8.2-LSMAOC, AArch64 only */
1371 #define SCTLR_BT0 (1ULL << 35) /* v8.5-BTI */
1372 #define SCTLR_BT1 (1ULL << 36) /* v8.5-BTI */
1373 #define SCTLR_ITFSB (1ULL << 37) /* v8.5-MemTag */
1374 #define SCTLR_TCF0 (3ULL << 38) /* v8.5-MemTag */
1375 #define SCTLR_TCF (3ULL << 40) /* v8.5-MemTag */
1376 #define SCTLR_ATA0 (1ULL << 42) /* v8.5-MemTag */
1377 #define SCTLR_ATA (1ULL << 43) /* v8.5-MemTag */
1444 * AArch32 mode SPSRs are basically CPSR-format.
1497 /* Return the current PSTATE value. For the moment we don't support 32<->64 bit
1505 ZF = (env->ZF == 0); in pstate_read()
1506 return (env->NF & 0x80000000) | (ZF << 30) in pstate_read()
1507 | (env->CF << 29) | ((env->VF & 0x80000000) >> 3) in pstate_read()
1508 | env->pstate | env->daif | (env->btype << 10); in pstate_read()
1513 env->ZF = (~val) & PSTATE_Z; in pstate_write()
1514 env->NF = val; in pstate_write()
1515 env->CF = (val >> 29) & 1; in pstate_write()
1516 env->VF = (val << 3) & 0x80000000; in pstate_write()
1517 env->daif = val & PSTATE_DAIF; in pstate_write()
1518 env->btype = (val >> 10) & 3; in pstate_write()
1519 env->pstate = val & ~CACHED_PSTATE_BITS; in pstate_write()
1534 * Set the CPSR. Note that some bits of mask must be all-set or all-clear.
1546 ZF = (env->ZF == 0); in xpsr_read()
1547 return (env->NF & 0x80000000) | (ZF << 30) in xpsr_read()
1548 | (env->CF << 29) | ((env->VF & 0x80000000) >> 3) | (env->QF << 27) in xpsr_read()
1549 | (env->thumb << 24) | ((env->condexec_bits & 3) << 25) in xpsr_read()
1550 | ((env->condexec_bits & 0xfc) << 8) in xpsr_read()
1551 | (env->GE << 16) in xpsr_read()
1552 | env->v7m.exception; in xpsr_read()
1555 /* Set the xPSR. Note that some bits of mask must be all-set or all-clear. */
1559 env->ZF = (~val) & XPSR_Z; in xpsr_write()
1560 env->NF = val; in xpsr_write()
1561 env->CF = (val >> 29) & 1; in xpsr_write()
1562 env->VF = (val << 3) & 0x80000000; in xpsr_write()
1565 env->QF = ((val & XPSR_Q) != 0); in xpsr_write()
1568 env->GE = (val & XPSR_GE) >> 16; in xpsr_write()
1572 env->thumb = ((val & XPSR_T) != 0); in xpsr_write()
1575 env->condexec_bits &= ~3; in xpsr_write()
1576 env->condexec_bits |= (val >> 25) & 3; in xpsr_write()
1579 env->condexec_bits &= 3; in xpsr_write()
1580 env->condexec_bits |= (val >> 8) & 0xfc; in xpsr_write()
1717 #define FPCR_LEN_MASK (7 << 16) /* LEN, A-profile only */
1718 #define FPCR_FZ16 (1 << 19) /* ARMv8.2+, FP16 flush-to-zero */
1721 #define FPCR_FZ (1 << 24) /* Flush-to-zero enable bit */
1723 #define FPCR_AHP (1 << 26) /* Alternative half-precision */
1725 #define FPCR_LTPSIZE_SHIFT 16 /* LTPSIZE, M-profile only */
1811 /* These ones are M-profile only */
1818 /* QEMU-internal value meaning "FPSCR, but we care only about NZCV" */
1929 /* We use the combination of InD and Level to index into cpu->ccsidr[];
1954 /* These bits are banked. Others are non-banked and live in the M_REG_S bank */
2366 FIELD(MVFR1, SIMDLS, 8, 4) /* A-profile only */
2367 FIELD(MVFR1, SIMDINT, 12, 4) /* A-profile only */
2368 FIELD(MVFR1, SIMDSP, 16, 4) /* A-profile only */
2369 FIELD(MVFR1, SIMDHP, 20, 4) /* A-profile only */
2370 FIELD(MVFR1, MVE, 8, 4) /* M-profile only */
2371 FIELD(MVFR1, FP16, 20, 4) /* M-profile only */
2391 QEMU_BUILD_BUG_ON(ARRAY_SIZE(((ARMCPU *)0)->ccsidr) <= R_V7M_CSSELR_INDEX_MASK);
2394 * HWCAP bit, remember to update the feature-bit-to-hwcap
2395 * mapping in linux-user/elfload.c:get_elf_hwcap().
2411 ARM_FEATURE_V7VE, /* v7 Virtualization Extensions (non-EL2 parts) */
2419 ARM_FEATURE_CACHE_TEST_CLEAN, /* 926/1026 style test-and-clean ops */
2427 ARM_FEATURE_CBAR_RO, /* has cp15 CBAR and it is read-only */
2448 return (env->features & (1ULL << feature)) != 0; in arm_feature()
2466 /* Return true if @space is secure, in the pre-v9 sense. */
2472 /* Return the ARMSecuritySpace for @secure, assuming !RME or EL[0-2]. */
2507 if (is_a64(env) && extract32(env->pstate, 2, 2) == 3) { in arm_is_el3_or_mon()
2511 (env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_MON) { in arm_is_el3_or_mon()
2547 && (space != ARMSS_Secure || (env->cp15.scr_el3 & SCR_EEL2)); in arm_is_el2_enabled_secstate()
2605 * access the secure or non-secure bank of a cp register. When EL3 is
2606 * operating in AArch32 state, the NS-bit determines whether the secure
2609 * accesses are to the non-secure version.
2631 return env->v7m.exception != 0; in arm_v7m_is_handler_mode()
2641 * from incoming migration state.
2645 * Note that we do not stop early on failure -- we will attempt
2658 * KVM or for outbound migration.
2662 * values in the list if the previous list->cpustate sync actually
2668 * Note that we do not stop early on failure -- we will attempt
2678 #define TYPE_ARM_HOST_CPU "host-" TYPE_ARM_CPU
2682 * If EL3 is 64-bit:
2686 * + NonSecure EL2 & 0 (ARMv8.1-VHE)
2695 * If EL3 is 32-bit:
2704 * because they may differ in access permissions even if the VA->PA map is
2706 * 2. we want to cache in our TLB the full VA->IPA->PA lookup for a stage 1+2
2713 * which can be slow-pathed and always do a page table walk.
2725 * 7. we fold together most secure and non-secure regimes for A-profile,
2727 * process of switching between secure and non-secure is
2752 * EL2 for cores like the Cortex-R52).
2767 * are not quite the same -- different CPU types (most notably M profile
2802 * A-profile.
2824 /* TLBs with 1-1 mapping to the physical address spaces. */
2839 * M-profile.
2852 * Bit macros for the core-mmu-index values for each index,
2908 return idx - ARMMMUIdx_Phys_S; in arm_phys_to_space()
2916 return (cpu->clidr & R_V7M_CLIDR_CTYPE_ALL_MASK) != 0; in arm_v7m_csselr_razwi()
2922 /* We need not implement SCTLR.ITD in user-mode emulation, so in arm_sctlr_b()
2923 * let linux-user ignore the fact that it conflicts with SCTLR_B. in arm_sctlr_b()
2924 * This lets people run BE32 binaries with "-cpu any". in arm_sctlr_b()
2929 (env->cp15.sctlr_el[1] & SCTLR_B) != 0; in arm_sctlr_b()
2935 * We have more than 32-bits worth of state per TB, so we split the data
2936 * between tb->flags and tb->cs_base, which is otherwise unused for ARM.
2942 * flags2 always has 64-bits, even though only 32-bits are used for A32 and M32.
2944 * The bits for 32-bit A-profile and M-profile partially overlap:
2947 * +-------------+----------+----------------+
2949 * | TBFLAG_AM32 | +-----+----------+
2951 * +-------------+----------------+----------+
2954 * Unless otherwise noted, these bits are cached in env->hflags.
2961 /* Target EL if we take a floating-point-disabled exception */
2970 * Bit usage when in AArch32 state, both A- and M-profile.
2976 * Bit usage when in AArch32 state, for A-profile only.
3003 * Bit usage when in AArch32 state, for M-profile only.
3007 /* Whether we should generate stack-limit checks */
3050 /* Set if FEAT_NV2 RAM accesses are big-endian */
3081 * Return the VL cached within env->hflags, in units of quadwords.
3085 return EX_TBFLAG_A64(env->hflags, VL) + 1; in sve_vq()
3092 * Return the SVL cached within env->hflags, in units of quadwords.
3096 return EX_TBFLAG_A64(env->hflags, SVL) + 1; in sme_vq()
3104 * would also end up as a mixed-endian mode with BE code, LE data. in bswap_code()
3145 * Note that if a pre-change hook is called, any registered post-change hooks
3158 * if pre-change hooks have been.
3171 * Return a pointer to the Dn register within env in 32-bit mode.
3175 return &env->vfp.zregs[regno >> 1].d[regno & 1]; in aa32_vfp_dreg()
3180 * Return a pointer to the Qn register within env in 32-bit mode.
3184 return &env->vfp.zregs[regno].d[0]; in aa32_vfp_qreg()
3189 * Return a pointer to the Qn register within env in 64-bit mode.
3193 return &env->vfp.zregs[regno].d[0]; in aa64_vfp_qreg()
3196 /* Shared between translate-sve.c and sve_helper.c. */
3200 * AArch64 usage of the PAGE_TARGET_* bits for linux-user.