From patchwork Mon May 18 18:02:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11555991 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 DE172912 for ; Mon, 18 May 2020 18:02:53 +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 BAECD21475 for ; Mon, 18 May 2020 18:02:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ru+Jn4J0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zEHVE8gb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAECD21475 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=TvpO7vTDhoe5TyfJXEQ4cHDtgVUF37uxHH7GZJ10TXE=; b=Ru+Jn4J0cMEeZT 2460n1ej+tKMu8zCCuWUiDh+ncchI2poywFdW8BRsw/dRbz2lgMfPsIPL1EKMSC708Si6STd0A9PL /blWEj+X9mx5kgs97/4GhvieVXtHcqcswkPux02MVRVFbuRi5G0yWwZGyYa5J1GYqgTILNnEQjiS2 TefkOWk9xz8eQDdrx0qHHvEwifR/GkZUioOX1qJxbHt1JwIxK4NvRKTYsZVpFxjSFu4V7oGCssVEj sjzGcQJ9nn+1a9FdKFaAS7oaB1EzaRQFETa+NHJrFYpc8d5UaIZ3lzLbaRowkfakNNuOiEkwvytET 42LB87NNLBJf3lZIAq+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6E-0003Gq-58; Mon, 18 May 2020 18:02:50 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6B-0003El-85 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:48 +0000 Received: by mail-pg1-x544.google.com with SMTP id b8so5183185pgi.11 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=K1J3bl2/S1TagYTUln5luOODCiYzQtzA3RJkuY15cVw=; b=zEHVE8gbH8thYWx+pig8yyp26b0ohOf1r26gDa6sricXW4JLRO4SFpCKm5WeWLEcCD bygQhMA5x9VfSZU3j7ihk+VcSq3V5gXoOZpgCf3/kXNFWwYPhn6cql8QKKK3O6kmhxdY ZpmEyVRfoZH1w97QT71UfJXxDC8KbxzV+rtjxvXi4FrPUHfpYBEVAXkGD7WS/oqGOjVb CEbJGqacehlNf2Tb5QgWJA7jsyYiw2SVsEnL3X9jXgoMgZE6d1F/I+drHkKCW0yNhS74 YVLuGugGCkpaFdy2HwMnkkOHDXqOqDp38O5uY10s8nA1XOweJiid2azPzX4TS8K+jy92 7ovA== 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:mime-version:content-transfer-encoding; bh=K1J3bl2/S1TagYTUln5luOODCiYzQtzA3RJkuY15cVw=; b=aX+c6LOrXlbaXDV/OD2rPX+EtD25SRQpJdepOcWWuPpc6Nnf+ONwE3/KlgLentcPkg 44GSOYWqfuc678XfJg0uAGcoqtZVTsHo3XO+xbDHn55rbkPcZsxWJ6UBJqVm+L6lP+Cp UIvGJ6F/J87vGehT4Ncw8X9FM/Gc4Ch9YIm9qlX899vbNOjYtvu7lmC7nIn9LZxxqr8+ 6f7LqZ5kcLQJF+TzLfdoJHbzJTM0M4YUsHmmqzGwXYAJ8G1BFbvsRE4a93JgwEeGfWkg YnyXjA98ARmBpiCvwWHU/2JEZ8j4U78TTMwjnvJqSHifrZKxROa0JqMcGyObNCxQjE5n moUw== X-Gm-Message-State: AOAM530QFYXO3CI43b0sbYJjSDTHWuibwnBBDLx4/UUFCh9EKZI+ApTy +ij6sC7TDjoneEE3v1AtOFCtgmoqOgI= X-Google-Smtp-Source: ABdhPJyo04Y2tm296mzmgWVhjyXswqDwndJUMwFmbWN0qHq6OI8Dpt8pGdcpvRKVg3Pw3I9zdVgcBQ== X-Received: by 2002:a63:af5c:: with SMTP id s28mr15001127pgo.380.1589824965008; Mon, 18 May 2020 11:02:45 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:44 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 01/23] coresight: Pass coresight_device for coresight_release_platform_data Date: Mon, 18 May 2020 12:02:20 -0600 Message-Id: <20200518180242.7916-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110247_323950_1DAF4298 X-CRM114-Status: GOOD ( 13.73 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Suzuki K Poulose As we prepare to expose the links between the devices in sysfs, pass the coresight_device instance to the coresight_release_platform_data in order to free up the connections when the device is removed. No functional changes as such in this patch. Signed-off-by: Suzuki K Poulose Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-platform.c | 2 +- drivers/hwtracing/coresight/coresight-priv.h | 3 ++- drivers/hwtracing/coresight/coresight.c | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 43418a2126ff..4b78e1ac5285 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -822,7 +822,7 @@ coresight_get_platform_data(struct device *dev) error: if (!IS_ERR_OR_NULL(pdata)) /* Cleanup the connection information */ - coresight_release_platform_data(pdata); + coresight_release_platform_data(NULL, pdata); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(coresight_get_platform_data); diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 890f9a5c97c6..1cad642f27aa 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -211,7 +211,8 @@ static inline void *coresight_get_uci_data(const struct amba_id *id) return 0; } -void coresight_release_platform_data(struct coresight_platform_data *pdata); +void coresight_release_platform_data(struct coresight_device *csdev, + struct coresight_platform_data *pdata); struct coresight_device * coresight_find_csdev_by_fwnode(struct fwnode_handle *r_fwnode); void coresight_set_assoc_ectdev_mutex(struct coresight_device *csdev, diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index c71553c09f8e..10e756410d3c 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1213,7 +1213,8 @@ postcore_initcall(coresight_init); * coresight_release_platform_data: Release references to the devices connected * to the output port of this device. */ -void coresight_release_platform_data(struct coresight_platform_data *pdata) +void coresight_release_platform_data(struct coresight_device *csdev, + struct coresight_platform_data *pdata) { int i; @@ -1316,7 +1317,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) kfree(csdev); err_out: /* Cleanup the connection information */ - coresight_release_platform_data(desc->pdata); + coresight_release_platform_data(NULL, desc->pdata); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(coresight_register); @@ -1326,7 +1327,7 @@ void coresight_unregister(struct coresight_device *csdev) etm_perf_del_symlink_sink(csdev); /* Remove references of that device in the topology */ coresight_remove_conns(csdev); - coresight_release_platform_data(csdev->pdata); + coresight_release_platform_data(csdev, csdev->pdata); device_unregister(&csdev->dev); } EXPORT_SYMBOL_GPL(coresight_unregister); From patchwork Mon May 18 18:02:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11555997 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 EBB461391 for ; Mon, 18 May 2020 18:03:56 +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 C584420885 for ; Mon, 18 May 2020 18:03:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aiTITQ8e"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IQc+uRxE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C584420885 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=gcTc1aduGxacudw5LhFV8KYcPcgn6gsAaQup3MbooK8=; b=aiTITQ8eA5KCdz HHaFswkZ3nLaBJtKdLS0NIaOsAwtvWH19xu8B3R3/8Qn7ngvQco2V58ZBrfQcYLA/vQ2DxPHyJJq6 NW1/uWl2pXPVNj2TPrq/yF4J5THRgE4vRP9o1hYjHQWlsAoflT1cneWUsPLjHPOph4PtU6lzzApZJ KXrq0B/ji8KlNBosTQLmt76hxhfXrXI43riXLI6ebbc3Ac6ZBh5gRTkmmFgXcPmmG5BKNwd98V/93 4pPtyioUper0ON4rB/tBYhazi4QjPB6n1zZmOpLDENUMMDc4uE1J9goaV7ipItulKAEX4myRZRmPx mNbj1jJgoAZKYf+9Ww8A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak7A-00042t-89; Mon, 18 May 2020 18:03:48 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6D-0003F6-J0 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:51 +0000 Received: by mail-pl1-x644.google.com with SMTP id b12so4523419plz.13 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=TWDc2MIzLCD0J0DTo843/pEAjWpz4zi5meBGNQusvOI=; b=IQc+uRxEsTXifaZ91XkjEpUISl4kTqabtfZnx537qwR1Hj+snPjk1L8+ztn9N7TXgk yYhGi7e838d2sIM1ipdRzg8LrHHpW4hxUNdN2qQxkK0Hr+b7AsYH+Ijt4mjarpKsUIgs 20tk3CjgQNDqrY/6+o8A2MqNBJqZMUOpEtoZWz8oG/TnsSEehwSVWj6udY+5TSyfbu+l 9WrP46hoC07nc09mkHargPOvmuCl2JF3/nGtgrtTttWkHc1+Dlvy+dhtStpU5NmpDzCK TtoTWZl698zBC1jYgYndA4vb4nfoj262Up68Ut1MnIUnpmdYI1wdAhQzilfOFsy9CrA8 fDJg== 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:mime-version:content-transfer-encoding; bh=TWDc2MIzLCD0J0DTo843/pEAjWpz4zi5meBGNQusvOI=; b=pWNrcZwPhasBx27fPpI6Ix6MXz7KBdFkswM87Xr9MzHmOEIfakTFMsfEKqolB4yRaa 1RiYO1saURnIh/PCTTzJYsM94kefH9r9WUcLoT+qvsAJGj0TZ56T2X0jB+4PB+snlxr/ i3Bh5UP1K1GHXRZs1vVmeC1pkOCsdI66G8e0JI02XI+5mxDew85EZmKEfsMJQHYRAFOs iCLgEyKTwJW9QkgXvsFFI6qPHhjvznOq6bzKuK4UxwxetdRzjRJRHl0E90+F+3xd6qXw Vs/fPHWaSgUSiqLF13vvCGrbFOo9YnARw8h0glV+gJfp9Ca6q2psMduNAR7rxR2fo/5A YdyQ== X-Gm-Message-State: AOAM532IULm/mWU063T5n1j+R85rfJwGOo8OLkO74vDCFYcWCuFwKU3v acU4E/oNfWu5NlMG/DYWES9ZLY2KprQ= X-Google-Smtp-Source: ABdhPJyMdLoWO51V2HVNXVeJCaB/WIl9AlRBiwWR9TIkJWuLSv2KQsQNVikE2QxVTdeWmdJvklbp7Q== X-Received: by 2002:a17:90b:358c:: with SMTP id mm12mr596616pjb.134.1589824966019; Mon, 18 May 2020 11:02:46 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:45 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 02/23] coresight: Add return value for fixup connections Date: Mon, 18 May 2020 12:02:21 -0600 Message-Id: <20200518180242.7916-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110249_626047_FD290624 X-CRM114-Status: GOOD ( 13.70 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Suzuki K Poulose Handle failures in fixing up connections for a newly registered device. This will be useful to handle cases where we fail to expose the links via sysfs for the connections. Signed-off-by: Suzuki K Poulose Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 10e756410d3c..07f66a3968f1 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1073,18 +1073,14 @@ static int coresight_orphan_match(struct device *dev, void *data) return 0; } -static void coresight_fixup_orphan_conns(struct coresight_device *csdev) +static int coresight_fixup_orphan_conns(struct coresight_device *csdev) { - /* - * No need to check for a return value as orphan connection(s) - * are hooked-up with each newly added component. - */ - bus_for_each_dev(&coresight_bustype, NULL, + return bus_for_each_dev(&coresight_bustype, NULL, csdev, coresight_orphan_match); } -static void coresight_fixup_device_conns(struct coresight_device *csdev) +static int coresight_fixup_device_conns(struct coresight_device *csdev) { int i; @@ -1096,6 +1092,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) if (!conn->child_dev) csdev->orphan = true; } + + return 0; } static int coresight_remove_match(struct device *dev, void *data) @@ -1305,11 +1303,17 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) mutex_lock(&coresight_mutex); - coresight_fixup_device_conns(csdev); - coresight_fixup_orphan_conns(csdev); - cti_add_assoc_to_csdev(csdev); + ret = coresight_fixup_device_conns(csdev); + if (!ret) + ret = coresight_fixup_orphan_conns(csdev); + if (!ret) + cti_add_assoc_to_csdev(csdev); mutex_unlock(&coresight_mutex); + if (ret) { + coresight_unregister(csdev); + return ERR_PTR(ret); + } return csdev; From patchwork Mon May 18 18:02:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556005 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 17BDA912 for ; Mon, 18 May 2020 18:04:36 +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 EA15520826 for ; Mon, 18 May 2020 18:04: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="TRyTt3v4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cYGjP76V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA15520826 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=n1bKy+4vnzMBhFFHYvUIlpRmpE9BKN8tKkEb5gohCi0=; b=TRyTt3v448vJCI TMDbhoEZCOlC1DNuWVs2ZM96b68uOS7ne+j/UzBIvJfMSb/NFsGAxALKQjh9RU/HSwJtyOgMFw9/N yUfK8DitEwNOZCOKQYco6zUwIe+ZC1rVSA5/NBZ8fiwJefLqNJ21LpEhcp789tF5tcIOgqkxY8qKC kisHaVBoJLI+90OMRRDOX3fTdVM3TqXsvWtLsFQSvA/H574HAU/PiILwDZ4VnyopJxFZKc/HlaZrC dgngo52DASOYMICTIgbgmhFujgWQNXw0uLyHAnOVAzBozpSSESMKhJFnRvMwNKsCKF9XhEFeN2rUm 9d2xyzxjtHCn1KJkab6A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak7m-0004Yq-Sh; Mon, 18 May 2020 18:04:26 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6D-0003FV-J2 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:53 +0000 Received: by mail-pl1-x644.google.com with SMTP id w19so2755145ply.11 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=iT88ubFxc6ED1UBnLQRgzXhnhZ/8N9RhHlYl+rHKEcA=; b=cYGjP76VcLAjmPAMn61/zWvs9tckW9X4UfwVw9AzxPvGINi0M2WGdc5codf6Cy67yG 41fSGWxRzMbQGA87DK2SA3sKW2erfu9YCjlkHCDCqq4Dn1JQVScWHqmaqpbxGYuVy1YR u1E0+9g0bzluKL0rr8SOPvCt74P2+VCQ5EIqCLMBBCXeKTN0tk3A2cglFq4hU0p78kg1 uTXFOSpyvSc7VT8kZODAoIxNCcWDn3zuBBBT99Fkh4BBmtBZZPqO17+Yy8xIUfLdUdO4 xUlWZ9muUVLB0KKgx0mzKxfC1+y1ClQ2D0yi1QxxQTgcCO5dOW081a2rHIePNBSX7W8T 2eZA== 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:mime-version:content-transfer-encoding; bh=iT88ubFxc6ED1UBnLQRgzXhnhZ/8N9RhHlYl+rHKEcA=; b=NOfuUyR52+vRcgtiBxx5o+wAWzuAVkajDR3K0192uR3mRn0CgTwhd9hZv4jA0jdoQs 5EJ2EGECFIb6XBzLsmKByZQuOBrLKGUw/P7HSKgoOjc84EBhg5F3ZD28+lWOw+T8nELL /w2lKRCkxXxQpSvWE/jd/p8hEjroLMa1Om3r9zHY0uJ60GTbSb/3bYCTFXKXWB7ujjmz 1TmzWtc364uDvYLLLyfmMfOVPb3NUGYsyRyEwEfgDVcISE+OGfLe2cfn1taR1v2x2622 eJ6C4O8pcQN5YD5QdUCgZwFNZrrwEISYcY5hI8yFrJUxPMS8oea0a7v37+Wi4bmIA22G sDWA== X-Gm-Message-State: AOAM530Gvb2p0rDfxjZtfGCIsufgXASuhzuVXRHQnSp0jjdaUuktmFK+ YIV3BUedIDjnjW+gonszoPIXmjGQH1g= X-Google-Smtp-Source: ABdhPJwqnEQorsm11raCyLat+BB/aNgTV4e77OluQtYY1BcBAo8rP9vKplPRQRfJra/zJAKPn/LC6Q== X-Received: by 2002:a17:902:8342:: with SMTP id z2mr8023549pln.112.1589824967103; Mon, 18 May 2020 11:02:47 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:46 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 03/23] coresight: Add generic sysfs link creation functions Date: Mon, 18 May 2020 12:02:22 -0600 Message-Id: <20200518180242.7916-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110249_627046_4DB06003 X-CRM114-Status: GOOD ( 19.39 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach To allow the connections between coresight components to be represented in sysfs, generic methods for creating sysfs links between two coresight devices are added. Signed-off-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Makefile | 3 +- drivers/hwtracing/coresight/coresight-priv.h | 4 + drivers/hwtracing/coresight/coresight-sysfs.c | 124 ++++++++++++++++++ include/linux/coresight.h | 20 +++ 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 drivers/hwtracing/coresight/coresight-sysfs.c diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 0e3e72f0f510..19497d1d92bf 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -2,7 +2,8 @@ # # Makefile for CoreSight drivers. # -obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o coresight-platform.o +obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o \ + coresight-platform.o coresight-sysfs.o obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o \ coresight-tmc-etf.o \ coresight-tmc-etr.o diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 1cad642f27aa..a4a658d46045 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -153,6 +153,10 @@ struct coresight_device *coresight_get_sink_by_id(u32 id); struct list_head *coresight_build_path(struct coresight_device *csdev, struct coresight_device *sink); void coresight_release_path(struct list_head *path); +int coresight_add_sysfs_link(struct coresight_sysfs_link *info); +void coresight_remove_sysfs_link(struct coresight_sysfs_link *info); +int coresight_create_conns_sysfs_group(struct coresight_device *csdev); +void coresight_remove_conns_sysfs_group(struct coresight_device *csdev); #ifdef CONFIG_CORESIGHT_SOURCE_ETM3X extern int etm_readl_cp14(u32 off, unsigned int *val); diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c new file mode 100644 index 000000000000..6759f78733ab --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019, Linaro Limited, All rights reserved. + * Author: Mike Leach + */ + +#include +#include + +#include "coresight-priv.h" + +/* + * Connections group - links attribute. + * Count of created links between coresight components in the group. + */ +static ssize_t nr_links_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct coresight_device *csdev = to_coresight_device(dev); + + return sprintf(buf, "%d\n", csdev->nr_links); +} +static DEVICE_ATTR_RO(nr_links); + +static struct attribute *coresight_conns_attrs[] = { + &dev_attr_nr_links.attr, + NULL, +}; + +static struct attribute_group coresight_conns_group = { + .attrs = coresight_conns_attrs, + .name = "connections", +}; + +/* + * Create connections group for CoreSight devices. + * This group will then be used to collate the sysfs links between + * devices. + */ +int coresight_create_conns_sysfs_group(struct coresight_device *csdev) +{ + int ret = 0; + + if (!csdev) + return -EINVAL; + + ret = sysfs_create_group(&csdev->dev.kobj, &coresight_conns_group); + if (ret) + return ret; + + csdev->has_conns_grp = true; + return ret; +} + +void coresight_remove_conns_sysfs_group(struct coresight_device *csdev) +{ + if (!csdev) + return; + + if (csdev->has_conns_grp) { + sysfs_remove_group(&csdev->dev.kobj, &coresight_conns_group); + csdev->has_conns_grp = false; + } +} + +int coresight_add_sysfs_link(struct coresight_sysfs_link *info) +{ + int ret = 0; + + if (!info) + return -EINVAL; + if (!info->orig || !info->target || + !info->orig_name || !info->target_name) + return -EINVAL; + if (!info->orig->has_conns_grp || !info->target->has_conns_grp) + return -EINVAL; + + /* first link orig->target */ + ret = sysfs_add_link_to_group(&info->orig->dev.kobj, + coresight_conns_group.name, + &info->target->dev.kobj, + info->orig_name); + if (ret) + return ret; + + /* second link target->orig */ + ret = sysfs_add_link_to_group(&info->target->dev.kobj, + coresight_conns_group.name, + &info->orig->dev.kobj, + info->target_name); + + /* error in second link - remove first - otherwise inc counts */ + if (ret) { + sysfs_remove_link_from_group(&info->orig->dev.kobj, + coresight_conns_group.name, + info->orig_name); + } else { + info->orig->nr_links++; + info->target->nr_links++; + } + + return ret; +} + +void coresight_remove_sysfs_link(struct coresight_sysfs_link *info) +{ + if (!info) + return; + if (!info->orig || !info->target || + !info->orig_name || !info->target_name) + return; + + sysfs_remove_link_from_group(&info->orig->dev.kobj, + coresight_conns_group.name, + info->orig_name); + + sysfs_remove_link_from_group(&info->target->dev.kobj, + coresight_conns_group.name, + info->target_name); + + info->orig->nr_links--; + info->target->nr_links--; +} diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 193cc9dbf448..a2ec25e02ca9 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -148,6 +148,20 @@ struct coresight_connection { struct coresight_device *child_dev; }; +/** + * struct coresight_sysfs_link - representation of a connection in sysfs. + * @orig: Originating (master) coresight device for the link. + * @orig_name: Name to use for the link orig->target. + * @target: Target (slave) coresight device for the link. + * @target_name: Name to use for the link target->orig. + */ +struct coresight_sysfs_link { + struct coresight_device *orig; + const char *orig_name; + struct coresight_device *target; + const char *target_name; +}; + /** * struct coresight_device - representation of a device as used by the framework * @pdata: Platform data with device connections associated to this device. @@ -165,6 +179,9 @@ struct coresight_connection { * @ea: Device attribute for sink representation under PMU directory. * @ect_dev: Associated cross trigger device. Not part of the trace data * path or connections. + * @nr_links: number of sysfs links created to other components from this + * device. These will appear in the "connections" group. + * @has_conns_grp: Have added a "connections" group for sysfs links. */ struct coresight_device { struct coresight_platform_data *pdata; @@ -180,6 +197,9 @@ struct coresight_device { struct dev_ext_attribute *ea; /* cross trigger handling */ struct coresight_device *ect_dev; + /* sysfs links between components */ + int nr_links; + bool has_conns_grp; }; /* From patchwork Mon May 18 18:02:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11555995 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 714A0912 for ; Mon, 18 May 2020 18:03:34 +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 4D0E420715 for ; Mon, 18 May 2020 18:03:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ch3rYlQk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w8lpPzR5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D0E420715 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=HG1oEyhXYhsN3vMZs9xzX/+r1Se8Q9yKg0AxeJ2DRyY=; b=ch3rYlQk1hQi0l yzjlPcAV09OArBUgu3CrAzvLNXQNQgL7Rr7Akb5bV2167eDbfIPd3Sk2wJR3o9Wi1ha+bl61dWmaD lw2r16DVUbsGVvjqePefdvyrBFBqe8BzDwiejK6Q8DM90z3J30+Wvej4myJ9YXEI3zn6gA14Xy1qh iyEIHXLlFwoHWNLcKrP9RCCpEckP12UOH6C86lsmxnaq0Df34Sq/BqfOXmxRYCV4HProkmDnRQqur 7gIpbvlU8H/d18JhqsLzHuLFqVxCIGwvNXrBKxAEq6RGziesySLi8M+eFGWYzKl2PK/dKqqMSYr5X gd9LJeBR3oKMn7uM8GYA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6r-0003p5-PT; Mon, 18 May 2020 18:03:29 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6D-0003Fq-8i for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:51 +0000 Received: by mail-pj1-x1044.google.com with SMTP id ci23so179991pjb.5 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=YHBmS70VV3hNYhi2EuyscotqPn7h5GQLIPiCIgqJv4M=; b=w8lpPzR582yARXrSQ2QMBXF7ZWDI7yMbkepKXCJTPu+nnoULR+gujjc+YTdhAKN4CD Jk+yIL/ta3BvxSrA6+b3rogcj5JJjxuRIC8JRE9DFvFS98TNq4HhYeZ8YMVD3jq+xkds MYT7gsIxTV6f0iSHc6qDLM4TCtrAgpjFUM5+w9r4rSFGdvDrnnGcs9Uy14bV61cVWraN Yih3LcdL970d1es3zV9EdZw01alPfz4IaYpKGaaoyJJBIV7pOh5pDLdhLL2V+k7D8T9M mvpAU8FTWxVggFkLI0hu2HtziJXIeZP1ERhh3pEx95Yg/Ah01HEksOjAtoQPDoyFrAoh hoAQ== 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:mime-version:content-transfer-encoding; bh=YHBmS70VV3hNYhi2EuyscotqPn7h5GQLIPiCIgqJv4M=; b=o9zC4fltEyn2Nr4waQc7ifOrSAnVh1+UHmAEca9BiaHeJA1H/YSa4ekyuSDPWAH9+O nWH/k/3OCj7299F7bE5gRJEG2cshj/INbsnKnqoNYl7WGQ8z51smBaZax7vhoTvTmUl+ 772+Uv9ifIHyk1L9xXBXmYP213ek9u0lZwfmHHRb0VvecSolYCJeTyhis8jE+6Z/BlOi O4Lmp0HUd2Er32TPVBeTxYo7P3MMFWgBpFcCK90srWGnsu3gjDPk+V6SxMw+DsOacW0r jbL5Z4ZHhM6DG70dcKhV8HtQQFxo4dkmyn012hpK3cv8n61PlzsaovFdbIjI4FPhz/8J 8mPQ== X-Gm-Message-State: AOAM530HIAWBeGUWmD+gvNsUFW4fjj2lw0gbXdS8IDqnATovYiTUZVRJ /kLbVhD4Fi6E45fe4MwXeI6lfK69f38= X-Google-Smtp-Source: ABdhPJw8WdbKLKrqGGXCTFvYMNe3lc1VoBzcBIk7PYXD39x0+GsKNQYtt3zX+rUgd2ej/o5WOiWrLA== X-Received: by 2002:a17:90a:2ac2:: with SMTP id i2mr636698pjg.80.1589824968553; Mon, 18 May 2020 11:02:48 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:47 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 04/23] coresight: Expose device connections via sysfs Date: Mon, 18 May 2020 12:02:23 -0600 Message-Id: <20200518180242.7916-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110249_309737_45FBC60D X-CRM114-Status: GOOD ( 23.62 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:1044 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Suzuki K Poulose Coresight device connections are a bit complicated and is not exposed currently to the user. One has to look at the platform descriptions (DT bindings or ACPI bindings) to make an understanding. Given the new naming scheme, it will be helpful to have this information to choose the appropriate devices for tracing. This patch exposes the device connections via links in the sysfs directories. e.g, for a connection devA[OutputPort_X] -> devB[InputPort_Y] is represented as two symlinks: /sys/bus/coresight/.../devA/out:X -> /sys/bus/coresight/.../devB /sys/bus/coresight/.../devB/in:Y -> /sys/bus/coresight/.../devA Signed-off-by: Suzuki K Poulose [Revised to use the generic sysfs links functions & link structures. Provides a connections sysfs group in each device to hold the links.] Co-developed-by: Mike Leach Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-priv.h | 5 ++ drivers/hwtracing/coresight/coresight-sysfs.c | 80 +++++++++++++++++++ drivers/hwtracing/coresight/coresight.c | 46 ++++++++--- include/linux/coresight.h | 2 + 4 files changed, 121 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index a4a658d46045..5a36f0f50899 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -157,6 +157,11 @@ int coresight_add_sysfs_link(struct coresight_sysfs_link *info); void coresight_remove_sysfs_link(struct coresight_sysfs_link *info); int coresight_create_conns_sysfs_group(struct coresight_device *csdev); void coresight_remove_conns_sysfs_group(struct coresight_device *csdev); +int coresight_make_links(struct coresight_device *orig, + struct coresight_connection *conn, + struct coresight_device *target); +void coresight_remove_links(struct coresight_device *orig, + struct coresight_connection *conn); #ifdef CONFIG_CORESIGHT_SOURCE_ETM3X extern int etm_readl_cp14(u32 off, unsigned int *val); diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c index 6759f78733ab..82afeaf2ccc4 100644 --- a/drivers/hwtracing/coresight/coresight-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -122,3 +122,83 @@ void coresight_remove_sysfs_link(struct coresight_sysfs_link *info) info->orig->nr_links--; info->target->nr_links--; } + +/* + * coresight_make_links: Make a link for a connection from a @orig + * device to @target, represented by @conn. + * + * e.g, for devOrig[output_X] -> devTarget[input_Y] is represented + * as two symbolic links : + * + * /sys/.../devOrig/out:X -> /sys/.../devTarget/ + * /sys/.../devTarget/in:Y -> /sys/.../devOrig/ + * + * The link names are allocated for a device where it appears. i.e, the + * "out" link on the master and "in" link on the slave device. + * The link info is stored in the connection record for avoiding + * the reconstruction of names for removal. + */ +int coresight_make_links(struct coresight_device *orig, + struct coresight_connection *conn, + struct coresight_device *target) +{ + int ret = -ENOMEM; + char *outs = NULL, *ins = NULL; + struct coresight_sysfs_link *link = NULL; + + do { + outs = devm_kasprintf(&orig->dev, GFP_KERNEL, + "out:%d", conn->outport); + if (!outs) + break; + ins = devm_kasprintf(&target->dev, GFP_KERNEL, + "in:%d", conn->child_port); + if (!ins) + break; + link = devm_kzalloc(&orig->dev, + sizeof(struct coresight_sysfs_link), + GFP_KERNEL); + if (!link) + break; + + link->orig = orig; + link->target = target; + link->orig_name = outs; + link->target_name = ins; + + ret = coresight_add_sysfs_link(link); + if (ret) + break; + + conn->link = link; + + /* + * Install the device connection. This also indicates that + * the links are operational on both ends. + */ + conn->child_dev = target; + return 0; + } while (0); + + return ret; +} + +/* + * coresight_remove_links: Remove the sysfs links for a given connection @conn, + * from @orig device to @target device. See coresight_make_links() for more + * details. + */ +void coresight_remove_links(struct coresight_device *orig, + struct coresight_connection *conn) +{ + if (!orig || !conn->link) + return; + + coresight_remove_sysfs_link(conn->link); + + devm_kfree(&conn->child_dev->dev, conn->link->target_name); + devm_kfree(&orig->dev, conn->link->orig_name); + devm_kfree(&orig->dev, conn->link); + conn->link = NULL; + conn->child_dev = NULL; +} diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 07f66a3968f1..4f10cfa9dc18 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1031,7 +1031,7 @@ static void coresight_device_release(struct device *dev) static int coresight_orphan_match(struct device *dev, void *data) { - int i; + int i, ret = 0; bool still_orphan = false; struct coresight_device *csdev, *i_csdev; struct coresight_connection *conn; @@ -1056,19 +1056,23 @@ static int coresight_orphan_match(struct device *dev, void *data) /* We have found at least one orphan connection */ if (conn->child_dev == NULL) { /* Does it match this newly added device? */ - if (conn->child_fwnode == csdev->dev.fwnode) - conn->child_dev = csdev; - else + if (conn->child_fwnode == csdev->dev.fwnode) { + ret = coresight_make_links(i_csdev, + conn, csdev); + if (ret) + return ret; + } else { /* This component still has an orphan */ still_orphan = true; + } } } i_csdev->orphan = still_orphan; /* - * Returning '0' ensures that all known component on the - * bus will be checked. + * Returning '0' in case we didn't encounter any error, + * ensures that all known component on the bus will be checked. */ return 0; } @@ -1082,15 +1086,21 @@ static int coresight_fixup_orphan_conns(struct coresight_device *csdev) static int coresight_fixup_device_conns(struct coresight_device *csdev) { - int i; + int i, ret = 0; for (i = 0; i < csdev->pdata->nr_outport; i++) { struct coresight_connection *conn = &csdev->pdata->conns[i]; conn->child_dev = coresight_find_csdev_by_fwnode(conn->child_fwnode); - if (!conn->child_dev) + if (conn->child_dev) { + ret = coresight_make_links(csdev, conn, + conn->child_dev); + if (ret) + break; + } else { csdev->orphan = true; + } } return 0; @@ -1121,7 +1131,7 @@ static int coresight_remove_match(struct device *dev, void *data) if (csdev->dev.fwnode == conn->child_fwnode) { iterator->orphan = true; - conn->child_dev = NULL; + coresight_remove_links(iterator, conn); /* * Drop the reference to the handle for the remote * device acquired in parsing the connections from @@ -1215,13 +1225,23 @@ void coresight_release_platform_data(struct coresight_device *csdev, struct coresight_platform_data *pdata) { int i; + struct coresight_connection *conns = pdata->conns; for (i = 0; i < pdata->nr_outport; i++) { - if (pdata->conns[i].child_fwnode) { - fwnode_handle_put(pdata->conns[i].child_fwnode); + /* If we have made the links, remove them now */ + if (csdev && conns[i].child_dev) + coresight_remove_links(csdev, &conns[i]); + /* + * Drop the refcount and clear the handle as this device + * is going away + */ + if (conns[i].child_fwnode) { + fwnode_handle_put(conns[i].child_fwnode); pdata->conns[i].child_fwnode = NULL; } } + if (csdev) + coresight_remove_conns_sysfs_group(csdev); } struct coresight_device *coresight_register(struct coresight_desc *desc) @@ -1303,7 +1323,9 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) mutex_lock(&coresight_mutex); - ret = coresight_fixup_device_conns(csdev); + ret = coresight_create_conns_sysfs_group(csdev); + if (!ret) + ret = coresight_fixup_device_conns(csdev); if (!ret) ret = coresight_fixup_orphan_conns(csdev); if (!ret) diff --git a/include/linux/coresight.h b/include/linux/coresight.h index a2ec25e02ca9..ccd17304d7bd 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -140,12 +140,14 @@ struct coresight_desc { * @chid_fwnode: remote component's fwnode handle. * @child_dev: a @coresight_device representation of the component connected to @outport. + * @link: Representation of the connection as a sysfs link. */ struct coresight_connection { int outport; int child_port; struct fwnode_handle *child_fwnode; struct coresight_device *child_dev; + struct coresight_sysfs_link *link; }; /** From patchwork Mon May 18 18:02:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556001 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 EAFB2912 for ; Mon, 18 May 2020 18:04:11 +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 83B9620715 for ; Mon, 18 May 2020 18:04:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Vidv/ntQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ytD2QjeX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83B9620715 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=pKuMrPFYMm/PnEeIUTUQ/r57MH4wFxm5k625tnKmiLc=; b=Vidv/ntQW0xfXI jCRtcNExRo3DcZnHhnDWQMF2F8ocAFAL5pR6sgeYWNhDZYZbwQit/p1Li0OAjPlIC7Z/OnX7oR6jX 15OfR1ho84WSjgrKcFGX6rqipeswOyib0e5WAFiq9rhDn3OixVKuIjPtkwGj2V1Pfs1chu9N6kDpC /rKIYh7SS/lbCQs2zQdq5SUT848ZZXyn9LVUvXMrpK/cWgECrbNqRou8GJkAceiooPor5i8bRRVHg vtB8l35vckxi+4AKHKFx5M/JkUVDf4T2MEQHiH8OctKhWkeKEg6KOO0Mh+88lP6M1bMp56CVaGPgn dE9gSi2f4haIRNgZEGCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak7V-0004LU-3q; Mon, 18 May 2020 18:04:09 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6E-0003Gp-1G for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:53 +0000 Received: by mail-pj1-x1042.google.com with SMTP id k7so185897pjs.5 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=0qup2xfzyR/Fig7E6oaQXo8Xo2JibJ08tYflWG0z/rg=; b=ytD2QjeXDZrbc8HRk73YatO30g/33jOPq/+y+srGwAQEgtfofNjqlW68+UAby2WZxh K0OOt5OIKplgSdawJHU3QxysPrrEORtf8xNfsVmgCOIviXJ1M2Mjw6R5alQZFA6gFYnH zSi4jbwLkOjo3LsUpaMCde8DHhtnXjS6QwrWm4hJxeIMI7zkrSx+GRc4zfdjB5N+PCDv 5qIk85wkYbIQ0aDRQNUSPlzKFOTu8ecG4HFxHW9rzmHLFPHzWIra91lrwmVGcysxtGva gYElEfjLHJyQsiabWrPcLiY5IvHGcHVPQxUUbQN3oiG0YnChjhHK5i3k82yVmO/K1sTA r1hA== 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:mime-version:content-transfer-encoding; bh=0qup2xfzyR/Fig7E6oaQXo8Xo2JibJ08tYflWG0z/rg=; b=llXawlOKQGvZmhrZtNz4B7XX3l1Wi26M7lTSk0YlZBnQmoTwPE54J1oxwPw6LmPW4k wAwUVU2P8pPGNYmXiHcapknZKxWEXf6F5dyGh4HPfT7YJ39GOq1+dLuAwtzbOSuK1guQ xWg9P2t09IHHa2MPKUP9Fp1Rs2ilPeFJsPR+H3G/BQQ/fAjs/4uTUGNFoMCWSJUDqZfF ngUxK3bz3Qx0xNG/W61NTXOSD0qegP138GDh0U4X9iCPSRNghb8euO8700TAXwBsrPAC SPGsd8rXiNESclDXTRYDF/eYJ62c31eve56o1H2bFN9oGmvL1/KUT9XunkAWAzC/svLG SQpw== X-Gm-Message-State: AOAM533QEH2mcUakjE6yAVciyESIt+uFCRUmz9aUsS4gJmrVqz8ka190 wXH/9xyVL+yx6ihbjyOxDRRo9A== X-Google-Smtp-Source: ABdhPJxItxOuiaDBzTApsq2ElULgX5D34VOHCWN5PhW3MOaM1qCraWmrkBHYmVFQyTNsccVJ+KvAiA== X-Received: by 2002:a17:902:9686:: with SMTP id n6mr17944319plp.100.1589824969267; Mon, 18 May 2020 11:02:49 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:48 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 05/23] coresight: cti: Add in sysfs links to other coresight devices Date: Mon, 18 May 2020 12:02:24 -0600 Message-Id: <20200518180242.7916-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110250_111867_C296A041 X-CRM114-Status: GOOD ( 15.55 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:1042 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach Adds in sysfs links for connections where the connected device is another coresight device. This allows examination of the coresight topology. Non-coresight connections remain just as a reference name. Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 52 +++++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index aa6e0249bd70..9e262f5a85e3 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -442,6 +442,34 @@ int cti_channel_setop(struct device *dev, enum cti_chan_set_op op, return err; } +static bool cti_add_sysfs_link(struct cti_drvdata *drvdata, + struct cti_trig_con *tc) +{ + struct coresight_sysfs_link link_info; + int link_err = 0; + + link_info.orig = drvdata->csdev; + link_info.orig_name = tc->con_dev_name; + link_info.target = tc->con_dev; + link_info.target_name = dev_name(&drvdata->csdev->dev); + + link_err = coresight_add_sysfs_link(&link_info); + if (link_err) + dev_warn(&drvdata->csdev->dev, + "Failed to set CTI sysfs link %s<=>%s\n", + link_info.orig_name, link_info.target_name); + return !link_err; +} + +static void cti_remove_sysfs_link(struct cti_trig_con *tc) +{ + struct coresight_sysfs_link link_info; + + link_info.orig_name = tc->con_dev_name; + link_info.target = tc->con_dev; + coresight_remove_sysfs_link(&link_info); +} + /* * Look for a matching connection device name in the list of connections. * If found then swap in the csdev name, set trig con association pointer @@ -452,6 +480,8 @@ cti_match_fixup_csdev(struct cti_device *ctidev, const char *node_name, struct coresight_device *csdev) { struct cti_trig_con *tc; + struct cti_drvdata *drvdata = container_of(ctidev, struct cti_drvdata, + ctidev); list_for_each_entry(tc, &ctidev->trig_cons, node) { if (tc->con_dev_name) { @@ -459,7 +489,12 @@ cti_match_fixup_csdev(struct cti_device *ctidev, const char *node_name, /* match: so swap in csdev name & dev */ tc->con_dev_name = dev_name(&csdev->dev); tc->con_dev = csdev; - return true; + /* try to set sysfs link */ + if (cti_add_sysfs_link(drvdata, tc)) + return true; + /* link failed - remove CTI reference */ + tc->con_dev = NULL; + break; } } } @@ -522,6 +557,7 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev) ctidev = &ctidrv->ctidev; list_for_each_entry(tc, &ctidev->trig_cons, node) { if (tc->con_dev == csdev->ect_dev) { + cti_remove_sysfs_link(tc); tc->con_dev = NULL; break; } @@ -543,10 +579,16 @@ static void cti_update_conn_xrefs(struct cti_drvdata *drvdata) struct cti_device *ctidev = &drvdata->ctidev; list_for_each_entry(tc, &ctidev->trig_cons, node) { - if (tc->con_dev) - /* set tc->con_dev->ect_dev */ - coresight_set_assoc_ectdev_mutex(tc->con_dev, + if (tc->con_dev) { + /* if we can set the sysfs link */ + if (cti_add_sysfs_link(drvdata, tc)) + /* set the CTI/csdev association */ + coresight_set_assoc_ectdev_mutex(tc->con_dev, drvdata->csdev); + else + /* otherwise remove reference from CTI */ + tc->con_dev = NULL; + } } } @@ -559,6 +601,8 @@ static void cti_remove_conn_xrefs(struct cti_drvdata *drvdata) if (tc->con_dev) { coresight_set_assoc_ectdev_mutex(tc->con_dev, NULL); + cti_remove_sysfs_link(tc); + tc->con_dev = NULL; } } } From patchwork Mon May 18 18:02:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556013 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 CEEE61668 for ; Mon, 18 May 2020 18:05:59 +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 AC6C7207D3 for ; Mon, 18 May 2020 18:05:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GhyyN2au"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="T1IPvmub" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AC6C7207D3 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=GS0Ysk5AbXEZWQHTikBP/pDe3keVCz4Rb/S3L0OCUlk=; b=GhyyN2au3hdb3+ KTmUVs07Bwj5OUtp+QNE35se2bQSd0/d6/Rt4kRS+Dy+o96EuFLAD5hful0BgF0aOk2f/K2tY2AU5 /ClANST1it72oi5TUfRCnyCAFY+7rpOnul5BzLIizLMVXqxzlJI1gVVt+Ja1vzVlYrVLpd096MQig v2DPWDQK7Lh3Tg2rovUBIUhmnv2H18iW8+OBRQ/oClDz5yh7LSNTY+n0soEKw/pQHaXJYPEgW2ykQ hCpFzYymp5ifqgOvJdo5s/R7SGcntl/fSqors5Sy46jPsl4ImLGXOeK+Mam7OO1qA/CXTk2pztniW Vvl7vIEl+ON5MjkUqFZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak9A-0007wB-Kx; Mon, 18 May 2020 18:05:52 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6G-0003Hx-Vv for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:55 +0000 Received: by mail-pl1-x633.google.com with SMTP id a13so2992426pls.8 for ; Mon, 18 May 2020 11:02:50 -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 :mime-version:content-transfer-encoding; bh=e0Pz6i6JWlIFvYArOTeih8eCx8iV9HZyZAVvys5cSoM=; b=T1IPvmubnKy3FrzpG2x3gObu92H7ScU2ErAm+ogozjvbWTpd7pw6LM4aOIIHXYByou LRuLZAL8Gd5c1YAKLuzJer93cYPG+F5OiJnXIkrwxQOXSj0e0X1fK2hTAvZso9V7+A8b ivbnHOi4NDNlR2PjEpHVl8YhNKMgMqLGtPzgySy04wjQ5NsB595Oy4E3Kwy3iy4XZB72 bnGuU2lTNMTPgaGjtiDHMHkT/qUoJN2lF163cEHVbs0HsH3b1GmOgpcFIWQwTg4bWoXU g8p3WB6gMx8mJXxlzRjtqPkizGVmx62loOXRhH0oZ5dt5GPr55PmwIeBf5i7sBvOr5eG i4Ow== 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:mime-version:content-transfer-encoding; bh=e0Pz6i6JWlIFvYArOTeih8eCx8iV9HZyZAVvys5cSoM=; b=XRgtDiUtrqDL4ig2UL4Mcmkblt9MNtgX8orKH95HEexksk2GMxEtA3HEUiN3bgf/tM IAcg1O5/3My72fnj8sN6fuXl0O+lnmYWkmEe5NKkkMYMDxFZowHrm4j+aHtlN5xlYwcj g1/tyjdoy0n0Wjl+Lu+Kuqmp1CNdIXSzpl1xUSSnTlGlSC2ExvbtdDsk2kUxYIWayQPY TFgtArPP0IAmX1ig/jQvV1El7FAwjm/Wzgtf2jLx2HZ1QhMkDom/Q8p6H8wK9LoTRcTF gFio14d/DS1rRzVPxu9Sfja9GEJRPjxaDS89rnPNHEerrDaN7PTtvUPPcr5dy8fEe7rI eZCg== X-Gm-Message-State: AOAM531kv4W+50mjj1wFK53pFXrmf15lrdScqcehVwfksolAe1c8xeoO EuPUxtMeWMtPVyTDFrgGX7VR2g== X-Google-Smtp-Source: ABdhPJzOQzE4YtrZ+JT6A7A6V6flhqDT09iabX9Ed2eM9fV3YI3iugRWD8L5txr9oqCDOiuhEiMEAg== X-Received: by 2002:a17:902:7802:: with SMTP id p2mr9371956pll.38.1589824970369; Mon, 18 May 2020 11:02:50 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:49 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 06/23] coresight: docs: Add information about the topology representations Date: Mon, 18 May 2020 12:02:25 -0600 Message-Id: <20200518180242.7916-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110253_061782_5CB3F0BD X-CRM114-Status: GOOD ( 15.60 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:633 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach Update the CoreSight documents to describe the new connections directory and the links between CoreSight devices in this directory. Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- .../trace/coresight/coresight-ect.rst | 5 +- Documentation/trace/coresight/coresight.rst | 85 +++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) diff --git a/Documentation/trace/coresight/coresight-ect.rst b/Documentation/trace/coresight/coresight-ect.rst index ecc1e57012ef..50a5623d5d4f 100644 --- a/Documentation/trace/coresight/coresight-ect.rst +++ b/Documentation/trace/coresight/coresight-ect.rst @@ -72,7 +72,7 @@ capable of generating or using trigger signals.:: >$ ls /sys/bus/coresight/devices/etm0/cti_cpu0 channels ctmid enable nr_trigger_cons mgmt power powered regs - subsystem triggers0 triggers1 uevent + connections subsystem triggers0 triggers1 uevent *Key file items are:-* * ``enable``: enables/disables the CTI. Read to determine current state. @@ -88,6 +88,9 @@ capable of generating or using trigger signals.:: * ``channels``: Contains the channel API - CTI main programming interface. * ``regs``: Gives access to the raw programmable CTI regs. * ``mgmt``: the standard CoreSight management registers. + * ``connections``: Links to connected *CoreSight* devices. The number of + links can be 0 to ``nr_trigger_cons``. Actual number given by ``nr_links`` + in this directory. triggers directories diff --git a/Documentation/trace/coresight/coresight.rst b/Documentation/trace/coresight/coresight.rst index 108600ee1e12..0b73acb44efa 100644 --- a/Documentation/trace/coresight/coresight.rst +++ b/Documentation/trace/coresight/coresight.rst @@ -241,6 +241,91 @@ to the newer scheme, to give a confirmation that what you see on your system is not unexpected. One must use the "names" as they appear on the system under specified locations. +Topology Representation +----------------------- + +Each CoreSight component has a ``connections`` directory which will contain +links to other CoreSight components. This allows the user to explore the trace +topology and for larger systems, determine the most appropriate sink for a +given source. The connection information can also be used to establish +which CTI devices are connected to a given component. This directory contains a +``nr_links`` attribute detailing the number of links in the directory. + +For an ETM source, in this case ``etm0`` on a Juno platform, a typical +arrangement will be:: + + linaro-developer:~# ls - l /sys/bus/coresight/devices/etm0/connections + cti_cpu0 -> ../../../23020000.cti/cti_cpu0 + nr_links + out:0 -> ../../../230c0000.funnel/funnel2 + +Following the out port to ``funnel2``:: + + linaro-developer:~# ls -l /sys/bus/coresight/devices/funnel2/connections + in:0 -> ../../../23040000.etm/etm0 + in:1 -> ../../../23140000.etm/etm3 + in:2 -> ../../../23240000.etm/etm4 + in:3 -> ../../../23340000.etm/etm5 + nr_links + out:0 -> ../../../20040000.funnel/funnel0 + +And again to ``funnel0``:: + + linaro-developer:~# ls -l /sys/bus/coresight/devices/funnel0/connections + in:0 -> ../../../220c0000.funnel/funnel1 + in:1 -> ../../../230c0000.funnel/funnel2 + nr_links + out:0 -> ../../../20010000.etf/tmc_etf0 + +Finding the first sink ``tmc_etf0``. This can be used to collect data +as a sink, or as a link to propagate further along the chain:: + + linaro-developer:~# ls -l /sys/bus/coresight/devices/tmc_etf0/connections + cti_sys0 -> ../../../20020000.cti/cti_sys0 + in:0 -> ../../../20040000.funnel/funnel0 + nr_links + out:0 -> ../../../20150000.funnel/funnel4 + +via ``funnel4``:: + + linaro-developer:~# ls -l /sys/bus/coresight/devices/funnel4/connections + in:0 -> ../../../20010000.etf/tmc_etf0 + in:1 -> ../../../20140000.etf/tmc_etf1 + nr_links + out:0 -> ../../../20120000.replicator/replicator0 + +and a ``replicator0``:: + + linaro-developer:~# ls -l /sys/bus/coresight/devices/replicator0/connections + in:0 -> ../../../20150000.funnel/funnel4 + nr_links + out:0 -> ../../../20030000.tpiu/tpiu0 + out:1 -> ../../../20070000.etr/tmc_etr0 + +Arriving at the final sink in the chain, ``tmc_etr0``:: + + linaro-developer:~# ls -l /sys/bus/coresight/devices/tmc_etr0/connections + cti_sys0 -> ../../../20020000.cti/cti_sys0 + in:0 -> ../../../20120000.replicator/replicator0 + nr_links + +As described below, when using sysfs it is sufficient to enable a sink and +a source for successful trace. The framework will correctly enable all +intermediate links as required. + +Note: ``cti_sys0`` appears in two of the connections lists above. +CTIs can connect to multiple devices and are arranged in a star topology +via the CTM. See (:doc:`coresight-ect`) [#fourth]_ for further details. +Looking at this device we see 4 connections:: + + linaro-developer:~# ls -l /sys/bus/coresight/devices/cti_sys0/connections + nr_links + stm0 -> ../../../20100000.stm/stm0 + tmc_etf0 -> ../../../20010000.etf/tmc_etf0 + tmc_etr0 -> ../../../20070000.etr/tmc_etr0 + tpiu0 -> ../../../20030000.tpiu/tpiu0 + + How to use the tracer modules ----------------------------- From patchwork Mon May 18 18:02:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556011 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 965CB1668 for ; Mon, 18 May 2020 18:05: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 67CB620715 for ; Mon, 18 May 2020 18:05: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="rkIT/WpE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vEvPNVPA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67CB620715 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=99+STx63lrGupEsMJcZZvP2tOHOhznCkZOVCDwFPOqc=; b=rkIT/WpESmBabK 3fXGH5O347AVOjyUoKluEMfvwl61H2S6/+0gTXNEyxZnTsp9y75vwVjHANo0q10qDRUztsjWPUBE0 MTrnkbn4gnudh4Lkm0/dZHKnxcjZJX4IXFxEZgdDjtGO3n2mX15eUhOrYDrTHBqi+4tUi5ck7W+ZJ lhFOaj5To9szzO6L+ekl7BHGAN01ZG64Llx0KksJqx/TVL9zo0oQQSmtIu0jKBp3ULhLMqpuz3Ic9 iS3GWlAsoDZ/NPOA4kyNH1AliAxYGn99oBXTZN2XrXX1kQ+T5MtcZAkzJTSV9rr3HNsySvzVHTWE2 T1MgNdz+8ty5UGfIiTrQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak8q-0007gu-8K; Mon, 18 May 2020 18:05:32 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6H-0003Ij-6o for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:55 +0000 Received: by mail-pj1-x102d.google.com with SMTP id cx22so196861pjb.1 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=3Nj0lWmTeyBc/FhSKF/gfTCgo/kmCMNbvurnmgvzlOU=; b=vEvPNVPAKXWK4AnWTWfbC4Zyy0JqQL+9zK2ftDNUV+bgjNuOPHyTtp2FINuVWovNBH c/D4sjrvQQOHKDWZcY6Rg3CAmO+bUul2diYq+YOEVERWFW8XNbZXG8yiWVaNJI24Dq0o +kpn3tJFxOpqsn8UFYVu65AUOVbKrWNbnxMvoEc1UK+xFCMpjTUkO8TcxIesxdJurg92 xv+60hYXH4qjKQ4/6h4aK5id5U1akTjb0/6PEjl8UzC8dBaJW1JODZ+w80JSyEykC2/Q wfwsi7eDwz5OJ35lNrbCAgD6x6zeYXSUJDgaruMA5N873+DAoCWwm2F1EDGu5jqTaqL9 zkew== 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:mime-version:content-transfer-encoding; bh=3Nj0lWmTeyBc/FhSKF/gfTCgo/kmCMNbvurnmgvzlOU=; b=H9eXKlG0Qil8k4qGYvab7JjNwG+wyOaUhjEOIFCNDYzqUzzbVUfZmrUZBChWCKVHya CGriEJYFqM/zXbR4VCP0p8dqOs5ODlfDVVYbg2LPKdhqJYsgbxmMs1Al7gIrySCi3w4m d51Jz8QOFlrVNN0gACBAIZhTjcgEX7vfdTPn5phNngodKTFk6k/L2wNbOXTFt2mJ0MtM WKgAy57N9sp8NjCrAykz0Fj4Y+iDAdXTcGjUk4zvxJEueqO+0vxXmTrY/rEMPNnpcQ7p fpj7jjMhSjUFBdQcFSzJqtW1jaP0klPJT3R1APHIFQpS9dByj7w1FJzI+xZSPcPeRLM0 TxaA== X-Gm-Message-State: AOAM531Sg+NgwlHdNdB7anIUwwph8ni9MN5eWTuEp4mzhxG8h5n5Kqti wuiQOAiaO3IpwXc/c/clwXP5bfhHBNA= X-Google-Smtp-Source: ABdhPJyDmAV6di7+KHiRMwgeyIE+y+w0Xi2F72z1sJ/rhU7Sgwqc1CQP5El83nzFgsrt+OxE0DOq/w== X-Received: by 2002:a17:902:a60a:: with SMTP id u10mr16671131plq.249.1589824971445; Mon, 18 May 2020 11:02:51 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:50 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 07/23] docs: trace: coresight-ect.rst: Fix a build warning Date: Mon, 18 May 2020 12:02:26 -0600 Message-Id: <20200518180242.7916-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110253_277919_58729929 X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:102d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mauro Carvalho Chehab Sphinx wants a line after "..", as otherwise it complains with: Documentation/trace/coresight/coresight-ect.rst:2: WARNING: Explicit markup ends without a blank line; unexpected unindent. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mathieu Poirier --- Documentation/trace/coresight/coresight-ect.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/trace/coresight/coresight-ect.rst b/Documentation/trace/coresight/coresight-ect.rst index 50a5623d5d4f..a68732c5c6d6 100644 --- a/Documentation/trace/coresight/coresight-ect.rst +++ b/Documentation/trace/coresight/coresight-ect.rst @@ -1,4 +1,5 @@ .. SPDX-License-Identifier: GPL-2.0 + ============================================= CoreSight Embedded Cross Trigger (CTI & CTM). ============================================= From patchwork Mon May 18 18:02:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556007 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 4B6C71391 for ; Mon, 18 May 2020 18:04:53 +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 01E0C207D3 for ; Mon, 18 May 2020 18:04:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="seQVYkUJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Z9WDlXCB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01E0C207D3 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=0uUMaD2XN0JgIo/EIIEIG9gXYM48iaAnZOQtpth02yU=; b=seQVYkUJcNK3AF b9+4irRmuvpeyuV2iXtLW/YEp7e8rCNmLRq2ehghMLMNHeRUa51mSodbmxdYv6f0/GmWIeIQSL6ZW NBBzBRTpOLcqhfUqshI8vLRJjajz0JxY6+G7phlXq9yGfPfPLrM5US5GguTRnup+QjGQaMOxNAswF 0ZHqC8AjDxW82mA2ciQh6tVIRnx986vCrkTWFMXzdVui90YY3FGA56G3ZX8yLS1ZprDXvNKP9XUUo evvy4eVI8BJkGXoQanqJShhOeLroXC6nbHD3hdOM9L3AEFnR4iXtf6S6hcVJ22bgMnYSNCt2Uj/70 590no6GpKZofy8ykX8mQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak87-0004oD-Tl; Mon, 18 May 2020 18:04:47 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6H-0003JQ-Eu for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:55 +0000 Received: by mail-pf1-x443.google.com with SMTP id z26so5180599pfk.12 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=TyOfEyc1p8YX3PmwOzWO2A6hoI9O98cRfCI+e8b4hIA=; b=Z9WDlXCB9+wMZqt3HYnxXTG46rSJL2qt3M7eatb2UX36OTObY1A6EgFhZfyNoY4wJf iP/Sa5g0uHF0+sjoKoBOelDlEB/FFZ6NOxOyV/DLGpvsAcv6JQ+xmnYz/iFD1tiAFvAU fd8FFNg9eY+A5PXAGc0MlCMATCp832KVPJ24D4ehketjc09x96hM1qtkKZIV5M/DLmzy Gy4jV/wXW9ZRNnPiBmuNwqFcw+7a/RMryXt+uBNTcewB60wRMG1Aq9J1lZt92H7N6Qqh yFuypdQdarzKBW2wZQZD2C05LfOaeR9Xe6GWVPTBB8PU5oITEOfy+cGp98Xs2W/yqXy/ bm/A== 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:mime-version:content-transfer-encoding; bh=TyOfEyc1p8YX3PmwOzWO2A6hoI9O98cRfCI+e8b4hIA=; b=iprBVCyUewievbLtxac0Ln+y/4Id9M0K7bGMWuj4xpuBeCSClYRpiTz4qpEiZhRqET CWc5YC9ysuyVyKhUj66SnDj8eFc9UQ4bnrk/Chd3RMhNtSqlAOuoqQEXIcJd+w9B5RRy azHyiFgyr1vCYWEcj5aZGOuvwyfzWkCAj4fGaiv7eNWhmeolO91xvsCHOK+cOEUPnURx utSJWuT8YGs3sGwDKre6DRaM5wHNcRa9cUwS7nd6XC7KGwTKCGcwm0TI8P4oadUx5EYU JWEVwGMShT1YDbUjuGHuljwQ25YzHHN2Vrb/wCyb8Ejsj5geydaIBhyhy9rTTNOUYCAN n8MQ== X-Gm-Message-State: AOAM532gZDbzXiTh2tnFFUJPl9V/n8zN1By1kSf9p/lp+Ybagz4QrjHK N9REsgCTC0AHGqH3/GphA0icyY0X2/Q= X-Google-Smtp-Source: ABdhPJzkoRui4pceYAEXUOW33V1Cn3Jf4RMM/FaT1ctdAyL8uL/6vco/xWEUwz3hloVZhsgchxndpw== X-Received: by 2002:a63:a363:: with SMTP id v35mr14756782pgn.95.1589824972370; Mon, 18 May 2020 11:02:52 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:52 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 08/23] coresight: etm4x: Add support for Qualcomm SC7180 SoC Date: Mon, 18 May 2020 12:02:27 -0600 Message-Id: <20200518180242.7916-9-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110253_588024_9C98F3EB X-CRM114-Status: GOOD ( 10.00 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:443 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Sai Prakash Ranjan Add ETM UCI IDs for Qualcomm SC7180 SoC. It has 2 big CPU cores based on Cortex-A76 and 6 LITTLE CPU cores based on Cortex-A55. Signed-off-by: Sai Prakash Ranjan Reviewed-by: Stephen Boyd Tested-by: Stephen Boyd Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index a90d757f7043..4fb4874981e1 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1556,6 +1556,8 @@ static const struct amba_id etm4_ids[] = { 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 */ + CS_AMBA_UCI_ID(0x000bb805, uci_id_etm4),/* Qualcomm Kryo 4XX Cortex-A55 */ + CS_AMBA_UCI_ID(0x000bb804, uci_id_etm4),/* Qualcomm Kryo 4XX Cortex-A76 */ CS_AMBA_UCI_ID(0x000cc0af, uci_id_etm4),/* Marvell ThunderX2 */ {}, }; From patchwork Mon May 18 18:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556015 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 A57AE739 for ; Mon, 18 May 2020 18:06: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 838812087D for ; Mon, 18 May 2020 18:06: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="HBmIKqfo"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Nz5YNmpW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 838812087D 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=JBd6210+vAT0w8w0qPsD1d5vB6ti0m2KcHiobZ0L2NE=; b=HBmIKqfo1Grf9f xs3d+rZJzBd0uFCLKwuWroFwp2VWMjM5+pqZzm2/M36jRx0D5SSwTBcX8MV6Bdf1YqP57DpvcUvcZ gJJP3TKBlQjGnd9fyXyauTh51mh4f7+ZAsuyCsl6Lf1LZjm1HFOP8Jj0iXxuxonCkzDpn/O8bKPW9 88I9WlZHSCkom0/xDg7txwfkMv4O2rx9h4GPP8RsGU1ASMs9MZGGH2e9Q50g6UM24nGkoi3vn4w40 0lqEM1Du+/lQdbHj/rxmU2vAzG6iIiQ5MwZpK3CDpoZA1bQ7oxP5BLz+f3VtkrvovJcNI4aO/qovZ PWWLplXsq3/mfsNEGXGw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak9S-0008D6-33; Mon, 18 May 2020 18:06:10 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6H-0003KO-Vv for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:55 +0000 Received: by mail-pj1-x1044.google.com with SMTP id 5so193993pjd.0 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=zSWw0gTwrFNJ59zKX4DfJwQn4PCUoycy0XTqgN8fJFM=; b=Nz5YNmpWZCQY875rygR0fAZ5Z9aZH62HUXpwYnD2NorcXK9H8GWjppkBr20PUNChwe E9fuM2aj6A1MGE1JCD+mFGcX0FKC6OKVRAwC6tjIut2shX1lFrvWRBwLFkpi3bNH6R7C ylQnk8fm+3womwW1H9BtWqv9mW8h/DWkemivfXQOidP5r8deMnUGOGqpLgAu2dUnA07z BQqtY0PtR57UHzKxZJcDSCD1TNtFRE+EP8EFtbF59TLmADxC72zwvgwyBIhR3zfEkc+Y ksc2/+FaC0aBKYGDFVwFHe9s4y0VI843sUyPJMW2voO1/9Ol/9sMu2jWO/zcWswJhro4 b7wA== 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:mime-version:content-transfer-encoding; bh=zSWw0gTwrFNJ59zKX4DfJwQn4PCUoycy0XTqgN8fJFM=; b=q5+MFhD/W0ze70yBRoUIOv/klZ3ZqLN69S3Si9JUixb2zAbSMMJm9PngjHa3e0eaJE MORps96Aogh46OdPb0J2EDHEz3L/G6pPqivY4GnB+zlN7OJppmtiJ44Sk2/4ojfLxkbZ UNdQturBaWEoAbIzhxycpE6DhCvpF4BoCjS52ByQbat6k+k3FM5JPl1GaLwoprqXtnZI tcJLwVnGEP0RjSA6iPvgWDvzB9lvCFVWyuCe31kRY4e8FYxaUy9eruadOIvqyaSVRKQQ UGBz6DaU84RKKxiGSNZR12ri2Mg2ZsEKQ7aDxK61ueqLuFkQW/IVHX1dNeZmxOUAuoWe xtrw== X-Gm-Message-State: AOAM531a6Gw6Z/LbzEvLxbdK5uTZ98tNqMprPeyVxAvY/1tYKyiBHndv oINSOiG0uMgeWY5fu9mPi39UOg== X-Google-Smtp-Source: ABdhPJxDqY+d4L13ODH8cQWmTyLct9X4HK5O/YLbr0oY5HyMRZWrCq5SPEHBzzG+ibxPB0McFFgHSA== X-Received: by 2002:a17:90a:49c5:: with SMTP id l5mr611214pjm.73.1589824973138; Mon, 18 May 2020 11:02:53 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:52 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 09/23] coresight: etm4x: Replace ETM PIDs with UCI IDs for Kryo385 Date: Mon, 18 May 2020 12:02:28 -0600 Message-Id: <20200518180242.7916-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110254_097180_3AEDE04C X-CRM114-Status: GOOD ( 10.82 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:1044 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Sai Prakash Ranjan Replace the AMBA ETM PIDs with UCI IDs to avoid future conflicts when adding the CTI support for QCOM Kryo385 CPU cores. Fixes: 17b4add0d4e0 ("coresight: etm4x: Add ETM PIDs for SDM845 and MSM8996") Signed-off-by: Sai Prakash Ranjan Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 4fb4874981e1..94c5f204998e 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1554,8 +1554,8 @@ static const struct amba_id etm4_ids[] = { 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 */ + CS_AMBA_UCI_ID(0x000bb802, uci_id_etm4),/* Qualcomm Kryo 385 Cortex-A55 */ + CS_AMBA_UCI_ID(0x000bb803, uci_id_etm4),/* Qualcomm Kryo 385 Cortex-A75 */ CS_AMBA_UCI_ID(0x000bb805, uci_id_etm4),/* Qualcomm Kryo 4XX Cortex-A55 */ CS_AMBA_UCI_ID(0x000bb804, uci_id_etm4),/* Qualcomm Kryo 4XX Cortex-A76 */ CS_AMBA_UCI_ID(0x000cc0af, uci_id_etm4),/* Marvell ThunderX2 */ From patchwork Mon May 18 18:02:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556009 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 7480C739 for ; Mon, 18 May 2020 18:05:27 +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 3D88920671 for ; Mon, 18 May 2020 18:05:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kWIsIvFi"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uMcyZAMn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D88920671 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=JjmlmNeoDInv6zkqDR58M2/uRTNq2dZVRYzDEA4wuTM=; b=kWIsIvFiwvTJYZ ipfXs1MDNvLyqFSdC7u44bo2Grq1wt2z+F3yar+vP1rT1h8iVyzx+DYQaTrPz67UYMEq++nc8iymA lRW2v6OKYVLGRIPtWW/QOooaemTOPep2zQq+LJUv9lkeC4mu81947JhrEoSgIK8u9mrxjHdYydFDS EF/Wg5GA1fYdjKuLOlAJ/MUd7vMN2cucNVCjQu2MvKZqolffockWktswvCgbcpoy1TPdlUOcZ3KtB T7XIcWvBH9d8TELpNFbdhUqRqFDA4U8wshKEs+jfpFFvREzr0wUbhJDJN5m4DKBuixd7vOnDPgfXU s/jFj4Iw9hK/ETQRh5+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak8e-0007U7-MP; Mon, 18 May 2020 18:05:20 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6J-0003LV-CS for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:57 +0000 Received: by mail-pf1-x442.google.com with SMTP id 23so5304001pfy.8 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=TNFXN7HdI7SEUVehc+ncm1I4+gJh5UYkyGN7rnj56sc=; b=uMcyZAMnXMYPh6qRGTt+cBFdp6+XAQdW9VdjMwEb3K6qWX7PjGpGdZDhPZluGeFxf0 14kRYwdg5DmhkYjRO+9ZAWlU4jvvvYn8g3BZnbdiRyMi3sWii3+9R/AuxI/+xvZ/XvBY Fb2UZJc2GHqKPVPYlmeMdJWlxxqjYMkgdcrnXW5V+Scv/kVrGglV+aLyNX70NBtog7rZ 3+LyrRAAdBD1CO3eaMplJUwdfIhfeg6yO/n5b0dqdSXIAkVULXA/OdEwmLtAyWljjv4D 8Fn9eiOT+rj/0C2riLvngZ3YOqNJv90vSIDFlUwDJ8vgbDMKUfvlVPgd2CzAs+0edWMQ 4nBA== 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:mime-version:content-transfer-encoding; bh=TNFXN7HdI7SEUVehc+ncm1I4+gJh5UYkyGN7rnj56sc=; b=N8K7gtyf24ERhFPT8Jy9fcvaOUIhMDkZg3M7WXUq1I7nGzDhxQ+DHxxj4nORtsZvwD qp4kWP1MCanEYxAc29BChiv5cVH+J6mPr5iBHxNV3XNOAV5rieQBCjQR1+DPe+I9ZRv8 /q3hPo7ZxB+DbGVkPkD27nJJV+V6C7Y9AoxuYbrNCr3VkZo4fruaAt6MRUZZ8jwosEdA HWAZ0b8QKZfnaT75v7nOf8++Aj5yOvSZbPwsdpXYov1zmAB2dkjoj7ECGcugG9cKjS+W V/BxaviuAUstNgObCG37c7YokZi+F/ryXyfjvuaMUtanEyxwrl7Zkr9YUmnDCYp6V/A7 s62g== X-Gm-Message-State: AOAM530w1cJ8wHUq8vdRVPIDLj1ZVzWzj+7kIfNIt+T8PCy+k7howYzx qtIerzNIrnM9KAhrHUZXf7yewQ== X-Google-Smtp-Source: ABdhPJyXNheK4m49L8AbaPRUQSdQxVVLZ0HEDLaS/TTTYaGPOyJpkKcPwwvmyu2BtpGwlgTyfV5Szw== X-Received: by 2002:a63:b95a:: with SMTP id v26mr15770459pgo.196.1589824974090; Mon, 18 May 2020 11:02:54 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:53 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 10/23] coresight: cti: Make some symbols static Date: Mon, 18 May 2020 12:02:29 -0600 Message-Id: <20200518180242.7916-11-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110255_500972_1CA6C1B5 X-CRM114-Status: GOOD ( 11.26 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jason Yan Fix the following sparse warning: drivers/hwtracing/coresight/coresight-cti.c:22:1: warning: symbol 'ect_net' was not declared. Should it be static? drivers/hwtracing/coresight/coresight-cti.c:625:32: warning: symbol 'cti_ops_ect' was not declared. Should it be static? drivers/hwtracing/coresight/coresight-cti.c:630:28: warning: symbol 'cti_ops' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Jason Yan Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 9e262f5a85e3..7fc1fc8d7738 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -19,7 +19,7 @@ */ /* net of CTI devices connected via CTM */ -LIST_HEAD(ect_net); +static LIST_HEAD(ect_net); /* protect the list */ static DEFINE_MUTEX(ect_mutex); @@ -622,12 +622,12 @@ int cti_disable(struct coresight_device *csdev) return cti_disable_hw(drvdata); } -const struct coresight_ops_ect cti_ops_ect = { +static const struct coresight_ops_ect cti_ops_ect = { .enable = cti_enable, .disable = cti_disable, }; -const struct coresight_ops cti_ops = { +static const struct coresight_ops cti_ops = { .ect_ops = &cti_ops_ect, }; From patchwork Mon May 18 18:02:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556019 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 B4A641391 for ; Mon, 18 May 2020 18:06: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 812B220715 for ; Mon, 18 May 2020 18:06: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="vBqZt1xk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kCZGWJVJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 812B220715 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=DYnYM2uoByn9tvemnT2nhkUAGzge12Nx0DcUt9evdNo=; b=vBqZt1xkLcp+hm 9KvmkKtMALkCZlJsNv4m/7HFppmyBb5xiFcuajUQ2O4+tb8bGCnnoU0DUyGtbt0OxUnMi5yS1POo0 Q9k2A/YbItFlTXVJHtvjFyeOhB/+8fqWyFxubcuXZsNT+ACpnIZYjTCeyEIQyWl02GV+loPCVTj/B eD9kcth3aKsGQuQ2C1j2Xq+SdbE/cVhiO+SnuVUg4H9WR0waIrzW1lv2eMtMZnYhujLz10eyTI3j2 SX2KR6uDHQvocwCzdTOyQNTcLfSrDUs841o5w3lLEKqMgFeKeWo1O17R8uee/SYjv9qrfffCM9Onr e+zpsJbgLSQidyLX8GkQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak9x-0000Dw-03; Mon, 18 May 2020 18:06:41 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6J-0003MJ-Up for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:57 +0000 Received: by mail-pl1-x641.google.com with SMTP id f15so4545129plr.3 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=2A9HocrxMs257cTec0YZIZY33yZiZ7tmE2rTI2roxDM=; b=kCZGWJVJ2emAGBcMUNHKSEgPISG3V+qwTPq5IodhFtv8RSt7vZKJ+6nT+X7PVAqNcw yk3+TGXY6kUu9csoWjxOinTFS52/FKyD/6gMo/BxihHfjJ+rII8Qnm9ACDeLWk0m6a76 v4T9OZC39+WK1LJuLzQT2bpyxqfqmUvNfJBdY330F10RpZErnz/bvTKG2A5Ni0uczAyz dzfEA3oJwJgiq4UkUatIj2OVG5AWRoOXsn6NLE7DHfNGS+Vr2ZtwrEszaJMb0+fjpBcI yafVAfiYdOLUnq4z93N/GRJpObQ5lUFYvV9+KElRtttF76HROmDlyp0Hr928IpQuLlLc PW9A== 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:mime-version:content-transfer-encoding; bh=2A9HocrxMs257cTec0YZIZY33yZiZ7tmE2rTI2roxDM=; b=eWpt/DtUsLV7kI6hGOOHfLPgwHfPne6dmgMrUfIncO+pFVYmQPvbjIL+vradyyZBTP oaHuP0ZAcP8V/KDJckz/t1wxU2jQGHB2bAs4NdWhkK2geY7JuSv9yW0vMi47EHa9g0W3 paKKgrznjW1RaZZ+6rBpEw9HRiRb8I7a+ylVBSJtccilOWUzoQeKPEtPRsVZ2Vme4CTb 4EdBv9WJKugmnUbGW9sUkOlcdASums/9pFA3UhqYlrOyjT0EZqjgyfadII8qCWddzhvB QS7btF7VjcYRXxNWJc7uJ9rTXJjM8pkJQHf1oVzlNwsF0+ytGSLKqhPIv/rONJPNZfKl CmRA== X-Gm-Message-State: AOAM532XHw3TiNE9s8cJbd7XpK+qNWw16pvl18EVpOaNJcu8J+GkUp1r Szoz6cXJ6EJvBoqq4xVw6khgHmTDqV0= X-Google-Smtp-Source: ABdhPJyL6JyCQ2Xa5lIT48ArPl8ym3jjBVYF0/tj1fmdxcsay5G2titcnt4GDHUZBuPqGSHJhICPAA== X-Received: by 2002:a17:90a:dd42:: with SMTP id u2mr619809pjv.65.1589824975057; Mon, 18 May 2020 11:02:55 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:54 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 11/23] coresight: etb10: Make coresight_etb_groups static Date: Mon, 18 May 2020 12:02:30 -0600 Message-Id: <20200518180242.7916-12-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110256_030998_9057EDF1 X-CRM114-Status: GOOD ( 11.74 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jason Yan Fix the following sparse warning: drivers/hwtracing/coresight/coresight-etb10.c:720:30: warning: symbol 'coresight_etb_groups' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Jason Yan Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 3810290e6d07..03e3f2590191 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -717,7 +717,7 @@ static const struct attribute_group coresight_etb_mgmt_group = { .name = "mgmt", }; -const struct attribute_group *coresight_etb_groups[] = { +static const struct attribute_group *coresight_etb_groups[] = { &coresight_etb_group, &coresight_etb_mgmt_group, NULL, From patchwork Mon May 18 18:02:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556021 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 53D96138A for ; Mon, 18 May 2020 18:07:10 +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 1B7AA20853 for ; Mon, 18 May 2020 18:07:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="n8IJpcht"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ed+9gc2W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B7AA20853 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=+eONSneeg9emsUb2I87ocWPUikgn3mqfOhToaBc3Gno=; b=n8IJpchtZ4Rm0A 8H7S18/UpKeRv3p3u2W0TDvNrmSiI9S3a9PgzDUFcb1vFYrK8DeRoHxj9VzBn7j6cHuHR+EzrP7TN l/xURssGm8Aw2snGHkMPS78YXFUrTVup3K+mAfyr6+r4P3hdsalXLlIlfKfq7x3tMw8XQMeHca7pY UndP/5Y8IcYvPVZdcM/LDPPVS8kns36D5Y6BHVjsAoCuv3/lnmhZqcUnCKUYxcaXHNyQRYxFq1n18 B05rQXEoFhVmeFd32u+h1t6tmjuRi0DonJ/A+fon1aTETJB1ht2W3sVPf4xHdi+C/lsY0teQeQDik pqcHqQ1n+M195pbwJteQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakAI-0000Wl-Q3; Mon, 18 May 2020 18:07:02 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6L-0003Nn-41 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:00 +0000 Received: by mail-pl1-x644.google.com with SMTP id g11so4547564plp.1 for ; Mon, 18 May 2020 11:02:56 -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 :mime-version:content-transfer-encoding; bh=IlFU47XBCp0m4ekp2KyDiotQ7R7szFQOTzqYDo1qCh0=; b=ed+9gc2W9j7pe60mGj7f6HQ3o8O9VeURwDHsUNth3uwhih1+/MvkacK3GRN7RXEg5R YTTpD2g77W4bVZ6yUFje5Fie8g5ENUZQ9OHXLcZ+DeKFjJPYUPx6FeVYlR6gHJiiz+Fq JCLKFiOBzVIgil+KboCUKT/ePvZmEEWK+zYK/z4+i47SiM33Z9M9aVzUtWuiLrWaJN2M Aa/AWdIdxG7opt1015UUiDl7yVIHTgf+CGS7Cwgaq6C0E+Y+ji5MLU+4TL6nLUcXjjen qglYcHXLrQOGQWhPxDK251CWIjZM+SQ12MfSWWeviLEHuv15ptMLM39GVCWiydDcO9Bb 7/4g== 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:mime-version:content-transfer-encoding; bh=IlFU47XBCp0m4ekp2KyDiotQ7R7szFQOTzqYDo1qCh0=; b=gUZCH/ZQJC03w3DG6oNyoTSSQt/DaS01pSzIoYkcLOi/ZH4qlfVGEBGpKbt4Ycb6m+ pl9US73Rn2U3HSugvTFozbPGZF2WYaiYQui92uxgL9vawRMEWdiJyhgM/NuopUC8m2Y3 qpJNamoCmOifrTJZgYQlq/qtXpwNNnBcktQx8zCpd/L1FqfUv3/FuenYU2FgtCRFKXhr SWSdIgc847cseodjdiPCM+4qYK+uvjgyjsgihWxFI5sWYNjP3mUnpee385U5fAh/K4fq 9O4rwEdmtZGg93dZRKH3ewUgaiTppbkbRturjSR6i+ZLtgIS9wOyrKP+JJyWbltwdyoo IGXg== X-Gm-Message-State: AOAM531GWRJNpR350dFIeW4/aQk+jTPWL2RCoYtB9wIEVEy0gKVP6IbP e1Wr4hQqWfkGKu5+/jQbX+NdgQ== X-Google-Smtp-Source: ABdhPJyySdwXZp1arkFAmhQ82JqnOuRJZ8T6itjdOu+/5PoV6qsqVZ976/WVa6SEuHygRovm7XWRdw== X-Received: by 2002:a17:90a:fa95:: with SMTP id cu21mr629700pjb.106.1589824975921; Mon, 18 May 2020 11:02:55 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:55 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 12/23] coresight: Fix support for sparsely populated ports Date: Mon, 18 May 2020 12:02:31 -0600 Message-Id: <20200518180242.7916-13-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110257_280374_1D3AC63E X-CRM114-Status: GOOD ( 26.82 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Suzuki K Poulose On some systems the firmware may not describe all the ports connected to a component (e.g, for security reasons). This could be especially problematic for "funnels" where we could end up in modifying memory beyond the allocated space for refcounts. e.g, for a funnel with input ports listed 0, 3, 5, nr_inport = 3. However the we could access refcnts[5] while checking for references, like : [ 526.110401] ================================================================== [ 526.117988] BUG: KASAN: slab-out-of-bounds in funnel_enable+0x54/0x1b0 [ 526.124706] Read of size 4 at addr ffffff8135f9549c by task bash/1114 [ 526.131324] [ 526.132886] CPU: 3 PID: 1114 Comm: bash Tainted: G S 5.4.25 #232 [ 526.140397] Hardware name: Qualcomm Technologies, Inc. SC7180 IDP (DT) [ 526.147113] Call trace: [ 526.149653] dump_backtrace+0x0/0x188 [ 526.153431] show_stack+0x20/0x2c [ 526.156852] dump_stack+0xdc/0x144 [ 526.160370] print_address_description+0x3c/0x494 [ 526.165211] __kasan_report+0x144/0x168 [ 526.169170] kasan_report+0x10/0x18 [ 526.172769] check_memory_region+0x1a4/0x1b4 [ 526.177164] __kasan_check_read+0x18/0x24 [ 526.181292] funnel_enable+0x54/0x1b0 [ 526.185072] coresight_enable_path+0x104/0x198 [ 526.189649] coresight_enable+0x118/0x26c ... [ 526.237782] Allocated by task 280: [ 526.241298] __kasan_kmalloc+0xf0/0x1ac [ 526.245249] kasan_kmalloc+0xc/0x14 [ 526.248849] __kmalloc+0x28c/0x3b4 [ 526.252361] coresight_register+0x88/0x250 [ 526.256587] funnel_probe+0x15c/0x228 [ 526.260365] dynamic_funnel_probe+0x20/0x2c [ 526.264679] amba_probe+0xbc/0x158 [ 526.268193] really_probe+0x144/0x408 [ 526.271970] driver_probe_device+0x70/0x140 ... [ 526.316810] [ 526.318364] Freed by task 0: [ 526.321344] (stack is not available) [ 526.325024] [ 526.326580] The buggy address belongs to the object at ffffff8135f95480 [ 526.326580] which belongs to the cache kmalloc-128 of size 128 [ 526.339439] The buggy address is located 28 bytes inside of [ 526.339439] 128-byte region [ffffff8135f95480, ffffff8135f95500) [ 526.351399] The buggy address belongs to the page: [ 526.356342] page:ffffffff04b7e500 refcount:1 mapcount:0 mapping:ffffff814b00c380 index:0x0 compound_mapcount: 0 [ 526.366711] flags: 0x4000000000010200(slab|head) [ 526.371475] raw: 4000000000010200 ffffffff05034008 ffffffff0501eb08 ffffff814b00c380 [ 526.379435] raw: 0000000000000000 0000000000190019 00000001ffffffff 0000000000000000 [ 526.387393] page dumped because: kasan: bad access detected [ 526.393128] [ 526.394681] Memory state around the buggy address: [ 526.399619] ffffff8135f95380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.407046] ffffff8135f95400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.414473] >ffffff8135f95480: 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.421900] ^ [ 526.426029] ffffff8135f95500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.433456] ffffff8135f95580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.440883] ================================================================== To keep the code simple, we now track the maximum number of possible input/output connections to/from this component @ nr_inport and nr_outport in platform_data, respectively. Thus the output connections could be sparse and code is adjusted to skip the unspecified connections. Cc: Mathieu Poirier Cc: Mike Leach Reported-by: Sai Prakash Ranjan Tested-by: Sai Prakash Ranjan Tested-by: Stephen Boyd Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-platform.c | 85 +++++++++++++------ drivers/hwtracing/coresight/coresight.c | 7 +- include/linux/coresight.h | 10 ++- 3 files changed, 72 insertions(+), 30 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 4b78e1ac5285..d58dcd0ab514 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -87,6 +87,7 @@ static void of_coresight_get_ports_legacy(const struct device_node *node, int *nr_inport, int *nr_outport) { struct device_node *ep = NULL; + struct of_endpoint endpoint; int in = 0, out = 0; do { @@ -94,10 +95,16 @@ static void of_coresight_get_ports_legacy(const struct device_node *node, if (!ep) break; - if (of_coresight_legacy_ep_is_input(ep)) - in++; - else - out++; + if (of_graph_parse_endpoint(ep, &endpoint)) + continue; + + if (of_coresight_legacy_ep_is_input(ep)) { + in = (endpoint.port + 1 > in) ? + endpoint.port + 1 : in; + } else { + out = (endpoint.port + 1) > out ? + endpoint.port + 1 : out; + } } while (ep); @@ -137,9 +144,16 @@ of_coresight_count_ports(struct device_node *port_parent) { int i = 0; struct device_node *ep = NULL; + struct of_endpoint endpoint; + + while ((ep = of_graph_get_next_endpoint(port_parent, ep))) { + /* Defer error handling to parsing */ + if (of_graph_parse_endpoint(ep, &endpoint)) + continue; + if (endpoint.port + 1 > i) + i = endpoint.port + 1; + } - while ((ep = of_graph_get_next_endpoint(port_parent, ep))) - i++; return i; } @@ -191,14 +205,12 @@ static int of_coresight_get_cpu(struct device *dev) * Parses the local port, remote device name and the remote port. * * Returns : - * 1 - If the parsing is successful and a connection record - * was created for an output connection. * 0 - If the parsing completed without any fatal errors. * -Errno - Fatal error, abort the scanning. */ static int of_coresight_parse_endpoint(struct device *dev, struct device_node *ep, - struct coresight_connection *conn) + struct coresight_platform_data *pdata) { int ret = 0; struct of_endpoint endpoint, rendpoint; @@ -206,6 +218,7 @@ static int of_coresight_parse_endpoint(struct device *dev, struct device_node *rep = NULL; struct device *rdev = NULL; struct fwnode_handle *rdev_fwnode; + struct coresight_connection *conn; do { /* Parse the local port details */ @@ -232,6 +245,13 @@ static int of_coresight_parse_endpoint(struct device *dev, break; } + conn = &pdata->conns[endpoint.port]; + if (conn->child_fwnode) { + dev_warn(dev, "Duplicate output port %d\n", + endpoint.port); + ret = -EINVAL; + break; + } conn->outport = endpoint.port; /* * Hold the refcount to the target device. This could be @@ -244,7 +264,6 @@ static int of_coresight_parse_endpoint(struct device *dev, conn->child_fwnode = fwnode_handle_get(rdev_fwnode); conn->child_port = rendpoint.port; /* Connection record updated */ - ret = 1; } while (0); of_node_put(rparent); @@ -258,7 +277,6 @@ static int of_get_coresight_platform_data(struct device *dev, struct coresight_platform_data *pdata) { int ret = 0; - struct coresight_connection *conn; struct device_node *ep = NULL; const struct device_node *parent = NULL; bool legacy_binding = false; @@ -287,8 +305,6 @@ static int of_get_coresight_platform_data(struct device *dev, dev_warn_once(dev, "Uses obsolete Coresight DT bindings\n"); } - conn = pdata->conns; - /* Iterate through each output port to discover topology */ while ((ep = of_graph_get_next_endpoint(parent, ep))) { /* @@ -300,15 +316,9 @@ static int of_get_coresight_platform_data(struct device *dev, if (legacy_binding && of_coresight_legacy_ep_is_input(ep)) continue; - ret = of_coresight_parse_endpoint(dev, ep, conn); - switch (ret) { - case 1: - conn++; /* Fall through */ - case 0: - break; - default: + ret = of_coresight_parse_endpoint(dev, ep, pdata); + if (ret) return ret; - } } return 0; @@ -647,6 +657,16 @@ static int acpi_coresight_parse_link(struct acpi_device *adev, * coresight_remove_match(). */ conn->child_fwnode = fwnode_handle_get(&r_adev->fwnode); + } else if (dir == ACPI_CORESIGHT_LINK_SLAVE) { + /* + * We are only interested in the port number + * for the input ports at this component. + * Store the port number in child_port. + */ + conn->child_port = fields[0].integer.value; + } else { + /* Invalid direction */ + return -EINVAL; } return dir; @@ -692,10 +712,20 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, return dir; if (dir == ACPI_CORESIGHT_LINK_MASTER) { - pdata->nr_outport++; + if (ptr->outport > pdata->nr_outport) + pdata->nr_outport = ptr->outport; ptr++; } else { - pdata->nr_inport++; + WARN_ON(pdata->nr_inport == ptr->child_port); + /* + * We do not track input port connections for a device. + * However we need the highest port number described, + * which can be recorded now and reuse this connection + * record for an output connection. Hence, do not move + * the ptr for input connections + */ + if (ptr->child_port > pdata->nr_inport) + pdata->nr_inport = ptr->child_port; } } @@ -704,8 +734,13 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, return rc; /* Copy the connection information to the final location */ - for (i = 0; i < pdata->nr_outport; i++) - pdata->conns[i] = conns[i]; + for (i = 0; conns + i < ptr; i++) { + int port = conns[i].outport; + + /* Duplicate output port */ + WARN_ON(pdata->conns[port].child_fwnode); + pdata->conns[port] = conns[i]; + } devm_kfree(&adev->dev, conns); return 0; diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 4f10cfa9dc18..f3efbb3b2b4d 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1053,6 +1053,9 @@ static int coresight_orphan_match(struct device *dev, void *data) for (i = 0; i < i_csdev->pdata->nr_outport; i++) { conn = &i_csdev->pdata->conns[i]; + /* Skip the port if FW doesn't describe it */ + if (!conn->child_fwnode) + continue; /* We have found at least one orphan connection */ if (conn->child_dev == NULL) { /* Does it match this newly added device? */ @@ -1091,6 +1094,8 @@ static int coresight_fixup_device_conns(struct coresight_device *csdev) for (i = 0; i < csdev->pdata->nr_outport; i++) { struct coresight_connection *conn = &csdev->pdata->conns[i]; + if (!conn->child_fwnode) + continue; conn->child_dev = coresight_find_csdev_by_fwnode(conn->child_fwnode); if (conn->child_dev) { @@ -1126,7 +1131,7 @@ static int coresight_remove_match(struct device *dev, void *data) for (i = 0; i < iterator->pdata->nr_outport; i++) { conn = &iterator->pdata->conns[i]; - if (conn->child_dev == NULL) + if (conn->child_dev == NULL || conn->child_fwnode == NULL) continue; if (csdev->dev.fwnode == conn->child_fwnode) { diff --git a/include/linux/coresight.h b/include/linux/coresight.h index ccd17304d7bd..e3e9f0e3a878 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -100,10 +100,12 @@ union coresight_dev_subtype { }; /** - * struct coresight_platform_data - data harvested from the DT specification - * @nr_inport: number of input ports for this component. - * @nr_outport: number of output ports for this component. - * @conns: Array of nr_outport connections from this component + * struct coresight_platform_data - data harvested from the firmware + * specification. + * + * @nr_inport: Number of elements for the input connections. + * @nr_outport: Number of elements for the output connections. + * @conns: Sparse array of nr_outport connections from this component. */ struct coresight_platform_data { int nr_inport; From patchwork Mon May 18 18:02:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556017 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 23089739 for ; Mon, 18 May 2020 18:06:27 +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 0142B2083E for ; Mon, 18 May 2020 18:06:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hFAV2XFz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZDZpYpJe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0142B2083E 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=EGdtPT1TwG+04leTrrdVQ9pSze2TvoMyWzw/JV3FAb8=; b=hFAV2XFzrPZ8HB mBpZXHYgzFCJtZVBsNBnDSEiLLAmKA4ZbxKUOSrOqZRh2nEiGjXblLzZbwTN6qG+iEk/FIwgzDZUD gQ9mXttb64zCtkdu3mKXbENYaZ5dOYvQ9Uohoyh4pFqXxrETDAl9LLa689RNwDWQNY8P/Paox2z8x E4vnmvwcSq6KrAJis/0Pf6oi2rQtNfl2f0v0sojHwBzryu6pDJFPRc0FRmcRxdFn6fblUwVeHU9K/ 42OVLOtgELTC2+kYQPq79INcIOUqqvyQ/InXbFxgQJbWGwW0AdBMeYJf5sxQr/mnymKWfZkSqBAtM 7aAvwzOi6gADTlI1oHsA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak9i-0008Qv-3c; Mon, 18 May 2020 18:06:26 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6L-0003OH-Q9 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:02:59 +0000 Received: by mail-pl1-x641.google.com with SMTP id s20so4543648plp.6 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=lRmSiRVSYRvReMhh28RP4/vZKd6NlyKhQZ7NuWIDNS0=; b=ZDZpYpJeo6pTMJg73otjIXxupf4NOxLc3eJbCmx5qhl17gRTAOHA6aJ1NatGhw1XN8 Zh5oRPtWLl3j/WpcZsGQUUQ/Nm56HpBhlyGXYz0PyVN9//u627UGxHe/LPgnc0pgaTgx t6tJRiBmIaVhyp+GsBqA+quAQZdcIs+eBdt23AzfSf7gXZbt7LEOrNRSzYS+3BXadUVl iwyY5jEf/CF6GbBGCTo4G/Begw7x+h6sa262NqlhwazqY+OEPm0lXR6W+yWVT7QExWeW yR2L4fgtEizaXkoFJQhKWv3AhoevDpML/oES1udTfVhTgbWxxCsRYd4rN0ufENBNkJtE 61cA== 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:mime-version:content-transfer-encoding; bh=lRmSiRVSYRvReMhh28RP4/vZKd6NlyKhQZ7NuWIDNS0=; b=T+t1EpqekoE6MIg9J/4NkKbYisQgAqVedQDMviBQ4gS67kq9VVi4UlUwRk8T86teWu AS/sN4siBBXy89SxaQiFwGMKSoE9sxhEevh4EMXkn17bqpll0qwRbjwdvYDoCSuNzvb7 zt+OZ474eD7ukDP1Efup7nDn/qU1pJmX9dNvvWAiB5LxhOBo4U2h5VMOnBpSrEJrHf4r vqvhXG+31cd4xGp22UoH3zUip2Ops93hGRiraaG6+aiFAAsTiE5Aa0ESScx29/KIGinQ P31E9VkBQSatmKW8f6nZXvHjo9hD807oiLOlyhWQSkvd/hzaKB8WpV1BDVwXA2vZgbAE jNWQ== X-Gm-Message-State: AOAM5319WEep8c4/yL/90AfJpfunxGf/4iJRKLGsJR5uftA1lGAL1XPS haw4VnznO2D1xTXzBz1Lugjsbg== X-Google-Smtp-Source: ABdhPJzV0PKf6kavOpovJEq9IGfpUxMsogNOF8aZXYQTItbGtVG3wVut+/ZGTMJqzGcJjrpVTYkCNg== X-Received: by 2002:a17:90a:2306:: with SMTP id f6mr589090pje.231.1589824976798; Mon, 18 May 2020 11:02:56 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:56 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 13/23] coresight: tmc: Fix TMC mode read in tmc_read_prepare_etb() Date: Mon, 18 May 2020 12:02:32 -0600 Message-Id: <20200518180242.7916-14-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110257_939018_EBEF0B19 X-CRM114-Status: GOOD ( 13.95 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Sai Prakash Ranjan On some QCOM platforms like SC7180, SDM845 and SM8150, reading TMC mode register without proper coresight power management can lead to async exceptions like the one in the call trace below in tmc_read_prepare_etb(). This can happen if the user tries to read the TMC etf data via device node without setting up source and the sink first. Fix this by having a check for coresight sysfs mode before reading TMC mode management register. Kernel panic - not syncing: Asynchronous SError Interrupt CPU: 7 PID: 2605 Comm: hexdump Tainted: G S 5.4.30 #122 Call trace: dump_backtrace+0x0/0x188 show_stack+0x20/0x2c dump_stack+0xdc/0x144 panic+0x168/0x36c panic+0x0/0x36c arm64_serror_panic+0x78/0x84 do_serror+0x130/0x138 el1_error+0x84/0xf8 tmc_read_prepare_etb+0x88/0xb8 tmc_open+0x40/0xd8 misc_open+0x120/0x158 chrdev_open+0xb8/0x1a4 do_dentry_open+0x268/0x3a0 vfs_open+0x34/0x40 path_openat+0x39c/0xdf4 do_filp_open+0x90/0x10c do_sys_open+0x150/0x3e8 __arm64_compat_sys_openat+0x28/0x34 el0_svc_common+0xa8/0x160 el0_svc_compat_handler+0x2c/0x38 el0_svc_compat+0x8/0x10 Fixes: 4525412a5046 ("coresight: tmc: making prepare/unprepare functions generic") Reported-by: Stephen Boyd Suggested-by: Mathieu Poirier Signed-off-by: Sai Prakash Ranjan Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index d0cc3985b72a..36cce2bfb744 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -596,13 +596,6 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) goto out; } - /* There is no point in reading a TMC in HW FIFO mode */ - mode = readl_relaxed(drvdata->base + TMC_MODE); - if (mode != TMC_MODE_CIRCULAR_BUFFER) { - ret = -EINVAL; - goto out; - } - /* Don't interfere if operated from Perf */ if (drvdata->mode == CS_MODE_PERF) { ret = -EINVAL; @@ -616,8 +609,15 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata) } /* Disable the TMC if need be */ - if (drvdata->mode == CS_MODE_SYSFS) + if (drvdata->mode == CS_MODE_SYSFS) { + /* There is no point in reading a TMC in HW FIFO mode */ + mode = readl_relaxed(drvdata->base + TMC_MODE); + if (mode != TMC_MODE_CIRCULAR_BUFFER) { + ret = -EINVAL; + goto out; + } __tmc_etb_disable_hw(drvdata); + } drvdata->reading = true; out: From patchwork Mon May 18 18:02:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556025 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 A9021138A for ; Mon, 18 May 2020 18:08: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 876B720715 for ; Mon, 18 May 2020 18:08: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="Xdsyhw3d"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="v7rWz7ed" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 876B720715 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=0f0uzoz4cE5aStXKa9yFtQmtIWFLr4nby2SkGS0b8nc=; b=Xdsyhw3dLLXsN5 P7X7q3/A1W0Hy7JVgWfkByjQ69fFmjbWRdbg09PGbDl0ukjNQSRiWmOpyQ6CrHTd1+RgJgz5zSaFd W9Idpn4ht9Z122O611PqnznLTNd6zVLEtzGGxQ/rtlD20yHJYIIlVmNzNetnCXk5URGmKCykNVmrV wMCtDLuwU3m72AvzTD4dABhpGW6Ja602dxwteizdS9FVRR8owQgDluzg8xg//iF7eMJ0AmV6I7pd8 /ztZfYozBjFC9Cl5rUX8iKTJ06ZEk8BO9xvv0PKVAqh/RUr+4xKWPIyFRJLmijcYC4FDa10G+fW5v U/J5kdYYvTRzld8ISLog==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakBB-0001IQ-7M; Mon, 18 May 2020 18:07:57 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6N-0003PX-8H for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:01 +0000 Received: by mail-pj1-x1043.google.com with SMTP id l73so223771pjb.1 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=qI0hkZLl1p40lpmoqUP5FQkPLM/cVGruUyPdGcb4wIQ=; b=v7rWz7edbqHgcpapNTcdBkkA49gPIQn9qCOdOWX8oswt5q6lNAOVvsk1B8bRpUKMgR V4rLEToL+vznxN6V51xzvHyi5SPHiZ536ZXjjZoyZpAPKS9dcQ5Bh8uS/Zz7Bu9iFiGN viTvAVkzFbmABREoO94u8xSroYUz6TiRqc2M3l3yy3Fvh8cpViYns3W5Rx41tuOqXBek NzTUMh94cOHdFbYLrTUo86P60ddnETRFCJ+4E9i/9HKgo5c6ETsbX3Busz+cmB3vx00p MFldLgSi0CsnmHYpZgDjDdFF6PwCZ5S1dINmBFKM1YF0JZBCjzS4JSlJVbPCtdrgfJwM ocGg== 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:mime-version:content-transfer-encoding; bh=qI0hkZLl1p40lpmoqUP5FQkPLM/cVGruUyPdGcb4wIQ=; b=ny4K1EF3LhWAcQIlSzJsuUOeG2KisBpIy2mdCyMh8/Mcv9LMebEAL3y4BCWlonppTb G4wSXkaiHxbJnKjwPUUlTT717UlKV9lXatb4ydRE1bNvl5oSFljNs7LkTQeQtQafh0j1 dRU7P7MhqgWVcSc79Df1RKPLtdzYUqPmvlJ6ZW4Eq3lXD8cGlHrA0QKZJNk1OzzoX4m4 jaXWSnSKvqz2e+vt5pCJxd3FrYbifo9rI4BX9HefSBmPUgjJcb9iB8uJTqDdTSAI2ZcI YeHJVrcqbAdogNppuyLFJ0JJJxEaqLMUhzN4CvcQgzw+igQKHm23+n9Oo8iLewec88z4 MxsQ== X-Gm-Message-State: AOAM531E78eOP/srkrOv1GloJYFQnb1u9rBgEjHV0CKH3MgAemThDLWf xvVpIHcGFb5ecIJjn2x2rcM9+th40do= X-Google-Smtp-Source: ABdhPJwrsp4UxKFu/aIe6tugBNFzecrOXHzIRK2MK354U6zTOpapPG8A2PpDhYcYC5ub/H9BD/nkzg== X-Received: by 2002:a17:90a:c284:: with SMTP id f4mr680374pjt.68.1589824977944; Mon, 18 May 2020 11:02:57 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:57 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 14/23] coresight: etmv4: Update default filter and initialisation Date: Mon, 18 May 2020 12:02:33 -0600 Message-Id: <20200518180242.7916-15-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110259_358197_0A97BD86 X-CRM114-Status: GOOD ( 13.66 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:1043 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach Differing default states set on driver init / perf init and as a result of a sysfs reset. The ETMv4 can be programmed to trace the entire instruction address range without the need to use address comparator filter resources. (Described in the ETMv4.x technical reference manual) sysfs reset was using this method, perf and default driver init were setup with an address range comparator for the entire address range. The perf / driver init has been altered to use the method without needing any comparator address hardware. Minor adjustment to the vinst_ctrl register initialisation to ensure correct zero initialisation. Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- .../coresight/coresight-etm4x-sysfs.c | 2 +- drivers/hwtracing/coresight/coresight-etm4x.c | 23 +++++-------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index ce41482431f9..b673e738bc9a 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -205,7 +205,7 @@ static ssize_t reset_store(struct device *dev, * started state. ARM recommends start-stop logic is set before * each trace run. */ - config->vinst_ctrl |= BIT(0); + config->vinst_ctrl = BIT(0); if (drvdata->nr_addr_cmp == true) { config->mode |= ETM_MODE_VIEWINST_STARTSTOP; /* SSSTATUS, bit[9] */ diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 94c5f204998e..0b2c7c7efacb 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -791,7 +791,7 @@ static void etm4_set_default_config(struct etmv4_config *config) config->ts_ctrl = 0x0; /* TRCVICTLR::EVENT = 0x01, select the always on logic */ - config->vinst_ctrl |= BIT(0); + config->vinst_ctrl = BIT(0); } static u64 etm4_get_ns_access_type(struct etmv4_config *config) @@ -894,17 +894,8 @@ static void etm4_set_start_stop_filter(struct etmv4_config *config, static void etm4_set_default_filter(struct etmv4_config *config) { - u64 start, stop; - - /* - * Configure address range comparator '0' to encompass all - * possible addresses. - */ - start = 0x0; - stop = ~0x0; - - etm4_set_comparator_filter(config, start, stop, - ETM_DEFAULT_ADDR_COMP); + /* Trace everything 'default' filter achieved by no filtering */ + config->viiectlr = 0x0; /* * TRCVICTLR::SSSTATUS == 1, the start-stop logic is @@ -925,11 +916,9 @@ static void etm4_set_default(struct etmv4_config *config) /* * Make default initialisation trace everything * - * Select the "always true" resource selector on the - * "Enablign Event" line and configure address range comparator - * '0' to trace all the possible address range. From there - * configure the "include/exclude" engine to include address - * range comparator '0'. + * This is done by a minimum default config sufficient to enable + * full instruction trace - with a default filter for trace all + * achieved by having no filtering. */ etm4_set_default_config(config); etm4_set_default_filter(config); From patchwork Mon May 18 18:02:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556037 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 57C881391 for ; Mon, 18 May 2020 18:08:54 +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 32A2620853 for ; Mon, 18 May 2020 18:08: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="TpVejjVk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xsx8AoVs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32A2620853 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=NpE18QyS366DmXux1nj3bYxH5Em4xnz/8iMXBOgONA8=; b=TpVejjVkCFyfHp e6FJPlzSv4IdxlQVfwP2q89Dr+F65iQAI83bCMSlKN9k1U184eacxFnjWPbkQR5chsVuPNOAXjorj WBk6hE62zOk609iBUVH0K+2LYGt/O7xvgAtPB56tjPYacNixjD/IO8P5McDRWOcdM3zne2XjV5vMN t2NU0+TNwuQyNLcvTmJ5/6DZSC+96BUgi4xPy21hnQVMig5I1hrBgciLaHqzCKt2qfHbA663HLyoR BxKcTB6C49aUbc54HwKsr6WA7b7I9xYf8LpIWVQhS6b2xy5OD7uC6KpDGCd7d4pYHpxUCZ/F9Xh2V AyQf1yVaBZEnC9RXyLyw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakC0-00021x-D3; Mon, 18 May 2020 18:08:48 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6R-0003Pz-0A for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:04 +0000 Received: by mail-pl1-x643.google.com with SMTP id s20so4543694plp.6 for ; Mon, 18 May 2020 11:02: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 :mime-version:content-transfer-encoding; bh=FoVRWcy/XNi4B/r5P2FDvOZUmVOjksYJfgQMSWpzBRM=; b=xsx8AoVsLHOYJKfK/062oNs3Aao9eR/Fg/VHsKjUZ382yNan4FyFhoF/fJZzQ5JpEs wfpy2Z9kOJ+ghkpgOfM3GxC/vuwSWmlhtbydN1rOclFMHJS94t1g7A/CcWv68s6ZCTOT EKyfn74YvrUBk6PoeYRnZ+tqvKZgblvIAWWbewI6XlOy7k/DxCdzKCpxNVGBJHnIBciN etVj0pA+hm6T9Imdqvi3Wv2WLtcBN3U4Mz080NXAPUtcOeCdy2peD+wb6EcrKpw66EBV 0ahHDqO795Je8sUD2CBv0Ws78+kBMv8qz9bg22M3ZjPQHiXz++mwPPGU4qD9vaGWUuIY /0ag== 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:mime-version:content-transfer-encoding; bh=FoVRWcy/XNi4B/r5P2FDvOZUmVOjksYJfgQMSWpzBRM=; b=QDsZ3alqNTDE1k/mFsT2afJ8+QYn2hSokM33pwJ+1GrtFo/gTNFERxleC1pIDF73Av v0heMDyJ2+fY+XTfMLReDoUkd/9Y74RHsDLSio8Gcj6maYcFPgbOJvdvsqfO0PrUG8P9 gsqU2Ps42iWEVImiwQ+syvnAgSHwSQNmvIrCnVhoIN/vtDd8MNcBOaHjwGhHX3a7a437 vza61+LS3O65uK33sYirQ+zVwKX5CA2tCLcS4P65N405pQ3USHXr9xFiLbO8zUaEwM09 iLASbqTsKIU3ifh3BBNhTAOicuWkdqkOoSW8yaIq0mnYoSSA8xdzHnr0lrwGa+eCuUTu SSog== X-Gm-Message-State: AOAM531hgi9QZCHBqXWXAZTRX0Ka++GE6IpZqV971U12Zt2LOsLjyvib SBu7dlNlRmfmKxsl/3n/XJXyektXl0U= X-Google-Smtp-Source: ABdhPJz+dMzKPW2+sd77DhdV6OySI3saGSpbB+lE5thmPMr3NoyggeO75URGrYcnt776k7WLHOspNA== X-Received: by 2002:a17:90a:2009:: with SMTP id n9mr550946pjc.81.1589824978857; Mon, 18 May 2020 11:02:58 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:58 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 15/23] coresight: etm4x: Add support for Neoverse N1 ETM Date: Mon, 18 May 2020 12:02:34 -0600 Message-Id: <20200518180242.7916-16-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110303_054865_AA447545 X-CRM114-Status: GOOD ( 10.67 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Anurag Koul Add PID for Arm Neoverse N1 ETM to the list of supported/known ETMs. Signed-off-by: Anurag Koul Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 0b2c7c7efacb..7443a2e4528d 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1541,6 +1541,7 @@ static const struct amba_id etm4_ids[] = { 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(0x000bbd0c, uci_id_etm4),/* Neoverse N1 */ CS_AMBA_UCI_ID(0x000f0205, uci_id_etm4),/* Qualcomm Kryo */ CS_AMBA_UCI_ID(0x000f0211, uci_id_etm4),/* Qualcomm Kryo */ CS_AMBA_UCI_ID(0x000bb802, uci_id_etm4),/* Qualcomm Kryo 385 Cortex-A55 */ From patchwork Mon May 18 18:02:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556023 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 F41391391 for ; Mon, 18 May 2020 18:07:40 +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 C244720826 for ; Mon, 18 May 2020 18:07:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="a8tnxDB8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EokdUeKb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C244720826 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=/O6HtsU2LQAK3u/02z1GoSADTnFZsy/jmMewTFHl0dA=; b=a8tnxDB8BJCwPm u6cGOKc+XC9wLbWyHkpuevy/CDMi1NTvB/sNQYO87t7NZofdEzPPFjg/kceisOScjG52Mr7R48qk6 zeVhFSFzpNjU9fz4TsUyKBk0pjdjb/ZB1sNBHS8P9hR5FTGEVKdqejmcVWcXetLSPN5bCNmmqHO/l qg7qFbIiDjrZOPK1z7Nm1nZUmbgxT+TWb42oOinXETyo/fRgQHWx5V6YkCkF6zTB5BJT6oWld47H5 gPPqLO6npAzCeHHAE4wt9agDnwlpo0pTs+zD2AJs+1BQgi2yQuPytUTm0KUwREio6KEJYvLy1/yvb 9Ei7VM04MF0hje+g7xoQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakAq-00012i-Qx; Mon, 18 May 2020 18:07:36 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6O-0003Qp-Gx for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:02 +0000 Received: by mail-pj1-x1041.google.com with SMTP id 5so194161pjd.0 for ; Mon, 18 May 2020 11:03: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 :mime-version:content-transfer-encoding; bh=lx4SPVIy3wEGxKB9o9K9q2O6lTF76YzRNReGQVYCn8A=; b=EokdUeKb6RDPCGpUokxqPIb5waiOeBrFAvAxrJGV7Hy9vRGAT3P1D0RFTrill+mIC9 +1zQrIBDmVBr6EFoQeaypXh67SrwqRZkuPcDBeo+HDoR5Qf6O3JIpjDtPbgGv4u7WDpA p9M/vwoUxCT+Pcc3FB3CWGbawuKPPj6Fi5S0ncwUpTvmMyfC2Pba3p4frljOoknbOAA5 j/oa+pXTmTMT1PwIf8zg6snFoGcK4JW7Hz0F19Ddzzwi5aYI10akOgmnc/J3RVi/uMRe uZbqFMcbt2xBXQAFaiYySrs0d4fD8YjV+RhxeSSat+8RRHA+bCrmMWNw1Dhxs5Igh1HR 4vfA== 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:mime-version:content-transfer-encoding; bh=lx4SPVIy3wEGxKB9o9K9q2O6lTF76YzRNReGQVYCn8A=; b=htoZP3RcC0Su1BVL5fLq31jQMWrCScSAgCTUjew6SLWVhwSvHA7KpJgZtvvCNPmtly YuF0RZ+l9ndz+PzckBbi8jW8UczP8US6gVRk7WaeolrGiWzTpklHmPzhdJFwuKeOVXFS 2cYN4xha4U3797Pb9HWB6q6qoITc7BoQV6YKEx/plqVupaGPRV/yB6YpEGP3iUYz59/d 8Y8ohv83MUxtg/yDa6EAMRW868KeAIiFSQbQ+DmBfSPOh4Sk9B7tsbl7cAmki3cmxRa1 sNRBkOHcSn4Ryo6fdnqreTwEedc0j9LlZvnS4YL2hoO6lkeRoxL1VXeYv+P2jFnhHhFC bmxA== X-Gm-Message-State: AOAM531f7z/l7CfgtjHNlrRmaPyFf4jq6ZXtm1d1un4f1xwbJi6Lkeki SXUZdhEPbwbM0lmYQ8IxIdflpw== X-Google-Smtp-Source: ABdhPJwoo6GbVktcGMX6mkZaVjtn3E9jkVEs9EFqgQ2IM42msr3Z9V9JW1qWmtaYYYBzuS6FEbSJGA== X-Received: by 2002:a17:902:988a:: with SMTP id s10mr16744100plp.204.1589824979789; Mon, 18 May 2020 11:02:59 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:02:59 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 16/23] coresight: Mark some functions static Date: Mon, 18 May 2020 12:02:35 -0600 Message-Id: <20200518180242.7916-17-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110300_672830_2CAF1075 X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:1041 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Stephen Boyd These functions aren't used outside the file they're in. Mark them static to indicate as such and silence tools like sparse. Cc: Suzuki K Poulose Cc: Mike Leach Signed-off-by: Stephen Boyd [Dropped changes in coresight-cti.c and coresight-etb10.c] Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti-platform.c | 3 +-- drivers/hwtracing/coresight/coresight-cti-sysfs.c | 2 +- drivers/hwtracing/coresight/coresight-platform.c | 4 ++-- drivers/hwtracing/coresight/coresight-tmc.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c index b44d83142b62..c6c0c9b4827e 100644 --- a/drivers/hwtracing/coresight/coresight-cti-platform.c +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c @@ -429,8 +429,7 @@ static int cti_plat_create_impdef_connections(struct device *dev, } /* get the hardware configuration & connection data. */ -int cti_plat_get_hw_data(struct device *dev, - struct cti_drvdata *drvdata) +static int cti_plat_get_hw_data(struct device *dev, struct cti_drvdata *drvdata) { int rc = 0; struct cti_device *cti_dev = &drvdata->ctidev; diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c index 1f8fb7c15e80..a095db03d2bc 100644 --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c @@ -1139,7 +1139,7 @@ static int cti_create_con_attr_set(struct device *dev, int con_idx, } /* create the array of group pointers for the CTI sysfs groups */ -int cti_create_cons_groups(struct device *dev, struct cti_device *ctidev) +static int cti_create_cons_groups(struct device *dev, struct cti_device *ctidev) { int nr_groups; diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index d58dcd0ab514..e4912abda3aa 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -511,7 +511,7 @@ static inline bool acpi_validate_dsd_graph(const union acpi_object *graph) } /* acpi_get_dsd_graph - Find the _DSD Graph property for the given device. */ -const union acpi_object * +static const union acpi_object * acpi_get_dsd_graph(struct acpi_device *adev) { int i; @@ -574,7 +574,7 @@ acpi_validate_coresight_graph(const union acpi_object *cs_graph) * Returns the pointer to the CoreSight Graph Package when found. Otherwise * returns NULL. */ -const union acpi_object * +static const union acpi_object * acpi_get_coresight_graph(struct acpi_device *adev) { const union acpi_object *graph_list, *graph; diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 1cf82fa58289..39fba1d16e6e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -361,7 +361,7 @@ static const struct attribute_group coresight_tmc_mgmt_group = { .name = "mgmt", }; -const struct attribute_group *coresight_tmc_groups[] = { +static const struct attribute_group *coresight_tmc_groups[] = { &coresight_tmc_group, &coresight_tmc_mgmt_group, NULL, From patchwork Mon May 18 18:02:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556035 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 AB7A61391 for ; Mon, 18 May 2020 18:08:39 +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 7664C2083E for ; Mon, 18 May 2020 18:08:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KN7cu44P"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eDW9yGFr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7664C2083E 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=YveaISje1MZAgA3PFJ//w0gWW6X2nnpF4plXLwA1Z2o=; b=KN7cu44PGG4Q9U Z//QApsdPiw/UJMJAq01DvBemb8RiwdTYNmtPt6T+asWnKCizZCvflL6c8PlxpqR4VBMtvUpZGE1V y9FCg44gd+EDkXK34fjV9OLHarEQA3U+ONtrhvz4W1kubMHwCm5rfEwKG3O7ys6fLkqlqMSFZRC8b zKuogYjAJPKEXuxAE1+ZCwfTXPXiZqKmi5kmQUwIpjgtpyE/xc92zNQQaKkNgp/o6gOKO0ucksY4o Qw2ykJphGINsR4q32r6ypjeCCGdvlWQh6h1NzuZpiP2AxDgQmcOEbz3XOFxsiSTIcldj/1UMQEo/q ir3DgS5T7QcSThRwBbAQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakBo-0001qp-5t; Mon, 18 May 2020 18:08:36 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6P-0003Rf-7w for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:02 +0000 Received: by mail-pl1-x641.google.com with SMTP id u22so4529411plq.12 for ; Mon, 18 May 2020 11:03:01 -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 :mime-version:content-transfer-encoding; bh=mLFkeFv5HWGKptJ0s4V6OJj0VEk0WD3tjVOmDK300SM=; b=eDW9yGFrhHY4198g/3hhoOz+a/sYeJvLXzPJOiUD26CyVyH3wB3AOxsIM5QYvG7QEE LOWhoLqm3hrnEhz2ylxvDQ3VWbdmm/g7rv2nC1Plg6fsq9SL3InsZy2vRdhFupoYo57s ZvsdFfJcKmyf5mOMK/wLMInA60Yd4tbK6hQ6zmwPHds+yI5++0wXqhBbNH+T8d2PtEm2 mhnxSc0m+sjWNNUh8pBHYNnVxPBEK2a6OfKTDCD51OM8XlzwWIedqXepNDyefdDPIKQE UOwovpEhHGARLuJKCwHQbJwW0OsvQj3HXzQ20dtdRpzmbX2OuXFmRVRQEu6n23deNOBT pGZQ== 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:mime-version:content-transfer-encoding; bh=mLFkeFv5HWGKptJ0s4V6OJj0VEk0WD3tjVOmDK300SM=; b=gYIJm4EEdqqYI22ReympMDGF1C9EDDfAP7LluT1LUKrg6vG2XrranNPNgNyeCL2rCg ekPYlS2i8RXempJUgdcI6d39x/7rSPQmfHg57rj6Eikov7fm+H4q9KUiUlPFtj5gxxf6 0iQyGjIHzBWXzg+yhuMqXcb3Ttto/XrY7qEd5OjZi9ky9S6IoYEYCUGv3TSbJHvDEDQ1 dhVNJB9O0Lpi1tIh2HhcSK1BWUQygc5iAHS77g04M1ZLMrL+i9KqvyPlXB8+xsE8ie3K FSkjRFvUWGZ8PBo/CfuFN1JcXg4/tq8R21FpibzOUeFEv8D47lVbIPe5uTda9oCcJx/f L9Fw== X-Gm-Message-State: AOAM530HOSgB5Alix9ewKd3d4m3KKtqtvzbLjejbHC9ntq287qKe5Q4f qUh5haH0cA43A+xDgbpxXPVTfIh12w8= X-Google-Smtp-Source: ABdhPJxyhKMdyxNcOviUJfI2E/9h9DHTBdz7Y+r0lx75bOQbaxOfvyt/E0KChUzDc+T6kSKusUwUjg== X-Received: by 2002:a17:90a:7046:: with SMTP id f64mr534460pjk.205.1589824980575; Mon, 18 May 2020 11:03:00 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:03:00 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 17/23] coresight: Don't initialize variables unnecessarily Date: Mon, 18 May 2020 12:02:36 -0600 Message-Id: <20200518180242.7916-18-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110301_340831_94987E28 X-CRM114-Status: GOOD ( 11.89 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Stephen Boyd These variables are assigned again before they're used. Leave them unassigned at first so that the compiler can detect problems in the future with use before initialization. Cc: Suzuki K Poulose Cc: Mike Leach Signed-off-by: Stephen Boyd Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti-sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c index a095db03d2bc..aeea39cbd161 100644 --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c @@ -1036,8 +1036,8 @@ static int cti_create_con_sysfs_attr(struct device *dev, enum cti_conn_attr_type attr_type, int attr_idx) { - struct dev_ext_attribute *eattr = 0; - char *name = 0; + struct dev_ext_attribute *eattr; + char *name; eattr = devm_kzalloc(dev, sizeof(struct dev_ext_attribute), GFP_KERNEL); @@ -1156,8 +1156,8 @@ static int cti_create_cons_groups(struct device *dev, struct cti_device *ctidev) int cti_create_cons_sysfs(struct device *dev, struct cti_drvdata *drvdata) { struct cti_device *ctidev = &drvdata->ctidev; - int err = 0, con_idx = 0, i; - struct cti_trig_con *tc = NULL; + int err, con_idx = 0, i; + struct cti_trig_con *tc; err = cti_create_cons_groups(dev, ctidev); if (err) From patchwork Mon May 18 18:02:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556029 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 BC71C138A for ; Mon, 18 May 2020 18:08:25 +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 840F320671 for ; Mon, 18 May 2020 18:08:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MJbPhIQC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mJVRlvy7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 840F320671 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=+CgCDAe4+KeCxYSFxWDlA/BzO4RiNm01esmjJ0V0Dd0=; b=MJbPhIQC4+ygZ5 eKwwgy1FGMBbbDRZjJ6gqtCWmdsJBW7SnxCJwvhhwKezRpOB9lMkaD+/Pb+li/EKdlj4S4rbLNtre TFgZ5b3j8AcYl6g2RtxzAOhSfYQNKrLjWFeiFNIK5TZeUekszarT/MYt81qKnBH1UsOAiled5i+wY /y0Q6rejNlQuqqfblahAebhQKHwNo2FDKalZQTiMu1qDb3eLivLuQrG6QEMqbeN1vXb372MIx2nDy gtl157XIIuedAQ9WMPkdE3xAr9fIQDAhK+/SXXF9yLmsCHd7gLm2W1qUvzChBZwzTJR8KguXFRa+/ 2XhMAri6EjvYBDdiacRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakBU-0001Zc-Iu; Mon, 18 May 2020 18:08:16 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6Q-0003Sq-1X for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:03 +0000 Received: by mail-pl1-x641.google.com with SMTP id w19so2755415ply.11 for ; Mon, 18 May 2020 11:03:02 -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 :mime-version:content-transfer-encoding; bh=i3BWbBbkg8NyB0iXqBE55doZtUFR+gfZIquhH1ktDhE=; b=mJVRlvy7q0XT2dVo/1a6jMGnINkp6g4sFkzUJOFtT50IVmfcZKW5oWXVbz++zyWA7l iTzlDGkoR2WNvz/CkdFnIj2IeWA4X5NUSQJ45f7qI9TrqKHHkn4zuIIDUv5hhbl7TY6K j3ez8fMHe+og4a/xjLIFscra4qqsOv/fhuWvuCDZwQcnHb7WAzwd4vnpjf9h3QgOukrA ywRPjUNy1IsFOsG5SmvttHC+FTmiyCJjGuxuV1IodTdx36N+9dJaahYxB/utrL6sIQcZ 5gZ8ihpywXHd8Y/AdqGbyfINNUv+j4XRqtgkM+vGW8eztJ6Y9BF6kQxcyUAWTBnKf0hf XkIw== 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:mime-version:content-transfer-encoding; bh=i3BWbBbkg8NyB0iXqBE55doZtUFR+gfZIquhH1ktDhE=; b=O428d+YP0QfUlwLEekFf8iHPEz9yZeDHFgX1JUi7VN/hCqzgQy3vqq4WMR1Gcz/T1/ G2/MqsXlGllmUE/CMr6hOArcI+f/7iDa0CPFYMrfEwc+341M5qhRUmOA018p2lfJEAX1 0X8o8ITxhqXv+OtPef2rjub57RtqzaOFNUYm43vlS52eZr68Xp+gY4ygAwT0wvIxZr5p 35vryuaDGQ2ekUqQuHSpgLxvteEhuBDTcPhFoXxShwxiUW84hPqKKOnbwh53v6/jnLCP NSEuGfl47sO9ST+NAkwvubG0COWtVr3egIwsLrXrcaahmJ8GoUD+o4l8DhavBawgpPW0 MSYg== X-Gm-Message-State: AOAM532uosgPieZ/YazK3sXjsth9sTguEDgVNvBT82BZQ930L7wSZV2G 3W2axEAhPoGbDgufoZ4NFiXrZv8XX9I= X-Google-Smtp-Source: ABdhPJzDfkWuMuQZ2I+6W737DmcL/mZXIXXcL8EeXC/Q5GDTg1ytGpB/3Y75vPa+GYE+2r5mnKLk0A== X-Received: by 2002:a17:90a:268f:: with SMTP id m15mr685647pje.190.1589824981460; Mon, 18 May 2020 11:03:01 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:03:00 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 18/23] coresight: Initialize arg in sparse friendly way Date: Mon, 18 May 2020 12:02:37 -0600 Message-Id: <20200518180242.7916-19-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110302_093864_FCFD3F62 X-CRM114-Status: GOOD ( 12.38 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Stephen Boyd Sparse gets annoyed when this initializer is 0 but the first struct member is a pointer. Just use { } to initialize instead so that sparse is quiet. Cc: Suzuki K Poulose Cc: Mike Leach Signed-off-by: Stephen Boyd Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm3x.c | 2 +- drivers/hwtracing/coresight/coresight-etm4x.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index e2cb6873c3f2..bf22dcfd3327 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -504,7 +504,7 @@ static int etm_enable_perf(struct coresight_device *csdev, static int etm_enable_sysfs(struct coresight_device *csdev) { struct etm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); - struct etm_enable_arg arg = { 0 }; + struct etm_enable_arg arg = { }; int ret; spin_lock(&drvdata->spinlock); diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 7443a2e4528d..fb0f5f4f3a91 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -412,7 +412,7 @@ static int etm4_enable_perf(struct coresight_device *csdev, static int etm4_enable_sysfs(struct coresight_device *csdev) { struct etmv4_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); - struct etm4_enable_arg arg = { 0 }; + struct etm4_enable_arg arg = { }; int ret; spin_lock(&drvdata->spinlock); From patchwork Mon May 18 18:02:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556041 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 41F181391 for ; Mon, 18 May 2020 18:09:23 +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 1BE3820715 for ; Mon, 18 May 2020 18:09:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kn62qui9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UWiaQNZg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BE3820715 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=1cTR7FzVkp8RVPn+uqwPpr6sMpXSzglxkvZp9+Yj4JA=; b=kn62qui9TLSinf Dv/hZV8ji9Gbi+lrhN8fvI2vj/sA9g9XePoTVAMJOahFEqB7/H8dC3Sp1Ecw3qy2QgWnVZCfm18lO C/CMd8zx5t8NAZSwiLoRcB0poQNDgzpc2r2/OJU3PuHMdwrPSCZGqggS2aAxXUbv79u/WYHVUfHph SjlYfJ764O7nPRDe+QSfi77m9rjKO38S5/FmFtR7O35L40IGIYm9C1fTTXs5X4UOnuTXu6n9HzrY/ vbOAJ+5pdSagCSsQvTAjXzaY2eV3P8qNtnTJmHMKUyOPSUZM9TDouDatkm5PERHa+UgEVpLJwRlWm 0Q03CymowZlXwvg886wg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakCR-0002Y1-4G; Mon, 18 May 2020 18:09:15 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6R-0003Tr-Fp for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:05 +0000 Received: by mail-pl1-x636.google.com with SMTP id a13so2992644pls.8 for ; Mon, 18 May 2020 11:03:02 -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 :mime-version:content-transfer-encoding; bh=frOK4OZDYhbgzHRdQmb2gRizrXDsUQpDoZuLWDJWtp4=; b=UWiaQNZgB0xYbQXioPaR6Njc3Lx8ppjNgiEvvjsOcLyXCy8sH+c+1MhEW5fSflvGTv nr/kHdFTUx9HiYUj8eWPNSYYNpGPbdHf9I2s3WfI1NhNB2/EB0uQZbegnwpcudldktWH 7qw7sGadxZ/+wUfGacwqfWu99FQLnvbV62dwr4tBG+Th/rlOcut4xiz1r7OoZyTAaHSL cAzQliOfTUKDpMDET2xPclq95oOfVdofrrGyUAmhfJQc1BrTPGLqvXzpIjDJnhYX7HRK EBWnaAhmAUvLj5YJ5QF5eLhYiQRwuS8vyqJmJoW7rIjC1ZnA0SQfRUjmHEq7ZZTqting cXyQ== 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:mime-version:content-transfer-encoding; bh=frOK4OZDYhbgzHRdQmb2gRizrXDsUQpDoZuLWDJWtp4=; b=W2MaMgOHJ4fpnikyE8MkowIWcRkzB60wHDViyRvCo+letOVjhnM/oBYGMWYKz148SQ lgxPeNlbJF5QqCWDILxIGD1l06+8St0P3RPVYzSh/pM8n9ta5mwJQuxrXnaZGlfI5n0H ulVQoOZ8j4aqY0RYxrjwD9MIWzup6K4nxqh23xrbdObk459KyFGgHSIWEe8Glp6MDVX1 2zYahPdm2bHbMEXA1fi5RoMn+EDzGh7uWOAsV1TIv07fql2wvSJaXydtb0IboHFT1Iuf 0hlJjC5O4RC1AKkKJebuVJaDgjtoyAOGAZx8igZk/TayOMgThMbZfW0SD07eAUQjW3sm VLxQ== X-Gm-Message-State: AOAM530HPl3PbxoPbo/rbfJbyHF6atPsz1/tQOqtVJBLt1FFdVFIRmfQ eeXMw6DIEp2d3skkv2v5LNdFkQ== X-Google-Smtp-Source: ABdhPJxkYwWR9jeiOA5WL3hNF6RXRP/I47uBCD/qn9sPl6MufOqWoFuFXSYb7KhIKd8zrp/W5DpBbg== X-Received: by 2002:a17:90a:f493:: with SMTP id bx19mr565656pjb.45.1589824982250; Mon, 18 May 2020 11:03:02 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.03.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:03:01 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 19/23] coresight: Include required headers in C files Date: Mon, 18 May 2020 12:02:38 -0600 Message-Id: <20200518180242.7916-20-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110303_549321_F9CFE165 X-CRM114-Status: GOOD ( 10.73 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:636 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Stephen Boyd We should include headers that C files use in the C files that use them and avoid relying on implicit includes as much as possible. This helps avoid compiler errors in the future about missing declarations when header files change includes in the future. Cc: Douglas Anderson Cc: Suzuki K Poulose Cc: Mike Leach Signed-off-by: Stephen Boyd Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-cti-platform.c | 8 +++++++- drivers/hwtracing/coresight/coresight-cti-sysfs.c | 6 ++++++ drivers/hwtracing/coresight/coresight-cti.c | 13 +++++++++++++ drivers/hwtracing/coresight/coresight-cti.h | 8 +++++++- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers/hwtracing/coresight/coresight-cti-platform.c index c6c0c9b4827e..ab3bd4ed0910 100644 --- a/drivers/hwtracing/coresight/coresight-cti-platform.c +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c @@ -2,11 +2,17 @@ /* * Copyright (c) 2019, The Linaro Limited. All rights reserved. */ +#include +#include +#include +#include +#include +#include #include -#include #include "coresight-cti.h" +#include "coresight-priv.h" /* Number of CTI signals in the v8 architecturally defined connection */ #define NR_V8PE_IN_SIGS 2 diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c index aeea39cbd161..392757f3a019 100644 --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c @@ -4,7 +4,13 @@ * Author: Mike Leach */ +#include #include +#include +#include +#include +#include +#include #include "coresight-cti.h" diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 7fc1fc8d7738..be61c1705916 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -4,7 +4,20 @@ * Author: Mike Leach */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include + +#include "coresight-priv.h" #include "coresight-cti.h" /** diff --git a/drivers/hwtracing/coresight/coresight-cti.h b/drivers/hwtracing/coresight/coresight-cti.h index 004df3ab9dd0..acf7b545e6b9 100644 --- a/drivers/hwtracing/coresight/coresight-cti.h +++ b/drivers/hwtracing/coresight/coresight-cti.h @@ -7,8 +7,14 @@ #ifndef _CORESIGHT_CORESIGHT_CTI_H #define _CORESIGHT_CORESIGHT_CTI_H -#include +#include +#include +#include +#include #include +#include +#include + #include "coresight-priv.h" /* From patchwork Mon May 18 18:02:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556039 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 EDC54138A for ; Mon, 18 May 2020 18:09:07 +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 CBFE4214D8 for ; Mon, 18 May 2020 18:09:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VWgobxcj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qzdi+mr+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBFE4214D8 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=MBKwxSChXywGXxBP0056IYdr0E2mtF5ckRdJKZL1OVY=; b=VWgobxcjcWI20X k7VmZPcv173SOPH+6i9d9CWTza5xkmTyxwpp3/g1SAuybR5UacAf+HLgMo0MMskdp57+fe0FOYpOr sChKrLo2Aq4018i7iaZA29PMwtq/1qzrEQQzyujkEP9f2CY7CBP8AoyGQfjEobf7NgG5OQDxHO0Cn cTvoPz+cpMHIa3TsOvLya4A7Q810Sge1CQ2O4W1kvZHe3d/78nNCV7r+tX8aeylYRleMPEckSfmlf owccf8xkSqm0pax3cIB8Lwt4rAf+4teZd1hY5uIDEJeX1p8wH17ibGA4uosOh08BKVeM75lBGeHC1 +A1+NQloGbdIF3s/uvmQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakCF-0002HS-Ob; Mon, 18 May 2020 18:09:03 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6S-0003V4-JA for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:06 +0000 Received: by mail-pg1-x542.google.com with SMTP id c75so4188655pga.3 for ; Mon, 18 May 2020 11:03:03 -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 :mime-version:content-transfer-encoding; bh=VJzKeuOL4L44SAKgZAVu7We4ziBefHgIGw4RLcFAeqs=; b=qzdi+mr+BLEG277mq3T/hcFb94iM8qHrSK6DaOlVm7otw5kzS3whc/RTKZLmM2BR+Q RSRspgHlLglF+lgugRgYyYNU/F6TGjQ5F8Zx6SrLiOXPn9sWgfUCRZ66vz63oDddBcAA yvSeQ9qu+wSbVRc2OrRm/O2ji/M8nj2ObEzx7lFaRQtEyT42AAKTZbCL0+8LX9gUYMPX IaBG62tXnn3oHKwJuKLQqatxWc41sD0ihBYXGvB9phLkKppPa/Za99N7qpu7NWE1WLpB cjEbXDZD/JAXAIe4hjnQ0IMDCIbgjK+dQXWuEUzUhQ6EymIQqGhyyDgMYO2kBat+VNJZ guUA== 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:mime-version:content-transfer-encoding; bh=VJzKeuOL4L44SAKgZAVu7We4ziBefHgIGw4RLcFAeqs=; b=QE437IjoStK1o/P9VgrK/WWeAMiX3rEJIiSO18s89ml1op92mH7F/YgSVt82/n96zQ VMfE6la7dxyjfdtXTWeS2TvSQQtDIqrKJTUhJtOUZa4O+bMEv8LAN3afcVBQUIpEsgau 4D1dwy5XLmO8RexY1VSpwU4Mh/Z9wlN44D/njnz2CwaJbyjCsZit1Qi/Blxgbci9J9WX aH7ncTUO0k4Pu/TZ+XJm/V9DUq7hP5eFDrywNGus/DMWrN9KphkGVCh17071bo7yBPEC 5ml4J0WCMgtQlVkssJHo2hmMXGSPQcf61jo0QmP86ZK+V0Zh/w25Q7V/9Q6vTvdCf0NT Coag== X-Gm-Message-State: AOAM532FoVnToE7rHcyP0XOaqko/MJcI7V8KpV+G+j5WUuqdyIpN+5o0 d/RC7vQUtg9HXSsBNcMXO61GTg== X-Google-Smtp-Source: ABdhPJxMqvVGypwJS+T9Nkn805ByRR2dWc4T1KXeIHWy01otChpcbgNSQa4LBXXTZuF7x/+hGLtx4w== X-Received: by 2002:a62:e91a:: with SMTP id j26mr17958244pfh.61.1589824983256; Mon, 18 May 2020 11:03:03 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.03.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:03:02 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 20/23] coresight: Avoid casting void pointers Date: Mon, 18 May 2020 12:02:39 -0600 Message-Id: <20200518180242.7916-21-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110304_636803_D10EB99A X-CRM114-Status: GOOD ( 11.84 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Stephen Boyd We don't need to cast void pointers, such as the amba_id data. Assign to a local variable to make the code prettier and also return NULL instead of 0 to make sparse happy. Cc: Suzuki K Poulose Cc: Mike Leach Reviewed-by: Joe Perches Signed-off-by: Stephen Boyd Reviewed-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-priv.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 5a36f0f50899..36c943ae94d5 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -215,9 +215,12 @@ cti_remove_assoc_from_csdev(struct coresight_device *csdev) {} /* extract the data value from a UCI structure given amba_id pointer. */ static inline void *coresight_get_uci_data(const struct amba_id *id) { - if (id->data) - return ((struct amba_cs_uci_id *)(id->data))->data; - return 0; + struct amba_cs_uci_id *uci_id = id->data; + + if (!uci_id) + return NULL; + + return uci_id->data; } void coresight_release_platform_data(struct coresight_device *csdev, From patchwork Mon May 18 18:02:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556045 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 3FBCD138A for ; Mon, 18 May 2020 18:09: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 1B77C207D3 for ; Mon, 18 May 2020 18:09: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="YEwfQKQC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SEJJxAMz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B77C207D3 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=C4cnZkdbv0xBcQrWH8g/J6r8fFE9QXpaeZaRpRx402Y=; b=YEwfQKQCWPrmjw kGZQI6b1BXP31yDlYhBuoObwS8CdyX3fQPilNKrNtzF+5NNuTFVgB0+E/h6RoRcu2xXnRf4RqYqBG 1X9t9DS6aKM6GvJmlCBJWlAJzybrPELfNFPnFSyIeroM8w1iHaJSXQQcqe3RMzYqh+d8BXgTynlKI MWpg4iSqwMOam0hKyyVnBnTcxMLICkJdRFIDig6ViRlx7oIJM6oPa6XKi9rI/CS5PGawCw8eO2Zz3 mEPDQecCK6mDKj4yUKYE8UxTLI43qDorGM1m4sQdjkenGnRMjoAU1LfaBnMc9nPCyQUKyDz3E/GdI S244wi/E+zB38MmXfUog==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakCe-0002o3-FJ; Mon, 18 May 2020 18:09:28 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6T-0003Vz-E9 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:07 +0000 Received: by mail-pl1-x642.google.com with SMTP id k19so4534206pll.9 for ; Mon, 18 May 2020 11:03:05 -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 :mime-version:content-transfer-encoding; bh=HaLIE01l00hWoIXZtVguX/ou+2+ENTVPVwBzESc1vbA=; b=SEJJxAMzr8CzW+Zh0rEoRRWoKYrYIvwibnpKI1ZUfK56e3bZOhCqLvzIC8Zslb2Hd3 LOero3rx5jB37CWsFrReg8t5NaIL7MLFUEb32xHWcp0fWD/S9oevzn3BaKph5WblX2ny jBSsVRuevdayqz5vXCdK5bMUJ3mWb9lOoHYwf4FhZmyfeL2EHKGt+6Twr11vEOjE8wh+ ZLCttBmzmPChUG8oVXagvFLiV5pxp5oJsBB7MViKgBaJTWbxRSZEym9u/8aHgCyjptk6 jsUIl/W2VLEZcFAsUVjor2YzQsO7cYYvoR6nUiA/lS4yD/q/bhdr+vnhvwKfITIkLlt/ AHhA== 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:mime-version:content-transfer-encoding; bh=HaLIE01l00hWoIXZtVguX/ou+2+ENTVPVwBzESc1vbA=; b=XCMeLfSTYMeFEms07lBfAQ24dO1s793sldciJFOuVVa1I48ShNxjwsI4gBsR7XEvSZ Nxl8kAVnWTcCTqYk+gW0Rzk9hdVOoB9FQm10hYlKrQojsE7z1UHImQ+3t9TEArkdwXCv h9x8M6QNzNuiU6wp95GVEHjW6WVJBum4harh9eDdtsWRv9Mio3Tf/Sz8/QydE4JwVDZm 8/InLRF6w6HxU0Y+Q18low3/+CcDfT3i+CzSebCIXfRSiq/X8rD63wE8xTbHLvtnlaVR 2rZPjxLidl2HGo++DrF8r+shtJU/VnabRb7L25YwZcEtydr09nxRfNw5Fn19PqHb8KaG CIcA== X-Gm-Message-State: AOAM530xqss5pG5dFHeNtZB0ITnliZ7VfWyCaoz0CIlFR01lw3tfE+VQ ZB0glWwT24g+07hGvGy52FUWU0+bJPU= X-Google-Smtp-Source: ABdhPJw/OFz2/1zN427pY+gekNC89H4JtZRo1SWQgm2et1Lsam3qS68YEbQrigdODkHYyAWu2sPnOg== X-Received: by 2002:a17:90b:798:: with SMTP id l24mr644146pjz.208.1589824984247; Mon, 18 May 2020 11:03:04 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:03:03 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 21/23] coresight: etm4x: Fix use-after-free of per-cpu etm drvdata Date: Mon, 18 May 2020 12:02:40 -0600 Message-Id: <20200518180242.7916-22-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110305_574282_F6D1E9CC X-CRM114-Status: GOOD ( 11.47 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Suzuki K Poulose etm probe could be deferred due to the dependency in the trace path chain and may be retried. We need to clear the per-cpu etmdrvdata entry for the etm in case of a failure to avoid use-after-free cases as reported below: KASAN use-after-free bug in etm4_cpu_pm_notify(): [ 8.574566] coresight etm0: CPU0: ETM v4.2 initialized [ 8.581920] BUG: KASAN: use-after-free in etm4_cpu_pm_notify+0x580/0x2024 [ 8.581925] Read of size 8 at addr ffffff813304f8c8 by task swapper/3/0 [ 8.581927] [ 8.581934] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G S W 5.4.28 #314 [ 8.587775] coresight etm1: CPU1: ETM v4.2 initialized [ 8.594195] Call trace: [ 8.594205] dump_backtrace+0x0/0x188 [ 8.594209] show_stack+0x20/0x2c [ 8.594216] dump_stack+0xdc/0x144 [ 8.594227] print_address_description+0x3c/0x494 [ 8.594232] __kasan_report+0x144/0x168 [ 8.601598] coresight etm2: CPU2: ETM v4.2 initialized [ 8.602563] kasan_report+0x10/0x18 [ 8.602568] check_memory_region+0x1a4/0x1b4 [ 8.602572] __kasan_check_read+0x18/0x24 [ 8.602577] etm4_cpu_pm_notify+0x580/0x2024 [ 8.665945] notifier_call_chain+0x5c/0x90 [ 8.670166] __atomic_notifier_call_chain+0x90/0xf8 [ 8.675182] cpu_pm_notify+0x40/0x6c [ 8.678858] cpu_pm_enter+0x38/0x80 [ 8.682451] psci_enter_idle_state+0x34/0x70 [ 8.686844] cpuidle_enter_state+0xb8/0x20c [ 8.691143] cpuidle_enter+0x38/0x4c [ 8.694820] call_cpuidle+0x3c/0x68 [ 8.698408] do_idle+0x1a0/0x280 [ 8.701729] cpu_startup_entry+0x24/0x28 [ 8.705768] secondary_start_kernel+0x15c/0x170 [ 8.710423] [ 8.711972] Allocated by task 242: [ 8.715473] __kasan_kmalloc+0xf0/0x1ac [ 8.719426] kasan_slab_alloc+0x14/0x1c [ 8.723375] __kmalloc_track_caller+0x23c/0x388 [ 8.728040] devm_kmalloc+0x38/0x94 [ 8.731632] etm4_probe+0x48/0x3c8 [ 8.735140] amba_probe+0xbc/0x158 [ 8.738645] really_probe+0x144/0x408 [ 8.742412] driver_probe_device+0x70/0x140 [ 8.746716] __device_attach_driver+0x9c/0x110 [ 8.751287] bus_for_each_drv+0x90/0xd8 [ 8.755236] __device_attach+0xb4/0x164 [ 8.759188] device_initial_probe+0x20/0x2c [ 8.763490] bus_probe_device+0x34/0x94 [ 8.767436] device_add+0x34c/0x3e0 [ 8.771029] amba_device_try_add+0x68/0x440 [ 8.775332] amba_deferred_retry_func+0x48/0xc8 [ 8.779997] process_one_work+0x344/0x648 [ 8.784127] worker_thread+0x2ac/0x47c [ 8.787987] kthread+0x128/0x138 [ 8.791313] ret_from_fork+0x10/0x18 [ 8.794993] [ 8.796532] Freed by task 242: [ 8.799684] __kasan_slab_free+0x15c/0x22c [ 8.803897] kasan_slab_free+0x10/0x1c [ 8.807761] kfree+0x25c/0x4bc [ 8.810913] release_nodes+0x240/0x2b0 [ 8.814767] devres_release_all+0x3c/0x54 [ 8.818887] really_probe+0x178/0x408 [ 8.822661] driver_probe_device+0x70/0x140 [ 8.826963] __device_attach_driver+0x9c/0x110 [ 8.831539] bus_for_each_drv+0x90/0xd8 [ 8.835487] __device_attach+0xb4/0x164 [ 8.839431] device_initial_probe+0x20/0x2c [ 8.843732] bus_probe_device+0x34/0x94 [ 8.847678] device_add+0x34c/0x3e0 [ 8.851274] amba_device_try_add+0x68/0x440 [ 8.855576] amba_deferred_retry_func+0x48/0xc8 [ 8.860240] process_one_work+0x344/0x648 [ 8.864366] worker_thread+0x2ac/0x47c [ 8.868228] kthread+0x128/0x138 [ 8.871557] ret_from_fork+0x10/0x18 [ 8.875231] [ 8.876782] The buggy address belongs to the object at ffffff813304f800 [ 8.876782] which belongs to the cache kmalloc-1k of size 1024 [ 8.889632] The buggy address is located 200 bytes inside of [ 8.889632] 1024-byte region [ffffff813304f800, ffffff813304fc00) [ 8.901761] The buggy address belongs to the page: [ 8.906695] page:ffffffff04ac1200 refcount:1 mapcount:0 mapping:ffffff8146c03800 index:0x0 compound_mapcount: 0 [ 8.917047] flags: 0x4000000000010200(slab|head) [ 8.921799] raw: 4000000000010200 dead000000000100 dead000000000122 ffffff8146c03800 [ 8.929753] raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 [ 8.937703] page dumped because: kasan: bad access detected [ 8.943433] [ 8.944974] Memory state around the buggy address: [ 8.949903] ffffff813304f780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 8.957320] ffffff813304f800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 8.964742] >ffffff813304f880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 8.972157] ^ [ 8.977886] ffffff813304f900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 8.985298] ffffff813304f980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 8.992713] ================================================================== Fixes: f188b5e76aae9 ( "coresight: etm4x: Save/restore state across CPU low power states ") Reported-by: Sai Prakash Ranjan Tested-by: Sai Prakash Ranjan Cc: Mathieu Poirier Cc: Mike Leach Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index fb0f5f4f3a91..747afc875f91 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1516,6 +1516,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) return 0; err_arch_supported: + etmdrvdata[drvdata->cpu] = NULL; if (--etm4_count == 0) { etm4_cpu_pm_unregister(); From patchwork Mon May 18 18:02:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556047 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 CC0C7138A for ; Mon, 18 May 2020 18:09: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 81C3420671 for ; Mon, 18 May 2020 18:09:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HViqHon4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kwiG2DaY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81C3420671 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=8i07Rs2OgDjQV+aj8zn0NVcAVMaWrwagAPfI+4vX4QE=; b=HViqHon4izttKU bbQ3wH0zWayOU0yY2L8ukFv9W8ALDeW6+oS6lb7evskzartYrVe6FIGFRyPU6XNvZold/UEuy3R++ bJpfmV60vgp1hHdrkBuhOcdA0iq+FyDqGgpH1+4dEdAXM6iyzEfFdS4lt8tR26wSYsnM7DFwS9e9Q WpVx5CXiApSimjvbAG4M5ZhEvRXsmNysTcbZbs37CRXFDLrcxs8fvMEhgNPRkqvd5/8Qa9cRskGCg rDS8wXGpj7T/hpQShchSuOUHCvC1/0Ts3HFZNCLmz63gOPg3aJLjwERGHEi1z+UklgnRpkvGOdkzq NLgK9i40vrSiFic2otzQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakCw-00037n-VM; Mon, 18 May 2020 18:09:46 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6T-0003We-Uq for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:07 +0000 Received: by mail-pf1-x443.google.com with SMTP id b190so5307810pfg.6 for ; Mon, 18 May 2020 11:03:05 -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 :mime-version:content-transfer-encoding; bh=dq8B5i493pOtcT+TOE4LZPewgBRMXjn1BYe4NBtmAVw=; b=kwiG2DaYFYwGC4mYVBNRxgPJSCEynjYsLPLlusJkO2YkopPhauLwYOY2iFjCQL2b4q WeDLAUulKO0ZDZbjNWqGX27zghfaDZHM0aVX4oIJ99E8CoJGMoUORLq/0sNHydqzD3dT MS7tqq1KfO2GtdVO5teJQJQh3H4jMYxvv6/3M9083Kve+lH7HekrXR4neNCl+wTbptze oYO83gU3lrrAXSSHBdiUaIUY+zG9tU2mS1bImEBLav6bfFMPUbEMRlfwhgUY+Qgl3sXY nKh1555HZ/i0xZ3JOYAqQBNR19VMEqj0EQZiPLeOR99FWES58545CxqwCkLmbAUrE1A5 vkhQ== 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:mime-version:content-transfer-encoding; bh=dq8B5i493pOtcT+TOE4LZPewgBRMXjn1BYe4NBtmAVw=; b=oIFrA8QESpXtTi+qNtqbOkJNLlJcTITTA49jakxS1C5T5ozcA8d8ZT/j2OdWwPrp4g kkVvPTdAn3eJBb8M+fq2lXMYm/YKVjC3rWoi/3/bZCwt8D8cCSmxPWydryMCB9zb7UvC koZ+DqwjAhhXLxRHL1S3ge2FB8Xo067X+zMOY8taBzUTNQhX5UR169Bggsx+oKK9zPo8 pFEM/1pOnfMj0KJnQ6pam3BiFSzyQX5c/Z1gGd/v+fnYDV0Rlojsq8Hok09O2uyrrPYF rG66V1fH7vGQy/jTxnA1hBdGsIONuTTyDmTNzVsh81U8HGxQCNaefK2TpXcs1pUIyme/ tJ0w== X-Gm-Message-State: AOAM533lWsAToOzs0SbNmwSO5hSu56o+bpssMntKXOIlMBUC/8YX9dVL tubNk6ELtaI3aXOkdEZUiTLG+IbzGR8= X-Google-Smtp-Source: ABdhPJyZmcg9BxVanpdURFIT6L3+3OVgOgKdS/p4UZo9QOwZvN+bOXiG9eznhx2sFBxLRpQvbTqW3w== X-Received: by 2002:a63:33ca:: with SMTP id z193mr16553439pgz.210.1589824984972; Mon, 18 May 2020 11:03:04 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:03:04 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 22/23] coresight: cti: Add CPU Hotplug handling to CTI driver Date: Mon, 18 May 2020 12:02:41 -0600 Message-Id: <20200518180242.7916-23-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110306_179401_4C423B3A X-CRM114-Status: GOOD ( 18.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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:443 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach Adds registration of CPU start and stop functions to CPU hotplug mechanisms - for any CPU bound CTI. Sets CTI powered flag according to state. Will enable CTI on CPU start if there are existing enable requests. Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 92 +++++++++++++++++++++ include/linux/cpuhotplug.h | 1 + 2 files changed, 93 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index be61c1705916..7e7ec6dd93c0 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,12 @@ static DEFINE_MUTEX(ect_mutex); #define csdev_to_cti_drvdata(csdev) \ dev_get_drvdata(csdev->dev.parent) +/* power management handling */ +static int nr_cti_cpu; + +/* quick lookup list for CPU bound CTIs when power handling */ +static struct cti_drvdata *cti_cpu_drvdata[NR_CPUS]; + /* * CTI naming. CTI bound to cores will have the name cti_cpu where * N is the CPU ID. System CTIs will have the name cti_sys where I @@ -129,6 +136,35 @@ static int cti_enable_hw(struct cti_drvdata *drvdata) return rc; } +/* re-enable CTI on CPU when using CPU hotplug */ +static void cti_cpuhp_enable_hw(struct cti_drvdata *drvdata) +{ + struct cti_config *config = &drvdata->config; + struct device *dev = &drvdata->csdev->dev; + + pm_runtime_get_sync(dev->parent); + spin_lock(&drvdata->spinlock); + config->hw_powered = true; + + /* no need to do anything if no enable request */ + if (!atomic_read(&drvdata->config.enable_req_count)) + goto cti_hp_not_enabled; + + /* try to claim the device */ + if (coresight_claim_device(drvdata->base)) + goto cti_hp_not_enabled; + + cti_write_all_hw_regs(drvdata); + config->hw_enabled = true; + spin_unlock(&drvdata->spinlock); + return; + + /* did not re-enable due to no claim / no request */ +cti_hp_not_enabled: + spin_unlock(&drvdata->spinlock); + pm_runtime_put(dev->parent); +} + /* disable hardware */ static int cti_disable_hw(struct cti_drvdata *drvdata) { @@ -620,6 +656,44 @@ static void cti_remove_conn_xrefs(struct cti_drvdata *drvdata) } } +/* CPU HP handlers */ +static int cti_starting_cpu(unsigned int cpu) +{ + struct cti_drvdata *drvdata = cti_cpu_drvdata[cpu]; + + if (!drvdata) + return 0; + + cti_cpuhp_enable_hw(drvdata); + return 0; +} + +static int cti_dying_cpu(unsigned int cpu) +{ + struct cti_drvdata *drvdata = cti_cpu_drvdata[cpu]; + + if (!drvdata) + return 0; + + spin_lock(&drvdata->spinlock); + drvdata->config.hw_powered = false; + coresight_disclaim_device(drvdata->base); + spin_unlock(&drvdata->spinlock); + return 0; +} + +/* release PM registrations */ +static void cti_pm_release(struct cti_drvdata *drvdata) +{ + if (drvdata->ctidev.cpu >= 0) { + if (--nr_cti_cpu == 0) { + cpuhp_remove_state_nocalls( + CPUHP_AP_ARM_CORESIGHT_CTI_STARTING); + } + cti_cpu_drvdata[drvdata->ctidev.cpu] = NULL; + } +} + /** cti ect operations **/ int cti_enable(struct coresight_device *csdev) { @@ -655,6 +729,7 @@ static void cti_device_release(struct device *dev) mutex_lock(&ect_mutex); cti_remove_conn_xrefs(drvdata); + cti_pm_release(drvdata); /* remove from the list */ list_for_each_entry_safe(ect_item, ect_tmp, &ect_net, node) { @@ -730,6 +805,22 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) goto err_out; } + /* setup CPU power management handling for CPU bound CTI devices. */ + if (drvdata->ctidev.cpu >= 0) { + cti_cpu_drvdata[drvdata->ctidev.cpu] = drvdata; + if (!nr_cti_cpu++) { + cpus_read_lock(); + ret = cpuhp_setup_state_nocalls_cpuslocked( + CPUHP_AP_ARM_CORESIGHT_CTI_STARTING, + "arm/coresight_cti:starting", + cti_starting_cpu, cti_dying_cpu); + + cpus_read_unlock(); + if (ret) + goto err_out; + } + } + /* create dynamic attributes for connections */ ret = cti_create_cons_sysfs(dev, drvdata); if (ret) { @@ -768,6 +859,7 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) return 0; err_out: + cti_pm_release(drvdata); return ret; } diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 77d70b633531..6dc7332307ca 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -142,6 +142,7 @@ enum cpuhp_state { CPUHP_AP_ARM_XEN_STARTING, CPUHP_AP_ARM_KVMPV_STARTING, CPUHP_AP_ARM_CORESIGHT_STARTING, + CPUHP_AP_ARM_CORESIGHT_CTI_STARTING, CPUHP_AP_ARM64_ISNDEP_STARTING, CPUHP_AP_SMPCFD_DYING, CPUHP_AP_X86_TBOOT_DYING, From patchwork Mon May 18 18:02:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11556049 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 336CB1391 for ; Mon, 18 May 2020 18:10:04 +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 0F3B12087D for ; Mon, 18 May 2020 18:10:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gjDOjkAQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UgTdUjvq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F3B12087D 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=2RTFhvVQr7DKVmmBYNEgzgXl9zI9vKB3xE07/X1Qyfg=; b=gjDOjkAQlAOdDe BFIZPL7542bmKj3BDv4O1qolFYM2O7Kvjfez/CrWA7O9FgeMWB2xfZMMkPKxWuotZHXHWvTWDRXGW WFW6qzGGA/2ni8B5GEQO/DK5DJst2yfNxmbaitAPQpFENyBYOpN79FMFaEraDcFfGgac6glFiMXUT HK7vp4OPTmfB9fnV6JvcVK/g1RKfZV5Vvg8kL5gIHfePovgqP7cELiJJhooJQIWEmcbvXL8d8Sc/b m9BTwfDt0rjCce6FMzQAKfrIoml/SOfKQyJuoHvJ2m+8ZycpfFkv22qBsYDw+5Imd/mfoZAlZlrXC wCUmu8h1DLPT3kVnCBWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jakD9-0003Nz-44; Mon, 18 May 2020 18:09:59 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jak6U-0003Xd-N6 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2020 18:03:08 +0000 Received: by mail-pf1-x442.google.com with SMTP id y18so5300771pfl.9 for ; Mon, 18 May 2020 11:03:06 -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 :mime-version:content-transfer-encoding; bh=yJAMmA5oFXo3RMgRoby1GjfGVPG2NEb0jBUCrGMUliA=; b=UgTdUjvqn1fx10oWzW/KirlcWgmSdoH2W9/VFHQ86CfwTfLcIEHQJpwDWPd3htfCtC jPVWX6nyYh35GS2Xx9mpLpDC89wheN1gbYv0YWOioGV0jOsQanyZUygJnTSNxene4Vvv XICMiDNbztOVaQvIk7kVT0tj3PC9307V+q5lWHOon7Nk3mxL99mYHz8/O37Dh9h9SnTs yclB7HQzYmQMNqlqLE5V/XTxCdtbl2+pfyiqiU42XUY56hJSSuunxNfsR3C/yIdGcTa/ ijvCPUVIdG+6csTi9CaENFo++BFF1/2Xp6AKCr0YWgYGwlPpw36MkIcVx7ouldBK00/n m80Q== 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:mime-version:content-transfer-encoding; bh=yJAMmA5oFXo3RMgRoby1GjfGVPG2NEb0jBUCrGMUliA=; b=guLvMelA/3Zw0OIW+YdR78Ycxjpp1GbslDxBVoE7+fSNTIIYOyUa/D1/Od6mBdu0pA CuBsi7tLG/abcdnf7+6zXBOTmuL5l9GIJPzGMjMb/N8U4tlw740uWYcLdAH3djY3CkLa ex0WD6kMHE9zUfifSeatJQwgX4XYKdhNr6+A193YENN5rPiwpBXMklA59M7LZMbGAxsF mS1bOWG+EMN6KLt7nMRXQ9/dXb9ISzCwaIrX/dZzbAa4fDZRzp9aLUP95yxlcxIVvwp3 yoKs4awXfCKn/5fUsrUUFjRPFhLW8mpkaGP8Otkd7qkMs0x3+V8tDA9AMrYjUXKZ/ocn CA0A== X-Gm-Message-State: AOAM532ZV3WhBMh9FGd6NImRvT1Zo3KgMpu7yRm5jKTgoqoRTk1F4fMh mqBW26fqrFRX6g+tLJ92c62zTvrXIzQ= X-Google-Smtp-Source: ABdhPJwdgsLqzC8VsPDYnne2JONRvzv+kC/ed3qWUXtC25fSC0qIQ93P3Y33O3tgp01OgyNkkXjG7Q== X-Received: by 2002:aa7:92cc:: with SMTP id k12mr17155579pfa.184.1589824985848; Mon, 18 May 2020 11:03:05 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v3sm9212314pfv.186.2020.05.18.11.03.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 11:03:05 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 23/23] coresight: cti: Add CPU idle pm notifer to CTI devices Date: Mon, 18 May 2020 12:02:42 -0600 Message-Id: <20200518180242.7916-24-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200518180242.7916-1-mathieu.poirier@linaro.org> References: <20200518180242.7916-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200518_110307_031534_9E169C0D X-CRM114-Status: GOOD ( 14.46 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach Adds a notify callback for CPU PM events to the CTI driver - for CPU bound CTI devices. Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 69 +++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 7e7ec6dd93c0..40387d58c8e7 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -656,6 +657,70 @@ static void cti_remove_conn_xrefs(struct cti_drvdata *drvdata) } } +/** cti PM callbacks **/ +static int cti_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd, + void *v) +{ + struct cti_drvdata *drvdata; + unsigned int cpu = smp_processor_id(); + int notify_res = NOTIFY_OK; + + if (!cti_cpu_drvdata[cpu]) + return NOTIFY_OK; + + drvdata = cti_cpu_drvdata[cpu]; + + if (WARN_ON_ONCE(drvdata->ctidev.cpu != cpu)) + return NOTIFY_BAD; + + spin_lock(&drvdata->spinlock); + + switch (cmd) { + case CPU_PM_ENTER: + /* CTI regs all static - we have a copy & nothing to save */ + drvdata->config.hw_powered = false; + if (drvdata->config.hw_enabled) + coresight_disclaim_device(drvdata->base); + break; + + case CPU_PM_ENTER_FAILED: + drvdata->config.hw_powered = true; + if (drvdata->config.hw_enabled) { + if (coresight_claim_device(drvdata->base)) + drvdata->config.hw_enabled = false; + } + break; + + case CPU_PM_EXIT: + /* write hardware registers to re-enable. */ + drvdata->config.hw_powered = true; + drvdata->config.hw_enabled = false; + + /* check enable reference count to enable HW */ + if (atomic_read(&drvdata->config.enable_req_count)) { + /* check we can claim the device as we re-power */ + if (coresight_claim_device(drvdata->base)) + goto cti_notify_exit; + + drvdata->config.hw_enabled = true; + cti_write_all_hw_regs(drvdata); + } + break; + + default: + notify_res = NOTIFY_DONE; + break; + } + +cti_notify_exit: + spin_unlock(&drvdata->spinlock); + return notify_res; +} + +static struct notifier_block cti_cpu_pm_nb = { + .notifier_call = cti_cpu_pm_notify, +}; + /* CPU HP handlers */ static int cti_starting_cpu(unsigned int cpu) { @@ -687,6 +752,8 @@ static void cti_pm_release(struct cti_drvdata *drvdata) { if (drvdata->ctidev.cpu >= 0) { if (--nr_cti_cpu == 0) { + cpu_pm_unregister_notifier(&cti_cpu_pm_nb); + cpuhp_remove_state_nocalls( CPUHP_AP_ARM_CORESIGHT_CTI_STARTING); } @@ -815,6 +882,8 @@ static int cti_probe(struct amba_device *adev, const struct amba_id *id) "arm/coresight_cti:starting", cti_starting_cpu, cti_dying_cpu); + if (!ret) + ret = cpu_pm_register_notifier(&cti_cpu_pm_nb); cpus_read_unlock(); if (ret) goto err_out;