Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp11558pxb; Thu, 14 Oct 2021 22:41:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmtvA5n80+CULdOr/BSKbpiJvaLeyRCCLmROAe5LPbVJBzMgJUcjgUCtB2rvzbv7PNJ/IG X-Received: by 2002:a17:906:1bf2:: with SMTP id t18mr4248532ejg.340.1634276477968; Thu, 14 Oct 2021 22:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634276477; cv=none; d=google.com; s=arc-20160816; b=v6G6xADYQkC+qq0YWdvcz1NXDoq4n28skfR2PekWwN2pKmjIShG1d8kkLgLJaUEO7I TD65EqEoJscPYUkGGDaQBVoU8JFEniodqdst4KA647+Dzig6iV2e+woDusGQ9LH5Odmc o7BWf3FyRCnwgW/CgmP3Ey6rVDCDHfIS8utOtlASYzZhFBOZb3hSy/x0Gim1PO2KZCI5 jGI4ZgO+K+A5SzrVPgO4JZ8hiq629luEKtIfAsXageNGgYqWpsLhIWT5d5iDy/oGXK3U bXG+QQe0qKFRD1bHj8jzeI56GYLTGEOqraxOu1NvuU5YtZfmT24Z+8sYSv+gTpzxC8Zr GD2w== 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=nBSFm/9JVfwiToKLPYtns4DhrSyfIMJf+Qk9P+uafPU=; b=HFsSCio4C3RqXuvpMZFxSkl00cYYIhDRDb3AAOtqgROQc29zSnxus67k1HeRlDwoFe +3l/21yaWBNKlC90IZSD8yC7eemM/zl/MilVmu1U5P3yRuVrfGYpBNTjOEYQ7OaoE3K3 oAu5NAFqhcOYplshf+HkXDPdh1fYqiNTOaPp2eM5y8zxbtjBSYBntZO9M5JyS+2boTl3 C+0yNv05fh/Qc0Pz0lQk4W7oa0zq34ANxqlf+6oGTddMRtlIK4KErF61CW58CVdqi9Qa PtvF/roNcBucIPqVSLxbfQ3nYaidyXNNgNSJSPV9YLn6KsSVf/v4XGoTOeb0h3+baAA+ u5eg== 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 g5si6837517edf.557.2021.10.14.22.40.08; Thu, 14 Oct 2021 22:41:17 -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 S234409AbhJNWeK (ORCPT + 99 others); Thu, 14 Oct 2021 18:34:10 -0400 Received: from foss.arm.com ([217.140.110.172]:32832 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234307AbhJNWd7 (ORCPT ); Thu, 14 Oct 2021 18:33:59 -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 7B52D152B; Thu, 14 Oct 2021 15:31:54 -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 114103F694; Thu, 14 Oct 2021 15:31:52 -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 11/15] coresight: trbe: Add a helper to determine the minimum buffer size Date: Thu, 14 Oct 2021 23:31:21 +0100 Message-Id: <20211014223125.2605031-12-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 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 b56b166b2dec..4a50309a892d 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