From patchwork Wed Jun 19 17:29:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DAFD13AF for ; Wed, 19 Jun 2019 17:31:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4958E20223 for ; Wed, 19 Jun 2019 17:31:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A88C28515; Wed, 19 Jun 2019 17:31:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF45220223 for ; Wed, 19 Jun 2019 17:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XonHFz5eiXJswPu4D8CFGTzxWHkyYrx5W2Orliy8mV8=; b=IGfYL5fWKCoVFPZgKuPySr5PAs LjJdGfRv6coI0iudijBtgsbTk1tDZ1ElKR3j4QiEFOYO3skzfuKV8yE+NhRBDhjw5KwUbSF96J9mp bbP+qvgbD92zIatVUXziAMkv56HnWqcfoWzdT07KfmmPuh3EjIsS/YXGolLEOTw24RgC6LkKDQ79U J8TVgPqJG09eEgAGHbee00QbKgWAsGWloVXbr4FksDLEqtB4l7VmFGet302TbIl7lTIinfHr3rjeC xLbAgFEXk7T9Chj4v9xhgD67fAdLjh5sjmTgg78Ck8/zBVulvO3E2tkl6NZO08K/emeSLw5T7ZNC8 cwJTVKSA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdeQY-0000kr-NX; Wed, 19 Jun 2019 17:31:19 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdePC-000726-IT for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:29:56 +0000 Received: by mail-pl1-x644.google.com with SMTP id p1so101348plo.2 for ; Wed, 19 Jun 2019 10:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xNRhHxUPWncB5rk9ccCc3nU/kF5YdxipsSBDqELFwA4=; b=vcKfhxX/oosFu3ZomeEpMgjZGgs/d+rYYAl2uFr9m5l3fGvil3fFS3fC/sUnOvw/1H mpX+EMJvI8Ur0umZkCP9MdTaFkj8WIFHY6f5pqkhchzsm7/tG2jM3AGnqZdoDBdFQUbN Z5cT+Ck7rKhscV4/MxXDNiBP+mAw98zqUBiB5CHOMqmK9MuChfNrKNOKLYI4nCGjDmlg 0ksv1KitZqMRx7FD6l7G3T85srJW/k+NC1eKTITOO0FZPKp0w6ymVzfz8DBkQQE8jvxF N5x1gN7K3FNf/BnnJ1ZFCy6Ao7hSuMmPWA65Lx6YCbL9v7VEpznmYTxIcme8rUAubWii sy3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xNRhHxUPWncB5rk9ccCc3nU/kF5YdxipsSBDqELFwA4=; b=mjj/tKLjHJ9DZgcCylkqKJHTAfYoB4H+gOFU56Vvj2VuzB1vCfjGM5/DSSfk6LehEU S6Qk8q3egj1Z3RwMKmxmT9fJObaqzwYxePD6lL9eIUtFSbfeHDNgBQa4FWYpizADkN+r DlHiRRIUqsSRuAwMao6bYFu+npD2E3rDXm2Ztp3Nk9mlzYJ7RNz/CBDOtPd7Ctuv4m7N 4GuOphzetZwzZzB1eaaOghiwiWqp8MIc29NkwW0hVusm/j8JGfownCal9Nn+ch8pI6IC f3U+16QX+pt41r647zdpLR/kLTH22orlXlcKrfZHpnq+ZN5+iSwpB3vbGv59c6ZsX2q8 FhoA== X-Gm-Message-State: APjAAAWggZ+f7kupoY+qsKHO94F/nPsH6A1Cmcwc5Fki+lOdRLc/isXq ojWg78sQlHSMCdtbaFzfoLRx++iYROlS0g== X-Google-Smtp-Source: APXvYqxasAH5gx1S8sAFZBvO4s6IxUVYwvwnwNgLptvOyIe1OPflgarFzrEGeNPAEMDvjBxTuCP3AQ== X-Received: by 2002:a17:902:e281:: with SMTP id cf1mr39640055plb.271.1560965394018; Wed, 19 Jun 2019 10:29:54 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:53 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 03/45] coresight: tmc-etf: Properly set AUX buffer head in snapshot mode Date: Wed, 19 Jun 2019 11:29:07 -0600 Message-Id: <20190619172949.4522-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_102954_605632_3A161C31 X-CRM114-Status: GOOD ( 14.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Unify amongst sink drivers how the AUX ring buffer head is communicated to user space. That way the same algorithm in user space can be used to determine where the latest data is and how much of it to access. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 2527b5d3b65e..d026bd04a6af 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -542,11 +542,15 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, } } - /* In snapshot mode we have to update the head */ - if (buf->snapshot) { - handle->head = (cur * PAGE_SIZE) + offset; - to_read = buf->nr_pages << PAGE_SHIFT; - } + /* + * In snapshot mode we simply increment the head by the number of byte + * that were written. User space function cs_etm_find_snapshot() will + * figure out how many bytes to get from the AUX buffer based on the + * position of the head. + */ + if (buf->snapshot) + handle->head += to_read; + CS_LOCK(drvdata->base); out: spin_unlock_irqrestore(&drvdata->spinlock, flags);