Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1207147rdb; Mon, 19 Feb 2024 07:35:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWLSgZdJbJT5OHLd43OCoD5G84/nafMBCvPClkHSx95cJc7nbeK7lMQJkYctKWoiT/1Vx9kjiEnusSb7C9MXPVSz+lVD/SMmCc/SmXLRQ== X-Google-Smtp-Source: AGHT+IHbBNZ7nCpoZBO/gppj4ZeG67p0FbvpyVbWIM4N85BR8kEetMzrIjTYATQ7Ie59BRKAWnQH X-Received: by 2002:a05:6358:d090:b0:178:fb5d:46f6 with SMTP id jc16-20020a056358d09000b00178fb5d46f6mr8936401rwb.24.1708356950349; Mon, 19 Feb 2024 07:35:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708356950; cv=pass; d=google.com; s=arc-20160816; b=ZqTTi0xpiO1oH4CPV2rh3ZxWKqZnPBak9IFqqqXap+TijQKFvpylur9BnIZZFCV8YN aPcJ3kbvhEHX3JMy42G2r4ynDBlOidRHYmx2pf0AshAxhuWqrT5dQtM08CIqzWh4dOou FwJrdywxCEBmSLXEQf4WJZeSoVYjAEzfM7zGSvhF3PubW+j/yIXu0a0X68Uze8kMtX0C Qgs6nKxR+ouTeQ5rheUHpFEUz0gCJPbTzUnF0TODe9B53WxFS9zTMQhyv3EjmjkLcmUB rDGq6EUC+4ioC3nPuZFhUmouFuU61gU9sL4MAP5cHEqWoP31P7H8zKDmauAgdOUv26XX 2ZCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=S9nEBlq/XXqJAcnNSpgRDk3uKgg4nUMfbMnFaIFUpWM=; fh=JwW4n2G0rnEH0NtQ7dhRtDy3EcJJZLL0HCtyD6Ou82Y=; b=oG3+K/kFK+1xFbPCoZA4mGEynWOOwR2xWnlF3mFXepUQl5DBEsIL/KB9tRo1OPmkHs +ToAb3ts/vtevvLkBSQoj49ceKCQFoYyLVd2QVV+ojMbvm+Tyjjfml6MzyBR7tu9aw+0 JibONdAp3pB3J91yOIDjYnkjw2skpGY4w0FWBCpkaNmofcHHFgw8apuM0xAY3/r3ifm0 52ZqEBlltHJ0DkSoNwrJmTKkUXHNSlaXPkJXnM9cnHyK98gCAKCx2e4i5QsH3nZ1jBDF 9xyYr35wpFqr8QIA3ipn1VYzWn8cbjC4EvKyDxDI+/kGqII8aA8I8PMyYE2C4Psw6fhi IVwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-71592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71592-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c4-20020ac853c4000000b0042dffb18260si4412656qtq.495.2024.02.19.07.35.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 07:35:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-71592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71592-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1B7061C216BB for ; Mon, 19 Feb 2024 15:35:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADA9038FA5; Mon, 19 Feb 2024 15:35:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BB36381CE; Mon, 19 Feb 2024 15:35:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708356924; cv=none; b=dqvLQn4HDkIkpqp/hxQcNBQjlLXhpNpTxRSUzcCc9DDSxxw1wkcvSE6bDSDJ2p0SxX+eHUwH24R7t5GifGvbqfo74cwbP9HcwkXn11udyrCXqHYpXVVmueBWicO4s+gnvWNB8MVBgZxHQQGqayKiMA3jC20kG/JR8I6LWx76J18= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708356924; c=relaxed/simple; bh=gWExRT6udu7I7jl7GjueXlupno17y2YrXS0ghER5g9c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q+yeL6exu54Ak51Gma/ZefyQgj4xTzKlpLCoOSS5na9FDCskYqv7nfA3pu0EMJ1YKsrWUipJe0v334QztYtgPYAjDQ09I2egJgeZz1wQvgXEsSNmKWob8wcUgj78eWzJfjqfAMMlLE4/3FA+UJwQ/K3yTNs3dordZV6wX0rwN1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A15CEFEC; Mon, 19 Feb 2024 07:35:57 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.64.104]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7E8103F762; Mon, 19 Feb 2024 07:35:16 -0800 (PST) Date: Mon, 19 Feb 2024 15:35:08 +0000 From: Mark Rutland To: Marc Zyngier Cc: Catalin Marinas , Stephen Rothwell , Christoffer Dall , Will Deacon , Ard Biesheuvel , Linux Kernel Mailing List , Linux Next Mailing List , Oliver Upton Subject: Re: linux-next: manual merge of the kvm-arm tree with the arm64 tree Message-ID: References: <20240219135805.1c4138a3@canb.auug.org.au> <86bk8c4gyh.wl-maz@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86bk8c4gyh.wl-maz@kernel.org> On Mon, Feb 19, 2024 at 03:22:14PM +0000, Marc Zyngier wrote: > From f24638a5f41424faf47f3d9035e6dcbd3800fcb6 Mon Sep 17 00:00:00 2001 > From: Marc Zyngier > Date: Mon, 19 Feb 2024 15:13:22 +0000 > Subject: [PATCH] arm64: Use Signed/Unsigned enums for TGRAN{4,16,64} and > VARange > > Open-coding the feature matching parameters for LVA/LVA2 leads to > issues with upcoming changes to the cpufeature code. > > By making TGRAN{4,16,64} and VARange signed/unsigned as per the > architecture, we can use the existing macros, making the feature > match robust against those changes. > > Signed-off-by: Marc Zyngier I think this is the right thing to do; the patch itself looks good to me, so FWIW: Acked-by: Mark Rutland Mark. > --- > arch/arm64/kernel/cpufeature.c | 15 +++------------ > arch/arm64/tools/sysreg | 8 ++++---- > 2 files changed, 7 insertions(+), 16 deletions(-) > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index 8f9665e8774b..2119e9dd0c4e 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -2791,24 +2791,15 @@ static const struct arm64_cpu_capabilities arm64_features[] = { > .capability = ARM64_HAS_VA52, > .type = ARM64_CPUCAP_BOOT_CPU_FEATURE, > .matches = has_cpuid_feature, > - .field_width = 4, > #ifdef CONFIG_ARM64_64K_PAGES > .desc = "52-bit Virtual Addressing (LVA)", > - .sign = FTR_SIGNED, > - .sys_reg = SYS_ID_AA64MMFR2_EL1, > - .field_pos = ID_AA64MMFR2_EL1_VARange_SHIFT, > - .min_field_value = ID_AA64MMFR2_EL1_VARange_52, > + ARM64_CPUID_FIELDS(ID_AA64MMFR2_EL1, VARange, 52) > #else > .desc = "52-bit Virtual Addressing (LPA2)", > - .sys_reg = SYS_ID_AA64MMFR0_EL1, > #ifdef CONFIG_ARM64_4K_PAGES > - .sign = FTR_SIGNED, > - .field_pos = ID_AA64MMFR0_EL1_TGRAN4_SHIFT, > - .min_field_value = ID_AA64MMFR0_EL1_TGRAN4_52_BIT, > + ARM64_CPUID_FIELDS(ID_AA64MMFR0_EL1, TGRAN4, 52_BIT) > #else > - .sign = FTR_UNSIGNED, > - .field_pos = ID_AA64MMFR0_EL1_TGRAN16_SHIFT, > - .min_field_value = ID_AA64MMFR0_EL1_TGRAN16_52_BIT, > + ARM64_CPUID_FIELDS(ID_AA64MMFR0_EL1, TGRAN16, 52_BIT) > #endif > #endif > }, > diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tools/sysreg > index fa3fe0856880..670a33fca3bc 100644 > --- a/arch/arm64/tools/sysreg > +++ b/arch/arm64/tools/sysreg > @@ -1540,16 +1540,16 @@ Enum 35:32 TGRAN16_2 > 0b0010 IMP > 0b0011 52_BIT > EndEnum > -Enum 31:28 TGRAN4 > +SignedEnum 31:28 TGRAN4 > 0b0000 IMP > 0b0001 52_BIT > 0b1111 NI > EndEnum > -Enum 27:24 TGRAN64 > +SignedEnum 27:24 TGRAN64 > 0b0000 IMP > 0b1111 NI > EndEnum > -Enum 23:20 TGRAN16 > +UnsignedEnum 23:20 TGRAN16 > 0b0000 NI > 0b0001 IMP > 0b0010 52_BIT > @@ -1697,7 +1697,7 @@ Enum 23:20 CCIDX > 0b0000 32 > 0b0001 64 > EndEnum > -Enum 19:16 VARange > +UnsignedEnum 19:16 VARange > 0b0000 48 > 0b0001 52 > EndEnum > -- > 2.39.2 > > > -- > Without deviation from the norm, progress is not possible.