qemu-patch-raspberry4/target/ppc
Suraj Jitindar Singh a6152b52bc target/ppc: Add Instruction Authority Mask Register Check
The instruction authority mask register (IAMR) can be used to restrict
permissions for instruction fetch accesses on a per key basis for each
of 32 different key values. Access permissions are derived based on the
specific key value stored in the relevant page table entry.

The IAMR was introduced in, and is present in processors since, POWER8
(ISA v2.07). Thus introduce a function to check access permissions based
on the pte key value and the contents of the IAMR when handling a page
fault to ensure sufficient access permissions for an instruction fetch.

A hash pte contains a key value in bits 2:3|52:54 of the second double word
of the pte, this key value gives an index into the IAMR which contains 32
2-bit access masks. If the least significant bit of the 2-bit access mask
corresponding to the given key value is set (IAMR[key] & 0x1 == 0x1) then
the instruction fetch is not permitted and an ISI is generated accordingly.
While we're here, add defines for the srr1 bits to be set for the ISI for
clarity.

e.g.

pte:
dw0 [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]
dw1 [XX01XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX010XXXXXXXXX]
       ^^                                                ^^^
key = 01010 (0x0a)

IAMR: [XXXXXXXXXXXXXXXXXXXX01XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]
                           ^^
Access mask = 0b01

Test access mask: 0b01 & 0x1 == 0x1

Least significant bit of the access mask is set, thus the instruction fetch
is not permitted. We should generate an instruction storage interrupt (ISI)
with bit 42 of SRR1 set to indicate access precluded by virtual page class
key protection.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
[dwg: Move new constants to cpu.h, since they're not MMUv3 specific]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-03 11:30:59 +11:00
..
translate target-ppc: Add xscvqpudz and xscvqpuwz instructions 2017-02-22 11:28:28 +11:00
arch_dump.c Add PowerPC 32-bit guest memory dump support 2017-03-01 11:53:58 +11:00
compat.c target/ppc: Add POWER9/ISAv3.00 to compat_table 2017-03-03 11:30:59 +11:00
cpu-models.c target/ppc/cpu-models: Fix/remove bad CPU aliases 2017-01-31 13:46:26 +11:00
cpu-models.h powerpc/cpu-models: rename ISAv3.00 logical PVR definition 2017-01-31 10:10:14 +11:00
cpu-qom.h target/ppc/POWER9: Add POWERPC_MMU_V3 bit 2017-03-03 11:30:59 +11:00
cpu.c target/ppc: support for 32-bit carry and overflow 2017-03-01 11:23:39 +11:00
cpu.h target/ppc: Add Instruction Authority Mask Register Check 2017-03-03 11:30:59 +11:00
dfp_helper.c
excp_helper.c ppc: Clean up and QOMify hypercall emulation 2017-01-31 10:10:13 +11:00
fpu_helper.c target-ppc: Add xscvqpudz and xscvqpuwz instructions 2017-02-22 11:28:28 +11:00
gdbstub.c
helper.h target-ppc: Add xscvqpudz and xscvqpuwz instructions 2017-02-22 11:28:28 +11:00
helper_regs.h cputlb: drop flush_global flag from tlb_flush 2017-01-13 14:24:37 +00:00
int_helper.c target/ppc: introduce helper_update_ov_legacy 2017-03-01 11:23:39 +11:00
internal.h target-ppc: implement load atomic instruction 2017-02-22 11:28:27 +11:00
kvm-stub.c
kvm.c exec, kvm, target-ppc: Move getrampagesize() to common code 2017-03-03 11:30:59 +11:00
kvm_ppc.h target/ppc: Fix KVM-HV HPTE accessors 2017-03-01 11:23:39 +11:00
machine.c target/ppc: Manage external HPT via virtual hypervisor 2017-03-01 11:23:39 +11:00
Makefile.objs target/ppc/POWER9: Add POWER9 mmu fault handler 2017-03-03 11:30:59 +11:00
mem_helper.c target-ppc: implement stxvll instructions 2017-01-31 10:10:13 +11:00
mfrom_table.c
mfrom_table_gen.c
misc_helper.c target/ppc: SDR1 is a hypervisor resource 2017-03-01 11:23:39 +11:00
mmu-book3s-v3.c target/ppc/POWER9: Add POWER9 mmu fault handler 2017-03-03 11:30:59 +11:00
mmu-book3s-v3.h target/ppc/POWER9: Add POWER9 mmu fault handler 2017-03-03 11:30:59 +11:00
mmu-hash32.c target/ppc: Eliminate htab_base and htab_mask variables 2017-03-01 11:23:39 +11:00
mmu-hash32.h target/ppc: Manage external HPT via virtual hypervisor 2017-03-01 11:23:39 +11:00
mmu-hash64.c target/ppc: Add Instruction Authority Mask Register Check 2017-03-03 11:30:59 +11:00
mmu-hash64.h target/ppc: Correct SDR1 masking 2017-03-01 11:23:39 +11:00
mmu_helper.c target/ppc/POWER9: Add POWER9 mmu fault handler 2017-03-03 11:30:59 +11:00
monitor.c monitor: Fix crashes when using HMP commands without CPU 2017-02-21 18:29:01 +00:00
STATUS
timebase_helper.c
trace-events
translate.c target/ppc: Don't gen an SDR1 on POWER9 and rework register creation 2017-03-03 11:30:59 +11:00
translate_init.c target/ppc/POWER9: Add cpu_has_work function for POWER9 2017-03-03 11:30:59 +11:00
user_only_helper.c