Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3874636pxb; Tue, 10 Nov 2020 02:14:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxsDqOidFD5hkmfiEWjVksDEkfbEgTpVMmaUKNOCOit9LHuNoMU++3TDUdJPvyNNSK9OnS+ X-Received: by 2002:a50:a845:: with SMTP id j63mr20926546edc.32.1605003241596; Tue, 10 Nov 2020 02:14:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605003241; cv=none; d=google.com; s=arc-20160816; b=Mqnl0+/FgI9W0mIWNkyCNffcWPdxkP1ImLhRVO9uUCXlvM74VJvNDZrEYEVybkc6G2 TOlRVE6Ds05BD/Szy4k/8oNdVZm2jiDan58SPmLu9b1Wadrrdl3NaQhb4ABXuRhpPrMm kCWz5aMQEk5k+9Zz5/UwKmzt8N9aFgsLNYXK+BNvEVRFgPrNF+SlMwruWfXGek4M6upP ZUh1jr1PaKmeEGsMR16QH2wQp2t8e+08Sq7teWDF8HTaGF1M6NKCSHmSlqYPygny74Kg +qaanqRdks7V5xDD6toWQpLtbYynd9TX4eNifjDY62UyqoIrHuFEreluEKHyfuj3PWVl 8Exg== 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=eq8dRicoguj5D8nf2jN0D8WU4Rj0JmNvfzY2fowuxvg=; b=DW3pw7WgwIB4B/k7QA80xqEMhN9UjlzuzppDt/VS5NZE7LMBMjaKismefhti6e7vS8 sYcYQ+ufdi5oShiiycgWLkCH1B+w3mR7gp/fmCo1m3Pa/DUYVxx9/4lG8X4PFQ79+arq 9dQN2x4uG5qF8zTSU7Oam5VPkeVM8vcYH7KlAuyZmYvMqfugZuvT40iLXibfr+hjxX5m HjAljg6QqzbvfrbmnnY3e86ezi3aMihRndx9pGr6Xt4Ey2pWk/+NZ4miE6YTYjVwLDbQ BlcuN5UuggE486XstQ7LqF7avVDSUC8/AN0mTtQM281pn2kRWRHTQRM39hGNpGVQm364 s36A== 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 v7si9542689ejg.393.2020.11.10.02.13.38; Tue, 10 Nov 2020 02:14:01 -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 S1728776AbgKJKLc (ORCPT + 99 others); Tue, 10 Nov 2020 05:11:32 -0500 Received: from foss.arm.com ([217.140.110.172]:53248 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726462AbgKJKLc (ORCPT ); Tue, 10 Nov 2020 05:11:32 -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 61C3C11D4; Tue, 10 Nov 2020 02:11:31 -0800 (PST) Received: from [10.57.23.123] (unknown [10.57.23.123]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 58AC53F6CF; Tue, 10 Nov 2020 02:11:30 -0800 (PST) Subject: Re: [PATCH v3 22/26] coresight: etm4x: Add necessary synchronization for sysreg access To: Mathieu Poirier Cc: linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org References: <20201028220945.3826358-1-suzuki.poulose@arm.com> <20201028220945.3826358-24-suzuki.poulose@arm.com> <20201109183255.GA3396611@xps15> From: Suzuki K Poulose Message-ID: <7370dc60-ca9c-7b58-0b56-6fcef628304f@arm.com> Date: Tue, 10 Nov 2020 10:11:23 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 In-Reply-To: <20201109183255.GA3396611@xps15> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/9/20 6:32 PM, Mathieu Poirier wrote: > On Wed, Oct 28, 2020 at 10:09:41PM +0000, Suzuki K Poulose wrote: >> As per the specification any update to the TRCPRGCTLR must be synchronized >> by a context synchronization event (in our case an explicist ISB) before >> the TRCSTATR is checked. >> >> Cc: Mike Leach >> Cc: Mathieu Poirier >> Signed-off-by: Suzuki K Poulose >> --- >> drivers/hwtracing/coresight/coresight-etm4x-core.c | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c >> index e36bc1c722c7..4bc2f15b6332 100644 >> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c >> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c >> @@ -178,6 +178,15 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) >> /* Disable the trace unit before programming trace registers */ >> etm4x_relaxed_write32(csa, 0, TRCPRGCTLR); >> >> + /* >> + * If we use system instructions, we need to synchronize the >> + * write to the TRCPRGCTLR, before accessing the TRCSTATR. >> + * See ARM IHI0064F, section >> + * "4.3.7 Synchronization of register updates" >> + */ >> + if (!csa->io_mem) >> + isb(); >> + > > When I first read the documentation on system instruction section 4.3.7 really > got me thinking... > > At the very top, right after the title "Synchronization of register updates" one > can read "Software running on the PE...". Later in the text, when specifying > the synchronisation rules, the term "trace analyzer" is used. _Typically_ a trace > analyzer is an external box. > Very good point. The trace analyzer could still use the system register to program the ETM and causing a context synchronization event is tricky from within the trace analyzer. And I agree that there is a bit of confusion around the synchronization from a self-hosted point of view. I believe this is true for the self-hosted case too and should be clarified in the TRM. > Arm documentation is precise and usually doesn't overlook that kind of detail. > The question is to understand if a context synchronisation event is also needed > when programming is done on the PE. If so I think the documentation should be > amended. > > In that case: > > Reviewed-by: Mathieu Poirier > Thanks Suzuki