From: Will Deacon <will@kernel.org>
To: Marc Zyngier <maz@kernel.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
linux-arm-kernel@lists.infradead.org,
James Morse <james.morse@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Ard Biesheuvel <ardb@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
kvmarm@lists.cs.columbia.edu, linux-efi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64/mm: Fix __enable_mmu() for new TGRAN range values
Date: Tue, 9 Mar 2021 14:05:28 +0000 [thread overview]
Message-ID: <20210309140527.GB28395@willie-the-truck> (raw)
In-Reply-To: <8735x5zozr.wl-maz@kernel.org>
On Mon, Mar 08, 2021 at 02:42:00PM +0000, Marc Zyngier wrote:
> On Fri, 05 Mar 2021 14:36:09 +0000,
> Anshuman Khandual <anshuman.khandual@arm.com> wrote:
> > - switch (cpuid_feature_extract_unsigned_field(mmfr0, tgran_2)) {
> > - default:
> > - case 1:
> > + tgran_2 = cpuid_feature_extract_unsigned_field(mmfr0, tgran_2_shift);
> > + if (tgran_2 == ID_AA64MMFR0_TGRAN_2_SUPPORTED_NONE) {
> > kvm_err("PAGE_SIZE not supported at Stage-2, giving up\n");
> > return -EINVAL;
> > - case 0:
> > + } else if (tgran_2 == ID_AA64MMFR0_TGRAN_2_SUPPORTED_DEFAULT) {
> > kvm_debug("PAGE_SIZE supported at Stage-2 (default)\n");
> > - break;
> > - case 2:
> > + } else if (tgran_2 >= ID_AA64MMFR0_TGRAN_2_SUPPORTED_MIN &&
> > + tgran_2 <= ID_AA64MMFR0_TGRAN_2_SUPPORTED_MAX) {
> > kvm_debug("PAGE_SIZE supported at Stage-2 (advertised)\n");
> > - break;
> > + } else {
> > + kvm_err("Unsupported value, giving up\n");
> > + return -EINVAL;
>
> nit: this doesn't say *what* value is unsupported, and I really
> preferred the switch-case version, such as this:
>
> diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
> index 1f22b36a0eff..d267e4b1aec6 100644
> --- a/arch/arm64/kvm/reset.c
> +++ b/arch/arm64/kvm/reset.c
> @@ -312,15 +312,18 @@ int kvm_set_ipa_limit(void)
>
> switch (cpuid_feature_extract_unsigned_field(mmfr0, tgran_2)) {
> default:
> - case 1:
> + case ID_AA64MMFR0_TGRAN_2_SUPPORTED_NONE:
> kvm_err("PAGE_SIZE not supported at Stage-2, giving up\n");
> return -EINVAL;
> - case 0:
> + case ID_AA64MMFR0_TGRAN_2_SUPPORTED_DEFAULT:
> kvm_debug("PAGE_SIZE supported at Stage-2 (default)\n");
> break;
> - case 2:
> + case ID_AA64MMFR0_TGRAN_2_SUPPORTED_MIN ... ID_AA64MMFR0_TGRAN_2_SUPPORTED_MAX:
> kvm_debug("PAGE_SIZE supported at Stage-2 (advertised)\n");
> break;
> + default:
> + kvm_err("Unsupported value for TGRAN_2, giving up\n");
> + return -EINVAL;
> }
>
> kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange);
>
>
> Otherwise:
>
> Acked-by: Marc Zyngier <maz@kernel.org>
Anshuman -- please can you spin a v2 with the switch syntax as suggested
above by Marc?
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-03-09 14:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 14:36 [PATCH] arm64/mm: Fix __enable_mmu() for new TGRAN range values Anshuman Khandual
2021-03-05 14:51 ` Mark Rutland
2021-03-07 11:54 ` Anshuman Khandual
2021-03-08 13:30 ` Will Deacon
2021-03-08 15:03 ` Mark Rutland
2021-03-08 14:42 ` Marc Zyngier
2021-03-09 14:05 ` Will Deacon [this message]
2021-03-09 14:52 ` Anshuman Khandual
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=20210309140527.GB28395@willie-the-truck \
--to=will@kernel.org \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=suzuki.poulose@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).