All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: maz@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com,
	yuzenghui@huawei.com, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.linux.dev, catalin.marinas@arm.com, will@kernel.org
Subject: Re: [PATCH v2 1/2] KVM: arm64: VHE: Initialize PMSCR_EL1
Date: Wed, 3 Sep 2025 23:55:00 -0700	[thread overview]
Message-ID: <aLk3xLd8ylxP63hH@linux.dev> (raw)
In-Reply-To: <20250902130833.338216-2-alexandru.elisei@arm.com>

On Tue, Sep 02, 2025 at 02:08:32PM +0100, Alexandru Elisei wrote:
> diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c
> index 381382c19fe4..e7ce0d5a622d 100644
> --- a/arch/arm64/kvm/debug.c
> +++ b/arch/arm64/kvm/debug.c
> @@ -74,13 +74,19 @@ void kvm_init_host_debug_data(void)
>  	*host_data_ptr(debug_brps) = SYS_FIELD_GET(ID_AA64DFR0_EL1, BRPs, dfr0);
>  	*host_data_ptr(debug_wrps) = SYS_FIELD_GET(ID_AA64DFR0_EL1, WRPs, dfr0);
>  
> +	if (cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_EL1_PMSVer_SHIFT) &&
> +	    !(read_sysreg_s(SYS_PMBIDR_EL1) & PMBIDR_EL1_P)) {
> +		if (has_vhe()) {
> +			/* Clear E{0,1}SPE, which reset to UNKNOWN values. */
> +			write_sysreg_el1(0, SYS_PMSCR);
> +		} else {
> +			host_data_set_flag(HAS_SPE);
> +		}
> +	}
> +

nit: While this is correct, from a code organization perspective it
doesn't belong here. The rest of this function is concerned with probing
hardware state and initializing the corresponding host data.

I prefer Marc's suggestion which could be wrapped up in a function called
'kvm_debug_init_vhe()' or similar.

Thanks,
Oliver

  reply	other threads:[~2025-09-04  7:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02 13:08 [PATCH v2 0/2] KVM: arm64: VHE: Debug fixes Alexandru Elisei
2025-09-02 13:08 ` [PATCH v2 1/2] KVM: arm64: VHE: Initialize PMSCR_EL1 Alexandru Elisei
2025-09-04  6:55   ` Oliver Upton [this message]
2025-09-04  9:30     ` Alexandru Elisei
2025-09-02 13:08 ` [PATCH v2 2/2] KVM: arm64: VHE: Save and restore host MDCR_EL2 value correctly Alexandru Elisei
2025-09-04  6:55   ` Oliver Upton
2025-09-05  9:41 ` [PATCH v2 0/2] KVM: arm64: VHE: Debug fixes Oliver Upton

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=aLk3xLd8ylxP63hH@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=alexandru.elisei@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.