Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp853342pxb; Thu, 28 Jan 2021 01:41:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOo/keQRDdrARSSPtLUL42R2YYlLh477j0tzGJ+/A3j31Ng7GngEmrXJ7p1oAKu5o4jzLb X-Received: by 2002:a17:907:a06f:: with SMTP id ia15mr10371934ejc.328.1611826884014; Thu, 28 Jan 2021 01:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611826884; cv=none; d=google.com; s=arc-20160816; b=YOaLG5HBi9HD5y12ZJhKYLTBWIbwL8aRYv5kO3Kn098+eG/pMOA83qE/PNH6bJWdr+ mBx8GwFuVxa0opFBiqbX0q4/8/7C/q4Qct7Lh+zCloXtKmqhacY++vsj/84Y3W5jrqPL OhsuYhWQphrAajhR75/jaitoOY7BzgP6mnriYRhWVpddGro0Pz8nyRXYvCODIwA5VqRj l4ZjFVEbcN7VkIEfP4i1lLe+5oSvwwMRgGSCL8/owW5loxfhTG0V+Wa/Ecm7ENgQzFNW 7HpJJ7pEdHrKZpPTx84vW9inHnoB0oZNq3ijwWgA/xAqtXUt3SdBw4ae/YAs568NYCIW P03g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Yye2Si91QMvatU5j6mq60Nbjx1q1B1pwOtjEZ3qdYqU=; b=WGEq9S2vr89OwatprR/54UzVV66SHtQoA/5ZXdvFwjrc0rCX8DN77+b5eqC9W7+aXU H3qpIMpKaQDhNSwXVbhmMyCpEhSa4TyRQCwqAu9Lcz86h7femuYUWcBheCcSAFpQ6n9C cazlw9A1AmWXQN/HJIIHnc3okd6UaZqbtT7Vcub6OTkP5Byl8RfhLvPEGoO62hw5hFld N1OvHHSpmFbLIJQpweigCGRjMhoQV4ZNijF8U9jN0+i3rEaCc/7KxU2JDUAEm+/27F0M NjdY6GBhzF+B+NrRtZY3iGe7dl7sKnHl9jmdOYZotOdEZYIjo97twLzNE21C0pObqfEH q3yA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si2580580edw.240.2021.01.28.01.41.00; Thu, 28 Jan 2021 01:41:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232227AbhA1JkL (ORCPT + 99 others); Thu, 28 Jan 2021 04:40:11 -0500 Received: from foss.arm.com ([217.140.110.172]:55276 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232468AbhA1JfG (ORCPT ); Thu, 28 Jan 2021 04:35:06 -0500 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 7B229106F; Thu, 28 Jan 2021 01:34:19 -0800 (PST) Received: from [10.57.45.249] (unknown [10.57.45.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2CE0D3F766; Thu, 28 Jan 2021 01:34:17 -0800 (PST) Subject: Re: [PATCH V3 10/14] arm64: nvhe: Allow TRBE access at EL1 To: Marc Zyngier , Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, mike.leach@linaro.org, lcherian@marvell.com, linux-kernel@vger.kernel.org, Will Deacon , Catalin Marinas , Mark Rutland References: <1611737738-1493-1-git-send-email-anshuman.khandual@arm.com> <1611737738-1493-11-git-send-email-anshuman.khandual@arm.com> <12b1572e2568d4936f0458649065fe64@kernel.org> From: Suzuki K Poulose Message-ID: Date: Thu, 28 Jan 2021 09:34:11 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <12b1572e2568d4936f0458649065fe64@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/27/21 9:58 AM, Marc Zyngier wrote: > On 2021-01-27 08:55, Anshuman Khandual wrote: >> From: Suzuki K Poulose >> >> When the kernel is booted at EL2 in a nvhe configuration, >> enable the TRBE access to the EL1. The EL1 still can't trace >> EL2, unless EL2 permits explicitly via TRFCR_EL2.E2TRE. >> >> Cc: Will Deacon >> Cc: Catalin Marinas >> Cc: Marc Zyngier >> Cc: Mark Rutland >> cc: Anshuman Khandual >> Signed-off-by: Suzuki K Poulose >> Signed-off-by: Anshuman Khandual > > Acked-by: Marc Zyngier > > One comment below, though: > >> --- >>  arch/arm64/include/asm/el2_setup.h | 19 +++++++++++++++++++ >>  arch/arm64/include/asm/kvm_arm.h   |  2 ++ >>  2 files changed, 21 insertions(+) >> >> diff --git a/arch/arm64/include/asm/el2_setup.h >> b/arch/arm64/include/asm/el2_setup.h >> index a7f5a1b..05ecce9 100644 >> --- a/arch/arm64/include/asm/el2_setup.h >> +++ b/arch/arm64/include/asm/el2_setup.h >> @@ -72,6 +72,25 @@ >>  .endif >> >>  3: >> + >> +.ifeqs    "\mode", "nvhe" >> +    /* >> +     * If the Trace Buffer is available, allow >> +     * the EL1 to own it. Note that EL1 cannot >> +     * trace the EL2, as it is prevented by >> +     * TRFCR_EL2.E2TRE == 0. >> +     */ >> +    ubfx    x0, x1, #ID_AA64DFR0_TRBE_SHIFT, #4 >> +    cbz    x0, 1f >> + >> +    mrs_s    x0, SYS_TRBIDR_EL1 >> +    and    x0, x0, TRBIDR_PROG >> +    cbnz    x0, 1f >> +    mov    x0, #(MDCR_EL2_E2TB_EL1_OWN << MDCR_EL2_E2TB_SHIFT) >> +    orr    x2, x2, x0 >> +.endif >> + >> +1: > > Note that this will (badly) conflict with the late-VHE patches[1], > where this code path has been reworked. Thanks for the heads up. We will need to see how things get merged. Ideally this patch and the previous one (TRBE definitions could go via the arm64 tree / kvm tree), in which case we could rebase these two patches on the respective tree. Cheers Suzuki