Hi,

On 15/1/26 05:50, Mohamed Mediouni wrote:
HVF traps accesses to CNTHCTL_EL2. For nested guests, HVF traps accesses to 
MDCCINT_EL1.
Pass through those accesses to the Hypervisor.framework library.

Signed-off-by: Mohamed Mediouni <[email protected]>

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
---
  target/arm/hvf/hvf.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index fe9b63bc76..fdfc8497b1 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -297,6 +297,10 @@ void hvf_arm_init_debug(void)
  #define SYSREG_DBGWVR15_EL1   SYSREG(2, 0, 0, 15, 6)
  #define SYSREG_DBGWCR15_EL1   SYSREG(2, 0, 0, 15, 7)
+/* EL2 registers */
+#define SYSREG_CNTHCTL_EL2    SYSREG(3, 4, 14, 1, 0)
+#define SYSREG_MDCCINT_EL1    SYSREG(2, 0, 0, 2, 0)
+
  #define WFX_IS_WFE (1 << 0)
#define TMR_CTL_ENABLE (1 << 0)
@@ -1289,6 +1293,12 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, 
uint64_t *val)
      case SYSREG_OSDLR_EL1:
          /* Dummy register */
          return 0;
+    case SYSREG_CNTHCTL_EL2:
+        assert_hvf_ok(hv_vcpu_get_sys_reg(cpu->accel->fd, 
HV_SYS_REG_CNTHCTL_EL2, val));
+        return 0;
I'm getting:

../target/arm/hvf/hvf.c:1264:59: error: 'HV_SYS_REG_CNTHCTL_EL2' is only available on macOS 15.0 or newer [-Werror,-Wunguarded-availability-new] 1264 | assert_hvf_ok(hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTHCTL_EL2, val)); | ^~~~~~~~~~~~~~~~~~~~~~ /Applications/Xcode_16.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Hypervisor.framework/Headers/hv_vcpu_types.h:312:5: note: 'HV_SYS_REG_CNTHCTL_EL2' has been marked as being introduced in macOS 15.0 here, but the deployment target is macOS 14.0.0 312 | HV_SYS_REG_CNTHCTL_EL2 API_AVAILABLE(macos(15.0)) API_UNAVAILABLE(ios, tvos) = 0xe708,
      |     ^


Reply via email to