From patchwork Tue Jun 4 13:05:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13685272 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01C5DC25B7E for ; Tue, 4 Jun 2024 13:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z/MieCh6YzHO+YupiTqsYEn0J4mt06brmSN9BP2SV4s=; b=acgu2wmnEnRcRJ Xq9rKl9LM7KBqyYTOpmKen47wGFzocB38siVkR6txAEi4kxebXkb3QsbF1vmhBKZ+Bt7r5BiejvOA trOtWOOWTq7EOJY7DmTkOL7tgxMTDYQ73jEriSv9u64XczIW9rxfycICOmlQnGRFwihCRdPDAj7Sm G+21ykMTyvPrSB3vFRMjmjgWGX7AN2j/+jQo4NjZN/NTnDPW6Y8ntDV3LCzu1FSb9hagt5Mbw5mRB lpyXi6vnvU1wE/bHjKQx4KY49MHpN4rBqxbNgGTFQsGgHbOoR6P3mQmpGeBjp1QE4AsT3MuOm6DtQ G/L0RlECpyIimZdzSakQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETrX-00000002R58-1b4Y; Tue, 04 Jun 2024 13:06:03 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETrU-00000002R3M-2yFZ for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2024 13:06:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F0C7461290; Tue, 4 Jun 2024 13:05:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A83D7C4AF08; Tue, 4 Jun 2024 13:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717506359; bh=G9+RYxAFA/FJOBMWD/iuYRQjJ3+UABCuHbLX2dHhEeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lEUSHHYYs3XCTsetJoEv7av+D730xRT1Gnyak/mIy0NA/xCwlFIhDh5wZLnVFXZyR no12BTtjQPRBuN3VwcjrHEtr80dYZXwkfnx4YnFJrU3obXJoG+vP53aCCmqq6L6Zah AKu0NmtUXfSFKfSkFkz+F2JRSoghRBpL34IaX16qv6QJnljeazgrne4nw9DRJ7t+ed vcG+/lBJ55WKhWGoECMJcz19FX6uJtLt1rVmGOgMTJ4f6lTIXNobHpIuZInyfBTtCA TMAFSSDFDNP6Jk4dm/t88ELRqDFfdNzeq+Cgtk/Lt9y88/meYSeet/OboaIjbBH4Lj FcdajbiS5yvVw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sETrR-000ZSS-Je; Tue, 04 Jun 2024 14:05:57 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly Subject: [PATCH 1/4] KVM: arm64: nv: Add TCPAC/TTA to CPTR->CPACR conversion helper Date: Tue, 4 Jun 2024 14:05:50 +0100 Message-Id: <20240604130553.199981-2-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604130553.199981-1-maz@kernel.org> References: <20240604130553.199981-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_060600_826199_E6423816 X-CRM114-Status: GOOD ( 12.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We are missing the propagation of CPTR_EL2.{TCPAC,TTA} into the CPACR format. Make sure we preserve these bits. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_nested.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_nested.h b/arch/arm64/include/asm/kvm_nested.h index 5d55f76254c3..07cf6c64f0d0 100644 --- a/arch/arm64/include/asm/kvm_nested.h +++ b/arch/arm64/include/asm/kvm_nested.h @@ -32,7 +32,7 @@ static inline u64 translate_tcr_el2_to_tcr_el1(u64 tcr) static inline u64 translate_cptr_el2_to_cpacr_el1(u64 cptr_el2) { - u64 cpacr_el1 = 0; + u64 cpacr_el1 = CPACR_ELx_RES1; if (cptr_el2 & CPTR_EL2_TTA) cpacr_el1 |= CPACR_ELx_TTA; @@ -41,6 +41,8 @@ static inline u64 translate_cptr_el2_to_cpacr_el1(u64 cptr_el2) if (!(cptr_el2 & CPTR_EL2_TZ)) cpacr_el1 |= CPACR_ELx_ZEN; + cpacr_el1 |= cptr_el2 & (CPTR_EL2_TCPAC | CPTR_EL2_TAM); + return cpacr_el1; }