VHE: Move hcr_el2 from lazy saved region to volatile region.
This patch moves hcr_el2 from the list of registers that are saved
lazily to the volatile region, so that it is saved and restored on every
entry and exit into EL2. This is to prepare for future changes that
require enabling hcr_el2.TGE at every entry into EL2 so that hafnium can
execute in "host" mode when FEAT_VHE is enabled and available.
Change-Id: I1e4570ee07df70eb1b608ad8b26a791bf9a50f2a
Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com>
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 368b38d..414167f 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -260,9 +260,9 @@
static void set_virtual_irq(struct arch_regs *r, bool enable)
{
if (enable) {
- r->lazy.hcr_el2 |= HCR_EL2_VI;
+ r->hcr_el2 |= HCR_EL2_VI;
} else {
- r->lazy.hcr_el2 &= ~HCR_EL2_VI;
+ r->hcr_el2 &= ~HCR_EL2_VI;
}
}
@@ -271,14 +271,14 @@
*/
static void set_virtual_irq_current(bool enable)
{
- uintreg_t hcr_el2 = read_msr(hcr_el2);
+ uintreg_t hcr_el2 = current()->regs.hcr_el2;
if (enable) {
hcr_el2 |= HCR_EL2_VI;
} else {
hcr_el2 &= ~HCR_EL2_VI;
}
- write_msr(hcr_el2, hcr_el2);
+ current()->regs.hcr_el2 = hcr_el2;
}
/**
@@ -288,9 +288,9 @@
static void set_virtual_fiq(struct arch_regs *r, bool enable)
{
if (enable) {
- r->lazy.hcr_el2 |= HCR_EL2_VF;
+ r->hcr_el2 |= HCR_EL2_VF;
} else {
- r->lazy.hcr_el2 &= ~HCR_EL2_VF;
+ r->hcr_el2 &= ~HCR_EL2_VF;
}
}
@@ -299,14 +299,14 @@
*/
static void set_virtual_fiq_current(bool enable)
{
- uintreg_t hcr_el2 = read_msr(hcr_el2);
+ uintreg_t hcr_el2 = current()->regs.hcr_el2;
if (enable) {
hcr_el2 |= HCR_EL2_VF;
} else {
hcr_el2 &= ~HCR_EL2_VF;
}
- write_msr(hcr_el2, hcr_el2);
+ current()->regs.hcr_el2 = hcr_el2;
}
#if SECURE_WORLD == 1