target-arm: Add ARMCPU secure property

Added a "has_el3" state property to the ARMCPU descriptor. This property
indicates whether the ARMCPU has security extensions enabled (EL3) or not.
By default it is disabled at this time.

Backports commit 51942aee3c51ca23b0dd78f95534a57e8dc1e582 from qemu
This commit is contained in:
Greg Bellows 2018-02-12 10:17:54 -05:00 committed by Lioncash
parent 1d3719a39f
commit e1576f314e
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 14 additions and 0 deletions

View file

@ -99,6 +99,8 @@ typedef struct ARMCPU {
bool start_powered_off;
/* CPU currently in PSCI powered-off state */
bool powered_off;
/* CPU has security extension */
bool has_el3;
/* PSCI conduit used to invoke PSCI methods
* 0 - disabled, 1 - smc, 2 - hvc

View file

@ -410,6 +410,18 @@ static int arm_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **err
cpu->reset_sctlr |= (1 << 13);
}
if (!cpu->has_el3) {
/* If the has_el3 CPU property is disabled then we need to disable the
* feature.
*/
unset_feature(env, ARM_FEATURE_EL3);
/* Disable the security extension feature bits in the processor feature
* register as well. This is id_pfr1[7:4].
*/
cpu->id_pfr1 &= ~0xf0;
}
if (arm_feature(env, ARM_FEATURE_EL3)) {
set_feature(env, ARM_FEATURE_VBAR);
}