Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2953pxb; Thu, 14 Oct 2021 22:20:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUKKxAttjAEAG1Nix+aSjL3dGoWoLOhNei4NqwJmUZtvJaUY/vNYLp2qKPfYlWcQcBYo82 X-Received: by 2002:a05:6a00:24d6:b0:44c:df15:f52e with SMTP id d22-20020a056a0024d600b0044cdf15f52emr9736168pfv.36.1634275247257; Thu, 14 Oct 2021 22:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634275247; cv=none; d=google.com; s=arc-20160816; b=aBJnxYdkNc/rnjLqaAwC+zgITJudAdL80x01gXPlc1aThhuzYTNOA3mSP+3BfXCsYY lpy5Dstd8eAz+JrMPQfrjIqq7LP2EntSit1nbQqcRNL4e0RLfdn44+kDb1GRzaL1VD8Q AUWibOPtpcpFxVX846jCKokdSbac0bjqPnZSefge6W05w2KNQovcDzxPYdtBpITm+aLe RAruF/VedNOeZAwjwv2yRViIw867eY1DHyvUQ1nOY+7h0ZqDimVDIxLybuaube4nV8qd YvebYF59sFmbwJs0/UmFiusb0NCgQsiJenmDw37qkC1eNnhZCOgqrJENe+cd5kEZRR0i rHTw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bBUStZr7tC36LiGd/mMANWof/AXfADcTuDbQZxo0JLw=; b=CkHDqvmkCXcFkNLW+uyiNCd8/asghkGp6Oj83Afo+fLIftooxBHIGjLLJh9d4IGBhd CCn9aeCU3ZpMMxfk0OP2Paow+32bWi382XbdIuBm9cg7b3o4+1lNJNPLBy9iF6u9EQ8Y zqafueKnhWgEBHQxoiHsgl3kr+sp1Qry/O145NpKDT6OZtxDJsDAPw7yvyoJ4QEUvRIl kK5+1Clh4uFUWPhVcaSro1zkdWqABotK+vIbcMpSz5P98ljiRNeFxzPwOY/VJjjixL2a QL6uexRh/prrekY3oQpZe8FvGm732NZ9s+G8d77yCZesZ5bJa72e7T0ISjMykgHip6kC ylDw== 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 o1si6081519pfe.320.2021.10.14.22.19.49; Thu, 14 Oct 2021 22:20:47 -0700 (PDT) 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 S234290AbhJNWeC (ORCPT + 99 others); Thu, 14 Oct 2021 18:34:02 -0400 Received: from foss.arm.com ([217.140.110.172]:32790 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234279AbhJNWdz (ORCPT ); Thu, 14 Oct 2021 18:33:55 -0400 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 8DC0F150C; Thu, 14 Oct 2021 15:31:49 -0700 (PDT) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 23DF63F694; Thu, 14 Oct 2021 15:31:48 -0700 (PDT) From: Suzuki K Poulose To: will@kernel.org, mathieu.poirier@linaro.org Cc: catalin.marinas@arm.com, anshuman.khandual@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, maz@kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Suzuki K Poulose Subject: [PATCH v5 08/15] coresight: trbe: Allow driver to choose a different alignment Date: Thu, 14 Oct 2021 23:31:18 +0100 Message-Id: <20211014223125.2605031-9-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20211014223125.2605031-1-suzuki.poulose@arm.com> References: <20211014223125.2605031-1-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The TRBE hardware mandates a minimum alignment for the TRBPTR_EL1, advertised via the TRBIDR_EL1. This is used by the driver to align the buffer write head. This patch allows the driver to choose a different alignment from that of the hardware, by decoupling the alignment tracking. This will be useful for working around errata. Cc: Mathieu Poirier Cc: Anshuman Khandual Cc: Mike Leach Cc: Leo Yan Reviewed-by: Anshuman Khandual Reviewed-by: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-trbe.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 58796ff425a4..f8c04c428780 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -67,8 +67,18 @@ struct trbe_buf { struct trbe_cpudata *cpudata; }; +/* + * struct trbe_cpudata: TRBE instance specific data + * @trbe_flag - TRBE dirty/access flag support + * @trbe_hw_align - Actual TRBE alignment required for TRBPTR_EL1. + * @trbe_align - Software alignment used for the TRBPTR_EL1, + * @cpu - CPU this TRBE belongs to. + * @mode - Mode of current operation. (perf/disabled) + * @drvdata - TRBE specific drvdata + */ struct trbe_cpudata { bool trbe_flag; + u64 trbe_hw_align; u64 trbe_align; int cpu; enum cs_mode mode; @@ -875,7 +885,7 @@ static ssize_t align_show(struct device *dev, struct device_attribute *attr, cha { struct trbe_cpudata *cpudata = dev_get_drvdata(dev); - return sprintf(buf, "%llx\n", cpudata->trbe_align); + return sprintf(buf, "%llx\n", cpudata->trbe_hw_align); } static DEVICE_ATTR_RO(align); @@ -963,11 +973,13 @@ static void arm_trbe_probe_cpu(void *info) goto cpu_clear; } - cpudata->trbe_align = 1ULL << get_trbe_address_align(trbidr); - if (cpudata->trbe_align > SZ_2K) { + cpudata->trbe_hw_align = 1ULL << get_trbe_address_align(trbidr); + if (cpudata->trbe_hw_align > SZ_2K) { pr_err("Unsupported alignment on cpu %d\n", cpu); goto cpu_clear; } + + cpudata->trbe_align = cpudata->trbe_hw_align; cpudata->trbe_flag = get_trbe_flag_update(trbidr); cpudata->cpu = cpu; cpudata->drvdata = drvdata; -- 2.25.4