target/arm: Allow deliver_fault() caller to specify EA bit

For external aborts, we will want to be able to specify the EA
(external abort type) bit in the syndrome field. Allow callers of
deliver_fault() to do that by adding a field to ARMMMUFaultInfo which
we use when constructing the syndrome values.

Backports commit c528af7aa64f159eb30b46e567b650c5440fc117 from qemu
This commit is contained in:
Peter Maydell 2018-03-04 13:20:21 -05:00 committed by Lioncash
parent 320655293a
commit b9f06be41d
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 7 additions and 5 deletions

View file

@ -450,12 +450,14 @@ void arm_handle_psci_call(ARMCPU *cpu);
* @s2addr: Address that caused a fault at stage 2 * @s2addr: Address that caused a fault at stage 2
* @stage2: True if we faulted at stage 2 * @stage2: True if we faulted at stage 2
* @s1ptw: True if we faulted at stage 2 while doing a stage 1 page-table walk * @s1ptw: True if we faulted at stage 2 while doing a stage 1 page-table walk
* @ea: True if we should set the EA (external abort type) bit in syndrome
*/ */
typedef struct ARMMMUFaultInfo ARMMMUFaultInfo; typedef struct ARMMMUFaultInfo ARMMMUFaultInfo;
struct ARMMMUFaultInfo { struct ARMMMUFaultInfo {
target_ulong s2addr; target_ulong s2addr;
bool stage2; bool stage2;
bool s1ptw; bool s1ptw;
bool ea;
}; };
/* Do a page table walk and add page to TLB if possible */ /* Do a page table walk and add page to TLB if possible */

View file

@ -79,7 +79,7 @@ uint32_t HELPER(neon_tbl)(CPUARMState *env, uint32_t ireg, uint32_t def,
static inline uint32_t merge_syn_data_abort(uint32_t template_syn, static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
unsigned int target_el, unsigned int target_el,
bool same_el, bool same_el, bool ea,
bool s1ptw, bool is_write, bool s1ptw, bool is_write,
int fsc) int fsc)
{ {
@ -98,7 +98,7 @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
*/ */
if (!(template_syn & ARM_EL_ISV) || target_el != 2 || s1ptw) { if (!(template_syn & ARM_EL_ISV) || target_el != 2 || s1ptw) {
syn = syn_data_abort_no_iss(same_el, syn = syn_data_abort_no_iss(same_el,
0, 0, s1ptw, is_write, fsc); ea, 0, s1ptw, is_write, fsc);
} else { } else {
/* Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template /* Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template
* syndrome created at translation time. * syndrome created at translation time.
@ -106,7 +106,7 @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
*/ */
syn = syn_data_abort_with_iss(same_el, syn = syn_data_abort_with_iss(same_el,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, s1ptw, is_write, fsc, ea, 0, s1ptw, is_write, fsc,
false); false);
/* Merge the runtime syndrome with the template syndrome. */ /* Merge the runtime syndrome with the template syndrome. */
syn |= template_syn; syn |= template_syn;
@ -140,11 +140,11 @@ static void deliver_fault(ARMCPU *cpu, vaddr addr, MMUAccessType access_type,
} }
if (access_type == MMU_INST_FETCH) { if (access_type == MMU_INST_FETCH) {
syn = syn_insn_abort(same_el, 0, fi->s1ptw, fsc); syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
exc = EXCP_PREFETCH_ABORT; exc = EXCP_PREFETCH_ABORT;
} else { } else {
syn = merge_syn_data_abort(env->exception.syndrome, target_el, syn = merge_syn_data_abort(env->exception.syndrome, target_el,
same_el, fi->s1ptw, same_el, fi->ea, fi->s1ptw,
access_type == MMU_DATA_STORE, access_type == MMU_DATA_STORE,
fsc); fsc);
if (access_type == MMU_DATA_STORE if (access_type == MMU_DATA_STORE