Commit graph

3588 commits

Author SHA1 Message Date
Jean-Christophe DUBOIS 0aa0b849c2
ARM: Factor out ARM on/off PSCI control functions
Split ARM on/off function from PSCI support code.

This will allow to reuse these functions in other code.

Backports commit 825482adde1f971cbddf27e15fb4453ab3fae994 from qemu
2018-03-01 23:31:47 -05:00
Peter Maydell 468e2849cd
target/arm: Implement DBGVCR32_EL2 system register
The DBGVCR_EL2 system register is needed to run a 32-bit
EL1 guest under a Linux EL2 64-bit hypervisor. Its only
purpose is to provide AArch64 with access to the state of
the DBGVCR AArch32 register. Since we only have a dummy
DBGVCR, implement a corresponding dummy DBGVCR32_EL2.

Backports commit 4d2ec4da1c2d60c9fd8bad137506870c2f980410 from qemu
2018-03-01 23:02:28 -05:00
Peter Maydell 0db334c0e4
target/arm: Handle VIRQ and VFIQ in arm_cpu_do_interrupt_aarch32()
To run a VM in 32-bit EL1 our AArch32 interrupt handling code
needs to be able to cope with VIRQ and VFIQ exceptions.
These behave like IRQ and FIQ except that we don't need to try
to route them to Monitor mode.

Backports commit 87a4b270348c69a446ebcddc039bfae31b1675cb from qemu
2018-03-01 22:59:08 -05:00
Lioncash ebae552174
mips: Build fix 2018-03-01 22:56:23 -05:00
Thomas Huth b2f1326437
Move target-* CPU file into a target/ folder
We've currently got 18 architectures in QEMU, and thus 18 target-xxx
folders in the root folder of the QEMU source tree. More architectures
(e.g. RISC-V, AVR) are likely to be included soon, too, so the main
folder of the QEMU sources slowly gets quite overcrowded with the
target-xxx folders.
To disburden the main folder a little bit, let's move the target-xxx
folders into a dedicated target/ folder, so that target-xxx/ simply
becomes target/xxx/ instead.

Backports commit fcf5ef2ab52c621a4617ebbef36bf43b4003f4c0 from qemu
2018-03-01 22:50:58 -05:00
Artyom Tarasenko 59ec6876bd
target-sparc: add ST_BLKINIT_ ASIs for UA2005+ CPUs
In OpenSPARC T1+ TWINX ASIs in store instructions are aliased
with Block Initializing Store ASIs.

"UltraSPARC T1 Supplement Draft D2.1, 14 May 2007" describes them
in the chapter "5.9 Block Initializing Store ASIs"

Integer stores of all sizes are allowed with these ASIs.

Backports commit 3390537b5df4014e24a30f9bdcfa05c2bd0cd6d8 from qemu
2018-03-01 22:29:21 -05:00
Artyom Tarasenko a6981c9b91
target-sparc: store the UA2005 entries in sun4u format
According to chapter 13.3 of the
UltraSPARC T1 Supplement to the UltraSPARC Architecture 2005,
only the sun4u format is available for data-access loads.

Store UA2005 entries in the sun4u format to simplify processing.

Backports commit 7285fba083de3f14f6e98abb4469173b56da9480 from qemu
2018-03-01 22:28:12 -05:00
Artyom Tarasenko aa24403d8a
target-sparc: implement UA2005 ASI_MMU (0x21)
Backports commit 7dd8c0760ee197420273a7dfeab13bf54f6bbd8d from qemu
2018-03-01 22:25:39 -05:00
Artyom Tarasenko aac6955197
target-sparc: add more registers to dump_mmu
Backports commit d00a2334433483d1751d94aabdf47985a68010d3 from qemu
2018-03-01 22:23:46 -05:00
Artyom Tarasenko 49e61dc62f
target-sparc: implement auto-demapping for UA2005 CPUs
Backports commit 70f44d2f4bce44fa04426def3290306fa8064b91 from qemu
2018-03-01 22:23:06 -05:00
Artyom Tarasenko b20b29fc8e
target-sparc: allow 256M sized pages
Backports commit 70f44d2f4bce44fa04426def3290306fa8064b91 from qem#u
2018-03-01 22:22:50 -05:00
Lioncash 92730d9626
target-sparc: simplify ultrasparc_tsb_pointer 2018-03-01 22:18:25 -05:00
Artyom Tarasenko 76d1612dcb
target-sparc: implement UA2005 TSB Pointers
Backports commit 15f746cedc6db2cc8fc7bcfe7692e02263caeeca from qemu
2018-03-01 21:31:47 -05:00
Artyom Tarasenko f3d96d19e5
target-sparc: use SparcV9MMU type for sparc64 I/D-MMUs
Backports commit 96df2bc99f9bdaf7a2f13550111f219b72b73708 from qemu
2018-03-01 21:28:43 -05:00
Artyom Tarasenko c61e580b2d
target-sparc: replace the last tlb entry when no free entries left
Implement the behavior described in the chapter 13.9.11 of
UltraSPARC T1™ Supplement to the UltraSPARC Architecture 2005:

"If a TLB Data-In replacement is attempted with all TLB
entries locked and valid, the last TLB entry (entry 63) is
replaced."

Backports commit 4797a6851975c1239df440c5f01d8566e63717bb from qemu
2018-03-01 21:26:05 -05:00
Artyom Tarasenko c43a89b2bc
target-sparc: ignore writes to UA2005 CPU mondo queue register
Backports commit 2f1b52920205863024cc86007e88557f4c2c898e from qemu
2018-03-01 21:25:28 -05:00
Artyom Tarasenko 0c5a21230f
target-sparc: allow priveleged ASIs in hyperprivileged mode
Backports commit 7cd39ef234a7e2eea45a08cd15f920da5f1ba008 from qemu
2018-03-01 21:24:10 -05:00
Artyom Tarasenko 3a5a9dd6cd
target-sparc: use direct address translation in hyperprivileged mode
Please note that QEMU doesn't impelement Real->Physical address
translation. The "Real Address" is always the "Physical Address".

Backports commit 84f8f5876628963e67f66edde8a71208c4274ac8 from qemu
2018-03-01 21:24:09 -05:00
Artyom Tarasenko f07be0ac3f
target-sparc: fix immediate UA2005 traps
Backports commit 5c65df364af0a2cc60af318e5a3011ae5fce293a from qemu
2018-03-01 21:24:09 -05:00
Artyom Tarasenko 2f2bde32bf
target-sparc: implement UA2005 rdhpstate and wrhpstate instructions
Backports commit f7f17ef75c9c90db63c44d11dc16fc085ca2c474 from qemu
2018-03-01 21:24:09 -05:00
Artyom Tarasenko 0a124b2199
target-sparc: implement UA2005 GL register
Backports commit cbc3a6a4cc675516328a2b0d3602355d68b6302d from qemu
2018-03-01 21:24:09 -05:00
Artyom Tarasenko 05e80b59af
target-sparc: implement UA2005 hypervisor traps
Backports commit 6e040755f12eba34d2fa3d56b18de32d63fea631 from qemu
2018-03-01 21:24:09 -05:00
Artyom Tarasenko 8710ef1128
target-sparc: hypervisor mode takes over nucleus mode
Accordinf to UA2005, 9.3.3 "Address Space Identifiers",

"In hyperprivileged mode, all instruction fetches and loads and stores with implicit
ASIs use a physical address, regardless of the value of TL".

Backports commit 9a10756d1204c3528e47892195349bf882069846 from qemu
2018-03-01 21:24:08 -05:00
Artyom Tarasenko 204a4dc1d3
target-sparc: implement UltraSPARC-T1 Strand status ASR
Backports commit b8e31b3cc6315bc5c6ec686c363c088c4fb1d0ea from qemu
2018-03-01 21:24:08 -05:00
Artyom Tarasenko 2f329af7ef
target-sparc: implement UA2005 scratchpad registers
Backports commit 4ec3e34654990868ad73a5a452a46d7f9f9dd378 from qemu
2018-03-01 21:24:08 -05:00
Artyom Tarasenko ec74c31ebf
target-sparc: simplify replace_tlb_entry by using TTE_PGSIZE
Backports commit e4d06ca74b751e486ca2a57f586fd4b858a13085 from qemu
2018-03-01 21:24:08 -05:00
Artyom Tarasenko 926247a35e
target-sparc: on UA2005 don't deliver Interrupt_level_n IRQs in hypervisor mode
As described in Chapter 5.7.6 of the UltraSPARC Architecture 2005,
outstanding disrupting exceptions that are destined for privileged mode can only
cause a trap when the virtual processor is in nonprivileged or privileged mode and
PSTATE.ie = 1. At all other times, they are held pending.

Backports commit 1a2aefae6627170fdee689b394a65f76080c068a from qemu
2018-03-01 21:24:08 -05:00
Artyom Tarasenko f486053ae0
target-sparc: add UltraSPARC T1 TLB #defines
Backports commit 5b5352b2f41e460f213a515e087c24dac1322f49 from qemu
2018-03-01 21:24:08 -05:00
Artyom Tarasenko b3f7d376cc
target-sparc: add UA2005 TTE bit #defines
Backports commit c2c7f864df16ed6ef7ef21d255c5593dbeaec261 from qemu
2018-03-01 21:24:07 -05:00
Artyom Tarasenko c1c88e147d
target-sparc: use explicit mmu register pointers
Use explicit register pointers while accessing D/I-MMU registers.
Call cpu_unassigned_access on access to missing registers.

Backports commit 20395e63375358bf6dd147057aaf998abf7abdb9 from qemu
2018-03-01 21:24:07 -05:00
Artyom Tarasenko be8357f8b5
target-sparc: store cpu super- and hypervisor flags in TB
Backports commit c9b459aab8c5775a21dd913fc8820b736181e7be from qemu
2018-03-01 21:24:00 -05:00
Artyom Tarasenko 96af2cfb58
target-sparc: ignore MMU-faults if MMU is disabled in hypervisor mode
while IMMU/DMMU is disabled
- ignore MMU-faults in hypervisorv mode or if CPU doesn't have hypervisor
- signal TT_INSN_REAL_TRANSLATION_MISS/TT_DATA_REAL_TRANSLATION_MISS otherwise

Backports commit 1ceca928538a3633b74a7dc718a05ce6767f2f76 from qemu
2018-03-01 20:25:32 -05:00
Lioncash d905278b86
Make unicorn happy with TLB execution 2018-03-01 20:13:37 -05:00
Alex Bennée e3e57ca08e
cputlb: drop flush_global flag from tlb_flush
We have never has the concept of global TLB entries which would avoid
the flush so we never actually use this flag. Drop it and make clear
that tlb_flush is the sledge-hammer it has always been.

Backports commit  d10eb08f5d8389c814b554d01aa2882ac58221bf from qemu
2018-03-01 19:36:04 -05:00
Alex Bennée 7e2cc86ad2
cpu_common_reset: wrap TCG specific code in tcg_enabled()
Both the cpu->tb_jmp_cache and SoftMMU TLB structures are only used
when running TCG code so we might as well skip them for anything else.

Backports commit ba7d3d1858c257e39b47f7f12fa2016ffd960b11 from qemu
2018-03-01 19:29:57 -05:00
Alex Bennée 780ed8722e
qom/cpu: move tlb_flush to cpu_common_reset
It is a common thing amongst the various cpu reset functions want to
flush the SoftMMU's TLB entries. This is done either by calling
tlb_flush directly or by way of a general memset of the CPU
structure (sometimes both).

This moves the tlb_flush call to the common reset function and
additionally ensures it is only done for the CONFIG_SOFTMMU case and
when tcg is enabled.

In some target cases we add an empty end_of_reset_fields structure to the
target vCPU structure so have a clear end point for any memset which
is resetting value in the structure before CPU_COMMON (where the TLB
structures are).

While this is a nice clean-up in general it is also a precursor for
changes coming to cputlb for MTTCG where the clearing of entries
can't be done arbitrarily across vCPUs. Currently the cpu_reset
function is usually called from the context of another vCPU as the
architectural power up sequence is run. By using the cputlb API
functions we can ensure the right behaviour in the future.

Backports commit 1f5c00cfdb8114c1e3a13426588ceb64f82c9ddb from qemu
2018-03-01 19:21:07 -05:00
Laurent Vivier 770989f36f
target-m68k: increment/decrement with SP
On 680x0 family only.

Address Register indirect With postincrement:

When using the stack pointer (A7) with byte size data, the register
is incremented by two.

Address Register indirect With predecrement:

When using the stack pointer (A7) with byte size data, the register
is decremented by two.

Backports commit 727d937b59f1f722f983e20f9cd23b0e7ef60165 from qemu
2018-03-01 19:16:22 -05:00
Laurent Vivier 6ff83aadab
target-m68k: CAS doesn't need aligned access
Backports commit b19578f42872aefef891e5804359af8d935a5487 from qemu
2018-03-01 19:15:20 -05:00
Laurent Vivier 636bf36272
target-m68k: manage pre-dec et post-inc in CAS
In these cases we must update the address register after
the operation.

Backports commit 308feb935249ad745ef763707e1db69bc10ba789 from qemu
2018-03-01 19:14:35 -05:00
Laurent Vivier 1197d778cc
target-m68k: fix gen_flush_flags()
gen_flush_flags() is setting unconditionally cc_op_synced to 1
and s->cc_op to CC_OP_FLAGS, whereas env->cc_op can be set
to something else by a previous tcg fragment.

We fix that by not setting cc_op_synced to 1
(except for gen_helper_flush_flags() that updates env->cc_op)

FIX: https://github.com/vivier/qemu-m68k/issues/19

Backports commit 695576db2daaf2bdc63e7f6d36038b61caed622a from qemu
2018-03-01 19:13:35 -05:00
Laurent Vivier b3c3cf84a5
target-m68k: fix bit operation with immediate value
M680x0 bit operations with an immediate value use 9 bits of the 16bit
value, while coldfire ones use only 8 bits.

Backports commit fe53c2be8c12da345bd788b949e0b2360e4b3db3 from qemu
2018-03-01 19:12:20 -05:00
Richard Henderson 6f5081314b
target-m68k: Implement bfffo
Backports commit a45f1763cc501861ea4f5eed06e6f58aa681a082 from qemu
2018-03-01 19:10:59 -05:00
Richard Henderson 797e5d44e9
target-m68k: Implement bitfield ops for memory
Backports commit f2224f2c9a9ed63edaed77ae21ffb1e501d7f247 from qemu
2018-03-01 19:07:06 -05:00
Richard Henderson 4f481b2c5a
target-m68k: Implement bitfield ops for registers
Backports commit ac815f46a325b5dabe2ebd6561e4244767c0a603 from qemu
2018-03-01 18:58:47 -05:00
Doug Evans 7bd3170ea5
target/i386: Fix bad patch application to translate.c
In commit c52ab08aee6f7d4717fc6b517174043126bd302f,
the patch snippet for the "syscall" insn got applied to "iret".

Backports commit 410e98146ffde201ab4c778823ac8beaa74c4c3f from qemu
2018-03-01 18:52:10 -05:00
Richard Henderson 4bec129626
tcg/i386: Handle ctpop opcode
Backports commit 993508e43e6d180e9ba9b747a9657eac69aec5bb from qemu
2018-03-01 18:49:43 -05:00
Richard Henderson 3a0fba32f3
tcg/ppc: Handle ctpop opcode
Backports commit 33e75fb9c8cc44165c8dad9093762ba728cc7596 from qemu
2018-03-01 18:46:43 -05:00
Richard Henderson 6d4fc1319a
tcg/ppc: Handle ctz and clz opcodes
Backports commit d0b07481fabb4dc4ed05d56d09718758f5f7a136 from qemu
2018-03-01 18:44:54 -05:00
Richard Henderson ff3512a045
tcg: Use ctpop to generate ctz if needed
Particularly when andc is also available, this is two insns
shorter than using clz to compute ctz.

Backports commit 14e99210f6c6cede461a54b2e0f9b4cd55175f00 from qemu
2018-03-01 18:39:20 -05:00
Richard Henderson 5ca8ac1aeb
qemu/host-utils.h: Reduce the operation count in the fallback ctpop
Backports commit 7bdcecb7b2d79c292d1256f7d6cf0f1da50d381f from qemu
2018-03-01 18:35:51 -05:00