Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp625315pxb; Tue, 19 Oct 2021 09:35:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWeoDYBnKFgO4wdFo71xaiZmMyzCx4uzODr9j/03blzJyPvXu6TbXoZDw8lwHoJAbYXaku X-Received: by 2002:a17:902:ce8c:b0:13f:9678:230c with SMTP id f12-20020a170902ce8c00b0013f9678230cmr24583583plg.62.1634661344467; Tue, 19 Oct 2021 09:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634661344; cv=none; d=google.com; s=arc-20160816; b=frJ++VtzR/Pttm6M3w6zXXxB326CjdL8BlLNQw/miJp/XQIofvfTlOIVbQLhfPf4Sx G5tpMuAoIDTbQXiTni3JOTiBciHToDSBRiC/0H37QnqYPz43xwOAeZ4g1BkLDFmETvu2 tQUyVkqBK1G239VQLUrlYoIB/M8UaBzoSGfILqe0hFy3npggz4GnG5JpAqzynXboLVt/ v8PaFnQRyGu3TrT+i+orLFjTwsdlZj2VS21rkRO8AdYSyFZYXjIRIuqfyeF8KNcjcWbQ ftndyJeQ/02cGUbeOLMTTntwaG1Gy54Lsgwy2VaUgboFINwWPEaLRw/VLTBNbQj9C2zR Ju1A== 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=8MxefqQoQmxPogJBzZ1Gv8JEqoT1LyzNIM9GrZYWVA4=; b=u0ok84XpHKv2fP+GClL86+7MgnWJnitfOx8nzxwmpuvraFu0rH+G9wIOnrLdvVoIkV NQ7rN9RWbVkJkHDkZ9nzBdsd5YBrGMLgKMioh/FxC2l9scrx8x1fY56cWr41qz5FFeDA UTxnnLB53vPoeFQyLuAw5LwHz1It7Hx1R91r6ebqZhmAmna4hVyd50fLjhrFrgP0bb+C 0nmCnYc4ZE7kBylAujXm36YKotD/whABBXl5z2BPCu6tQn8KKKXk/NOaDRgLwuVg7VAS u8cbBTiqGn3EE8lR2k+7CQ2GL4OiU/a2kmOYkAS/hpxWqrGZExxIVu82CpM3CqFaezr3 Yl+A== 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 e18si4331520pjp.181.2021.10.19.09.35.30; Tue, 19 Oct 2021 09:35:44 -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 S234623AbhJSQfv (ORCPT + 99 others); Tue, 19 Oct 2021 12:35:51 -0400 Received: from foss.arm.com ([217.140.110.172]:51652 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234503AbhJSQfj (ORCPT ); Tue, 19 Oct 2021 12:35:39 -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 2508011FB; Tue, 19 Oct 2021 09:33:26 -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 ACA483F694; Tue, 19 Oct 2021 09:33:24 -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 v6 08/15] coresight: trbe: Allow driver to choose a different alignment Date: Tue, 19 Oct 2021 17:31:46 +0100 Message-Id: <20211019163153.3692640-9-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20211019163153.3692640-1-suzuki.poulose@arm.com> References: <20211019163153.3692640-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 ae0bde9630f6..cdbb134892f6 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); @@ -967,11 +977,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