Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Colton Lewis" <coltonlewis@google.com>
Cc: "Oliver Upton" <oupton@kernel.org>,
	kvmarm@lists.linux.dev, "Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH 6.6 v3 4/6] KVM: arm64: Initialize HCR_EL2.E2H early
Date: Thu, 09 Jul 2026 22:46:58 +0000	[thread overview]
Message-ID: <20260709224658.8FCA61F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260709223604.12934-5-coltonlewis@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Preexisting sysreg write paths in `___kvm_hyp_init` and `init_el2_state` macros omit the architecturally required `isb` immediately after writing control-plane system registers.
--

--- Patch [4]: [PATCH 6.6 v3 4/6] KVM: arm64: Initialize HCR_EL2.E2H early ---
(Note: The format of this report is altered to provide a free-form summary instead of quoting the patch code directly, due to recitation restrictions.)

commit 726047e1aa205da54b261630927b54303540481f
Author: Mark Rutland <mark.rutland@arm.com>

KVM: arm64: Initialize HCR_EL2.E2H early

This commit initializes HCR_EL2.E2H early in KVM PSCI entry points to avoid
consuming an uninitialized value on CPUs without FEAT_E2H0. It factors out
existing head.S logic into a new init_el2_hcr macro.

Link: https://lore.kernel.org/r/20250227180526.1204723-2-mark.rutland@arm.com

[Severity: High]
This isn't a bug introduced by this patch, but there appears to be a
pre-existing issue with missing context synchronization events in the EL2
initialization paths.

In arch/arm64/kvm/hyp/nvhe/hyp-init.S:___kvm_hyp_init, writes to mair_el2,
hcr_el2, and vttbr_el2 are followed by memory loads or other operations
without an immediate isb instruction.

Similarly, in arch/arm64/include/asm/el2_setup.h:__init_el2_hcrx, the write
to SYS_HCRX_EL2 is followed by a branch rather than an isb. Also, in
__init_el2_timers within the same file, cnthctl_el2 and cntvoff_el2 are
written consecutively without an isb between or immediately after them.

Could this cause the CPU to execute subsequent instructions under a stale
architectural configuration, potentially leading to unpredictable behavior
or unexpected traps during hypervisor setup?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709223604.12934-1-coltonlewis@google.com?part=4

  reply	other threads:[~2026-07-09 22:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 22:35 [PATCH 6.6 v3 0/6] arm64: KVM: Backport VHE-only boot fixes Colton Lewis
2026-07-09 22:35 ` [PATCH 6.6 v3 1/6] arm64: sysreg: Add layout for ID_AA64MMFR4_EL1 Colton Lewis
2026-07-09 22:35 ` [PATCH 6.6 v3 2/6] arm64: Treat HCR_EL2.E2H as RES1 when ID_AA64MMFR4_EL1.E2H0 is negative Colton Lewis
2026-07-09 22:45   ` sashiko-bot
2026-07-09 22:36 ` [PATCH 6.6 v3 3/6] arm64: Fix early handling of FEAT_E2H0 not being implemented Colton Lewis
2026-07-09 22:46   ` sashiko-bot
2026-07-09 22:36 ` [PATCH 6.6 v3 4/6] KVM: arm64: Initialize HCR_EL2.E2H early Colton Lewis
2026-07-09 22:46   ` sashiko-bot [this message]
2026-07-09 22:36 ` [PATCH 6.6 v3 5/6] KVM: arm64: Initialize SCTLR_EL1 in __kvm_hyp_init_cpu() Colton Lewis
2026-07-09 22:36 ` [PATCH 6.6 v3 6/6] arm64: Revamp HCR_EL2.E2H RES1 detection Colton Lewis
2026-07-10 21:03 ` [PATCH 6.6 v3 0/6] arm64: KVM: Backport VHE-only boot fixes Sasha Levin
2026-07-13 22:07   ` Colton Lewis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260709224658.8FCA61F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=coltonlewis@google.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox