From patchwork Thu Aug 29 20:28:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122405 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A627E112C for ; Thu, 29 Aug 2019 20:29:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8083F2070B for ; Thu, 29 Aug 2019 20:29:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ctbo5pFQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YQOxkttE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8083F2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=KQcz9vOAt7NWb6uQFN+F2vdYVUNCFJKEc06r/FDKd+k=; b=ctbo5pFQBdu//Y+y41//Il4iIz eZ5U05d3BfYIhxplVdtFLyiWUdHo8Q2k8RzxncrRU8S4vJcoF9FtzZzChGlfwAL4/L8B3IdZcRVSu 0nR5F1wElaMxDGq8Inrsi70KhWZDcLVfs44er+Kr7ogrOOzbc92G4p6fpjh3svmOCXs6+HOt8tq6A eWlMYXoAdaL28x+ExlGcsMWG/XZQP2yzgxZvDj9ppsamBcuDdNWL/OILh9qvPgJMpvXFuhsmbuGi0 JGUr4SUBgndBJUPZsCRUIApWaWmsRVRj2Qxa9XVPNZ4xRkJ91lxSKmWv2X3xFCfMipqSLTlyVTSeF YeW+YdLg==; 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 1i3R2X-0003uX-Ty; Thu, 29 Aug 2019 20:29:06 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2C-0003eZ-Oa for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:46 +0000 Received: by mail-pg1-x543.google.com with SMTP id p3so2180114pgb.9 for ; Thu, 29 Aug 2019 13:28:44 -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=e1rfzPi9lka2rztuAHcYlD7FftmyaSElRH5Zdr494kI=; b=YQOxkttEKLeumqIAVS1RxL0jOYy08PVdunK/nWSCAxox+i/OpwRzYeJTXkNL1bAMXS /I9Wm4yqPIPQ9HGKpBPPG8UUtEKYgHM51mgRyBleeUgOveLyz0JYG1xjxSLL1sMl9BPs bH5prYB/dRpOzpUwomDE9n48xHewJ4LnFLB6nl8li83JGcBwrTdhLBuYur1DibNmNuLW NreSJHmJUbwWvRH7CIjPIT4uRK7P9JYceGLUCsgC6OA9vDVMJsWw/DQxwhjFDGjDXuBN PWrwjUBQuyMtvBjHGwsiQ4c0ekYh8NQYw/6dF7NcK+2l0JcKbpVpo2Yr8emucD/o9DIx 7LbA== 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=e1rfzPi9lka2rztuAHcYlD7FftmyaSElRH5Zdr494kI=; b=BnO6CWik4cbln/fFjDHSg7aHIL3jfw5milSIEtRYEqkxz9UKfzMh1pufyc3Iyp/6E/ bIQY+clGq9kEseUT2wSO7PHoGsK4rypGI2G6Q4lK4c3eBLvuz+xeJHjbUWUyfeKD+Qbl d+VBra/BxqGDFn8Ss9Evf9v12CkFAT5O81J0OqLHiB23rAr8WKlfUucgkc0/KSI5HAMU qagG8p2XSsYgr30dyDxL0fdv7rDvNquJfY8FdDNVWtG0wmG05ub0kpXWzp9wAEIOnSq7 CP2fkHC2WiZKG8l00c21JDmd+R8Bdw6DXy4hH01qurAmeksIIX1tqxuM7M1RhWy8a9dp 318g== X-Gm-Message-State: APjAAAW7Pf/3VMLiykAocNT6rkmlwlX4O5rA3c+fGkxyfhkWC+dmxuPP GSvmGwUU27hFcVOZ1ELkyaF9CgKmd9I= X-Google-Smtp-Source: APXvYqzc7a/xEbOcqP6mq9R+xh9Rsal8HVpsyZnImbOs+EkhfYKj+eJYHEsOMWYOE4XCsJfV2nPmVw== X-Received: by 2002:a62:6045:: with SMTP id u66mr13428464pfb.261.1567110524184; Thu, 29 Aug 2019 13:28:44 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:43 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 01/17] coresight: etm4x: Two function calls less Date: Thu, 29 Aug 2019 14:28:26 -0600 Message-Id: <20190829202842.580-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132844_795477_FC6AC094 X-CRM114-Status: GOOD ( 11.09 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Markus Elfring Avoid an extra function call in two function implementations by using a ternary operator instead of a conditional statement. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index a0365e23678e..219c10eb752c 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -296,11 +296,8 @@ static ssize_t mode_store(struct device *dev, spin_lock(&drvdata->spinlock); config->mode = val & ETMv4_MODE_ALL; - - if (config->mode & ETM_MODE_EXCLUDE) - etm4_set_mode_exclude(drvdata, true); - else - etm4_set_mode_exclude(drvdata, false); + etm4_set_mode_exclude(drvdata, + config->mode & ETM_MODE_EXCLUDE ? true : false); if (drvdata->instrp0 == true) { /* start by clearing instruction P0 field */ @@ -999,10 +996,8 @@ static ssize_t addr_range_store(struct device *dev, * Program include or exclude control bits for vinst or vdata * whenever we change addr comparators to ETM_ADDR_TYPE_RANGE */ - if (config->mode & ETM_MODE_EXCLUDE) - etm4_set_mode_exclude(drvdata, true); - else - etm4_set_mode_exclude(drvdata, false); + etm4_set_mode_exclude(drvdata, + config->mode & ETM_MODE_EXCLUDE ? true : false); spin_unlock(&drvdata->spinlock); return size; From patchwork Thu Aug 29 20:28:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0FCE112C for ; Thu, 29 Aug 2019 20:29:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D9562070B for ; Thu, 29 Aug 2019 20:29:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pNXM7eaH"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Pc++9X36" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D9562070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=kP4ugWUq2f05ZjjxatKTIlIT8VX8A3zkxSIPAcyPvEk=; b=pNXM7eaH60gkDb3KfsNy5wUaG0 k30ah272BPnSna+/lIvWOfMwpyxEJafy6ZhfRlWfoMhxSL3IlBUW8J39vmGdhTBS0o/yOAdomj3+q ukOqE0ZMN2w73XoHgfqUEUAAYSG3lCQWGK4mv0L9pQMk4orJ+wQKbMxOMoDQrNBQKleJadC50ktpD BPG1ORI2C4gXlD12CLvit27rDXpwTYHfwiR19SerBL6Dv62E+0U4QRrdFkgItf25sgfCfiYs8iRX9 LilnC2dvc6C+AjVprmShm7Kl6U0ADweU0LEhxZqkPUzZ3OLkGSW6ak/QAEnSvyNKm+Q596fc4eSaa 7uZXE3rg==; 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 1i3R2j-00047u-V9; Thu, 29 Aug 2019 20:29:18 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2D-0003f0-Tu for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:47 +0000 Received: by mail-pg1-x542.google.com with SMTP id m3so2172463pgv.13 for ; Thu, 29 Aug 2019 13:28:45 -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=dd1S70qC4Knnjc76mO421DIbTiN8oBwUIOYstjye2mk=; b=Pc++9X36Fn6GsIKNwfs8pIxgKhCIJGcSkZYc9b7eXYU5EumnFAg9sgQA+rwPissMum uAhtU4uweGmCL2Q7tCAczWelyne48d6cOpNi2CSfZTDFMqNOmpuvxKWxl8cwbqKCItDs BnJ5eoRMMmJMuylP+LhjnMww2qcV7qvdct9zRwjszRlQoKWsPrR/oyH5YKvUYFlcjCOL Tn9fOFN+d7SnBECaM0WvNiyFUEdII9ydJuKcqrwEzlPbMCEVT12GPikucNIT2lbtS3YG ifccZxptzYYtUppkwsvzaIepfa+6wLcMbhUF7WbqeM54T1zjYJQIfsQNN/K05SJSvmoz cGSQ== 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=dd1S70qC4Knnjc76mO421DIbTiN8oBwUIOYstjye2mk=; b=TVS8k2PRxu7Uh+tjrT6hxGg+A7TZIDQYoUlIVDn+IY3XqHNUMLOtTP/miG8bGIaoeT IQkXKBwYdZmv0Vyrhz08CXf9exAiAT0TvU1IVQcKTsvJpLHOu398NjjoKO1QjTMM3UM/ TRA64UqAgF6joTO7F1ilUapN3wBAPVnskayvwc1Hj0vmf1iRb9qOm0OdsJ7FuvbDpA4B JPr3eOodiZUU87XmzXt94r/juqCH6JobQv0MXiZebkZfHqZwRGjPFx0j7xgW2DrnhBjP +iR6XjmBTR+ooB2nRO+8F9FBPzT0fPETAh6c4FUxCNtyiUZ76AH5uO5TDJKQkt3cI6lT xiHQ== X-Gm-Message-State: APjAAAV4zIUK46YJs+zeMKp94wlpCJVNDg82Vfy25hNhDwV6u60bdToX uOYoL8paOf87tgQ4loniy7AZwQ== X-Google-Smtp-Source: APXvYqxiVRGeki3ncOVglHSsTvSGUld2+NK9vKmQImBX2vw0VqPHK18BtZT8Bce0NVtpQ7Mg+enYFA== X-Received: by 2002:a65:5cca:: with SMTP id b10mr10223773pgt.365.1567110525003; Thu, 29 Aug 2019 13:28:45 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:44 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 02/17] coresight: etm4x: Add ETM PIDs for SDM845 and MSM8996 Date: Thu, 29 Aug 2019 14:28:27 -0600 Message-Id: <20190829202842.580-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132845_963498_3D19B8AE X-CRM114-Status: GOOD ( 11.67 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Sai Prakash Ranjan Instead of overriding the peripheral id(PID) check in AMBA by hardcoding them in DT, add the PIDs to the ETM4x driver. Here we use Unique Component Identifier(UCI) for MSM8996 since the ETM and CPU debug module shares the same PIDs. SDM845 does not support CPU debug module. Signed-off-by: Sai Prakash Ranjan Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 7bcac8896fc1..28bcc0e58d7a 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1192,11 +1192,15 @@ static struct amba_cs_uci_id uci_id_etm4[] = { }; static const struct amba_id etm4_ids[] = { - CS_AMBA_ID(0x000bb95d), /* Cortex-A53 */ - CS_AMBA_ID(0x000bb95e), /* Cortex-A57 */ - CS_AMBA_ID(0x000bb95a), /* Cortex-A72 */ - CS_AMBA_ID(0x000bb959), /* Cortex-A73 */ - CS_AMBA_UCI_ID(0x000bb9da, uci_id_etm4), /* Cortex-A35 */ + CS_AMBA_ID(0x000bb95d), /* Cortex-A53 */ + CS_AMBA_ID(0x000bb95e), /* Cortex-A57 */ + CS_AMBA_ID(0x000bb95a), /* Cortex-A72 */ + CS_AMBA_ID(0x000bb959), /* Cortex-A73 */ + CS_AMBA_UCI_ID(0x000bb9da, uci_id_etm4),/* Cortex-A35 */ + CS_AMBA_UCI_ID(0x000f0205, uci_id_etm4),/* Qualcomm Kryo */ + CS_AMBA_UCI_ID(0x000f0211, uci_id_etm4),/* Qualcomm Kryo */ + CS_AMBA_ID(0x000bb802), /* Qualcomm Kryo 385 Cortex-A55 */ + CS_AMBA_ID(0x000bb803), /* Qualcomm Kryo 385 Cortex-A75 */ {}, }; From patchwork Thu Aug 29 20:28:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122409 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0D441395 for ; Thu, 29 Aug 2019 20:29:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9DC032070B for ; Thu, 29 Aug 2019 20:29:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oOtyzT6W"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Zs9NkvKj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DC032070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=Lfsc4KRuWJJkc2pbdxQihcNZMzEipUjTUvb0vZZsij4=; b=oOtyzT6WuoBQshb3UTnv10XTn+ SAb1m/QogEe0dU/VNdsnYDst8al7rhoTLcO/V3pozV2KK5A4MJqOHHhl3TCynsjEONGy04HrrWazA JkyI38odTBqiMnUHNFYTMa7r72/QukvpxWgZ4MSYOCKQTYEQrO0318OiPOZYVJ+zN2y3MtClq+qHv MyEEwKj+u8xtcVOXVAtlU7Lge/BnOp+iEjGICQhMG5mYO7fKiDCiNqpZHTCsq0a2+Ik621XhWlijv 4EQpgIgbIclPN3yxCp4VGxxf3uvEc2CcQqZUImn3VVta/mZT67M6P4IlFf0j0GO6sU6fKFrTTom6v yjn1+7eg==; 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 1i3R33-0004WS-76; Thu, 29 Aug 2019 20:29:37 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2E-0003fQ-9O for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:47 +0000 Received: by mail-pf1-x444.google.com with SMTP id o70so2860780pfg.5 for ; Thu, 29 Aug 2019 13:28:46 -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=skNhpMN2Ucyc8n+P/pDVGmxDvDSjMfWlnQrtB94MVOc=; b=Zs9NkvKjqvXWUQycjTsRVSLN5kmzYtNtIdjldjvIGydRXG+9CcooiZEspNkSkEix3L VMJXa2f6dq3rn8ybVRRWX/Gsm+gyQlQqZllQCoju3BgW+oLjeTWC/9233Nk3D6iYeyKb xms2Fhb5HDJl+Fhic/yIaUlUc6IzsNfSErFT4tlEKgPpsxcNmMNIoNcSmUTfNwnnQYwk tHeyMwdlchQJz1HzipuX5MEGQfbBpSRQBOH/onfOSOavasR+OaO0Dm/1DfbSwJofgPqE jKzvm639umEEiUhCENYPoiYsvZsWKYj2T6NxWMY8B87s2WWN3VIX1tSYJlWX87I3vxAm c7GQ== 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=skNhpMN2Ucyc8n+P/pDVGmxDvDSjMfWlnQrtB94MVOc=; b=owepJrH7Yx4DHcC8CcBe8JAXT7LLin03R4EVWJ0FIGaIl5tJJhkIJy/SE7rbWeRGYh Dz4JCcUBkCPdW8+obxrXYK8E9lVXx17uFNRY1hGNryguDQB8jq1cqV/lrns0m+qi1tP6 vVOfWiSnEaHvflypfalH9POP/AwN3+OED3OnmNxWwm+H/yZ3DWunOeaNfhEnY4efOWui e1fCbAx7K6Z4Pblgb6CQs0Ba4GJoqGIZppbdyNnHwzAFU5VjKO5dxeypv88u2AR3vfcl 0e4evxsFqX+xMHdvcaA70LPZrY5nXHyMxr94IjBGejj7fvc1528ml4cxm79GmcihZtGx j2lA== X-Gm-Message-State: APjAAAVZMu1g5oEWi8Uc9qXFiZKmfS/a8cUC0W7Psz/d1loJSoT2wAkZ tDiXnLg+TlLZJYi4bAHSBj7dAQ== X-Google-Smtp-Source: APXvYqy52EQIwKyqb3VpOjagNGkjySwgvctcRQlgNIERdJOABJLEp+VBJCb4utA4URN42Pe3XcIulQ== X-Received: by 2002:a17:90a:326e:: with SMTP id k101mr12452804pjb.15.1567110525807; Thu, 29 Aug 2019 13:28:45 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:45 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 03/17] coresight: cpu-debug: Add support for Qualcomm Kryo Date: Thu, 29 Aug 2019 14:28:28 -0600 Message-Id: <20190829202842.580-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132846_328124_8FA09066 X-CRM114-Status: GOOD ( 15.87 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Sai Prakash Ranjan Add support for coresight CPU debug module on Qualcomm Kryo CPUs. This patch adds the UCI entries for Kryo CPUs found on MSM8996 which shares the same PIDs as ETMs. Without this, below error is observed on MSM8996: [ 5.429867] OF: graph: no port node found in /soc/debug@3810000 [ 5.429938] coresight-etm4x: probe of 3810000.debug failed with error -22 [ 5.435415] coresight-cpu-debug 3810000.debug: Coresight debug-CPU0 initialized [ 5.446474] OF: graph: no port node found in /soc/debug@3910000 [ 5.448927] coresight-etm4x: probe of 3910000.debug failed with error -22 [ 5.454681] coresight-cpu-debug 3910000.debug: Coresight debug-CPU1 initialized [ 5.487765] OF: graph: no port node found in /soc/debug@3a10000 [ 5.488007] coresight-etm4x: probe of 3a10000.debug failed with error -22 [ 5.493024] coresight-cpu-debug 3a10000.debug: Coresight debug-CPU2 initialized [ 5.501802] OF: graph: no port node found in /soc/debug@3b10000 [ 5.512901] coresight-etm4x: probe of 3b10000.debug failed with error -22 [ 5.513192] coresight-cpu-debug 3b10000.debug: Coresight debug-CPU3 initialized Signed-off-by: Sai Prakash Ranjan Tested-by: Leo Yan Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-cpu-debug.c | 33 +++++++++---------- drivers/hwtracing/coresight/coresight-priv.h | 10 +++--- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c index 2463aa7ab4f6..96544b348c27 100644 --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c @@ -646,24 +646,23 @@ static int debug_remove(struct amba_device *adev) return 0; } +static const struct amba_cs_uci_id uci_id_debug[] = { + { + /* CPU Debug UCI data */ + .devarch = 0x47706a15, + .devarch_mask = 0xfff0ffff, + .devtype = 0x00000015, + } +}; + static const struct amba_id debug_ids[] = { - { /* Debug for Cortex-A53 */ - .id = 0x000bbd03, - .mask = 0x000fffff, - }, - { /* Debug for Cortex-A57 */ - .id = 0x000bbd07, - .mask = 0x000fffff, - }, - { /* Debug for Cortex-A72 */ - .id = 0x000bbd08, - .mask = 0x000fffff, - }, - { /* Debug for Cortex-A73 */ - .id = 0x000bbd09, - .mask = 0x000fffff, - }, - { 0, 0 }, + CS_AMBA_ID(0x000bbd03), /* Cortex-A53 */ + CS_AMBA_ID(0x000bbd07), /* Cortex-A57 */ + CS_AMBA_ID(0x000bbd08), /* Cortex-A72 */ + CS_AMBA_ID(0x000bbd09), /* Cortex-A73 */ + CS_AMBA_UCI_ID(0x000f0205, uci_id_debug), /* Qualcomm Kryo */ + CS_AMBA_UCI_ID(0x000f0211, uci_id_debug), /* Qualcomm Kryo */ + {}, }; static struct amba_driver debug_driver = { diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 7d401790dd7e..41ae5863104d 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -185,11 +185,11 @@ static inline int etm_writel_cp14(u32 off, u32 val) { return 0; } } /* coresight AMBA ID, full UCI structure: id table entry. */ -#define CS_AMBA_UCI_ID(pid, uci_ptr) \ - { \ - .id = pid, \ - .mask = 0x000fffff, \ - .data = uci_ptr \ +#define CS_AMBA_UCI_ID(pid, uci_ptr) \ + { \ + .id = pid, \ + .mask = 0x000fffff, \ + .data = (void *)uci_ptr \ } /* extract the data value from a UCI structure given amba_id pointer. */ From patchwork Thu Aug 29 20:28:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122411 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0360E1395 for ; Thu, 29 Aug 2019 20:29:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D3EED2070B for ; Thu, 29 Aug 2019 20:29:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YYI2vWhM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="j7fG4JFr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3EED2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=nXOLwF6RasaIZS6ySye6/FQmqcRK4RJNZM32pfC3tXQ=; b=YYI2vWhMwwvX+u/gi4Cg0AU95+ SbMMBDJadruvnzXexE9Mtkl9yNMXDlnFk5YTWmgdAcHMn69kuz3hKJ/St5sE499HQdyGtMIf9OuA9 DtbvN4PGoYqTcjqegnrkWtwfkFhbRfRn8fosSRmRsDTVFonyNo0riR2sd5X7zs7oTEFt+NYns1nhH OSFrxA8YagAOO0w5B7I7kKtKWENaxE0/6pGyr4B92Igh4xF8tjUQBUKRwOEf5nBDPR5AEn3EhBz5Q qQUuDtEzf2nB7iHdEaX6HCl5jervZHlcc1koIYxSq9Z8GZI281lnj3WxKi+uZ2h1WQu8YRsqjZhZP tm6wBfDA==; 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 1i3R3G-0004kG-1q; Thu, 29 Aug 2019 20:29:50 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2F-0003fr-LF for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:49 +0000 Received: by mail-pg1-x544.google.com with SMTP id o13so2176400pgp.12 for ; Thu, 29 Aug 2019 13:28:47 -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=bVJOPZuGL3hFw3YCjN9nuKypVgI+bDnUYt2M16Fs5tI=; b=j7fG4JFrXfi+EBRurr6UCyqYugEHYjEpeXWvnWi5X6+F0p1pjAvwq+898TGeBBVN1w aG36vW8X9cVNlgyqC2M8tnvAuQswqcGcPXnW4wUHksCV+26FBgzsv63b8MdP5WU3G1tr cS//6FSA6n9/xzkQBjVFNWvwXO6f238pxu3JpYSqn3l/m7H423/1A2496g7Jn7+FnD/2 hfv8JccWjMcPtQJIOMgen9FVWIrrM5iAhofjLT8AZKOSfyWoj9qMyzRmIJ1UYKsMGod9 Nu2FpHMqWLXN3EFSfiAzKBTu7LHo/p4+S/ogXmBVA7hQmomFMdyUGY5no6FJIc0UhxiX b0sA== 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=bVJOPZuGL3hFw3YCjN9nuKypVgI+bDnUYt2M16Fs5tI=; b=NUBUevoBlGCXpfrEMRd2Tb0wew4l19+Dj8GCv8s6evcT2KiXS8jIlUYSrqo4ezFUbF LBURMdBc3FGfumbidiFDPTxgkaokbO6YPvJv8rN2HBrqQKGl3tIMhyLdql43ojKKIuXb vnfRrKFD9vskXqZjPs3IUg5zb63O5MbzXY+MJBlJqQsba2ZgS1TquPpz2Not4pzDyc5p 0xk2eqfKXbnFOzPXflnUierxO+Z8Wtolkzp1bGwmsPpel65dPOPUkedeSuhXIJoZfonz 9k2OC+PT1KRU5cS5DS1X0WQmGKesTdTAvsG8552+UlqQaHq9hkH96WhumuBcxjbk7BBY GxTA== X-Gm-Message-State: APjAAAWv9BYO2sQbwa/XmLlgbYpmI7Rho91FUpJ2l+X08yM6xNsP+Mr+ HHM6IRt1QrNBElHgT+Ku3u9l8A== X-Google-Smtp-Source: APXvYqx2SWdumhPkH5P3gln1VTA5Gs82OL7mLLrZL7mJUvwTSPLtsScdi8xmqLuKBVriYCt+dSX14w== X-Received: by 2002:a17:90a:c404:: with SMTP id i4mr11802060pjt.81.1567110526780; Thu, 29 Aug 2019 13:28:46 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:46 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 04/17] coresight: etr_buf: Consolidate refcount initialization Date: Thu, 29 Aug 2019 14:28:29 -0600 Message-Id: <20190829202842.580-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132847_747444_B566217B X-CRM114-Status: GOOD ( 11.24 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:544 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Suzuki K Poulose We now use refcounts for the etr_buf users. Let us initialize it while we allocate it. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 17006705287a..3116d1f28e66 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -871,6 +871,7 @@ static struct etr_buf *tmc_alloc_etr_buf(struct tmc_drvdata *drvdata, return ERR_PTR(rc); } + refcount_set(&etr_buf->refcount, 1); dev_dbg(dev, "allocated buffer of size %ldKB in mode %d\n", (unsigned long)size >> 10, etr_buf->mode); return etr_buf; @@ -1263,8 +1264,6 @@ get_perf_etr_buf_cpu_wide(struct tmc_drvdata *drvdata, if (IS_ERR(etr_buf)) return etr_buf; - refcount_set(&etr_buf->refcount, 1); - /* Now that we have a buffer, add it to the IDR. */ mutex_lock(&drvdata->idr_mutex); ret = idr_alloc(&drvdata->idr, etr_buf, pid, pid + 1, GFP_KERNEL); @@ -1291,19 +1290,11 @@ get_perf_etr_buf_per_thread(struct tmc_drvdata *drvdata, struct perf_event *event, int nr_pages, void **pages, bool snapshot) { - struct etr_buf *etr_buf; - /* * In per-thread mode the etr_buf isn't shared, so just go ahead * with memory allocation. */ - etr_buf = alloc_etr_buf(drvdata, event, nr_pages, pages, snapshot); - if (IS_ERR(etr_buf)) - goto out; - - refcount_set(&etr_buf->refcount, 1); -out: - return etr_buf; + return alloc_etr_buf(drvdata, event, nr_pages, pages, snapshot); } static struct etr_buf * From patchwork Thu Aug 29 20:28:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122413 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CF5714E5 for ; Thu, 29 Aug 2019 20:30:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDC7C2189D for ; Thu, 29 Aug 2019 20:30:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pZd8iO31"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oVF0y4nw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDC7C2189D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=o65atp3EHhFJ24S4NwnibqG/+RKA6Jhrg6+dK8qPyos=; b=pZd8iO31ZlIjKWlq1tCGTd7WFf vEhRuhppTzyRZtEcl1a4onsiYKIHxvk0/4lOkZRb1Ztf6JD9ISD/HAPUMCA6M3wONA/Nzf0OLsIwb YaWNszXF5lCmrB3pUIR2T30RR/CryO2oUb2lmXqw2IO51va8YlB/NbvWRF7vJGGlzvSz1pQlHyrhm k3e3aSkicOKZr6sifc56hd9MY0clnVgZjEaLMtMjBZNebiJOdGpM9MB/GGEckk04hS4XVSRiOl2sf BeEIvxNPJsRVwWYrFQV+GWSydCS/bYYCuJesxETt+nWWOKiLBVRsiYivEC+4bB3ONBxEQI39ulnMl RXe2tY7A==; 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 1i3R3e-0005hA-3h; Thu, 29 Aug 2019 20:30:14 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2G-0003gn-Io for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:49 +0000 Received: by mail-pg1-x541.google.com with SMTP id k3so2179393pgb.10 for ; Thu, 29 Aug 2019 13:28:48 -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=Kp6bWICVzcD1vRMYLxKwPKSzCM3AbPwuHgbbnTiMIUM=; b=oVF0y4nwLWJJEuvvOzTSKviTM0sbi+lXRLt6VxlUw+99TlF+OGKYlIe5SPmJlfw4UK dZ3zXkPZbJ/VeHkvtKDP7pcCfZTaYQKftGdMibVJ83MEIol4lqF1BpRaAXX+ouK4TRGz 6Gg9Sul5o8k0kfg/Xe4d0xnZln+aQvsWXsYeDpsV+ZajEe8Wmvhzmisyhf1AITOgOQrz /Oo3ZAsVQAKPyDhiNTpglRT07LVHFfhOltup+1zFir81LCHJmpi/KRplSufldEuZEn0p Ygmw+7YUDAGXNpK3LWNsaiQWvfHaALCHuuzmcR4Vv1QD6trVryGmxkQ+ukSHOennQR8l XPZg== 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=Kp6bWICVzcD1vRMYLxKwPKSzCM3AbPwuHgbbnTiMIUM=; b=ohA28ZhlOdXf6COli/590YrLBbuvm1PSvMflHg+Ojf0aihjhoraJXDV/ElqlWs3PCW H7J2TIjeoNSvx4e38sdFNCDfuMVql4k8MD1KIx5c+Y0lKD5ua+ZGcfbYHM7In2g2L1Db o9ZpypXpOvjbKKhtocHY49OjPfCn4D7Avh79F8487c1esOqoz9wbcrYPHNxmW4fyHiD+ m1i4mP3CnmcmAhKmrN4CCdQAWikbheGN+9VGppGkV+JY1ZTf1JSjOaD0RGWQR08augF9 /eLORMihvHXqSZNfc7LG1RNFZJh4i2VK7YoPEOZsOkKPBK3Qc/zezMFs/ts72uqX79hu A6Fg== X-Gm-Message-State: APjAAAUo7o2qXlI4OFEmWQ+WIVbVh0AP3YX7sVmgHlctAwHYwk0TU25r b4wCCKMWTkfDpFjJ/Ivf+Mj7f087uQ0= X-Google-Smtp-Source: APXvYqyLIDIrWiwlmeOL7xbftwvKDLTvfL8Kl7uOXyBWKuQ2LiGHI5n3peVWp0D/kjYHVlLAbC3ttA== X-Received: by 2002:a63:5048:: with SMTP id q8mr9808567pgl.446.1567110527555; Thu, 29 Aug 2019 13:28:47 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:47 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 05/17] coresight: tmc-etr: Handle memory errors Date: Thu, 29 Aug 2019 14:28:30 -0600 Message-Id: <20190829202842.580-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132848_632183_81C8E183 X-CRM114-Status: GOOD ( 12.24 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Suzuki K Poulose We have so far ignored the memory errors, assuming that we have perfect hardware and driver. Let us handle the memory errors reported by the TMC ETR in status and truncate the buffer. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose [Removed ASCII smiley face from changelog] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 13 +++++++++++++ drivers/hwtracing/coresight/coresight-tmc.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 3116d1f28e66..2246c1e6744a 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -928,6 +928,19 @@ static void tmc_sync_etr_buf(struct tmc_drvdata *drvdata) rrp = tmc_read_rrp(drvdata); rwp = tmc_read_rwp(drvdata); status = readl_relaxed(drvdata->base + TMC_STS); + + /* + * If there were memory errors in the session, truncate the + * buffer. + */ + if (WARN_ON_ONCE(status & TMC_STS_MEMERR)) { + dev_dbg(&drvdata->csdev->dev, + "tmc memory error detected, truncating buffer\n"); + etr_buf->len = 0; + etr_buf->full = 0; + return; + } + etr_buf->full = status & TMC_STS_FULL; WARN_ON(!etr_buf->ops || !etr_buf->ops->sync); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 1ed50411cc3c..95d2e2747970 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -47,6 +47,7 @@ #define TMC_STS_TMCREADY_BIT 2 #define TMC_STS_FULL BIT(0) #define TMC_STS_TRIGGERED BIT(1) +#define TMC_STS_MEMERR BIT(5) /* * TMC_AXICTL - 0x110 * From patchwork Thu Aug 29 20:28:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52E1C14E5 for ; Thu, 29 Aug 2019 20:30:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2EC722070B for ; Thu, 29 Aug 2019 20:30:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nLywuNFZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kiWgybCn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2EC722070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=h/KJDz6e6mnjeCv4zg4sQ/ZKHUJbiO8IWqQuA0GruNU=; b=nLywuNFZodWcN61e33mE4AKjF+ VJFwLGENo+wts2Inzf5N57VYje5IIpHqBSJNu4B8F/cjWgjcLzf4uEjK8dfndeFsp1PJmjhvYEcjL In35d0SGPj5nYraEIUcIZf7Zq9boO4/X8/0Fcy1jIj4pMMVEDv6HCpi3onduaTso/QVvNTAMKWpTU +VKtYWGexCTxmV49iLABH/eyOV1GRanWLdoiWqERgZigdKWotY3hIDoLhM5RTlaI33gS9kmHwAh2C suMgyQx7FtXN6gBLz7x96MRegfX62U5YLGklrhOKrfYPP0v2EuW1RNXkCIgHA3O6f+yZoJVLaz0ca 2CholK/w==; 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 1i3R3q-0006Wx-Rs; Thu, 29 Aug 2019 20:30:27 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2H-0003i4-8f for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:50 +0000 Received: by mail-pg1-x541.google.com with SMTP id o13so2176466pgp.12 for ; Thu, 29 Aug 2019 13:28:49 -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=ZtRE4tzSco72o3chGVIv73hx7TWJtztIiSnwQVUxI1k=; b=kiWgybCn9+Eqc0p4UHrd4vH+aGKXMB6h7MH5kykSab88spNCj9cU7I/yBlnnTXKwWa B/5WhbbqtonBDVeiuRMok8md+smiS30ZRW6jz2zU9y+zG0joy1HBc/QoLLn/NxZ2+UpV 4uYKIdB+mvC33EqfsvOWoF0NOcdP8zTn3KcJEoxdihWdQZ4u4NQZSOqfQbHUWEKt1dwV imY371VQnFZTH3t2wqggVkF4vFckPI4MQ0f8bdTWO0RX7/4NJVvWyjKpHA+PhAX3RDtB 8Da8Irnb/XuHlcK22wkFFioEWxOOVOocA0NFe21gIreLZhlRR8bv7YLNkcrliECgBoXx PoiA== 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=ZtRE4tzSco72o3chGVIv73hx7TWJtztIiSnwQVUxI1k=; b=S+wJ4KSy9wq9xKvQB+jFn7mjYB3T5I4PmdMnVIqUcqDQjlIL68+PtApNYAgrmH33Zu Rd2hEHwyuYnDykCzxqFqMQcCBei1++3cacgs7OssgCILRBeaplG4yNE9O2PgSjgO2Q3z Q92IGn6sS9U0CLpnqaqvv2wdIuAv1Dg4w80G+bQLTWqS+uKGMXQ+wIAPbCssDc7x45N5 r/Wf3HAeZYsshpBfA7s+s+2kulSPT9f8xzRdtmr05S8Lvp+BCVz0rUuJqf8Lc1YKUQ/k PRxXJ0JXzL6YNtp5riVE5BoCvnTpFhxpBENevbmegemOJQKgQrkw7uLDl1RlwTR24aRL te0Q== X-Gm-Message-State: APjAAAVQ+Qxkps5OYLJUy/5Y2J4bOTiXyfd0l2WKokBg4aLq2s6x0Lqw OYbFWz35xnNiZFBOpKyrJ++EOZXko/4= X-Google-Smtp-Source: APXvYqyOu4Np2Xs4Y4D91Y9VQdAV4MGZhdU9B8smzcH3E0RHUzEEFL52KfM/qo0jHGRtpVa31ipvVQ== X-Received: by 2002:a17:90a:e502:: with SMTP id t2mr11875721pjy.104.1567110528791; Thu, 29 Aug 2019 13:28:48 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:48 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 06/17] coresight: tmc-etr: Check if non-secure access is enabled Date: Thu, 29 Aug 2019 14:28:31 -0600 Message-Id: <20190829202842.580-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132849_314848_024C9473 X-CRM114-Status: GOOD ( 12.34 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Suzuki K Poulose CoreSight TMC-ETR must have the non-secure invasive debug access enabled for use by self-hosted tracing. Without it, there is no point in enabling the ETR. So, let us check it in the TMC_AUTHSTATUS register and fail the probe if it is disabled. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc.c | 12 ++++++++++++ drivers/hwtracing/coresight/coresight-tmc.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index be37aff573b4..3055bf8e2236 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -236,6 +236,7 @@ coresight_tmc_reg(ffcr, TMC_FFCR); coresight_tmc_reg(mode, TMC_MODE); coresight_tmc_reg(pscr, TMC_PSCR); coresight_tmc_reg(axictl, TMC_AXICTL); +coresight_tmc_reg(authstatus, TMC_AUTHSTATUS); coresight_tmc_reg(devid, CORESIGHT_DEVID); coresight_tmc_reg64(rrp, TMC_RRP, TMC_RRPHI); coresight_tmc_reg64(rwp, TMC_RWP, TMC_RWPHI); @@ -255,6 +256,7 @@ static struct attribute *coresight_tmc_mgmt_attrs[] = { &dev_attr_devid.attr, &dev_attr_dba.attr, &dev_attr_axictl.attr, + &dev_attr_authstatus.attr, NULL, }; @@ -342,6 +344,13 @@ static inline bool tmc_etr_can_use_sg(struct device *dev) return fwnode_property_present(dev->fwnode, "arm,scatter-gather"); } +static inline bool tmc_etr_has_non_secure_access(struct tmc_drvdata *drvdata) +{ + u32 auth = readl_relaxed(drvdata->base + TMC_AUTHSTATUS); + + return (auth & TMC_AUTH_NSID_MASK) == 0x3; +} + /* Detect and initialise the capabilities of a TMC ETR */ static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps) { @@ -349,6 +358,9 @@ static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps) u32 dma_mask = 0; struct tmc_drvdata *drvdata = dev_get_drvdata(parent); + if (!tmc_etr_has_non_secure_access(drvdata)) + return -EACCES; + /* Set the unadvertised capabilities */ tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 95d2e2747970..4c59f2a4ad0e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -39,6 +39,7 @@ #define TMC_ITATBCTR2 0xef0 #define TMC_ITATBCTR1 0xef4 #define TMC_ITATBCTR0 0xef8 +#define TMC_AUTHSTATUS 0xfb8 /* register description */ /* TMC_CTL - 0x020 */ @@ -90,6 +91,8 @@ #define TMC_DEVID_AXIAW_SHIFT 17 #define TMC_DEVID_AXIAW_MASK 0x7f +#define TMC_AUTH_NSID_MASK GENMASK(1, 0) + enum tmc_config_type { TMC_CONFIG_TYPE_ETB, TMC_CONFIG_TYPE_ETR, From patchwork Thu Aug 29 20:28:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122417 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73057112C for ; Thu, 29 Aug 2019 20:30:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 498012070B for ; Thu, 29 Aug 2019 20:30:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="G8OHBpLp"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uwPm6+We" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 498012070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=KXtwdd+m5wGRBFDjFS2bHk+UQtjlJYc9qmTYeAdlhto=; b=G8OHBpLppxarFlsaKpF/JM9ebY UGSqaPth8prOOzA/JMXld8RbWaza319P1im5Zrmk73dDgIdiHEKYpIOSx7Dtt55gtyVmXNy19q9cX QHKji+IHY9w9JQrplfOIfhOGqx5s7O8R9qBCpKFu4tZ1lzARp5PTaSQbT1oKchwzMM5kodyWdFqXW 5Xz1y/9J3lI622ZOfiOXHXRjQoXUmskBCuZTqbrXHE1/v93h5WJWi3P45qBPu8aD07l0LjffrgU1T Jg/E8ruv0QouF6a043nB/WsD6AcHqTIfj5nHcRpPpEiO7RB/gGEXolt2ziYFU1eps7OaSEmiusH8p 4B6DC35A==; 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 1i3R49-0006lw-V6; Thu, 29 Aug 2019 20:30:45 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2J-0003kY-S6 for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:53 +0000 Received: by mail-pl1-x642.google.com with SMTP id y1so2108252plp.9 for ; Thu, 29 Aug 2019 13:28:51 -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=lyxWH3I3xY93jZ4BZY/ubIbJwypjoTC/XYUq8klqrrE=; b=uwPm6+WepLLVw9NK0vv9RrcqjSJtEG75HZzxAJb/nZdiaoLMmdbAbeAkFLc9IhWyVs st82gr4ibHZfTFaHKUyBPp6UoseQwRVKGw9ZHo0ruYUkqzb3Rfdchij5v6hOlCdBcs5T pwchOPonhBlZaBuIgp2C53lbQoeX/yhZWoqJBS+kGWi71KGAB16hrPTu/7F1MJ9sQet9 ul7zwQvGewFY9GhewCsevbSkpSexZPJoDHephat/Nf7y5hhjUKHjafDcjGr7rXZxehVF wgBmhPVHo9zECnEBd/rrETqHTE4x9sbPeRFDyp9m54TbeS4bpZWd+eR82S5ryvHjHDKf TYDg== 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=lyxWH3I3xY93jZ4BZY/ubIbJwypjoTC/XYUq8klqrrE=; b=E0k01pWHaePXBwOwE9fvLJVx+OckKoRV7Pe3B5Imj2Q7AKdEa1G3g7WUA2FeLH1J9I CKL06Ckn32JJ4sx1j7tK+iLmD8D7/BqyrgdEJWwL3E6sxynTVYjQE0lqKhWfhTj1ORD1 T1IT2s8bXXTSFs+OBUUT13SufxaiB2gSI2VyLWd25B1GLWFJODynu+yLiBgKqDFvw61Q VIAn14k5n1GA6NJZhAnpHfUTxD3c2+IUqHYFoeYS0BGBkwoi4oy6sQDf/Ouh4xwk/kDJ F3WmRe7f9n//405J5KrQl0nAUXF4VtCFFWPsGMAgj0AFdPTsiLYHgwSrHoaGDJbnKK0s LjTQ== X-Gm-Message-State: APjAAAWPr0H/RMgEoAaPslDjcXnCt90TZPKN8AU/wmGG2twcJDFf6B4r z5oU2veXsG6kKqRvYSMTbt5VNGEZQE4= X-Google-Smtp-Source: APXvYqzZBZPQkCKu5r8gutDcTabY3R70X7SezfOnBcXV6eViVIkPDkWSjJJ0k0BpsxEEjOi/eIyKnQ== X-Received: by 2002:a17:902:9895:: with SMTP id s21mr11789126plp.255.1567110531000; Thu, 29 Aug 2019 13:28:51 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:49 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 07/17] coresight: Convert pr_warn to dev_warn for obsolete bindings Date: Thu, 29 Aug 2019 14:28:32 -0600 Message-Id: <20190829202842.580-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132851_956453_51D460B0 X-CRM114-Status: GOOD ( 11.50 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Suzuki K Poulose We warn the users of obsolete bindings in the DT for coresight replicator and funnel drivers. However we use pr_warn_once() which doesn't give a clue about which device it is bound to. Let us use dev_warn_once() to give the context. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-funnel.c | 2 +- drivers/hwtracing/coresight/coresight-replicator.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index fa97cb9ab4f9..84ca30f4e5ec 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -192,7 +192,7 @@ static int funnel_probe(struct device *dev, struct resource *res) if (is_of_node(dev_fwnode(dev)) && of_device_is_compatible(dev->of_node, "arm,coresight-funnel")) - pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n"); + dev_warn_once(dev, "Uses OBSOLETE CoreSight funnel binding\n"); desc.name = coresight_alloc_device_name(&funnel_devs, dev); if (!desc.name) diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index b7d6d59d56db..b29ba640eb25 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -184,7 +184,8 @@ static int replicator_probe(struct device *dev, struct resource *res) if (is_of_node(dev_fwnode(dev)) && of_device_is_compatible(dev->of_node, "arm,coresight-replicator")) - pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n"); + dev_warn_once(dev, + "Uses OBSOLETE CoreSight replicator binding\n"); desc.name = coresight_alloc_device_name(&replicator_devs, dev); if (!desc.name) From patchwork Thu Aug 29 20:28:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09D3D14E5 for ; Thu, 29 Aug 2019 20:31:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA96E2070B for ; Thu, 29 Aug 2019 20:31:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nak7xinH"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="orm9xnFJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA96E2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=jHcu5J1/flpxAc/DNFCAfIejsaf99gVCn5iXV1tpsyE=; b=nak7xinHVO40nJ/K3o9R/4JSHa xuSuKKMNzdG35iLaixE41SJnD/SXkj/0SMnTnB/bWkOwhctX4Yrj2JMluYuCZRKdD9H7zBY0djBz7 TsMIOosdYjm38wqiCHqWaRQtDwVsxgkkARU2WalchmmAHhZ7bupoER41YquRhw0FDsyCHPQs+DWFl /VAiRgV2YSGXdNezfxrBcN6vYiNt8K3KcT9sg/4BqTpfgLXIO4uqwEeYRlq+sEQKIqIqcT39BhlCZ Z3ukKG0cInQ1o1Pg4ge3ctnarEi3q1ArgF4/Vwmsry19BkVuUeJzURY7uZItIis/pMCjKCdjxT55f DZ5QZhjA==; 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 1i3R4M-00072z-1k; Thu, 29 Aug 2019 20:30:58 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2K-0003lW-9n for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:53 +0000 Received: by mail-pl1-x642.google.com with SMTP id t14so2106100plr.11 for ; Thu, 29 Aug 2019 13:28:52 -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=fgl0Hv4m6rVTvvPn7h0hS8xrcpwpLx1YzEBPcCkf+ys=; b=orm9xnFJCpi8wDGJk0uyFFfZKCq+Fbl+O9elJjERIeHAexYHEEx1pgODYqCli+PcUQ d++sRKyIwnHIF0qRQosMrwnRh5cdATg7Cs7BOteZZyWBm/XupNtqaSJRu+sb//biSuAW 4AB33zrmPGZZDrbQyXoILC9j0TyOOA5IXjFzKB8xDrb9zu2zMyT1vR1JH0WNx0XRpnYz BvgmIRDwyx7TI4WVThGXyARNcBOzC23K3DEWNhERb/+P+0S+y3zTAEmb+V8dd4Bal2if 5U1zpLayOGHjdzXjvX+7BuG6mgIwjk/7zVBV31zNR860mCNMmK/2+KeEbCbMx0DVzZyx Mkfw== 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=fgl0Hv4m6rVTvvPn7h0hS8xrcpwpLx1YzEBPcCkf+ys=; b=EXhcs9mmlxie5WG8zCo5hvduRhljXay9Mfqoj+FYZ3iBai4VcUsRgI561G09BXL9Xs I5CtHeGFoqiLGX7TcF7nYc4eHry4QDEMKNjInNWFU2MOvaaaGXW1DeW/WOyWomlWIN7w wU1hc6JKsmzhPwdHl4eqT7Xy2tO5KA9tQ9vo7r2DjTkAqo8VzEHX67wPNNMiWuy3+bC2 IcTZv+F9C6zE6iCCf5v+56F8sEx+GvGrJgKPD6vi7KCO3r8HXxohVR7sGCwwvp7OaPKf zrQJf18WwWZvr3UM0Jpc2nHndyouFTl4cIa1XD30/GtDo98CXV6BsmtVMOA8ceFBSCSn XuoQ== X-Gm-Message-State: APjAAAUC9ekuDeF1+UZL+P+teMZ+Ov2Y/bsliqRuf7EuLAcJMbx9Nagi PYV7hAHG/C0Ww8zRm7+1tENwK2FkGAU= X-Google-Smtp-Source: APXvYqzt1TuCeOImHpdiZz1vDMArvUJzWVRXiMct7jJkjezkPy9Jr8R1mKZxf5cxjgg1bKCwojWCRA== X-Received: by 2002:a17:902:542:: with SMTP id 60mr11520149plf.272.1567110531751; Thu, 29 Aug 2019 13:28:51 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:51 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 08/17] coresight: acpi: Static funnel support Date: Thu, 29 Aug 2019 14:28:33 -0600 Message-Id: <20190829202842.580-9-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132852_419242_EC18DD36 X-CRM114-Status: GOOD ( 10.59 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Suzuki K Poulose The ACPI bindings for CoreSight has been updated to add the device id for non-programmable CoreSight funnels (aka static funnels) as of v1.1 [0]. Add the ACPI id for static funnels in the driver. [0] https://static.docs.arm.com/den0067/a/DEN0067_CoreSight_ACPI_1.1.pdf Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-funnel.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 84ca30f4e5ec..05f7896c3a01 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -5,6 +5,7 @@ * Description: CoreSight Funnel driver */ +#include #include #include #include @@ -302,11 +303,19 @@ static const struct of_device_id static_funnel_match[] = { {} }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id static_funnel_ids[] = { + {"ARMHC9FE", 0}, + {}, +}; +#endif + static struct platform_driver static_funnel_driver = { .probe = static_funnel_probe, .driver = { .name = "coresight-static-funnel", .of_match_table = static_funnel_match, + .acpi_match_table = ACPI_PTR(static_funnel_ids), .pm = &funnel_dev_pm_ops, .suppress_bind_attrs = true, }, From patchwork Thu Aug 29 20:28:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122421 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FA0F112C for ; Thu, 29 Aug 2019 20:31:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C5F32070B for ; Thu, 29 Aug 2019 20:31:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y/OEqnI2"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qB8qfpjy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C5F32070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=rukemwmQET2KaFil1sdgskce3ujkgwMbmryCz7phxh4=; b=Y/OEqnI2dknXfN41lXmRcoGqKm r1Wc90VnWKqAnN7xTRZlOXXyAm3FdSBx2oRK5ZhJVQHrjTIddb+ZPGzi4jpc2kBmCgZCH/7TMQtT5 Nlq7Lz8+cXKGf4iQNeCf3Xjdd4BNSvz8tDuqGyXgjEi4bSDg2oMhftT2GQ9psF8JwDccH/Bx9zhmG UwzhW/GbFwaIYpTSnQZMDAq2347a+zk06iSDPrjOMEyWMCjYvTbX+wVjlPbsRvz7VJT1NGufhBjlv E1H9YVeqVqoUcbJMvWqWDYE+Z/GCzf6xH2aQoBwjEOF80FZdjb7SEigugjptB3d5tmw913AKGPSas Wyohb9xA==; 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 1i3R4c-0007G6-RQ; Thu, 29 Aug 2019 20:31:14 +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 1i3R2L-0003mB-DL for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:54 +0000 Received: by mail-pl1-x644.google.com with SMTP id m9so2115776pls.8 for ; Thu, 29 Aug 2019 13:28:52 -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=fpVkeA6g4XFAlHVQjTfS3OXnfP+15964icDfpkX9T2M=; b=qB8qfpjyZyiyODnQUhsuSzg6b32BMfSO5q2CcqeXQT4zTI7Y2xHTA17sj+EiRUAEpX qqv1g39pdH9Is181535GJ7Fhb8Kxw3fB6vgX6ifDJHxraaG9xWtYc+sdWH9wYTSBoobR cJ6UYaRH9nT/BvARKUNSEcztPM+YeY+dH/DQfjIQX6O8g3JPhUvDJ4XLmas6OkqbPXOr JqabEWfnHneYbMHUeY5CtQqN/cbZwcJT7R4vCW7mZV/kYtXTQt3LTqnFVTuTZ1PwRJBy EbuLH4xTmQXq6o97lPiy8whnxJkE7036N7WVnf2a7uZ9E4tNqIBwclQjFaEozlMl9o2s DLcw== 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=fpVkeA6g4XFAlHVQjTfS3OXnfP+15964icDfpkX9T2M=; b=bFOzS1RyZpvV7FGPyTNFUYo7AE85oET50xrcf8uDTIuPJYzeG6OCKEuqQJNBq1mTV7 GlZIWDF3fhwQTlj7ssOUacij3++I7dvdyJsWAz+r300tfwlszpJYWj8e3mEnPL+7QjqC bgyuQarDgqxcFJOIJZpdVAEzP/QxullY4IHcunzZ7ZfAmoyuLeAu7dz9R6mTOix4T/K9 yP1Teo0fob7yI8ZK0MNR4wJolPWbTZXmYStF1CeLWYu+/yYQ+FSBZoO/w/Uuv5DejY6M uMZ8shubdjgk9KbibkJPDDJwPxkcGeYcxyTGsCe1VojmhQUznz9B3IsSO4BrRaT7o06H JAvA== X-Gm-Message-State: APjAAAUeJaM44FIo22KMXRhzL3Wg28LuRzDPt6yauFQsT9YEXOJ3vo8H cgt0Ww+ueFfi1QJZkUVp3Bo+mA== X-Google-Smtp-Source: APXvYqxgX2kW379lZsbjYRleKsGZpijs/0L+E8n9XkLsnmtxMpVehlJaQynEjY84K/AV4+mqSuIr2A== X-Received: by 2002:a17:902:e613:: with SMTP id cm19mr11122508plb.299.1567110532482; Thu, 29 Aug 2019 13:28:52 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:52 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 09/17] coresight: etm4x: Remove superfluous setting of os_unlock Date: Thu, 29 Aug 2019 14:28:34 -0600 Message-Id: <20190829202842.580-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132853_472521_2CB9FF96 X-CRM114-Status: GOOD ( 11.29 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:644 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Andrew Murray In addition to unlocking the OS lock, etm4_os_unlock will also set the os_unlock flag. Therefore let's avoid unnecessarily setting os_unlock flag outside of this function. Signed-off-by: Andrew Murray Reviewed-by: Suzuki K Poulose [Fixed capital letter for "remove" in the title] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 28bcc0e58d7a..7ad15651e069 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1047,10 +1047,8 @@ static int etm4_starting_cpu(unsigned int cpu) return 0; spin_lock(&etmdrvdata[cpu]->spinlock); - if (!etmdrvdata[cpu]->os_unlock) { + if (!etmdrvdata[cpu]->os_unlock) etm4_os_unlock(etmdrvdata[cpu]); - etmdrvdata[cpu]->os_unlock = true; - } if (local_read(&etmdrvdata[cpu]->mode)) etm4_enable_hw(etmdrvdata[cpu]); From patchwork Thu Aug 29 20:28:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122423 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59A4314E5 for ; Thu, 29 Aug 2019 20:31:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 365382070B for ; Thu, 29 Aug 2019 20:31:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nIXnD5rN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KlirqNSZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 365382070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=JH+9rqleL3uv8dNDLIe/Q6/RVEkT92C5GeTn75Z2GVg=; b=nIXnD5rN2nwgcVEz5NXe8M4ig2 xfCfba6WOjS1TouCsxQuInT1wgr04YVsa3wtV50jwp9xRdbzT+PcH0esG769QujRboTQOLoRYn6rm WTFVYO4mAq0/u6rRrABULiwr1O0FdYgKvIeUNAT77IGhDiBVJ/RNZaeg9C6ZoKxzxFqkDyFheLUg6 mHAww9rFrEduIzwhiClNcq4HoI/vB+5u58gmOjHlbYKa3GSji+86ZsA1PssfkquIu8hOuoABYybYC BmaoLQWKsIElXbmSWY2lxHsZofAaBQ3MdaBxy2Yu9CUD933SE+t34+CqAzZJG1CKbsYsovA+xRqrg l4USWE0g==; 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 1i3R4r-0007TN-7u; Thu, 29 Aug 2019 20:31:29 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2M-0003mu-70 for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:55 +0000 Received: by mail-pl1-x641.google.com with SMTP id h3so2116869pls.7 for ; Thu, 29 Aug 2019 13:28:53 -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=hCklS4e5K72OswsT6XLNGtZ978s0B4rsmlu1tAGe+pE=; b=KlirqNSZYVd0ngq8d59iY7oaVkTclRQjLrdaDsQqLysEor8fK5E/UcrrLEtdl5DIW5 4caTfoY2avnu8ut2uDCh82SMIXWdpyM/Hh3HO6tjiXItu8KVHryny0bEAO7LuGMewn5R d2zqWSDecEMx+TCfyrGHpaZzuWcA00w4WfhBj06KSr185GhrBaDMB6C30WZZ/DfKC9Or KhudTGzVWdeckguiNF3Jn7wIB6IX0t8fxJkcLuKEp6b6ttDbLscnrY/8c7pmXL9lL/Hq 4TG3gG3IJZfttDutHyR/j5Hx0jQRZFOJJfkDH6BqoatL2gqSG+3dgmL1xvG1RTtZA1Zg Xz5Q== 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=hCklS4e5K72OswsT6XLNGtZ978s0B4rsmlu1tAGe+pE=; b=MvlNaWDSyZEgqwSopniw2IRiZU5e1kAx/EZSzEJJe6CBkG6m3F25SIDWX6vYeLelLE /3yYmIZ97mEBkeEyD/LM9NUcTz+ZHu3bIWsBI/1ryeYPY4pFK44NsvlufF4naoEPbcL6 ZPqq6wULJ1iQ3JvYfgWGxyFReP8y3EkHxk6QCr11YAHKek7u4/i04JJ4hd1mR30E1JhX 1Fo5IU2pF+px0XrhUA47T/pI2Yio6RYi0O2ZZ2wDbGAltzWquCDbIjp5oHfAxSvfrvbD lmBg/Uu3bS6kKQ7617UIavPWQcxKOumjNQDPXbVZzCC/PfDfg77PbsL3pvom2qqI1GZ9 SIUg== X-Gm-Message-State: APjAAAU34yXbKjV43DPFLpFTq34+HzdYVBnRsrO1QJkyx7RQT6qfHBgQ HCpxe5eaZpVIXSBS9MeRtmQeQQ== X-Google-Smtp-Source: APXvYqxZEZyeAX1Hmif6qyrp6Ra6ZB02BXu1SKgnhdQ7ttAERstzbSQBoCX7bljOEDifx4nUlTPKAQ== X-Received: by 2002:a17:902:1126:: with SMTP id d35mr11947965pla.330.1567110533144; Thu, 29 Aug 2019 13:28:53 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:52 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 10/17] coresight: etm4x: Use explicit barriers on enable/disable Date: Thu, 29 Aug 2019 14:28:35 -0600 Message-Id: <20190829202842.580-11-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132854_339870_4A90DF55 X-CRM114-Status: GOOD ( 14.33 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Andrew Murray Synchronization is recommended before disabling the trace registers to prevent any start or stop points being speculative at the point of disabling the unit (section 7.3.77 of ARM IHI 0064D). Synchronization is also recommended after programming the trace registers to ensure all updates are committed prior to normal code resuming (section 4.3.7 of ARM IHI 0064D). Let's ensure these syncronization points are present in the code and clearly commented. Note that we could rely on the barriers in CS_LOCK and coresight_disclaim_device_unlocked or the context switch to user space - however coresight may be of use in the kernel. On armv8 the mb macro is defined as dsb(sy) - Given that the etm4x is only used on armv8 let's directly use dsb(sy) instead of mb(). This removes some ambiguity and makes it easier to correlate the code with the TRM. Signed-off-by: Andrew Murray Reviewed-by: Suzuki K Poulose [Fixed capital letter for "use" in title] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 7ad15651e069..ec9468880c71 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -188,6 +188,13 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) dev_err(etm_dev, "timeout while waiting for Idle Trace Status\n"); + /* + * As recommended by section 4.3.7 ("Synchronization when using the + * memory-mapped interface") of ARM IHI 0064D + */ + dsb(sy); + isb(); + done: CS_LOCK(drvdata->base); @@ -453,8 +460,12 @@ static void etm4_disable_hw(void *info) /* EN, bit[0] Trace unit enable bit */ control &= ~0x1; - /* make sure everything completes before disabling */ - mb(); + /* + * Make sure everything completes before disabling, as recommended + * by section 7.3.77 ("TRCVICTLR, ViewInst Main Control Register, + * SSTATUS") of ARM IHI 0064D + */ + dsb(sy); isb(); writel_relaxed(control, drvdata->base + TRCPRGCTLR); From patchwork Thu Aug 29 20:28:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122425 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E575F14E5 for ; Thu, 29 Aug 2019 20:31:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C25942070B for ; Thu, 29 Aug 2019 20:31:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SfTTHJaz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VTwS4Mc0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C25942070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=FrudU1iu4sM8CPMjqBhjltbVGR/mnseBjO7LfP/b7FY=; b=SfTTHJazeeXnXifHe9hCg0D831 ohcHkSi/vNO46qexZNrL+bADPkSpN7WFdSriJYqw3gXKDqsgubUGtODB/XtndtiaGcB9Tv9FXXFiS ldc6r+ijK9hw3GFyXlAchT6o8SGaCw8w7dky1F/rWyHqGjhMwAaOkEUxg/tgNrT1ANarca+3m25Zy u4DRM1idnL0MY5FRAFj9u114r8UXP6xZhhzXe8RxafL5Lhj33skxdAYN7dRgxMBzzJv2R7RGbgZ6+ s74X8aUUFf4bHCZNBNAui4A/HEUR2yYJubty9HMvGx2Fo4FcwjYY1W+hSKrxk5AfyAvDah/ti/mxO 8mTDZg6w==; 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 1i3R57-0007gd-9n; Thu, 29 Aug 2019 20:31:45 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2M-0003nj-Q4 for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:56 +0000 Received: by mail-pl1-x643.google.com with SMTP id f19so2133873plr.3 for ; Thu, 29 Aug 2019 13:28: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=b5zJyHlGDBqJC4HV7eqiak/P9biAFuBrVePMCjU9nus=; b=VTwS4Mc0pVj27mlJ5xepGnvcaqPh/UJCcP/KLu6p9ra7So8wPeYMCmrxsZnHIJ0OrY f7vpEzs9HwB+ffsTuYmT+qIyVhoakqVTO6HYZThv3dw/m5S3wp/TbPcrcg8IFxUCys9y qritYw3DHoK8arwDK9wzF1I34qsPAMGoMuSVdTtJg+DFFc6OmbMESaUGBdLO8K2fm7iB 4xtkPXWLUsTIcRjV84fO9ZJ2pUog7X/V/YRuFwasVUugkZIefWNRgEtxy0m/9EjGdu7z YAHR5a5jVQn6facq2dLwz8HsdIWfpm1lGZypRCGb8Y73mwRecvThVRuU7p4Y9bSqysqV wOUA== 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=b5zJyHlGDBqJC4HV7eqiak/P9biAFuBrVePMCjU9nus=; b=fBTqLIgys9DtQ1fwukjt8Gjyx5kKZdwIDJIrZAKiUYCE7Lz7R0uQun4s6XRrU9woAj wZlA3QPhi2ULa9KT0ggz51gKbLhHR3OSPkSXEdSvB9ipYLrXYA1KHRn99X6fsncJvvmM AETsBcZYMvEba/6xz4UcyAwQEBCzDSFUi97BE/K8/PUZ2LTckHpk91wCPOfplHlJcEDN dfa2So3FQgmTH3QYgGF3XCwg0LHg4z8kQnTN1wdyaWJfqgWFZx2gMGnLQAGSbKQjg1Ry LmkNy7QZevGgUr4q2ljKnffNsFATmT6qdCFYRRCApr2AHJEgiCRQSq0/AD8tu0xAsya5 79dw== X-Gm-Message-State: APjAAAXFtv9O7WnB92WCWWp7fLRbsaNI0J1/c/zp6109CSX6VQFE6aHI lAzk39jMi9Nf3F10uFRzzhLV1w== X-Google-Smtp-Source: APXvYqxj8IoMZ8U7Kq3keglcixLYKy0eYCesSSj31JynTzBtpDYoGp8Tqj280M9iNofK0Jq/bKMUWA== X-Received: by 2002:a17:902:2f05:: with SMTP id s5mr11991108plb.170.1567110533892; Thu, 29 Aug 2019 13:28:53 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:53 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 11/17] coresight: etm4x: use module_param instead of module_param_named Date: Thu, 29 Aug 2019 14:28:36 -0600 Message-Id: <20190829202842.580-12-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132854_927040_A1C500CB X-CRM114-Status: GOOD ( 10.79 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Andrew Murray Given that the user-exposed module parameter for 'boot_enable' matches the variable that it sets, let's use module_param instead of module_param_named. Let's also use octal permissions (checkpatch recommends this) and provide a module parameter description. Signed-off-by: Andrew Murray Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index ec9468880c71..615bdbf7c9b7 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -34,7 +34,8 @@ #include "coresight-etm-perf.h" static int boot_enable; -module_param_named(boot_enable, boot_enable, int, S_IRUGO); +module_param(boot_enable, int, 0444); +MODULE_PARM_DESC(boot_enable, "Enable tracing on boot"); /* The number of ETMv4 currently registered */ static int etm4_count; From patchwork Thu Aug 29 20:28:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122429 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3093914E5 for ; Thu, 29 Aug 2019 20:32:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D3CD2070B for ; Thu, 29 Aug 2019 20:32:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hiOyAjcE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Taa04c2V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D3CD2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=Kr1sWXtmg3zLHHdg/HDj6tfISDXx6fa61jakNnOZis8=; b=hiOyAjcEropNnqX/VsYTkojlXk ENsCWj3mtArAEa/hhs0CtEarl+bzExIlBcA0ipJl3/FbQUxKXGN+k62W2YrHVli7e4NKhbGLYhN8S Bqfs5qseQlBB93g9Z2p7sSr+/SoWnBZrnAIRL/D/VOXqf1jRLZJB1jzVbG++F3FwpoebSqIpOdGvl bERofPpgwHA+Bhs8cgseqRASWCPVKu8AkD3h+CWl1mMQc/3Pw8tDCPoNvtwTfpqtRh+yhxLrAcTFt HPcrqpw0hYG40eh3GrZwgXW/1HGzDJHyH1qYcGqSo1F+NWD7Gx+W9WZrJFy+xyBMyfACgbYSxIxu3 3NGDVmVA==; 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 1i3R5J-0007u7-8s; Thu, 29 Aug 2019 20:31:57 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2N-0003ox-5S for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:57 +0000 Received: by mail-pl1-x643.google.com with SMTP id o3so2103218plb.13 for ; Thu, 29 Aug 2019 13:28:55 -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=m79oRnRrEr4qP8mVMU/76dpiarnntehXpScT0RVwif0=; b=Taa04c2VVm1QUnj+0gP+YRVeG4PBUTpzKpjZUNVPWhjceX8wBxp/R/XZjwGo6Q+oRB 9NwdkGftTaAuSVz2wz4/0hfXjOkUmCVItSsqXKHnpvJREvnq/cZfOvgRB2Hg91w2vAkR guSjY3y1skyEFN2/WLDPPvLnJThATjR20sgE4J8Eh9Y1lc8GulexOWquWyKHDvSrAq+W xPQV4eJ2CC+84VRAkkRNT9Cp6d+oHlcEmzGTSR5rmMZR4qx8PBDYeL5BbVPriUGlobrr Y/Pl5d7l5n6B4cQjJ4TqPAfewtve+Uw5h5CNnYaN5837I/uKYuhrIqaps9nq6yiz8eP8 cMrA== 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=m79oRnRrEr4qP8mVMU/76dpiarnntehXpScT0RVwif0=; b=n6MnMLSDtyOfhfGU713mzTb4dz6Z6U/Ffa5ap2f7ZLNELrCEw0p2CwMXU0a/qb5wpz iMS72IEVskxErSd+vyPOCuMVcr+SCdgcr/sx1+acQtqe4UZNgQiCn9Mg4EEua7rCERpf UklhSCiLcy5nMBXbeA9Md8DqmRbq8rnFcpUZZ7EUTxpZyBpwRyDMJzKNNtXOiywkwegx YLz9JpbbmOmRWmA+YjvqFrrXAFofnKoGCVyW7qC3Qg+l28hj14liwVPCbwJJnVHwriRP ilZ3w+VKlJHscaiHH2dezsf67Vx3IH3imA50bVQBvPSZFsdNk1oJ3AKnTTag1CGTfb72 FIlA== X-Gm-Message-State: APjAAAUWAUV+7XQd992rMjq1Y6HC+Qr/1XUYvc10fSOmVl3xR80LdBtc FWIrgge/kbkkpjv+EK3hHMjzQ1mZ084= X-Google-Smtp-Source: APXvYqwll5nTXFWczC0ZvzmJjKVimClwUqzosGWa5wWBhaihnhgLNeeNmId/FHQJ6QFY1HrDWh5Qpg== X-Received: by 2002:a17:902:6bc7:: with SMTP id m7mr12172902plt.60.1567110534704; Thu, 29 Aug 2019 13:28:54 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:54 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 12/17] coresight: etm4x: improve clarity of etm4_os_unlock comment Date: Thu, 29 Aug 2019 14:28:37 -0600 Message-Id: <20190829202842.580-13-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132855_408705_FB50FF4C X-CRM114-Status: GOOD ( 12.08 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Andrew Murray To improve clarity, let's update the comment for etm4_os_unlock to use the name of the register as per the ETM architecture specification. The existing comment is also misleading as it suggests any value written to TRCOSLAR unlocks the trace registers, however it must be '0' - let's also correct this. Signed-off-by: Andrew Murray Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 615bdbf7c9b7..a128b5063f46 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -48,7 +48,7 @@ static enum cpuhp_state hp_online; static void etm4_os_unlock(struct etmv4_drvdata *drvdata) { - /* Writing any value to ETMOSLAR unlocks the trace registers */ + /* Writing 0 to TRCOSLAR unlocks the trace registers */ writel_relaxed(0x0, drvdata->base + TRCOSLAR); drvdata->os_unlock = true; isb(); From patchwork Thu Aug 29 20:28:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 871921398 for ; Thu, 29 Aug 2019 20:32:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 642F02070B for ; Thu, 29 Aug 2019 20:32:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QtgB1Vxd"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QKloUu+1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 642F02070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=TS93avKJvo63j5LHxjcPAo4cDxMtXWAQzXF7lS4YGQg=; b=QtgB1VxdLBQisTgKtdIJOUuXv0 /HyJERWWp5FQioKlzE8KhQG4haplrLMXPkYIB8NgZSlF9CmTS5GbBVqLGAyKt8ZjLneTGKTKogx6p bJYxyKWDHCUZZTAUu9XswNGxTa9+WMHHi1T2iETlN8gNIBDeZdQ1t52xssyGZCrOPa4kz/t04pQnY tpXLAkz0Vr7hBZ/SvihMFon4vjJ0iutNfYmZ9uvkfme1agBflluLZkDy7dREy8ZqKZONctEOc5Rd8 u7YdQ51yiCSHBsU8RcHCmsBQBNmwDoZcIdX7DOUbzwkUvre+3igzkpNuXP7rjUYtWHj7uLUy8RD4l GxrLIy8w==; 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 1i3R5X-00086y-6e; Thu, 29 Aug 2019 20:32:11 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2N-0003pj-Vn for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:57 +0000 Received: by mail-pg1-x544.google.com with SMTP id n190so2209758pgn.0 for ; Thu, 29 Aug 2019 13:28:55 -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=dht/RUc4+DcZjMSx1Gk9ynHax5PcdbOKL1DeXRBmap4=; b=QKloUu+1WWB2hyO1EX6mdPu62V1PWog2BPnolZQihlcG+CHyvuVJtsnZKn3wYSfEYg 229ucIvdqCoSDdbAKslXiQWRs9KQzanRlq3NiWWSvyiVnD9kNWqRTxCWSL1OBt8KI0Se yxYzhK7by4/tTmW75M6Jj31Sl6TxNFCt8tMvWijWGQ6P3ahDw6GrvkN3HQkCn6bPpaan tf3cdny6TEQzrKSKFzJc0zX9jS92PjBih2qVQsLWW9ovPr0NwtyVx+rONtDBJk4cOZad +FtRcM4musLa2u7/DRziLkRcafbCygfPNyqFKxZ6Dc10Qh/+L3U6++ghG+Kio1Uk1pZf 6dSA== 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=dht/RUc4+DcZjMSx1Gk9ynHax5PcdbOKL1DeXRBmap4=; b=qUrIOV5uIBIZIiHEYkFdq/pmz1o3S7BUa1Q3kY12f7YLEky5yy+WXUh+R05Er7+f1O SaLodohVW3YY1rLEnVyLh7vSX2HJiizHALHInPDKY0mqeafzxRuDW1F4spX9vP4AA4VV vNI8a/OK2SSQLevls7xZSjmVVXVtglGrhE+SDNrU0IFDh76EAAjMdSPmtnASHM34vZb4 Q6oq1IFks8Hz31ET/gM6XGZ+YJUoxGpf2qRg2TR7vKzo/dTRgOgTSKYs9xrOMXwx4Z7y Arp2qWPA66loxU5mMYguMhpIchaQSM/ao4tDmHR99yk1IDQ67ZgqizjUua09ybL8ayl9 e67w== X-Gm-Message-State: APjAAAWOAmh9fn0NMAJCX8Tut40l95dSCCOCNHZWfH1iCU25T1qsp7MW ISABe8VhH6parxrDMUgMq1TuyQ== X-Google-Smtp-Source: APXvYqzLumVsarjdlWeQXqwDjH4Q986hSSVbQNJGdBqjMNSf4CRq3QPvnQDqRktXf4kPWyLyRo1dwQ== X-Received: by 2002:a63:2264:: with SMTP id t36mr9560463pgm.87.1567110535406; Thu, 29 Aug 2019 13:28:55 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:55 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 13/17] coresight: tmc-etr: Fix updating buffer in not-snapshot mode. Date: Thu, 29 Aug 2019 14:28:38 -0600 Message-Id: <20190829202842.580-14-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132856_113445_4C262B44 X-CRM114-Status: GOOD ( 13.94 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:544 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Yabin Cui TMC etr always copies all available data to perf aux buffer, which may exceed the available space in perf aux buffer. It isn't suitable for not-snapshot mode, because: 1) It may overwrite previously written data. 2) It may make the perf_event_mmap_page->aux_head report having more or less data than the reality. So change to only copy the latest data fitting the available space in perf aux buffer. Signed-off-by: Yabin Cui Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-tmc-etr.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 2246c1e6744a..f835a3c78b37 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1414,9 +1414,10 @@ static void tmc_free_etr_buffer(void *config) * tmc_etr_sync_perf_buffer: Copy the actual trace data from the hardware * buffer to the perf ring buffer. */ -static void tmc_etr_sync_perf_buffer(struct etr_perf_buffer *etr_perf) +static void tmc_etr_sync_perf_buffer(struct etr_perf_buffer *etr_perf, + unsigned long to_copy) { - long bytes, to_copy; + long bytes; long pg_idx, pg_offset, src_offset; unsigned long head = etr_perf->head; char **dst_pages, *src_buf; @@ -1426,8 +1427,7 @@ static void tmc_etr_sync_perf_buffer(struct etr_perf_buffer *etr_perf) pg_idx = head >> PAGE_SHIFT; pg_offset = head & (PAGE_SIZE - 1); dst_pages = (char **)etr_perf->pages; - src_offset = etr_buf->offset; - to_copy = etr_buf->len; + src_offset = etr_buf->offset + etr_buf->len - to_copy; while (to_copy > 0) { /* @@ -1438,6 +1438,8 @@ static void tmc_etr_sync_perf_buffer(struct etr_perf_buffer *etr_perf) * 3) what is available in the destination page. * in one iteration. */ + if (src_offset >= etr_buf->size) + src_offset -= etr_buf->size; bytes = tmc_etr_buf_get_data(etr_buf, src_offset, to_copy, &src_buf); if (WARN_ON_ONCE(bytes <= 0)) @@ -1458,8 +1460,6 @@ static void tmc_etr_sync_perf_buffer(struct etr_perf_buffer *etr_perf) /* Move source pointers */ src_offset += bytes; - if (src_offset >= etr_buf->size) - src_offset -= etr_buf->size; } } @@ -1505,7 +1505,11 @@ tmc_update_etr_buffer(struct coresight_device *csdev, spin_unlock_irqrestore(&drvdata->spinlock, flags); size = etr_buf->len; - tmc_etr_sync_perf_buffer(etr_perf); + if (!etr_perf->snapshot && size > handle->size) { + size = handle->size; + lost = true; + } + tmc_etr_sync_perf_buffer(etr_perf, size); /* * In snapshot mode we simply increment the head by the number of byte From patchwork Thu Aug 29 20:28:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122433 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E82C1398 for ; Thu, 29 Aug 2019 20:32:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B67D2070B for ; Thu, 29 Aug 2019 20:32:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WcdIrlxB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="a3Ccg5fO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B67D2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=xvdkCszcXE31IuH91Kmy2CTTQ1t6cPvP2gx9TCEA9o0=; b=WcdIrlxBhFJdUmMoNyxQxFRRDI LLgZdbqJLRJNZq5fOWgNqe7jce1pJMnAiwPCKioM/yy85x5L24KB3H7J+LCzkE/djlzzD++5JnynO 3ndN5r7iJeWNTFr/q7G6hMSaxbnAiaP9xr3aPRgg75a/Aofyo2RBQHs48bfIbAooGbJ1SSGPzpHH8 wIPGA/UCLSPM8YoSOOvb8Ive6r+nUp+QMZpGzOT3gNkjbVmCtjkqHraqy9XtFSIxKTTFVSigQugdc sBDRo78st+PXOEQSbL/shgIH1FCQPKlv/aB7gpz785P5NLv1ufrSXg2LlZZrbGcZ20ewnw7gIUzoS au7AFISg==; 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 1i3R5j-0008Kh-EI; Thu, 29 Aug 2019 20:32:23 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2P-0003rB-DO for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:28:59 +0000 Received: by mail-pg1-x542.google.com with SMTP id e11so2192105pga.5 for ; Thu, 29 Aug 2019 13:28:57 -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=rYvz4IhkNbEOrtxPHmF8tW+sLayn2a1deeWF2dkHF3Y=; b=a3Ccg5fOp6hdn/Ot3iqv75JTy+gXgKNRstQ8V1f8Nno+y5WL/Q3K0kp6a0t/i6O171 tWjJR+UWKk/yUbGPonzAgFKa7yn6kiAytFHaUn54smrijjGBiP3xhWTM2365mD/AujZV AUQf6Q6FC1+CSzpH1MDzGwJiQnP4LRlVyo5nnWBc8H/48o/wVFIkavFdvYlO8PV/y0qt 8WJ4dy4Kj5uLd1IArrxNmGOwsexWgbE8TkFB9ftJ/8C2mI2mc7gvhVuD6caA0sBsfCo+ Xf2G7CQRGMHO5rt6e7pI88cZkxH0lXlz74jiHc1zpW3RtOCTWAWs7/9rb7BPYQUiNPSC 78sg== 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=rYvz4IhkNbEOrtxPHmF8tW+sLayn2a1deeWF2dkHF3Y=; b=sgVYDTrvL6VHekxyTWRXefwuZ+4fvt6T+eiLU4S7Xx/VOcKfAWdcq4AcP1xo9imADS RWbzigyJpvkmHXtVoFiQQ0URhmB4R9asLhM8ByTxscKjwiei4iPHUnMW+BdI8xw/QcwR r5VMg74HD3ONVenioB8VFrNmILx6YwPOLfxxPhOF29KtzhidP/F2yfq6o+ZMys4MM6jV WK/5F3lp/ONaB80bZ1cTrgCOimopUddwWBeAUTDMvSFrtY5xHb9C0HWfgcWbw5V/aPfw bFW/mjJelxeHYKjK2fumwbXT0YoVFPcf7weAbDiymSjuQTmjF7aT/gH1oPJEQYUfcSxw bjEQ== X-Gm-Message-State: APjAAAXaRJysJND47YqUhoPBiDoOvOG0svg/7hnuyKiLehvBJ37tMoZv 56t2v9EPRsGOMWC5q2A6TYgvI6SmkBA= X-Google-Smtp-Source: APXvYqzRd2oF6S8sZ/uIQrKUOn9rBbjEsbxMbz1XPZ827rjlFbYbc1FurPi+cwnRk6Oz1JwroN+3ww== X-Received: by 2002:a65:4948:: with SMTP id q8mr9881898pgs.214.1567110536528; Thu, 29 Aug 2019 13:28:56 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:56 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 14/17] coresight: tmc-etr: Fix perf_data check Date: Thu, 29 Aug 2019 14:28:39 -0600 Message-Id: <20190829202842.580-15-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132857_671629_6F08CA51 X-CRM114-Status: GOOD ( 13.65 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 From: Yabin Cui When tracing etm data of multiple threads on multiple cpus through perf interface, each cpu has a unique etr_perf_buffer while sharing the same etr device. There is no guarantee that the last cpu starts etm tracing also stops last. This makes perf_data check fail. Fix it by checking etr_buf instead of etr_perf_buffer. Also move the code setting and clearing perf_buf to more suitable places. Fixes: 3147da92a8a8 ("coresight: tmc-etr: Allocate and free ETR memory buffers for CPU-wide scenarios") Signed-off-by: Yabin Cui Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 8 ++++---- drivers/hwtracing/coresight/coresight-tmc.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index f835a3c78b37..4f000a03152e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1488,7 +1488,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev, goto out; } - if (WARN_ON(drvdata->perf_data != etr_perf)) { + if (WARN_ON(drvdata->perf_buf != etr_buf)) { lost = true; spin_unlock_irqrestore(&drvdata->spinlock, flags); goto out; @@ -1500,8 +1500,6 @@ tmc_update_etr_buffer(struct coresight_device *csdev, tmc_sync_etr_buf(drvdata); CS_LOCK(drvdata->base); - /* Reset perf specific data */ - drvdata->perf_data = NULL; spin_unlock_irqrestore(&drvdata->spinlock, flags); size = etr_buf->len; @@ -1564,7 +1562,6 @@ static int tmc_enable_etr_sink_perf(struct coresight_device *csdev, void *data) } etr_perf->head = PERF_IDX2OFF(handle->head, etr_perf); - drvdata->perf_data = etr_perf; /* * No HW configuration is needed if the sink is already in @@ -1580,6 +1577,7 @@ static int tmc_enable_etr_sink_perf(struct coresight_device *csdev, void *data) /* Associate with monitored process. */ drvdata->pid = pid; drvdata->mode = CS_MODE_PERF; + drvdata->perf_buf = etr_perf->etr_buf; atomic_inc(csdev->refcnt); } @@ -1625,6 +1623,8 @@ static int tmc_disable_etr_sink(struct coresight_device *csdev) /* Dissociate from monitored process. */ drvdata->pid = -1; drvdata->mode = CS_MODE_DISABLED; + /* Reset perf specific data */ + drvdata->perf_buf = NULL; spin_unlock_irqrestore(&drvdata->spinlock, flags); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 4c59f2a4ad0e..9dbcdf453e22 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -182,8 +182,8 @@ struct etr_buf { * device configuration register (DEVID) * @idr: Holds etr_bufs allocated for this ETR. * @idr_mutex: Access serialisation for idr. - * @perf_data: PERF buffer for ETR. - * @sysfs_data: SYSFS buffer for ETR. + * @sysfs_buf: SYSFS buffer for ETR. + * @perf_buf: PERF buffer for ETR. */ struct tmc_drvdata { void __iomem *base; @@ -206,7 +206,7 @@ struct tmc_drvdata { struct idr idr; struct mutex idr_mutex; struct etr_buf *sysfs_buf; - void *perf_data; + struct etr_buf *perf_buf; }; struct etr_buf_operations { From patchwork Thu Aug 29 20:28:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F7F21398 for ; Thu, 29 Aug 2019 20:32:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C3482070B for ; Thu, 29 Aug 2019 20:32:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YxalVxL6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zuLKb5Kw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C3482070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=pQXmWw/v0dXZb8ulqL+J5iswLiezTtebuw9FdTowNIc=; b=YxalVxL6fImcZCgbRw0RexAt9M Jb4QLIr+85E4kqkBz/B5oeqz9IyAaqx3r9zPcbLbON+IcEhNl7BQ9FdETnoY/xF0EL4n3f3cAv8C7 JHjZfV1otHkVwpylJ323Qb8YlpT1Vxf+4LFkqa+CY1cIMXU/2oI9lEYxWPRLnXcwLW3001//3YAT1 mMr6eDyfoMRRc4c69K6nZz0NClm6V6oSLjmv5V6oy04k2xRBD/65brceQjJ9Bf7buR9FaxIbk/hRi 6uFY5i2juaEaVmWNOS1cAKlnTb8WRs1wKDyMSrvSRPWOCysvdvpfC5jUtsq2ggOD1kIl/mbZcbKuG UsMcN+4A==; 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 1i3R5x-000062-TG; Thu, 29 Aug 2019 20:32:37 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2Q-0003sW-HH for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:29:00 +0000 Received: by mail-pf1-x442.google.com with SMTP id w26so2837144pfq.12 for ; Thu, 29 Aug 2019 13:28:58 -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=E6JJPDmvISX991Wh+NJW8zwoICYYRk5QMIwlhnt3CGg=; b=zuLKb5Kwu59QP18+LohC8fxu31X9MGkRLi4sOAryHBSlKK71nBfZ8/rhAPwp3TxzBP ifuDvwW9s/3/3CJ+mQGBKYp/4ZcMcRgbO4biVflJ34GlGs1WC+7qigIqeq+oD2Wmo/Lg /EOY7kNIvrvMrfvufovvnaRJ/GmX/DcuyrN9f2oFjIyCfkJd0CVlpywcUtNkoFzbyX04 bauAb1q1On7LhyPMF+bkZjj7hMfc+GTzDSbLnVfYmWDnBWjznqDJ9ZSH+Bs0QjwY2MGA J8HbZTu69yBgB2t+/1VsMVL7GJgdGk9LbEbmWK3JgZixvBl/qR6pcP5oDYVrImOWfngT ExSQ== 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=E6JJPDmvISX991Wh+NJW8zwoICYYRk5QMIwlhnt3CGg=; b=L5cveAZCEn8Y1ut4NnlHjsagwglMRtK9Btt9SfBDO01ShixXmBEwe3mTPvcEH9PJkE us3bKVJopsB9BnJlC8wt0ngZ5C5PsnKMp6NOi/zWJHv6GyLfrRQisQpZFWPj+aq5r7oP fmAG5+Cu0T2sb95diDC8fWO/Zzb7lgfOyF17K9vUB7QjMZYoNksHgiEiV4NV8AcR26pG 1AYoGmiNTfHOdHhSXuqFUN9Vp9ZjkxPHQxif5PuBf3lgNfSQ9IAJBsmu/VPi6yw5SF3E Puw5k7cGD8KHittRZi29IlLdLB5VTCWuqTFgdmqCIxNE7v8JWHW2TdJWKWhPnn08tJsw ePmw== X-Gm-Message-State: APjAAAV7T0JbJThkctmjWb8xPbPv0+HrdySeuQ/X0B4OKLFVrmTa3oVz faRU3H6ix9ldmwJ6mnJzk31l8QNnf/A= X-Google-Smtp-Source: APXvYqxpXbXRC4EmUBxFTrlHoSF6YCdKHrNTCHRs7FfRzMVzvj6/n2B98LpvIm/x1GIJ2h1Zgdm3gA== X-Received: by 2002:a65:6108:: with SMTP id z8mr9980441pgu.289.1567110537766; Thu, 29 Aug 2019 13:28:57 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:57 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 15/17] coresight: tmc: Make memory width mask computation into a function Date: Thu, 29 Aug 2019 14:28:40 -0600 Message-Id: <20190829202842.580-16-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132858_642837_C5797250 X-CRM114-Status: GOOD ( 15.41 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 Make the computation of a memory mask representing the width of the memory bus into a function so that it can be re-used by the ETR driver. Signed-off-by: Mathieu Poirier Reviewed-by: Leo Yan --- .../hwtracing/coresight/coresight-tmc-etf.c | 23 ++------------- drivers/hwtracing/coresight/coresight-tmc.c | 28 +++++++++++++++++++ drivers/hwtracing/coresight/coresight-tmc.h | 1 + 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 23b7ff00af5c..807416b75ecc 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -479,30 +479,11 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, * traces. */ if (!buf->snapshot && to_read > handle->size) { - u32 mask = 0; - - /* - * The value written to RRP must be byte-address aligned to - * the width of the trace memory databus _and_ to a frame - * boundary (16 byte), whichever is the biggest. For example, - * for 32-bit, 64-bit and 128-bit wide trace memory, the four - * LSBs must be 0s. For 256-bit wide trace memory, the five - * LSBs must be 0s. - */ - switch (drvdata->memwidth) { - case TMC_MEM_INTF_WIDTH_32BITS: - case TMC_MEM_INTF_WIDTH_64BITS: - case TMC_MEM_INTF_WIDTH_128BITS: - mask = GENMASK(31, 4); - break; - case TMC_MEM_INTF_WIDTH_256BITS: - mask = GENMASK(31, 5); - break; - } + u32 mask = tmc_get_memwidth_mask(drvdata); /* * Make sure the new size is aligned in accordance with the - * requirement explained above. + * requirement explained in function tmc_get_memwidth_mask(). */ to_read = handle->size & mask; /* Move the RAM read pointer up */ diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 3055bf8e2236..1cf82fa58289 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -70,6 +70,34 @@ void tmc_disable_hw(struct tmc_drvdata *drvdata) writel_relaxed(0x0, drvdata->base + TMC_CTL); } +u32 tmc_get_memwidth_mask(struct tmc_drvdata *drvdata) +{ + u32 mask = 0; + + /* + * When moving RRP or an offset address forward, the new values must + * be byte-address aligned to the width of the trace memory databus + * _and_ to a frame boundary (16 byte), whichever is the biggest. For + * example, for 32-bit, 64-bit and 128-bit wide trace memory, the four + * LSBs must be 0s. For 256-bit wide trace memory, the five LSBs must + * be 0s. + */ + switch (drvdata->memwidth) { + case TMC_MEM_INTF_WIDTH_32BITS: + /* fallthrough */ + case TMC_MEM_INTF_WIDTH_64BITS: + /* fallthrough */ + case TMC_MEM_INTF_WIDTH_128BITS: + mask = GENMASK(31, 4); + break; + case TMC_MEM_INTF_WIDTH_256BITS: + mask = GENMASK(31, 5); + break; + } + + return mask; +} + static int tmc_read_prepare(struct tmc_drvdata *drvdata) { int ret = 0; diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 9dbcdf453e22..71de978575f3 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -255,6 +255,7 @@ void tmc_wait_for_tmcready(struct tmc_drvdata *drvdata); void tmc_flush_and_stop(struct tmc_drvdata *drvdata); void tmc_enable_hw(struct tmc_drvdata *drvdata); void tmc_disable_hw(struct tmc_drvdata *drvdata); +u32 tmc_get_memwidth_mask(struct tmc_drvdata *drvdata); /* ETB/ETF functions */ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata); From patchwork Thu Aug 29 20:28:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122437 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2669814E5 for ; Thu, 29 Aug 2019 20:32:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0265D2070B for ; Thu, 29 Aug 2019 20:32:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C+MAebwM"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ldKueGDn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0265D2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=abcuc+UQZK8tE0PTami2yajttWjfotrEhofyG8HqUNc=; b=C+MAebwM9Z0DDbBO/aVsDqpcZJ ukua9Vfhv3q9dK4PfgoI+WeRjjIlyzqHiII1XE30SDR4WnjMu76a/4wqstbYaTLXrY1s2VrejMSWx AZost09EaJwhLS+9covS8yzxOWnt0Hi7kLkrRW2EqNFa6wR/USjvUD0l32It8hCbeni+8du0dh8Yo joMpXPiQoU4Zcd5Fm3kxVQTEWWepyyeYxzI7PGs9Jf47gixKt4/3evJhvQddevRtE4EvyuNw8FJQ9 3nIkAEE+2zNDwSqNYDU+0lXy0q3Z3jsCTEQrE4koqTHTlNl3Y9/rJuyVkr7BjCAIy16xA8820pMnO 0maXTYfQ==; 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 1i3R6A-0000KZ-Qj; Thu, 29 Aug 2019 20:32:51 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2R-0003tY-8x for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:29:01 +0000 Received: by mail-pg1-x542.google.com with SMTP id u17so2192959pgi.6 for ; Thu, 29 Aug 2019 13:28:59 -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=+Z3NPWauWgqkbAtaaZA1LMl/05vfVy1Sm0Y1RvvWJNM=; b=ldKueGDnjf1aV9chhRpVQoaP6mJfnsqgRVWouu0i5X418/0TxiyUb6zvDZkucs/eJd 42d/GnKGMaRfc/DuARvZ2yfDxmPaKL7EAtN8l5MLr4MxRbk7bVzBtfJWl19kA8E3/s46 JbF2tgRlyFGk0BbdsSe+Cyl9T7S/PqdwWuZJQhk9NyhoW74AqxnH1ktuU4yQBpGbgV3+ 0EhMzfHYnj/dHrRcb+X09+qajHRJFbwfBtmv5SlOVLSeuxRXXZZig4wjwVLkQ7UoLb7d aV5LJR5hqfyPNl5RXf0KeJgJWn/495dYllnSHrqN9sIdWkX1EUZF6VPVCHCBdKv92RuG bwpw== 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=+Z3NPWauWgqkbAtaaZA1LMl/05vfVy1Sm0Y1RvvWJNM=; b=TkCaTFYwCYa++pf6pDQMdtzth8xDVU31exoompbpChsYtpwPydBcHHqIytAEGsG/k2 TRLm4uQErcWf09wfCMM7cL3uqfO1BiyoTyD4AjSw5s9thHpQnUAeiy46FgorodJUspFO L6XqPsd0IU83fvriSZHcA4k+r0rA/RCPn0CIqx4lshjwPsJHy5U8aFxbFNlH/TjWQx1Q 7HaI2SQqp7xwjGuaUJRwteeFsInj1B96IVprIStyViqc0kRH8dMOtqZkUBltGVgfcW35 S1akRREEhb5XR+guItmYxbbmTOwKJf3Gi4H5+V9Of65ob7PZud6NVC62/xfvXpiQDFDA KoXA== X-Gm-Message-State: APjAAAV5PS80yea/aJOJEi/Bhr2k0ffAxmDucaUeBWQxbmyxeOzA02ly FADygmiYV2M6+014QxtQkv2tHg== X-Google-Smtp-Source: APXvYqw6fKuYNcSWl6VZ8txCpcbpn/DEO4p1VN/o1K12yzCs74gVEgOPraGOIo3rgs+N47bHqjykdg== X-Received: by 2002:a63:10a:: with SMTP id 10mr10095873pgb.281.1567110538599; Thu, 29 Aug 2019 13:28:58 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:58 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 16/17] coresight: tmc-etr: Decouple buffer sync and barrier packet insertion Date: Thu, 29 Aug 2019 14:28:41 -0600 Message-Id: <20190829202842.580-17-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132859_542025_D94D10FE X-CRM114-Status: GOOD ( 12.83 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 If less space is available in the perf ring buffer than the ETR buffer, barrier packets inserted in the trace stream by tmc_sync_etr_buf() are skipped over when the head of the buffer is moved forward, resulting in traces that can't be decoded. This patch decouples the process of syncing ETR buffers and the addition of barrier packets in order to perform the latter once the offset in the trace buffer has been properly computed. Signed-off-by: Mathieu Poirier Reviewed-by: Leo Yan --- .../hwtracing/coresight/coresight-tmc-etr.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 4f000a03152e..bae47272de98 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -946,10 +946,6 @@ static void tmc_sync_etr_buf(struct tmc_drvdata *drvdata) WARN_ON(!etr_buf->ops || !etr_buf->ops->sync); etr_buf->ops->sync(etr_buf, rrp, rwp); - - /* Insert barrier packets at the beginning, if there was an overflow */ - if (etr_buf->full) - tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf->offset); } static void __tmc_etr_enable_hw(struct tmc_drvdata *drvdata) @@ -1086,6 +1082,13 @@ static void tmc_etr_sync_sysfs_buf(struct tmc_drvdata *drvdata) drvdata->sysfs_buf = NULL; } else { tmc_sync_etr_buf(drvdata); + /* + * Insert barrier packets at the beginning, if there was + * an overflow. + */ + if (etr_buf->full) + tmc_etr_buf_insert_barrier_packet(etr_buf, + etr_buf->offset); } } @@ -1502,11 +1505,16 @@ tmc_update_etr_buffer(struct coresight_device *csdev, CS_LOCK(drvdata->base); spin_unlock_irqrestore(&drvdata->spinlock, flags); + lost = etr_buf->full; size = etr_buf->len; if (!etr_perf->snapshot && size > handle->size) { size = handle->size; lost = true; } + + /* Insert barrier packets at the beginning, if there was an overflow */ + if (lost) + tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf->offset); tmc_etr_sync_perf_buffer(etr_perf, size); /* @@ -1517,8 +1525,6 @@ tmc_update_etr_buffer(struct coresight_device *csdev, */ if (etr_perf->snapshot) handle->head += size; - - lost |= etr_buf->full; out: /* * Don't set the TRUNCATED flag in snapshot mode because 1) the From patchwork Thu Aug 29 20:28:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11122439 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AEC841398 for ; Thu, 29 Aug 2019 20:33:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8B5CD2070B for ; Thu, 29 Aug 2019 20:33:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m3bDvwAq"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="b3DnXAN+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B5CD2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=FzpkVKp5A00fZB+NYzTYAxy4D+DCDtLf8jKZtDNU+A4=; b=m3bDvwAqQrcw9/r5HRWCFnksd7 GPw17N8g5FeaBiq5MLEzLx6CWiLeD9XOP0s3vFSSrpn2jAU8oDYlSUWDuwqHyPD/7egYzloVlM1kt /023eDlzKFpXaP5yQOiv0P46BPMiJYRb/VRJHcqv96OoilEDiTRY3Z6+euIa2/oFEQrQDIrhbshO4 Yq1fR6y6dA+4y3c7FPd6iVJLgIcRlxpkn6X+nqWq/QcPoiPKxHR+XdpDe5rbyeIZh3zZc/2qrTCW2 vKTDO1QRe/ZFjVNxM7aQGoDi20y8WqUUDnVmH1Tqd7k+P432mjRyDHx7B+YgXSRsjB53gn3oV1cAH JnktA9uw==; 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 1i3R6P-0000Xe-V5; Thu, 29 Aug 2019 20:33:06 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3R2S-0003uU-9X for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 20:29:01 +0000 Received: by mail-pg1-x544.google.com with SMTP id e11so2192186pga.5 for ; Thu, 29 Aug 2019 13:29:00 -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=a4fLj0pzLTp9f4awHR+2/MiqHLekTbzHMO5Bqs6m/10=; b=b3DnXAN+54JSbRJ5yI0uNAWG1+GgHUU+TReNh8zcGDFl26RYlGv/cHtp6cAqj/Pl5Z 4ESx/j/0Ab7728jshvKy1414DEkybd0yOr06RpbZbAXjBsjYdqrKxNOfBgNFdAybeCiz N+Z7CsBVpE/wrgsSYW2PEEoERAA7i5ME4+LlQTNWrrVPuqy8U9c7AmHIi4BRd4/MVAwL 6TJEZxHx7ep9tvCxGQ7S/nON41lzQoMBbW1sT+vViShy4m3Nfj3DU27s2+QLoKLyrJee x1s4VetypGJ+yTyB49RA6PLsavHKD+Y5qb6GZ5lpD8kvEJCRSx8DrL00SrCF6F4Q1kE6 KVig== 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=a4fLj0pzLTp9f4awHR+2/MiqHLekTbzHMO5Bqs6m/10=; b=tBHy4nz4+w/0z0IlDgwFWK+Z0wAE5Gxg0sJPNClkbEG+Dp/yuANAwkSKk++HX2xvbf SfA4tjUHzCmCbS4nMtA+/C9vsLfqKso1463Rr8TgdDdGj164CqJoaXJRq0Zg7dIE19KY 4NUIjjDxbXeq8RIfTEz5eK+r70mkqXQuYwZnslgkFpn2o2RJh3654e3R8m4ldyZbvY+e 0VFDHfboKb5aNjS+E1NIEcTI8QLMY7p+xY1SreyMe9QVtzfOfmDSG6xGI2RtC0PO1ulb VmgdNzGX02pUBIG+XCrtezr8n+Fi1v97S1MTm1rcChnGYpHpdYDNsRPYMfFUbNg7vgA2 sJxA== X-Gm-Message-State: APjAAAXXhVOedrRGTLJ34O5eyOsb561WWBaOehJnr2uy4CjPG+CosEqr Q++EH2+lQ8LU3LxqjqQEk9XPtw== X-Google-Smtp-Source: APXvYqyxgMZlae3Rm+VSdxYOt2HE3ppCQLjD+ApyYoYU1cGxOW+2Xo1m7irCZTsV780b2Vz/US+mAA== X-Received: by 2002:a63:1743:: with SMTP id 3mr9672715pgx.435.1567110539475; Thu, 29 Aug 2019 13:28:59 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id k64sm3620947pgk.74.2019.08.29.13.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 13:28:59 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 17/17] coresight: tmc-etr: Add barrier packets when moving offset forward Date: Thu, 29 Aug 2019 14:28:42 -0600 Message-Id: <20190829202842.580-18-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190829202842.580-1-mathieu.poirier@linaro.org> References: <20190829202842.580-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_132900_384342_46BA59FB X-CRM114-Status: GOOD ( 15.39 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:544 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 This patch adds barrier packets in the trace stream when the offset in the data buffer needs to be moved forward. Otherwise the decoder isn't aware of the break in the stream and can't synchronise itself with the trace data. Signed-off-by: Mathieu Poirier Tested-by: Yabin Cui Reviewed-by: Leo Yan --- .../hwtracing/coresight/coresight-tmc-etr.c | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index bae47272de98..625882bc8b08 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1418,10 +1418,11 @@ static void tmc_free_etr_buffer(void *config) * buffer to the perf ring buffer. */ static void tmc_etr_sync_perf_buffer(struct etr_perf_buffer *etr_perf, + unsigned long src_offset, unsigned long to_copy) { long bytes; - long pg_idx, pg_offset, src_offset; + long pg_idx, pg_offset; unsigned long head = etr_perf->head; char **dst_pages, *src_buf; struct etr_buf *etr_buf = etr_perf->etr_buf; @@ -1430,7 +1431,6 @@ static void tmc_etr_sync_perf_buffer(struct etr_perf_buffer *etr_perf, pg_idx = head >> PAGE_SHIFT; pg_offset = head & (PAGE_SIZE - 1); dst_pages = (char **)etr_perf->pages; - src_offset = etr_buf->offset + etr_buf->len - to_copy; while (to_copy > 0) { /* @@ -1478,7 +1478,7 @@ tmc_update_etr_buffer(struct coresight_device *csdev, void *config) { bool lost = false; - unsigned long flags, size = 0; + unsigned long flags, offset, size = 0; struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); struct etr_perf_buffer *etr_perf = config; struct etr_buf *etr_buf = etr_perf->etr_buf; @@ -1506,16 +1506,35 @@ tmc_update_etr_buffer(struct coresight_device *csdev, spin_unlock_irqrestore(&drvdata->spinlock, flags); lost = etr_buf->full; + offset = etr_buf->offset; size = etr_buf->len; + + /* + * The ETR buffer may be bigger than the space available in the + * perf ring buffer (handle->size). If so advance the offset so that we + * get the latest trace data. In snapshot mode none of that matters + * since we are expected to clobber stale data in favour of the latest + * traces. + */ if (!etr_perf->snapshot && size > handle->size) { - size = handle->size; + u32 mask = tmc_get_memwidth_mask(drvdata); + + /* + * Make sure the new size is aligned in accordance with the + * requirement explained in function tmc_get_memwidth_mask(). + */ + size = handle->size & mask; + offset = etr_buf->offset + etr_buf->len - size; + + if (offset >= etr_buf->size) + offset -= etr_buf->size; lost = true; } /* Insert barrier packets at the beginning, if there was an overflow */ if (lost) tmc_etr_buf_insert_barrier_packet(etr_buf, etr_buf->offset); - tmc_etr_sync_perf_buffer(etr_perf, size); + tmc_etr_sync_perf_buffer(etr_perf, offset, size); /* * In snapshot mode we simply increment the head by the number of byte