From: Ulrich Wulff <[email protected]>

Set the HCR_EL2.FB during startup. Clear it after cell creation and CPU
reset.

Signed-off-by: Ulrich wulff <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
 hypervisor/arch/arm64/control.c | 1 +
 hypervisor/arch/arm64/setup.c   | 2 +-
 hypervisor/control.c            | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/hypervisor/arch/arm64/control.c b/hypervisor/arch/arm64/control.c
index 5b41b39363cde..99283cbff1106 100644
--- a/hypervisor/arch/arm64/control.c
+++ b/hypervisor/arch/arm64/control.c
@@ -81,6 +81,7 @@ void arm_cpu_reset(unsigned long pc, bool aarch32)
                arm_write_sysreg(SPSR_EL2, RESET_PSR_AARCH64);
                hcr_el2 |= HCR_RW_BIT;
        }
+       hcr_el2 &= ~HCR_FB_BIT;
        arm_write_sysreg(HCR_EL2, hcr_el2);
 
        arm_write_sysreg(ELR_EL2, pc);
diff --git a/hypervisor/arch/arm64/setup.c b/hypervisor/arch/arm64/setup.c
index 376648e3f1d4f..dbcba6691729a 100644
--- a/hypervisor/arch/arm64/setup.c
+++ b/hypervisor/arch/arm64/setup.c
@@ -47,7 +47,7 @@ int arch_init_early(void)
 int arch_cpu_init(struct per_cpu *cpu_data)
 {
        unsigned long hcr = HCR_VM_BIT | HCR_IMO_BIT | HCR_FMO_BIT
-                               | HCR_TSC_BIT | HCR_TAC_BIT | HCR_RW_BIT;
+                               | HCR_TSC_BIT | HCR_TAC_BIT | HCR_RW_BIT | 
HCR_FB_BIT;
        int err;
 
        /* link to ID-mapping of trampoline page */
diff --git a/hypervisor/control.c b/hypervisor/control.c
index 2214406fe0acf..bb54b01fdead9 100644
--- a/hypervisor/control.c
+++ b/hypervisor/control.c
@@ -413,11 +413,17 @@ static int cell_create(struct per_cpu *cpu_data, unsigned 
long config_address)
        struct unit *unit;
        void *cfg_mapping;
        int err;
+       u64 hcr_el2;
 
        /* We do not support creation over non-root cells. */
        if (cpu_data->public.cell != &root_cell)
                return -EPERM;
 
+       /* reset the FB bit in HCR_EL2 */
+       arm_read_sysreg(HCR_EL2, hcr_el2);
+       hcr_el2 &= ~HCR_FB_BIT;
+       arm_write_sysreg(HCR_EL2, hcr_el2);
+
        cell_suspend(&root_cell);
 
        if (!cell_reconfig_ok(NULL)) {
-- 
2.40.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20230602074808.1383333-2-bigeasy%40linutronix.de.

Reply via email to