From patchwork Mon Sep 28 16:34:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804063 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 8002A1746 for ; Mon, 28 Sep 2020 16:35:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 508742080C for ; Mon, 28 Sep 2020 16:35:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="O+9bKwie"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kr5Oqg5r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 508742080C 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=merlin.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=Si7KBKiSPGdmSWnLYad21vPAR6/8D7Zg1BEVF+5fN6w=; b=O+9bKwieC1zVaEAI81Bx9Zsp9 dglkUCkAjIVzejSQXBdvo4AJq3Xbc1+oRMWeRszJFuKTnJiJY+1on1e7QXp2jWZpwN8/p4Huq/Mh3 fCeiN+04skh8zSu7fwtQn+UAnfcmsQ6ZLr1cmNpm77tOXUU1rtYYeWHWo0kaegICd/E4tBIchXj5I doQIC9vB+OI4wcsh6Kaw6SiOpPVRdULrFqf+QoBYtaU1Y2MJb5H3H5oZiPt9V0u1CKW70TcnzhyNO zqFjCt2lGTFpjKQtVzYBsMUDR0WlV5nZ7PiLPXRoiRFIGatC95R7v3TdxBvCFl/n3SsGsLY9SYNMH BR51gOw8g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7j-0000cR-LF; Mon, 28 Sep 2020 16:35:35 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7R-0000V9-Kk for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:20 +0000 Received: by mail-pg1-x544.google.com with SMTP id 197so1317793pge.8 for ; Mon, 28 Sep 2020 09:35:17 -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=mhPB3SD/cztsuX6qmnMAjYP7h5Xc/N3TOgnRL69WxQw=; b=kr5Oqg5rgbz+BE0HjhxRGQ0QNlBinYZaTbP54+Sd6w6eBPbj26puveFA1Cthla3RqE Uf7rYMAcA2u+JKZMg5NYq8vhnEAP+76BIp+1+rqocckJmFbQ6+loEK2mcOsXK7Vod4Cx 1NunEZTKPcasUe/7hOPTXIIxSGotv9nV1iui9r1KdkXjJpaOOMfr8p/Ny1mw8adO+YtA 8vpl+pcXGZQbJjUXkRP6b4a3RCOgi543JumvbiKQsevxqbvZUNb05CtJnFytwrN+DbpX UpCRwn6XB6Ee6Y4s3GOEzItYjPWjYBnzrrJOBV3X+Fq4mP9s5UpSXKX4amscgCK59eVf Z/FA== 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=mhPB3SD/cztsuX6qmnMAjYP7h5Xc/N3TOgnRL69WxQw=; b=XOngNqRrGk61nKcyIStXZATTEYX1njiGAXH8SlJWpCLRvKfKWsIPxvW+OH6+KQFbNn 82OgvclnZvO/323CAGalnpni9krVHlx9i1oRgENyUQ7co3qDPYTs1zKJqkaRjWn3/pQn /Wu70UWtrwiSQlerHrSEj3l3fB+QsELNNjIcbX0H1g8Y/6hn0IvQ4eSaf75gwpw+8mln 6LsICDg6+we3FPmpliIKjINAQnC+HknB23asrC4KYuiAJ2xUyPOdBH9MGao/O651bHz0 tjIoO55o96tFM5PEZQHFg1vC/jK6yW7ckJMUt7R0qlEbCzFo4HQg+CBzf2BFevstAEzX NX8A== X-Gm-Message-State: AOAM530LODa6hbfITy+LGPUIQ1keC81GYOW57uw75nCnZNZOjnKXsOA0 oBGih85KD4nQ4EFVAedY3jRBrQ== X-Google-Smtp-Source: ABdhPJx7cmBJ7mcYC0d9P9oJ7xWnnGRLozhDMrgPge4N7B9k8b8V7InFSl4AG8SbcGN1tN38cR3jjA== X-Received: by 2002:a63:7d8:: with SMTP id 207mr1794517pgh.173.1601310915642; Mon, 28 Sep 2020 09:35:15 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:15 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 01/25] coresight: cpu_debug: Add module name in Kconfig Date: Mon, 28 Sep 2020 10:34:49 -0600 Message-Id: <20200928163513.70169-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123518_044103_12B63BE1 X-CRM114-Status: GOOD ( 13.23 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang Provide name of cpu_debug module in Kconfig help section. Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 02dbb5ca3bcf..4663fd1bbffc 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -110,6 +110,9 @@ config CORESIGHT_CPU_DEBUG properly, please refer Documentation/trace/coresight/coresight-cpu-debug.rst for detailed description and the example for usage. + To compile this driver as a module, choose M here: the + module will be called coresight-cpu-debug. + config CORESIGHT_CTI bool "CoreSight Cross Trigger Interface (CTI) driver" depends on ARM || ARM64 From patchwork Mon Sep 28 16:34:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804071 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 A74D1139A for ; Mon, 28 Sep 2020 16:37:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 4489D2080C for ; Mon, 28 Sep 2020 16:37:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="N5Ikk1NS"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Nisff/dG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4489D2080C 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=merlin.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=BexmwTA3qI+EavRIGT2JA2EqbdL3oPc+tGsP8RmfglQ=; b=N5Ikk1NS9zGbtK9pYAPB4mJUR hxgMF0gMFCMoLIjf5MuG0uUE30P7CfNw+//5vuboWhDlwYRi9/tWwtT5mUdrm3l6SNrxGN9rovDnd XrFdrAU5HR6ohfDtKRiqcSvzy8dhXA9P3wwvY+YtvWYGx4b/6iA6h77dgVvGR8LETBWCE4KVg9qAY L8CHkqhNdHmwEfkW3XopJxNkksIWQsycjcA84iSKw/p+P2nrAkZMw/CQD5RBJHms7k1RYe5HB2jsr twOPqXOYeiAkYO9YRGsnd++uJi2hzL4cFfEbFWcEjFpkCfqJhEiwc4TKrlZnOcavjAbNsgfPzWiM1 KT8890HaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7v-0000hR-Qn; Mon, 28 Sep 2020 16:35:47 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7S-0000Vc-OD for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:21 +0000 Received: by mail-pj1-x1041.google.com with SMTP id v14so941870pjd.4 for ; Mon, 28 Sep 2020 09:35:18 -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=AMZpD8+Li6GFUtc4Pm9yyOxq3WZ1VdS1uKZ+57gOcGw=; b=Nisff/dGaQnt5giFy0+gbCxZOyxIq8yzZHqaf8yvSXI4mK6JOfGqOWRAze74KzmpPk PcSgEfg5JCSNReg6GYWHksUb4BbBh22OIiCr8KluSnQdXN8dgxEyzqKuQ/UxGEKVXxl9 yFnJYIqqn52YqpKtbs36kfgxCJtsS+NtydY33Pbcul3K03mY8ZChWkd3tncRj9oQkipx Mcppdf1K2qZ/YqlgvKMZDQsQEowJv8LIqKc6ZeirjG92JCPwq7He63JyoW9aLL1N8Emu vlYPIFyJhDj7chEbb6HE83Xbj6xbIQeekj7h1dvd1/zSeQGvqWqXrnaG+T7ALnRGEWs2 T7nA== 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=AMZpD8+Li6GFUtc4Pm9yyOxq3WZ1VdS1uKZ+57gOcGw=; b=HD6PyQAELcryAtkuwv0U0pP3aL/1VnVbhVRp5CFXf6A7n73fYCCnUtp24ADT0mWxLI MsZ889fCSK6vK2UuxK0ko98cV3iTe10FPHSYLKCJvBNnJsj76kBH6GAH7uGO7x7qMMht v1is44eqFLaImLaKzdRxfREOluto923OmOXWOZ8u9W+WU5Ac6e7vlH0U3M0BzyxmgDAO HHTNDtWF56ZeEaI1kvwL7i1W++7cGHASS2sSXayapNJqYIh51Yam/Cgs92tY8DG4am8m Xj8Q37E6DUJHmOT/VvzjIRfiAOdwKFJOAUmK3+oO0pmu6r2gnnY3YDJ3h6ZM8rj2HGTP yKsQ== X-Gm-Message-State: AOAM530EPgo/gyn2RRTz9a61RYOlQZ3cZA2YULp0wlDEjTSD5Rbmk5Pb TBh5VJdvDPjoPYEuB6x27WC/2wnW4C7Bmg== X-Google-Smtp-Source: ABdhPJzXVQXWJQf7Y7yqN9X8MV0VrbRhBo+F3jp6j831Kc3brGe3CBtVspQeH1mDshkFY2HeKEcM5w== X-Received: by 2002:a17:90b:a51:: with SMTP id gw17mr151742pjb.118.1601310916737; Mon, 28 Sep 2020 09:35:16 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:16 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 02/25] coresight: cpu_debug: Define MODULE_DEVICE_TABLE Date: Mon, 28 Sep 2020 10:34:50 -0600 Message-Id: <20200928163513.70169-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123518_828322_38808994 X-CRM114-Status: GOOD ( 13.52 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang Define a MODULE_DEVICE_TABLE for cpu_debug so module can be auto loaded on boot. Signed-off-by: Tingwei Zhang Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cpu-debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c index 7e642fb3ed15..e1d232411d8d 100644 --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c @@ -665,6 +665,8 @@ static const struct amba_id debug_ids[] = { {}, }; +MODULE_DEVICE_TABLE(amba, debug_ids); + static struct amba_driver debug_driver = { .drv = { .name = "coresight-cpu-debug", From patchwork Mon Sep 28 16:34:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804065 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 852F26CB for ; Mon, 28 Sep 2020 16:36:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3C8982080C for ; Mon, 28 Sep 2020 16:36: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="TYMc/sAX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AlPBzp9R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C8982080C 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=merlin.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=+gWJfHIGPAIRRn/RL+5fq75aNg4QJKNqio/9a3PnE2g=; b=TYMc/sAXQNv7thrp+zxugdwwd +Kp35EstfbWCKOKfr9QDUk9lZbPHkJZis2fmnqEubkwuB8Q8FMH3CsGU7B1r+9qUq0xt2He8t3AOl dRknrdBd40aT9VgLtDdusJ37aZ2SDZXYcHkVEkRUmPNgZyCFRyhIfTqHyHGuptdu7oyyU/qbYapdA HmT3l8ubNUDHFLATOOxWsojoMbPGbnvbGbv3cqGSxVwfisO6K9PCI60uyehW8GsqH2+wytmFe52q2 ratb+MBx9b8CVyMxqJHSqpB/yEFFTOSHRepg+h93tgEF/YM7GJo3C3SuNQ1PnQFoF0Mr2sxem3dD5 /03YnDlDA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw85-0000nZ-SX; Mon, 28 Sep 2020 16:35:57 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7T-0000Vw-QX for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:24 +0000 Received: by mail-pf1-x42a.google.com with SMTP id f18so1501926pfa.10 for ; Mon, 28 Sep 2020 09:35:19 -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=9uBCtknHRVZ5YnORcKUKYFX5Ylh+EACLqKEbj0M9418=; b=AlPBzp9R1iGsWkWvsea30Ky4Jf59IpYlVNEppTSV6TglRjfCq5a7ee/tdFR+FATgSC /UahVo/hAwOOuBnVwCX7/4N1czOyehEX71/q8UC5X527oiXyG1QwlmH1u9PKJ+46yFp0 Szb7ViFF0+Jo+82wfVFuaiypgv6HQYG0wHb/MhwNr8WslXoEMpfw4tmFpKWNyqk0LVEn O7+lGP8G+eHtd9gepldPpDT/FzhO/B9a7uGgHziEdjMbmhAF98h5lUbct1a6f7oeA6QF svhwaD1f0uxniFxcY8PpyXpkMTP9UFBt5cjruXn3ktU4KD4+O+OQYszVB8D1bXAHDsrp cb3g== 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=9uBCtknHRVZ5YnORcKUKYFX5Ylh+EACLqKEbj0M9418=; b=UfWIoCevJB4Dig9Z2QtifTEdYA7wSSRYs316zh2g3k9PxqNi+NfZAR9TQR1cI3Yt8l kCd72GB/F3LcsVM5I9ZdETJviEPOecmt13Z6HCWlGRvxKtFQFQ1JXNup4ld+s+NGq+Ei oIXBlsWk64qgLvTdGvY6fcAQ0lNWn4cfTMMiHuIu/wjdH0ZkVjHP5THGBcJJ6PJoFKuy IWvTu2F1nIiJo5br+jkIfgNM7iU5uDRIRB85/SDYLgmZJhDK/GvUT/OnK+3QO5I882gx hnR2IWDciHZ8Akpd121KreGa4de8dBv1TqXVt9UQ+38Ul7DLVGuUVvh46EycQpEaQpUX ndlw== X-Gm-Message-State: AOAM533joIKkPDv1x4WUCySt71uX8huZ736zEkySBkYV2O5N3rvi45fT AyPaaPU0t3U/DFmu+foW9PRPR5ftiwGwRg== X-Google-Smtp-Source: ABdhPJz6aKTIfIyMjaMa3S62Vjbum7V1Km03/87+OVuGz5uTmbrdR9pwN1RYvGZ0BVneyop2M5lliA== X-Received: by 2002:a63:f104:: with SMTP id f4mr1834586pgi.365.1601310917763; Mon, 28 Sep 2020 09:35:17 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:17 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 03/25] coresight: Use IS_ENABLED for CONFIGs that may be modules Date: Mon, 28 Sep 2020 10:34:51 -0600 Message-Id: <20200928163513.70169-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123519_889660_AF20D019 X-CRM114-Status: GOOD ( 14.89 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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:42a 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Kim Phillips Checking for ifdef CONFIG_x fails if CONFIG_x=m. Use IS_ENABLED that is true for both built-ins and modules, instead. Required when building coresight components as modules. Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm-perf.h | 2 +- drivers/hwtracing/coresight/coresight-priv.h | 2 +- include/linux/coresight.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h index 015213abe00a..05f89723e282 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -57,7 +57,7 @@ struct etm_event_data { struct list_head * __percpu *path; }; -#ifdef CONFIG_CORESIGHT +#if IS_ENABLED(CONFIG_CORESIGHT) int etm_perf_symlink(struct coresight_device *csdev, bool link); int etm_perf_add_symlink_sink(struct coresight_device *csdev); void etm_perf_del_symlink_sink(struct coresight_device *csdev); diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 5fe773c4d6cc..28695e26e5c6 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -166,7 +166,7 @@ int coresight_make_links(struct coresight_device *orig, void coresight_remove_links(struct coresight_device *orig, struct coresight_connection *conn); -#ifdef CONFIG_CORESIGHT_SOURCE_ETM3X +#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X) extern int etm_readl_cp14(u32 off, unsigned int *val); extern int etm_writel_cp14(u32 off, u32 val); #else diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 58fffdecdbfd..3bb738f9a326 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -324,7 +324,7 @@ struct coresight_ops { const struct coresight_ops_ect *ect_ops; }; -#ifdef CONFIG_CORESIGHT +#if IS_ENABLED(CONFIG_CORESIGHT) extern struct coresight_device * coresight_register(struct coresight_desc *desc); extern void coresight_unregister(struct coresight_device *csdev); From patchwork Mon Sep 28 16:34:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804073 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 9715F139A for ; Mon, 28 Sep 2020 16:38:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 5ABB62080C for ; Mon, 28 Sep 2020 16:38:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="T8G7NStC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kLqhFN7/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5ABB62080C 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=merlin.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=+DzAyBaiAqOK+inkcOb0ifkxBLmYgHgLPJrpIL5+46g=; b=T8G7NStCyU2pLY/BqVmjwmEL5 z1Og2YgOKzXCY8MN7HcjUXL1D6rEoEUL2uBg3GgI857qFvooDEHqrF+3YOwIw99j2PovtvmIyWCDu aWAHJm0xJYq3+3wcT0SZM4krWHKVONDBllgx4xALwIfgCS8GBL7U5MUyHw5dF4AUUrJRwwcq8UwSa 8amVrHZI669VQQ2fNVHyt/3KD6mc5kMMfrFMuPG/9n54QNu4/Lv1Sum2oLGyLs/vVGEZkRqFuklJP cxKeFKluLL0hvombsz7TrfBgFT/sKL28XDtytCMxfqK559SSINqrtp9xogWkxB9Zj4C8Yziu+VN56 ZQePHMdOA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw8A-0000op-AW; Mon, 28 Sep 2020 16:36:02 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7U-0000WR-JM for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:25 +0000 Received: by mail-pj1-x1041.google.com with SMTP id b17so953159pji.1 for ; Mon, 28 Sep 2020 09:35:20 -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=gSNI4aKIAgjaa3IWnWs5bKpT6ackNFBWDJoRKS0EH98=; b=kLqhFN7/bIhd9wUGI78A0ktoH07XgmRZDjrVQAc8bdiSY5sbjRd0KQ5BcMDjNJn4YH E25q2of6p9zDRYlVsaN3x7Iq4GKJn2areWyQRdDOI4i4HDxDZ4CtNoyCCZvkvmyTJ9a9 zDy7W1IYNUQB+pETxN7DFxnKfre/pTE38Q6ZJSqf12rteCxF5CXKbacx2khW9wVo1RbN gTGJYdSqXShTzo2N8Zk8jN54Jitx1bYyqXDM/IMvACoGbmoslDcpUUHCFloGPOu8gXP0 +QU4ZhuiJn2ANRF68wg3fvw3bESzHZpOB6BfycD4j4Iqu6+OMtpywnrU9FiN8wtxzMh2 ruxA== 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=gSNI4aKIAgjaa3IWnWs5bKpT6ackNFBWDJoRKS0EH98=; b=ebUoaGPlfee4I4LWtqxMKpRXNYRG0giqUSC3CfSABzR21PvETCJgoxmyw2FJrxDHK5 Q9KN1rkORleVKNQzPWtsYjflEmjfmsPQpa67iNRdPAqNytA7qNs+9QtbUI7hK+On28Fk DW3MV3lD5Yh2ftneUBw68slNzU0KQ16VaSRctUpVgdA6xOBoLPXusLioq80XMU16jUJm FKx10/3JLIjMc7I9JLnWUfG85w46+bw2Ywb62PRbQu0xrlmz6ctaq6bep5VnWVWILn0o cKo73N8FGwKVv+8lebB2pVJYsvMjPu8Q2vx1tduaEga0evGWa7pex9Ab50pP4lmAQEca vPvg== X-Gm-Message-State: AOAM532PM0PPQo0mFk8/sdJnvdQ3IhLrwpBusvlVwB2vu6+rJbpcFMnG 7XF6emjNZR09jhMVc0cW3CUC3Q== X-Google-Smtp-Source: ABdhPJz+6aMCbhN+gVLQgyJolgCX8SUrFCFZ1ruiPcZVR/nvFJJyzSfEYpCpkzTChA2TCT7+0vUdyA== X-Received: by 2002:a17:90a:d914:: with SMTP id c20mr167794pjv.34.1601310918968; Mon, 28 Sep 2020 09:35:18 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:18 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 04/25] coresight: Add coresight prefix to barrier_pkt Date: Mon, 28 Sep 2020 10:34:52 -0600 Message-Id: <20200928163513.70169-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123520_678128_4FDF8AA3 X-CRM114-Status: GOOD ( 16.39 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang Add coresight prefix to make it specific. It will be a export symbol. Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Tingwei Zhang Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- drivers/hwtracing/coresight/coresight-priv.h | 7 +++---- drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +- drivers/hwtracing/coresight/coresight.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 03e3f2590191..04ee9cda988d 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -525,7 +525,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, cur = buf->cur; offset = buf->offset; - barrier = barrier_pkt; + barrier = coresight_barrier_pkt; for (i = 0; i < to_read; i += 4) { buf_ptr = buf->data_pages[cur] + offset; diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index 28695e26e5c6..d638c7d48815 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -66,8 +66,8 @@ static DEVICE_ATTR_RO(name) #define coresight_simple_reg64(type, name, lo_off, hi_off) \ __coresight_simple_func(type, NULL, name, lo_off, hi_off) -extern const u32 barrier_pkt[4]; -#define CORESIGHT_BARRIER_PKT_SIZE (sizeof(barrier_pkt)) +extern const u32 coresight_barrier_pkt[4]; +#define CORESIGHT_BARRIER_PKT_SIZE (sizeof(coresight_barrier_pkt)) enum etm_addr_type { ETM_ADDR_TYPE_NONE, @@ -104,10 +104,9 @@ struct cs_buffers { static inline void coresight_insert_barrier_packet(void *buf) { if (buf) - memcpy(buf, barrier_pkt, CORESIGHT_BARRIER_PKT_SIZE); + memcpy(buf, coresight_barrier_pkt, CORESIGHT_BARRIER_PKT_SIZE); } - static inline void CS_LOCK(void __iomem *addr) { do { diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 6375504ba8b0..44402d413ebb 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -519,7 +519,7 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, cur = buf->cur; offset = buf->offset; - barrier = barrier_pkt; + barrier = coresight_barrier_pkt; /* for every byte to read */ for (i = 0; i < to_read; i += 4) { diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index bb4f9e0a5438..ae40bb0539fd 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -53,7 +53,7 @@ static struct list_head *stm_path; * beginning of the data collected in a buffer. That way the decoder knows that * it needs to look for another sync sequence. */ -const u32 barrier_pkt[4] = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; +const u32 coresight_barrier_pkt[4] = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; static int coresight_id_match(struct device *dev, void *data) { From patchwork Mon Sep 28 16:34:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804067 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 2F6646CB for ; Mon, 28 Sep 2020 16:36:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 DCD4B2080C for ; Mon, 28 Sep 2020 16:36: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="YPQso17l"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eLp58MgK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCD4B2080C 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=merlin.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=ZhkqaRqLTFm8x1xnQGfBob8fWXSs0lgWBpEUUk5gZC0=; b=YPQso17lFlV4rkYgrd3mfoasH rTCA5VLWqDViaTj3j5rB8B2BrHDAZmIk//aJ48/idSzmrG3oCdoRoRokH4rP9mQHw/wfq6DPpR/tX YoQldE7ve5w0yiwoRcko1KPboyHgpHToQnIJwMo7Ny/LGB3PBdqBG2kqaeKiQBDVCCfi7lq5RjAVt 8BS803N74o1Qmx98YyiC4Zf2k5XiYRi+U/aigfj3/mmGemCZief0JbcMXadKsB5tLB5FwQsrom+ex XyaVVM0gR1nU5ukScjO8vLich+gU9Nq3yIXo96JhPnZYy51Yo1fuWDNqOYwFdPQYpGq5wolx0Ub5f W33TYvd2g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw8I-0000qK-3x; Mon, 28 Sep 2020 16:36:10 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7W-0000X6-8V for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:27 +0000 Received: by mail-pf1-x441.google.com with SMTP id q123so1542019pfb.0 for ; Mon, 28 Sep 2020 09:35:21 -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=7uhV9FbhFzcIeQA7/8itpaMiUW3+R2wmKNKtzK5dqCs=; b=eLp58MgKFDC8ooYfcBKgfgoC8G9TGGGsTiscFJ/UPULzDzfYWftqG8pqiHDSRhkRnI q2t5MXMJg5C2kJnV/Tb1p5Emtj95mL3scE2xgmFm3NDFWaBPnA5aItFGny3AULySpHba B8dQPj0JpKz2ULMcI758KZ09KA4Apilu/33ScI1jbWt6ztnswNdaZkuYA5VRdiT8pl7e YYPtVyIRWcXwNu97UNeMAiCa59AxmK0N+F6WoVJUI+sg6M3Frxy2tfgXS2fG8jAuWgtQ kK8MjRpW8X+nnfMG3Kd8uXYNB1S/PfcxZ+yp6eH0nKe9AgJsTfIdzQJ3eO6SHnhjkbts orDg== 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=7uhV9FbhFzcIeQA7/8itpaMiUW3+R2wmKNKtzK5dqCs=; b=mg6UYZ1tnH6t/IbPuGgsg06qmycPkDb8NhSdMTyWOX8G7joyAirLs8EPo++I48xKpR bC2j/8jSWOiaH/eZ+hvmY1rfCXUb3L1P6W0mPSx/EaIJAelq6E+J/Jgux2rMs+/XdNks qayaneYXvJy1PvkMckzS5gedpr2ptsv5U/gYqFCMLIFhxqPq9Cxwwy2gWzLfxgdxwyWv 9paqLwImsLMuU+c35uVlmr/8DVLfKYSktEF8z6tmjp75ncRzA3Tbg09C8SiwLAOXKKnV kFpC6xhG7GCbK3C0bMt2kx2Zvq+TfZZyZHt0fRnTIHl5/Mf2O9Euc7cWmXw8iF7/ov+H Pscw== X-Gm-Message-State: AOAM532c+i5FnBzOYgelGDd/odTpkIzwatYZAfCBdgd4URJYN8pk5RN1 72podK62q9hXsx4RHkbzLzfSqQ== X-Google-Smtp-Source: ABdhPJxUr7s+Tln57fdPUapsg6If3k+BJojIGBOTCtkV+KH3vwliAqU0Uc+8lxxS1EDP0A+HXQLU2Q== X-Received: by 2002:a05:6a00:792:b029:13c:1611:652d with SMTP id g18-20020a056a000792b029013c1611652dmr235509pfu.13.1601310920056; Mon, 28 Sep 2020 09:35:20 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:19 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 05/25] coresight: Export global symbols Date: Mon, 28 Sep 2020 10:34:53 -0600 Message-Id: <20200928163513.70169-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123522_356517_F553A422 X-CRM114-Status: GOOD ( 18.85 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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:441 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Mian Yousaf Kaukab Export symbols used among coresight modules. Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm-perf.c | 1 + drivers/hwtracing/coresight/coresight-sysfs.c | 2 ++ drivers/hwtracing/coresight/coresight-tmc-etr.c | 6 ++++++ drivers/hwtracing/coresight/coresight.c | 8 ++++++++ 4 files changed, 17 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index b4e5758b6c12..644805e0a9ec 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -525,6 +525,7 @@ int etm_perf_symlink(struct coresight_device *csdev, bool link) return 0; } +EXPORT_SYMBOL_GPL(etm_perf_symlink); static ssize_t etm_perf_sink_name_show(struct device *dev, struct device_attribute *dattr, diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c index 82afeaf2ccc4..34d2a2d31d00 100644 --- a/drivers/hwtracing/coresight/coresight-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -102,6 +102,7 @@ int coresight_add_sysfs_link(struct coresight_sysfs_link *info) return ret; } +EXPORT_SYMBOL_GPL(coresight_add_sysfs_link); void coresight_remove_sysfs_link(struct coresight_sysfs_link *info) { @@ -122,6 +123,7 @@ void coresight_remove_sysfs_link(struct coresight_sysfs_link *info) info->orig->nr_links--; info->target->nr_links--; } +EXPORT_SYMBOL_GPL(coresight_remove_sysfs_link); /* * coresight_make_links: Make a link for a connection from a @orig diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index b29c2db94d96..ad991a37e2d2 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -255,6 +255,7 @@ void tmc_free_sg_table(struct tmc_sg_table *sg_table) tmc_free_table_pages(sg_table); tmc_free_data_pages(sg_table); } +EXPORT_SYMBOL_GPL(tmc_free_sg_table); /* * Alloc pages for the table. Since this will be used by the device, @@ -340,6 +341,7 @@ struct tmc_sg_table *tmc_alloc_sg_table(struct device *dev, return sg_table; } +EXPORT_SYMBOL_GPL(tmc_alloc_sg_table); /* * tmc_sg_table_sync_data_range: Sync the data buffer written @@ -360,6 +362,7 @@ void tmc_sg_table_sync_data_range(struct tmc_sg_table *table, PAGE_SIZE, DMA_FROM_DEVICE); } } +EXPORT_SYMBOL_GPL(tmc_sg_table_sync_data_range); /* tmc_sg_sync_table: Sync the page table */ void tmc_sg_table_sync_table(struct tmc_sg_table *sg_table) @@ -372,6 +375,7 @@ void tmc_sg_table_sync_table(struct tmc_sg_table *sg_table) dma_sync_single_for_device(real_dev, table_pages->daddrs[i], PAGE_SIZE, DMA_TO_DEVICE); } +EXPORT_SYMBOL_GPL(tmc_sg_table_sync_table); /* * tmc_sg_table_get_data: Get the buffer pointer for data @offset @@ -401,6 +405,7 @@ ssize_t tmc_sg_table_get_data(struct tmc_sg_table *sg_table, *bufpp = page_address(data_pages->pages[pg_idx]) + pg_offset; return len; } +EXPORT_SYMBOL_GPL(tmc_sg_table_get_data); #ifdef ETR_SG_DEBUG /* Map a dma address to virtual address */ @@ -766,6 +771,7 @@ tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) return NULL; } +EXPORT_SYMBOL_GPL(tmc_etr_get_catu_device); static inline int tmc_etr_enable_catu(struct tmc_drvdata *drvdata, struct etr_buf *etr_buf) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index ae40bb0539fd..d1aea3a1e7b6 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -54,6 +54,7 @@ static struct list_head *stm_path; * it needs to look for another sync sequence. */ const u32 coresight_barrier_pkt[4] = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; +EXPORT_SYMBOL_GPL(coresight_barrier_pkt); static int coresight_id_match(struct device *dev, void *data) { @@ -179,6 +180,7 @@ int coresight_claim_device_unlocked(void __iomem *base) coresight_clear_claim_tags(base); return -EBUSY; } +EXPORT_SYMBOL_GPL(coresight_claim_device_unlocked); int coresight_claim_device(void __iomem *base) { @@ -190,6 +192,7 @@ int coresight_claim_device(void __iomem *base) return rc; } +EXPORT_SYMBOL_GPL(coresight_claim_device); /* * coresight_disclaim_device_unlocked : Clear the claim tags for the device. @@ -208,6 +211,7 @@ void coresight_disclaim_device_unlocked(void __iomem *base) */ WARN_ON_ONCE(1); } +EXPORT_SYMBOL_GPL(coresight_disclaim_device_unlocked); void coresight_disclaim_device(void __iomem *base) { @@ -215,6 +219,7 @@ void coresight_disclaim_device(void __iomem *base) coresight_disclaim_device_unlocked(base); CS_LOCK(base); } +EXPORT_SYMBOL_GPL(coresight_disclaim_device); /* enable or disable an associated CTI device of the supplied CS device */ static int @@ -467,6 +472,7 @@ void coresight_disable_path(struct list_head *path) { coresight_disable_path_from(path, NULL); } +EXPORT_SYMBOL_GPL(coresight_disable_path); int coresight_enable_path(struct list_head *path, u32 mode, void *sink_data) { @@ -1368,6 +1374,7 @@ int coresight_timeout(void __iomem *addr, u32 offset, int position, int value) return -EAGAIN; } +EXPORT_SYMBOL_GPL(coresight_timeout); struct bus_type coresight_bustype = { .name = "coresight", @@ -1544,6 +1551,7 @@ bool coresight_loses_context_with_cpu(struct device *dev) return fwnode_property_present(dev_fwnode(dev), "arm,coresight-loses-context-with-cpu"); } +EXPORT_SYMBOL_GPL(coresight_loses_context_with_cpu); /* * coresight_alloc_device_name - Get an index for a given device in the From patchwork Mon Sep 28 16:34:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804077 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 3EBCF139A for ; Mon, 28 Sep 2020 16:38:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 11C422080C for ; Mon, 28 Sep 2020 16:38:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DzyXNngT"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SKEOX13/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11C422080C 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=merlin.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=9nqVQ6jvcSuajiA0KOeDwaDA7T474nflt37H+ZG/xTI=; b=DzyXNngTNNzJEJBAt70O8dBfS M7xe2uc+0uqAoRwIhlinIj2lvbVRd8T2CS5dJXmjKeJeF8lBke0iWuuUwqs/IH9zdAipU2FKSxDQW sNqdPFTFGZimGIxD55usrnQAMkcNzicoEf2By/fWTx7uUquVvlmTjRxqqQG+rgdkc2d70T/Idm1D/ gAjZueAggrK1/QibbnR6HCDepQkmrkSKVb5Bs3ug08bT+yOc82v7fNsh3XRh0CGleCEPRY60AZtx6 HqJhSqzGl8l47yx3uhdpfakHGuIDxN+V4g10D3Pk6OVKJ4v3xgvMhzFS6PMAPqVCpuLoI+mQ2gBs9 B0wKszt+Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw8a-0000vZ-45; Mon, 28 Sep 2020 16:36:28 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7X-0000XN-9f for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:28 +0000 Received: by mail-pf1-x441.google.com with SMTP id d9so1531018pfd.3 for ; Mon, 28 Sep 2020 09:35:23 -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=Ez4LWIQoeyGf2VTxB83p0ifF8EHclgO0IOs2psbJ0hU=; b=SKEOX13/WnvoWJd9IhPVayw5UH+4LkiPWZmUtQ6QVkceYFlowc61HnDyhaQRfC7q3n IRHXvJFSsIcvH3PXoyFuESFdztXAPJRiYeXfNQ1i2FBnpu8Gh0/qaFykKcjuG7Iqk/FZ fHvXAu08YsGb0I0NNm3Of+Lme9zidVmtDbKyiOUj9yMWl3HweHjFxOX/kWuCSzL52/z0 7C3v/6nImfrG/Q+DumpD+mFCMDCy5/z3mkvp37ryW2eBkTCihHw886rIoJJl3ps/UtA1 RRXB/PB8Cag00NCjmpiP6iqpqs4u8e2GZowtzsKtYjzBJ/xiRcVAR9UtQUj9wPbUp8lr J4Gw== 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=Ez4LWIQoeyGf2VTxB83p0ifF8EHclgO0IOs2psbJ0hU=; b=HPr1fMQOE7aDV8+MdcqROydDEDsg+mOcU+rpi45Dv9oly+fL34h9/Vt0TqlquoeJ/v AEegLvdOHL29CPWXA1iVFW4phtzvoL044SbWwgOKNn3cDViHPr1PZlJwsIy7GlNENAVj 7N9qWfNO3ksiCf/fa5Aq+zuHe3CENupgh0qFhr3EZMXJQXQdUlNl/MtIJkzWLOLu7PfC ggSyvX8pjtv7FgfX6QJtkGHmR+vvnGb8szDk3aovhBBa1yLVGf4sUzUJYROUDONh5WZb ZVGmvBTcAPng83LsZkgjUc91uIZ+VErBw+d3uPJ2oVZlBmj4dulHqRvZV2lbuCKVu5YR ZAdw== X-Gm-Message-State: AOAM530eSHImoQaQ14LJ+sUpbQ69A51eDMWpJslIaRWoiw4KtwfLLXHx 3RlIv7NUXtUg/bSD63qTdK+BBg== X-Google-Smtp-Source: ABdhPJxPedhVcg8S3n31HR9Hw3o8M9RSKN43o1bmDzOqCJZmi4xgcBsE3zwzb6QqNCmsBvlq3TpT6g== X-Received: by 2002:a62:cfc4:0:b029:142:440e:231d with SMTP id b187-20020a62cfc40000b0290142440e231dmr218346pfg.7.1601310921347; Mon, 28 Sep 2020 09:35:21 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:20 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 06/25] coresight: Add try_get_module() in coresight_grab_device() Date: Mon, 28 Sep 2020 10:34:54 -0600 Message-Id: <20200928163513.70169-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123523_407158_D1DE6F54 X-CRM114-Status: GOOD ( 23.22 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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:441 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang When coresight device is in an active session, driver module of that device should not be removed. Use try_get_module() in coresight_grab_device() to prevent module to be unloaded. Use get_device()/put_device() to protect device data in the middle of active session. Suggested-by: Suzuki K Poulose Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 60 ++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index d1aea3a1e7b6..4faa4aa3964d 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -629,13 +629,45 @@ struct coresight_device *coresight_get_sink_by_id(u32 id) return dev ? to_coresight_device(dev) : NULL; } +/** + * coresight_get_ref- Helper function to increase reference count to module + * and device. + * Return true in successful case and power up the device. + * Return false when failed to get reference of module. + */ +static inline bool coresight_get_ref(struct coresight_device *csdev) +{ + struct device *dev = csdev->dev.parent; + + /* Make sure the driver can't be removed */ + if (!try_module_get(dev->driver->owner)) + return false; + /* Make sure the device can't go away */ + get_device(dev); + pm_runtime_get_sync(dev); + return true; +} + +/** + * coresight_put_ref- Helper function to decrease reference count to module + * and device. Power off the device. + */ +static inline void coresight_put_ref(struct coresight_device *csdev) +{ + struct device *dev = csdev->dev.parent; + + pm_runtime_put(dev); + put_device(dev); + module_put(dev->driver->owner); +} + /* * coresight_grab_device - Power up this device and any of the helper * devices connected to it for trace operation. Since the helper devices * don't appear on the trace path, they should be handled along with the * the master device. */ -static void coresight_grab_device(struct coresight_device *csdev) +static int coresight_grab_device(struct coresight_device *csdev) { int i; @@ -644,9 +676,20 @@ static void coresight_grab_device(struct coresight_device *csdev) child = csdev->pdata->conns[i].child_dev; if (child && child->type == CORESIGHT_DEV_TYPE_HELPER) - pm_runtime_get_sync(child->dev.parent); + if (!coresight_get_ref(child)) + goto err; + } + if (coresight_get_ref(csdev)) + return 0; +err: + for (i--; i >= 0; i--) { + struct coresight_device *child; + + child = csdev->pdata->conns[i].child_dev; + if (child && child->type == CORESIGHT_DEV_TYPE_HELPER) + coresight_put_ref(child); } - pm_runtime_get_sync(csdev->dev.parent); + return -ENODEV; } /* @@ -657,13 +700,13 @@ static void coresight_drop_device(struct coresight_device *csdev) { int i; - pm_runtime_put(csdev->dev.parent); + coresight_put_ref(csdev); for (i = 0; i < csdev->pdata->nr_outport; i++) { struct coresight_device *child; child = csdev->pdata->conns[i].child_dev; if (child && child->type == CORESIGHT_DEV_TYPE_HELPER) - pm_runtime_put(child->dev.parent); + coresight_put_ref(child); } } @@ -682,7 +725,7 @@ static int _coresight_build_path(struct coresight_device *csdev, struct coresight_device *sink, struct list_head *path) { - int i; + int i, ret; bool found = false; struct coresight_node *node; @@ -712,11 +755,14 @@ static int _coresight_build_path(struct coresight_device *csdev, * is tell the PM runtime core we need this element and add a node * for it. */ + ret = coresight_grab_device(csdev); + if (ret) + return ret; + node = kzalloc(sizeof(struct coresight_node), GFP_KERNEL); if (!node) return -ENOMEM; - coresight_grab_device(csdev); node->csdev = csdev; list_add(&node->link, path); From patchwork Mon Sep 28 16:34:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804079 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 2995C139A for ; Mon, 28 Sep 2020 16:39:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 EEC8C214D8 for ; Mon, 28 Sep 2020 16:39:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PrJN8GxR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JjHQyvZe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEC8C214D8 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=merlin.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=gtk84wtmLeCMp7zpenrEoi1xIz83lEvaZR9ztYtyGR8=; b=PrJN8GxRFCig8T8nGrijsCa1n 88xMpmgAVpPBtXn3z9iyaqwRo6Rucykwn5fCCL+auNEV/oOz1wFFF5HxKDvkXLJ6siGVS9zfkq0Pt 73DuqSD+Q5FtZ7Ues8xzcGAgEMyoIkG11m1U0SG0GLBSAT6AJCkc3TDn/yfha5P+6xqeCRGOThzio odloHq+OF5iNOdxCl9AM09kMxCak7EZUtd84iarb6GgooRjfTEYRteAcmjoyhhtDzzCgZOxvDTedu CbKzDTdHHpRAe1nKzVPFBLSvmOgYhzsizzB/oOpA8qCn/o+RmmvygD8DN+ekU5OyawfK/um5d7cIE hQdXdA8nQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw92-00018i-RX; Mon, 28 Sep 2020 16:36:56 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7Y-0000Xf-It for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:29 +0000 Received: by mail-pg1-x543.google.com with SMTP id 197so1318076pge.8 for ; Mon, 28 Sep 2020 09:35:24 -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=O73kpBGGK8HOLylKY/q0Q1ivmjbxjRv7jyp1mVZ/xfA=; b=JjHQyvZem5pU93PCTLoPYqqGDRIMNVni4NYVyaBvYticDEgRkRpfWMdh/C+HAoe/Ve Tk24YuFhl2Tpf8La/RCfOlFcwklF+W1URx+BIYHWADuL+YtCfG1bTOjEUjDpvgIxPUtf WailIZkMRWt3+Kz0f99o+jzPVw63mrlEsir/DIIdFBKUawlGxKH4CNPqPEw7FvYB6nAz kWEuJtHWVvFceqismX3cvXZk0b+r+5ZIOhtqeu3dQhuJ2tUrRsLIA/8kdEbCsUauioD6 7ki0e/+DpMq+IhCmKSiSeLxU2MvH85Bpb4ZVykPLSXWLNby43yW1vVwuQqbHWE/RumWl t1AA== 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=O73kpBGGK8HOLylKY/q0Q1ivmjbxjRv7jyp1mVZ/xfA=; b=sdcE+PrX0PGHGVDpp//3BOI9inqow1rqgHCkNZxO7ZKb/95YpPc4GGFzVx4qYqy0nH 9x/tOx9mPdA7ZLxwnHzGdNN9JKwvfisR0bYrvR4IixijjB/9j0SH+6DD45ZSsD1n+NsJ 2LEUXE0uenB3L6hS5I4UKWW51sXg01oiImDRXICmwktFHoS5ER9ovF33yOc0S5hJgY9l G7DV31RHvUv2xFnLJKXug33IFLcmg3e8Y9GiRusia6P1hmLyT2kAhxnayo5BdH+LGw/D JFEDUPwAU4fdICnJRul8T7fq7q7HJbpBhDKKHaqeVcDlhRq2ybiRf6HUaPvcbjQLFlqY SmaA== X-Gm-Message-State: AOAM530t6rUzeNhrq/YJEVl8t1p+slvFhpeupcxVndIcLmjgj0i/Wg7S iuggmn+LBQpoEwXe2l5I+/s9T09tCa5rNQ== X-Google-Smtp-Source: ABdhPJx685Iufn2gqsCjBD//uq3ZXQDyAbAQhuKDHf1FWgHy/Qy1tzwHHREjEF87YYC8QG1UWzhaEQ== X-Received: by 2002:aa7:8299:0:b029:142:2501:397a with SMTP id s25-20020aa782990000b02901422501397amr288654pfm.63.1601310922393; Mon, 28 Sep 2020 09:35:22 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:21 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 07/25] coresight: stm: Allow to build coresight-stm as a module Date: Mon, 28 Sep 2020 10:34:55 -0600 Message-Id: <20200928163513.70169-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123524_684475_72526579 X-CRM114-Status: GOOD ( 19.57 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang - Kconfig becomes a tristate, to allow =m - add a stm_remove function, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 ++++- drivers/hwtracing/coresight/coresight-stm.c | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 4663fd1bbffc..6433f835fc97 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -86,7 +86,7 @@ config CORESIGHT_SOURCE_ETM4X data tracing may also be available. config CORESIGHT_STM - bool "CoreSight System Trace Macrocell driver" + tristate "CoreSight System Trace Macrocell driver" depends on (ARM && !(CPU_32v3 || CPU_32v4 || CPU_32v4T)) || ARM64 select CORESIGHT_LINKS_AND_SINKS select STM @@ -96,6 +96,9 @@ config CORESIGHT_STM logging useful software events or data coming from various entities in the system, possibly running different OSs + To compile this driver as a module, choose M here: the + module will be called coresight-stm. + config CORESIGHT_CPU_DEBUG tristate "CoreSight CPU Debug driver" depends on ARM || ARM64 diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 2ba819a47cf6..b0ad912651a9 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -951,6 +951,17 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int __exit stm_remove(struct amba_device *adev) +{ + struct stm_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); + + stm_unregister_device(&drvdata->stm); + + return 0; +} + #ifdef CONFIG_PM static int stm_runtime_suspend(struct device *dev) { @@ -983,6 +994,8 @@ static const struct amba_id stm_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, stm_ids); + static struct amba_driver stm_driver = { .drv = { .name = "coresight-stm", @@ -991,7 +1004,12 @@ static struct amba_driver stm_driver = { .suppress_bind_attrs = true, }, .probe = stm_probe, + .remove = stm_remove, .id_table = stm_ids, }; -builtin_amba_driver(stm_driver); +module_amba_driver(stm_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_DESCRIPTION("Arm CoreSight System Trace Macrocell driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:34:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804069 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 05A036CB for ; Mon, 28 Sep 2020 16:37:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B2D9D2080C for ; Mon, 28 Sep 2020 16:37:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ECtjl898"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wX2X5i59" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2D9D2080C 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=merlin.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=UQQ3wovTMYDFrDx7jaB+CHCQE8CC3+5ug1TgCBKW1vo=; b=ECtjl898S/iCOooo0ZgP6gCFe z6VJyFXqVPbgTN3kbVyEDPiPJbCv8hYQLn0tLRy5J8zC+Goalg3dhWAT71Fl2OyWxetZJHsl+mKR1 dQIDPshKmVqe9ZXv4QU4zzCle0DCGrNDCPbLXslCXWiqbLhgvDyIoPj8AcicGYMFVQurmn+1my5n4 aP/zPwDdRXMwxJE1FwauE899cY2+4yJ6D9SvuEBEgfHyJ74YVqtf9oEJ1Gkuljonwg/LXEqxCdbzq wYTl2drprJ7dNBLZIT9PU9sIGINqAGDUmIJP0W5SEkYncWAcVWUaAOlB1AexawLAXu4q9RrwfnIi9 MUlpSZirg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw8v-00013K-LT; Mon, 28 Sep 2020 16:36:49 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7Z-0000Y8-Mx for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:29 +0000 Received: by mail-pj1-x1042.google.com with SMTP id a9so979915pjg.1 for ; Mon, 28 Sep 2020 09:35:25 -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=XKxXl3MciKAKZSXIF+TmSJQtPsXbnsXWSEMuZ9mJPpY=; b=wX2X5i59Q63zjV8FYOMQuBp2F1hmgrLrZqqrLaKd4BDNrFbhimrmks4UAk17E/DdEs 0b3VI/DqBsXAS9EKSrgz4xpOwh/vYMpG5MQnmTbfelr5mKyG6t/Pj+QJTxGGC3oyAd7d Fa9fVMlDS3nHJ0ZuHq1Xm+0QP3tTrmrdvlsM2epdkuUd5WlhVCHLzWQ7EoTMxlX7JZFq 8ExavDjFgiiwaQ5L6cXoQYvbqkl/IFVHVoD6aGO0HSyFqo++UiNjX7og4SNffWb6oZ4z vEPhZJ98iwTd5zQHZlCNvraJkehqL6SMQqG75AOw+eeEjW3mSA6ZS/E4ERKLWBsnoe0w OcVQ== 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=XKxXl3MciKAKZSXIF+TmSJQtPsXbnsXWSEMuZ9mJPpY=; b=neAXKR3+Xb/Jc+WCQEKWF7p4wIDuvvBHkCG8m1Zyjcn/9QloZNSDzzhSzxFGnNj2v5 ODSUrmbuGdJspsFIPym9mdlyMskO0R463s4S2y3zex5hrfU527Ewhn6YoBE2MyGjmFsZ lXsSLiZmp8f8XRvBfqzoAspy7T5f0+1iappfUsp6DX+n2umG81HNNBFL2vxClvK0xV23 3aptV4OWL3hxZO6VNjq4l3+Q86wMIpMddScPGIvkjm3TFfou/nXq0Oy7xiM3phjSuD+9 nEyaO2M/fyM5qZaLINX8jIblymtUqaDjGfdwWgGCH0gyQ5NJWJNI+GJxXYvOPwLqPYrr Ia1Q== X-Gm-Message-State: AOAM531gmADfqQYpd5y8PsC+6tH0r3q1UwptlFY+UD1H/B/nFMIq1gaY jGSOpWq9FSPQOSjhT5STbJc+2wOVm5iRWA== X-Google-Smtp-Source: ABdhPJwrpxepEEUzeifXDPbPFvqwiotsmJUpk/W7hkbqpR5y3xYF10rN2TWZlLJ0q9069FY8ZMGULg== X-Received: by 2002:a17:90b:1988:: with SMTP id mv8mr133408pjb.23.1601310923548; Mon, 28 Sep 2020 09:35:23 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:22 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 08/25] coresight: etm: perf: Fix warning caused by etm_setup_aux failure Date: Mon, 28 Sep 2020 10:34:56 -0600 Message-Id: <20200928163513.70169-9-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123525_833946_8EEB0105 X-CRM114-Status: GOOD ( 14.43 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang When coresight_build_path() fails on all the cpus, etm_setup_aux calls etm_free_aux() to free allocated event_data. WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty. Check event_data->snk_config is not NULL first to avoid this warning. Fixes: f5200aa9831f38 ("coresight: perf: Refactor function free_event_data()") Signed-off-by: Tingwei Zhang Reviewed-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 644805e0a9ec..47894a0dcf5e 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -126,10 +126,10 @@ static void free_sink_buffer(struct etm_event_data *event_data) cpumask_t *mask = &event_data->mask; struct coresight_device *sink; - if (WARN_ON(cpumask_empty(mask))) + if (!event_data->snk_config) return; - if (!event_data->snk_config) + if (WARN_ON(cpumask_empty(mask))) return; cpu = cpumask_first(mask); From patchwork Mon Sep 28 16:34:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804089 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 6C6F76CB for ; Mon, 28 Sep 2020 16:40:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 314F02080C for ; Mon, 28 Sep 2020 16:40:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="k2UUAk3V"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="srvl1dUu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 314F02080C 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=merlin.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=PfUOqocjH1TezwqChwMEWeAqZWdmOq0zTTHKN9vuuXw=; b=k2UUAk3VzeKvGAGS4SHMRoTEW lEIbSdtsILLpjaH5zUkvK3ukhFnh2HMyrr2DCRc4+KIfcJ9fl7xkj4oyteAA45H5CX/BQcA1isxO2 vF1WtVmvY8Hc6J8peKDO/bqwKBI9orGpW7+qfRbovEQS5taHFJ19T291O4lIihG+ScWx+hoF1EWiu 5+j/Xz6OTcNekHVO68xapufYhxkS+HeMXkej40BpO6BDTTy1sJ2nUClcsOSJITSnUwMM6oE55BmGk zF6FF8TSyk3fu/B4NfppY0R0rxl8fRC6Ge1D0b36kGhqUxbmrmTaOoNlex5hNTDrIdUZrowesaTxc xHNd+GOGQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwAf-0001k0-3T; Mon, 28 Sep 2020 16:38:37 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7a-0000Yd-GZ for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:32 +0000 Received: by mail-pg1-x542.google.com with SMTP id m34so1315557pgl.9 for ; Mon, 28 Sep 2020 09:35:26 -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=4QN691BXao3PnqcNAUhINxRttOXk+OwnyXq6jctViII=; b=srvl1dUuIyNeF9lSxf7h8DgWXz3vjSS9TIQPSbmIWzW2KZes294tXMwgvCtmgPXZM2 IOtKwDNM2AeX2Vj1ZSS7Yzy9NR+7adH7K2rLuGLh2+gEOjfWk3pNOzoNJkwMadPWAXR4 HoNmTk5pg6oCICD/yTlsc0Q3TM5tyAv9g+PMlCqt4e9JyPcDAAnjn3E26wItt0zVevpY L2e0evrOi3mixMYF5jLDzSkzxraLUUYOO9DyMhFACqbFsOVfDr6nZfO7PRQuUtRC52Ip bVGVnXkTbvM1x03K7M75h9+S8kmsm+G3GVFLASQHwz3aftbBCvaCOQfTBM7jRFEGmtAK OELQ== 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=4QN691BXao3PnqcNAUhINxRttOXk+OwnyXq6jctViII=; b=FhxbSOYj++qYrjgBIQorb0aXih5PQOcjtjqQ+Z0+6RgBt4TpNpsO9eTmFHQ4c9IqCA RIB/betkWQnwLVnbk1cCU9vQJeC6QtoRSZjCGBtzxDhdCOZI7jFHFpqdisKN3FhrWBpp 9mkOkZhvH3uqzFD/e2vwuHfNyMfGFWSilH7rpZGJFdxCh8xm+1Xlm0rp0EJF+Ftx4Tk+ EuRMn5BlzhHdK6+ULXhoX2HQI65MdPNyGBH4Xw3DPWFXr1PYejvTIOudP95qBgLW/0/u WI3u4VlBZmt1KKDiD3M6MYXTWfjMu3Of/M8X/PJh8hajjzuBRvzHX4SM/SStjgi6mXZH jYtw== X-Gm-Message-State: AOAM530oos26GaGLu+PsTQmJsyTI4GDK8BEAITcCyA/RkJZRiOPZbgwe 8dHXw84oFSak21C9mdJLGnw2ag== X-Google-Smtp-Source: ABdhPJyy2hBUA0XfPWRwLYXR6S3zVE5i2+XVuZPlltHyS51ngnfJF8pX+uJWzKLrFhQ8NyvGspSoxQ== X-Received: by 2002:a17:902:a982:b029:d2:8cba:921b with SMTP id bh2-20020a170902a982b02900d28cba921bmr264678plb.50.1601310924619; Mon, 28 Sep 2020 09:35:24 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:24 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 09/25] coresight: etm3x: Allow etm3x to be built as a module Date: Mon, 28 Sep 2020 10:34:57 -0600 Message-Id: <20200928163513.70169-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123526_600762_BCE005C0 X-CRM114-Status: GOOD ( 25.86 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Kim Phillips Allow to build coresight-etm3x as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - append -core to source file name to allow module to be called coresight-etm3x by the Makefile - add an etm_remove function, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot - delay advertising the per-cpu etmdrvdata - protect etmdrvdata[] by modifying it on relevant CPU Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Reviewed-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 +- drivers/hwtracing/coresight/Makefile | 5 +- ...resight-etm3x.c => coresight-etm3x-core.c} | 154 +++++++++++++----- 3 files changed, 122 insertions(+), 42 deletions(-) rename drivers/hwtracing/coresight/{coresight-etm3x.c => coresight-etm3x-core.c} (90%) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 6433f835fc97..8fd9fd139cf3 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -65,7 +65,7 @@ config CORESIGHT_SINK_ETBV10 special enhancement or added features. config CORESIGHT_SOURCE_ETM3X - bool "CoreSight Embedded Trace Macrocell 3.x driver" + tristate "CoreSight Embedded Trace Macrocell 3.x driver" depends on !ARM64 select CORESIGHT_LINKS_AND_SINKS help @@ -74,6 +74,9 @@ config CORESIGHT_SOURCE_ETM3X This is primarily useful for instruction level tracing. Depending the ETM version data tracing may also be available. + To compile this driver as a module, choose M here: the + module will be called coresight-etm3x. + config CORESIGHT_SOURCE_ETM4X bool "CoreSight Embedded Trace Macrocell 4.x driver" depends on ARM64 diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 19497d1d92bf..86b4648844b4 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -11,8 +11,9 @@ obj-$(CONFIG_CORESIGHT_SINK_TPIU) += coresight-tpiu.o obj-$(CONFIG_CORESIGHT_SINK_ETBV10) += coresight-etb10.o obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-funnel.o \ coresight-replicator.o -obj-$(CONFIG_CORESIGHT_SOURCE_ETM3X) += coresight-etm3x.o coresight-etm-cp14.o \ - coresight-etm3x-sysfs.o +obj-$(CONFIG_CORESIGHT_SOURCE_ETM3X) += coresight-etm3x.o +coresight-etm3x-y := coresight-etm3x-core.o coresight-etm-cp14.o \ + coresight-etm3x-sysfs.o obj-$(CONFIG_CORESIGHT_SOURCE_ETM4X) += coresight-etm4x.o \ coresight-etm4x-sysfs.o obj-$(CONFIG_CORESIGHT_STM) += coresight-stm.o diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c similarity index 90% rename from drivers/hwtracing/coresight/coresight-etm3x.c rename to drivers/hwtracing/coresight/coresight-etm3x-core.c index bf22dcfd3327..47f610b1c2b1 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -40,8 +40,6 @@ static int boot_enable; module_param_named(boot_enable, boot_enable, int, S_IRUGO); -/* The number of ETM/PTM currently registered */ -static int etm_count; static struct etm_drvdata *etmdrvdata[NR_CPUS]; static enum cpuhp_state hp_online; @@ -782,6 +780,42 @@ static void etm_init_trace_id(struct etm_drvdata *drvdata) drvdata->traceid = coresight_get_trace_id(drvdata->cpu); } +static int __init etm_hp_setup(void) +{ + int ret; + + ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING, + "arm/coresight:starting", + etm_starting_cpu, etm_dying_cpu); + + if (ret) + return ret; + + ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN, + "arm/coresight:online", + etm_online_cpu, NULL); + + /* HP dyn state ID returned in ret on success */ + if (ret > 0) { + hp_online = ret; + return 0; + } + + /* failed dyn state - remove others */ + cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); + + return ret; +} + +static void etm_hp_clear(void) +{ + cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); + if (hp_online) { + cpuhp_remove_state_nocalls(hp_online); + hp_online = 0; + } +} + static int etm_probe(struct amba_device *adev, const struct amba_id *id) { int ret; @@ -823,39 +857,20 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) if (!desc.name) return -ENOMEM; - cpus_read_lock(); - etmdrvdata[drvdata->cpu] = drvdata; - if (smp_call_function_single(drvdata->cpu, etm_init_arch_data, drvdata, 1)) dev_err(dev, "ETM arch init failed\n"); - if (!etm_count++) { - cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ARM_CORESIGHT_STARTING, - "arm/coresight:starting", - etm_starting_cpu, etm_dying_cpu); - ret = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN, - "arm/coresight:online", - etm_online_cpu, NULL); - if (ret < 0) - goto err_arch_supported; - hp_online = ret; - } - cpus_read_unlock(); - - if (etm_arch_supported(drvdata->arch) == false) { - ret = -EINVAL; - goto err_arch_supported; - } + if (etm_arch_supported(drvdata->arch) == false) + return -EINVAL; etm_init_trace_id(drvdata); etm_set_default(&drvdata->config); pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto err_arch_supported; - } + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; desc.type = CORESIGHT_DEV_TYPE_SOURCE; @@ -865,17 +880,17 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) desc.dev = dev; desc.groups = coresight_etm_groups; drvdata->csdev = coresight_register(&desc); - if (IS_ERR(drvdata->csdev)) { - ret = PTR_ERR(drvdata->csdev); - goto err_arch_supported; - } + if (IS_ERR(drvdata->csdev)) + return PTR_ERR(drvdata->csdev); ret = etm_perf_symlink(drvdata->csdev, true); if (ret) { coresight_unregister(drvdata->csdev); - goto err_arch_supported; + return ret; } + etmdrvdata[drvdata->cpu] = drvdata; + pm_runtime_put(&adev->dev); dev_info(&drvdata->csdev->dev, "%s initialized\n", (char *)coresight_get_uci_data(id)); @@ -885,14 +900,40 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) } return 0; +} -err_arch_supported: - if (--etm_count == 0) { - cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); - if (hp_online) - cpuhp_remove_state_nocalls(hp_online); - } - return ret; +static void __exit clear_etmdrvdata(void *info) +{ + int cpu = *(int *)info; + + etmdrvdata[cpu] = NULL; +} + +static int __exit etm_remove(struct amba_device *adev) +{ + struct etm_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + etm_perf_symlink(drvdata->csdev, false); + + /* + * Taking hotplug lock here to avoid racing between etm_remove and + * CPU hotplug call backs. + */ + cpus_read_lock(); + /* + * The readers for etmdrvdata[] are CPU hotplug call backs + * and PM notification call backs. Change etmdrvdata[i] on + * CPU i ensures these call backs has consistent view + * inside one call back function. + */ + if (smp_call_function_single(drvdata->cpu, clear_etmdrvdata, &drvdata->cpu, 1)) + etmdrvdata[drvdata->cpu] = NULL; + + cpus_read_unlock(); + + coresight_unregister(drvdata->csdev); + + return 0; } #ifdef CONFIG_PM @@ -937,6 +978,8 @@ static const struct amba_id etm_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, etm_ids); + static struct amba_driver etm_driver = { .drv = { .name = "coresight-etm3x", @@ -945,6 +988,39 @@ static struct amba_driver etm_driver = { .suppress_bind_attrs = true, }, .probe = etm_probe, + .remove = etm_remove, .id_table = etm_ids, }; -builtin_amba_driver(etm_driver); + +static int __init etm_init(void) +{ + int ret; + + ret = etm_hp_setup(); + + /* etm_hp_setup() does its own cleanup - exit on error */ + if (ret) + return ret; + + ret = amba_driver_register(&etm_driver); + if (ret) { + pr_err("Error registering etm3x driver\n"); + etm_hp_clear(); + } + + return ret; +} + +static void __exit etm_exit(void) +{ + amba_driver_unregister(&etm_driver); + etm_hp_clear(); +} + +module_init(etm_init); +module_exit(etm_exit); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Program Flow Trace driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:34:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804093 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 B02CC139A for ; Mon, 28 Sep 2020 16:41:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 8390B208FE for ; Mon, 28 Sep 2020 16:41:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EM77grPX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CJtW7N5w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8390B208FE 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=merlin.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=eeNtNc7HO5n7rKA//Buow0C8CvGIWp2bdIymA6gAwxw=; b=EM77grPXEVrqmM1hhxXuDGqCR Y1bLE0y1szIHJ/0Ww6QLkOCRXa3I8EPv8y90AKBgCVe7Geq8FtfcTDBe7VzOzTTXHn998ijz84lJ+ Zx6BX9Ca9DNzkDVjIngodgL1DV8NjoxPQlGh5kJ++6+eZhExqM6Ek7+pKxBvMUDQBV4kQZpGVQJqT zWkZ+zWA6F1SF2fF2RE2/EfVmRK+LPq5K1XvwQwcrmqEtUY1ZqYiR0PsUGosPn4YvXSar4S2SJVYL 2iUGjFX0+m/H9tWHBjM9xltbpUkWOqJ3S/938mkbFa6co8303xL7KRNwLu+IMmLC9mAJVL778Ubwt zU3WPezLA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwBB-0001xV-2r; Mon, 28 Sep 2020 16:39:09 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7b-0000ZC-PU for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:33 +0000 Received: by mail-pf1-x443.google.com with SMTP id o20so1501831pfp.11 for ; Mon, 28 Sep 2020 09:35:27 -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=bZtzAoPbhcMJY41y/E57CaSilqkeyDxkF3e/HxapUoY=; b=CJtW7N5wojqdEzR6yH1IKjkVusNP++v4rfjscbesN5Q8gwOYxWyERVeJGeT9LLx7Lu Sy5G/mSkEzAZZPvE2w5fEaAOKOCd64by6tRpDX3nR2FI9pL8yF2Ot/LOWrUir45WayM9 jMoHEl19QZpFEmcrMsz+qOQGHGK8glJBKP8q2Z919C/s0c+eAnqZRCNJTYihH3pnQNQT mg0pkqS3R0sqH2FktJJV2knvB7Ky/5glIem4BEgob0N/xjFd27/XQxZyExdCi1rlV3x5 qL4AcxylZsrFFcDxexmwFavlU6WiIDNk3UKpqw1Lxf6Q5oXBItpmeJD+6g1WdkpUOEiU 6aVg== 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=bZtzAoPbhcMJY41y/E57CaSilqkeyDxkF3e/HxapUoY=; b=t9gD1T6T6CBPBy0Y15YRzccGIQBjDCb7gTLQQ+k6SbJ3bzdfrJmWnoxr953iDytkK4 AMj6TYiriUBKhJsQHFOi0QsmmwAG4LLmE/GqOe+/Lk0EFF06bdycl3MG4mvBFK5k53s3 Q4sfAJsmVs6uxzlSnfAa0mwIl3unIGYaD+eg/s2gZdYD48vGrViY99kDC0afCaD7uRH0 42XdO0kvrXtST4XZNheKyF8CcSooNkE21/wfeRQpEx9MZPpOfjmc8VCS9ILM4f3Gt81A H7SEXDmiLoWIP+4PcZQHDoLuQDczmpgUaChqMs9ZLpxxW7g2zDb+7BvHZcfXSxPpNWIf IebA== X-Gm-Message-State: AOAM531TTxTc87zh/hijCP2Y2Lggzgr+Cp1Ortb6Kg6TbZhB05nsJb9m cSKsfUUeB1jTt68KX4SfdtJ1YLx+afxLRg== X-Google-Smtp-Source: ABdhPJxHZNeEmhFCGRYjsZU6E0X39hzL6gpcD0779Xe5/IV4IZmWiOLxegHmlk1aqbpoWyceCh3Rew== X-Received: by 2002:a17:902:ec02:b029:d1:fc2b:fe95 with SMTP id l2-20020a170902ec02b02900d1fc2bfe95mr318906pld.79.1601310925613; Mon, 28 Sep 2020 09:35:25 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:25 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 10/25] coresight: etm4x: Allow etm4x to be built as a module Date: Mon, 28 Sep 2020 10:34:58 -0600 Message-Id: <20200928163513.70169-11-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123527_921357_2BDF4BB0 X-CRM114-Status: GOOD ( 24.13 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Kim Phillips Allow to build coresight-etm4x as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - append -core to source file name to allow module to be called coresight-etm4x by the Makefile - add an etm4_remove function, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot - delay advertising the per-cpu etmdrvdata - protect etmdrvdata[] by modifying it on relevant CPU Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 +- drivers/hwtracing/coresight/Makefile | 4 +- ...resight-etm4x.c => coresight-etm4x-core.c} | 84 ++++++++++++++----- 3 files changed, 69 insertions(+), 24 deletions(-) rename drivers/hwtracing/coresight/{coresight-etm4x.c => coresight-etm4x-core.c} (96%) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 8fd9fd139cf3..d6e107bbd30b 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -78,7 +78,7 @@ config CORESIGHT_SOURCE_ETM3X module will be called coresight-etm3x. config CORESIGHT_SOURCE_ETM4X - bool "CoreSight Embedded Trace Macrocell 4.x driver" + tristate "CoreSight Embedded Trace Macrocell 4.x driver" depends on ARM64 select CORESIGHT_LINKS_AND_SINKS select PID_IN_CONTEXTIDR @@ -88,6 +88,9 @@ config CORESIGHT_SOURCE_ETM4X for instruction level tracing. Depending on the implemented version data tracing may also be available. + To compile this driver as a module, choose M here: the + module will be called coresight-etm4x. + config CORESIGHT_STM tristate "CoreSight System Trace Macrocell driver" depends on (ARM && !(CPU_32v3 || CPU_32v4 || CPU_32v4T)) || ARM64 diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 86b4648844b4..3f2b057443fb 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -14,8 +14,8 @@ obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-funnel.o \ obj-$(CONFIG_CORESIGHT_SOURCE_ETM3X) += coresight-etm3x.o coresight-etm3x-y := coresight-etm3x-core.o coresight-etm-cp14.o \ coresight-etm3x-sysfs.o -obj-$(CONFIG_CORESIGHT_SOURCE_ETM4X) += coresight-etm4x.o \ - coresight-etm4x-sysfs.o +obj-$(CONFIG_CORESIGHT_SOURCE_ETM4X) += coresight-etm4x.o +coresight-etm4x-y := coresight-etm4x-core.o coresight-etm4x-sysfs.o obj-$(CONFIG_CORESIGHT_STM) += coresight-stm.o obj-$(CONFIG_CORESIGHT_CPU_DEBUG) += coresight-cpu-debug.o obj-$(CONFIG_CORESIGHT_CATU) += coresight-catu.o diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c similarity index 96% rename from drivers/hwtracing/coresight/coresight-etm4x.c rename to drivers/hwtracing/coresight/coresight-etm4x-core.c index f5ab13aaecea..de76d57850bc 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1447,7 +1447,7 @@ static int __init etm4_pm_setup(void) return ret; } -static void __init etm4_pm_clear(void) +static void etm4_pm_clear(void) { cpu_pm_unregister_notifier(&etm4_cpu_pm_nb); cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING); @@ -1504,25 +1504,20 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) if (!desc.name) return -ENOMEM; - etmdrvdata[drvdata->cpu] = drvdata; - if (smp_call_function_single(drvdata->cpu, etm4_init_arch_data, drvdata, 1)) dev_err(dev, "ETM arch init failed\n"); - if (etm4_arch_supported(drvdata->arch) == false) { - ret = -EINVAL; - goto err_arch_supported; - } + if (etm4_arch_supported(drvdata->arch) == false) + return -EINVAL; etm4_init_trace_id(drvdata); etm4_set_default(&drvdata->config); pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto err_arch_supported; - } + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; desc.type = CORESIGHT_DEV_TYPE_SOURCE; @@ -1532,17 +1527,17 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) desc.dev = dev; desc.groups = coresight_etmv4_groups; drvdata->csdev = coresight_register(&desc); - if (IS_ERR(drvdata->csdev)) { - ret = PTR_ERR(drvdata->csdev); - goto err_arch_supported; - } + if (IS_ERR(drvdata->csdev)) + return PTR_ERR(drvdata->csdev); ret = etm_perf_symlink(drvdata->csdev, true); if (ret) { coresight_unregister(drvdata->csdev); - goto err_arch_supported; + return ret; } + etmdrvdata[drvdata->cpu] = drvdata; + pm_runtime_put(&adev->dev); dev_info(&drvdata->csdev->dev, "CPU%d: ETM v%d.%d initialized\n", drvdata->cpu, drvdata->arch >> 4, drvdata->arch & 0xf); @@ -1553,10 +1548,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) } return 0; - -err_arch_supported: - etmdrvdata[drvdata->cpu] = NULL; - return ret; } static struct amba_cs_uci_id uci_id_etm4[] = { @@ -1568,6 +1559,40 @@ static struct amba_cs_uci_id uci_id_etm4[] = { } }; +static void __exit clear_etmdrvdata(void *info) +{ + int cpu = *(int *)info; + + etmdrvdata[cpu] = NULL; +} + +static int __exit etm4_remove(struct amba_device *adev) +{ + struct etmv4_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + etm_perf_symlink(drvdata->csdev, false); + + /* + * Taking hotplug lock here to avoid racing between etm4_remove and + * CPU hotplug call backs. + */ + cpus_read_lock(); + /* + * The readers for etmdrvdata[] are CPU hotplug call backs + * and PM notification call backs. Change etmdrvdata[i] on + * CPU i ensures these call backs has consistent view + * inside one call back function. + */ + if (smp_call_function_single(drvdata->cpu, clear_etmdrvdata, &drvdata->cpu, 1)) + etmdrvdata[drvdata->cpu] = NULL; + + cpus_read_unlock(); + + coresight_unregister(drvdata->csdev); + + return 0; +} + static const struct amba_id etm4_ids[] = { CS_AMBA_ID(0x000bb95d), /* Cortex-A53 */ CS_AMBA_ID(0x000bb95e), /* Cortex-A57 */ @@ -1587,12 +1612,16 @@ static const struct amba_id etm4_ids[] = { {}, }; +MODULE_DEVICE_TABLE(amba, etm4_ids); + static struct amba_driver etm4x_driver = { .drv = { .name = "coresight-etm4x", + .owner = THIS_MODULE, .suppress_bind_attrs = true, }, .probe = etm4_probe, + .remove = etm4_remove, .id_table = etm4_ids, }; @@ -1614,4 +1643,17 @@ static int __init etm4x_init(void) return ret; } -device_initcall(etm4x_init); + +static void __exit etm4x_exit(void) +{ + amba_driver_unregister(&etm4x_driver); + etm4_pm_clear(); +} + +module_init(etm4x_init); +module_exit(etm4x_exit); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Program Flow Trace v4.x driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:34:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804075 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 ED1EF139F for ; Mon, 28 Sep 2020 16:38:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 916CD214D8 for ; Mon, 28 Sep 2020 16:38:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VQJoMEFj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BMR/O8qe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 916CD214D8 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=merlin.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=x4DQhLls6smKca2EAMgNlAwGS+CCBnnUHwcmZk7gsys=; b=VQJoMEFjcY/kMrBYZlR+6+6aG AMA7J1B37g8BUNMgTf8fvRCpC/NMq46M0WTW4e6/Z0rzfn0bpxd1huxAyvEQOeHmb0l9adQBH2dBF GK4bqG/xQPoSXKI7rOnmABycx70MF1AI8U+NWgPMJi+w0fixluXl8NIOrdY+JUQM5FQtxe2jvifsr 94VxyQ+SWd8u/kUf2mPxyfRL+kWEZtYg8bMeH4BjUE3lVlHk1L8pnKU33J0TyAKX4xyg2+uNzXOYJ NXbrgKZGVAIpdfv0nJIVqff7KzbSUrO4irOgpM0E/ip6AqLH2lsIsxMuCJHSSRSxIZEEHjYp99mOD OP+LeUQxw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw9f-0001KZ-En; Mon, 28 Sep 2020 16:37:35 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7c-0000ZY-Qt for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:32 +0000 Received: by mail-pf1-x444.google.com with SMTP id q123so1542313pfb.0 for ; Mon, 28 Sep 2020 09:35:28 -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=z2CmOiUqIi3yzFuKU+bzyeukQxjbaPfmw7sLG+1ioBo=; b=BMR/O8qe2rXvmTvc0vLb+ZJea/fudMosPiGJcAui+t2ZRn578HzmIA5MS/kjTuwR6+ khFkU9w7kBv4rCc14TyxBuPiMawXnsKmZu262ZRMK5f2kGulIDYZn97Z5G4Uh97GzPwk FIcMws2GFZP5pgukI8WVlpZ2VuK0FphAPtN++y3pZbyEXeJrWaFvQWSX7370fIKdHwx8 uHQGBBdVTqUjWQfHRsInMtauh2EqJB2fOt83dBXdu3WmvAHyehYS2eRbEORSXWe3jOxz ZsKSD17zQ+a6SCxCvBibdzCGfcfshZpX2RxJSNbCQuKneyd3zZkQciJgXIRAtwymc1Ab rLSA== 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=z2CmOiUqIi3yzFuKU+bzyeukQxjbaPfmw7sLG+1ioBo=; b=Y1HYZSXjqfD3SXmVxlM3BDHtiWPxRoBzzvkWnn80fq9/2MFze1KL5y+IhG7w2ENsYX CbydEhZ2DNl2YsFGRmx1pxOM/NGFQybwfcHrnG117Hnn0KzNFOivuQHkkqUwCblxbOwL rJ8NqjBGymmV+pxog7OLdd1vwYOMAmArv6+zHZncmp3Ein2PVr6kX0lYevbMs3CDxtWT GEOWvU3x1jIabQ/xOLHUwYCr7y9MstAeMssKYal508xX8+0Ue+mHHfu2UY5ebxz3seHm +MFVsUlmsH7SCwvrALF9rMOR7gPG3zxgkTQ8jJsRazSWVFh1ACw+rMZQ6NSJZHBDlN0u 6RPQ== X-Gm-Message-State: AOAM532OT+4OMh7U7vz8h573U+skK7D91pOB75pCyXtItXrJzCjPSkV/ EW4zGHqpemW9Aeg2tV2gGJkPmMV35SccRw== X-Google-Smtp-Source: ABdhPJzqJs2a3ir5T2VTqKg6xAe6GuQu//NZjLFcieRxcCk962PEym3sNugg9IaixbV7as1OdqAlWQ== X-Received: by 2002:a62:154b:0:b029:150:c091:7146 with SMTP id 72-20020a62154b0000b0290150c0917146mr220065pfv.80.1601310926652; Mon, 28 Sep 2020 09:35:26 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:26 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 11/25] coresight: etb: Allow etb to be built as a module Date: Mon, 28 Sep 2020 10:34:59 -0600 Message-Id: <20200928163513.70169-12-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123528_941291_D6CC18AC X-CRM114-Status: GOOD ( 22.05 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Kim Phillips Allow to build coresight-etb10 as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - add an etb_remove function, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 +++- drivers/hwtracing/coresight/coresight-etb10.c | 26 ++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index d6e107bbd30b..996d84a1edb8 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -57,13 +57,16 @@ config CORESIGHT_SINK_TPIU the on-board coresight memory can handle. config CORESIGHT_SINK_ETBV10 - bool "Coresight ETBv1.0 driver" + tristate "Coresight ETBv1.0 driver" depends on CORESIGHT_LINKS_AND_SINKS help This enables support for the Embedded Trace Buffer version 1.0 driver that complies with the generic implementation of the component without special enhancement or added features. + To compile this driver as a module, choose M here: the + module will be called coresight-etb10. + config CORESIGHT_SOURCE_ETM3X tristate "CoreSight Embedded Trace Macrocell 3.x driver" depends on !ARM64 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 04ee9cda988d..248cc82c838e 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -801,6 +801,21 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int __exit etb_remove(struct amba_device *adev) +{ + struct etb_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + /* + * Since misc_open() holds a refcount on the f_ops, which is + * etb fops in this case, device is there until last file + * handler to this device is closed. + */ + misc_deregister(&drvdata->miscdev); + coresight_unregister(drvdata->csdev); + + return 0; +} + #ifdef CONFIG_PM static int etb_runtime_suspend(struct device *dev) { @@ -835,6 +850,8 @@ static const struct amba_id etb_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, etb_ids); + static struct amba_driver etb_driver = { .drv = { .name = "coresight-etb10", @@ -844,6 +861,13 @@ static struct amba_driver etb_driver = { }, .probe = etb_probe, + .remove = etb_remove, .id_table = etb_ids, }; -builtin_amba_driver(etb_driver); + +module_amba_driver(etb_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Embedded Trace Buffer driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:35:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804081 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 2D3726CB for ; Mon, 28 Sep 2020 16:39:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B4D1F2080C for ; Mon, 28 Sep 2020 16:39: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="IPDgrkS5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wthzh4Pa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4D1F2080C 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=merlin.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=nPcs5qK0g8gOQ8Fg422ddcvkkC6JC1i3NRxUuy87W20=; b=IPDgrkS5eeC4lpdPIQszMDUtm uuZI/VdpX81mQC9X0m5ug7Kfftck265oCLtXflCgCH6vMJUJQpSvi9ZPJohTwAPYVXEqRSEC0tsw3 9TdLvHSghCqwUqZti0ApjJnNWgxi454DVj3hIlQ6sLups9YNBjTunLrNAVxi4nLkOpVPQVI/oXv1j 0PG/3piDH6UGiC9Sl4S/RUncqItaAnR46AZhZvWDW7j0TBJR+nRbtbi8B5s3wQ7pDqXj6inabW67I anN4LXpNnutHJA3OwuQNTyKRuF8uC/SCIuEhj1j9giwQV1AjPqB4+DxGtNd2Ru60jOuJWPffvUUWV YBS6qhMsQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwAu-0001qy-3s; Mon, 28 Sep 2020 16:38:52 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7d-0000a8-SI for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:33 +0000 Received: by mail-pf1-x442.google.com with SMTP id k13so1537665pfg.1 for ; Mon, 28 Sep 2020 09:35:29 -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=XaJPe7K+ZjHgHfXIN2qEoYr/QyZph8mHXWNbLeRPwdw=; b=wthzh4Pad4X5FxEjptnGzLoiFt/kjnaJISlMrfOG4+cU0QLHDj4oI53F5kzusDUwmv 4RV1Gpx4+IAYC1x4tiXM99rEJUoh/JFQMkdGiNWRIWcC1RYbIunyeGOBz8yex6NCou1f wvmppI2n7plE3FY34fQ5TkD8L3Q9+UQzegByyl8N9uZueTHB3HS4rSiuc1vJLLCW9sCr Re+UytA4k2pB62HyLVEFSwJFu2By8B2r8AD4uMqiWTzJVZ879PCD4qVakWK4F2zffR/i r0P/pz7HIR0KcfQ9u+pPV3fvm+qxXW6BvVuz6z3jE4WY2e4tOJy/0657j5XFUVgDhT6h Tg6Q== 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=XaJPe7K+ZjHgHfXIN2qEoYr/QyZph8mHXWNbLeRPwdw=; b=iXVjygqP4T263L5IyiNjwHGbdN2Xyn/cy7P3+SJK/MsHxSo3IgEFGcp1K/EVVqj0nY sJ1jNflFd1M2ZMz2abEZxY3m7KklMmPp7q5i6bc8UhRS6M81XFU4JszTk0X0S6VVurc5 pbiea2W2NxMd3EllnicDR+lx23bqLUhrqkK7ohkM0zQNOHj9HUWgUN8yFexjMMAYdiuU r94pCnnOE5XbotbkJx3TiP1EUi7BrTQPpF+h45AaHmg1blD1EvT85o3lri3QMkeJ3sHV QVYgWhcqzPDunthcoqb/kUROqyajMJ8GmW4/D4efBE9CZFoB6qhl64wge8GaiR40RCeF 3O0Q== X-Gm-Message-State: AOAM532vIT/I5qfNzsd+ZjibT8BQRHgmPRi6NsNr5+GjAsVvSFXXyzvT bPvWr4GGgBhKZi95P4Fo/JuCug== X-Google-Smtp-Source: ABdhPJz/QrA7wRRqiwNKrbNLcc+XS4F92IDbxzxfrd+pLXb0loh+r/vzqzVXnakXoDlRdQ0NDSuIQA== X-Received: by 2002:a17:902:7e0d:b029:d2:8ceb:ea4b with SMTP id b13-20020a1709027e0db02900d28cebea4bmr303249plm.59.1601310927714; Mon, 28 Sep 2020 09:35:27 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:27 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 12/25] coresight: tpiu: Allow tpiu to be built as a module Date: Mon, 28 Sep 2020 10:35:00 -0600 Message-Id: <20200928163513.70169-13-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123529_958511_80293C96 X-CRM114-Status: GOOD ( 20.49 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Kim Phillips Allow to build coresight-tpiu as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - add a tpiu_remove function, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Reviewed-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 ++++- drivers/hwtracing/coresight/coresight-tpiu.c | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 996d84a1edb8..8fd9887fb03b 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -46,7 +46,7 @@ config CORESIGHT_CATU mode where the address is not translated. config CORESIGHT_SINK_TPIU - bool "Coresight generic TPIU driver" + tristate "Coresight generic TPIU driver" depends on CORESIGHT_LINKS_AND_SINKS help This enables support for the Trace Port Interface Unit driver, @@ -56,6 +56,9 @@ config CORESIGHT_SINK_TPIU connected to an external host for use case capturing more traces than the on-board coresight memory can handle. + To compile this driver as a module, choose M here: the + module will be called coresight-tpiu. + config CORESIGHT_SINK_ETBV10 tristate "Coresight ETBv1.0 driver" depends on CORESIGHT_LINKS_AND_SINKS diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index f8583e4032a6..566c57e03596 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -173,6 +173,15 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR(drvdata->csdev); } +static int __exit tpiu_remove(struct amba_device *adev) +{ + struct tpiu_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); + + return 0; +} + #ifdef CONFIG_PM static int tpiu_runtime_suspend(struct device *dev) { @@ -216,6 +225,8 @@ static const struct amba_id tpiu_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, tpiu_ids); + static struct amba_driver tpiu_driver = { .drv = { .name = "coresight-tpiu", @@ -224,6 +235,13 @@ static struct amba_driver tpiu_driver = { .suppress_bind_attrs = true, }, .probe = tpiu_probe, + .remove = tpiu_remove, .id_table = tpiu_ids, }; -builtin_amba_driver(tpiu_driver); + +module_amba_driver(tpiu_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight TPIU (Trace Port Interface Unit) driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:35:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804083 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 A3F4C139A for ; Mon, 28 Sep 2020 16:39:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 713B62080C for ; Mon, 28 Sep 2020 16:39: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="pu5Kq2v+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tKlH6Q2n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 713B62080C 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=merlin.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=0E3KYbG7rQH8du5vFeYkKnNiaQqQuiDZ44GEG93S8Ok=; b=pu5Kq2v+8aPUdv+RJ8eBCAf83 QPMYx6OtlKk2y1Ma458shygCWvRGTeFIcerLHR7sR3pHTK+Q8ESpQF/ApUl5k0eocbCRM8YbipVdr mcefqkoVHEtki0ILaTQNZW1qFq2lfYHzgDOkdV//qnxwVBjY2ejY3XTHmiATMI1LY68QjR6rCx6TQ nEyCOdJjCUtocVEpbh0oawqWYKWvv08D7apKXK0QOGB4TMmGVo/7RMp+9tqPuK378JAOqCWUvfZY6 Vtist+sF+58agfGsSMWsVYCerbhNEI6YM1agJkq/EQXG/U8KqP6QMPosYTOGHmpUeHDQKr+SFTCY4 ZGWo/7VwA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwBc-00026K-Nx; Mon, 28 Sep 2020 16:39:36 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7f-0000am-2L for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:37 +0000 Received: by mail-pg1-x541.google.com with SMTP id 197so1318333pge.8 for ; Mon, 28 Sep 2020 09:35:30 -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=D3jVDw2F3FLGmwjOb7HhNx2sSGB+A2r03pvrlXP4qvw=; b=tKlH6Q2nCg7QhIkLFB8DujfYuejxynSpxjKqkvxOVgMyNH8ghIV6R0uITk5iR2YW2T X95Iu2I0Wnzg5WoRN21HX6BLmrHAhLbH35LIkSLgJX9zxxlVjVO1BliH15xURcsj/brO onRaI/htm7LHIVyEx+fJO/KvtdvEx7X5hb1k1dy2rKFZpdRlHfWmcAr4zzp61Nbwj1QG 57cHw3C44dNNmgu4HWA2FJ+PlFECr2bx8GggNMm8q5qNMSBgxVXEjE4nlDD7LV0HPFZe xpmF1jSA+7dJiCe0KWSQLW+Ax/S/vEeIswfyuZnmKwGaSBpGJMigmZe6kviQ7slGmwgS HJBg== 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=D3jVDw2F3FLGmwjOb7HhNx2sSGB+A2r03pvrlXP4qvw=; b=KRnGY05JTnH3gM6Zw32vjK2hRNLfFhv+wy4k00rXZpQDntYF/iI3AZvmQJawCOFTnF SyeLM0wkOFAwF6cYvcUGglcXznqq5AfqpX4Qf7Zjyw9isL4lGTityGTQabdGkjLxYqpl 3X6Y8qvMTVfupkZRKyvEyTdXJkvJiQFsdHtlFARejRtRC5HjX2H2r7rhENMCNXIwZmw+ SbwCsBKV/8kOnwtMnVE46Pxw0bwDKgc/zuKk3yVW/A25V4lHJmISL4NPbsRk+Fbbr66h RsOsBOkDBOvEoPU/k5wpW9mCP7BrzMx7lQTB6Mru5/wP+RG7f15536nCtqSyrGbnW+Re u2Aw== X-Gm-Message-State: AOAM533oGHOQobTW9ava8HJqWi2R6nXncw8F1ErNpfR5HlMB0+LwI4hZ ZV4gDMk2gPQZwmH6/+4ik/2LhPZyV+wQXg== X-Google-Smtp-Source: ABdhPJwJ4nykfCh9VS9dkXfNUx8G/MsHHxoNAxTMZpSm9SSuGCOV+t6xwvIqg3LI3qHWjS7GRT2Fbw== X-Received: by 2002:a17:902:7681:b029:d2:88b1:b130 with SMTP id m1-20020a1709027681b02900d288b1b130mr383548pll.20.1601310928915; Mon, 28 Sep 2020 09:35:28 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:28 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 13/25] coresight: tmc: Allow tmc to be built as a module Date: Mon, 28 Sep 2020 10:35:01 -0600 Message-Id: <20200928163513.70169-14-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123531_208304_294291D2 X-CRM114-Status: GOOD ( 21.74 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Kim Phillips Allow to build coresight-tmc as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - append -core to source file name to allow module to be called coresight-tmc by the Makefile - add an tmc_remove function, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 6 ++++- drivers/hwtracing/coresight/Makefile | 6 ++--- .../{coresight-tmc.c => coresight-tmc-core.c} | 25 ++++++++++++++++++- 3 files changed, 32 insertions(+), 5 deletions(-) rename drivers/hwtracing/coresight/{coresight-tmc.c => coresight-tmc-core.c} (95%) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 8fd9887fb03b..fc48ae086746 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -25,7 +25,8 @@ config CORESIGHT_LINKS_AND_SINKS entity at run time to form a complete trace path. config CORESIGHT_LINK_AND_SINK_TMC - bool "Coresight generic TMC driver" + tristate "Coresight generic TMC driver" + depends on CORESIGHT_LINKS_AND_SINKS help This enables support for the Trace Memory Controller driver. @@ -34,6 +35,9 @@ config CORESIGHT_LINK_AND_SINK_TMC complies with the generic implementation of the component without special enhancement or added features. + To compile this driver as a module, choose M here: the + module will be called coresight-tmc. + config CORESIGHT_CATU bool "Coresight Address Translation Unit (CATU) driver" depends on CORESIGHT_LINK_AND_SINK_TMC diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 3f2b057443fb..3dbd49a060dd 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -4,9 +4,9 @@ # 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 +obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o +coresight-tmc-y := coresight-tmc-core.o coresight-tmc-etf.o \ + coresight-tmc-etr.o obj-$(CONFIG_CORESIGHT_SINK_TPIU) += coresight-tpiu.o obj-$(CONFIG_CORESIGHT_SINK_ETBV10) += coresight-etb10.o obj-$(CONFIG_CORESIGHT_LINKS_AND_SINKS) += coresight-funnel.o \ diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc-core.c similarity index 95% rename from drivers/hwtracing/coresight/coresight-tmc.c rename to drivers/hwtracing/coresight/coresight-tmc-core.c index 9ca3aaafcfbc..5653e0945c74 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c @@ -559,6 +559,21 @@ static void tmc_shutdown(struct amba_device *adev) spin_unlock_irqrestore(&drvdata->spinlock, flags); } +static int __exit tmc_remove(struct amba_device *adev) +{ + struct tmc_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + /* + * Since misc_open() holds a refcount on the f_ops, which is + * etb fops in this case, device is there until last file + * handler to this device is closed. + */ + misc_deregister(&drvdata->miscdev); + coresight_unregister(drvdata->csdev); + + return 0; +} + static const struct amba_id tmc_ids[] = { CS_AMBA_ID(0x000bb961), /* Coresight SoC 600 TMC-ETR/ETS */ @@ -570,6 +585,8 @@ static const struct amba_id tmc_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, tmc_ids); + static struct amba_driver tmc_driver = { .drv = { .name = "coresight-tmc", @@ -578,6 +595,12 @@ static struct amba_driver tmc_driver = { }, .probe = tmc_probe, .shutdown = tmc_shutdown, + .remove = tmc_remove, .id_table = tmc_ids, }; -builtin_amba_driver(tmc_driver); + +module_amba_driver(tmc_driver); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_DESCRIPTION("Arm CoreSight Trace Memory Controller driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:35:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804097 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 87FAC6CB for ; Mon, 28 Sep 2020 16:42:01 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 1E0AE208FE for ; Mon, 28 Sep 2020 16:42:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="z9d4AdIu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MIB+37QM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E0AE208FE 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=merlin.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=uj5+X6taUsQpV9h/p1mScSbMarPSt/XAjOKbqnwW++w=; b=z9d4AdIuQis3X+90jJL8xGcUm YgmjV+2MHTRCkOnOacxRm76X/FohbefwwvYBDLFBKO2J3qOJi0CPxnX9Zup5bZbmn3OxKsXZJs3Px Y12tfgkAsPfXfXQLiIGvcwRekdo4k5/WmrXU87a/sOZQcOjDBwt7+TNxWINBRfIkPIbLIs6VYcici MZO+nmRU8yNXFVn81IdlpN+7pEAefAErLervbJt+Uy46GAwrV/BH0sqLAVlBNrJ7fJZOg+oSEq0R5 60BTurlCUQ5rbWoDMBs+/hYGhdBHBzS0lMf+tzufSpDCTZ6zSf41FcDtvVUBNL6LGEFNsCpDL6TI9 U70mYj4XQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwBj-0002Be-6g; Mon, 28 Sep 2020 16:39:43 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7f-0000bN-RP for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:37 +0000 Received: by mail-pg1-x542.google.com with SMTP id 7so1307744pgm.11 for ; Mon, 28 Sep 2020 09:35:31 -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=vMwbm6M17eoKIMI3/97ZhWWkuJ53zAySuNIn1r+zO7o=; b=MIB+37QMnkKch3OGAmY/TF8pDjDUOzFVG+pW4cC3/gjdCg7p2YD9kzGItbhRKuIm2t 3TvAZ7sR2kNtnUaPtAdSWgm5mpCgOdpTa8dhRhllIMkSlEMyEKJUmATRUvqzgwMLkl7U Co+BZCZhpTPhXitC9gSAr98vhuOr4a/cS2qkzb2jEgijldq3jCpjuCPX3csNA966edRV O9sB9MBBv5cRDQ7bgVRE2unoaWDbcwyYoexPHvMTCDrUzcCgaQU1LmnUdfusSnfWoHkG SdMp6nfVHe3PSftGHyz2YNEi2rdStKJM8lmc2T0TikeIeeK7SzKDUrAHNTBqDzLAYVfK emTg== 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=vMwbm6M17eoKIMI3/97ZhWWkuJ53zAySuNIn1r+zO7o=; b=nZoTkgu8JhJddKWKzFl87LYdfKCk+jGeNPBjutWNn7J8M7EY3QpdGqE4lQf1UhdCcJ 4MFxR7z/qcHXiR5S7htXqEin2qDLB1OEO3iF++CiQRv7Hu0+F/GgBMfcafSdf5ar41Dv wi7/5pnKvHV30hyuLh7XPYbIbwpkbw+5t6BAQowL2/AS+3NZeRYn5+ccZGMrjdPCjefe Uvl5HpKSI5WhFsoEUKsSJuGY7pqtmgIZBc5jD2jxVHzSojyKyuA+oPxxO4+QSYJ1EhvT ZyznTVK6S+AOCrvPUp+fq+MTfJJFd2cAOXwpEhaKs+3T7APQfXiZIj57GL2oGLE6Xura ZYvg== X-Gm-Message-State: AOAM532Cs6MIwc9FClivkFT6zssxXTMC7w/IpsN38yxfvqsczswPejLT ePnOGoPtnc1eTuCr7KtVIILim28C0g6iVA== X-Google-Smtp-Source: ABdhPJw9a0z4zuW2GGmK3wRCFrZbpPgX7Wrp96hGFD20ClnIyJq1ieH/D9WVbPRQ+bV8PB64NtOjYg== X-Received: by 2002:a63:1a66:: with SMTP id a38mr1736255pgm.253.1601310930011; Mon, 28 Sep 2020 09:35:30 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:29 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 14/25] coresight: funnel: Allow funnel driver to be built as module Date: Mon, 28 Sep 2020 10:35:02 -0600 Message-Id: <20200928163513.70169-15-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123531_926333_DA4DD038 X-CRM114-Status: GOOD ( 20.18 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Kim Phillips Allow to build coresight-funnel as module, for ease of development. - combine static and dynamic funnel init into single module_init/exit call - add funnel_remove functions, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Co-developed-by: Mian Yousaf Kaukab Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-funnel.c | 65 ++++++++++++++++++- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 900690a9f7f0..af40814ce560 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -274,6 +274,15 @@ static int funnel_probe(struct device *dev, struct resource *res) return ret; } +static int __exit funnel_remove(struct device *dev) +{ + struct funnel_drvdata *drvdata = dev_get_drvdata(dev); + + coresight_unregister(drvdata->csdev); + + return 0; +} + #ifdef CONFIG_PM static int funnel_runtime_suspend(struct device *dev) { @@ -319,29 +328,41 @@ static int static_funnel_probe(struct platform_device *pdev) return ret; } +static int __exit static_funnel_remove(struct platform_device *pdev) +{ + funnel_remove(&pdev->dev); + pm_runtime_disable(&pdev->dev); + return 0; +} + static const struct of_device_id static_funnel_match[] = { {.compatible = "arm,coresight-static-funnel"}, {} }; +MODULE_DEVICE_TABLE(of, static_funnel_match); + #ifdef CONFIG_ACPI static const struct acpi_device_id static_funnel_ids[] = { {"ARMHC9FE", 0}, {}, }; + +MODULE_DEVICE_TABLE(acpi, static_funnel_ids); #endif static struct platform_driver static_funnel_driver = { .probe = static_funnel_probe, + .remove = static_funnel_remove, .driver = { .name = "coresight-static-funnel", + .owner = THIS_MODULE, .of_match_table = static_funnel_match, .acpi_match_table = ACPI_PTR(static_funnel_ids), .pm = &funnel_dev_pm_ops, .suppress_bind_attrs = true, }, }; -builtin_platform_driver(static_funnel_driver); static int dynamic_funnel_probe(struct amba_device *adev, const struct amba_id *id) @@ -349,6 +370,11 @@ static int dynamic_funnel_probe(struct amba_device *adev, return funnel_probe(&adev->dev, &adev->res); } +static int __exit dynamic_funnel_remove(struct amba_device *adev) +{ + return funnel_remove(&adev->dev); +} + static const struct amba_id dynamic_funnel_ids[] = { { .id = 0x000bb908, @@ -362,6 +388,8 @@ static const struct amba_id dynamic_funnel_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, dynamic_funnel_ids); + static struct amba_driver dynamic_funnel_driver = { .drv = { .name = "coresight-dynamic-funnel", @@ -370,6 +398,39 @@ static struct amba_driver dynamic_funnel_driver = { .suppress_bind_attrs = true, }, .probe = dynamic_funnel_probe, + .remove = dynamic_funnel_remove, .id_table = dynamic_funnel_ids, }; -builtin_amba_driver(dynamic_funnel_driver); + +static int __init funnel_init(void) +{ + int ret; + + ret = platform_driver_register(&static_funnel_driver); + if (ret) { + pr_info("Error registering platform driver\n"); + return ret; + } + + ret = amba_driver_register(&dynamic_funnel_driver); + if (ret) { + pr_info("Error registering amba driver\n"); + platform_driver_unregister(&static_funnel_driver); + } + + return ret; +} + +static void __exit funnel_exit(void) +{ + platform_driver_unregister(&static_funnel_driver); + amba_driver_unregister(&dynamic_funnel_driver); +} + +module_init(funnel_init); +module_exit(funnel_exit); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Funnel Driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:35:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804085 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 9C5026CB for ; Mon, 28 Sep 2020 16:40:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 6EFA32080C for ; Mon, 28 Sep 2020 16:40:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3YTuc6Yv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rrpGDK1P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6EFA32080C 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=merlin.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=mIRImkNJWTux7cte31C7i9QS/PYJUU9co2SA6e/Y6aU=; b=3YTuc6YvmtIi2M5iAHmWPE3P8 7P7TxgaO58ePV5igvhwHwsZOQyXe0YoEvJtCIcwvmxDXo2nq+pbXdLix+s0b9r6fRthnI4Q2Teeep J3JFdjWaPYNsZmUXyCFllhQ1nap6EAjHmm6ufXrecr7fFuAfY9llvrSDD698EPaklitW747WKbM8G tcCbyFT0J+aJwLIqKgqKqF+ZXRz8+STey2/yEm9O9oa/BYbnqfjqZa9jWyT69pFwR9+tsx0LlK0LD 2tnTU/JdIY0aKjd8VpOvPdidOxpvxCuYK5cQBLpo2/pgq2HKSkLGHEyePYmdbCujEuw8hrbLPWJz6 oz4+d6eUA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwBo-0002E7-2Y; Mon, 28 Sep 2020 16:39:48 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7g-0000bk-Mo for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:38 +0000 Received: by mail-pf1-x443.google.com with SMTP id d9so1531463pfd.3 for ; Mon, 28 Sep 2020 09:35:32 -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=XIx91CccDaMdjV0kYj3bzRvAnnTG3Y6NVqg6FhgtymQ=; b=rrpGDK1PuYY26QV/Qus8zZSUEzEBSvGPLngFW0TycgAyGD79W5dMo5/vXMLrEbUD41 I2ZBHj7Gjlf68vM/vDyCkHh//H+n3mYuJYzcIaHhbPHWUsYCAT+2F5V4+aNP2jk9rMQs w2KUFCOlcOgqH6EodqIa3EReq8joBWWZSLWgLJz7wmUsXrclUgwws68zy/Taw4mPnrzt GulDmVJcEcKiIWdzYmrfu6UqTlEC0AFWPDziF/D9psjPyxrDBZGHvIQE5Y1xInQUFSXV z9wslKx3T7Xm+TnC1avXJGh2b+veo8PJdxKa8N2aljQbglb3FiRvGB/hoCGWlfIj+dwq IUPA== 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=XIx91CccDaMdjV0kYj3bzRvAnnTG3Y6NVqg6FhgtymQ=; b=uQ5O4VN7cREEbvWjmWnX6JLRIR0Qf0Gnsj/CMWUGWu00xZcAVNzY2pw7vPkDMqt/xK S1/6S0bVYv1uV11rnAHtDKEmCs3LMeI1wqYpGPUtMFPeTIamUDhicSS8hvK2bpRiyKti b+WQ3d+4o8dWOtes/h54EOLbxCJoGfbu+kD5InrejB1KiHxoUyDvACnIdHih/iQEi0XH lMg+UQdGX5KvyxaKswrLSAaWLLLnjxB7ZhjaBft2AuakWoKrZT0s8IY7m4VXUHKGQ1FV HvlU3eByRjjy+hFADKRXPDp2LyeSiROL2+Ip+YSdLCS7sBPWqF+q4Xmu936/W9oguH8B c2Rw== X-Gm-Message-State: AOAM532YCZXkQPL6xOqzf5Zbl+/QmaPjFBDzdmqqmBtUz0CzzVtXJQbr YyBjjswbUOcXCnYCF2i3KpxQ4w== X-Google-Smtp-Source: ABdhPJxjBK1zCvQQ8uD6VTpZqiRhqtDxs2lAKFsh4876s8nAKwAUjuZQHqZOEg200ziiFRoqSmPqwQ== X-Received: by 2002:a17:902:a407:b029:d2:2113:7f8f with SMTP id p7-20020a170902a407b02900d221137f8fmr360285plq.70.1601310930991; Mon, 28 Sep 2020 09:35:30 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:30 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 15/25] coresight: replicator: Allow replicator driver to be built as module Date: Mon, 28 Sep 2020 10:35:03 -0600 Message-Id: <20200928163513.70169-16-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123532_816097_018763E5 X-CRM114-Status: GOOD ( 21.54 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Kim Phillips Allow to build coresight-replicator as modules, for ease of development. - Kconfig becomes a tristate, to allow =m - combine static and dynamic replicator init into single module_init/exit call - add replicator_remove functions, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Co-developed-by: Mian Yousaf Kaukab Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 +- .../coresight/coresight-replicator.c | 65 ++++++++++++++++++- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index fc48ae086746..f31778dd0b5d 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -17,13 +17,16 @@ menuconfig CORESIGHT if CORESIGHT config CORESIGHT_LINKS_AND_SINKS - bool "CoreSight Link and Sink drivers" + tristate "CoreSight Link and Sink drivers" help This enables support for CoreSight link and sink drivers that are responsible for transporting and collecting the trace data respectively. Link and sinks are dynamically aggregated with a trace entity at run time to form a complete trace path. + To compile these drivers as modules, choose M here: the + modules will be called coresight-funnel and coresight-replicator. + config CORESIGHT_LINK_AND_SINK_TMC tristate "Coresight generic TMC driver" diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 78acf29c49ca..62afdde0e5ea 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -291,6 +291,14 @@ static int replicator_probe(struct device *dev, struct resource *res) return ret; } +static int __exit replicator_remove(struct device *dev) +{ + struct replicator_drvdata *drvdata = dev_get_drvdata(dev); + + coresight_unregister(drvdata->csdev); + return 0; +} + static int static_replicator_probe(struct platform_device *pdev) { int ret; @@ -310,6 +318,13 @@ static int static_replicator_probe(struct platform_device *pdev) return ret; } +static int __exit static_replicator_remove(struct platform_device *pdev) +{ + replicator_remove(&pdev->dev); + pm_runtime_disable(&pdev->dev); + return 0; +} + #ifdef CONFIG_PM static int replicator_runtime_suspend(struct device *dev) { @@ -343,24 +358,29 @@ static const struct of_device_id static_replicator_match[] = { {} }; +MODULE_DEVICE_TABLE(of, static_replicator_match); + #ifdef CONFIG_ACPI static const struct acpi_device_id static_replicator_acpi_ids[] = { {"ARMHC985", 0}, /* ARM CoreSight Static Replicator */ {} }; + +MODULE_DEVICE_TABLE(acpi, static_replicator_acpi_ids); #endif static struct platform_driver static_replicator_driver = { .probe = static_replicator_probe, + .remove = static_replicator_remove, .driver = { .name = "coresight-static-replicator", + .owner = THIS_MODULE, .of_match_table = of_match_ptr(static_replicator_match), .acpi_match_table = ACPI_PTR(static_replicator_acpi_ids), .pm = &replicator_dev_pm_ops, .suppress_bind_attrs = true, }, }; -builtin_platform_driver(static_replicator_driver); static int dynamic_replicator_probe(struct amba_device *adev, const struct amba_id *id) @@ -368,19 +388,60 @@ static int dynamic_replicator_probe(struct amba_device *adev, return replicator_probe(&adev->dev, &adev->res); } +static int __exit dynamic_replicator_remove(struct amba_device *adev) +{ + return replicator_remove(&adev->dev); +} + static const struct amba_id dynamic_replicator_ids[] = { CS_AMBA_ID(0x000bb909), CS_AMBA_ID(0x000bb9ec), /* Coresight SoC-600 */ {}, }; +MODULE_DEVICE_TABLE(amba, dynamic_replicator_ids); + static struct amba_driver dynamic_replicator_driver = { .drv = { .name = "coresight-dynamic-replicator", .pm = &replicator_dev_pm_ops, + .owner = THIS_MODULE, .suppress_bind_attrs = true, }, .probe = dynamic_replicator_probe, + .remove = dynamic_replicator_remove, .id_table = dynamic_replicator_ids, }; -builtin_amba_driver(dynamic_replicator_driver); + +static int __init replicator_init(void) +{ + int ret; + + ret = platform_driver_register(&static_replicator_driver); + if (ret) { + pr_info("Error registering platform driver\n"); + return ret; + } + + ret = amba_driver_register(&dynamic_replicator_driver); + if (ret) { + pr_info("Error registering amba driver\n"); + platform_driver_unregister(&static_replicator_driver); + } + + return ret; +} + +static void __exit replicator_exit(void) +{ + platform_driver_unregister(&static_replicator_driver); + amba_driver_unregister(&dynamic_replicator_driver); +} + +module_init(replicator_init); +module_exit(replicator_exit); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight Replicator Driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:35:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804099 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 BD0FC139A for ; Mon, 28 Sep 2020 16:42:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 52123208FE for ; Mon, 28 Sep 2020 16:42:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Sj7/HXg6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mk7VkhZ1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52123208FE 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=merlin.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=rjm3YChWRhb+4OrzPlbLCdIgVk4RjEaNQ6RBbP2kIsA=; b=Sj7/HXg6F128lq3w4K1VHwIil mOHoqLzeWEkUOKY8yxkaUpATn1/nMt5XwLlaJLK+cqewYv+sioafRw1NSyA6Cgd/dROQ2lyz66Ibv 8veOsxPs8Kc6QNk/q5ooNlovPhd/A0+cpt8WnK8vpWMyELZdwttw4KVWMvikQztzNTeNSuiDaaHG6 pa+47DJ8Vsi6wcmkjTu/oJ9UosbZycO+1ek8YJPRD3t5n4Vyky2sGr15r/qaBROIu4aejtiVHVuDE sFQQPDI/zBlHCmUw/UoWrL91pTkotOh710RQqUM4J2W0kU47z8k0wgTYZoNIMa8/33rogzR32DXm5 oDBcdNx4g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwBs-0002G9-7J; Mon, 28 Sep 2020 16:39:52 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7h-0000c7-R0 for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:38 +0000 Received: by mail-pg1-x544.google.com with SMTP id 5so1331408pgf.5 for ; Mon, 28 Sep 2020 09:35:33 -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=IpatMEPJJ14BSXBClV0KrHKcOb/q5ewFCZIj8n6XC30=; b=mk7VkhZ15yLWQKbSUJd17gBGjqFDl7+pJSl0ixp9l0s58jU4SkHX492O7+H7CQsit4 1aE4ILUzgnTL0Gl8kBAoeF6C2e2nyBxAbCtTOwn5ocbQgqJ/OE/AuJ0dwtEf6+NhiTQe MIuOHFyGTxpyHQ8l/bZXD4AGNL+rtQPVsQ29ofV13kM1tia8/X0f3nwtixtUtr/k6iuN zMXWj7xEn+7neK3z4uWhSycTB/Gt604ngXVgSDtxvRfXtjNhseNCcw6rGb1gKdYAGSvy kxncXHjnrx6Y0L8Y4o7OXTGtsZwmEuwOvlujIjs/q4jb2vE0Yneup3FXOtsfflHQfR6w azUg== 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=IpatMEPJJ14BSXBClV0KrHKcOb/q5ewFCZIj8n6XC30=; b=eKxmkHz5Yo32lKIjnoQzccudxUotEEKmq8TWvCJQwV8LMbVjnEueNQISmh1eFZU3+8 HlhFc3m0TeszypCSMxlvqgwf+Sw8MQCuXXo7782HMi8u6Y71xK6dcgkTLoie7AvIps7H 48TmzK/VvSHsBfujatpVT6namlCXqaohot8mSctWG1y0f7kgiJ0hSQBd+H5+uomx3VaK M9Y6GtSXbiRudZOH2rVdqdhlek+1lrmvtM+/9hkoCqhXzoyCtgM2GQHWxEUC5VVzm2rn MmlqdHpUsXF9tQtKkDc8inWcY8ajSSwathAIBS7Ci4byf52sAMqxPpyOOXPMf5HFunkw v5Jg== X-Gm-Message-State: AOAM532JScerO6YjJoOtcsmp5H99DAyBeTR1nT6utqx+iXu40kG8Rxwf zZbNaOKWp5VC4gtX6LczGJbKTQ== X-Google-Smtp-Source: ABdhPJzS7WIL651OcX+O+/eP89XDg3TG62Tvhki5Z9YwTzag0U0nhYGfmVnqnAMpokJGCyWpXC3DlQ== X-Received: by 2002:a17:902:6bc1:b029:d0:cbe1:e73d with SMTP id m1-20020a1709026bc1b02900d0cbe1e73dmr375908plt.24.1601310932022; Mon, 28 Sep 2020 09:35:32 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:31 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 16/25] coresight: cti: Add function to register cti associate ops Date: Mon, 28 Sep 2020 10:35:04 -0600 Message-Id: <20200928163513.70169-17-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123533_917022_85422BA9 X-CRM114-Status: GOOD ( 20.25 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang Add static cti_assoc_ops to coresight core driver. Let cti driver register the add_assoc and remove_assoc call back. Avoid coresight core driver to depend on cti driver. Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 36 +++++++++++++++++--- drivers/hwtracing/coresight/coresight-priv.h | 14 ++++---- drivers/hwtracing/coresight/coresight.c | 21 ++++++++++-- 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 47f3c9abae30..5003d1f59af0 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -539,7 +539,7 @@ cti_match_fixup_csdev(struct cti_device *ctidev, const char *node_name, * This will set the association if CTI declared before the CS device. * (called from coresight_register() with coresight_mutex locked). */ -void cti_add_assoc_to_csdev(struct coresight_device *csdev) +static void cti_add_assoc_to_csdev(struct coresight_device *csdev) { struct cti_drvdata *ect_item; struct cti_device *ctidev; @@ -572,13 +572,12 @@ void cti_add_assoc_to_csdev(struct coresight_device *csdev) cti_add_done: mutex_unlock(&ect_mutex); } -EXPORT_SYMBOL_GPL(cti_add_assoc_to_csdev); /* * Removing the associated devices is easier. * A CTI will not have a value for csdev->ect_dev. */ -void cti_remove_assoc_from_csdev(struct coresight_device *csdev) +static void cti_remove_assoc_from_csdev(struct coresight_device *csdev) { struct cti_drvdata *ctidrv; struct cti_trig_con *tc; @@ -599,7 +598,15 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev) } mutex_unlock(&ect_mutex); } -EXPORT_SYMBOL_GPL(cti_remove_assoc_from_csdev); + +/* + * Operations to add and remove associated CTI. + * Register to coresight core driver as call back function. + */ +static struct cti_assoc_op cti_assoc_ops = { + .add = cti_add_assoc_to_csdev, + .remove = cti_remove_assoc_from_csdev +}; /* * Update the cross references where the associated device was found @@ -956,4 +963,23 @@ static struct amba_driver cti_driver = { .probe = cti_probe, .id_table = cti_ids, }; -builtin_amba_driver(cti_driver); + +static int __init cti_init(void) +{ + int ret; + + ret = amba_driver_register(&cti_driver); + if (ret) + pr_info("Error registering cti driver\n"); + coresight_set_cti_ops(&cti_assoc_ops); + return ret; +} + +static void __exit cti_exit(void) +{ + coresight_remove_cti_ops(); + amba_driver_unregister(&cti_driver); +} + +module_init(cti_init); +module_exit(cti_exit); diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index d638c7d48815..65a29293b6cb 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -173,15 +173,13 @@ static inline int etm_readl_cp14(u32 off, unsigned int *val) { return 0; } static inline int etm_writel_cp14(u32 off, u32 val) { return 0; } #endif -#ifdef CONFIG_CORESIGHT_CTI -extern void cti_add_assoc_to_csdev(struct coresight_device *csdev); -extern void cti_remove_assoc_from_csdev(struct coresight_device *csdev); +struct cti_assoc_op { + void (*add)(struct coresight_device *csdev); + void (*remove)(struct coresight_device *csdev); +}; -#else -static inline void cti_add_assoc_to_csdev(struct coresight_device *csdev) {} -static inline void -cti_remove_assoc_from_csdev(struct coresight_device *csdev) {} -#endif +extern void coresight_set_cti_ops(const struct cti_assoc_op *cti_op); +extern void coresight_remove_cti_ops(void); /* * Macros and inline functions to handle CoreSight UCI data and driver diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 4faa4aa3964d..4f4485b17458 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -56,6 +56,20 @@ static struct list_head *stm_path; const u32 coresight_barrier_pkt[4] = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; EXPORT_SYMBOL_GPL(coresight_barrier_pkt); +static const struct cti_assoc_op *cti_assoc_ops; + +void coresight_set_cti_ops(const struct cti_assoc_op *cti_op) +{ + cti_assoc_ops = cti_op; +} +EXPORT_SYMBOL_GPL(coresight_set_cti_ops); + +void coresight_remove_cti_ops(void) +{ + cti_assoc_ops = NULL; +} +EXPORT_SYMBOL_GPL(coresight_remove_cti_ops); + static int coresight_id_match(struct device *dev, void *data) { int trace_id, i_trace_id; @@ -1232,7 +1246,8 @@ static void coresight_device_release(struct device *dev) { struct coresight_device *csdev = to_coresight_device(dev); - cti_remove_assoc_from_csdev(csdev); + if (cti_assoc_ops && cti_assoc_ops->remove) + cti_assoc_ops->remove(csdev); fwnode_handle_put(csdev->dev.fwnode); kfree(csdev->refcnt); kfree(csdev); @@ -1543,8 +1558,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) ret = coresight_fixup_device_conns(csdev); if (!ret) ret = coresight_fixup_orphan_conns(csdev); - if (!ret) - cti_add_assoc_to_csdev(csdev); + if (!ret && cti_assoc_ops && cti_assoc_ops->add) + cti_assoc_ops->add(csdev); mutex_unlock(&coresight_mutex); if (ret) { From patchwork Mon Sep 28 16:35:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804087 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 826F0139A for ; Mon, 28 Sep 2020 16:40:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 52FEA2100A for ; Mon, 28 Sep 2020 16:40:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ev1SyeIg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="c+ufyza4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52FEA2100A 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=merlin.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=VSUt/tX06I3ig4H8JdQmDYFdFM2LLy+0vOOa+iG7HgM=; b=Ev1SyeIg8XgoSbXk02oj5sKwS TypqKSrJ4HfjaaIFcrqHcWr97LtJMKD0D1XgloUXpFGc+F0ye9cxZ792CtctDcTiOqogPn7Z9DMur yl1+pWA7aeoot4NWkx7MG1ylcgWi9nMMGWrP3ubUZI3QmY7VNeiL46khHLr4HuYewdpGfdLji60oV DNWONu8t0iszoCtVOP6pANAcWwcCRkgHUb7PqxQGQeYo5yMleWIQDD1HodG99OL4Y1rRM5M7FI5qM wUktlnjgYPZ+M8QG7/xZuxCCS6JLANFZeRcKCZ3RN8bMhT+vbh6pSC7qJauaWYC8pqH3C9o0ePkPj VeFl43Gug==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwBz-0002KR-NA; Mon, 28 Sep 2020 16:39:59 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7i-0000ck-VG for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:41 +0000 Received: by mail-pf1-x442.google.com with SMTP id w7so1526589pfi.4 for ; Mon, 28 Sep 2020 09:35:34 -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=uQAZxuXMQGBtR+XEE1cJor4vajw3CBOa7U4wzhGgrBE=; b=c+ufyza4khJYPdz/3PTvWDJmufwz1AAjIsMmQ3Jhoze+AfN8okAxLuv5bXb1I5gKHw xhRyvrcc8iuDzXHgtCtJ2yxbculjTci51cPSOls9JCZuY6w1k1xGdi6Uu/9fZpl0cF67 E7XsFI09xHb4JOqOhgTwpUdcwYtWtpqKnOd8a2hoQOX7HSpip+UW4quUrFEsnQlT88M0 a+jedxS1/UMRuNKtOb0FGYoOkJDLwSC7Ewqq/oTY0rr+lvvsG5MrSc3bxLyM+QG5Xi7G 4nMytsyXHy1DkTavPX/EZqlJw5eXy3Pc+C0130bStbHGwfPQAZL7chLFGwgBA5LOUm3Q x6Ew== 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=uQAZxuXMQGBtR+XEE1cJor4vajw3CBOa7U4wzhGgrBE=; b=fypTaW/WpFOmr59aJtBS/ewdCrjvs0nXc2bCESjUNoKJkYyVZ5+uqZtzRWUkbcvQBT r87+6+Bca4BreCYGPHkzHOc/0bf5kiqUBdhzYCD3kqpfKBHf4xP8VShl1IWZHDpDeBdr W4aNycs993el5fsDV0VWQqzBXZf2JaeJcy7WiKVEnfkKickKnh8BVq6u0PsOuJ51xewS KXbRIblThYqmr3Pl7atjFaCyMZjAq8MplNVC8ZiGWRekQJ91pwfgWULAH5LVo9Erknxg jNA1jwUaM1gP0bBHEkb0KgNJ5Kf7VPo+TnqFAqMShB+lSToi/KHwWCqxEmCY4syE43yI b80A== X-Gm-Message-State: AOAM531taq415jqGbR4LQj8g+5YUYXujyaNdqZhiDMve2GipsoVeWMdk mXV097UMGm9XnUZnlJe3QYnkwg== X-Google-Smtp-Source: ABdhPJwWvP15f/fbhVDpd4HCUcyFdHiHD7t1vvnFgxCgXFUH0LfFZUnvzJ9ZCHomH+zStSj3hDAclg== X-Received: by 2002:a63:c00d:: with SMTP id h13mr1816537pgg.358.1601310933065; Mon, 28 Sep 2020 09:35:33 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:32 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 17/25] coresight: cti: Fix remove sysfs link error Date: Mon, 28 Sep 2020 10:35:05 -0600 Message-Id: <20200928163513.70169-18-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123535_107637_F70A0B72 X-CRM114-Status: GOOD ( 14.67 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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 CTI code to remove sysfs link to other devices on shutdown, incorrectly tries to remove a single ended link when these are all double ended. This implementation leaves elements in the link info structure undefined which results in a crash in recent tests for driver module unload. This patch corrects the link removal code. Fixes: 73274abb6557 ("coresight: cti: Add in sysfs links to other coresight devices") Reported-by: Tingwei Zhang Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index 5003d1f59af0..abc8b32e79b3 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -494,12 +494,15 @@ static bool cti_add_sysfs_link(struct cti_drvdata *drvdata, return !link_err; } -static void cti_remove_sysfs_link(struct cti_trig_con *tc) +static void cti_remove_sysfs_link(struct cti_drvdata *drvdata, + struct cti_trig_con *tc) { struct coresight_sysfs_link link_info; + 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); coresight_remove_sysfs_link(&link_info); } @@ -589,7 +592,7 @@ static 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); + cti_remove_sysfs_link(ctidrv, tc); tc->con_dev = NULL; break; } @@ -641,7 +644,7 @@ 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); + cti_remove_sysfs_link(drvdata, tc); tc->con_dev = NULL; } } From patchwork Mon Sep 28 16:35:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804101 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 EA16B6CB for ; Mon, 28 Sep 2020 16:42:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B3D28208FE for ; Mon, 28 Sep 2020 16:42:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KPReOner"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w2aEywjx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3D28208FE 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=merlin.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=Lo5NeWKAzxI/UsCWHxu0QtDCL7UKV/KWOg/QDXSttNw=; b=KPReOnerGDkPTanqzijIRJbGN phzOXQiaNK/XHxOU08qIjwuZ0oqVm+5304w9B5cIaKzsAoLdJF5Tj+seFmMfG7vCJZgtXpTiNPORz lbEpIP+alirSwxPHKmhLWKwRSMT40+CEcPHY7toHKKqkIzHfbalm9FXy4tJAipjJ3k+TFeBN4rkpa CdmMl6hwHJr6sVaTJUCGfXh1iPMnT48hzPJFXvSNuajQuf5V3+n5GGlZKM7z0m3Sqj8DBteLsHVEt siYErB7litGPmO4GMo77AF91S6wMu9i3TqJy8N80hnEWknyDbkrnSXWxlEAL19YaRlVMWbuAVELOu A9J06zcIg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwCB-0002Qe-8E; Mon, 28 Sep 2020 16:40:11 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7j-0000dE-U9 for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:42 +0000 Received: by mail-pf1-x441.google.com with SMTP id d6so1508097pfn.9 for ; Mon, 28 Sep 2020 09:35:35 -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=LbFpq0wd5+hxz3XH6XRLouzUqxCeQhgca4mXu1de8J8=; b=w2aEywjxp9dMgipUoJ9iL8g/12berH/b8sx9NjaH5ufVmIakaWTqAR7la8pcEAG/BZ CNtY3YTMyLhvZGoeaREXAi9j9EmxQMPZyYfpsq5GyZMZ7T2k1F8J4qK2dQiWMarPPb/r SF3Apbu35eZ5srGjlVDKE1C+aZfayp8FE3AVwdkH3uo5apOsO5EMZ9UBHAKDmx812GF6 8Mw69mvUuu9iqPWg0NZHha54Mu8vtOjaANYclXJdjK0tlnWe5deeXTbGHMekNSvKqtRN RPV7ssadgFHgNP1d8omQtHD4ao6+imEOcu/wxsUiUAVnb4+UMsLJxS88/s/YAho72c5w skIg== 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=LbFpq0wd5+hxz3XH6XRLouzUqxCeQhgca4mXu1de8J8=; b=tSP1ma2WqJNRa7jEBd1eZOj2H8b2pPYCzpKTm7bx9EKseJv+gmlIyTOS1idS3JxEIK T0TrBPjuKAhVDvlhdFsHjl/Hi5fwl+ZYl9NAs56Wlnh2sNChq/AC8iytLsA9CxS4SbXR hK3GXGJGIfWxCZ9HaD5ArRM4bXmXX5ius/ZkltDYKWl+MOWD5EdQI5G1cc08F1SOP/eW YnJqi8LFohPkhwhcZAiqnjWKk9tWdfzxxeOpXV+EVC7LwDDsvOnADBKLvWvxcffem0s6 qAwaihlk6SuWIRBmcTxWOehOaN/7dRHaG/kpexX1KEvmbPJjcigbbMSrLBkC/fxlfeuB Gy0Q== X-Gm-Message-State: AOAM5335XZLmAMM21A8mmRO8YhjIq1HEMgN51OaeXEYXn34zRnV+jTYR zYIn9OO2b3r7o/AJX4x1BG7Z69xCoIAs4A== X-Google-Smtp-Source: ABdhPJyZB5vjT7d/JfEtTBZ44fpfjE6idaPbl/mLkqGjBv2OCTPwzokn0FcFyvA3SLKHoBoTJf/VMA== X-Received: by 2002:a62:6147:0:b029:142:2501:34e8 with SMTP id v68-20020a6261470000b0290142250134e8mr209057pfb.65.1601310934053; Mon, 28 Sep 2020 09:35:34 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:33 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 18/25] coresight: cti: Fix bug clearing sysfs links on callback Date: Mon, 28 Sep 2020 10:35:06 -0600 Message-Id: <20200928163513.70169-19-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123536_044503_E6D1CDF8 X-CRM114-Status: GOOD ( 18.32 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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:441 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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 During module unload, a coresight driver module will call back into the CTI driver to remove any links between the two devices. The current code has 2 issues:- 1) in the CTI driver the matching code is matching to the wrong device so misses all the links. 2) The callback is called too late in the unload process resulting in a crash. This fixes both the issues. Fixes: 177af8285b59 ("coresight: cti: Enable CTI associated with devices") Reported-by: Tingwei Zhang Signed-off-by: Mike Leach Signed-off-by: Tingwei Zhang Acked-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-cti.c | 2 +- drivers/hwtracing/coresight/coresight.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c index abc8b32e79b3..38e785d913b0 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti.c @@ -591,7 +591,7 @@ static void cti_remove_assoc_from_csdev(struct coresight_device *csdev) ctidrv = csdev_to_cti_drvdata(csdev->ect_dev); ctidev = &ctidrv->ctidev; list_for_each_entry(tc, &ctidev->trig_cons, node) { - if (tc->con_dev == csdev->ect_dev) { + if (tc->con_dev == csdev) { cti_remove_sysfs_link(ctidrv, tc); tc->con_dev = NULL; break; diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 4f4485b17458..b8b0a20e93c9 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1246,8 +1246,6 @@ static void coresight_device_release(struct device *dev) { struct coresight_device *csdev = to_coresight_device(dev); - if (cti_assoc_ops && cti_assoc_ops->remove) - cti_assoc_ops->remove(csdev); fwnode_handle_put(csdev->dev.fwnode); kfree(csdev->refcnt); kfree(csdev); @@ -1582,6 +1580,8 @@ void coresight_unregister(struct coresight_device *csdev) { etm_perf_del_symlink_sink(csdev); /* Remove references of that device in the topology */ + if (cti_assoc_ops && cti_assoc_ops->remove) + cti_assoc_ops->remove(csdev); coresight_remove_conns(csdev); coresight_clear_default_sink(csdev); coresight_release_platform_data(csdev, csdev->pdata); From patchwork Mon Sep 28 16:35:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804091 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 037FD139A for ; Mon, 28 Sep 2020 16:40:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 A10A12080C for ; Mon, 28 Sep 2020 16:40:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HgEKbxNv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="os6AcU2w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A10A12080C 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=merlin.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=0MKOTsCp3QPka409fqZ0qfGgZ2UDJD7mnx80V2ndxfM=; b=HgEKbxNvJA5cqmlrtXo3ITA2s zqhPCFQ/4gOZPf+PqaR8gh6vsHZ5PsKEsd+QBL7bCWPs/wP3FeunyFCTuS/QiPnbEmgenutZ9Ed6+ t8xp9C8mUk1cxH+3ZmpS6amCjLFlgAn/oTjQK6JQ6ODBcQ1TVB0EPs2LKzsR1N7MxcspiOtFV2Uyr P6bvXqECDq0C+hhyB7NN/ikgSQA57iW2iVSc5ykaOShtC5Q61qaEbNHNybh/YjRd5lzr1ek5XOmgO ZJrpm6mREXuXMqQ/ThWVvjld00xoLgaNVH7NNCUW208NTZtpX6LQh2rxziCM3jB+PqS/LCvn9E+4F IVZ25cZBw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwCI-0002Wt-QE; Mon, 28 Sep 2020 16:40:18 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7l-0000dg-5M for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:43 +0000 Received: by mail-pf1-x444.google.com with SMTP id x22so1495136pfo.12 for ; Mon, 28 Sep 2020 09:35:36 -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=PFNZXtI95g0K6EiyKzxVVKdekKnnD7HXNlnqY5psBQg=; b=os6AcU2wpUMO0LwxaiVbIb+NVpIgu3Edd4DRyzo+QSz8Z+xB5gnAuvQ0ZYVGUOmNUP ltE8DtXJ/t27XSxIO+hc3HEpKKOa89eikipbsSo91ZMAOzMup4JZU3F71V7lbVdKvcKM XjTbDZ9nBjNHkuZJ6ciMWZDef32e+jz/IQY6ZE96KPTY5zQSd45c1H+EU2VajYEigK7H xpwZCclXk6QTkNulj6B4s9MMeQ3vMbB+9I0xwsAJy1kW7xet4+JjxwTjpwYjpzFqlNgk QrdhNyso5S1rJhNKVhwMqexKu5BZqTpwNaj9k98l1bgA2mq+V0zWdgDXUJaYh+Z7bA7Z ktag== 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=PFNZXtI95g0K6EiyKzxVVKdekKnnD7HXNlnqY5psBQg=; b=Ci7tnylESiSLM5kQP1xEo/M1cFt33+l5blFNDqm2MNDHilxJC3M/ViSX0rDmKKkqMz 1XCXmuXY1zbR68Vf8LgyjSkBplEMlvsPZtrhjB1IsaIWTMin6zqY0+2gjwKEOt00guQd U7U7xunLkBzFmEwgkZ13yablEhHon0Q2NcEguAo0/+yTBVPhiPwojSHEt9UQyOZYW8A3 o4lO8nLgDIKCune7V6krGaGgtWZI8L+FaDecRDxHgEhSV1t976T+UVdWxfuqmZgi0LF7 iPUaofY2h80W4EoZX/nrHoErYeiRBK6Lw80Prq77oNQGJeJKdTksjmaIwLESA2sZzAzy 04Bg== X-Gm-Message-State: AOAM532+fdSWsZ1t42OzR0W9K9dUOZWgYXAYp+aiWO4GSz2m4cWWz82G 7GWbY3eU0dIKDiBBauYbWYHmiI9vB9/YUg== X-Google-Smtp-Source: ABdhPJzxzKRXw7hgSldaGRbgnB6lTm4etRUB+E3moLb2conlDyuo1tUJTqJZ5ymj2fdq+XbugsKEyA== X-Received: by 2002:a65:5902:: with SMTP id f2mr1714479pgu.379.1601310935258; Mon, 28 Sep 2020 09:35:35 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:34 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 19/25] coresight: cti: Don't disable ect device if it's not enabled Date: Mon, 28 Sep 2020 10:35:07 -0600 Message-Id: <20200928163513.70169-20-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123537_254276_78627988 X-CRM114-Status: GOOD ( 18.79 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang If associated ect device is not enabled at first place, disable routine should not be called. Add ect_enabled flag to check whether ect device is enabled. Fix the issue in below case. Ect device is not available when associated coresight device enabled and the association is established after coresight device is enabled. Signed-off-by: Mike Leach Signed-off-by: Tingwei Zhang Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 11 ++++++++--- include/linux/coresight.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index b8b0a20e93c9..711beb92166a 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -244,13 +244,18 @@ coresight_control_assoc_ectdev(struct coresight_device *csdev, bool enable) if (!ect_csdev) return 0; + if ((!ect_ops(ect_csdev)->enable) || (!ect_ops(ect_csdev)->disable)) + return 0; if (enable) { - if (ect_ops(ect_csdev)->enable) - ect_ret = ect_ops(ect_csdev)->enable(ect_csdev); + ect_ret = ect_ops(ect_csdev)->enable(ect_csdev); + if (!ect_ret) + csdev->ect_enabled = true; } else { - if (ect_ops(ect_csdev)->disable) + if (csdev->ect_enabled) { ect_ret = ect_ops(ect_csdev)->disable(ect_csdev); + csdev->ect_enabled = false; + } } /* output warning if ECT enable is preventing trace operation */ diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 3bb738f9a326..7d3c87e5b97c 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -208,6 +208,7 @@ struct coresight_device { /* sysfs links between components */ int nr_links; bool has_conns_grp; + bool ect_enabled; /* true only if associated ect device is enabled */ }; /* From patchwork Mon Sep 28 16:35:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804103 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 4B7926CB for ; Mon, 28 Sep 2020 16:43:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 EADAF214D8 for ; Mon, 28 Sep 2020 16:43:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="S1AvNnrt"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ilWQBABA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EADAF214D8 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=merlin.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=dV+47Qa2B86Z1EFjV4KDKcgPRflLSHOIhWy9RwUO1y0=; b=S1AvNnrt3VY7vmIcTohhDEM85 X935cdpav4laqjhuT07adgncChuUVk710E5BPwHrPWgaHLLIPa151lGoC//MbjEGgcuMXXCROVFCJ eh2xUkSJrG2mVFc3gGGB7v+MnEuZAbekloVNFJjhr9WXyY6/tC0o9CwBRa4R+nABWezi0uYgy1vCD AIkPoYbylP8wipwPPdauTHMqAlokQjW1ErUdz5fYjoeMwp3V7w1jJLFg4ygBryu86pVthsWpiYzWB CJF6nuffDuhv6hP3qucF8CTp1BDYoIOVgqjSCNhTAI/aQlmt7llh6Bo+46Ocw2fDdwUrwNU8Ft/8u KCYdfWHiQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwCb-0002gx-8R; Mon, 28 Sep 2020 16:40:37 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7m-0000eB-2A for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:45 +0000 Received: by mail-pf1-x441.google.com with SMTP id f18so1502810pfa.10 for ; Mon, 28 Sep 2020 09:35:37 -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=IMd2wxbWSskBrQ2C+X7YA5Ufqq005IN1/YwGk6ozQGg=; b=ilWQBABA6kMOrJoh/CKJlyxmjAFWLqWaWPFEc1dIuByBNPZQa0yfmTbHaUIGnrkmQG IPLjyH+PiMWw0+FjN1+lWtjTZmVOk+nUf5MG2YNuJTJ2pbtyslBYfrrCx+Tbm1i+6/k+ vT0XPbNzxe98Ox53FByw8fSCLG/r/DQcrRugYVyVq+vJXOeQLlnVH52ZDu2TpKjFxk8P zrov+AQ277aJmWzONeUS6xBhiu8j3F5g3nDUZv9zMdot3nIwRBSfEfIHZyQaxr2U2WT2 uixCS/wxyRkw4WhfL21r0+hBkhw5/5ifToK6bnvfGLaQ+rfFMdaeeAB0KWZVsA1Pubnr qf4g== 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=IMd2wxbWSskBrQ2C+X7YA5Ufqq005IN1/YwGk6ozQGg=; b=jClJELVnbNn9WFa57quCcrEdePF9VboUqLGgeNSswnPO0kBr5I2PYrnF3iPz6effq7 Os0BdV4dTsGdczkAuzEXsnWHeecvripPVZ/oOlYBjhlv0K3jPZKna3Q09ODZ+VMZnOal jja9tM6vCObPOGBEg23fohdDlAiE2sLiqvZt9GBMW2o4BOu2dzEoMuQGQNCsY4163IWs nZpB2EdTkPAXW8Wf505EkQu/sML642UPQQ7eN1+fyVfbO64a1mAlaHNIi734WVQKZaEB 3mVpJpAiSVZ6erjGlZniD7VP5SsR5cMvxlptJihAGgraICpzID0OfU3hS0CanKOlVyXs ZRtQ== X-Gm-Message-State: AOAM531YZuasp5rAiv+yBvAVqP+/k3ZcSLZMvSEF2ssy3BI0+JY3mQIy hX2MfM4BXZedq8YsMGmv8xte4w== X-Google-Smtp-Source: ABdhPJz2khhedvAGxqkeK5cUNSNg/eSDC0o9IXllj+NsVS2MWD18lzl8cv2QMY2GEcKzuAdlruZGow== X-Received: by 2002:a63:144d:: with SMTP id 13mr827354pgu.153.1601310936257; Mon, 28 Sep 2020 09:35:36 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:35 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 20/25] coresight: cti: Increase reference count when enabling cti Date: Mon, 28 Sep 2020 10:35:08 -0600 Message-Id: <20200928163513.70169-21-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123538_154347_75049605 X-CRM114-Status: GOOD ( 14.96 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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:441 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_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang CTI device is enabled when associated coresight device is enabled. Increase the module and device reference count for CTI device when it's enabled. This can prevent CTI device be removed or module be unloaded when CTI device is enabled by an active trace session. Signed-off-by: Mike Leach Signed-off-by: Tingwei Zhang Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 711beb92166a..546c97045afe 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -241,19 +241,30 @@ coresight_control_assoc_ectdev(struct coresight_device *csdev, bool enable) { int ect_ret = 0; struct coresight_device *ect_csdev = csdev->ect_dev; + struct module *mod; if (!ect_csdev) return 0; if ((!ect_ops(ect_csdev)->enable) || (!ect_ops(ect_csdev)->disable)) return 0; + mod = ect_csdev->dev.parent->driver->owner; if (enable) { - ect_ret = ect_ops(ect_csdev)->enable(ect_csdev); - if (!ect_ret) - csdev->ect_enabled = true; + if (try_module_get(mod)) { + ect_ret = ect_ops(ect_csdev)->enable(ect_csdev); + if (ect_ret) { + module_put(mod); + } else { + get_device(ect_csdev->dev.parent); + csdev->ect_enabled = true; + } + } else + ect_ret = -ENODEV; } else { if (csdev->ect_enabled) { ect_ret = ect_ops(ect_csdev)->disable(ect_csdev); + put_device(ect_csdev->dev.parent); + module_put(mod); csdev->ect_enabled = false; } } From patchwork Mon Sep 28 16:35:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804107 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 515AE6CB for ; Mon, 28 Sep 2020 16:44:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 02BCF208FE for ; Mon, 28 Sep 2020 16:44: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="Th1jz3s/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ObBy8vJt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02BCF208FE 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=merlin.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=gKTtNvOnzS3cqmMB0YzpL7wXdbEFKFmPWjxSoSiq6Nc=; b=Th1jz3s/7gntM3wgrlSBPBvh5 HNdRxs2U7PC5OvJnvgGRnTxsDsCgnoN64qQrFDLJWXWsfmTV1B3UvQR6TJfUGVYXTVuGboDIS0XOt p8N7G8xhzg9oDEfkzpskexrLqhz4pvhowdpb40NmxIUj4hBd6xJdL647sIGUmKEevKksB+2vC9OFC i6pAoidPqkNdkc/oQi9/aPL9uAHKAiZYnsUpY8CI2kcgswqH07KoXWaBpRZRPXiyiNpbWhUDagbf6 B7j16Von32kWfeS8GiEg6v3LaVoafw57wAE+aJPnteZwh014vkmJRo0FHxE8nO77jMS7Wirk082wP NpSjm9Z4g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwEI-0003V3-C7; Mon, 28 Sep 2020 16:42:22 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7n-0000ec-9B for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:47 +0000 Received: by mail-pg1-x541.google.com with SMTP id t14so1308277pgl.10 for ; Mon, 28 Sep 2020 09:35:38 -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=ivbWO62B8/k+HVBL4SFDiAMi/0I8fix8+11SWaId4bY=; b=ObBy8vJtilE1GAR2jjlktnpUQ69kiKhcfz77CJ1CtcnVu2IFeEWVMNAaiqkh+QERYS 11Aj+Bj5Fr582cwGunCQ2YZImInNM3vIZxARd7AU3cwRQxQ1adWFHr5QMiUsDiffpAdo ETINsPdp2Ty5tLUBPlX6b+y9sc8XXTJ4ha/0lb5CWJwj1yG2jt4Nk01M0rCVbzpCpUz7 J6HB5bOvb9Kk+kDEGUGNTEkEuqFhmYIpcAmYBGzCtMYjaSfiioAHOBUuJuZxSQsL4OjZ mUMGFF614RKMy7NBxPlIQzlVYxgEujaRQx2hGf49EbLRbwIP8CuTgj7uuCQW4EepTEkN bu6A== 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=ivbWO62B8/k+HVBL4SFDiAMi/0I8fix8+11SWaId4bY=; b=W8g9wFCrTS2Y5b02TaytVaBfTacxEX/h8VFRCQgeCNad+mXjC3KSC4qXEStBXypPIZ oUEFvGueFZWfWlLUpPwSj/wcNFjDWgrlJ6G5BdglH7aUrgxjhF1BX++l8CsirhXUQpDv hrLxNDITOHzeeIACk4Seo+FaMlD2et3JIVoeurOijgmc36yIz8XVHS+ayOrHf5kanIa8 TzWnYudqLHOI/+MgFgDio03PyPD8d5+nW6V7FPD8PNqcyxo1u6VUyBN8kBkIJ3lfpvxZ hu+EfqSTKHi9YKTkmpIAZiIbrh+73xijtEfLoKy6CpC/gRwlCsD3yrKdE/zOKVB3VNc4 LMag== X-Gm-Message-State: AOAM532waeSVq651JQLevtt1oDRdlXicKw9v7fgN5Rk7TdU9XpoN4L5n NNGD52VJrFgKk6p7dgrp4g7TDg== X-Google-Smtp-Source: ABdhPJzyeA3Q5ngCzGIK7eSt6PW/tJB8tqaKnGIDg9q3no2KbHhZQJeHREM0JArhioIFXKbrUbsY9w== X-Received: by 2002:a63:2e42:: with SMTP id u63mr1817811pgu.292.1601310937360; Mon, 28 Sep 2020 09:35:37 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:36 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 21/25] coresight: cti: Allow cti to be built as a module Date: Mon, 28 Sep 2020 10:35:09 -0600 Message-Id: <20200928163513.70169-22-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123539_379325_9C12E89E X-CRM114-Status: GOOD ( 21.33 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang Allow to build coresight-cti as a module, for ease of development. - Kconfig becomes a tristate, to allow =m - append -core to source file name to allow module to be called coresight-cti by the Makefile - add an cti_remove function, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot - move cti_remove_conn_xrefs to cti_remove since all sysfs links have gone when system calls device_release. Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by Mike Leach Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 ++++- drivers/hwtracing/coresight/Makefile | 6 +++--- .../{coresight-cti.c => coresight-cti-core.c} | 20 ++++++++++++++++++- .../hwtracing/coresight/coresight-platform.c | 1 + drivers/hwtracing/coresight/coresight.c | 1 + 5 files changed, 28 insertions(+), 5 deletions(-) rename drivers/hwtracing/coresight/{coresight-cti.c => coresight-cti-core.c} (98%) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index f31778dd0b5d..b04aae2ceecc 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -136,7 +136,7 @@ config CORESIGHT_CPU_DEBUG module will be called coresight-cpu-debug. config CORESIGHT_CTI - bool "CoreSight Cross Trigger Interface (CTI) driver" + tristate "CoreSight Cross Trigger Interface (CTI) driver" depends on ARM || ARM64 help This driver provides support for CoreSight CTI and CTM components. @@ -147,6 +147,9 @@ config CORESIGHT_CTI halt compared to disabling sources and sinks normally in driver software. + To compile this driver as a module, choose M here: the + module will be called coresight-cti. + config CORESIGHT_CTI_INTEGRATION_REGS bool "Access CTI CoreSight Integration Registers" depends on CORESIGHT_CTI diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 3dbd49a060dd..27034bd4d3c7 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -19,6 +19,6 @@ coresight-etm4x-y := coresight-etm4x-core.o coresight-etm4x-sysfs.o obj-$(CONFIG_CORESIGHT_STM) += coresight-stm.o obj-$(CONFIG_CORESIGHT_CPU_DEBUG) += coresight-cpu-debug.o obj-$(CONFIG_CORESIGHT_CATU) += coresight-catu.o -obj-$(CONFIG_CORESIGHT_CTI) += coresight-cti.o \ - coresight-cti-platform.o \ - coresight-cti-sysfs.o +obj-$(CONFIG_CORESIGHT_CTI) += coresight-cti.o +coresight-cti-y := coresight-cti-core.o coresight-cti-platform.o \ + coresight-cti-sysfs.o diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti-core.c similarity index 98% rename from drivers/hwtracing/coresight/coresight-cti.c rename to drivers/hwtracing/coresight/coresight-cti-core.c index 38e785d913b0..d28eae93e55c 100644 --- a/drivers/hwtracing/coresight/coresight-cti.c +++ b/drivers/hwtracing/coresight/coresight-cti-core.c @@ -822,7 +822,6 @@ static void cti_device_release(struct device *dev) struct cti_drvdata *ect_item, *ect_tmp; mutex_lock(&ect_mutex); - cti_remove_conn_xrefs(drvdata); cti_pm_release(drvdata); /* remove from the list */ @@ -837,6 +836,18 @@ static void cti_device_release(struct device *dev) if (drvdata->csdev_release) drvdata->csdev_release(dev); } +static int __exit cti_remove(struct amba_device *adev) +{ + struct cti_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + mutex_lock(&ect_mutex); + cti_remove_conn_xrefs(drvdata); + mutex_unlock(&ect_mutex); + + coresight_unregister(drvdata->csdev); + + return 0; +} static int cti_probe(struct amba_device *adev, const struct amba_id *id) { @@ -957,6 +968,8 @@ static const struct amba_id cti_ids[] = { { 0, 0}, }; +MODULE_DEVICE_TABLE(amba, cti_ids); + static struct amba_driver cti_driver = { .drv = { .name = "coresight-cti", @@ -964,6 +977,7 @@ static struct amba_driver cti_driver = { .suppress_bind_attrs = true, }, .probe = cti_probe, + .remove = cti_remove, .id_table = cti_ids, }; @@ -986,3 +1000,7 @@ static void __exit cti_exit(void) module_init(cti_init); module_exit(cti_exit); + +MODULE_AUTHOR("Mike Leach "); +MODULE_DESCRIPTION("Arm CoreSight CTI Driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 227e234a2470..3629b7885aca 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -75,6 +75,7 @@ coresight_find_csdev_by_fwnode(struct fwnode_handle *r_fwnode) } return csdev; } +EXPORT_SYMBOL_GPL(coresight_find_csdev_by_fwnode); #ifdef CONFIG_OF static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 546c97045afe..5aebdbe293f2 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -288,6 +288,7 @@ void coresight_set_assoc_ectdev_mutex(struct coresight_device *csdev, csdev->ect_dev = ect_csdev; mutex_unlock(&coresight_mutex); } +EXPORT_SYMBOL_GPL(coresight_set_assoc_ectdev_mutex); static int coresight_enable_sink(struct coresight_device *csdev, u32 mode, void *data) From patchwork Mon Sep 28 16:35:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804095 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 052DC139A for ; Mon, 28 Sep 2020 16:41:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B3C6B208FE for ; Mon, 28 Sep 2020 16:41:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0BBu16Y0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="n7Xg3DD0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3C6B208FE 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=merlin.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=yIPymCwuzwt+r3eCr8BufZBq2Z39zSKSin5GuObHGAM=; b=0BBu16Y0pjL/OrHySATm4PV5v P6z4iWLHLd+t/bvyP35wmntF7Kd6CqkIkyoCW1V606836Rsnqk+9fzIXs62BCGZNREODfJkmzlv8l k2Lyxkc/mDywR8Bn+pcihu9P66zRRDUolDGwuvzdM+Y+ZSLR2OJvhYdmL/RI9quyZr+Zg9AKY1vEr 8T14AF3kiX51ptmcSnfGDnadSq04L+Hv7goqE13BxmiUEv01kEoUgc/pkOF4fwljB80613x4NEwBT xoOiQSAOMvEEhF0mgkOGLLNhqpZ/RvIKppbz1U9Fuic8Tq3BXfR9n1GrFcXoBhZGEzUAG/rVvRFfw Pkln0oEDQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwDP-00033g-GR; Mon, 28 Sep 2020 16:41:27 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7o-0000f9-6v for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:47 +0000 Received: by mail-pg1-x543.google.com with SMTP id 34so1297423pgo.13 for ; Mon, 28 Sep 2020 09:35:39 -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=OgGSOrCXLQyAV2gZxStMZAfdrZXXx22iIYuK3Is0SJo=; b=n7Xg3DD0ia9d5X4Xq+I9G1N/47h6NlnuPRHdCgaErHYEr2dY7lmMVbAeFx7OI2qFK7 xDrcakHPanZ42XZHfO5yOF1VKEvuwXN9NPMqySjSetLQLz5jRz8AixQWFBcTew9rgZxu G52dWoSB1je8D/F14sHHK3yV7DPubWHS1YpcTGqdyqC75hynrSUIcEoUKAeOXCPGSPWX 7aWnia/1uq176tELxPJsqd1prGCBWTVeqbpnRvDnicRS7KHqDbv9Q/OFbOsGMDx+Ry7c 3W70KxUg9FkTvLuniyaPD3BIskWp5mNoMsIDZQLGxiH9/mhmlKbb5i1T/dYm5+kXd5BA HOdQ== 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=OgGSOrCXLQyAV2gZxStMZAfdrZXXx22iIYuK3Is0SJo=; b=YKw0IAvCL9eqR7IHbQAQvJVg+0jR/xhcrGqYeyimK7AbbhvxRkN3w5uuIHL4wNeYb0 aYOGbu+V2IyPK4iKYSlqkoV3BLgdNpnayeuN4v0MrYHYkcOEG7UE/8sLoxkIm9bG+Dzx lCRTBKtPG8CN+j7tJARRsCqY5qwClt701QTW2og1T3mkETN8loqkTCW2uX4t1iOX9xuZ AjNYLRJtnx2BFMCIy8IRz7fvaR3eejOv7AfSwZe6gwQ5ZLx91kwFBFD/jzttl4E8HQKo 6DoqU/jVzikyS+Kd0mnygvvT+Blw0RTcdEglVFR5yyg2tuRTtXgCLmmvoGJbO5njZSoq Ai5A== X-Gm-Message-State: AOAM533Qdp08ABxTUp6ESfVU5U3xDFXwkshjXAs05e9qlMBs0DxB9g5+ j1rytxUJ5OzKyZ7jwWxWPy8AQADYgOmVXg== X-Google-Smtp-Source: ABdhPJzhtAbdoo90Cfy9sdx/HUlWhZbTmy/0j/EfBnrYEIHYG6jKtAOj89mNLKLIVedbXd+3jEvmZw== X-Received: by 2002:a63:c18:: with SMTP id b24mr1847450pgl.208.1601310938403; Mon, 28 Sep 2020 09:35:38 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:37 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 22/25] coresight: tmc-etr: Add function to register catu ops Date: Mon, 28 Sep 2020 10:35:10 -0600 Message-Id: <20200928163513.70169-23-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123540_333694_32455D3D X-CRM114-Status: GOOD ( 17.49 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Mian Yousaf Kaukab Make etr_catu_buf_ops static. Instead of directly accessing it in etr_buf_ops[], add a function to let catu driver register the ops at runtime. Break circular dependency between tmc-etr and catu drivers. Signed-off-by: Mian Yousaf Kaukab Signed-off-by: Tingwei Zhang Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-catu.c | 22 +++++++++++++++++-- drivers/hwtracing/coresight/coresight-catu.h | 2 -- .../hwtracing/coresight/coresight-tmc-etr.c | 15 +++++++++++-- drivers/hwtracing/coresight/coresight-tmc.h | 3 +++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 1801804a7762..47696a7d24a7 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -358,7 +358,7 @@ static int catu_alloc_etr_buf(struct tmc_drvdata *tmc_drvdata, return 0; } -const struct etr_buf_operations etr_catu_buf_ops = { +static const struct etr_buf_operations etr_catu_buf_ops = { .alloc = catu_alloc_etr_buf, .free = catu_free_etr_buf, .sync = catu_sync_etr_buf, @@ -582,4 +582,22 @@ static struct amba_driver catu_driver = { .id_table = catu_ids, }; -builtin_amba_driver(catu_driver); +static int __init catu_init(void) +{ + int ret; + + ret = amba_driver_register(&catu_driver); + if (ret) + pr_info("Error registering catu driver\n"); + tmc_etr_set_catu_ops(&etr_catu_buf_ops); + return ret; +} + +static void __exit catu_exit(void) +{ + tmc_etr_remove_catu_ops(); + amba_driver_unregister(&catu_driver); +} + +module_init(catu_init); +module_exit(catu_exit); diff --git a/drivers/hwtracing/coresight/coresight-catu.h b/drivers/hwtracing/coresight/coresight-catu.h index 80ceee3c739c..6160c2d75a56 100644 --- a/drivers/hwtracing/coresight/coresight-catu.h +++ b/drivers/hwtracing/coresight/coresight-catu.h @@ -108,6 +108,4 @@ static inline bool coresight_is_catu_device(struct coresight_device *csdev) return true; } -extern const struct etr_buf_operations etr_catu_buf_ops; - #endif diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index ad991a37e2d2..714f9e867e5f 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -794,10 +794,21 @@ static inline void tmc_etr_disable_catu(struct tmc_drvdata *drvdata) static const struct etr_buf_operations *etr_buf_ops[] = { [ETR_MODE_FLAT] = &etr_flat_buf_ops, [ETR_MODE_ETR_SG] = &etr_sg_buf_ops, - [ETR_MODE_CATU] = IS_ENABLED(CONFIG_CORESIGHT_CATU) - ? &etr_catu_buf_ops : NULL, + [ETR_MODE_CATU] = NULL, }; +void tmc_etr_set_catu_ops(const struct etr_buf_operations *catu) +{ + etr_buf_ops[ETR_MODE_CATU] = catu; +} +EXPORT_SYMBOL_GPL(tmc_etr_set_catu_ops); + +void tmc_etr_remove_catu_ops(void) +{ + etr_buf_ops[ETR_MODE_CATU] = NULL; +} +EXPORT_SYMBOL_GPL(tmc_etr_remove_catu_ops); + static inline int tmc_etr_mode_alloc_buf(int mode, struct tmc_drvdata *drvdata, struct etr_buf *etr_buf, int node, diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 6e8d2dc33d17..b91ec7dde7bc 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -326,4 +326,7 @@ tmc_sg_table_buf_size(struct tmc_sg_table *sg_table) struct coresight_device *tmc_etr_get_catu_device(struct tmc_drvdata *drvdata); +void tmc_etr_set_catu_ops(const struct etr_buf_operations *catu); +void tmc_etr_remove_catu_ops(void); + #endif From patchwork Mon Sep 28 16:35:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804105 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 4CCAE139A for ; Mon, 28 Sep 2020 16:44:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 F2234208FE for ; Mon, 28 Sep 2020 16:44:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kslt5bRE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ic0DY+J4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2234208FE 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=merlin.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=QH5QPbZMszCQmY6qInyhQgbOWBWa8MEUv500OdiZrN4=; b=kslt5bRERXmS+mE5+58Ggt89f OS6PhhhucR5kPICVoZeS0xXnGHWyIGk3IptzlLOFY+6liKA/JznUREysMvVj/PxcOFKd20QN6HInA /McR7CNT0UJNVaQ2phHdSnDKUZN+K+7SLqBka09VoEosohxvrzhyEFsVVjsJoo6L0lTqHLqHoof1C ppur19yDfQXeSpLjGlJDk/XS51mPq4CHqGRVPRGprCWPAocYl6SyFLOR9qxZIDoZ3W8P8Qk2kD/Xk 1MahF99/4LKPodHQG7AIfDKv97aCn2nRGscFFpA6rzpkO1Q8FP2QLK9zVt5zKYUqjFdmUtLIBjS65 4wugQmd0g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwFW-0004Dt-DV; Mon, 28 Sep 2020 16:43:38 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7p-0000fj-Ea for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:48 +0000 Received: by mail-pf1-x444.google.com with SMTP id d9so1531892pfd.3 for ; Mon, 28 Sep 2020 09:35:41 -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=a5qzpqB7NQwWfYWvXhPMQqYvIW0wXYJS9U1EnLj7ruo=; b=Ic0DY+J4C7T5LjPKaY4f1P+MKDv7vcA8G3ERrgMfjQdQKXKH7gg8XcteDcKNQVkb/w W9VzGFkFHpcqhT89hnbCjFlJz6ItgXaRng6EcxuiHJlSf2zZCRcpel3/YCZe3Rmokcxe 5QibuNLDGU5KGnebELfIs+xwqr6tfHNN1GPHadWuPJmVlMq+JuOE2x5bb7LX4JrzARNV Tr16VNkd6vwoB9pAvfU2/MKN4fmXBjJS0Abu5BCb3RgO7GtAXakSTeb8GFzi5oLqdI+o UAEjC6jnvLYLI0v4eMROP1ejo/1Id5iKjlUBnxFMxY+0tEm0bhPg/FxWBXEtzAjj+wn0 HZog== 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=a5qzpqB7NQwWfYWvXhPMQqYvIW0wXYJS9U1EnLj7ruo=; b=l0ZCq1L+1bPA0BQJXlBKXE0xvbGQBfW2+cT4Dw53ujX0a7DSpMIcotJPS7NMGuG/eV 6ZGcm3KzIcq4yCJYuXPLHfrDDnOx8i13s5/od31Sm9R7LYx/XebCJ4K7e6+FOiNna8zZ VJnM9hVUHlO2hRrTrsP+vgm2bKD20Vo9/7jUfalHoEjzO14uKmldOdHdJ3myATpiS6XI ivQ/dhSvt79S3Q4vXJrYSJPVz2r3wzgvpQ7qQKzCqvuC7QP5vhkBrKkfBm1cWXR2Hy09 MofJpamX2Wx4AmW1o1jGsGq+3FY7VCOBXDSKcQuHaipdr1omRmwVyEq2FZhTMVo8KWpq GVbQ== X-Gm-Message-State: AOAM533My+uGLvqb+aD7RtDH0/wYnbWEVvFRrKdR+y8JBoh7HNBGSYyQ 62LUhIdNw+wovPD041kYAoyTEQ== X-Google-Smtp-Source: ABdhPJyrfmcxHn6Dqmy7WiI9wq+pv73WPhJjs+7K6iNf57RwQrTXeHC+VngefGDNXBEVFF2emPaF1A== X-Received: by 2002:a62:7747:0:b029:13f:d779:5f95 with SMTP id s68-20020a6277470000b029013fd7795f95mr256880pfc.2.1601310939553; Mon, 28 Sep 2020 09:35:39 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:38 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 23/25] coresight: catu: Allow catu drivers to be built as modules Date: Mon, 28 Sep 2020 10:35:11 -0600 Message-Id: <20200928163513.70169-24-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123541_561682_AC5025BA X-CRM114-Status: GOOD ( 17.00 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang Allow to build coresight-catu as modules, for ease of development. - Kconfig becomes a tristate, to allow =m - add catu_remove functions, for module unload - add a MODULE_DEVICE_TABLE for autoloading on boot Signed-off-by: Tingwei Zhang Reviewed-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 ++++- drivers/hwtracing/coresight/coresight-catu.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index b04aae2ceecc..dfe407cde262 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -42,7 +42,7 @@ config CORESIGHT_LINK_AND_SINK_TMC module will be called coresight-tmc. config CORESIGHT_CATU - bool "Coresight Address Translation Unit (CATU) driver" + tristate "Coresight Address Translation Unit (CATU) driver" depends on CORESIGHT_LINK_AND_SINK_TMC help Enable support for the Coresight Address Translation Unit (CATU). @@ -52,6 +52,9 @@ config CORESIGHT_CATU by looking up the provided table. CATU can also be used in pass-through mode where the address is not translated. + To compile this driver as a module, choose M here: the + module will be called coresight-catu. + config CORESIGHT_SINK_TPIU tristate "Coresight generic TPIU driver" depends on CORESIGHT_LINKS_AND_SINKS diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 47696a7d24a7..99430f6cf5a5 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -567,11 +567,21 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static int __exit catu_remove(struct amba_device *adev) +{ + struct catu_drvdata *drvdata = dev_get_drvdata(&adev->dev); + + coresight_unregister(drvdata->csdev); + return 0; +} + static struct amba_id catu_ids[] = { CS_AMBA_ID(0x000bb9ee), {}, }; +MODULE_DEVICE_TABLE(amba, catu_ids); + static struct amba_driver catu_driver = { .drv = { .name = "coresight-catu", @@ -579,6 +589,7 @@ static struct amba_driver catu_driver = { .suppress_bind_attrs = true, }, .probe = catu_probe, + .remove = catu_remove, .id_table = catu_ids, }; @@ -601,3 +612,7 @@ static void __exit catu_exit(void) module_init(catu_init); module_exit(catu_exit); + +MODULE_AUTHOR("Suzuki K Poulose "); +MODULE_DESCRIPTION("Arm CoreSight Address Translation Unit (CATU) Driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Sep 28 16:35:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804127 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 8F93F6CB for ; Mon, 28 Sep 2020 16:46:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 5AA1B20717 for ; Mon, 28 Sep 2020 16:46:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="U1nEvLoG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pge0/L76" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AA1B20717 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=merlin.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=q7XSfMzg2KgH5LFWFrM8+O8sTFc7zu+IaQr+uCzdJNc=; b=U1nEvLoGC786DR6abCv7HDsHY svUG7DJxr3QJQ8PqAZ6T8n9ERM/ZdwBcgXYYBEgYdlDjpP49abXVcc9ctFU2CwiyuqlZCCuLgSl5I WTu0mk9J83B4FBIiaGF3YusV5neoELlbPIlzBFjSVcsi/aPtbaqIDknysCEWMZ+5iCY1EwZyKPRa6 QOIj4ctlI5kqepFuJH/I/SR9bW0NXtNV7qj6CcF0+5mfN/8OmzCu1RGX9sCwKTA4lpYPE1MnYK74i kO3IXaUaOI8YQg9DKT8ExuQLuVEmVPUUUEVIsb60qZVSSmaj9DLdGXdPUqFK9jdHFPHfKtOA/F07R 3Swcp8AoQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwG9-0004Xw-TP; Mon, 28 Sep 2020 16:44:18 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7q-0000gC-Gi for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:50 +0000 Received: by mail-pg1-x543.google.com with SMTP id d13so1327274pgl.6 for ; Mon, 28 Sep 2020 09:35:42 -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=AVDy3lRo4u1kGXdA37uwPHSMumdxyJ4pvdoLnVCsqbY=; b=pge0/L761dyNtWA4WDPXGSZbSwCT/Ryl0UdBFpMdClcdiKMZB89vZ4PWlEprve+IX5 I7ULlMjTBwCrsBOg0Szv0qk8r9wSX8dRuKOaRbBPoCHt43PfLvykFzRTLj/qErjHT1+I MUAZ3pZRRTY4Xf38pkn+fMsEPnvAF0SMerGfUSMpkeHfWsWXcq+49XRg+PdUGbvnvq/o Sq9arFcnxujH8HZR0NkZOBlZnEh4mIToPJLc4nHUuMyWezaYLViXlG4BizlImFpnxYi6 9ony3nNaO2irh5l7c8H05tF7THJjvWX/USuVzO5hQTw2LIK7aUJTUx6JTxb8hurdruLa Zk4A== 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=AVDy3lRo4u1kGXdA37uwPHSMumdxyJ4pvdoLnVCsqbY=; b=ePJbPlzPEQKX09o2ZA0IoxyiMvOoQsT5A07wInD1zDl/qexl7Kl7bv/X+Vzw2AA4x6 QI/tpppJHMJYxeYfuIJlSfOKkX9EEqfBbjPyDABq2A3rrC/obREmzx35s4dAqOmALr0z NcZvQanRWC7Z9BdCBnMTNZNN9MZOBr3o6oW1sS9p/GC/cClqHtcwap+wKsjL3YlvDH6b 7lG5MsRPx851g813caH4bJHcu7NZtfLzPZXVUl5tkGkEXDaaH6l5M2XhKL8U7gjnxaPu rHHEc2A7YbYmLSjkkwf6i/Z8keJba0rps4wJEEcbL9lho/DkLRGRR+aL9wGScVO/WySm iGxA== X-Gm-Message-State: AOAM531K8nefBkxW8nyy9erwTDIEoJaj6/m8bamRxUUc/IpomCg9uN+p TZVH6woiZLMt/fS7oGjpiPzNIA== X-Google-Smtp-Source: ABdhPJzC2AVxkr4GIVfKLPkRrx1h28700LxyGtFJT5WmLM/uhXvVg1nFsbegBW1atTv5whas/rUECg== X-Received: by 2002:a62:1dcb:0:b029:13e:d13d:a131 with SMTP id d194-20020a621dcb0000b029013ed13da131mr213756pfd.25.1601310940715; Mon, 28 Sep 2020 09:35:40 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:40 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 24/25] coresight: core: Allow the coresight core driver to be built as a module Date: Mon, 28 Sep 2020 10:35:12 -0600 Message-Id: <20200928163513.70169-25-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123542_606677_919AF72A X-CRM114-Status: GOOD ( 21.77 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:543 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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: Tingwei Zhang Enhance coresight developer's efficiency to debug coresight drivers. - Kconfig becomes a tristate, to allow =m - append -core to source file name to allow module to be called coresight by the Makefile - modules can have only one init/exit, so we add the etm_perf register/unregister function calls to the core init/exit functions. - add a MODULE_DEVICE_TABLE for autoloading on boot Cc: Mathieu Poirier Cc: Leo Yan Cc: Alexander Shishkin Cc: Randy Dunlap Cc: Suzuki K Poulose Cc: Greg Kroah-Hartman Cc: Russell King Signed-off-by: Kim Phillips Signed-off-by: Tingwei Zhang Tested-by: Mike Leach Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 5 ++- drivers/hwtracing/coresight/Makefile | 5 ++- .../{coresight.c => coresight-core.c} | 42 ++++++++++++++----- .../hwtracing/coresight/coresight-etm-perf.c | 8 +++- .../hwtracing/coresight/coresight-etm-perf.h | 3 ++ 5 files changed, 48 insertions(+), 15 deletions(-) rename drivers/hwtracing/coresight/{coresight.c => coresight-core.c} (98%) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index dfe407cde262..c1198245461d 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -3,7 +3,7 @@ # Coresight configuration # menuconfig CORESIGHT - bool "CoreSight Tracing Support" + tristate "CoreSight Tracing Support" depends on ARM || ARM64 depends on OF || ACPI select ARM_AMBA @@ -15,6 +15,9 @@ menuconfig CORESIGHT specification and configure the right series of components when a trace source gets enabled. + To compile this driver as a module, choose M here: the + module will be called coresight. + if CORESIGHT config CORESIGHT_LINKS_AND_SINKS tristate "CoreSight Link and Sink drivers" diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 27034bd4d3c7..f20e357758d1 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -2,8 +2,9 @@ # # Makefile for CoreSight drivers. # -obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o \ - coresight-platform.o coresight-sysfs.o +obj-$(CONFIG_CORESIGHT) += coresight.o +coresight-y := coresight-core.o coresight-etm-perf.o coresight-platform.o \ + coresight-sysfs.o obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o coresight-tmc-y := coresight-tmc-core.o coresight-tmc-etf.o \ coresight-tmc-etr.o diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight-core.c similarity index 98% rename from drivers/hwtracing/coresight/coresight.c rename to drivers/hwtracing/coresight/coresight-core.c index 5aebdbe293f2..6994c1309b2b 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1452,16 +1452,6 @@ int coresight_timeout(void __iomem *addr, u32 offset, int position, int value) } EXPORT_SYMBOL_GPL(coresight_timeout); -struct bus_type coresight_bustype = { - .name = "coresight", -}; - -static int __init coresight_init(void) -{ - return bus_register(&coresight_bustype); -} -postcore_initcall(coresight_init); - /* * coresight_release_platform_data: Release references to the devices connected * to the output port of this device. @@ -1670,3 +1660,35 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict, return name; } EXPORT_SYMBOL_GPL(coresight_alloc_device_name); + +struct bus_type coresight_bustype = { + .name = "coresight", +}; + +static int __init coresight_init(void) +{ + int ret; + + ret = bus_register(&coresight_bustype); + if (ret) + return ret; + + ret = etm_perf_init(); + if (ret) + bus_unregister(&coresight_bustype); + + return ret; +} + +static void __exit coresight_exit(void) +{ + etm_perf_exit(); + bus_unregister(&coresight_bustype); +} + +module_init(coresight_init); +module_exit(coresight_exit); + +MODULE_AUTHOR("Pratik Patel "); +MODULE_AUTHOR("Mathieu Poirier "); +MODULE_DESCRIPTION("Arm CoreSight tracer driver"); diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 47894a0dcf5e..c2c9b127d074 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -599,7 +599,7 @@ void etm_perf_del_symlink_sink(struct coresight_device *csdev) csdev->ea = NULL; } -static int __init etm_perf_init(void) +int __init etm_perf_init(void) { int ret; @@ -626,4 +626,8 @@ static int __init etm_perf_init(void) return ret; } -device_initcall(etm_perf_init); + +void __exit etm_perf_exit(void) +{ + perf_pmu_unregister(&etm_pmu); +} diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h index 05f89723e282..3e4f2ad5e193 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -82,4 +82,7 @@ static inline void *etm_perf_sink_config(struct perf_output_handle *handle) #endif /* CONFIG_CORESIGHT */ +int __init etm_perf_init(void); +void __exit etm_perf_exit(void); + #endif From patchwork Mon Sep 28 16:35:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804125 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 D83746CB for ; Mon, 28 Sep 2020 16:45:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 A00C920717 for ; Mon, 28 Sep 2020 16:45:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dR77o9fH"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Wd/VIwRV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A00C920717 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=merlin.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=5nhXVrPmUj7WCq0beh/lsR7w6riuuDIRw0dAlNIvnzE=; b=dR77o9fHUh9nU7Pk2Q0PLqxZe +yrFMmR4d2lkkLeC+JRTf16vm9UJ2SxhrQw9Dsogups2DLev58O84jSBcpkCn3fmLfdYpqy7/cDiO tbKK2X9N8n5MvXjuCmW4sCtjwP1vR0fIwcqs2ksu5+8ex+CGtgtwNhxdNhE4B8iF5pUzB4pB2lkAa h0tgEkOReVN65yaDh60D+v8VaoA2+Gce986sr9FNy4hHr2nRgzgf8QJCACzVE3CfkLxq1zy87wchP S7wvXkL5J2+IbCQcH+hZm/T5nkDnwyt70UHHHraofNELTogZMhb4krKqKYa+PlHc6FxmRXMRiyycw 23tD9jNWQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwGz-0004xl-P2; Mon, 28 Sep 2020 16:45:09 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7r-0000gk-Mn for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:50 +0000 Received: by mail-pg1-x541.google.com with SMTP id 7so1308203pgm.11 for ; Mon, 28 Sep 2020 09:35:43 -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=TBPXQODSosAA+MQnNKR7oefcB4hNA176v8zrJGqKyUw=; b=Wd/VIwRVSx+9sHI+Ujp5RSkIne7iWqEu8pQJ2s9PA5c/Q28fOHPKGkGKiF1Dnxp6Kk J0e9guXqYtMuDvOeOckVpHjL17VDFfKdTO+WEDeDUh9e/UT1QoUewgD1fCThdrITyAw9 DcKhukZ9KLPUKvDcVDJAA00stRVKvzQDHuRk2ETUxB7BEE4GF2BFPaQFM4kD4K8vYk8d T3q0uk8y5g/QndncVIZXTUbsDKWNZiE4CH8xTupAlHCLmZI33tjAws+WsbSScsv4m1Mv L8ECYGHkMxhcXaNtHlHkQX8HqcecLE64voBVgC8ZVjNWHgnH9SZhIAtSnOtZYwlbJ67i E0qQ== 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=TBPXQODSosAA+MQnNKR7oefcB4hNA176v8zrJGqKyUw=; b=CCJXSuMQOBOjBw0NpNmp4DR3Xm7PNHtLeDZ+wP3Hm0idZJH2mdK8lyil2BPftNeqnI UCY1wy2Z3VquwMfIgbYrL0dUqiTkuaAdvUfujykTlXnkN21Yh/3dGs/op/fzHFRfO/64 x8YxM5MnC2bMwAoweCHHyaB6BXMQskj1UFYp73XHGjdm1otdisLlk4b+HMlb7jybi1Ik YY3zuYlge2lfz3GRz8ZsEv0tT18XEHXACUDEsSlPiUqiYyZvt+XxUvVrnTzvXlSIeu8V 1kZr6d0CnwsLfG3JVczAhZvSfC03SvLG5RdQXR+oXIUDU/VrfTXI+iPovYssvsPOsDBZ qReA== X-Gm-Message-State: AOAM533hhnEMpzU3x5x1xRN99tF104vBzC+EyhG6VB+2592E8fjGwjNZ Vs7VFHVrjqrc8LWMH/1gK8VgiA== X-Google-Smtp-Source: ABdhPJxNoF7c/7JPLSrL8Y9rewdCqbxcmCrsMYIS63nGaLriVkjjzWUx2gnt5y2Mx+6aG+ujqJwSEw== X-Received: by 2002:a62:1542:0:b029:150:e3f5:d8fc with SMTP id 63-20020a6215420000b0290150e3f5d8fcmr250068pfv.66.1601310941899; Mon, 28 Sep 2020 09:35:41 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:41 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 25/25] coresight: etm4x: Fix save and restore of TRCVMIDCCTLR1 register Date: Mon, 28 Sep 2020 10:35:13 -0600 Message-Id: <20200928163513.70169-26-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-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-20200928_123543_789504_3D8F1B4C X-CRM114-Status: GOOD ( 16.09 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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-kernel@vger.kernel.org, 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 In commit f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states"), mistakenly TRCVMIDCCTLR1 register value was saved in trcvmidcctlr0 state variable which is used to store TRCVMIDCCTLR0 register value in etm4x_cpu_save() and then same value is written back to both TRCVMIDCCTLR0 and TRCVMIDCCTLR1 in etm4x_cpu_restore(). There is already a trcvmidcctlr1 state variable available for TRCVMIDCCTLR1, so use it. Fixes: f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states") Signed-off-by: Sai Prakash Ranjan Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index de76d57850bc..abd706b216ac 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1243,7 +1243,7 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trccidcctlr1 = readl(drvdata->base + TRCCIDCCTLR1); state->trcvmidcctlr0 = readl(drvdata->base + TRCVMIDCCTLR0); - state->trcvmidcctlr0 = readl(drvdata->base + TRCVMIDCCTLR1); + state->trcvmidcctlr1 = readl(drvdata->base + TRCVMIDCCTLR1); state->trcclaimset = readl(drvdata->base + TRCCLAIMCLR); @@ -1353,7 +1353,7 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) writel_relaxed(state->trccidcctlr1, drvdata->base + TRCCIDCCTLR1); writel_relaxed(state->trcvmidcctlr0, drvdata->base + TRCVMIDCCTLR0); - writel_relaxed(state->trcvmidcctlr0, drvdata->base + TRCVMIDCCTLR1); + writel_relaxed(state->trcvmidcctlr1, drvdata->base + TRCVMIDCCTLR1); writel_relaxed(state->trcclaimset, drvdata->base + TRCCLAIMSET);