Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp50414lqs; Thu, 13 Jun 2024 03:37:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVte29AbjKvRymQccbOxkz0RbtRBCj0tdBWegpRFPvaCsA3AwPYJuEOHAIvfRK9Pmygxch0lMfzkOwWw8YqzM97aeA2dBdR1JO9XVtjFA== X-Google-Smtp-Source: AGHT+IHH6Vfgcjp0VaiLVnArA1UbzuHVvzXKZWOrvSPgvyWJCOgZ5hxjytMcPyIaBJ9N54pdaee5 X-Received: by 2002:a05:6a00:3cc6:b0:705:b922:2810 with SMTP id d2e1a72fcca58-705bcee36b8mr5349997b3a.28.1718275040065; Thu, 13 Jun 2024 03:37:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718275040; cv=pass; d=google.com; s=arc-20160816; b=aKy/wdRqFFu4qC+zZld2W4vFqDZQpbWs/8/FFL1lUY7lWKcrw4rRnpbWkn6mgLPH67 gZrhCY54qM1ToieNUnxj3tYpR4j3jz0E2kxWfGxXrqaa7tQqugSA7YOCm3HOrhhrqTlC es/y0d0ZCP3XbIIc2D/+nyot12kIUy7/jYSC9481tZ7+XItouYQGJPsp7lHnmJHJ/cx/ 2bb9fqStHnkclqiuiXllltap4/cuJ4mVegkh+p6lA95fdZPhCiqZfpqDight+lYzRHUL 9X5jIcWOgaMBxV7BzySyoX9HycztNJ047JkSHu8uGHzSe0NUadV5ZCGubgomcNrev89q pBnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=E72qYLmyn9AoErsGH99NfgKxvenyGopF7+6O21uM+g8=; fh=/WAp9dpV8024iaPSX0mEjJhlFOBnhDdhC5A7HVrImm8=; b=Aq8wQlUH4kt+K+6lMasrr+QBjTpeyds7GYk1V0nIRfgKwH1GQ29gftXO58WO3DUMSU qkItib1e5TmG8Dy12CvZ3HzIkVeJ2RCz4lRTz7NqCf2ZFWYlgbpdrVdbQTIan1fGcmBS 9gidGfwTDO5/xsP+qAWLjmwgsIWwaTHkobjFGUqXr4WmjA0zYVJ8nvt3MHqOMHH1ICOL XKF3lscQ4f9BcVMmyVWAgSW60ArXqfQPj+hkGot7sCOCSkcaWFxvVClGxQ7MZwDPDYeU 5ljq0GYPLaiztS0I87q6UDke4vOe+HyuzD6rzewsrxddPDgf7gGuY8Ny8bqGnSEZhWcT EEXA==; 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-213022-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fedd5e8e1bsi1040598a12.161.2024.06.13.03.37.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 03:37:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213022-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; 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-213022-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213022-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5A2B0B21CD8 for ; Thu, 13 Jun 2024 10:27:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4155D1428EC; Thu, 13 Jun 2024 10:27:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B7341428E0 for ; Thu, 13 Jun 2024 10:27:25 +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=1718274446; cv=none; b=EZerKai8G9n0a+qyoIRvrj53XBkC9zC0s+pU5wgXy5imcky04iH6myHFxTkolfnBYx5zNKOCXCTYOsSrHnscXXb+D5lj4F0ptTLUMWnt9zPBWL/7ENrhzBLRSdf+vCR/Fo4KNQPgIHJVdKmAmREkr0HZ9O8Ij7cEtxewn/O57o8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718274446; c=relaxed/simple; bh=dTKmwEKAj9gD/2+0/9oNTSzv1cgKOsCjl/Z5hSuHaqU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MfgMlDC6VSrkGispulCr00/LoMGAMfvPyjKbLT8CGFVO4fTXSxnRm7uxUxH56nt/m8ob3VwX3B2Y9MSLggWYhoWUZQ9iEmG2rAryK1NHRRrezoWjFM38hO/fVIZ0sZfVNOChpseZedjhpzljPsdh1B1ODRLjrDJwe4Yjw//EJr0= 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 2F1AE1063; Thu, 13 Jun 2024 03:27:49 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.44.128]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E8B033F5A1; Thu, 13 Jun 2024 03:27:20 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: mark.rutland@arm.com, ryan.roberts@arm.com, Anshuman Khandual , Marc Zyngier , Oliver Upton , Catalin Marinas , Will Deacon , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH V2 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 Date: Thu, 13 Jun 2024 15:57:09 +0530 Message-Id: <20240613102710.3295108-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613102710.3295108-1-anshuman.khandual@arm.com> References: <20240613102710.3295108-1-anshuman.khandual@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This replaces custom macros usage (i.e ID_AA64PFR0_EL1_ELx_64BIT_ONLY and ID_AA64PFR0_EL1_ELx_32BIT_64BIT) and instead directly uses register fields from ID_AA64PFR0_EL1 sysreg definition. Cc: Marc Zyngier Cc: Oliver Upton Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: kvmarm@lists.linux.dev Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 10 +++++----- arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 ++-- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h index 51f043649146..f957890c7e38 100644 --- a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h +++ b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h @@ -52,11 +52,11 @@ * Supported by KVM */ #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_RAS), ID_AA64PFR0_EL1_RAS_IMP) \ + SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL0, IMP) | \ + SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL1, IMP) | \ + SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL2, IMP) | \ + SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL3, IMP) | \ + SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, RAS, IMP) \ ) /* diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c index 26dd9a20ad6e..58da2fec89b2 100644 --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c @@ -31,9 +31,9 @@ static void pvm_init_traps_aa64pfr0(struct kvm_vcpu *vcpu) /* Protected KVM does not support AArch32 guests. */ BUILD_BUG_ON(FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), - PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) != ID_AA64PFR0_EL1_ELx_64BIT_ONLY); + PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) != ID_AA64PFR0_EL1_EL0_IMP); BUILD_BUG_ON(FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), - PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) != ID_AA64PFR0_EL1_ELx_64BIT_ONLY); + PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) != ID_AA64PFR0_EL1_EL1_IMP); /* * Linux guests assume support for floating-point and Advanced SIMD. Do diff --git a/arch/arm64/kvm/hyp/nvhe/sys_regs.c b/arch/arm64/kvm/hyp/nvhe/sys_regs.c index edd969a1f36b..2860548d4250 100644 --- a/arch/arm64/kvm/hyp/nvhe/sys_regs.c +++ b/arch/arm64/kvm/hyp/nvhe/sys_regs.c @@ -276,7 +276,7 @@ static bool pvm_access_id_aarch32(struct kvm_vcpu *vcpu, * of AArch32 feature id registers. */ BUILD_BUG_ON(FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), - PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) > ID_AA64PFR0_EL1_ELx_64BIT_ONLY); + PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) > ID_AA64PFR0_EL1_EL1_IMP); return pvm_access_raz_wi(vcpu, p, r); } -- 2.30.2