Repository navigation
arm64: apple: Ask a hypervisor about IMPDEF registers only over HVC - #910
Merged
RyanTheTide merged 1 commit intoNov 5, 2026
Merged
RyanTheTide merged 1 commit into
RyanTheTide merged 1 commit into
Conversation
has_apple_apflg() and has_apple_afp() require an Aurora vendor hypervisor feature whenever the kernel runs below EL2, so that KVM, which traps IMPLEMENTATION DEFINED registers through HCR_EL2.TIDCP, does not give a guest an UNDEF at its first exception. On M4 machines aura stays at EL2 as a monitor and enters Linux at EL1 with PSCI over SMC, or with no PSCI and no SMCCC conduit on older builds. The vendor hypervisor services are only discovered from KVM, so APFLG is never detected there, although nothing traps ASPSR_EL1. KVM guests call through HVC, so ask only over that conduit. AMX keeps its check: at EL1 it also needs EL2 to set AMX_CTL_EL2.EN_EL1. Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
AxxzyWasTaken
force-pushed
the
apple-impdef-el1
branch
from
November 3, 2026 22:51
d0e10fd to
f69ad7f
Compare
Contributor
|
Merge train (MTL, 06/11). Gates passed on test tree 0412501d (integration/aurora 2661d71 + this batch):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
has_apple_apflg()andhas_apple_afp()(#868, #869) ask the hypervisor whether it emulates ASPSR_EL1 / AFPCR_EL0 whenever the kernel isn't in hyp mode. That's right under KVM, which traps IMPDEF registers through HCR_EL2.TIDCP. But on M4 machines aura stays at EL2 as a monitor and enters Linux at EL1 with PSCI over SMC (monitor_required()inkboot.c, SMCCC 1.2), or with no PSCI and conduit NONE on older aura builds. The vendor services are only discovered from KVM, sokvm_arm_hyp_service_available()is always false, and APFLG is never detected, although nothing traps ASPSR_EL1 there.This asks only over the HVC conduit, which is what KVM guests use. Anywhere else there's no hypervisor to answer, so the existing AIDR_EL1 and "enable bit sticks" checks decide. Guests with an HVC conduit (KVM) behave as before. AMX keeps its check: at EL1 it also needs EL2 to set AMX_CTL_EL2.EN_EL1.
Testing (J616C, M4 Max, EL1 under aura's monitor,
kvm: HYP mode not available, no psci node)The same check on our 7.2.10 J616C tree (the merged #868 plus the first version of this, which tested for conduit NONE). That boot used an older aura with no
/psci, where both versions give the same answer:CPU features: detected: x86 parity and adjust flags (Apple APFLG),apple_apflgon all 14 CPUs in /proc/cpuinfo,AT_HWCAP3: 0x8000000000000000. Without it the hypervisor check fails here (no vendor services are discovered), and HWCAP3 stays 0.PR_AURORA_SET_X86_FLAGSin 64 threads (14 CPUs), writes PF/AF through NZCV, then spins or makes a syscall and reads them back: 0 mismatches in 12.8M rounds. Threads that didn't turn it on read PF/AF as 0.AFP isn't testable here: the ACTLR enable bit doesn't stick on this M4 Max, so it stays off either way.
Not booted: current aura main, with its PSCI over SMC. That case comes from reading
psci.candkboot.cin aura, and it's why the check is now!= SMCCC_CONDUIT_HVC: the first version would have left APFLG off there.On integration/aurora: builds with
W=1and no warnings with APFLG/AFP on and off, and checkpatch is clean.