Skip to content

Commit

Permalink
hw: don't depend on ARMv8 HCR, CPTR EL2 reg values
Browse files Browse the repository at this point in the history
Instead of re-using the register values found in HCR_EL2 and CPTR_EL2
and setting single bits within them, define the complete content to
prevent inconsistent hardware/hypervisor state.

Ref #4759
  • Loading branch information
skalk authored and chelmuth committed Feb 27, 2023
1 parent c5b9cab commit 8045323
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions repos/base-hw/src/bootstrap/spec/arm_64/cortex_a53_mmu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static inline void prepare_hypervisor(Cpu::Ttbr::access_t const ttbr,
using namespace Hw::Mm;

/* forbid trace access */
Cpu::Cptr_el2::access_t cptr = Cpu::Cptr_el2::read();
Cpu::Cptr_el2::access_t cptr = 0;
Cpu::Cptr_el2::Tta::set(cptr, 1);
Cpu::Cptr_el2::write(cptr);

Expand All @@ -74,7 +74,7 @@ static inline void prepare_hypervisor(Cpu::Ttbr::access_t const ttbr,
/* forbid any 32bit access to coprocessor/sysregs */
Cpu::Hstr_el2::write(0xffff);

Cpu::Hcr_el2::access_t hcr = Cpu::Hcr_el2::read();
Cpu::Hcr_el2::access_t hcr = 0;
Cpu::Hcr_el2::Rw::set(hcr, 1); /* exec in aarch64 */
Cpu::Hcr_el2::write(hcr);

Expand Down

0 comments on commit 8045323

Please sign in to comment.