Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp640542rwl; Thu, 23 Mar 2023 23:10:45 -0700 (PDT) X-Google-Smtp-Source: AKy350ZXDPzZ1m6ifrAM12sLenlu+gRvsmg/X3bawy4MUUQkshDxvScdE3XmYlRpRbR7sDZpwyne X-Received: by 2002:a17:906:ad98:b0:930:6d59:d1f8 with SMTP id la24-20020a170906ad9800b009306d59d1f8mr1459711ejb.10.1679638245628; Thu, 23 Mar 2023 23:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679638245; cv=none; d=google.com; s=arc-20160816; b=S1ZG+gMbFuS33ouDfWdxTqMjmvcTZ+3TodkEkQ5Cn1TP/NirNl/kRHrKfJInsv6WTF NGeqNEqgD0lFKlXmrLv8hwXZfizoImddzIy1Um2Vn8RIcEkt3dILQkYqkJ62Cvap7Gar VAshZNe59fUo+mXehPBJ00dLlN/HNPV/pS7Z9KbWF2yfIN/y03v9s9NDWsXrAtCRbd4P f9B9HdpavawhU6TAkBMaTaQ671YhW08tYTKKkY5aP1I0+G2GMZcBCbX4dqZVxGdRcopU 73aASRB4PRu5vuIXvTH0ZCb6xfrtxDHexkfL1ckDFNTgkzLqqn4svHB9VgcV9rrDI7v4 rWZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=YhvNIM/dCDp4h+SycBoI6mV96sl07LpvQ/iAqV3+ZJ0=; b=OYbGoBZiUo14K7fNFxc3n49/bElln80Ve3lDTj51yD6m/5YSs2iUgQqKJxVri2IL5/ AfAZ65gcTrqxInEDOGyxbyB4dLuS+zg/2DOI/hBdJzL1CPdvamBqXE47fUwFTQ9kG7vs 5TLzV0mVdkP1Wzc8cMN0jUqsfNTUit23s0By+ZJrwYO0s4g3npY5ISaErwxYzFnRdCiT MlhgKzHlR10SXy6O2wCmITBE/0BeM44sllp17/6Pr8KZfYy+9DgXQ824ln0cg6wyATBV L2Y4POTcHlD7ROZCuOdVRPAYbXe3TKKNDFqxBiALJ3V+gWDZgcP2TjPJjWyiDNm3W8Nr cQMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f13-20020a170906560d00b008d4d102a7b8si16826595ejq.365.2023.03.23.23.10.21; Thu, 23 Mar 2023 23:10:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231190AbjCXFvj (ORCPT + 99 others); Fri, 24 Mar 2023 01:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjCXFvi (ORCPT ); Fri, 24 Mar 2023 01:51:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 87107DBE8 for ; Thu, 23 Mar 2023 22:51:36 -0700 (PDT) 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 476A411FB; Thu, 23 Mar 2023 22:52:20 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E58253F766; Thu, 23 Mar 2023 22:51:33 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , Mark Brown , Marc Zyngier , linux-kernel@vger.kernel.org Subject: [PATCH] arm64: Disable EL2 traps for BRBE instructions executed in EL1 Date: Fri, 24 Mar 2023 11:21:27 +0530 Message-Id: <20230324055127.2228330-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This disables EL2 traps for BRBE instructions executed in EL1. This would enable BRBE to be configured and used successfully in the guest kernel. Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Brown Cc: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- This patch applies on v6.3-rc3, after the following patch series from Mark https://lore.kernel.org/all/20230306-arm64-fgt-reg-gen-v3-0-decba93cbaab@kernel.org/ arch/arm64/include/asm/el2_setup.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h index 037724b19c5c..06bf321a17be 100644 --- a/arch/arm64/include/asm/el2_setup.h +++ b/arch/arm64/include/asm/el2_setup.h @@ -161,6 +161,16 @@ msr_s SYS_HFGWTR_EL2, x0 msr_s SYS_HFGITR_EL2, xzr + mrs x1, id_aa64dfr0_el1 + ubfx x1, x1, #ID_AA64DFR0_EL1_BRBE_SHIFT, #4 + cbz x1, .Lskip_brbe_\@ + + mov x0, xzr + orr x0, x0, #HFGITR_EL2_nBRBIALL + orr x0, x0, #HFGITR_EL2_nBRBINJ + msr_s SYS_HFGITR_EL2, x0 + +.Lskip_brbe_\@: mrs x1, id_aa64pfr0_el1 // AMU traps UNDEF without AMU ubfx x1, x1, #ID_AA64PFR0_EL1_AMU_SHIFT, #4 cbz x1, .Lskip_fgt_\@ -- 2.25.1