Skip to content

Commit

Permalink
HACK: hvf: arm: Always treat SMC as enabled conduit
Browse files Browse the repository at this point in the history
The Windows 10 and 11 for ARM boot code implicitly assumes that SMC is a valid
SMCCC conduit to call for an OEM SMCCC call.

This patch forces HVF to treat SMC as an always active conduit, even when the
user has configured HVC. That way, the OEM SMCCC call gets handled as an
unimplemented SMCCC function (return -1) rather than an invalid conduit (inject
undefined instruction exception) which crashes Windows.

With this patch applied, I can successfully boot Windows for ARM Insider
Previews.

Signed-off-by: Alexander Graf <agraf@csgraf.de>
  • Loading branch information
agraf committed Dec 30, 2021
1 parent 44f28df commit e8ffde9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion target/arm/hvf/hvf.c
Expand Up @@ -61,6 +61,8 @@
#define TMR_CTL_IMASK (1 << 1)
#define TMR_CTL_ISTATUS (1 << 2)

static const bool windows_workaround_enabled = true;

static void hvf_wfi(CPUState *cpu);

typedef struct HVFVTimer {
Expand Down Expand Up @@ -1218,7 +1220,8 @@ int hvf_vcpu_exec(CPUState *cpu)
break;
case EC_AA64_SMC:
cpu_synchronize_state(cpu);
if (arm_cpu->psci_conduit == QEMU_PSCI_CONDUIT_SMC) {
if (windows_workaround_enabled ||
arm_cpu->psci_conduit == QEMU_PSCI_CONDUIT_SMC) {
advance_pc = true;

if (!hvf_handle_psci_call(cpu)) {
Expand Down

0 comments on commit e8ffde9

Please sign in to comment.