Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp858684pxb; Thu, 28 Jan 2021 01:54:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfnR+Yu0HVVAgIG6f60TFZ423S0eHvkotWghKY/XtRAxRi0bQwsLkmE0+1E9fMMVP2SiwG X-Received: by 2002:a17:907:9604:: with SMTP id gb4mr10793871ejc.474.1611827647006; Thu, 28 Jan 2021 01:54:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611827646; cv=none; d=google.com; s=arc-20160816; b=zGnFCgZcy4ixe/s4zxi8/l2UBIbbuoD+ZCct0/g6P+fsDgmRuLEn84AA2A8TIoM9+P MpIcRazKIs4qk4cqkzMWJiOaT6aUbMIVSx9KtFcVQ5xJG1FcBxZ7qXDTIFGz9dvqCPCX yLCPGtHljLDULWP8BHLPfaxM9YQ8O+xtMQmfvGUIeLfrUf6/ksHlz1RRyYnsnieJKEW8 TItJmIcFTWvlqTW0FVLJztHoAnh2Y8GWMTKbeee1uAizCIxSX0hvpwKYG2D3SZQtf0RT 4lkKqmmSP4iiVMLeTcZwmbNrhVBUkjP0df2kQcKhG5Wnjka5lsN15g+LuF+nF4dTegub /bWQ== 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=4gNEy2AF6jpMAM2dT7G3rcgkKmP55im3DBlm9CW1W3Q=; b=E1ZNmCe4d7q5tqgw8/Q27iHM2lPyX4XAAqTKWeMpoxsOOAwVm+SBe6y0sND/sGOm9j tv48vYv6esiy3C2vX07/ED2aXVC01jyFbJE/aDw1MAzeZqC+BcE3abZq++WaJI6PDmx8 8ACtEdlyg94BGH9WQCBJj+Cpv5u67yvH6IPsZicQCUj7KlwKNiy5XDIu0XlBI3WjNLLG 5gdzp4h/ISqf0AfGTsOBD088P0zGtbu9Aln+p57BhAWcqkB98UHqb3m2CYT3XYHdW5ls yjKXB38LQGIuQNtn8QLf0ceJZ4Fb0NPHICrb/93feTuTQ6A0ddO2yfXNPXy/97z9c5nC RvVQ== 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 du19si2310042ejc.206.2021.01.28.01.53.42; Thu, 28 Jan 2021 01:54:06 -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 S231890AbhA1Juf (ORCPT + 99 others); Thu, 28 Jan 2021 04:50:35 -0500 Received: from foss.arm.com ([217.140.110.172]:55570 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231468AbhA1Jtf (ORCPT ); Thu, 28 Jan 2021 04:49:35 -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 482CC1042; Thu, 28 Jan 2021 01:48:50 -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 E73AC3F766; Thu, 28 Jan 2021 01:48:47 -0800 (PST) Subject: Re: [PATCH V3 10/14] arm64: nvhe: Allow TRBE access at EL1 To: Marc Zyngier Cc: Anshuman Khandual , 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> <05c4cde3da791e7effd6196a197f5c98@kernel.org> From: Suzuki K Poulose Message-ID: <7a3252ae-8b8e-1d60-9ce5-5291e33ae8c8@arm.com> Date: Thu, 28 Jan 2021 09:48:42 +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: <05c4cde3da791e7effd6196a197f5c98@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/28/21 9:46 AM, Marc Zyngier wrote: > On 2021-01-28 09:34, Suzuki K Poulose wrote: >> 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. > > I think the current plan of action is to go via the arm64 tree, > given that there is nothing really KVM specific there. I'll respin > the series one last (hopefully!) time on Monday. Let me know if > you need a hand with the rebasing. Sounds good, will rebase it on top of that then. Cheers Suzuki