Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1087805lqb; Wed, 17 Apr 2024 22:38:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXy4uHPDL6IMUwmQ0B5QFXVBbnyMMpxRxY5/HG4zQ/FKybFkxeOSBfBoKsM5BnZPtWOUSpHuSIz387UgKb5WD3CAH+kD3NBlXfzX8IsEA== X-Google-Smtp-Source: AGHT+IHeXqRIhQg1gJqrfM0KDs+LMA2VdxfSj1hes2wXWohTmc5yaM0JF5j56ltrH4BVV8B9Sz/4 X-Received: by 2002:a17:902:ccc4:b0:1e2:c334:159 with SMTP id z4-20020a170902ccc400b001e2c3340159mr2260789ple.22.1713418716300; Wed, 17 Apr 2024 22:38:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713418716; cv=pass; d=google.com; s=arc-20160816; b=0mVLG2uMB+xRjOoiTX6JNTNo6JgRn9nidUbu0WXJkgT6p0YT6mVfqSzC/bl9nP0ZkK yN/IThQQ6amkAnHMx06PilvTDY87PakdB+qQLYbaa25cAO7VzGlyLgqJiu9LXAOA57Gj 1llglBYqWh9fgas/fvw+nL4qAR4GxjFKGz8+3LO4ezbeAWiVNORJ/7AKj50UYWmsFKis nxyeOIk24BJXiUr/5CHGkXR84N476HR0DE2tB3yQVgHc3y4bxztEajfoeCNR99ikLNTA CELMRShuWfzVjKbfu+HPSU8aC3w/tOv9UQZ8IVbfQBIqgUZB2TMe08vVSzDwbbiSyG3l brlw== 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=BpzkBleMarbXrzyZQ4yAWEH/hAE6BQeLm6NOlCHL8x0=; fh=1cp3dBvmytgES91U02zFrI9+gb+d125d380dlajTxVo=; b=ZrsphNGJ8LvHQzzWROKBewWakEzQiI6ytZxKPDup+NECTxOME9A6vMZlMbr0YZuhV8 JaGofpibcaPQqUMZ3CRv1jdktaQM4eq9DnbqSXupUPem1IdPqLtz/jpXLqMqKpMu4oxh Zu8gO+S4gQl0ECt4bsfUC2WYI3nhm6svJsVEd2qV3Os3cbr4x/CG1w5+lBfgCHvaEBnO ZDJuTDPGb3ejqX2OuB6IX0W/HQjzfOD9DXP6MsE2MNBwS9VMoAa01HtfOPiue2/K2vk2 WgbrApY3xCracKZZlJXIgnnlsh3jzgjR+LynDPXLFzMypSUp9Id/XLyBFijsFfMQcHR6 6ooA==; 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-149529-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149529-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o8-20020a170902d4c800b001e49bce914asi778417plg.429.2024.04.17.22.38.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 22:38:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149529-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-149529-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149529-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E8321282CB1 for ; Thu, 18 Apr 2024 05:38:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99A6C58119; Thu, 18 Apr 2024 05:38:27 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BDD21755B for ; Thu, 18 Apr 2024 05:38:24 +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=1713418707; cv=none; b=EU4gfMsBvClWXXEWurAI6I8m7jKzHv0RmJxJzLx6HjwNoTTvuirb19sQ7HseYUpB8/xGx+zhPYXXHzuYvTGI7rYcKNry8glGX1roRMp05wUloe4+KTfEPI0S1SZmvMn1FJK5eInuU8Kwr7AmvIwgPunrKJQGKLEoMgZoCDUEYCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713418707; c=relaxed/simple; bh=p4ZBSPDbE2nW6K1Ts3TieiUCROkQrl5qpQuS3vATpi0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eLNwLZYU/seTCaOVwlDGZrjSzZ24Rjo9HOjZReT3tZxf7D5A/etroPS1MKTQQjhPvbHd8iAnXyH0bvR0aGjeys51WW2JwrQTy3Df0mos6IrPrxUORGGD2d1GkJ5uKiAqjdYrY6CNsjJrmvi2vppu8xxFv51qRr4pc5kEBG3S1Wg= 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 57E18DA7; Wed, 17 Apr 2024 22:38:51 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.60.115]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 69B543F792; Wed, 17 Apr 2024 22:38:19 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com Cc: Anshuman Khandual , Marc Zyngier , Oliver Upton , Will Deacon , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 Date: Thu, 18 Apr 2024 11:08:03 +0530 Message-Id: <20240418053804.2573071-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240418053804.2573071-1-anshuman.khandual@arm.com> References: <20240418053804.2573071-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 | 8 ++++---- arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 ++-- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +- 3 files changed, 7 insertions(+), 7 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..0034bfffced6 100644 --- a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h +++ b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h @@ -52,10 +52,10 @@ * 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_EL0), ID_AA64PFR0_EL1_EL0_IMP) | \ + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_EL1_IMP) | \ + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_EL2_IMP) | \ + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_EL3_IMP) | \ FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_RAS), 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.25.1