[PATCH 2/2] target/arm: hvf: stubbing reads to LORC_EL1

Mohamed Mediouni posted 2 patches 3 months, 3 weeks ago
Maintainers: Alexander Graf <agraf@csgraf.de>, Mads Ynddal <mads@ynddal.dk>, Peter Maydell <peter.maydell@linaro.org>
[PATCH 2/2] target/arm: hvf: stubbing reads to LORC_EL1
Posted by Mohamed Mediouni 3 months, 3 weeks ago
Linux zeroes LORC_EL1 on boot at EL2, without further interaction with FEAT_LOR afterwards.

Stub out LORC_EL1 accesses as FEAT_LOR is a mandatory extension on Armv8.1+.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
 target/arm/hvf/hvf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 4331a3386a..2730c9793d 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -186,6 +186,7 @@ void hvf_arm_init_debug(void)
 #define SYSREG_OSLAR_EL1      SYSREG(2, 0, 1, 0, 4)
 #define SYSREG_OSLSR_EL1      SYSREG(2, 0, 1, 1, 4)
 #define SYSREG_OSDLR_EL1      SYSREG(2, 0, 1, 3, 4)
+#define SYSREG_LORC_EL1       SYSREG(3, 0, 10, 4, 3)
 #define SYSREG_CNTPCT_EL0     SYSREG(3, 3, 14, 0, 1)
 #define SYSREG_CNTP_CTL_EL0   SYSREG(3, 3, 14, 2, 1)
 #define SYSREG_PMCR_EL0       SYSREG(3, 3, 9, 12, 0)
@@ -1657,6 +1658,9 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)
     case SYSREG_OSDLR_EL1:
         /* Dummy register */
         return 0;
+    case SYSREG_LORC_EL1:
+        /* Dummy register */
+        return 0;
     case SYSREG_ICC_AP0R0_EL1:
     case SYSREG_ICC_AP0R1_EL1:
     case SYSREG_ICC_AP0R2_EL1:
-- 
2.39.5 (Apple Git-154)
Re: [PATCH 2/2] target/arm: hvf: stubbing reads to LORC_EL1
Posted by Peter Maydell 3 months, 3 weeks ago
On Mon, 21 Jul 2025 at 16:29, Mohamed Mediouni <mohamed@unpredictable.fr> wrote:
>
> Linux zeroes LORC_EL1 on boot at EL2, without further interaction with FEAT_LOR afterwards.
>
> Stub out LORC_EL1 accesses as FEAT_LOR is a mandatory extension on Armv8.1+.
>
> Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
> ---
>  target/arm/hvf/hvf.c | 4 ++++
>  1 file changed, 4 insertions(+)

Applied to target-arm.next, thanks (since it's a bugfix
even if it happens not to be triggered by Linux in normal
booting-into-EL1 config).

-- PMM