Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp626182pxb; Tue, 19 Oct 2021 09:36:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSMI1A80QuGZyZdyZR4A1lmwB3LI3ADWNwiekO5/CCf3I+4jmgn7h3g9WYHIjr/Xs57gKF X-Received: by 2002:a17:906:7c86:: with SMTP id w6mr39202231ejo.283.1634661411822; Tue, 19 Oct 2021 09:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634661411; cv=none; d=google.com; s=arc-20160816; b=F/7GXgA42XbdeIJ79Kb4SOu73qHn4imogR6PMsUxnYLgTbhiJgvu7KXIUGO0I7VL68 4F1Ozu8336UoFZl1DE0cf5ByyLKgdVlk0PkfutJ31L8NImAhvq2vOxvxiz1NllBhPU2A 4YAuHHLG305jpw8lq+xIJtuM/kqfncla5/kJ4/bzX19fdTUEnYkrE9ZUJd3FGDPeoQci bO0zY97WEkngNP02Uvje5JYo0fRjECihWP0oqOrkq80UdXpQhpAaU+Ywu+9GzMDj8cWh DhsfpHEyUk0TVHSLcyFwDuttS+y8sR6EQvg85h0gmvB2fl7tXTZv9oJ3LeS/o5tWYTkw /RXA== 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=mnREAYPPvxpcGGaETyuNNjMY/e4BglP424TrXoqxN1w=; b=fHC6ZIvx9aKoNmuM5f4uCX5rOggORlH7h9VWLkYMhCjXrZg55kUjrFAHnMI/Bkewtw wpQRXxB/JaNN0on412YmWg8YMkZVjNfJjhjhH+uNdBG8TfehG7ZvN3wtTtmUhFVrS66o ClL3yZWBydfUTSMmEQVroqWXRl5qa18mFt5jVSAhQawLiqIeaPc9NHz32w5hFCyz+OQs QIsRxttPE474WGRxm+dkfHxch9Okqeh9G7ZbxLz4JddEik9e7IjdbLMkwM5eoT+sSJxZ sR3P6+TqQjoFmMCO0R3O5eH63JqRv6ubqT4oUoDcBQTytS/RQcKeetTOsljLnPQAKajA 2xKQ== 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 y6si28156182edp.593.2021.10.19.09.36.28; Tue, 19 Oct 2021 09:36:51 -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 S234682AbhJSQfz (ORCPT + 99 others); Tue, 19 Oct 2021 12:35:55 -0400 Received: from foss.arm.com ([217.140.110.172]:51690 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234564AbhJSQfo (ORCPT ); Tue, 19 Oct 2021 12:35:44 -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 1398F13A1; Tue, 19 Oct 2021 09:33:31 -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 9D55B3F694; Tue, 19 Oct 2021 09:33:29 -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 11/15] coresight: trbe: Add a helper to determine the minimum buffer size Date: Tue, 19 Oct 2021 17:31:49 +0100 Message-Id: <20211019163153.3692640-12-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 For the TRBE to operate, we need a minimum space available to collect meaningful trace session. This is currently a few bytes, but we may need to extend this for working around errata. So, abstract this into a helper function. Cc: Anshuman Khandual Cc: Mike Leach Cc: Mathieu Poirier Cc: Leo Yan Reviewed-by: Anshuman Khandual Reviewed-by: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-trbe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 2d39e5ecb72c..02a639ece2af 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -303,6 +303,11 @@ static unsigned long trbe_snapshot_offset(struct perf_output_handle *handle) return buf->nr_pages * PAGE_SIZE; } +static u64 trbe_min_trace_buf_size(struct perf_output_handle *handle) +{ + return TRBE_TRACE_MIN_BUF_SIZE; +} + /* * TRBE Limit Calculation * @@ -473,7 +478,7 @@ static unsigned long trbe_normal_offset(struct perf_output_handle *handle) * have space for a meaningful run, we rather pad it * and start fresh. */ - if (limit && (limit - head < TRBE_TRACE_MIN_BUF_SIZE)) { + if (limit && ((limit - head) < trbe_min_trace_buf_size(handle))) { trbe_pad_buf(handle, limit - head); limit = __trbe_normal_offset(handle); } -- 2.25.4