From patchwork Wed Jun 19 19:52:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D175876 for ; Wed, 19 Jun 2019 19:53:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0B522223E for ; Wed, 19 Jun 2019 19:53:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B44DB2869D; Wed, 19 Jun 2019 19:53:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3568D2223E for ; Wed, 19 Jun 2019 19:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1Y6DP6NZ022P9C/JTSaTxnfdcK3rFrHjP4IVnjaCQwI=; b=L5pzoJ+ie1GenY5n9eQEXKVzRN cOssyVeWzvaDWTK43SJUoe7wmiuxt6/PTrgmGlSt7K2Vd/8WpMe2DjCDsYMdF4ys9mVXZZ5tdMfgC c/XdK7lH/yDRers6hndv7eGmrPa1hU9xv8DvIWGPpSkYroW85IT0XFu6pUoCkYHqCTEEDwD/AoFFw J37nLXnI5kfq6019SM89h5gHRp0HVOsJVRiETO3AGrfYZEaMjXFHQ5aZnfyFmv5EqFA85ja6onmtk bCKaFVMBScM2UGIfe77BNuDh2HvBQUPEzEuwZmv3NSYLSiex2x612DvyRk69oWlCTbDAsdsT6kK+J gB09MmpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeW-0006mp-VX; Wed, 19 Jun 2019 19:53:52 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge2-0006L7-SR for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:24 +0000 Received: by mail-pg1-x543.google.com with SMTP id v11so239774pgl.5 for ; Wed, 19 Jun 2019 12:53: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; bh=bUxFfPS39P9fdU4kY1BrfLqP1exnSRK81MEC3yDEPu0=; b=ZacyEvz51O2I0V5F1xg3NL5e/ldty2runRRl/eqK5yEvh6licaMzMfE92JGfBta/bt 5dLlthl4bBb0LEzgKm8/YwVup4XkFb3aT3KFKlbWhK+kwqpH3FKNYPy0iMlc8BpZ8kr4 jsvINukegNsrr0BcW9YyoI9yl9bnbRwpixtn/AUyHCDTzLG8hy959ir573M+RXYMfx6N Pv2WshetDEklvyUt056k5j0SelYCpjBIMF02NYopnTxoB07VEezIvRAOHMAT0nyATKT/ i3c5Wg1hSt1NIHDOmzwAJ0BpxD/21/RlPUYM8MICJe7GFl4UETCmIKpMjGr5lkR1E3Oq aKIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bUxFfPS39P9fdU4kY1BrfLqP1exnSRK81MEC3yDEPu0=; b=SZeE7f0bvBIu4F6FYQg7ynOCIBJ+vy+drM8MOd2Fng8/b444uw4JYdU/lH3g4Yg3Pi dUfHKBi9Nu5iU9wjHFaNDoyl1wlTwSh9VTMdkPdkWzoR/WrD9hnZqSU/VdeNnc6MxabV BwiGxQdLUJ/6QhZI6Ezh4XJomfoHmE1QR5fd8vWgyLu60Ry05xwv5YogcktQ3eb7ZBen WOCWs8p3FCz27AcaFw27shoI8+1p1OEBPDo3KRyRixEWSkH2GrGm7Kcq9Xm45HnsIRiP U1RUS1Hhg+RflFfkP53SdlAwzQwqhncvinqnS9g2KWr4IJAR0biGzucQqJz6A4Pxh2Mx IAhg== X-Gm-Message-State: APjAAAVrHQjZeQ4PVRU91BUfBsoL03OvlQEkO6XnJxN1n3UV9JOpL9Fh NLN7rwxvjNZ9nW6vXZ6ifbLju5aExwOsJg== X-Google-Smtp-Source: APXvYqxTKsRLmkAFW5v1TJff6alf31mGoREUQLxLGxSGUAMLz2raJDqOtuZAuNRvp0u4kbKIFvcZRA== X-Received: by 2002:a17:90a:ca0f:: with SMTP id x15mr9537373pjt.82.1560974001230; Wed, 19 Jun 2019 12:53:21 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:20 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 01/28] coresight: Rename of_coresight to coresight-platform Date: Wed, 19 Jun 2019 13:52:51 -0600 Message-Id: <20190619195318.19254-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125322_916510_667B8C11 X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose Rename the firmware handling file to a more generic name, in preparation for adding ACPI support. Right now we only support DT and we have all the platform handling code in of_coresight.c. Let us rename the file to coresight-platform.c in order to keep the platform handling in a single place for DT and the upcoming ACPI support. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Makefile | 3 +-- .../coresight/{of_coresight.c => coresight-platform.c} | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) rename drivers/hwtracing/coresight/{of_coresight.c => coresight-platform.c} (99%) diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 3b435aa42af5..3c0ac421e211 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -2,8 +2,7 @@ # # Makefile for CoreSight drivers. # -obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o -obj-$(CONFIG_OF) += of_coresight.o +obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o coresight-platform.o obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o \ coresight-tmc-etf.o \ coresight-tmc-etr.o diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/coresight-platform.c similarity index 99% rename from drivers/hwtracing/coresight/of_coresight.c rename to drivers/hwtracing/coresight/coresight-platform.c index 7045930fc958..514cc2b67c36 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -17,7 +17,7 @@ #include #include - +#ifdef CONFIG_OF static int of_dev_node_match(struct device *dev, void *data) { return dev->of_node == data; @@ -295,3 +295,4 @@ of_get_coresight_platform_data(struct device *dev, return pdata; } EXPORT_SYMBOL_GPL(of_get_coresight_platform_data); +#endif From patchwork Wed Jun 19 19:52:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2299213AF for ; Wed, 19 Jun 2019 19:54:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1161B2823E for ; Wed, 19 Jun 2019 19:54:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05829286BF; Wed, 19 Jun 2019 19:54:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9FB002823E for ; Wed, 19 Jun 2019 19:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=noXKls5VRq76zZMKstRTDzGS8SA+7SleCAI/20+HEjc=; b=nTC+h7rgr7mdRIgC4sOEzaS6C8 ZF5cwVdmZaamKlTcinLlCpmqPKyrMLf1UC1Y1roiZl/Rrk1HU1V9q5LE/U28pZ1wPBhdSi6LOc46c GI6DfAwl6UI/6qtm7FDkp6OuNd9xT8Ud/3LOKobySSqLZbSN+UKQPmVowe7z9zxcJ1+f845h3ua10 M5enmvKbTJdl3ltLYcK2IzCZM1l7djQtFr1hPeWYtYMoi8IiToKc3tTE3B/jVrrqHE4Sd38RTonY5 kGh/ewAj/Uwuok+GWOCUYrw8r9AUNCZMNYO0zH8KLGHJn9W9afS+Ml+rZjOFwKzJN5iEBk4CtxL47 sOzME3KA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgew-00077w-Hc; Wed, 19 Jun 2019 19:54:18 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge2-0006Lc-VG for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:24 +0000 Received: by mail-pf1-x444.google.com with SMTP id x15so226896pfq.0 for ; Wed, 19 Jun 2019 12:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P8HOcu/iy58r97z1ZeEK9hZTcUyQU9lbtvmBDEqsK0c=; b=HZYZbfxZ3R7+ROW5dAEMg8DgSLM+/BnI03yeIpiJeZiakmeraas8sObZF66vsOZ+IU Buw193psMwN96EXdbSjrsdqkOIZpU5pBRQMELXRDzdWjy3eQfhirpolLBZHFUokXz1Zo oUWZYmNTkcIVfjGCwyxly+2dLDFVf+Ju7ElSkyUc2SLdPNgzefDRk43y8JzMbG/XsnKa bNDDx9rfcpgSIriDnNn9iLdgNtBN9TbFt7BrUc1AbpUH3MHi0Kp25Kv2jjJ46H952VMd edwqgdBraXmtAs2ZqtBemdKQALkfvVSu0whss7lZ7BBCkoxHNZ4jJW5+DdLvEz1UH3cg aDFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P8HOcu/iy58r97z1ZeEK9hZTcUyQU9lbtvmBDEqsK0c=; b=D8DAUTYXklYBxRt0fOtww6LbJU3EBCgRZOsMCcCI4UWwQP0La/JS9+tcI5bdYED/2w sEY7KAp//rYoPgPhHppvf1qA6aEW0I5oCUaHApYeU8bdITsZTK1YUjhGYwafClQDuLV4 mCDEFnL7dOQ8KtosxFHhHRqA40xPIdGMJf5/tTVrs8U6pi+3PCg+NM70F9I6C9go5qFW lQ4odzSplF/hstOy8nf2bzOSEHYqi34YxvPK6+c5P5ntRgHVA4X/UE+DTXuPQR1ss5yE phSv+meVOBLz0JAfyJAxaTDTv/UE1SQD4hgi68N981ozAuTsvnlLNIAoJ94W1IfSwC0E CJGQ== X-Gm-Message-State: APjAAAXkdQqWSvQpTvOlrmjIU3s7VP0Y7900rChRSJtU8c3eCcaFMZQj sfcWQLq2DEmWzWL7JrKOTj5y5++FVRhvqg== X-Google-Smtp-Source: APXvYqw9rFiUI6GMFKAtHrduQ2/FMvZkgZ5tyW0xCPx6HplnLAIMAC+0KGPBlT+lZqEIpvkNwfJ5oQ== X-Received: by 2002:a17:90a:360c:: with SMTP id s12mr4826356pjb.30.1560974002135; Wed, 19 Jun 2019 12:53:22 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:21 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 02/28] coresight: platform: Make memory allocation helper generic Date: Wed, 19 Jun 2019 13:52:52 -0600 Message-Id: <20190619195318.19254-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125323_002796_25FBFF0A X-CRM114-Status: GOOD ( 14.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose Rename the of_coresight_alloc_memory() => coresight_alloc_conns() as it is independent of the underlying firmware type. This is in preparation for the ACPI support. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-platform.c | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 514cc2b67c36..4c31299607cf 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -17,6 +17,24 @@ #include #include +/* + * coresight_alloc_conns: Allocate connections record for each output + * port from the device. + */ +static int coresight_alloc_conns(struct device *dev, + struct coresight_platform_data *pdata) +{ + if (pdata->nr_outport) { + pdata->conns = devm_kzalloc(dev, pdata->nr_outport * + sizeof(*pdata->conns), + GFP_KERNEL); + if (!pdata->conns) + return -ENOMEM; + } + + return 0; +} + #ifdef CONFIG_OF static int of_dev_node_match(struct device *dev, void *data) { @@ -133,20 +151,6 @@ static void of_coresight_get_ports(const struct device_node *node, } } -static int of_coresight_alloc_memory(struct device *dev, - struct coresight_platform_data *pdata) -{ - if (pdata->nr_outport) { - pdata->conns = devm_kzalloc(dev, pdata->nr_outport * - sizeof(*pdata->conns), - GFP_KERNEL); - if (!pdata->conns) - return -ENOMEM; - } - - return 0; -} - int of_coresight_get_cpu(const struct device_node *node) { int cpu; @@ -252,7 +256,7 @@ of_get_coresight_platform_data(struct device *dev, if (!pdata->nr_outport) return pdata; - ret = of_coresight_alloc_memory(dev, pdata); + ret = coresight_alloc_conns(dev, pdata); if (ret) return ERR_PTR(ret); From patchwork Wed Jun 19 19:52:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43F2576 for ; Wed, 19 Jun 2019 19:54:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F5802223E for ; Wed, 19 Jun 2019 19:54:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 206BA2869D; Wed, 19 Jun 2019 19:54:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD8952223E for ; Wed, 19 Jun 2019 19:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3Wkk8Wg5kf5yJfh1Zg1QlQ1ayy7G1klS4bc8scvnBHI=; b=YC5MGOY90/XB54WsHbFIBC994L UM4PN4IhOidqov8LH5rYPWv5RGobmU28Aoxdddxe68V2TjKXs0z/cWAlQtE+WFQe19uhF58KGYaWr y045oxBizEEtiquLUcf4otbL6G77qJzeISirgzIFVNftt9bT+m/Ab5QtRvDBXZTPxly5kQJvz8gYG MgZqFi3EGPAA5rhMqdFr2xVybMWL2cVUy4kNSm3t8g23xrLImUh0+p9+RmooFUuCklhD62KSVjvzE gyiX9eVr9SZQXnQS7DiTJkzezItlwYjOt0eYIft4ANgCL+0+ZGIGKaIbiSEM5vQFkK+7gO9xE/aJk CHbTXDGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgfE-0007Rc-WE; Wed, 19 Jun 2019 19:54:37 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge3-0006MO-Q0 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:25 +0000 Received: by mail-pf1-x441.google.com with SMTP id m30so202392pff.8 for ; Wed, 19 Jun 2019 12:53: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; bh=FnDr//WBMjqUCzmJ1siLDIF1sonMXILv1ogujL+lmt0=; b=L30mxg/lnx2/wbRwEiKL9gmPTNsGHJ52gXMW0DcKJz87uCpW47xGDOnzkvQmx1rV0Z Fi6h8R7MZOGIraUeVZBy7BjyCTYJxpJkbOTBqwBm08Gzi6b4NT7LtQTkON5mV6YqH1po owjdGbs/jnH/Cbfx525QZBkTCffkhfkuFulS8MAVgdE8U2IUpy5eP9kNRDi5fGn5b59S iFpDFuqFRT3XD80taSvC8p+OvG83XGYsWxvFtYh88zncw0BMJOVXqHMyezXE/pmGqkIO wh3zyCI1Y7LPEZAKJmWmg7iiV0KOyKhwSL1feOj3BXF/D+F7YvepnVEaPREZ6io1L4r/ AniQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FnDr//WBMjqUCzmJ1siLDIF1sonMXILv1ogujL+lmt0=; b=qhilkfkhOVlipJXPmIdFmwN96VQKUaQcg0r3RIlUY7C24tRCiHE9Mkec+oR4SW95YR EvAPkAjUL8JWTThlGCQgcqV++59T+rikMb9rk36oHJjkyWhMsJeWHW8yG8c2pcK9oFEc TenAYGAmEuxVTgDRkwHtX8MkSPLwX+V3xKUh0ktoE6CwTg0jEmtAT6Mq62+xPOKIoQ+v 4mpjM/XLjaeuFPUKbDn9vE7Lao26Extv9uAfhnKXCdl2GmGVtva3YogS5QkdY78XtEkv I72V52iwaC45G3H5IAYsqd+Qo66WaVKXsxyvEzy7PgY/YYfSBD1KukKPKfaRJsj1cidP n51Q== X-Gm-Message-State: APjAAAVS4nWkbcdRj2oI0uaSNFpl5QiEiLx/Q7Jt1x80WkhFlXuDkIaS ce0HYTxqf0aocHNkDk4Pg9+ttJSWaVxoCQ== X-Google-Smtp-Source: APXvYqynzGNpDXLiYIwaTLJ2/ZeV3XntQaSqkdYx1d9Dlqnzs46BHqq5ZWVr3Qo5+r51GtYnRsvwCA== X-Received: by 2002:a63:35c7:: with SMTP id c190mr3049052pga.445.1560974002997; Wed, 19 Jun 2019 12:53:22 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:22 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 03/28] coresight: Make sure device uses DT for obsolete compatible check Date: Wed, 19 Jun 2019 13:52:53 -0600 Message-Id: <20190619195318.19254-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125323_842859_AB75F9F4 X-CRM114-Status: GOOD ( 13.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose As we prepare to add support for ACPI bindings, let us make sure we do the compatible check only if we are sure we are dealing with a DT based system. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-funnel.c | 3 ++- drivers/hwtracing/coresight/coresight-replicator.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 6236a847bb0b..3423042e7a52 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -196,7 +196,8 @@ static int funnel_probe(struct device *dev, struct resource *res) dev->platform_data = pdata; } - if (of_device_is_compatible(np, "arm,coresight-funnel")) + if (is_of_node(dev_fwnode(dev)) && + of_device_is_compatible(dev->of_node, "arm,coresight-funnel")) pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n"); drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index ee6ad34061a5..7e0514557920 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -187,7 +187,8 @@ static int replicator_probe(struct device *dev, struct resource *res) dev->platform_data = pdata; } - if (of_device_is_compatible(np, "arm,coresight-replicator")) + if (is_of_node(dev_fwnode(dev)) && + of_device_is_compatible(dev->of_node, "arm,coresight-replicator")) pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n"); drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); From patchwork Wed Jun 19 19:52:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B464676 for ; Wed, 19 Jun 2019 19:55:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2DC52823E for ; Wed, 19 Jun 2019 19:55:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97517286BF; Wed, 19 Jun 2019 19:55:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B60E32869D for ; Wed, 19 Jun 2019 19:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=VvqhZvvUDC1OvrGWdUhWD6z2C/dL7hLfDFByTF2FJ7Y=; b=YJ4oJ7YCTHy5+YOxMhT4lam7s/ 23DEfJnJxttwnnh/1Kl9aVmeAdH0l5qN8m/4+H1M/8wV8RZVF2PI4K0ThHeFocT4nLwW4KT20m8Xj 7xxF83fAbnk0bKVQH7Sva8y+bEHvYGFxBGyDJ7ZXvXNKeB7211TWiZ5stnM1Obd3UKTx405Ack3Bu 4Stz9lYSFHWvSdznrag/XJwHYOmIpzJ0X0lLt/Ky5708WjCkFCG8BiqlIYYPs7TrM6Qnk7PnR4FLd o+d+dI6do2LNPiqaAsOtB7wdTX1be6untFC4NYUYSU99xzU9ntsOiYq7SlPCO3kmTLiKs79Wkh4jr lxZEr08Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgfn-0007lZ-0y; Wed, 19 Jun 2019 19:55:11 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge5-0006NC-14 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:27 +0000 Received: by mail-pg1-x544.google.com with SMTP id s27so250050pgl.2 for ; Wed, 19 Jun 2019 12:53: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; bh=TOsro5wxKVAEEz/ic882lhEnM11CUUCdHgLpzCI0qQU=; b=rMUCCwuT9rb1WZ/S+GfDPjMG3MhldWpVSxIX0SyjkAe1ELm7zCFHpNuSgR71Hr3uB5 JKY42xInG8hqXSDCUiLOfOaaJSeCuT4AZWb/b/ikXlOf8+T5vgB/aK5nTzY2FjKZdh42 pHjbmMgMXjNUoIQL8hOgGKQf0cMNcVWh61i54F34KMON2YYo0vKjiFD69V3wKGoPNulG t1yxpoMN3cJwxIXANN/vocFrL/Nag5zrqjCYm+hlOJBULehBoVP7HmgmstwxWEC7FNJj jKox3Dv1r5q9JWMp57pS+M9PiVDrN9P9gBgLtTlTxkVMyGoPcFLaNV67YMv/DJzJE0TB Cd5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TOsro5wxKVAEEz/ic882lhEnM11CUUCdHgLpzCI0qQU=; b=s9+E034RzkySvAORzkXWOvfiAH8EO07+CXb6MwVhCliUiQYwE9lG33IC4OPJkOIO8l iwz8+JgN1wFmXAnvWFrEuO714KbL5a7ToXTjdPdOjwtVKaCQ+Bzt1A0yuS7BOK8IrJFT hvuRLbYwD2RoJjp4bJ3EypYrEceRYwUrTMO+xGMqaGnhIosZBXR4HYg6BtoD3cBSjHQs yr7y6tB7F/a9EB/H0ybvREz+WA7EWxvGMOOhJ15XG0/lfBdVjA7k6uySXOa7EysMsyMu uGMZdCy5kZWBDjMTajUDd1Gd1+GZ25XRLbczmxaWIdYYGnHejn+akSingXbZhs5tajEK 60gw== X-Gm-Message-State: APjAAAUXNBA8qi73f/PRaZn3PUEwZzapNf1NJ/yPPSJPZzlMUHrIqCty shZVHESIfh6WwcBWXTl9dhlgsyHIlLsgAg== X-Google-Smtp-Source: APXvYqy5jbjA5ESwhKWoq8urWzJ5G9+DZfMNK5ir3TEyTQcHaXLXZiz4vJr73rwcg3q25lDSfUrHNg== X-Received: by 2002:a17:90a:a505:: with SMTP id a5mr13116839pjq.27.1560974004142; Wed, 19 Jun 2019 12:53:24 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:23 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 04/28] coresight: Introduce generic platform data helper Date: Wed, 19 Jun 2019 13:52:54 -0600 Message-Id: <20190619195318.19254-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125325_072547_B459B314 X-CRM114-Status: GOOD ( 18.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose So far we have hard coded the DT platform parsing code in every driver. Introduce generic helper to parse the information provided by the firmware in a platform agnostic manner, in preparation for the ACPI support. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-catu.c | 13 ++--- drivers/hwtracing/coresight/coresight-etb10.c | 11 ++-- drivers/hwtracing/coresight/coresight-etm3x.c | 12 ++-- drivers/hwtracing/coresight/coresight-etm4x.c | 11 ++-- .../hwtracing/coresight/coresight-funnel.c | 11 ++-- .../hwtracing/coresight/coresight-platform.c | 58 ++++++++++++++----- .../coresight/coresight-replicator.c | 11 ++-- drivers/hwtracing/coresight/coresight-stm.c | 11 ++-- drivers/hwtracing/coresight/coresight-tmc.c | 13 ++--- drivers/hwtracing/coresight/coresight-tpiu.c | 11 ++-- include/linux/coresight.h | 7 +-- 11 files changed, 83 insertions(+), 86 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 63109c98765c..799ba1dd877e 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -503,17 +503,14 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) struct coresight_desc catu_desc; struct coresight_platform_data *pdata = NULL; struct device *dev = &adev->dev; - struct device_node *np = dev->of_node; void __iomem *base; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto out; - } - dev->platform_data = pdata; + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out; } + dev->platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) { diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 0c9161fe4233..cb8cb03e0cdb 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -732,14 +732,11 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) struct etb_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index fa2f1417cafb..fa2164ff07c2 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -790,20 +790,16 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) struct etm_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; drvdata->use_cp14 = fwnode_property_read_bool(dev->fwnode, "arm,cp14"); dev_set_drvdata(dev, drvdata); diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 77d1d837da52..4355b2e8c308 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1084,18 +1084,15 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) struct etmv4_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; dev_set_drvdata(dev, drvdata); diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 3423042e7a52..fc033fdb6cd5 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -187,14 +187,11 @@ static int funnel_probe(struct device *dev, struct resource *res) struct coresight_platform_data *pdata = NULL; struct funnel_drvdata *drvdata; struct coresight_desc desc = { 0 }; - struct device_node *np = dev->of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - dev->platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + dev->platform_data = pdata; if (is_of_node(dev_fwnode(dev)) && of_device_is_compatible(dev->of_node, "arm,coresight-funnel")) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 4c31299607cf..5d78f4fbd97d 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -230,23 +230,16 @@ static int of_coresight_parse_endpoint(struct device *dev, return ret; } -struct coresight_platform_data * -of_get_coresight_platform_data(struct device *dev, - const struct device_node *node) +static int of_get_coresight_platform_data(struct device *dev, + struct coresight_platform_data *pdata) { int ret = 0; - struct coresight_platform_data *pdata; struct coresight_connection *conn; struct device_node *ep = NULL; const struct device_node *parent = NULL; bool legacy_binding = false; + struct device_node *node = dev->of_node; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return ERR_PTR(-ENOMEM); - - /* Use device name as sysfs handle */ - pdata->name = dev_name(dev); pdata->cpu = of_coresight_get_cpu(node); /* Get the number of input and output port for this component */ @@ -254,11 +247,11 @@ of_get_coresight_platform_data(struct device *dev, /* If there are no output connections, we are done */ if (!pdata->nr_outport) - return pdata; + return 0; ret = coresight_alloc_conns(dev, pdata); if (ret) - return ERR_PTR(ret); + return ret; parent = of_coresight_get_output_ports_node(node); /* @@ -292,11 +285,46 @@ of_get_coresight_platform_data(struct device *dev, case 0: break; default: - return ERR_PTR(ret); + return ret; } } - return pdata; + return 0; +} +#else +static inline int +of_get_coresight_platform_data(struct device *dev, + struct coresight_platform_data *pdata) +{ + return -ENOENT; } -EXPORT_SYMBOL_GPL(of_get_coresight_platform_data); #endif + +struct coresight_platform_data * +coresight_get_platform_data(struct device *dev) +{ + int ret = -ENOENT; + struct coresight_platform_data *pdata; + struct fwnode_handle *fwnode = dev_fwnode(dev); + + if (IS_ERR_OR_NULL(fwnode)) + goto error; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + ret = -ENOMEM; + goto error; + } + + /* Use device name as sysfs handle */ + pdata->name = dev_name(dev); + + if (is_of_node(fwnode)) + ret = of_get_coresight_platform_data(dev, pdata); + + if (!ret) + return pdata; +error: + return ERR_PTR(ret); +} +EXPORT_SYMBOL_GPL(coresight_get_platform_data); diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 7e0514557920..054b33554695 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -177,15 +177,12 @@ static int replicator_probe(struct device *dev, struct resource *res) struct coresight_platform_data *pdata = NULL; struct replicator_drvdata *drvdata; struct coresight_desc desc = { 0 }; - struct device_node *np = dev->of_node; void __iomem *base; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - dev->platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + dev->platform_data = pdata; if (is_of_node(dev_fwnode(dev)) && of_device_is_compatible(dev->of_node, "arm,coresight-replicator")) diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 3992a35e34e4..9faa1ed01500 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -809,14 +809,11 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) struct resource ch_res; size_t bitmap_size; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 9c5e615c1486..be0bd98ca8c1 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -397,16 +397,13 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) struct tmc_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto out; - } - adev->dev.platform_data = pdata; + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out; } + adev->dev.platform_data = pdata; ret = -ENOMEM; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index 4dd3e7f63050..aec0ed7bf924 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -124,14 +124,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) struct tpiu_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - struct device_node *np = adev->dev.of_node; - if (np) { - pdata = of_get_coresight_platform_data(dev, np); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + dev->platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 62a520df8add..e2b95e05e0be 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -294,14 +294,11 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} #ifdef CONFIG_OF extern int of_coresight_get_cpu(const struct device_node *node); -extern struct coresight_platform_data * -of_get_coresight_platform_data(struct device *dev, - const struct device_node *node); #else static inline int of_coresight_get_cpu(const struct device_node *node) { return 0; } -static inline struct coresight_platform_data *of_get_coresight_platform_data( - struct device *dev, const struct device_node *node) { return NULL; } #endif +struct coresight_platform_data *coresight_get_platform_data(struct device *dev); + #endif From patchwork Wed Jun 19 19:52:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 458F776 for ; Wed, 19 Jun 2019 19:55:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3289728644 for ; Wed, 19 Jun 2019 19:55:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 236C528650; Wed, 19 Jun 2019 19:55:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A328828644 for ; Wed, 19 Jun 2019 19:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=MpzfYU/cIAMRtdX3uMNENFwu/NcXL0W8+cFkC/8WRIc=; b=qHC0Rss+xxMcI+JWIpgsqYLuo7 q2RZhEpdiwVHvW6LHEK+OxwlvI0f5Y6NWBQ+dLQab8j+q7tJg1Y5gPUhRa8A0dq75iISGXJeOELl7 XsLyILQ1kNI2OeVCnfy2vq77rfeVTnLdyyAz+kbrB4Mzx70EoIvBQBCKXJItEQ1RQm2dRHiHdh8Wv X2HtdRKWdkrdw+0BMqc2aWjrHWZXAybYK1Dfb+b/jc2znwixCdUmZ7uZ9wRSxBurolTx9Mxfj1akC vU+LSaFNfizYPioecmzgdNt7ojr1K5WcoOmXmGa7jky6Yk6lyfN6u0P8dzJVrE8ATbBvzG1ij/dO+ WzY6Xh6g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgg8-0000ph-NU; Wed, 19 Jun 2019 19:55:32 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge6-0006O5-3a for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:27 +0000 Received: by mail-pg1-x541.google.com with SMTP id 196so237172pgc.6 for ; Wed, 19 Jun 2019 12:53: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; bh=ZsHMhd4UvtNqVCHiYk9E1/62IJNBdhITI8cjZrmiFqs=; b=KVQIxFbnPPq0SSfglY+vWoHc2q2YBZcJBK4ntdkpPvCj4zXz+fpKVHA3Ie9VZppwpn nIfX+cgSobA/holvlugjVAjhE8wyatCzY0qHJJeZU15iThxFQsl0ETbg/TkH9J4GnByP uTud1Xc25Y84uW+0ZMbYy0oEHPCCGtO53TW8eCRzQc5hZr8HNoIzOWEdQZfvUOFsWivY GznMrmWhkx5FvLLx21YHCOn6G4y5a7T5UvolKVvnid7kbnFruOe80U381SUoOU8cmbzh hVKDU0jYipD56gJ9LJSDdbBgxwHu/twlzJm4jQtcL1i0/o4+poQFVUMlf8zyTFhw9qZs Gb2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZsHMhd4UvtNqVCHiYk9E1/62IJNBdhITI8cjZrmiFqs=; b=m+gFVElNISt8czKV3rgvkn+sex7I/s5JNipvw1sM0Oa6wrRfkH+BkDGCa0omtT0XdM wfm0teSq+UX+/nPoVXxSoJXjbZ7tQvPP30pEP95Cs4jmx2fP/EUUXhFY+O4JtR/D0twP Gg2ii1IztoI+tpAElmQxjt2ibNISs+IXdORDTQwvsXwhx0m7XBrcdztfwxhN83m7DboD CabpiahnT2LwDPla5H53Gnk3oL535+Gl2DgMKUXHeRJH4JsOl435/i46mFkaVna7n6wN DnXFBpH6aW9MVc7S98eQAMcF/pOdlmpJ6KdjW+LaTjgDVyFoHtwuB6UjkQfTx1iwr/N8 QZgA== X-Gm-Message-State: APjAAAU/g8BTOS1oYB9if3LjbcpI7JVwCuV/364yMh807X5tanLlnFAB kUchIFnF+u+DtVt0+04heUhS8PbmGaVb8A== X-Google-Smtp-Source: APXvYqxOSOTbixpp5kg+m6yC6tF6uuhEMwF8gEJvZn6ksYCIkY31D0pxCh9zUFFppDmXm2zhMeoFWg== X-Received: by 2002:a63:d950:: with SMTP id e16mr9678047pgj.271.1560974005068; Wed, 19 Jun 2019 12:53:25 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:24 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 05/28] coresight: Make device to CPU mapping generic Date: Wed, 19 Jun 2019 13:52:55 -0600 Message-Id: <20190619195318.19254-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125326_182680_7832E5E0 X-CRM114-Status: GOOD ( 15.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose The CoreSight components ETM and CPU-Debug are always associated with CPUs. Replace the of_coresight_get_cpu() with a platform agnostic helper, in preparation to add ACPI support. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-cpu-debug.c | 3 +-- .../hwtracing/coresight/coresight-platform.c | 18 +++++++++++++----- include/linux/coresight.h | 7 +------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c index e8819d750938..07a1367c733f 100644 --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c @@ -572,14 +572,13 @@ static int debug_probe(struct amba_device *adev, const struct amba_id *id) struct device *dev = &adev->dev; struct debug_drvdata *drvdata; struct resource *res = &adev->res; - struct device_node *np = adev->dev.of_node; int ret; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - drvdata->cpu = np ? of_coresight_get_cpu(np) : 0; + drvdata->cpu = coresight_get_cpu(dev); if (per_cpu(debug_drvdata, drvdata->cpu)) { dev_err(dev, "CPU%d drvdata has already been initialized\n", drvdata->cpu); diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 5d78f4fbd97d..ba8c14635c6b 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -151,12 +151,14 @@ static void of_coresight_get_ports(const struct device_node *node, } } -int of_coresight_get_cpu(const struct device_node *node) +static int of_coresight_get_cpu(struct device *dev) { int cpu; struct device_node *dn; - dn = of_parse_phandle(node, "cpu", 0); + if (!dev->of_node) + return 0; + dn = of_parse_phandle(dev->of_node, "cpu", 0); /* Affinity defaults to CPU0 */ if (!dn) return 0; @@ -166,7 +168,6 @@ int of_coresight_get_cpu(const struct device_node *node) /* Affinity to CPU0 if no cpu nodes are found */ return (cpu < 0) ? 0 : cpu; } -EXPORT_SYMBOL_GPL(of_coresight_get_cpu); /* * of_coresight_parse_endpoint : Parse the given output endpoint @ep @@ -240,8 +241,6 @@ static int of_get_coresight_platform_data(struct device *dev, bool legacy_binding = false; struct device_node *node = dev->of_node; - pdata->cpu = of_coresight_get_cpu(node); - /* Get the number of input and output port for this component */ of_coresight_get_ports(node, &pdata->nr_inport, &pdata->nr_outport); @@ -300,6 +299,14 @@ of_get_coresight_platform_data(struct device *dev, } #endif +int coresight_get_cpu(struct device *dev) +{ + if (is_of_node(dev->fwnode)) + return of_coresight_get_cpu(dev); + return 0; +} +EXPORT_SYMBOL_GPL(coresight_get_cpu); + struct coresight_platform_data * coresight_get_platform_data(struct device *dev) { @@ -318,6 +325,7 @@ coresight_get_platform_data(struct device *dev) /* Use device name as sysfs handle */ pdata->name = dev_name(dev); + pdata->cpu = coresight_get_cpu(dev); if (is_of_node(fwnode)) ret = of_get_coresight_platform_data(dev, pdata); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index e2b95e05e0be..98a4440dea3e 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -292,12 +292,7 @@ static inline void coresight_disclaim_device_unlocked(void __iomem *base) {} #endif -#ifdef CONFIG_OF -extern int of_coresight_get_cpu(const struct device_node *node); -#else -static inline int of_coresight_get_cpu(const struct device_node *node) -{ return 0; } -#endif +extern int coresight_get_cpu(struct device *dev); struct coresight_platform_data *coresight_get_platform_data(struct device *dev); From patchwork Wed Jun 19 19:52:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC30476 for ; Wed, 19 Jun 2019 19:56:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D95F628644 for ; Wed, 19 Jun 2019 19:56:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBAA0286DF; Wed, 19 Jun 2019 19:56:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 69DB528644 for ; Wed, 19 Jun 2019 19:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2yEE7MpCHqNQU7cW7V70akiM8YMXt7fGKK+VZS/ezzg=; b=cyrQXeyBJYXsK6iqJDGJmh1ua4 r7kZLY2WjDOuZCuGOvMycVfpXIsv+k6LloYdma34ca6PYEjmzY6565O5MuxjbUxI8Lg24KEzgAzic WSkSKcY6huQGtUEUKpI1vhDkdMPlWdroPNaJqfHVtR136UMKOOoKTjpqYIGrM32OdUOuN+GVu9WB/ V56f2z6DzMYtlzWHTbf+S2SHuis50H0lRvYUvAnaPdM6ZDOQVFJsSszKL2qELV8E/VfuOwXPHGGNf Uv5CgULvGO+DisPM/0S+a7mS9jHqiVf04CHCZrGcRRjTnuX+/2EhDj1OOplukNsWBcQmvG4G/cDj4 9uT4N4ZQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdggZ-000192-VJ; Wed, 19 Jun 2019 19:56:00 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge6-0006P8-WB for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:28 +0000 Received: by mail-pf1-x442.google.com with SMTP id r7so216288pfl.3 for ; Wed, 19 Jun 2019 12:53: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; bh=3FNM7irOGkHJQx+HodJo4nth9GnuaBbG1lJL4fmhw34=; b=PsznvdRhHsdAZMVITq/4kn/w3emBGYGGs9HF1FuMuvGKQE8bjhlbJM95qDZ2WKCwLQ N1rEZbibA4dIIXU940k40/fkhdL/DJr+s6FdcS89FjGwKd/lDatVg0QEoAXJRddGPZxw C2oZMCx8pY2EsfadRoQnjbH6ojLvN4dI/oB5YgIwVr/gm+G3LVmaI82fzfPDav6Y5ZCY mmxSWg6qggo8scnE94b6fW8x2I9oMz9XUuPVXwHLfB4Jq/MeioNcPd9RZcpJBGe8M+bm /wyY1504aqEhvF6OstPGkTziNUsNZ4P1SQ335FVNWgZYwoLI+D0KFBmsl0FLVcn3EU5W ORUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3FNM7irOGkHJQx+HodJo4nth9GnuaBbG1lJL4fmhw34=; b=TENgAnktWhoD18U8PaYU3l2hCPqptk/VE3H1IsVVsf9e6eRjGGHJjtS87wAH03oU51 cSLNc5F3qh+TCFxPPOkKlSHQEr3C9H3djCYLOV+eeDrgH730iiD/Hv5Aru4KN8J0hfu2 O0NtXxnDG/BczJ8Gr6m090NfT8OgAdwD906UyK6YuBjaepfTknfANnOJYrgWbsKCsg/V 0oSEGublHJb7toce2ztngJjSIlnfOGv+x4TLAxjUAkbDFPukjSOmbrskFQZfzRratcF+ sewY7hDzuuA+0qMy4yQJkbhDNJc8NOyc/MY7qD41P7yboWCSWWpeivjozsXSMGFUBffx MdAQ== X-Gm-Message-State: APjAAAV/DcGKGR8AW8Dso1WOYlnhtTQC1GyFt1tv3rHbkjE3QFUsaCud YQ3NA4BRITSlcarpSTvw/BAiqw== X-Google-Smtp-Source: APXvYqxnKijOhLxbaeOFhyUy7Q4c311Yx9bAJ1qw0LaB7tjR17rNx4VKIrmnu+kstjNZJsLr4+5VHg== X-Received: by 2002:a63:364f:: with SMTP id d76mr9152262pga.147.1560974006069; Wed, 19 Jun 2019 12:53:26 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:25 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 06/28] coresight: Remove cpu field from platform data Date: Wed, 19 Jun 2019 13:52:56 -0600 Message-Id: <20190619195318.19254-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125327_080189_DE2E4908 X-CRM114-Status: GOOD ( 15.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose CPU field is only used by ETMs and there is a separate API for fetching the same. So, let us use that instead of using the common platform probing helper. Also, remove it from the platform_data. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm3x.c | 2 +- drivers/hwtracing/coresight/coresight-etm4x.c | 2 +- drivers/hwtracing/coresight/coresight-platform.c | 1 - include/linux/coresight.h | 2 -- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index fa2164ff07c2..722fab9632ef 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -819,7 +819,7 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) return ret; } - drvdata->cpu = pdata ? pdata->cpu : 0; + drvdata->cpu = coresight_get_cpu(dev); cpus_read_lock(); etmdrvdata[drvdata->cpu] = drvdata; diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 4355b2e8c308..03576f3ed22d 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1105,7 +1105,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) spin_lock_init(&drvdata->spinlock); - drvdata->cpu = pdata ? pdata->cpu : 0; + drvdata->cpu = coresight_get_cpu(dev); cpus_read_lock(); etmdrvdata[drvdata->cpu] = drvdata; diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index ba8c14635c6b..541e500a83c2 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -325,7 +325,6 @@ coresight_get_platform_data(struct device *dev) /* Use device name as sysfs handle */ pdata->name = dev_name(dev); - pdata->cpu = coresight_get_cpu(dev); if (is_of_node(fwnode)) ret = of_get_coresight_platform_data(dev, pdata); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 98a4440dea3e..bf241dbf99c5 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -91,14 +91,12 @@ union coresight_dev_subtype { /** * struct coresight_platform_data - data harvested from the DT specification - * @cpu: the CPU a source belongs to. Only applicable for ETM/PTMs. * @name: name of the component as shown under sysfs. * @nr_inport: number of input ports for this component. * @nr_outport: number of output ports for this component. * @conns: Array of nr_outport connections from this component */ struct coresight_platform_data { - int cpu; const char *name; int nr_inport; int nr_outport; From patchwork Wed Jun 19 19:52:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A391213AF for ; Wed, 19 Jun 2019 19:56:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 914CF28644 for ; Wed, 19 Jun 2019 19:56:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8437B286BF; Wed, 19 Jun 2019 19:56:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B56428644 for ; Wed, 19 Jun 2019 19:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Zqs+Y5XTNMp6yavwN4ewRP4ilpfnOZQ3TzKh07BCI/4=; b=ZxW2iXV/8v0MPdNig+IZdz/gn1 bQYB4foiC1NP8MweoS1oifT6wO/Bn5djysUi6QF8gGbDfHB8lEdF2Eu5gr9jFt72SEe3ggARUK6mx 7HMvt7YJD1l0C+id7HYuiE/oSErro2iEBitjsOmEQ6jvR18V31Zc0Cf/7FT50379RjuasuAsXLoYJ d4QeIsSWvni6o5p9DS6EMkd1UJrEthGi4ju8ah+OzcgqGH1RabRCVV7dOKyu5jNPyqm4vAFovHBR9 x3MUdqoUnTvVqPO7Nw3su7RlXzR0hEiuHkGR476+dHYPHES8aY6ZIWFW5PxOeSb4Kn+rnadb1jjux jLnqqISA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdggv-0001SW-KD; Wed, 19 Jun 2019 19:56:21 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge8-0006QY-80 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:30 +0000 Received: by mail-pf1-x443.google.com with SMTP id m30so202489pff.8 for ; Wed, 19 Jun 2019 12:53: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; bh=tiXUTbhpb8QTXLfXKxw0xlSbjGmKnd5NIC4uXUkTfag=; b=x6vargVhv5KJiaL5jE7xlInZafcFZjzl4NPQ8d8fNQRqlM6iQb2sVMv5RZXoEnWYRa APVL0oFzDIg3mytBNVOCXeRGqZ5nOvFqwUpLrLqDnFs2+T9xqxXAeEfJuSGFsUaW4Sen KHEOKPf14R9SKbKTMEX1JonduKtYqLTzRWvpNb+cDzVj51R52hMtLvcouMaVqhNVEZyF DuaE4rofSM4secSrSV4OShlk1eUSMIBIMrFeSSZv2/Hxea+V64xxY5P1YcgPXBLC/lwM gUg6LhvRqq+MFX2IG9lF4idndF9XU6ylmoh/eQzjmOVZuJaQHcrgm+O5OZdnmfmxB8fP dcoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tiXUTbhpb8QTXLfXKxw0xlSbjGmKnd5NIC4uXUkTfag=; b=WUDANv4twypDUVx/N/wBKOEZBWDZIpu6Ea7Vfez+305dmOUEFadP0MoeltFZoXphoZ ye3r6sPHJs6J1BcxLxZk/ebej0cvP8ru6fgPfbv8ZTVCOqjxh7ZzWpUhVxnDkAKmmwCj C5Jb6w08czLzfUz6XYfC92lTCBXFj7kRWIjSJhOf+j/U+ABkskXbxjS/M/PurA42qhnp iM+buMQoICKE8oJQ4/Pdo508PidlPWr+rX50pPiqnXEg5Oge6LZ/kdZlQtYgUQE5uILt pcjs9xaL7gzcBO0BT4JKOpfwxrreLAAxghOTK3PBUWrGI5H/QtYMMHWlFc0TXvbbwpor lg+Q== X-Gm-Message-State: APjAAAXJkqPpcUinLPqOGNW51EbMdF7ZpAJK9pAP2e2V+kTQBgfudEQc 9QDutybJoK5YYCNTLpJanXI5aRvMlH7Erw== X-Google-Smtp-Source: APXvYqwew2P8Ghqr5hJq+zgppSbbsRS63+rO5Mfru9AhC1Lhibsn8fbkrPzYrpS+p9H9/qeNxu5bQg== X-Received: by 2002:a63:6948:: with SMTP id e69mr9239710pgc.441.1560974007145; Wed, 19 Jun 2019 12:53:27 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:26 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 07/28] coresight: Remove name from platform description Date: Wed, 19 Jun 2019 13:52:57 -0600 Message-Id: <20190619195318.19254-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125328_551550_FD6CBFCA X-CRM114-Status: GOOD ( 18.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose We are about to use a name independent of the parent AMBA device name. As such, there is no need to have it in the platform description. Let us move this to coresight description instead. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-catu.c | 2 ++ drivers/hwtracing/coresight/coresight-etb10.c | 3 ++- drivers/hwtracing/coresight/coresight-etm3x.c | 1 + drivers/hwtracing/coresight/coresight-etm4x.c | 1 + drivers/hwtracing/coresight/coresight-funnel.c | 1 + drivers/hwtracing/coresight/coresight-platform.c | 3 --- drivers/hwtracing/coresight/coresight-replicator.c | 2 ++ drivers/hwtracing/coresight/coresight-stm.c | 1 + drivers/hwtracing/coresight/coresight-tmc.c | 5 +++-- drivers/hwtracing/coresight/coresight-tpiu.c | 1 + drivers/hwtracing/coresight/coresight.c | 2 +- include/linux/coresight.h | 8 ++++---- 12 files changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 799ba1dd877e..05c73045532a 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -551,6 +551,8 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) catu_desc.type = CORESIGHT_DEV_TYPE_HELPER; catu_desc.subtype.helper_subtype = CORESIGHT_DEV_SUBTYPE_HELPER_CATU; catu_desc.ops = &catu_ops; + catu_desc.name = dev_name(dev); + drvdata->csdev = coresight_register(&catu_desc); if (IS_ERR(drvdata->csdev)) ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index cb8cb03e0cdb..8726d6c7663c 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -777,12 +777,13 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &etb_cs_ops; desc.pdata = pdata; desc.dev = dev; + desc.name = dev_name(dev); desc.groups = coresight_etb_groups; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) return PTR_ERR(drvdata->csdev); - drvdata->miscdev.name = pdata->name; + drvdata->miscdev.name = desc.name; drvdata->miscdev.minor = MISC_DYNAMIC_MINOR; drvdata->miscdev.fops = &etb_fops; ret = misc_register(&drvdata->miscdev); diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 722fab9632ef..101fb01e20de 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -854,6 +854,7 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &etm_cs_ops; desc.pdata = pdata; desc.dev = dev; + desc.name = dev_name(dev); desc.groups = coresight_etm_groups; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 03576f3ed22d..8adc1485cd89 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1142,6 +1142,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) desc.pdata = pdata; desc.dev = dev; desc.groups = coresight_etmv4_groups; + desc.name = dev_name(dev); drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index fc033fdb6cd5..ded33f5e7d43 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -229,6 +229,7 @@ static int funnel_probe(struct device *dev, struct resource *res) desc.ops = &funnel_cs_ops; desc.pdata = pdata; desc.dev = dev; + desc.name = dev_name(dev); drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 541e500a83c2..f500de61e7f9 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -323,9 +323,6 @@ coresight_get_platform_data(struct device *dev) goto error; } - /* Use device name as sysfs handle */ - pdata->name = dev_name(dev); - if (is_of_node(fwnode)) ret = of_get_coresight_platform_data(dev, pdata); diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 054b33554695..f28bafd98995 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -220,6 +220,8 @@ static int replicator_probe(struct device *dev, struct resource *res) desc.ops = &replicator_cs_ops; desc.pdata = dev->platform_data; desc.dev = dev; + desc.name = dev_name(dev); + drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 9faa1ed01500..02031d93fb8b 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -871,6 +871,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &stm_cs_ops; desc.pdata = pdata; desc.dev = dev; + desc.name = dev_name(dev); desc.groups = coresight_stm_groups; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index be0bd98ca8c1..44a571988219 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -437,6 +437,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.pdata = pdata; desc.dev = dev; desc.groups = coresight_tmc_groups; + desc.name = dev_name(dev); switch (drvdata->config_type) { case TMC_CONFIG_TYPE_ETB: @@ -461,7 +462,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &tmc_etf_cs_ops; break; default: - pr_err("%s: Unsupported TMC config\n", pdata->name); + pr_err("%s: Unsupported TMC config\n", desc.name); ret = -EINVAL; goto out; } @@ -472,7 +473,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) goto out; } - drvdata->miscdev.name = pdata->name; + drvdata->miscdev.name = desc.name; drvdata->miscdev.minor = MISC_DYNAMIC_MINOR; drvdata->miscdev.fops = &tmc_fops; ret = misc_register(&drvdata->miscdev); diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index aec0ed7bf924..d8a2e3991c7e 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -157,6 +157,7 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &tpiu_cs_ops; desc.pdata = pdata; desc.dev = dev; + desc.name = dev_name(dev); drvdata->csdev = coresight_register(&desc); if (!IS_ERR(drvdata->csdev)) { diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 4b130281236a..04b5d3c2bb3a 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1199,7 +1199,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) csdev->dev.parent = desc->dev; csdev->dev.release = coresight_device_release; csdev->dev.bus = &coresight_bustype; - dev_set_name(&csdev->dev, "%s", desc->pdata->name); + dev_set_name(&csdev->dev, "%s", desc->name); ret = device_register(&csdev->dev); if (ret) { diff --git a/include/linux/coresight.h b/include/linux/coresight.h index bf241dbf99c5..298db20ba8ce 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -91,13 +91,11 @@ union coresight_dev_subtype { /** * struct coresight_platform_data - data harvested from the DT specification - * @name: name of the component as shown under sysfs. * @nr_inport: number of input ports for this component. * @nr_outport: number of output ports for this component. * @conns: Array of nr_outport connections from this component */ struct coresight_platform_data { - const char *name; int nr_inport; int nr_outport; struct coresight_connection *conns; @@ -108,11 +106,12 @@ struct coresight_platform_data { * @type: as defined by @coresight_dev_type. * @subtype: as defined by @coresight_dev_subtype. * @ops: generic operations for this component, as defined - by @coresight_ops. + * by @coresight_ops. * @pdata: platform data collected from DT. * @dev: The device entity associated to this component. * @groups: operations specific to this component. These will end up - in the component's sysfs sub-directory. + * in the component's sysfs sub-directory. + * @name: name for the coresight device, also shown under sysfs. */ struct coresight_desc { enum coresight_dev_type type; @@ -121,6 +120,7 @@ struct coresight_desc { struct coresight_platform_data *pdata; struct device *dev; const struct attribute_group **groups; + const char *name; }; /** From patchwork Wed Jun 19 19:52:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F90A186E for ; Wed, 19 Jun 2019 19:56:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F6D5286A1 for ; Wed, 19 Jun 2019 19:56:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73AC4286BF; Wed, 19 Jun 2019 19:56:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 22FDB286A1 for ; Wed, 19 Jun 2019 19:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7/DW5kj+WaQ+dk61cbQkcnaKyrDHy3ffTsBctYDZX4I=; b=i4uMGL4Lc51lOmwvExxWWg0gZ1 3tvfzJ9OQHCEFWeoGFh3hMXLji4qYGisvcebctzNxXOjI+RQxrXPAOdkkoS8566Izf+nxi/Vdk3DK dReH0R8AMPaM4GGhguuCWChZ6UFJLlofseu40xwojGFiPdfy/pXukRr2Z0wgRf/dMrXTAdOkcC3to 69bVzQ4vtQzme+GyZ+MrKm+qUgGH161Kj+f5yKi2ZAd1MqyFvHbddqfETY6IEIniEChaRTiTyzmtb sn8ZBHhUq1nB9MEmFpnYWWVTM3gPs3I2YmoNuPypQj44TSB6062FO4Fpmjk5m6qVTtm3yvdpXKFXx rvTpYyLw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdghM-0001ky-3Z; Wed, 19 Jun 2019 19:56:48 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdge8-0006RX-Uj for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:30 +0000 Received: by mail-pg1-x541.google.com with SMTP id 145so243065pgh.4 for ; Wed, 19 Jun 2019 12:53: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; bh=wam6AHm/miO8TP1PGtbm8g85UgtcibQj68H7pbJwhxc=; b=jv8C5sBgLZvfD3CWqky7lPJw71eylFz2iEv0QQ+qjikurZx9t20ZW/8qjspp/7YuNb NC1QxdLXPxVOfWctUuNLwY3i267Bul4TQKFY+apKPgC1m2KTmjsOpiRNsAH3Ee05+14b U0WIe3H+XXhi8l9gcFRMtJgDVPGHFy0bQ3Hbg4P6Is1rj6i9wjGwxVlseNrBtwW4YPl+ p0gv5OELvFsJk/oAC1gLfSRW3ZJC6IxQA0Pzmob77WVjsMPT24RQOp2qATWr5w4r6AKB oWC7Nfx0tKjMBpbPUXZbXXWZB9ZRjTb4ayXKifB6dKqKpKy5H4HeAR5HrV8nXt0eyFpR TKSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wam6AHm/miO8TP1PGtbm8g85UgtcibQj68H7pbJwhxc=; b=mpM6BE4sYawsPEH1FRrq92k5fwMIy2lM/W/YSoxYyXKKkTWFA3ZLJnJrWpMHNBDu4/ fo/VsSO0DPWGXqLqsi3DLSJ37m1GjcmuvnXrLH3scH8t2m2iNJmdKVsOB1yC0VfqO4EB 68tiL8XeIw1m4O9HGulFGNEpZuP4yFmXt0Ad1tgGEtyfI5S+wSlqKO1Ld27QVSYKePag 9lgSqIVgIUqvOY6qvHFtCN+IoluCDXlkQURalMwZrFx9hXHGrn9vVpQTRqBBaGSkYxVx a1R5bmg+BPbUFUATQnmjsf2zUsPVLu7e0BON0SBiotFdcyg+aFgvQQUALVqn3MJ/7dhi eZog== X-Gm-Message-State: APjAAAVjj3nBk8n7RApIqeZ6JiJ/nhHkKelS/lbmV3lswr13+a7n3CBQ o81FUL/V5/XPwae7MamvVxgcaw== X-Google-Smtp-Source: APXvYqzXMuOSRJVlHqz9vo/V0aJLBwsZZfnBia1B9XQmdnm4nrQscjsdhx9XQVMOfMlWkBRP9JRfgw== X-Received: by 2002:a63:fb4b:: with SMTP id w11mr9206012pgj.415.1560974008167; Wed, 19 Jun 2019 12:53:28 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:27 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 08/28] coresight: Cleanup coresight_remove_conns Date: Wed, 19 Jun 2019 13:52:58 -0600 Message-Id: <20190619195318.19254-9-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125329_041242_9340154B X-CRM114-Status: GOOD ( 14.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose When a device is unregistered, we remove all connection references to it, by searching the connection records of all devices in the coresight bus, via coresight_remove_conns. We could avoid searching if this device doesn't have an input port (e.g, a source). Also document the purpose of the function. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 04b5d3c2bb3a..068bd2fc0985 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1096,10 +1096,21 @@ static int coresight_remove_match(struct device *dev, void *data) return 0; } +/* + * coresight_remove_conns - Remove references to this given devices + * from the connections of other devices. + */ static void coresight_remove_conns(struct coresight_device *csdev) { - bus_for_each_dev(&coresight_bustype, NULL, - csdev, coresight_remove_match); + /* + * Another device will point to this device only if there is + * an output port connected to this one. i.e, if the device + * doesn't have at least one input port, there is no point + * in searching all the devices. + */ + if (csdev->nr_inport) + bus_for_each_dev(&coresight_bustype, NULL, + csdev, coresight_remove_match); } /** From patchwork Wed Jun 19 19:52:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 603E076 for ; Wed, 19 Jun 2019 19:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B24928644 for ; Wed, 19 Jun 2019 19:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BF2B286BF; Wed, 19 Jun 2019 19:57:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8D73628644 for ; Wed, 19 Jun 2019 19:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=WIY40HEG3iCC0568H3WgpX+5dVnERhAXe4ti4TqeBRA=; b=YrHTnb5J8VM8bx2wdlozM+lBmI t3BKEVf1FHUNp62WQglCv2lCoHSm2QzIpfLQsqQMEcYTAPIICn4wX8ZywhrkQdb4glxxSawc1NCSZ RFuBR5wVlpSiY1ahaNdgLumM5VKKr5jmeGYQB1ai1E9WKoncwyIzHT6iA1FEPQxisB4HlE5qJk3Pv MNYR6C3fTgjZYA+o/oJBK86b6qi/GbxEhMWN1GMBbnEx9FAI6pHy46hftiP+0uu9qqtBVGt/sQW7Z gssjWB25FCtID/QjchFGBXgs1jRkGi2JrJLNHbnnjLWnLRt/P8ty0BnO/0IqD/rzUq9Rw+AFj8Ec0 Zpx/q2Rw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdghc-000237-7e; Wed, 19 Jun 2019 19:57:04 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeA-0006Ss-7O for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:32 +0000 Received: by mail-pg1-x543.google.com with SMTP id n2so223149pgp.11 for ; Wed, 19 Jun 2019 12:53: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; bh=pmZGtu9c56+4otJiRtfFe6AyaYLdUN7Nh4ydmav+H4A=; b=yGLfkp9PoutYGNNcQgrY9yBrDunjl9EisUsop8PZR0qX4rf4t+vQBnWTc/d8D+sQBD j6Os77ev298L9xsybI1+sehtlnmOyyqkiUCqtaX1R84BzIB7VHtQqSN5ZcX3H7SH86mE diCNIVcFvLGE8cn8d1zq/BMLwfXy81z6bN/zeMyJcowWlBz6+er8RoPuwoBxLta1xs27 +4NkJi8AWeXcdvJI/YZI4QT6H+Ja0JYCh+1n7mdZhYNtMWSYvWRostMvTpKEvq4PQS/r QkLUpdXvOMNOALKmxMlV34Ka8j5+i9gUcS2h5Sx4PoNbTD9bo4xEr2hUc6bydOwWjnWw 0oeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pmZGtu9c56+4otJiRtfFe6AyaYLdUN7Nh4ydmav+H4A=; b=BKIOrR56rHRkgZvENH5IthhaXSJ6A2pIQSFvgRvJw5PNjuok6jZArRFmmXXu0aezUl jSX/x4iKWQlDEtkNOXujaT27Su/UJ7dHXKWIOQolVaiSODFGnLkhFbD8LHuJZg2w2a1q DmwzkmZr5ZnkLOqOQPIZ74FQKygn2Z2ZLH6Fu0QPQW6zJONgmQ2eiIPDCRqih3bhwSGl llnHJj51lh1Qgg+7PDTgx8IGKbMaivCS0dc0elevFsfUElTb4oLzM0usrvlH8R1zgyaE QtnE6GrtBa/7I0wsKULafiffwG5XyCqRN3zRAKVOfI/GCWPxXY5kZZx/2ay7giR0iObn 5HCQ== X-Gm-Message-State: APjAAAWyD9aDwyXleB78h/gXdJJ+Vsv9/gEN9aS6e1mSHPmE0FkDC5fF tJdfDk059R642BZ1cxYXo/juZw== X-Google-Smtp-Source: APXvYqyam3bvIBZmWDRsgA11BRt8ZkYtlQlF8NcV/fs1Z4gKMXfo/CwPt9wP5dZGVyx9OLy50OGcZA== X-Received: by 2002:a65:6383:: with SMTP id h3mr9213475pgv.452.1560974009139; Wed, 19 Jun 2019 12:53:29 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:28 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 09/28] coresight: Reuse platform data structure for connection tracking Date: Wed, 19 Jun 2019 13:52:59 -0600 Message-Id: <20190619195318.19254-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125330_424104_44676DAA X-CRM114-Status: GOOD ( 19.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose The platform specific information describes the connections and the ports of a given coresigh device. This information is also recorded in the coresight device as separate fields. Let us reuse the original platform description to streamline the handling of the data. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-tmc-etr.c | 4 +- drivers/hwtracing/coresight/coresight.c | 46 +++++++++---------- include/linux/coresight.h | 8 +--- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 709448cf2dff..ce0114a5435c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -756,8 +756,8 @@ tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) if (!IS_ENABLED(CONFIG_CORESIGHT_CATU)) return NULL; - for (i = 0; i < etr->nr_outport; i++) { - tmp = etr->conns[i].child_dev; + for (i = 0; i < etr->pdata->nr_outport; i++) { + tmp = etr->pdata->conns[i].child_dev; if (tmp && coresight_is_catu_device(tmp)) return tmp; } diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 068bd2fc0985..96e15154a566 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -100,8 +100,8 @@ static int coresight_find_link_inport(struct coresight_device *csdev, int i; struct coresight_connection *conn; - for (i = 0; i < parent->nr_outport; i++) { - conn = &parent->conns[i]; + for (i = 0; i < parent->pdata->nr_outport; i++) { + conn = &parent->pdata->conns[i]; if (conn->child_dev == csdev) return conn->child_port; } @@ -118,8 +118,8 @@ static int coresight_find_link_outport(struct coresight_device *csdev, int i; struct coresight_connection *conn; - for (i = 0; i < csdev->nr_outport; i++) { - conn = &csdev->conns[i]; + for (i = 0; i < csdev->pdata->nr_outport; i++) { + conn = &csdev->pdata->conns[i]; if (conn->child_dev == child) return conn->outport; } @@ -306,10 +306,10 @@ static void coresight_disable_link(struct coresight_device *csdev, if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) { refport = inport; - nr_conns = csdev->nr_inport; + nr_conns = csdev->pdata->nr_inport; } else if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_SPLIT) { refport = outport; - nr_conns = csdev->nr_outport; + nr_conns = csdev->pdata->nr_outport; } else { refport = 0; nr_conns = 1; @@ -595,9 +595,10 @@ static void coresight_grab_device(struct coresight_device *csdev) { int i; - for (i = 0; i < csdev->nr_outport; i++) { - struct coresight_device *child = csdev->conns[i].child_dev; + 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_get_sync(child->dev.parent); } @@ -613,9 +614,10 @@ static void coresight_drop_device(struct coresight_device *csdev) int i; pm_runtime_put(csdev->dev.parent); - for (i = 0; i < csdev->nr_outport; i++) { - struct coresight_device *child = csdev->conns[i].child_dev; + 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); } @@ -645,9 +647,10 @@ static int _coresight_build_path(struct coresight_device *csdev, goto out; /* Not a sink - recursively explore each port found on this element */ - for (i = 0; i < csdev->nr_outport; i++) { - struct coresight_device *child_dev = csdev->conns[i].child_dev; + for (i = 0; i < csdev->pdata->nr_outport; i++) { + struct coresight_device *child_dev; + child_dev = csdev->pdata->conns[i].child_dev; if (child_dev && _coresight_build_path(child_dev, sink, path) == 0) { found = true; @@ -1000,8 +1003,8 @@ static int coresight_orphan_match(struct device *dev, void *data) * Circle throuch all the connection of that component. If we find * an orphan connection whose name matches @csdev, link it. */ - for (i = 0; i < i_csdev->nr_outport; i++) { - conn = &i_csdev->conns[i]; + for (i = 0; i < i_csdev->pdata->nr_outport; i++) { + conn = &i_csdev->pdata->conns[i]; /* We have found at least one orphan connection */ if (conn->child_dev == NULL) { @@ -1040,8 +1043,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) { int i; - for (i = 0; i < csdev->nr_outport; i++) { - struct coresight_connection *conn = &csdev->conns[i]; + for (i = 0; i < csdev->pdata->nr_outport; i++) { + struct coresight_connection *conn = &csdev->pdata->conns[i]; struct device *dev = NULL; if (conn->child_name) @@ -1075,8 +1078,8 @@ static int coresight_remove_match(struct device *dev, void *data) * Circle throuch all the connection of that component. If we find * a connection whose name matches @csdev, remove it. */ - for (i = 0; i < iterator->nr_outport; i++) { - conn = &iterator->conns[i]; + for (i = 0; i < iterator->pdata->nr_outport; i++) { + conn = &iterator->pdata->conns[i]; if (conn->child_dev == NULL) continue; @@ -1108,7 +1111,7 @@ static void coresight_remove_conns(struct coresight_device *csdev) * doesn't have at least one input port, there is no point * in searching all the devices. */ - if (csdev->nr_inport) + if (csdev->pdata->nr_inport) bus_for_each_dev(&coresight_bustype, NULL, csdev, coresight_remove_match); } @@ -1195,10 +1198,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) csdev->refcnt = refcnts; - csdev->nr_inport = desc->pdata->nr_inport; - csdev->nr_outport = desc->pdata->nr_outport; - - csdev->conns = desc->pdata->conns; + csdev->pdata = desc->pdata; csdev->type = desc->type; csdev->subtype = desc->subtype; diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 298db20ba8ce..b67d5074ece0 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -140,9 +140,7 @@ struct coresight_connection { /** * struct coresight_device - representation of a device as used by the framework - * @conns: array of coresight_connections associated to this component. - * @nr_inport: number of input port associated to this component. - * @nr_outport: number of output port associated to this component. + * @pdata: Platform data with device connections associated to this device. * @type: as defined by @coresight_dev_type. * @subtype: as defined by @coresight_dev_subtype. * @ops: generic operations for this component, as defined @@ -157,9 +155,7 @@ struct coresight_connection { * @ea: Device attribute for sink representation under PMU directory. */ struct coresight_device { - struct coresight_connection *conns; - int nr_inport; - int nr_outport; + struct coresight_platform_data *pdata; enum coresight_dev_type type; union coresight_dev_subtype subtype; const struct coresight_ops *ops; From patchwork Wed Jun 19 19:53:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0388F13AF for ; Wed, 19 Jun 2019 19:57:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E603228644 for ; Wed, 19 Jun 2019 19:57:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA20A286BF; Wed, 19 Jun 2019 19:57:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 168E928644 for ; Wed, 19 Jun 2019 19:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=euGiNpQS7Fz7G1eq8uZDLsmVpEzA3cgCgL0mVIhjjp4=; b=GRyWyLLiAYhEf56JXmXo+w5bcx pINJFC8de4vmGRRtu4wk6s39H1AgynIH45srt1yBK+BEHzbstOmMGeY4jiG7OI7FHhZe4hwq2z33Q cLN7SO8wlh9EJfNWTjpRZ3+Fg98RMNw7j7uLiMqiYOuI7JmNr69E9+LarC7iL94+ZH/i25VxSjbOz W4o3xL6Q3McXchxX9jd9xKRR3ya2Kj4OJjh3Z1MhIgChELX62xmma4+VQhtm+K8htQmqBzT8F62x5 zmuDdz9gShzdKZ1B/USs3BBZRTODbU5mY+47CaUBXbiPGi0og6VYpMBSKiHvQrsUAJVWliLpOML3y CJAn01qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdghy-0002KS-UQ; Wed, 19 Jun 2019 19:57:27 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeA-0006Tm-NG for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:33 +0000 Received: by mail-pg1-x543.google.com with SMTP id s21so220148pga.12 for ; Wed, 19 Jun 2019 12:53: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; bh=w+c8wJwNciAgUKZx5dnfejCyNdWdO98PKJXEnm0VYOo=; b=K/c8/YvG4SzCXVPx/8lgRmQf/C1X1hPmYlPOUJ5pjHa78XBtvWOr9uDEtBgZpULV0X Kffs0qsYhgmXbRkb3SJbjIDAieioA0beIr0TIfHyJIGv02Zzd9AUi3I/Ek2WSuVu8IL8 grVZ5S37GsthuiGOhBO47M4O0at3AFOOhUsCccTO7XNKcTCOZ8XwSkSqDGxV6JSKaD7+ 0ONC14B4nXL/CaN5GNBpl029xUpMeMWx7LpuVjogQ9qUTzCma4BoUa15nlNmA6PHzHAd 1/iPCSyMYugI7wp94d/hUmweI30MWSqJHGf3JwAMD313LlfKqyvBKabfT3xnXlwsBgLV IIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w+c8wJwNciAgUKZx5dnfejCyNdWdO98PKJXEnm0VYOo=; b=ZdAp2fsezp0jqcl6rHtxBFAasV/4A4HPvfImeukb0Wv8t82yCFoJqMXmjtz7AS+Wgs VOhjBE8I2c9qw+jVob4pU/i4Ij9A5JhxeogFskzyLJ73ddXWbzhfFy+ZKvyQaRYtW9mC 9vJX3xiMKZwRWyljX2oRdAtTUhpV+Mg7xwPtieIqJqqICC/Rd+w9XbOjIyzrMPE+M867 mqMv1p5l+6sgqtNCtWO2fzvaUm4ly+6KpzND/FTE+Z/FmRCgJ7XRY+rmd9xaEPr8OJ2S QW2JyRk7P5jOnls6N7RV7gnLguU7rtvk1xKT1CmZMHHlyOVRa+TR2mpvw2WECGhQ20VX e/Sg== X-Gm-Message-State: APjAAAUwQlMizV0jYBC+uAivCFi9oQ+DaXwdyNZ49SSKTfbdhxOoksRe 57Aax/9TZZqN1L62N69dJqf/mg== X-Google-Smtp-Source: APXvYqzkRDUfQ1j9x7NZ3TEy8ocgqkN4BDDgAD2h4YPDVt4khFimGPR1j+pHei0lB2rpKnWlqYGB2Q== X-Received: by 2002:a63:214a:: with SMTP id s10mr9223031pgm.13.1560974010099; Wed, 19 Jun 2019 12:53:30 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:29 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 10/28] coresight: Rearrange platform data probing Date: Wed, 19 Jun 2019 13:53:00 -0600 Message-Id: <20190619195318.19254-11-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125330_844253_6F070A06 X-CRM114-Status: GOOD ( 18.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose We are about to introduce methods to clean up the platform data as we switch to tracking the device reference from "name" to "fwnode handles" for device connections. This requires us to drop the fwnode handle references when the data is no longer required - i.e, when the device probe fails or the device gets unregistered. In order to consolidate the invocation of the cleanup, we delay the platform probing to the very last minute, possibly before invoking the coresight_register. Then, we leave the coresight core code to do the clean up. i.e, if the coresight_register fails, it takes care of freeing the data. Otherwise, coresight_unregister will do the necessary operations. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-catu.c | 14 +++++++------- drivers/hwtracing/coresight/coresight-etb10.c | 10 +++++----- drivers/hwtracing/coresight/coresight-etm3x.c | 12 +++++++----- drivers/hwtracing/coresight/coresight-etm4x.c | 12 +++++++----- drivers/hwtracing/coresight/coresight-funnel.c | 12 +++++++----- .../hwtracing/coresight/coresight-replicator.c | 12 +++++++----- drivers/hwtracing/coresight/coresight-stm.c | 11 +++++++---- drivers/hwtracing/coresight/coresight-tmc.c | 16 ++++++++-------- drivers/hwtracing/coresight/coresight-tpiu.c | 10 +++++----- 9 files changed, 60 insertions(+), 49 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 05c73045532a..1c1ad1268b9d 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -505,13 +505,6 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) struct device *dev = &adev->dev; void __iomem *base; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto out; - } - dev->platform_data = pdata; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) { ret = -ENOMEM; @@ -544,6 +537,13 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) if (ret) goto out; + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out; + } + dev->platform_data = pdata; + drvdata->base = base; catu_desc.pdata = pdata; catu_desc.dev = dev; diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 8726d6c7663c..fffaac3e3677 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -733,11 +733,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; @@ -772,6 +767,11 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) /* This device is not associated with a session */ drvdata->pid = -1; + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + adev->dev.platform_data = pdata; + desc.type = CORESIGHT_DEV_TYPE_SINK; desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc.ops = &etb_cs_ops; diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 101fb01e20de..f2d461610a2f 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -795,11 +795,6 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - - adev->dev.platform_data = pdata; drvdata->use_cp14 = fwnode_property_read_bool(dev->fwnode, "arm,cp14"); dev_set_drvdata(dev, drvdata); @@ -849,6 +844,13 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) 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; + } + adev->dev.platform_data = pdata; + desc.type = CORESIGHT_DEV_TYPE_SOURCE; desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC; desc.ops = &etm_cs_ops; diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 8adc1485cd89..1609da1eaf83 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1089,11 +1089,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; - dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ @@ -1136,6 +1131,13 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) 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; + } + adev->dev.platform_data = pdata; + desc.type = CORESIGHT_DEV_TYPE_SOURCE; desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_PROC; desc.ops = &etm4_cs_ops; diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index ded33f5e7d43..75fa2d3ad9b4 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -188,11 +188,6 @@ static int funnel_probe(struct device *dev, struct resource *res) struct funnel_drvdata *drvdata; struct coresight_desc desc = { 0 }; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - dev->platform_data = pdata; - if (is_of_node(dev_fwnode(dev)) && of_device_is_compatible(dev->of_node, "arm,coresight-funnel")) pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n"); @@ -224,6 +219,13 @@ static int funnel_probe(struct device *dev, struct resource *res) dev_set_drvdata(dev, drvdata); + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out_disable_clk; + } + dev->platform_data = pdata; + desc.type = CORESIGHT_DEV_TYPE_LINK; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_MERG; desc.ops = &funnel_cs_ops; diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index f28bafd98995..64dfde7241c1 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -179,11 +179,6 @@ static int replicator_probe(struct device *dev, struct resource *res) struct coresight_desc desc = { 0 }; void __iomem *base; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - dev->platform_data = pdata; - if (is_of_node(dev_fwnode(dev)) && of_device_is_compatible(dev->of_node, "arm,coresight-replicator")) pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n"); @@ -215,6 +210,13 @@ static int replicator_probe(struct device *dev, struct resource *res) dev_set_drvdata(dev, drvdata); + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out_disable_clk; + } + dev->platform_data = pdata; + desc.type = CORESIGHT_DEV_TYPE_LINK; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_SPLIT; desc.ops = &replicator_cs_ops; diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 02031d93fb8b..03528f3fa9ff 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -810,10 +810,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) size_t bitmap_size; struct coresight_desc desc = { 0 }; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - adev->dev.platform_data = pdata; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; @@ -866,6 +862,13 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) return -EPROBE_DEFER; } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto stm_unregister; + } + adev->dev.platform_data = pdata; + desc.type = CORESIGHT_DEV_TYPE_SOURCE; desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE; desc.ops = &stm_cs_ops; diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 44a571988219..212630e65cca 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -398,13 +398,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto out; - } - adev->dev.platform_data = pdata; - ret = -ENOMEM; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) @@ -434,7 +427,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) else drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4; - desc.pdata = pdata; desc.dev = dev; desc.groups = coresight_tmc_groups; desc.name = dev_name(dev); @@ -467,6 +459,14 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) goto out; } + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out; + } + adev->dev.platform_data = pdata; + desc.pdata = pdata; + drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index d8a2e3991c7e..b699d613425d 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -125,11 +125,6 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); - dev->platform_data = pdata; - drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; @@ -152,6 +147,11 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) /* Disable tpiu to support older devices */ tpiu_disable_hw(drvdata); + pdata = coresight_get_platform_data(dev); + if (IS_ERR(pdata)) + return PTR_ERR(pdata); + dev->platform_data = pdata; + desc.type = CORESIGHT_DEV_TYPE_SINK; desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PORT; desc.ops = &tpiu_cs_ops; From patchwork Wed Jun 19 19:53:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0C8076 for ; Wed, 19 Jun 2019 19:57:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF29428644 for ; Wed, 19 Jun 2019 19:57:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3064286BF; Wed, 19 Jun 2019 19:57:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3C0F628644 for ; Wed, 19 Jun 2019 19:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=fDharwS7tki/TQ0tKAXnHg96qh/+gDn45wp/zx/C2as=; b=jWivodnf1opeyBSl33BfVDhGzw 8mTZQZQ5N8W26L9u4o10BlnfB4eV+kH924pNbmzpKJhpA9b6r3CPuPw+/w47OferTxsw8OrLUBmIa O4nSFKSC5hdU5f4yLOHemYYfgMmqWVVfupq0GuHnhJKtEqZ74Cc9WUwL728zfs2CVzAu/upf5j2gv 4g2EucyKDQ5TyxlSajD1OZ0UtN/wEwLA6cd2CPgzEpc2m1Xt+n8dRq5EzE5FKaf+uhvQV8HyYm/OB b5EyLx+cKFIqtsOaGTIB/EnJNUeLwltwzw26J/5LefhmXwjfCMFQ1eG1+pQj8hLVcDX0bRz1Xs5Mj 6+Swb7Tw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgiI-0002eg-SR; Wed, 19 Jun 2019 19:57:47 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeC-0006Um-5d for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:34 +0000 Received: by mail-pf1-x444.google.com with SMTP id d126so220210pfd.2 for ; Wed, 19 Jun 2019 12:53: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; bh=ErY5wp85e3XhtR5Z0E4YUaVt5Ce9QaUAmTEfjZRCKV8=; b=BNfMdxifym8r3u6Fi8UK5/lZqA5200mtttYJhChCUB52n+vLiVmM9PEC7BJTxIpYYS y3heflhVW3vvzYyvNMDIR7qoDCSJvyj8XO4ALkzYl+kWFQL6MqaiXVLF6C9LIl5WB8xq x1Dm6/iaqlGnnqC0V3R5YBwkk2syqOnKBLqqMkfNris9nG1v/DU1aFNUo4RNmbGKfYep 4vpSXoVp9FHIKIPi8g0yeSct7ubQqyO0J0+fR5fVMDg63/usfJGSCAudBoizTSvELuY8 QXRh2XzyeSeCTQ8tHp/6CqVz1ZnkYyzeXqSc+SlUZP/lhM4f90lA9C6/OcdJFyjZZv1c gzug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ErY5wp85e3XhtR5Z0E4YUaVt5Ce9QaUAmTEfjZRCKV8=; b=gW1NSFGVLe+ZfZRoluIse5Iy+HzDu9Sa6ZYX8yhctSY5w/biA95wqK0kZu6el8vte3 WnVPobl/gYkvfY1cil9/kOaPWneLtP62g3ap9G2GyVsCtgR/qb1TIIF/AGhSvnbvBSU2 DPrI/Ql+1qG3AGAyGtO1WZROj1+9/SYAhR8mYfC4IicHDu3zOKkJU/6NZiVeASPuvyxM SjLylSU1OrdP2WwvKPV11YTWHqQEugAdXDIxnnlvgiRhUn+oea+quEg9MH20vS2Sbcvr eixAbwNzP4G7TOMEb/oJyWnS8eoZsaCil43yG541D36i3njbUP6E4cBJ3ZEIcTYCL5YF RZCA== X-Gm-Message-State: APjAAAXVYY8KuLt5DGBrycuFNlFNUIwhpai2NBJG8D/b6pwhF9wquikF bXJNzsgc+OOp4WESZNv7WnyR/w== X-Google-Smtp-Source: APXvYqx2j1DW8lsgf/BBoFN4LD24Be8kwDwoRGvmqmH0ev+GM8yS5duvfC499gbsOVE2fmzb1fY2ow== X-Received: by 2002:a65:4383:: with SMTP id m3mr9047185pgp.435.1560974011051; Wed, 19 Jun 2019 12:53:31 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:30 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 11/28] coresight: Add support for releasing platform specific data Date: Wed, 19 Jun 2019 13:53:01 -0600 Message-Id: <20190619195318.19254-12-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125332_477217_2A62B336 X-CRM114-Status: GOOD ( 14.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose Add a helper to clean up the platform specific data provided by the firmware. This will be later used for dropping the necessary references when we switch to the fwnode handles for tracking connections. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-platform.c | 6 +++++- drivers/hwtracing/coresight/coresight-priv.h | 4 ++++ drivers/hwtracing/coresight/coresight.c | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index f500de61e7f9..53d6eed44a20 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -17,6 +17,7 @@ #include #include +#include "coresight-priv.h" /* * coresight_alloc_conns: Allocate connections record for each output * port from the device. @@ -311,7 +312,7 @@ struct coresight_platform_data * coresight_get_platform_data(struct device *dev) { int ret = -ENOENT; - struct coresight_platform_data *pdata; + struct coresight_platform_data *pdata = NULL; struct fwnode_handle *fwnode = dev_fwnode(dev); if (IS_ERR_OR_NULL(fwnode)) @@ -329,6 +330,9 @@ coresight_get_platform_data(struct device *dev) if (!ret) return pdata; error: + if (!IS_ERR_OR_NULL(pdata)) + /* Cleanup the connection information */ + coresight_release_platform_data(pdata); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(coresight_get_platform_data); diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index e0684d06e9ee..c21642114fc3 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -200,4 +200,8 @@ static inline void *coresight_get_uci_data(const struct amba_id *id) return 0; } +static inline void +coresight_release_platform_data(struct coresight_platform_data *pdata) +{} + #endif diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 96e15154a566..526141c2f876 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1250,6 +1250,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) err_free_csdev: kfree(csdev); err_out: + /* Cleanup the connection information */ + coresight_release_platform_data(desc->pdata); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(coresight_register); @@ -1259,6 +1261,7 @@ void coresight_unregister(struct coresight_device *csdev) etm_perf_del_symlink_sink(csdev); /* Remove references of that device in the topology */ coresight_remove_conns(csdev); + coresight_release_platform_data(csdev->pdata); device_unregister(&csdev->dev); } EXPORT_SYMBOL_GPL(coresight_unregister); From patchwork Wed Jun 19 19:53:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA4D013AF for ; Wed, 19 Jun 2019 19:58:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7D8E28644 for ; Wed, 19 Jun 2019 19:58:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA4FF286BF; Wed, 19 Jun 2019 19:58:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4B46E28644 for ; Wed, 19 Jun 2019 19:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TgNiRp4hW6FT4aXaqE1sSfzXPdhtc83qvYHIEOl67Ro=; b=bKeTcT63pmgWzRuKF0+cr28RbG Nwq7whNLvxzbyHt6vyF0xEngCk4vcIMHalengAXCsbTRARkDweyYo7NGvXZt50KvjsUf5edFQjmKc /4c6SIQMsRqrGnh/bSG/IBb6xuRuf3+HJzAOQgvywnKxGjj6R2EXE48Q9QTyGcphO+fuBxKG7JgpM Zex3KZlfscAf20EEx0lFGTU2bTlyNmru7ev6OA/jHSBPby4NhZFOuAAGiI0Az225qVaJ9B3QlTZ9+ e7XF/XRiOWlfnZU4vY58O2t1anOz8gYCkXjWWJcHqPMfNNwPU7/PcZ9Qi3o2l/PhGnNv9GyM+ny8K L0ubS+ag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgia-0002wt-Ax; Wed, 19 Jun 2019 19:58:04 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeD-0006VZ-8k for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:34 +0000 Received: by mail-pf1-x443.google.com with SMTP id d126so220230pfd.2 for ; Wed, 19 Jun 2019 12:53: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; bh=rpOaaV9d83fotu4AxFyBdRWe6I4s8YAmRXD80aehfeA=; b=bmP9qbeD5XbBeUp57OyrV7rSRDZKxCT98sCMhmCNt16p1xD1X9uEMfGOV3TmK1Od5o SVwqCvNyir0QK5UhUQ1V9X6XSghseuK/5gK3sC4RFsQXS6h3QrUZquuT0FX0gwLaKUQU qzMCym40dvZvExUBv3AzfbboIfXRNKzVZb3zAhyfaZnJupURk1fANFzEZxnupn9fNYpR Y8phHlnvXwP2nIUEy6wpsIh4vJON0gT5T1NZe3ohI8K3GAhohszkF2GMcrRz8BrqAuWx 9AhnsCbjnlbv3sl20T9Efm6ilKNyClNpoEsMciNi5siBdKdr3d3XQLrVr33j4VY5QG2X dtEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rpOaaV9d83fotu4AxFyBdRWe6I4s8YAmRXD80aehfeA=; b=A6HsSMIjzbcZYjAYnNLZvvhVKI4RILbg3rk5rfudUiMEQmCr1EPXHlC4YPNJL/Zxqi M+QqLJBMZh3a5VpLw0zGLTrIzzJ+Rp084UVmraA3EmkPkq+ez26yo22nIgkoBX2G00LN P8T7QOBBvW79GnPRKy4Vk6wu1U6CX+ZFESwMg0VR03LovULzqqCmdSNWFJUNYss+0Stm 9AjwD5/fzR3tU1ynobYPKwKIKWr4zMkkQcz6CgCUrrQ2lMgSKHfcjCMKajqXzvsKgW/c 3ZSpgsLPhfWX6g6RgRHyK5nMwohqxvCBJ1CwPpEy0jWJz/iGIdf+wRZX//dlM9+t3oSv faeA== X-Gm-Message-State: APjAAAUy41wsR3iGam7u5795UUhV+pmFqok+grcyZoTJ029eJeSB92ld AUFntk6W1M/FUAnuUb6dU0b6Jhhuu8Oz/g== X-Google-Smtp-Source: APXvYqySwJbYU50Z8Ybidn0rVAyyocWt0yP70mmfwEIi09QwTHRveGkZLV0iY1jOw7eaZYdGkn1yUg== X-Received: by 2002:a63:3008:: with SMTP id w8mr9388855pgw.11.1560974011869; Wed, 19 Jun 2019 12:53:31 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:31 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 12/28] coresight: platform: Use fwnode handle for device search Date: Wed, 19 Jun 2019 13:53:02 -0600 Message-Id: <20190619195318.19254-13-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125333_399886_0394DC77 X-CRM114-Status: GOOD ( 15.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose We match of_node while searching for a device. Make this more generic in preparation for the ACPI support by using fwnode_handle. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-platform.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 53d6eed44a20..4394095ad224 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -36,14 +36,13 @@ static int coresight_alloc_conns(struct device *dev, return 0; } -#ifdef CONFIG_OF -static int of_dev_node_match(struct device *dev, void *data) +static int coresight_device_fwnode_match(struct device *dev, void *fwnode) { - return dev->of_node == data; + return dev_fwnode(dev) == fwnode; } static struct device * -of_coresight_get_endpoint_device(struct device_node *endpoint) +coresight_find_device_by_fwnode(struct fwnode_handle *fwnode) { struct device *dev = NULL; @@ -52,7 +51,7 @@ of_coresight_get_endpoint_device(struct device_node *endpoint) * platform bus. */ dev = bus_find_device(&platform_bus_type, NULL, - endpoint, of_dev_node_match); + fwnode, coresight_device_fwnode_match); if (dev) return dev; @@ -61,9 +60,10 @@ of_coresight_get_endpoint_device(struct device_node *endpoint) * looking for the device that matches the endpoint node. */ return bus_find_device(&amba_bustype, NULL, - endpoint, of_dev_node_match); + fwnode, coresight_device_fwnode_match); } +#ifdef CONFIG_OF static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep) { return of_property_read_bool(ep, "slave-mode"); @@ -191,6 +191,7 @@ static int of_coresight_parse_endpoint(struct device *dev, struct device_node *rparent = NULL; struct device_node *rep = NULL; struct device *rdev = NULL; + struct fwnode_handle *rdev_fwnode; do { /* Parse the local port details */ @@ -209,8 +210,9 @@ static int of_coresight_parse_endpoint(struct device *dev, if (of_graph_parse_endpoint(rep, &rendpoint)) break; + rdev_fwnode = of_fwnode_handle(rparent); /* If the remote device is not available, defer probing */ - rdev = of_coresight_get_endpoint_device(rparent); + rdev = coresight_find_device_by_fwnode(rdev_fwnode); if (!rdev) { ret = -EPROBE_DEFER; break; From patchwork Wed Jun 19 19:53:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005141 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 610D276 for ; Wed, 19 Jun 2019 19:58:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F34F28644 for ; Wed, 19 Jun 2019 19:58:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 407D4286BF; Wed, 19 Jun 2019 19:58:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F06428644 for ; Wed, 19 Jun 2019 19:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=BYSqHX6GvtEctJPVrLl82GuaUXxj0KRDBSX+Bs6evOY=; b=KXaxqMtgORw3b3QBJUmYMT86pd KY0EqgSrwCERgEUzka/8W9llNczRx44fm6+Bq3zn6pneuoBOB3lo07F4LsXJ6e8GXj3O0hEfaa8Or 7mvdjLLE9YhnvRhqFwX6mE9OAOHrve7SvbshvHwvz6sa4FNTT3YjxdWv7LQKH3vJ9VsxwpwmAEVSO bjiOcKYKkSf/wyGGe1HoPv93YJQ3hGlK3Q3tBLaJ/OEG05AQ9opF4RK3pu2e9N812x+CLUbU6Uv1L dLAeItHjZklVvwYNL3znNu48ScpTsiiCUEfdm+6RapF8/rC8wJTXU1aNKWl+TUaCyJcHJSd/O5OPD bNnqUeEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgix-0003FC-3F; Wed, 19 Jun 2019 19:58:27 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeE-0006Wk-1u for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:36 +0000 Received: by mail-pf1-x441.google.com with SMTP id d126so220253pfd.2 for ; Wed, 19 Jun 2019 12:53: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; bh=7YDLpLX/Ao2epAEvhkSMe8zwQunMhzBFxABY8GfNG7c=; b=CMSCRwHPae452XI5A8N8Hu/LXZVdF6lKfw/B/nDoofVEAfwrG+rh9A6MTk1XF9IeTr QC/P/PFmAFwwLWue7YpLxdMmOLApYgS1br119oHjvefzfO5x38v6aDHxndAm1tkDHmNB +4oYSo6i+LoU3bWo8iWGvOD8QLo9iJjU4OCUFpI+cW9MbUBZfsQKfGkgq1YjQE+y67Eq pxtnRxBntRJk44KCDo5BlnqjLsn91sgv0dIrljJKHbT7TfeTphAk6BM5RwyNEIif3qZ1 W2LLuscW8oebBqE/JDvrdMu7bOoHU/3SxW1xQkX67/1fCcY/B4E6fciW3/Y87ddej8xc SiQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7YDLpLX/Ao2epAEvhkSMe8zwQunMhzBFxABY8GfNG7c=; b=ofjp+CpRShJ/C6RW88QgYWZ3Z6CDT6zWrbew7p84qwCdnJEfELrFwu7tt63vXNQEL0 irBfhsYmNBq7aBrkKIfn76zeQy8bUwicqNozyX0FK/hZ4ncP3ATVpu063AJT9dB0Te4W SrueEdXRwFE2cwo1o8/AwbrP7VtrNFhNZadBwo7Dx2FRlMIGwew38pQHTe6zYcm2OzQs sVrUFKnD0JQ9gyFQjsgsXwS1ONQltSeb8DPKtVmD2elrJjSS/MqAbF/PEOe/JTGBdRKQ Kff2Ad/oXFFzEL8x9sjoROwk9N0mHM+LQ2OBW6Us6ybaXboPRtk1R9eMpvRbTnRABgqG TMmg== X-Gm-Message-State: APjAAAVKfJ9JwBtQKHMOfkS9z1N3nm+P/QOok4tBxnuDUm/+MPZ6aFlw tz8UwHqrz50RrsXwPd4SLsOpSQ== X-Google-Smtp-Source: APXvYqzHZyhDqiCNwL/0Eud/yUfEU4f6sR3Y+h/i+tz4opxEKBnDGl01rqrpttr3QMS6Yf7be1UHgg== X-Received: by 2002:a63:e250:: with SMTP id y16mr9036108pgj.392.1560974012988; Wed, 19 Jun 2019 12:53:32 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:32 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 13/28] coresight: Use fwnode handle instead of device names Date: Wed, 19 Jun 2019 13:53:03 -0600 Message-Id: <20190619195318.19254-14-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125334_373368_5F363D1A X-CRM114-Status: GOOD ( 23.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose We rely on the device names to find a CoreSight device on the coresight bus. The device name however is obtained from the platform, which is bound to the real platform/amba device. As we are about to use different naming scheme for the coresight devices, we can't rely on the platform device name to find the corresponding coresight device. Instead we use the platform agnostic "fwnode handle" of the parent device to find the devices. We also reuse the same fwnode as the parent for the Coresight device we create. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-platform.c | 14 +++++-- drivers/hwtracing/coresight/coresight-priv.h | 6 +-- drivers/hwtracing/coresight/coresight.c | 42 +++++++++++++++---- include/linux/coresight.h | 4 +- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 4394095ad224..49112a58478e 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -36,7 +36,7 @@ static int coresight_alloc_conns(struct device *dev, return 0; } -static int coresight_device_fwnode_match(struct device *dev, void *fwnode) +int coresight_device_fwnode_match(struct device *dev, void *fwnode) { return dev_fwnode(dev) == fwnode; } @@ -219,9 +219,15 @@ static int of_coresight_parse_endpoint(struct device *dev, } conn->outport = endpoint.port; - conn->child_name = devm_kstrdup(dev, - dev_name(rdev), - GFP_KERNEL); + /* + * Hold the refcount to the target device. This could be + * released via: + * 1) coresight_release_platform_data() if the probe fails or + * this device is unregistered. + * 2) While removing the target device via + * coresight_remove_match() + */ + conn->child_fwnode = fwnode_handle_get(rdev_fwnode); conn->child_port = rendpoint.port; /* Connection record updated */ ret = 1; diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index c21642114fc3..8b07fe55395a 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -200,8 +200,8 @@ static inline void *coresight_get_uci_data(const struct amba_id *id) return 0; } -static inline void -coresight_release_platform_data(struct coresight_platform_data *pdata) -{} +void coresight_release_platform_data(struct coresight_platform_data *pdata); + +int coresight_device_fwnode_match(struct device *dev, void *fwnode); #endif diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 526141c2f876..1287778c3be5 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -978,6 +978,7 @@ static void coresight_device_release(struct device *dev) { struct coresight_device *csdev = to_coresight_device(dev); + fwnode_handle_put(csdev->dev.fwnode); kfree(csdev->refcnt); kfree(csdev); } @@ -1009,13 +1010,11 @@ static int coresight_orphan_match(struct device *dev, void *data) /* We have found at least one orphan connection */ if (conn->child_dev == NULL) { /* Does it match this newly added device? */ - if (conn->child_name && - !strcmp(dev_name(&csdev->dev), conn->child_name)) { + if (conn->child_fwnode == csdev->dev.fwnode) conn->child_dev = csdev; - } else { + else /* This component still has an orphan */ still_orphan = true; - } } } @@ -1047,9 +1046,9 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) struct coresight_connection *conn = &csdev->pdata->conns[i]; struct device *dev = NULL; - if (conn->child_name) - dev = bus_find_device_by_name(&coresight_bustype, NULL, - conn->child_name); + dev = bus_find_device(&coresight_bustype, NULL, + (void *)conn->child_fwnode, + coresight_device_fwnode_match); if (dev) { conn->child_dev = to_coresight_device(dev); /* and put reference from 'bus_find_device()' */ @@ -1084,9 +1083,15 @@ static int coresight_remove_match(struct device *dev, void *data) if (conn->child_dev == NULL) continue; - if (!strcmp(dev_name(&csdev->dev), conn->child_name)) { + if (csdev->dev.fwnode == conn->child_fwnode) { iterator->orphan = true; conn->child_dev = NULL; + /* + * Drop the reference to the handle for the remote + * device acquired in parsing the connections from + * platform data. + */ + fwnode_handle_put(conn->child_fwnode); /* No need to continue */ break; } @@ -1166,6 +1171,22 @@ static int __init coresight_init(void) } postcore_initcall(coresight_init); +/* + * coresight_release_platform_data: Release references to the devices connected + * to the output port of this device. + */ +void coresight_release_platform_data(struct coresight_platform_data *pdata) +{ + int i; + + for (i = 0; i < pdata->nr_outport; i++) { + if (pdata->conns[i].child_fwnode) { + fwnode_handle_put(pdata->conns[i].child_fwnode); + pdata->conns[i].child_fwnode = NULL; + } + } +} + struct coresight_device *coresight_register(struct coresight_desc *desc) { int ret; @@ -1210,6 +1231,11 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) csdev->dev.parent = desc->dev; csdev->dev.release = coresight_device_release; csdev->dev.bus = &coresight_bustype; + /* + * Hold the reference to our parent device. This will be + * dropped only in coresight_device_release(). + */ + csdev->dev.fwnode = fwnode_handle_get(dev_fwnode(desc->dev)); dev_set_name(&csdev->dev, "%s", desc->name); ret = device_register(&csdev->dev); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index b67d5074ece0..b40544bc06fe 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -126,15 +126,15 @@ struct coresight_desc { /** * struct coresight_connection - representation of a single connection * @outport: a connection's output port number. - * @chid_name: remote component's name. * @child_port: remote component's port number @output is connected to. + * @chid_fwnode: remote component's fwnode handle. * @child_dev: a @coresight_device representation of the component connected to @outport. */ struct coresight_connection { int outport; - const char *child_name; int child_port; + struct fwnode_handle *child_fwnode; struct coresight_device *child_dev; }; From patchwork Wed Jun 19 19:53:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005143 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4471876 for ; Wed, 19 Jun 2019 19:58:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33066286BF for ; Wed, 19 Jun 2019 19:58:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 271E4286E5; Wed, 19 Jun 2019 19:58:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 023A8286BF for ; Wed, 19 Jun 2019 19:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=9DyflVBjc7lcIQUHC3KxJeKJi80u0/4JxiLX1aVmVBI=; b=qAU/UDUjb1h+6WTpiYrneqxyno UdpVAH7Snx6sK1K1p/pN2/vGyVMlj3D++AHGD4r5Paw5xkvhao/yYZmZn8ntB677obZPh3RWnqQpV rXr5qnEHMLpzIar5eg4RUxTsX/jOYq6brv9mTENv8Unh7ilNzutK0th9aHG0/lsY1g8vaazp5u1C6 wLJ2TJm8tMNbVASXyBv7yjZEuhW/HtqMZ1VJOqi2bZyyGxbiz9XppmYqLy3fagHTOuc4++KyGJ25z Unduw1yw8jgtlAe6Cg1DIxDPSvOVWrKaJQpcsph3HiH8PKw0v2kKw9jpzI/WrbAOra5+cCVEkdNCd D3Lk56Fg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgjM-0003Zl-Ar; Wed, 19 Jun 2019 19:58:52 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeG-0006YG-MU for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:39 +0000 Received: by mail-pl1-x643.google.com with SMTP id ay6so251184plb.9 for ; Wed, 19 Jun 2019 12:53: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; bh=MxLVRESGWnDH2zvmmePpLBwulWSPMEeC+OC/yVsqt3g=; b=cllIyvxolInXdVJHlFyRAR8NhXu4HBgHwCHwnAHJW+Ng1w53NAJzYlo8mRQX7L9pNz KjZgDD4SNYS+ejnWfwTZIta/wByw3IDWj7Nc6aZqGqhigeDVYbpJc1hpLqXgYOAQ307m C2ZGQLGyziVn3m8NaOrcqXFYfYgg0Zr9iq7fZEcByJG7t0xF+Iz5Kk1Z2hHNxe922rqh lTJjpPuUeK/tsN7cX2eEWATMccxQITc1iaR5zssns7vEpIEvt+ng198qDKSXIjGyn5HR mIgADfhNIl3QlUv6oGQDj9zsS8HgO4PpSP7eh23Uh+GoQtrbJI9dsejfpZznKK0Ow+2R Jbyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MxLVRESGWnDH2zvmmePpLBwulWSPMEeC+OC/yVsqt3g=; b=NbltYRt37CQYJkn7Jh+b/19FAIR6uK41TCIaOSWm0UcIK/2QJD4aDfuJRwWxCElZgq Z6XcBhWJqq8hKcauxlHFOPaXmuCo0dNh6+vZkmrvZcV9PG/wbWOJCLDGiQkG69+cPUy/ coTn8SYOfDBx8bmrWZUX23tkyjobBT2QWi48DR9TTKEYhD+p4eCej2VnwSpxmS3mvog0 /oZ4ekTBbVb+nJGImdZ0j8fX75+1XCHkoViaWgN/4IUyAVoyTV20ENEwUgk8BmN9Hn9M +iTgmE7C7sxzrMyykPwkg3HhsKjbS/UN1XP+mrA68oVuFO/3oUiLWxygsdx8Ri2AKKSo 6Tvw== X-Gm-Message-State: APjAAAWD8y+JEwOBige3ob4WPg0t2Qr0WbyvF4irF/DSjAh5jSud4jLw 81+fl8M0N4aqjb/X2BB1VwkGhHENJ9whUw== X-Google-Smtp-Source: APXvYqzKK/IGmyCOIeDgQD4gbLqbIbGZz3I6zn8H7zy6g8HPButYzCdCnKwEdt6RFre6IDutr54tzw== X-Received: by 2002:a17:902:a414:: with SMTP id p20mr10869600plq.187.1560974014156; Wed, 19 Jun 2019 12:53:34 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:33 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 14/28] coresight: Use platform agnostic names Date: Wed, 19 Jun 2019 13:53:04 -0600 Message-Id: <20190619195318.19254-15-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125336_912330_23546556 X-CRM114-Status: GOOD ( 19.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose So far we have reused the name of the "platform" device for the CoreSight device. But this is not very intuitive when we move to ACPI. Also, the ACPI device names have ":" in them (e.g, ARMHC97C:01), which the perf tool doesn't like very much. This patch introduces a generic naming scheme, givin more intuitive names for the devices that appear on the CoreSight bus. The names follow the pattern "prefix" followed by "index" (e.g, etm5). We maintain a list of allocated devices per "prefix" to make sure we don't allocate a new name when it is reprobed (e.g, due to unsatisifed device dependencies). So, we maintain the list of "fwnodes" of the parent devices to allocate a consistent name. All devices except the ETMs get an index allocated in the order of probing. ETMs get an index based on the CPU they are attached to. TMC devices are named using "tmc_etf", "tmc_etb", and "tmc_etr" prefixes depending on the configuration of the device. The replicators and funnels are not classified as dynamic/static anymore. One could easily figure that out by checking the presence of "mgmt" registers under sysfs. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-catu.c | 7 ++- drivers/hwtracing/coresight/coresight-etb10.c | 7 ++- drivers/hwtracing/coresight/coresight-etm3x.c | 4 +- drivers/hwtracing/coresight/coresight-etm4x.c | 4 +- .../hwtracing/coresight/coresight-funnel.c | 7 ++- .../coresight/coresight-replicator.c | 7 ++- drivers/hwtracing/coresight/coresight-stm.c | 12 +++- drivers/hwtracing/coresight/coresight-tmc.c | 15 ++++- drivers/hwtracing/coresight/coresight-tpiu.c | 7 ++- drivers/hwtracing/coresight/coresight.c | 58 +++++++++++++++++++ include/linux/coresight.h | 25 +++++++- 11 files changed, 141 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 1c1ad1268b9d..16ebf38a9f66 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -28,6 +28,8 @@ #define catu_dbg(x, ...) do {} while (0) #endif +DEFINE_CORESIGHT_DEVLIST(catu_devs, "catu"); + struct catu_etr_buf { struct tmc_sg_table *catu_table; dma_addr_t sladdr; @@ -505,6 +507,10 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) struct device *dev = &adev->dev; void __iomem *base; + catu_desc.name = coresight_alloc_device_name(&catu_devs, dev); + if (!catu_desc.name) + return -ENOMEM; + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) { ret = -ENOMEM; @@ -551,7 +557,6 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) catu_desc.type = CORESIGHT_DEV_TYPE_HELPER; catu_desc.subtype.helper_subtype = CORESIGHT_DEV_SUBTYPE_HELPER_CATU; catu_desc.ops = &catu_ops; - catu_desc.name = dev_name(dev); drvdata->csdev = coresight_register(&catu_desc); if (IS_ERR(drvdata->csdev)) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index fffaac3e3677..d5b9edecf76e 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -63,6 +63,8 @@ #define ETB_FFSR_BIT 1 #define ETB_FRAME_SIZE_WORDS 4 +DEFINE_CORESIGHT_DEVLIST(etb_devs, "etb"); + /** * struct etb_drvdata - specifics associated to an ETB component * @base: memory mapped base address for this component. @@ -733,6 +735,10 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; + desc.name = coresight_alloc_device_name(&etb_devs, dev); + if (!desc.name) + return -ENOMEM; + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; @@ -777,7 +783,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &etb_cs_ops; desc.pdata = pdata; desc.dev = dev; - desc.name = dev_name(dev); desc.groups = coresight_etb_groups; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index f2d461610a2f..bed729140718 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -815,6 +815,9 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) } drvdata->cpu = coresight_get_cpu(dev); + desc.name = devm_kasprintf(dev, GFP_KERNEL, "etm%d", drvdata->cpu); + if (!desc.name) + return -ENOMEM; cpus_read_lock(); etmdrvdata[drvdata->cpu] = drvdata; @@ -856,7 +859,6 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &etm_cs_ops; desc.pdata = pdata; desc.dev = dev; - desc.name = dev_name(dev); desc.groups = coresight_etm_groups; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 1609da1eaf83..7fe266194ab5 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1101,6 +1101,9 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) spin_lock_init(&drvdata->spinlock); drvdata->cpu = coresight_get_cpu(dev); + desc.name = devm_kasprintf(dev, GFP_KERNEL, "etm%d", drvdata->cpu); + if (!desc.name) + return -ENOMEM; cpus_read_lock(); etmdrvdata[drvdata->cpu] = drvdata; @@ -1144,7 +1147,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) desc.pdata = pdata; desc.dev = dev; desc.groups = coresight_etmv4_groups; - desc.name = dev_name(dev); drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 75fa2d3ad9b4..5867fcb4503b 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -29,6 +29,8 @@ #define FUNNEL_HOLDTIME (0x7 << FUNNEL_HOLDTIME_SHFT) #define FUNNEL_ENSx_MASK 0xff +DEFINE_CORESIGHT_DEVLIST(funnel_devs, "funnel"); + /** * struct funnel_drvdata - specifics associated to a funnel component * @base: memory mapped base address for this component. @@ -192,6 +194,10 @@ static int funnel_probe(struct device *dev, struct resource *res) of_device_is_compatible(dev->of_node, "arm,coresight-funnel")) pr_warn_once("Uses OBSOLETE CoreSight funnel binding\n"); + desc.name = coresight_alloc_device_name(&funnel_devs, dev); + if (!desc.name) + return -ENOMEM; + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; @@ -231,7 +237,6 @@ static int funnel_probe(struct device *dev, struct resource *res) desc.ops = &funnel_cs_ops; desc.pdata = pdata; desc.dev = dev; - desc.name = dev_name(dev); drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 64dfde7241c1..c0e42253dfe7 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -22,6 +22,8 @@ #define REPLICATOR_IDFILTER0 0x000 #define REPLICATOR_IDFILTER1 0x004 +DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); + /** * struct replicator_drvdata - specifics associated to a replicator component * @base: memory mapped base address for this component. Also indicates @@ -183,6 +185,10 @@ static int replicator_probe(struct device *dev, struct resource *res) of_device_is_compatible(dev->of_node, "arm,coresight-replicator")) pr_warn_once("Uses OBSOLETE CoreSight replicator binding\n"); + desc.name = coresight_alloc_device_name(&replicator_devs, dev); + if (!desc.name) + return -ENOMEM; + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; @@ -222,7 +228,6 @@ static int replicator_probe(struct device *dev, struct resource *res) desc.ops = &replicator_cs_ops; desc.pdata = dev->platform_data; desc.dev = dev; - desc.name = dev_name(dev); drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 03528f3fa9ff..e3e2b000cfb7 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -107,6 +107,8 @@ struct channel_space { unsigned long *guaranteed; }; +DEFINE_CORESIGHT_DEVLIST(stm_devs, "stm"); + /** * struct stm_drvdata - specifics associated to an STM component * @base: memory mapped base address for this component. @@ -810,6 +812,10 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) size_t bitmap_size; struct coresight_desc desc = { 0 }; + desc.name = coresight_alloc_device_name(&stm_devs, dev); + if (!desc.name) + return -ENOMEM; + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; @@ -854,11 +860,12 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) spin_lock_init(&drvdata->spinlock); stm_init_default_data(drvdata); - stm_init_generic_data(drvdata, dev_name(dev)); + stm_init_generic_data(drvdata, desc.name); if (stm_register_device(dev, &drvdata->stm, THIS_MODULE)) { dev_info(dev, - "stm_register_device failed, probing deferred\n"); + "%s : stm_register_device failed, probing deferred\n", + desc.name); return -EPROBE_DEFER; } @@ -874,7 +881,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &stm_cs_ops; desc.pdata = pdata; desc.dev = dev; - desc.name = dev_name(dev); desc.groups = coresight_stm_groups; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 212630e65cca..be37aff573b4 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -27,6 +27,10 @@ #include "coresight-priv.h" #include "coresight-tmc.h" +DEFINE_CORESIGHT_DEVLIST(etb_devs, "tmc_etb"); +DEFINE_CORESIGHT_DEVLIST(etf_devs, "tmc_etf"); +DEFINE_CORESIGHT_DEVLIST(etr_devs, "tmc_etr"); + void tmc_wait_for_tmcready(struct tmc_drvdata *drvdata) { /* Ensure formatter, unformatter and hardware fifo are empty */ @@ -397,6 +401,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) struct tmc_drvdata *drvdata; struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; + struct coresight_dev_list *dev_list = NULL; ret = -ENOMEM; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); @@ -429,13 +434,13 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.dev = dev; desc.groups = coresight_tmc_groups; - desc.name = dev_name(dev); switch (drvdata->config_type) { case TMC_CONFIG_TYPE_ETB: desc.type = CORESIGHT_DEV_TYPE_SINK; desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc.ops = &tmc_etb_cs_ops; + dev_list = &etb_devs; break; case TMC_CONFIG_TYPE_ETR: desc.type = CORESIGHT_DEV_TYPE_SINK; @@ -447,11 +452,13 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) goto out; idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); + dev_list = &etr_devs; break; case TMC_CONFIG_TYPE_ETF: desc.type = CORESIGHT_DEV_TYPE_LINKSINK; desc.subtype.link_subtype = CORESIGHT_DEV_SUBTYPE_LINK_FIFO; desc.ops = &tmc_etf_cs_ops; + dev_list = &etf_devs; break; default: pr_err("%s: Unsupported TMC config\n", desc.name); @@ -459,6 +466,12 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) goto out; } + desc.name = coresight_alloc_device_name(dev_list, dev); + if (!desc.name) { + ret = -ENOMEM; + goto out; + } + pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata)) { ret = PTR_ERR(pdata); diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index b699d613425d..f8583e4032a6 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -47,6 +47,8 @@ #define FFCR_FON_MAN BIT(6) #define FFCR_STOP_FI BIT(12) +DEFINE_CORESIGHT_DEVLIST(tpiu_devs, "tpiu"); + /** * @base: memory mapped base address for this component. * @atclk: optional clock for the core parts of the TPIU. @@ -125,6 +127,10 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; + desc.name = coresight_alloc_device_name(&tpiu_devs, dev); + if (!desc.name) + return -ENOMEM; + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; @@ -157,7 +163,6 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) desc.ops = &tpiu_cs_ops; desc.pdata = pdata; desc.dev = dev; - desc.name = dev_name(dev); drvdata->csdev = coresight_register(&desc); if (!IS_ERR(drvdata->csdev)) { diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 1287778c3be5..86d1fc2c1bd4 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1291,3 +1291,61 @@ void coresight_unregister(struct coresight_device *csdev) device_unregister(&csdev->dev); } EXPORT_SYMBOL_GPL(coresight_unregister); + + +/* + * coresight_search_device_idx - Search the fwnode handle of a device + * in the given dev_idx list. Must be called with the coresight_mutex held. + * + * Returns the index of the entry, when found. Otherwise, -ENOENT. + */ +static inline int coresight_search_device_idx(struct coresight_dev_list *dict, + struct fwnode_handle *fwnode) +{ + int i; + + for (i = 0; i < dict->nr_idx; i++) + if (dict->fwnode_list[i] == fwnode) + return i; + return -ENOENT; +} + +/* + * coresight_alloc_device_name - Get an index for a given device in the + * device index list specific to a driver. An index is allocated for a + * device and is tracked with the fwnode_handle to prevent allocating + * duplicate indices for the same device (e.g, if we defer probing of + * a device due to dependencies), in case the index is requested again. + */ +char *coresight_alloc_device_name(struct coresight_dev_list *dict, + struct device *dev) +{ + int idx; + char *name = NULL; + struct fwnode_handle **list; + + mutex_lock(&coresight_mutex); + + idx = coresight_search_device_idx(dict, dev_fwnode(dev)); + if (idx < 0) { + /* Make space for the new entry */ + idx = dict->nr_idx; + list = krealloc(dict->fwnode_list, + (idx + 1) * sizeof(*dict->fwnode_list), + GFP_KERNEL); + if (ZERO_OR_NULL_PTR(list)) { + idx = -ENOMEM; + goto done; + } + + list[idx] = dev_fwnode(dev); + dict->fwnode_list = list; + dict->nr_idx = idx + 1; + } + + name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx); +done: + mutex_unlock(&coresight_mutex); + return name; +} +EXPORT_SYMBOL_GPL(coresight_alloc_device_name); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index b40544bc06fe..a2b68823717b 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -168,6 +168,28 @@ struct coresight_device { struct dev_ext_attribute *ea; }; +/* + * coresight_dev_list - Mapping for devices to "name" index for device + * names. + * + * @nr_idx: Number of entries already allocated. + * @pfx: Prefix pattern for device name. + * @fwnode_list: Array of fwnode_handles associated with each allocated + * index, upto nr_idx entries. + */ +struct coresight_dev_list { + int nr_idx; + const char *pfx; + struct fwnode_handle **fwnode_list; +}; + +#define DEFINE_CORESIGHT_DEVLIST(var, dev_pfx) \ +static struct coresight_dev_list (var) = { \ + .pfx = dev_pfx, \ + .nr_idx = 0, \ + .fwnode_list = NULL, \ +} + #define to_coresight_device(d) container_of(d, struct coresight_device, dev) #define source_ops(csdev) csdev->ops->source_ops @@ -261,7 +283,8 @@ extern int coresight_claim_device_unlocked(void __iomem *base); extern void coresight_disclaim_device(void __iomem *base); extern void coresight_disclaim_device_unlocked(void __iomem *base); - +extern char *coresight_alloc_device_name(struct coresight_dev_list *devs, + struct device *dev); #else static inline struct coresight_device * coresight_register(struct coresight_desc *desc) { return NULL; } From patchwork Wed Jun 19 19:53:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 71B1E76 for ; Wed, 19 Jun 2019 19:59:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 610B828644 for ; Wed, 19 Jun 2019 19:59:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54CCB286DF; Wed, 19 Jun 2019 19:59:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CDCA728644 for ; Wed, 19 Jun 2019 19:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=UMsZ96JP3d8w1LCvPsQ1x6bs8TIkySqOzgk6l/WH4PY=; b=c1Y16X9DqeMVVrN8VLoJqICgAd uW1PDQ/DtEc8D+chyRkX4CAKuVnaMt1A2ekyJcCBg1km2+8khZEm5/PzgUD2HK1G52HQzDErDOrKJ jQVgyx7cOy/uwDV647Qj3l0/c+AkBWUBALl5SZ4CzhovTWnckW8fto5cGOnxFp2cY7xRWbY15LPBb LaWkT7zzzVpYys2/sW16/t+W1UcJ6h3ixVryY6SjTYlMTv3I6bt+y55P/Lt8bjkI4TW/Ie4OhTsFd +TUTbOhboZCfbMYrw+ICXGJFD8iKhQlBqG4kXYSkmLidZCs8ZslZIVaJUO5/fC7Q6iDxPR6K//ni3 fy2/6cNw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgji-0003r5-Os; Wed, 19 Jun 2019 19:59:14 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeI-0006Z8-2T for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:40 +0000 Received: by mail-pf1-x443.google.com with SMTP id 81so188574pfy.13 for ; Wed, 19 Jun 2019 12:53: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; bh=3eeHPEaBB7ibPeJGVTZBxrjCY9Q44woJ91BY0XbG0Qw=; b=h7zSfeEbdEzneBp61eLzanRwVKxxXUTVmy5XGgFJJy+WF/hvr3a2IJ12NdWN1Z8nvY 0pD4XzG7x4XNnmemmZkQIPGpJl+ZiWsLLtzWVALzCvnB4OCetrGxitzPJz5/YtFWufd3 A0WfWtyRbNyB28TLrJ3HwRVSwzJ/Z3f7gccmk0yQY/p2DKAJMg7Q+k/gaIMBHEy7eOUA tN2qwtmwZfj5O7199M7LivATCKZOJgMDGGvlgPN/jCrDFR637FUUzdcvaRz0aojM0kls gWZfBEc4jo8y8UDZZRGvlaIjTbQ4cR/GWwPchX4uZ0Yul0bN84D8vep3ciN030z//hEp VWGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3eeHPEaBB7ibPeJGVTZBxrjCY9Q44woJ91BY0XbG0Qw=; b=c2AysIAX0CQ1FtMhMkFseXXiE5i8qV/dLRBYwQ54znZ58RzwSeiggBcGIMlQ3zRoqL vzUbRZ1uJ1xUbxkYx/pxUGNzY7KMciUUJVWREz9Oy4Hvc7M3N6Ll6odTy4eGO87QuAN/ jP8FteqhO+rCOkGPT2rrKHbXCRb3aboN9pCx90OQpeUDslfsBWXSOzk/7jOz41Dk0KXd YPU9dNPqyOa9IJH+2hAhKLM9RBwcAMK1DfHGCVJQCalJxn03vPUvfAZuN+sPnpIhwp8V NEsjI+RwOkUTmDCD89PSynExYlnFZJQ9Q9svT1I1jt5FNrmZjtz/0BcC6+EBGxauUDPf kxaw== X-Gm-Message-State: APjAAAXoDGcoSiWXYEedkRJEkv6/aJFpq2wnMnbq+SLh1Br4De75eIJL 44bH/EyhBTKvAjCYn1dc7m/NrqRxUetwQg== X-Google-Smtp-Source: APXvYqzBU6iQJD7ox7+BTSiSTIN5hWA7srR74wTOg6IxhqbBxHmYUtzZe0ND/kPfGUMJG1VlAsqAnA== X-Received: by 2002:a63:5d45:: with SMTP id o5mr9384901pgm.40.1560974015640; Wed, 19 Jun 2019 12:53:35 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:34 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 15/28] coresight: stm: ACPI support for parsing stimulus base Date: Wed, 19 Jun 2019 13:53:05 -0600 Message-Id: <20190619195318.19254-16-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125338_474115_22DAF5FB X-CRM114-Status: GOOD ( 14.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose The stimulus base for STM device must be listed as the second memory resource, followed by the programming base address as described in "Section 2.3 Resources" in ACPI for CoreSightTM 1.0 Platform Design documen (DEN0067). Add support for parsing the information for ACPI. Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-stm.c | 53 ++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index e3e2b000cfb7..b908ca104645 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -16,6 +16,7 @@ * (C) 2015-2016 Chunyan Zhang */ #include +#include #include #include #include @@ -716,10 +717,60 @@ static inline int of_stm_get_stimulus_area(struct device *dev, } #endif +#ifdef CONFIG_ACPI +static int acpi_stm_get_stimulus_area(struct device *dev, struct resource *res) +{ + int rc; + bool found_base = false; + struct resource_entry *rent; + LIST_HEAD(res_list); + + struct acpi_device *adev = ACPI_COMPANION(dev); + + if (!adev) + return -ENODEV; + rc = acpi_dev_get_resources(adev, &res_list, NULL, NULL); + if (rc < 0) + return rc; + + /* + * The stimulus base for STM device must be listed as the second memory + * resource, followed by the programming base address as described in + * "Section 2.3 Resources" in ACPI for CoreSightTM 1.0 Platform Design + * document (DEN0067). + */ + rc = -ENOENT; + list_for_each_entry(rent, &res_list, node) { + if (resource_type(rent->res) != IORESOURCE_MEM) + continue; + if (found_base) { + *res = *rent->res; + rc = 0; + break; + } + + found_base = true; + } + + acpi_dev_free_resource_list(&res_list); + return rc; +} +#else +static inline int acpi_stm_get_stimulus_area(struct device *dev, + struct resource *res) +{ + return -ENOENT; +} +#endif + static int stm_get_stimulus_area(struct device *dev, struct resource *res) { - if (is_of_node(dev_fwnode(dev))) + struct fwnode_handle *fwnode = dev_fwnode(dev); + + if (is_of_node(fwnode)) return of_stm_get_stimulus_area(dev, res); + else if (is_acpi_node(fwnode)) + return acpi_stm_get_stimulus_area(dev, res); return -ENOENT; } From patchwork Wed Jun 19 19:53:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECF2214B6 for ; Wed, 19 Jun 2019 20:00:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB05028644 for ; Wed, 19 Jun 2019 20:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF2F7286BF; Wed, 19 Jun 2019 20:00:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB4FF28644 for ; Wed, 19 Jun 2019 20:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=eeSksW/0oLQSTrck0xrilNxgck1/UnTIgS+mZaskbzg=; b=o+Xn9DWnp8nWrqxf/iUaqEGdQJ Q+2hOpQ7Z24owLT8YPQ/JlCGD6FuhyTgSqZoWpZnA7533JoII0zqDeeI9nRwUW1/8Nuu3JtDi81x9 xfJHooaiVnjAYbzagzXe9NDnBXMygP3E2DVnlU9I1Q8OCFh6MMQCzGOEISa2iN7o5tCWVDXylJNED R9oAqh616fQI+vomRWL4oRqENGjPskYSn9deO0EAkm1zcKplWp6X84geQx97uaTh4IznYrNImOj7l W2Q3M+I8Xf7yrSbR72pfkTgstdl3lktIevx4Uql1UNwtRIxIaAiVRYu7iKh1nNyquvwA3iNxyI0Rj SjWx7W0Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgkd-0005XZ-UH; Wed, 19 Jun 2019 20:00:12 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeI-0006Zy-QB for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:44 +0000 Received: by mail-pl1-x641.google.com with SMTP id e5so246276pls.13 for ; Wed, 19 Jun 2019 12:53: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; bh=wGRvmzNJ0evrnLywjNiC/f2VpFf8RGJN+GMZoDDi1RE=; b=QyxpLrmUT/JCBO3lJb7hH5tETbmaTTHQeQozLG6vKk39ilzYEAreZQfME8laG/10vV gi+71PMY2oXdoLyxv/8mo9QPLGon0DdstPO3du+n0vGXiHZN8WQQtkkvl+FLiyeriV5C J35+OkY5Y72mUxzN1jAkH/m5QU6PA6spbhheZiROp3dhYJbZBduGe7n5+gHo9N6rMNlY UmhtDIkMvrYj1je5NlrLWthYxC+Q3SGDMYr6U4FWusT0jKCxa1zEIpDBNYoLgtAuc5a6 nXKhCgGIluP/8+Wi+iMj9fE2417ujuv+ru3zT0f1l+6SrAl9EvnNT0P0aPDYJt6wRprr 8mHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wGRvmzNJ0evrnLywjNiC/f2VpFf8RGJN+GMZoDDi1RE=; b=BEVuysY2WVN6V0eX4PrFPkOSmRg2V1n398UCm3KbdCjogT69PB1buEalo1Qfu7d/s5 W54Kz+BbnhOevsPPbydg6kihiZ1NphhSzFJKPwaQf0TybiRfD6igs17akyE+0qpyMqzR gFmIUZQgA8vhZzbml04q3DUOFPXhTt5THEaYl2eOZ3LBYGuVLrlJWwQr2lzHmBPWF4N+ RdCFOcDcAUV5OA9csAn4Q/M/8HEMp2MMjnYGoS8VHYOiytJgXabGrqV9Y+OdDuxfa9Yg yH+RmXmAnD3BxP/Zf5k5SGwFkECOZYsiF3QNtYRiI06qvPtKCI77smY3FGszTeWhn7zs txfg== X-Gm-Message-State: APjAAAVU0pMkoHuuHUYku6ooVEMmXHVWaBfw1s0gtq78H7PCP36wjh7U AmVMVkXeCBKEn45lQRx8rBgV5w== X-Google-Smtp-Source: APXvYqwo0r9k6NLBwL7GWQBpJjucy+kHJfZoLlT4soLDdLXXXqqiSC441g0kF4PxaJDFyW990LCpBA== X-Received: by 2002:a17:902:b098:: with SMTP id p24mr30728853plr.146.1560974016523; Wed, 19 Jun 2019 12:53:36 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:36 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 16/28] coresight: Support for ACPI bindings Date: Wed, 19 Jun 2019 13:53:06 -0600 Message-Id: <20190619195318.19254-17-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125339_340399_913D4E9B X-CRM114-Status: GOOD ( 21.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose Add support for parsing the ACPI platform description for CoreSight. The connections are encoded in a DSD graph property with CoreSight specific variation of the property. The ETMs are listed as the children device of the respective CPU. Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-platform.c | 464 ++++++++++++++++++ 1 file changed, 464 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 49112a58478e..6fef8732eea5 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -3,6 +3,7 @@ * Copyright (c) 2012, The Linux Foundation. All rights reserved. */ +#include #include #include #include @@ -308,10 +309,471 @@ of_get_coresight_platform_data(struct device *dev, } #endif +#ifdef CONFIG_ACPI + +#include +#include + +/* ACPI Graph _DSD UUID : "ab02a46b-74c7-45a2-bd68-f7d344ef2153" */ +static const guid_t acpi_graph_uuid = GUID_INIT(0xab02a46b, 0x74c7, 0x45a2, + 0xbd, 0x68, 0xf7, 0xd3, + 0x44, 0xef, 0x21, 0x53); +/* Coresight ACPI Graph UUID : "3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd" */ +static const guid_t coresight_graph_uuid = GUID_INIT(0x3ecbc8b6, 0x1d0e, 0x4fb3, + 0x81, 0x07, 0xe6, 0x27, + 0xf8, 0x05, 0xc6, 0xcd); +#define ACPI_CORESIGHT_LINK_SLAVE 0 +#define ACPI_CORESIGHT_LINK_MASTER 1 + +static inline bool is_acpi_guid(const union acpi_object *obj) +{ + return (obj->type == ACPI_TYPE_BUFFER) && (obj->buffer.length == 16); +} + +/* + * acpi_guid_matches - Checks if the given object is a GUID object and + * that it matches the supplied the GUID. + */ +static inline bool acpi_guid_matches(const union acpi_object *obj, + const guid_t *guid) +{ + return is_acpi_guid(obj) && + guid_equal((guid_t *)obj->buffer.pointer, guid); +} + +static inline bool is_acpi_dsd_graph_guid(const union acpi_object *obj) +{ + return acpi_guid_matches(obj, &acpi_graph_uuid); +} + +static inline bool is_acpi_coresight_graph_guid(const union acpi_object *obj) +{ + return acpi_guid_matches(obj, &coresight_graph_uuid); +} + +static inline bool is_acpi_coresight_graph(const union acpi_object *obj) +{ + const union acpi_object *graphid, *guid, *links; + + if (obj->type != ACPI_TYPE_PACKAGE || + obj->package.count < 3) + return false; + + graphid = &obj->package.elements[0]; + guid = &obj->package.elements[1]; + links = &obj->package.elements[2]; + + if (graphid->type != ACPI_TYPE_INTEGER || + links->type != ACPI_TYPE_INTEGER) + return false; + + return is_acpi_coresight_graph_guid(guid); +} + +/* + * acpi_validate_dsd_graph - Make sure the given _DSD graph conforms + * to the ACPI _DSD Graph specification. + * + * ACPI Devices Graph property has the following format: + * { + * Revision - Integer, must be 0 + * NumberOfGraphs - Integer, N indicating the following list. + * Graph[1], + * ... + * Graph[N] + * } + * + * And each Graph entry has the following format: + * { + * GraphID - Integer, identifying a graph the device belongs to. + * UUID - UUID identifying the specification that governs + * this graph. (e.g, see is_acpi_coresight_graph()) + * NumberOfLinks - Number "N" of connections on this node of the graph. + * Links[1] + * ... + * Links[N] + * } + * + * Where each "Links" entry has the following format: + * + * { + * SourcePortAddress - Integer + * DestinationPortAddress - Integer + * DestinationDeviceName - Reference to another device + * ( --- CoreSight specific extensions below ---) + * DirectionOfFlow - Integer 1 for output(master) + * 0 for input(slave) + * } + * + * e.g: + * For a Funnel device + * + * Device(MFUN) { + * ... + * + * Name (_DSD, Package() { + * // DSD Package contains tuples of { Proeprty_Type_UUID, Package() } + * ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), //Std. Property UUID + * Package() { + * Package(2) { "property-name", } + * }, + * + * ToUUID("ab02a46b-74c7-45a2-bd68-f7d344ef2153"), // ACPI Graph UUID + * Package() { + * 0, // Revision + * 1, // NumberOfGraphs. + * Package() { // Graph[0] Package + * 1, // GraphID + * // Coresight Graph UUID + * ToUUID("3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd"), + * 3, // NumberOfLinks aka ports + * // Link[0]: Output_0 -> Replicator:Input_0 + * Package () { 0, 0, \_SB_.RPL0, 1 }, + * // Link[1]: Input_0 <- Cluster0_Funnel0:Output_0 + * Package () { 0, 0, \_SB_.CLU0.FUN0, 0 }, + * // Link[2]: Input_1 <- Cluster1_Funnel0:Output_0 + * Package () { 1, 0, \_SB_.CLU1.FUN0, 0 }, + * } // End of Graph[0] Package + * + * }, // End of ACPI Graph Property + * }) + */ +static inline bool acpi_validate_dsd_graph(const union acpi_object *graph) +{ + int i, n; + const union acpi_object *rev, *nr_graphs; + + /* The graph must contain at least the Revision and Number of Graphs */ + if (graph->package.count < 2) + return false; + + rev = &graph->package.elements[0]; + nr_graphs = &graph->package.elements[1]; + + if (rev->type != ACPI_TYPE_INTEGER || + nr_graphs->type != ACPI_TYPE_INTEGER) + return false; + + /* We only support revision 0 */ + if (rev->integer.value != 0) + return false; + + n = nr_graphs->integer.value; + /* CoreSight devices are only part of a single Graph */ + if (n != 1) + return false; + + /* Make sure the ACPI graph package has right number of elements */ + if (graph->package.count != (n + 2)) + return false; + + /* + * Each entry must be a graph package with at least 3 members : + * { GraphID, UUID, NumberOfLinks(n), Links[.],... } + */ + for (i = 2; i < n + 2; i++) { + const union acpi_object *obj = &graph->package.elements[i]; + + if (obj->type != ACPI_TYPE_PACKAGE || + obj->package.count < 3) + return false; + } + + return true; +} + +/* acpi_get_dsd_graph - Find the _DSD Graph property for the given device. */ +const union acpi_object * +acpi_get_dsd_graph(struct acpi_device *adev) +{ + int i; + struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; + acpi_status status; + const union acpi_object *dsd; + + status = acpi_evaluate_object_typed(adev->handle, "_DSD", NULL, + &buf, ACPI_TYPE_PACKAGE); + if (ACPI_FAILURE(status)) + return NULL; + + dsd = buf.pointer; + + /* + * _DSD property consists tuples { Prop_UUID, Package() } + * Iterate through all the packages and find the Graph. + */ + for (i = 0; i + 1 < dsd->package.count; i += 2) { + const union acpi_object *guid, *package; + + guid = &dsd->package.elements[i]; + package = &dsd->package.elements[i + 1]; + + /* All _DSD elements must have a UUID and a Package */ + if (!is_acpi_guid(guid) || package->type != ACPI_TYPE_PACKAGE) + break; + /* Skip the non-Graph _DSD packages */ + if (!is_acpi_dsd_graph_guid(guid)) + continue; + if (acpi_validate_dsd_graph(package)) + return package; + /* Invalid graph format, continue */ + dev_warn(&adev->dev, "Invalid Graph _DSD property\n"); + } + + return NULL; +} + +static inline bool +acpi_validate_coresight_graph(const union acpi_object *cs_graph) +{ + int nlinks; + + nlinks = cs_graph->package.elements[2].integer.value; + /* + * Graph must have the following fields : + * { GraphID, GraphUUID, NumberOfLinks, Links... } + */ + if (cs_graph->package.count != (nlinks + 3)) + return false; + /* The links are validated in acpi_coresight_parse_link() */ + return true; +} + +/* + * acpi_get_coresight_graph - Parse the device _DSD tables and find + * the Graph property matching the CoreSight Graphs. + * + * Returns the pointer to the CoreSight Graph Package when found. Otherwise + * returns NULL. + */ +const union acpi_object * +acpi_get_coresight_graph(struct acpi_device *adev) +{ + const union acpi_object *graph_list, *graph; + int i, nr_graphs; + + graph_list = acpi_get_dsd_graph(adev); + if (!graph_list) + return graph_list; + + nr_graphs = graph_list->package.elements[1].integer.value; + + for (i = 2; i < nr_graphs + 2; i++) { + graph = &graph_list->package.elements[i]; + if (!is_acpi_coresight_graph(graph)) + continue; + if (acpi_validate_coresight_graph(graph)) + return graph; + /* Invalid graph format */ + break; + } + + return NULL; +} + +/* + * acpi_coresight_parse_link - Parse the given Graph connection + * of the device and populate the coresight_connection for an output + * connection. + * + * CoreSight Graph specification mandates that the direction of the data + * flow must be specified in the link. i.e, + * + * SourcePortAddress, // Integer + * DestinationPortAddress, // Integer + * DestinationDeviceName, // Reference to another device + * DirectionOfFlow, // 1 for output(master), 0 for input(slave) + * + * Returns the direction of the data flow [ Input(slave) or Output(master) ] + * upon success. + * Returns an negative error number otherwise. + */ +static int acpi_coresight_parse_link(struct acpi_device *adev, + const union acpi_object *link, + struct coresight_connection *conn) +{ + int rc, dir; + const union acpi_object *fields; + struct acpi_device *r_adev; + struct device *rdev; + + if (link->type != ACPI_TYPE_PACKAGE || + link->package.count != 4) + return -EINVAL; + + fields = link->package.elements; + + if (fields[0].type != ACPI_TYPE_INTEGER || + fields[1].type != ACPI_TYPE_INTEGER || + fields[2].type != ACPI_TYPE_LOCAL_REFERENCE || + fields[3].type != ACPI_TYPE_INTEGER) + return -EINVAL; + + rc = acpi_bus_get_device(fields[2].reference.handle, &r_adev); + if (rc) + return rc; + + dir = fields[3].integer.value; + if (dir == ACPI_CORESIGHT_LINK_MASTER) { + conn->outport = fields[0].integer.value; + conn->child_port = fields[1].integer.value; + rdev = coresight_find_device_by_fwnode(&r_adev->fwnode); + if (!rdev) + return -EPROBE_DEFER; + /* + * Hold the refcount to the target device. This could be + * released via: + * 1) coresight_release_platform_data() if the probe fails or + * this device is unregistered. + * 2) While removing the target device via + * coresight_remove_match(). + */ + conn->child_fwnode = fwnode_handle_get(&r_adev->fwnode); + } + + return dir; +} + +/* + * acpi_coresight_parse_graph - Parse the _DSD CoreSight graph + * connection information and populate the supplied coresight_platform_data + * instance. + */ +static int acpi_coresight_parse_graph(struct acpi_device *adev, + struct coresight_platform_data *pdata) +{ + int rc, i, nlinks; + const union acpi_object *graph; + struct coresight_connection *conns, *ptr; + + pdata->nr_inport = pdata->nr_outport = 0; + graph = acpi_get_coresight_graph(adev); + if (!graph) + return -ENOENT; + + nlinks = graph->package.elements[2].integer.value; + if (!nlinks) + return 0; + + /* + * To avoid scanning the table twice (once for finding the number of + * output links and then later for parsing the output links), + * cache the links information in one go and then later copy + * it to the pdata. + */ + conns = devm_kcalloc(&adev->dev, nlinks, sizeof(*conns), GFP_KERNEL); + if (!conns) + return -ENOMEM; + ptr = conns; + for (i = 0; i < nlinks; i++) { + const union acpi_object *link = &graph->package.elements[3 + i]; + int dir; + + dir = acpi_coresight_parse_link(adev, link, ptr); + if (dir < 0) + return dir; + + if (dir == ACPI_CORESIGHT_LINK_MASTER) { + pdata->nr_outport++; + ptr++; + } else { + pdata->nr_inport++; + } + } + + rc = coresight_alloc_conns(&adev->dev, pdata); + if (rc) + return rc; + + /* Copy the connection information to the final location */ + for (i = 0; i < pdata->nr_outport; i++) + pdata->conns[i] = conns[i]; + + devm_kfree(&adev->dev, conns); + return 0; +} + +/* + * acpi_handle_to_logical_cpuid - Map a given acpi_handle to the + * logical CPU id of the corresponding CPU device. + * + * Returns the logical CPU id when found. Otherwise returns >= nr_cpus_id. + */ +static int +acpi_handle_to_logical_cpuid(acpi_handle handle) +{ + int i; + struct acpi_processor *pr; + + for_each_possible_cpu(i) { + pr = per_cpu(processors, i); + if (pr && pr->handle == handle) + break; + } + + return i; +} + +/* + * acpi_coresigh_get_cpu - Find the logical CPU id of the CPU associated + * with this coresight device. With ACPI bindings, the CoreSight components + * are listed as child device of the associated CPU. + * + * Returns the logical CPU id when found. Otherwise returns 0. + */ +static int acpi_coresight_get_cpu(struct device *dev) +{ + int cpu; + acpi_handle cpu_handle; + acpi_status status; + struct acpi_device *adev = ACPI_COMPANION(dev); + + if (!adev) + return 0; + status = acpi_get_parent(adev->handle, &cpu_handle); + if (ACPI_FAILURE(status)) + return 0; + + cpu = acpi_handle_to_logical_cpuid(cpu_handle); + if (cpu >= nr_cpu_ids) + return 0; + return cpu; +} + +static int +acpi_get_coresight_platform_data(struct device *dev, + struct coresight_platform_data *pdata) +{ + struct acpi_device *adev; + + adev = ACPI_COMPANION(dev); + if (!adev) + return -EINVAL; + + return acpi_coresight_parse_graph(adev, pdata); +} + +#else + +static inline int +acpi_get_coresight_platform_data(struct device *dev, + struct coresight_platform_data *pdata) +{ + return -ENOENT; +} + +static inline int acpi_coresight_get_cpu(struct device *dev) +{ + return 0; +} +#endif + int coresight_get_cpu(struct device *dev) { if (is_of_node(dev->fwnode)) return of_coresight_get_cpu(dev); + else if (is_acpi_device_node(dev->fwnode)) + return acpi_coresight_get_cpu(dev); return 0; } EXPORT_SYMBOL_GPL(coresight_get_cpu); @@ -334,6 +796,8 @@ coresight_get_platform_data(struct device *dev) if (is_of_node(fwnode)) ret = of_get_coresight_platform_data(dev, pdata); + else if (is_acpi_device_node(fwnode)) + ret = acpi_get_coresight_platform_data(dev, pdata); if (!ret) return pdata; From patchwork Wed Jun 19 19:53:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AA9676 for ; Wed, 19 Jun 2019 19:59:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 079B1286A1 for ; Wed, 19 Jun 2019 19:59:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF233286DF; Wed, 19 Jun 2019 19:59:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 95D89286A1 for ; Wed, 19 Jun 2019 19:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=wleYmFdcHrd41WOGLSVfpca3NCayJt4gz22k1/OjGFo=; b=OoRHGK/asH+cWNOz/7+oa8nJjF cRqnZ6yGhWU5EvB/OV7TAQiSHQYK6b7d2R9lKcnnYl6A5sTxbH20wO/NIoVoC1wSPxsgMAvIndHW0 im03amAD4O/UgwPAwS9y6o3a6ZNkc16XZXw2pcYkDnX8T8JFw3ouQEBJQQXSmg4g8r4P2FxDEJHX0 S3cay/ojYc6B9Ixh58YlHn9afmYdfW7NVxD6RCwnMfVg8e7d9bjhJO6YTHmksVSkmK7gZt9bKsTPg 41tjEa6HbFQNRsQ0GG1MqJNE31EDm0CJD7invbCi9obh7A0zv7MZ+twMIQ1Y9WX1+TR6cTc2VLHqE EmSf2YkQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgkK-0004Sv-8Z; Wed, 19 Jun 2019 19:59:52 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeK-0006ah-5G for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:42 +0000 Received: by mail-pg1-x541.google.com with SMTP id w10so234234pgj.7 for ; Wed, 19 Jun 2019 12:53: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; bh=XhEC8YM9URAom24Z8CuHErk7aYgxQCn+3C30lnGzOD0=; b=xeRXT8iihPNL28u6521qWqVfzFbPjy4YAg3wRoNfH+DPmQ95ITu1sSZRIbtr6cLqgN cDqss0QSve3ClrcVGMTBzFXrLK8DlmeR9+GRrRFUIuddy6LVssffPyVfuSfrtmIdZs1K ZEqLvkFY9qGOoDhMBeXilijzDBjUQINREFZLbBpM0nDtW0lr2cHzKCW1slUDlnqN+EMh y905L23ITdYmWSXy+NdOt/+lmgAPbTo+ZrWs3hqzi8FTZ1R6E4bgzv9r7E9iffhlzCa0 HTPwqXy693Mqsk3OejOPNkjdhptxz/Yu81jWtNuwTAkM1cCOnObIBMsrwp5biSMu/q4S qIQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XhEC8YM9URAom24Z8CuHErk7aYgxQCn+3C30lnGzOD0=; b=NL2f2RfwTKy/UATELCoDbBpN4enfSwMtNkEPPnDWXvU2uknEq4gQ5Lw6nELLpIi/i+ YnqoeebDVV7d6mB/xbK4CwcFOVW9baI44YTPToBXumxSln4Vy8HQsqoTsnF1e7/0x0qN W8Hzd53CrUgeMkuOTD+G4W/5qJos7NRnCOLgUOaEjecPW2D3PLPHNOQZj+WJoJ79FbSd 5/lruFoDgwH27EdQMQzX8MCo2rrKmaGZ0+N2Xb1h2PO7DE9X8kZGshP136e06z78wdWa 0vtbadYR5VH0wK6mYEgjHgvYc/FH0aiMHpiyc6AlkulZYwbete9yW+rKisn1igRJixIV 6miA== X-Gm-Message-State: APjAAAXuIv/OBkDd5LrKy8FLVO71zMl5Aswya/AXgnppKMRE13EuiMY7 fquyICImL0V56EwkMX/TvaEfjw== X-Google-Smtp-Source: APXvYqycwZZCzo4Btx7RNugD1M5hdtPNL8cuu6ifBeTtmlEz3lNM5i3+IuGi/XrjAfcNWyq/ECKQVg== X-Received: by 2002:a63:31c7:: with SMTP id x190mr9221945pgx.376.1560974017417; Wed, 19 Jun 2019 12:53:37 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:36 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 17/28] coresight: acpi: Support for AMBA components Date: Wed, 19 Jun 2019 13:53:07 -0600 Message-Id: <20190619195318.19254-18-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125340_446228_A9680BF6 X-CRM114-Status: GOOD ( 10.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose All AMBA devices are handled via ACPI AMBA scan notifier infrastructure. The platform devices get the ACPI id added to their driver. Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/acpi/acpi_amba.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/acpi/acpi_amba.c b/drivers/acpi/acpi_amba.c index 7f77c071709a..e2142e3e0ceb 100644 --- a/drivers/acpi/acpi_amba.c +++ b/drivers/acpi/acpi_amba.c @@ -24,6 +24,15 @@ static const struct acpi_device_id amba_id_list[] = { {"ARMH0061", 0}, /* PL061 GPIO Device */ + {"ARMHC500", 0}, /* ARM CoreSight ETM4x */ + {"ARMHC501", 0}, /* ARM CoreSight ETR */ + {"ARMHC502", 0}, /* ARM CoreSight STM */ + {"ARMHC503", 0}, /* ARM CoreSight Debug */ + {"ARMHC979", 0}, /* ARM CoreSight TPIU */ + {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */ + {"ARMHC98D", 0}, /* ARM CoreSight Dynamic Replicator */ + {"ARMHC9CA", 0}, /* ARM CoreSight CATU */ + {"ARMHC9FF", 0}, /* ARM CoreSight Dynamic Funnel */ {"", 0}, }; From patchwork Wed Jun 19 19:53:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEED913AF for ; Wed, 19 Jun 2019 19:59:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEC3628644 for ; Wed, 19 Jun 2019 19:59:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C31CF286BF; Wed, 19 Jun 2019 19:59:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C0DE28644 for ; Wed, 19 Jun 2019 19:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=zH8jAP4zQxOhcDzFtK8dJU45o5BvNx49jZPJSsQ5ky8=; b=iyiegbVoHvnq9UsWO8iXo01jhc So43i3MLqM02np8EBLGU8JjMa/jH1OcHmJHLWq4JSKqO63ZyikYVRgDZx7lyGopvl7qayX4J6Rq7P VcrWQfkGYuhwwesqDPcx8oiFKcwidKuzEtnwhPVz+YnGiDZ3CgrDFhX4rC12meYQ2MnG3Ka5vYeRi b5q2G5rb83fuvIGAgnFDaVr5jLtBd0L0IAe9q1tR+n7SwqV7dCvV9aSqzBVrHeZ/VyXHVQyP8mfCh 1WVZVh9niQviiRwFJ7ytt1OC6sJvaP13x4suXEXPpfMeA7uPsS+ZyPOp9mpfuuIKwYgn+iCDK3xl9 +eR6uDiQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgjy-00049J-3q; Wed, 19 Jun 2019 19:59:30 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeL-0006bs-0V for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:44 +0000 Received: by mail-pl1-x644.google.com with SMTP id e5so246320pls.13 for ; Wed, 19 Jun 2019 12:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=f6b6EF22LZj9j5GmFlrz6dxNen9pTHUz+onNfHBegq0=; b=DId1sXSGsw89mvIIWoRwx/HMcLA1qMoX5POzFyXcmBnUjdzDylQjXd9ddsKNZXLN46 u6NbQw02KnQivurlX1TE4QJfgpvaXC/uZ6B+D4riNte5r5FLFSHjVk4WSdNfJxq9y2Su fYg6mIoQ2vwHfcOLya8ae41UNdkNuJCL1Igzh914FudaBxcaZVu0V5SHfz5wB2eHGW5Y 5pFSIASAwjIuESw/FKFTcxKlsAJUsO+IlEmH84YKCFmn6+/meyhYH6a1RNU9c8bly5NS A0I92606AxD0rvcEs4ZHU/IGq8JvlgMBv4roArlH1TI0KrbZR/CWEbcLNAe38tSKZ5Z7 2ozA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=f6b6EF22LZj9j5GmFlrz6dxNen9pTHUz+onNfHBegq0=; b=b2AWc0I08G9GlpsXK8LFUhO7J4LqTT6ducJ4Mp0y5XgmYg4FLY85mCOp7thfvkFGau FQi7Fvh7L50BirJ7VlomUMQP5yGY9yi4m02Ei6UPdGJNvy64A48UL1C1pBJrTxUXgOpA VwQUFXONJ2OfxcJOCdBihZ7QzcaunpDi3ICAYmMLQP9b10pkQ6oG8AVuY5+IqQ5geKE0 rkvh/bJk0656MpDLtnoAid4hxIDx47fFA4ifE0paWWXYRz4RugdaZiY2ZJ4OMDFFEVy/ ++FjW0P00hTGM8SFgOUEI51zsj378cRdigmFn3E7u7/yfVHdxFdXcqbUZeKK9dlhx3kr i/1Q== X-Gm-Message-State: APjAAAXm6gnXqcR0NP66uaT+HHMjbLWYNI8aH6yDU+xz4C1XjWKyfYcb fvO57/lFUjruTHJ/dtpxr2AZIg== X-Google-Smtp-Source: APXvYqwPTpk5fFIN8pw4fTsGW/IOsx6H2CyqkUsXyjsVmXquem1b432aBmnFFLETTxKeCIN333O5YQ== X-Received: by 2002:a17:902:d916:: with SMTP id c22mr97426363plz.195.1560974018805; Wed, 19 Jun 2019 12:53:38 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:37 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 18/28] coresight: acpi: Support for platform devices Date: Wed, 19 Jun 2019 13:53:08 -0600 Message-Id: <20190619195318.19254-19-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125341_283515_8C7ED553 X-CRM114-Status: GOOD ( 13.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose Add support for platform devices which do not appear on the AMBA bus. Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-replicator.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index c0e42253dfe7..542952759941 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -5,6 +5,7 @@ * Description: CoreSight Replicator driver */ +#include #include #include #include @@ -296,11 +297,18 @@ static const struct of_device_id static_replicator_match[] = { {} }; +#ifdef CONFIG_ACPI +static const struct acpi_device_id static_replicator_acpi_ids[] = { + {"ARMHC985", 0}, /* ARM CoreSight Static Replicator */ +}; +#endif + static struct platform_driver static_replicator_driver = { .probe = static_replicator_probe, .driver = { .name = "coresight-static-replicator", - .of_match_table = static_replicator_match, + .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, }, From patchwork Wed Jun 19 19:53:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BCA1176 for ; Wed, 19 Jun 2019 20:00:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A68D526E3C for ; Wed, 19 Jun 2019 20:00:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9722728492; Wed, 19 Jun 2019 20:00:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A07DD26E3C for ; Wed, 19 Jun 2019 20:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=I+3U2VXt2rPWTADHakjQk1gBLJXS7I4+qt2u7Xw1jm4=; b=ippv3Lmo2P6GousrYIHNvp0CJM KZ1tElEX1+dXAxEBE7lH3gcDjBPBXsc34BbbfHU1MfIHhn0qL4I/AhjzxCWLlhmXwD6szbLjg6X/H 2ERJD1HxN+5LD0IjVIBG7hhw+54NEiomj+BVJsFfOUxc8Bkn6+Xq1+hl+KGAweQHwROf3NJlAE8jn GmnlJXIhI3s26oIM/ypvwbQQTh7fz31otPkE7ZiqM0006YTcF9KG4nNF2Ok0SxkS8Si3HnznlP8QX zq6Gb4aRPfgdSngCi9a3LZsG8A7tHOiPBg4RhoQzqEpgj7Yzmk1kZvtGdxZ2StckzTyg7jdjWHRK2 FBZoXS4g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgkz-0006Ey-Tw; Wed, 19 Jun 2019 20:00:33 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeL-0006ce-SH for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:44 +0000 Received: by mail-pf1-x444.google.com with SMTP id j2so207674pfe.6 for ; Wed, 19 Jun 2019 12:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TV+NMprqoFfwSyp0QoUYpBDwrINgLFtHUcekXEvVDhU=; b=oAjogQElbtpiXBPkp0yfn2AojM1AtUpM+3pCVVj4zJgQGV7D/Tk40idYWoewYpz9rl JEsZ2FcTE/1ffdwluhQJH0JFGE5T3/cEaOMj1bLnvZ14ACPNtTgnhIk9sz6W0D4Aqtdt bz0CRc6CHkW+kL4WMrNVnvkE8wslV1OFSQ1iLz4DpFVEO/cp/IPA2k05woN/DyeEa9UH PdELMZnl9V3y4eSwuBKHcKbzoWsK3/i3lKUF1py8hzeHpWUpAzzIr7fWaxsBccBzrZYp huGseqIsviljBouwlHVgSQ/YpeKIrWiHsgKvHqh9KSGsIqUMi20w+3eVgrXHUdWbm9Ez 8ToQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TV+NMprqoFfwSyp0QoUYpBDwrINgLFtHUcekXEvVDhU=; b=HrBEmyvNZeGYatS5grs4lhRRX+m+ovqQCiGFfLKsDPoBrY2tlZ3aKWW2qOEWUmfPXx S3JNe7eJwsPMMvhp7+equtHQOq2oQYjZQy6aikZ0GFVn6VnsbqkXTDkOKB1UxrGZloIN 4FMIaThT2lTvIRZ96j9e9ZtPyYgYsu60Hq0FB9Muy6yrsC6IedD6hcNZMmgMEU1chsMH wZG4gQ9iw+ALFNBw5sywtblPzMVSDJUnbbaCma/uzSSZxwYTKuqMnRkb6KzB9WGGEbEb Md9f8AmcpO75W6pPa8wRcMOLYeVWN9IJbib8OLR+kQjYS4QV8BkEUTZJpb5b9C1xutnj Yw7w== X-Gm-Message-State: APjAAAWt5c/d8cXxeu2vW7MKrp2n325uAcKEx0roNezSQkA2VEmamhOo eglPJhwQiDm2Mrhx0MGnSv9eRe4ELv7awQ== X-Google-Smtp-Source: APXvYqxCuKOGb++7lFH5PjEe+Iq08jzfwZT8FMh6rzB1FBhyWtUyw28itx/9D7uwmq41Kq+xs932/w== X-Received: by 2002:a17:90a:ac11:: with SMTP id o17mr13183360pjq.134.1560974019576; Wed, 19 Jun 2019 12:53:39 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:39 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 19/28] coresight: Add dummy definition for of_coresight_get_cpu() Date: Wed, 19 Jun 2019 13:53:09 -0600 Message-Id: <20190619195318.19254-20-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125342_242842_9563FDC3 X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose For !CONFIG_OF case, add a dummy definition for the of_coresight_get_cpu(). Reported-by: Mike Leach Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-platform.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 6fef8732eea5..3c5ceda8db24 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -307,6 +307,11 @@ of_get_coresight_platform_data(struct device *dev, { return -ENOENT; } + +static inline int of_coresight_get_cpu(struct device *dev) +{ + return 0; +} #endif #ifdef CONFIG_ACPI From patchwork Wed Jun 19 19:53:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9DB8C76 for ; Wed, 19 Jun 2019 20:00:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D1F9284F0 for ; Wed, 19 Jun 2019 20:00:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80E212850F; Wed, 19 Jun 2019 20:00:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1ACC126E3C for ; Wed, 19 Jun 2019 20:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=y8ikfQO94n3bsaAswX+Etw0/eBNzID98aWWchm70IJc=; b=mV9CWpvoztoiurBb9nWRG+WrWf MgyK1ayIFotFz0XgncqPyn0E3O71BMtqjrP9OyaULeWIFn9MtojoDpKfxT8fDm8xjUPVCA5WbYeaR 1RAFn1OH5XM4O+qN1JEC8wkZ2PBEWPPctFXrfLhs8PBouZVziGa+VeaS437wcNHqGoVWA3RFTbUr3 VLBNt4+SBkCNKFpFhTdTyHiARU9W4Bmtq4sd0v455N9yXormlZhAIiZ8ZEBAbvzEoXgLG/gvb6oBv 0cKRHIv/xGd3/GkLzYLN9O4RDCSe+1uFtrPx0Cfka0c4/ET70nlkZZfAQ0HlXMcAJ/2OovJB4UTAw TDj+u+Zw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdglJ-0006Xm-8m; Wed, 19 Jun 2019 20:00:53 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeM-0006dh-NB for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:47 +0000 Received: by mail-pg1-x543.google.com with SMTP id 196so237492pgc.6 for ; Wed, 19 Jun 2019 12:53: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; bh=U+080fyAUiTJTh9JJ5MaKbNtEVXayYcNMjeizWilaNg=; b=dGgsEfOtCuXPIz+lWEAwh8Ybf+ey6Ba1wW1J+GNLkZphSlqu693nH+GxyygIBHCMJ9 UnrQmIYEsKEVvzhx5PnfbK0+OPCgucLQj9j4uuXKbPfIyFas70DqWJhlXCiPegZ2n+D5 IuMtIv22WBKA/pkiWnzuR2k8RhxDPpXXUv7DjYk9EhqAnIRFmF558dnN9HbHw0BeRN0n tcHTCQkD7oW4+URqErmXxIEydOBNrJGF1iXLQzMaTnK71xLmABxxxxVv2XV1u2haNP+m oYmRXA4BTekg18qWugPKAPCg6oUqg/83jKNyXl38/p/Gd0zKPbQaCZIqoNJr0T2av5x7 zHnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=U+080fyAUiTJTh9JJ5MaKbNtEVXayYcNMjeizWilaNg=; b=X2vjH6A14soBBopKkOatrGtbxTQtb00atvrtAIZM/3uIhRMReBTygHLMgENfeaUBcN WwfHyIE3wSDS+DhoZT9IF0wycpLU74ZEJuezjpitFHurCLCg1QtApW0o6Z4J/et8oivN fqfdQ2BbLtCzDlscIrAe9FjzVfbJt3DCBa+mPkbgIR4ihRRk5AVps/JTPc0wogxP5Sjg ABddK2l1DtTRF+01IG1xNFFtO0S+qLfnzo4Grhq3obbHzF++QedNgVjgI/EKb/nosOz9 dGj2+8QTPC0t5Y+Ij1LNyBpZ2AQk/gsiiOWMxyQZwgMGBhXN1n+LBh4zepH2cz3/RZIz kOcQ== X-Gm-Message-State: APjAAAXma7BV/UZVG3v+Uny6SxK8e59akOKs57zpLs/Uc5HTFli5tmVN HXLbDaQNqhfQ+kzm6GpuxUhrhA== X-Google-Smtp-Source: APXvYqxZNzCQED1IW4nRFIAXdbyDqd2PxD23szhS/ATJ4epxJNK06991N+ih5AmHB+8aL38X2nt/ig== X-Received: by 2002:a63:5a4b:: with SMTP id k11mr9300700pgm.143.1560974020463; Wed, 19 Jun 2019 12:53:40 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:39 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 20/28] coresight: tmc-etr: Do not call smp_processor_id() from preemptible Date: Wed, 19 Jun 2019 13:53:10 -0600 Message-Id: <20190619195318.19254-21-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125342_942560_DC81295C X-CRM114-Status: GOOD ( 14.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it's not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/1743 caller is alloc_etr_buf.isra.6+0x80/0xa0 CPU: 1 PID: 1743 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 alloc_etr_buf.isra.6+0x80/0xa0 tmc_alloc_etr_buffer+0x12c/0x1f0 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 855ab61c16bf70b646 ("coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf()") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index ce0114a5435c..7c81f634ecb4 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1323,13 +1323,11 @@ static struct etr_perf_buffer * tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, struct perf_event *event, int nr_pages, void **pages, bool snapshot) { - int node, cpu = event->cpu; + int node; struct etr_buf *etr_buf; struct etr_perf_buffer *etr_perf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); etr_perf = kzalloc_node(sizeof(*etr_perf), GFP_KERNEL, node); if (!etr_perf) From patchwork Wed Jun 19 19:53:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D8A276 for ; Wed, 19 Jun 2019 20:01:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D049286A1 for ; Wed, 19 Jun 2019 20:01:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E9F5286BF; Wed, 19 Jun 2019 20:01:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A4E66286A1 for ; Wed, 19 Jun 2019 20:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+Rm6Lll5Wss4K714CrfmfMfsLslb/P7xm5UNw1baPJ8=; b=GWrCkAVqna5Ae+CHVQihOFYJug pS0ZPA3VOb/2YAeVZ09GNZAubgKS1Hfviaq8B4CMwGQwacJlSO6yI8FfaR7GqyPxvUNiO4VX3Nf3U 1+nU8mMa9vi+wdFysNqDKLq3bx42q/eV6OpV/kjLLExIMYZ40Z1usv3fa1YSiduyaQDYd5bgF1QN6 yKquOZTVO8cFtNyIaBNxNwHOmJmwSXK6vl9xr6QpjMGRErcTJYfcNxOjppopYhOxAoed8ho+AD2vl QPY+OmYTNlmVYCEbVkBBfvD22oVLD4xiFfoFqSLxfvsdLmvdVHqr51C7CFBQSLRu5ZxEmAeUh+LXb EOviNuQA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdglt-00078r-BG; Wed, 19 Jun 2019 20:01:29 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeN-0006eS-BL for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:47 +0000 Received: by mail-pl1-x643.google.com with SMTP id c14so272121plo.0 for ; Wed, 19 Jun 2019 12:53: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; bh=QfxiSC10lT2kIdBoLtEEdrvPoomT9IvwdXsx/Fv3PE8=; b=Uy00H7aQiST9FooWquBKLO5MSZ/4rWUJ1XuFQkSTYwyWyUtytKH38Q7pEmMBbqddCM u5P514IFYf13V2qt3s/f1u9BAcizd7jKW4gDFJut4Q5jwYxF8z6987XKXKYp1QNRJWp9 mBLbzlg/8L4qFZYZfCJU9JGcLOkSJ+mE9hgTjM4egr3RUhcQ4sKHejf76ZIVEv8NMDef WweweOpmJEoLMcL4t65Xpc8sdvcDJ5DPyT8Ym9ET2S1Odin2QSTNs+BempQfeh+IWRNF QKDT3IEejJgVwPqTTiDg8c1YzfIFRq2vGWLxVYnsQG8tDNoH/E0Sk+rPXcZGseqTdQAg mkxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QfxiSC10lT2kIdBoLtEEdrvPoomT9IvwdXsx/Fv3PE8=; b=SOm/fVlzjYo6wzkL1IV5/Ze5YzMhL6+e+tM1pIM9jGEKeA0AK/M/MtF1Ylt1inGKDj hKciskBIy1aNFlLe0R/gen6QgnHPI8KCexygTQ50es9gJK0IFDX0mIJhCQ4znKZbcweR 5ebl86aC3UuiRi7znv708zEgZOmCn6bZSV8ybdiQ2dt/QeX6GdkONLmMMOCUz5TFbhT3 F2cibOSLXrsH7oILjzqwk0H+hyI8EE2oYD7Fo8GnEehub60dYRQ494DKrOvWtDfhrP23 9U5/gzc1yuA7R8OaZqJs2MoPfh5kxR3d3queydl683lsQnKCQTr1hyX9zZtoWz/LGoxG EQlQ== X-Gm-Message-State: APjAAAUQRbpRzW7QKJbu90D9r3GLARObslQe01FZLJkRY+bNpr0U8WSa h+0CpATlfVHbYB0Qquokvb3Nlw== X-Google-Smtp-Source: APXvYqw5oQE3QPURoL/FFfCdfq+ne7MJ9cHK/hBC1PIrYK+ukresTOyKxK0ambMdxp6Iozb0fAQD1A== X-Received: by 2002:a17:902:ea:: with SMTP id a97mr79352359pla.182.1560974021264; Wed, 19 Jun 2019 12:53:41 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:40 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 21/28] coresight: tmc-etr: alloc_perf_buf: Do not call smp_processor_id from preemptible Date: Wed, 19 Jun 2019 13:53:11 -0600 Message-Id: <20190619195318.19254-22-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125343_485762_14E7192B X-CRM114-Status: GOOD ( 14.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/1743 caller is tmc_alloc_etr_buffer+0x1bc/0x1f0 CPU: 1 PID: 1743 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 tmc_alloc_etr_buffer+0x1bc/0x1f0 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 22f429f19c4135d51e9 ("coresight: etm-perf: Add support for ETR backend") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 7c81f634ecb4..5d2bf6d18961 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1184,14 +1184,11 @@ static struct etr_buf * alloc_etr_buf(struct tmc_drvdata *drvdata, struct perf_event *event, int nr_pages, void **pages, bool snapshot) { - int node, cpu = event->cpu; + int node; struct etr_buf *etr_buf; unsigned long size; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); - + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); /* * Try to match the perf ring buffer size if it is larger * than the size requested via sysfs. From patchwork Wed Jun 19 19:53:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D9A276 for ; Wed, 19 Jun 2019 20:02:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C712286A1 for ; Wed, 19 Jun 2019 20:02:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60A1F286BF; Wed, 19 Jun 2019 20:02:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 004AC286A1 for ; Wed, 19 Jun 2019 20:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=I3kNfH7AEn9Q2mcGoXiLSeK083Dx/fz58N/mPL27m10=; b=GfSTNUgBIE8GHtgGs0Ir9a6pir gLg8wVM61k6Xz5Oytba25LSPNDLSVjn0dEnm0pL1u6hiRWR2gq0qB8P7X9iOeY/bTgdXO/qctJO/8 NE01ykGBp+YNhj+A6fGnAyKwMhPo39FyVT9W0H8D3xAgeBtXgZpWJqHCi8XqzBHOPPuMMJIKz8AfA idYpyely+GKgRsbmZ47rGNwr+trtKPjxd0WHhfSXEkeXvZeJPxVtzdGdyo9AOBmfin7lhnmSqiLKx t3sVfLkgHJ4vjHR/Z/nXW++/Lc2ZKc/11glXu0GTiYQxTlMRnt+epKzlynTg/3s8aTuxsvNGd4YCm t8MEQf2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgmX-0007jf-PI; Wed, 19 Jun 2019 20:02:09 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeO-0006fB-1s for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:47 +0000 Received: by mail-pl1-x642.google.com with SMTP id cl9so249608plb.10 for ; Wed, 19 Jun 2019 12:53: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; bh=UC0Qh+uUJVyhwc88NCYhgwMpRvPxciHY87Ex0aW5HaU=; b=NrKx5tWye87n268TSdDr9qGjAoXq6nSSvFB7xRH+Pm3dagLn9GTCc4w1flwFX6f1p3 N173E/bBOONw9hfKQ8L1JCTTBBKkhj+DnIvwoGknbWhUbSYqYsIl8Jsh+i/nsRStqJln juw80OR54qWJYq2ZQ04R6urpbTlV5VTTZAmdb6u/T3Y+g5VcAR0rUshOdc48AYkR4ARp ekmIvh/q0tKH02NJCb/po2qyc7gjVa+UbGlSnAzT/PJZG6RaqIyMBPuq71pOr1lGmy5x Q8GwVObdsAFoyJXln/6GtC/pvBVs7XqzDd35gkvEeDMKk/gNYrJPktbf7E0luClisnf2 l2fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UC0Qh+uUJVyhwc88NCYhgwMpRvPxciHY87Ex0aW5HaU=; b=GC4G4tiey2rSjkl9oIvfuaXtmNRcU3wZIAIHEQs6GIMIT1T9IgKHDoAJDpHwQsyu/A 88csZqk+bpQB+gZhek/YSbXt6v2jGmbuGeHfISADvs68mfVC5yHq5vgLQM2k6uansV8c lQai6HZ05XgB5Bq9exC7BLvG3u7Z7axI+NkDJhY3bTVs7W6+EBo3Bgoy4EQCc0M2vOP4 mrMxe3os2qNgzGLkhrhIttUNFA9H8qqaiJ16VWOCokOH0/YaAhoJ7wWQN968vNgYTAYB X8myZ2qLrYpl3X6bXcX0fp0GxaJwQJ6+MRKqz5tmVApiopoyhKQhXLcQsZxo+XYW6fzI 7uSg== X-Gm-Message-State: APjAAAUgdu5eJkYu+fam95OvqE2URQa92PxH8jOfm0Ekw0WulN1a3NJl Rdfm+1Lv0vGlbCBukEfIc+z5xA== X-Google-Smtp-Source: APXvYqyL0c6KGe2kHuhwvHCq5nGgCZcgHpC6FzUptevvSR8Au7sLnU7ax3G48/oUSfcWsHnAL+FSwA== X-Received: by 2002:a17:902:148:: with SMTP id 66mr113353833plb.143.1560974022077; Wed, 19 Jun 2019 12:53:42 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:41 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 22/28] coresight: tmc-etf: Do not call smp_processor_id from preemptible Date: Wed, 19 Jun 2019 13:53:12 -0600 Message-Id: <20190619195318.19254-23-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125344_111223_0EB607C6 X-CRM114-Status: GOOD ( 14.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 caller is tmc_alloc_etf_buffer+0x5c/0x60 CPU: 2 PID: 2544 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 tmc_alloc_etf_buffer+0x5c/0x60 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 2e499bbc1a929ac ("coresight: tmc: implementing TMC-ETF AUX space API") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index b89e29c5b39d..23b7ff00af5c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -377,12 +377,10 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - int node, cpu = event->cpu; + int node; struct cs_buffers *buf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); /* Allocate memory structure for interaction with Perf */ buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node); From patchwork Wed Jun 19 19:53:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 091F6186E for ; Wed, 19 Jun 2019 20:01:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAAA0286A1 for ; Wed, 19 Jun 2019 20:01:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEF29286BF; Wed, 19 Jun 2019 20:01:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 882B7286A7 for ; Wed, 19 Jun 2019 20:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=o0Gf3YtzLBi3PKWcCxDb+wNfUkrquMhEWej+RvZmURg=; b=JIawT2XoTATpR3eyGX/geaDpkU ogOPQ+7n1Iddq8bLm6lkJUM9HUl/Ol+DCsIcE0ch15Xx/CHjl+2Op5DVmi9bRsQdpRxX/7MLsz5iJ RjdZ9VsY1g1+ZuFIf1LbY+wPHmHcNa9SUYYjha5IOayf74qM5iOL0N29ymIZT3874zwKsoXoY3+m8 iaz+4xlqZXZ0zN00TYSwFbEouNnqQY/C11vc9AVLEdtT34WjiHb1jxVhu/Syd/wwFtHep79Y+t61l jQrxHJCmb13cMn+y2+3XAxyBx6Djg7PFOvMu7G/+NpqMDEZ87NN2oMCPxMiBN4SSmQj7m1cfubMBc QShCmBpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgmH-0007Ry-1G; Wed, 19 Jun 2019 20:01:53 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeO-0006fz-Cd for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:48 +0000 Received: by mail-pl1-x643.google.com with SMTP id cl9so249632plb.10 for ; Wed, 19 Jun 2019 12:53: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; bh=R0Wh2bB4q/aIbgHc3QWovDYztq8qq4nwX/0TMGUqdNo=; b=NUIGt5KMieg3H21BEE1iAA/viwD8copPqA9hJVJz2lxz1O5X+yPhJSiIIMI3rNeJBC CRg1Px9idgeSEOmNRB2pjFKEwu0MLgjNyeJuUhCCIu6IkMgS0aHnNcmKCmvMm87cCat9 h9Gt2fK/ntwDPdNy15PoVvE7frICZMRzgCAol6gQdZNI/tKkwDtoqxeVD2g54TqfBZVh lE20F1GxVkqnKewsngY7Pjt776qV8uIaOKqdYtHF+WdDWEY6Fg4bJrhWCqmgWSCxhc5C C/H9OwzI28+FZyH0KO0UQOkX65Z33ZozEwBUePvMM0mBUXKv4EvyO9KbCkEQ+wYrnTyl kz5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R0Wh2bB4q/aIbgHc3QWovDYztq8qq4nwX/0TMGUqdNo=; b=BkuYaXw3AhlX7S2yyZUxq/aAvWmze53Ppfc25AzXRfbqhghzNxfKQiqSiTlICbyHkC 8b+NPRYidsc2wpsBBXBtOrTQ2pNclfQ3fqtvhyugdtoCizZ6MV8nRU6vHHYa3JneYZN1 QzXqeioM71q8YP7V99HzO6dapWUGFoi6QuW85cEJNSVh6N1+SV91rUxlNoRqXS/+dGyf il6PGkZUtzo3QItfZlDMuN+nNCiRfGkr6tf+QHaOuvUNMSFsFL+AEosDwY8/oDSxAr1u xU8phW8tQQcCNTaQ58FZ+0o02oGDoBwDzRNjdhWoZLL5MguPhbQfZO6WBqy/c4fi97LV 3fEg== X-Gm-Message-State: APjAAAUvhibJlQvOnYW2AXiwOH3+bO0oCRaMoHWgSfWZ7HLDwu11ZtDC 7pNSdOCxC3xJWgzJ4EH45aanVQ== X-Google-Smtp-Source: APXvYqyswiCxY093Bhnp9HhynnIqXjOS4ktAD7R9vscNNzlqbI/P+iSUhh7qfadOArB2BWFww/UCfg== X-Received: by 2002:a17:902:aa03:: with SMTP id be3mr43306075plb.240.1560974022934; Wed, 19 Jun 2019 12:53:42 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:42 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 23/28] coresight: etb10: Do not call smp_processor_id from preemptible Date: Wed, 19 Jun 2019 13:53:13 -0600 Message-Id: <20190619195318.19254-24-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125344_545425_D5F325FA X-CRM114-Status: GOOD ( 13.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. Fixes: 2997aa4063d97fdb39 ("coresight: etb10: implementing AUX API") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index d5b9edecf76e..3810290e6d07 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -374,12 +374,10 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - int node, cpu = event->cpu; + int node; struct cs_buffers *buf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node); if (!buf) From patchwork Wed Jun 19 19:53:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005161 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 263B914B6 for ; Wed, 19 Jun 2019 20:01:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1449C286A1 for ; Wed, 19 Jun 2019 20:01:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0741B286BF; Wed, 19 Jun 2019 20:01:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B10AF286A1 for ; Wed, 19 Jun 2019 20:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=AF2rde6Soo3Dp9Y936Shh+Z79tXGwMf5PNBTwWvruag=; b=mKusdol5F1aHCU6WtB1p3/xUWx s3oDFOwlsvy7QkyVAduJf06VfFuDrMkqY14vB87igiX+ArpgcwssK1Wlv9pf+fpXxzONV5j5/n2Gn 0kNZ8mAF0Rax52q91ifcs6C7c8MEJ+Zaarc1WircLX5N24W2wbd6eyfvxYtq21FpxFyc3YOIJiCwJ KceSdoi8ftydpr3t2egQHyn1tbM5f9GDRyPPa8vtfh1mi/tdeVMbKbf+vNFE9uzzrNHh7a4SJcODs cmEEX+fXubQ4kMwU0Q7MiWPn7l/fsAkc5ygTuLvVLMF4bNFjTG7pO7KQtaeUD03iayJIW3Jw4Mi0x ARDy/15g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdglf-0006oj-2O; Wed, 19 Jun 2019 20:01:15 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeO-0006gg-RY for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:48 +0000 Received: by mail-pg1-x542.google.com with SMTP id 196so237563pgc.6 for ; Wed, 19 Jun 2019 12:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gXxfLSHgLZGmqkWHxSJZdsVy2kycSL/GwJEpQt6NxwI=; b=BE6q+zq7W9YCQV4bIxZaZC4SIPCeFlkmSHKrRLQFQivCglkMTdRMJO47pPhJfc1MRp To1hwcc+BLeb0E+jHlCN/yxESj55qtjK+bbYF5r33QwTQYoFVPhfj11a3lYwKKejNI6e 9yWwZU7Q8tTC2PWgBGQCckpIB5a2VyeEDTGVuwAUJH1enI9INaifZ5O8IAtb0xAsXfwj u9HkA3dh6HvACsQHRgn7dJGuCaqMi7594jB1LdJMdP3tzcAh7rTeg1lDYVvW3CwCHNBF I6AoBGIZc308w91RMEq9EfkqOMzWZJL2KbELfJE97Tj4q15yg28KZxakmv5s44grEqnf NX2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gXxfLSHgLZGmqkWHxSJZdsVy2kycSL/GwJEpQt6NxwI=; b=L6q+tfHtNGjjSIqMFIVL9ou+1MJLu16SVyyOw0KSdLwH8a5mnjbJzpUdTctZXZLIXc 6F7HYtfclyswAqf8TWuQQdPitP8stK3APMbaDMFvs+ryFggPdBvwEAtK5ltmUpfzaKjf jUlGke9jZt6RMctTzLMfuIncL07+5cM2p1QVXryADcWMwFNTU88TVeYLWHFvD1s0SifK BZmAU1U/1vNjUPCC3HM06MDSkzJPyOkj8CsTyAPDhpvhiLDjSUwinNojNOlizD4oLtGC UkDhAetsOotn6IzP1DhsDnu14rWTjKCgU0AGVx3jhB6daJuL8bGpNvtXtwiG46jqa0fI 14YA== X-Gm-Message-State: APjAAAXTImmz81LAi+/pFus4Oqd3dbQUHwlRsCJ4qQbQyGrEj12XH/CL shGjvKwYN2ypYpy/EbIO3CDBlA== X-Google-Smtp-Source: APXvYqxHNKZt8vSfKkKHc2OAKvHAxBAwi+1M7WWaszz8fYVUv4fOX81jC+lL/Pz1O0Uo473IunsQIA== X-Received: by 2002:a17:90a:bb8b:: with SMTP id v11mr12744868pjr.64.1560974023707; Wed, 19 Jun 2019 12:53:43 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:43 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 24/28] coresight: Potential uninitialized variable in probe() Date: Wed, 19 Jun 2019 13:53:14 -0600 Message-Id: <20190619195318.19254-25-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125345_026120_0C24DA80 X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dan Carpenter The "drvdata->atclk" clock is optional, but if it gets set to an error pointer then we're accidentally return an uninitialized variable instead of success. Fixes: 78e6427b4e7b ("coresight: funnel: Support static funnel") Signed-off-by: Dan Carpenter Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-funnel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 5867fcb4503b..fa97cb9ab4f9 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -244,6 +244,7 @@ static int funnel_probe(struct device *dev, struct resource *res) } pm_runtime_put(dev); + ret = 0; out_disable_clk: if (ret && !IS_ERR_OR_NULL(drvdata->atclk)) From patchwork Wed Jun 19 19:53:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A4B176 for ; Wed, 19 Jun 2019 20:02:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 480E2286A1 for ; Wed, 19 Jun 2019 20:02:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BA4F286BF; Wed, 19 Jun 2019 20:02:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2B86286A1 for ; Wed, 19 Jun 2019 20:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4TFkK9QcVxFd3XuH9JarhYL+Hm2tRHyR8eF6s1kPa+k=; b=JCDOBKjVOJYUsI651JJ3MNwGAW 6d8ytb/nkO9s3Rkq6CD5YhIkWHRkPXmx5+xvSmkDhsteDWp1EWW1dDVn5hKLvWYqITOY7xSEIeMFq Qbl6fJioFVO0tnFx0FWldShxJouTsO72vH/5z95UMb/5c7NBNTdx4Oeq+C5VdsdjJtJgj2hcPmXR9 W3+eq8Gfg/b9WETFhiaBq5addO+NmmX2QoEsu4mVr6UQENkzloUVo6Mx6mad3BUlmvT2m2rqHTmdi Rt63dnUWzK8oXsaM0qele9sqr0/djNsqbkMWSIuPSKND+FwfTgHk0SW6kEgd14aSZxJsvF5aCsFvC rQyGTZRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgmt-00080N-Uw; Wed, 19 Jun 2019 20:02:31 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeQ-0006hm-66 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:50 +0000 Received: by mail-pf1-x441.google.com with SMTP id q10so199323pff.9 for ; Wed, 19 Jun 2019 12:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZB/QEA/K3clWkDbM4qhRU5KEkoHlA3Iglne8yOGj5AU=; b=oxz8QNlNYpu14xP9SeCJNn/S/raL5b10AEjEFQ6To6DHmMBPrqxHndGOEkmQTtTNwt vUR0b4ZZ/gNdCUY9JP7CPwWbA/hjGCANWVExDbwezN2B6FEinBzFcvvgUA2AA84bIvVe VJ2G6L2Nn3aVPYgDexi2wEPOAMv9EHTAiBs+zDYmzdaO1rd+E+M8fSOIZ7A8xqRA8YqI YcY4ToTMoPVN+ej1tnoMJ+17Y/5GNAFbClrCWeij2V9rNrAglCxlSZtFhtOHW5mI36GX oaEx9iQreoUroEFQV6vHEPALHj9d/EXUueq84RtXLfoWjxWYQBBV4066hStpcNhQojLX +Deg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZB/QEA/K3clWkDbM4qhRU5KEkoHlA3Iglne8yOGj5AU=; b=SQWddODMFdX8HV2ocA2Lc4TF+Bd1ogvOlqhdf4uYZTMsIprDJITN7z+OYddHUJX4+R 9UNbVXbJxdXH/H45hfr0NkU8FLZBxfTkpbSoe6gM90anUTsLmFjSYFQ30X8i/FGCFl07 KZ39nqm0NYjT6+xBdsyES8fyvEBegnL9/6pDLJnXzv7i2IAxTuw6+vrO3bj+PfTAunfS Yu1xaVZZz2E83McbG+J99NGv85vXeD8U6gkW4qvDspC4ZPgJ3lUaGbvdg0HoK33Y+Sd6 tuIBMsAddI+ved7DFprrVAGoXNPwkVhQcstAYnn+3poD0oIdNyUJy8qaBNUSJlpp00hH WCFg== X-Gm-Message-State: APjAAAWzfw/zNSFs43A17qhJVGjzXWLZvO/4UzuhBjPv2+cQsS2+guvo IgJsKHdm+Kn4/1vJbUdhJfI2ucq45hrPFg== X-Google-Smtp-Source: APXvYqyQl/rSTWw+sEz+Dr4fSV5h01XvuVJZXuMzFVzg5eyxn1h7DimTkvRMWgJ5G1VQgXe+5h1tsA== X-Received: by 2002:a17:90a:d814:: with SMTP id a20mr13059065pjv.48.1560974024684; Wed, 19 Jun 2019 12:53:44 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:44 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 25/28] coresight: etm3x: Smatch: Fix potential NULL pointer dereference Date: Wed, 19 Jun 2019 13:53:15 -0600 Message-Id: <20190619195318.19254-26-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125346_374432_97C3FE2A X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose Based on the following report from Smatch tool, make sure we have a valid drvdata before we dereference it to find the real dev. The patch 21d26b905c05: "coresight: etm: Clean up device specific data" from May 22, 2019, leads to the following Smatch complaint: ./drivers/hwtracing/coresight/coresight-etm3x.c:460 etm_get_trace_id() warn: variable dereferenced before check 'drvdata' (see line 458) ./drivers/hwtracing/coresight/coresight-etm3x.c 457 int trace_id = -1; 458 struct device *etm_dev = drvdata->csdev->dev.parent; ^^^^^^^^^ New dereference 459 460 if (!drvdata) ^^^^^^^^ Checked too late. Delete the check? 461 goto out; 462 Cc: Mathieu Poirier Cc: Dan Carpenter Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm3x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index bed729140718..225c2982e4fe 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -455,11 +455,12 @@ int etm_get_trace_id(struct etm_drvdata *drvdata) { unsigned long flags; int trace_id = -1; - struct device *etm_dev = drvdata->csdev->dev.parent; + struct device *etm_dev; if (!drvdata) goto out; + etm_dev = drvdata->csdev->dev.parent; if (!local_read(&drvdata->mode)) return drvdata->traceid; From patchwork Wed Jun 19 19:53:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6735F76 for ; Wed, 19 Jun 2019 20:02:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56749286A1 for ; Wed, 19 Jun 2019 20:02:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AC3E286BF; Wed, 19 Jun 2019 20:02:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E86E6286A1 for ; Wed, 19 Jun 2019 20:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Z6tLJRWKrMfTjjT063aPSyCtl4+qcccqWj+YCGa07eM=; b=mcVCSvaezJJSQ6BlJfPyVcnFyK kMjlL9r7ftlRHLchSAZ9hMVsJvNqvufwSzCDat/Tw5TnE6KtHpYxjmu1+o+ltGV8DYcxa4Icxbixf SzE1WZ6tZPcMI0ye3MXZP221hxZzANYg73E0wVuEbvo+u2ohaxxPGMv8pKSK1Rc1xQyCYiH56OXDJ nyhfjrfMxVymBgpb9XsvcvyA7H7fG8BgusYrmwJjk912vfPdCzLO1dqdFx9/BV7n9TV8tb6wxaWL1 mm5/IQiPVLiX5eLY3H+QPnlpmbHP7Sq/BFRDs2j1ZRRpM/3pRFI6T3Agmb2Ww5bLgnFspcp9jq0pk kCOJ5KVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgnA-0008K1-DH; Wed, 19 Jun 2019 20:02:48 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeR-0006ij-Hf for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:51 +0000 Received: by mail-pg1-x544.google.com with SMTP id 196so237601pgc.6 for ; Wed, 19 Jun 2019 12:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eVDBdMkApj9sKJLqD9SjgtJkupY/dvzVE0zp0XjJG6s=; b=aQQlsUcm3Z24V7Z+EWx61qTLfxCs7b7nH/xaftbC8HtMCpQAnLXbjP5yu7nIY3OOMZ CWA74omKQQSUAV5Ys0yftxpQKRXldjo2onAV8EIU3AeQnPuxeON0dECL3ydE1PH09+yY wFbMBOaKWXfcZa3WIbZJ3D5TsMud7z3k4UjsHZ66OSXsfZ9iM3ajIiV84SUQXn6Ol6BM B0PmuDhsYrDLVWCWlPpzCVUaSg+ILgZjjvNe22vx+OJdg1DdY8jB4Vn5Kq/Bwewsp/DQ KVwIbz/z0Gh5FH995SXch8vblMRhaTqGc2mlT4ur0eSw7GXLpK7jNaDAejNCviAW+i+H B2+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eVDBdMkApj9sKJLqD9SjgtJkupY/dvzVE0zp0XjJG6s=; b=qaoqwF9ItUN3vxfKnW/eGb0WrCBXDrGP8CF0xiLigDvsIhQ56bGxr8bHweuMhXUAJo Z1h8iuQNmStma3DksHmQ+qChl8BZZ7WLeJwWYYMwA2OhcrTzSOvh56AHfSFS5KnkX1EB yHndYeiexN3Jti+Oifa/bmq/W5XPjihTm9x7F1hPMRO3p6HxjZOOmZ4NpOTYwqFBf4xQ eAuizpyq6lN6vlBXRs68QfpxgPRkpKg0QhKNN0h76tC4qiqam2bE+Julcp8ZPn+7VH5t otCJB1ceEqkKuL57AxX10wMouHj2Ik6LdezNTY1aC/WdmTThQXcVShji78xseVRvPBvg UrCg== X-Gm-Message-State: APjAAAWIvuI7T+m2blr3kdFwtm20v+9x+m7gHXBOuvo9YR5vyGt2CZmU U5J1BFpaNKuTiVUxjhqj5s04Eg== X-Google-Smtp-Source: APXvYqynFm4Gi6dwkGLGuDzG63Gvpmx2XwUU8Ox0vdU1H16fpEH0Kdh8q/Dd8SGWkXesbFP8rrtCHA== X-Received: by 2002:a17:90a:214e:: with SMTP id a72mr13374261pje.0.1560974025457; Wed, 19 Jun 2019 12:53:45 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:45 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 26/28] coresight: tmc: Smatch: Fix potential NULL pointer dereference Date: Wed, 19 Jun 2019 13:53:16 -0600 Message-Id: <20190619195318.19254-27-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125347_834649_4DE11B68 X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose Based on the following report from Smatch, fix the potential NULL pointer dereference check. The patch 743256e214e8: "coresight: tmc: Clean up device specific data" from May 22, 2019, leads to the following Smatch complaint: drivers/hwtracing/coresight/coresight-tmc-etr.c:625 tmc_etr_free_flat_buf() warn: variable dereferenced before check 'flat_buf' (see line 623) drivers/hwtracing/coresight/coresight-tmc-etr.c 622 struct etr_flat_buf *flat_buf = etr_buf->private; 623 struct device *real_dev = flat_buf->dev->parent; ^^^^^^^^^^ The patch introduces a new NULL check 624 625 if (flat_buf && flat_buf->daddr) ^^^^^^^^ but the existing code assumed it can be NULL. 626 dma_free_coherent(real_dev, flat_buf->size, 627 flat_buf->vaddr, flat_buf->daddr); Cc: Dan Carpenter Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 5d2bf6d18961..17006705287a 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -620,11 +620,13 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata, static void tmc_etr_free_flat_buf(struct etr_buf *etr_buf) { struct etr_flat_buf *flat_buf = etr_buf->private; - struct device *real_dev = flat_buf->dev->parent; - if (flat_buf && flat_buf->daddr) + if (flat_buf && flat_buf->daddr) { + struct device *real_dev = flat_buf->dev->parent; + dma_free_coherent(real_dev, flat_buf->size, flat_buf->vaddr, flat_buf->daddr); + } kfree(flat_buf); } From patchwork Wed Jun 19 19:53:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005173 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C479876 for ; Wed, 19 Jun 2019 20:03:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B03D9286A1 for ; Wed, 19 Jun 2019 20:03:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FC49286BF; Wed, 19 Jun 2019 20:03:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49FB8286A1 for ; Wed, 19 Jun 2019 20:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=E3cPg6TBrenfG9Rzhhl3qj76+PnLE9aEKWGwJn2YDog=; b=AsOWZVid8Ruc+UtiEe/oR53KYZ ZdNtTU2VxBgflg1+olaZdzpbrYTNETsQja5nzEatoNlQOV3g4oNeFoYyeoJw0SOtnnX4c5EU5EYu6 28+o0jjV+wdmP2DVo2C5ps1//E9P8Ro/ZjYx0UFbTadEvviX0SsUmRzEEU1HY7FmeZnR7lVc9+/iS mIX0uCSWb07NwrrrlbjeJTjIvpR8WpNwke0Tg7K0Av+SrQ+W85eR5zVwXKY+gA+GF35A4XvBhAze8 ARNfCM2a9NLgM6sIIJ/DtSFMLLeRXMimcjooKi5Vn+vTY92SirxJ9tncoVLimyvHgTDPUNlHlOPvZ 0bM/+9Vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgnW-0000Am-Hg; Wed, 19 Jun 2019 20:03:10 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeR-0006jQ-O7 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:53 +0000 Received: by mail-pl1-x643.google.com with SMTP id g4so260096plb.5 for ; Wed, 19 Jun 2019 12:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cNm/Gnvmoe8OMqI3hroQMow+nr0a1GxGDg/6aibpR2w=; b=lYveENuveuYI0BwZo80/qaUKHohljulL0oA0gaWK1utjfSxuKzmV0U60eiZH5x4sgI efWHxuiV7tZcV1tx4SMGwUre8UPH+YQEDHHGryHG5LM0q966Am6YGV8v3jq1FFcj6s5f 0v9u2UE0+FYdEkopGEaku41rRt7/6kGbyWIfyQAYi+R3UZ9S0sVN5fbulmhWPKKubDYd IE86DrE3fEzEb8B+GQso5lDbV9IXF/jz9cKvjolNASyLVOl6/MFV2uQtu4x1J/KAO5iO rthmcTQMQfN4x855g3Sgr6qqCJg2HtWrrdplIPcU2N0H+CWBae40bCNWeo+orczPgjsj Zmbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cNm/Gnvmoe8OMqI3hroQMow+nr0a1GxGDg/6aibpR2w=; b=GBiJYx+K6DvacJLlHuQR7oUCzfEZ707O2hrlNQlTYs9ECUFomEDDXppIYwLCUIDKCG BqLP20f8uYM8MfMXmnmwwZ67ofeNpOXHwLYmgth+h0oKK4pawa6VqahmC+fQ+g9JlE6/ eIoo5KspLD4P8fZbIa8j1gjDue4h7ExJuqe+h/CJle3ZDYUyNmxgicNWj5ZzpymBcx+v 5bhX56hHZyL5fvDt40kWQTUg9Fd8RRIKLzlJQ+6ss+IMF3h4M+o76KEpNgCKiGD1wf7u QwJJENq1fvGv6FZj5Lnympjz63SQLJmNarthstXI4tTGbHveTqVY432nL5mUOFA4y8jg 4DPg== X-Gm-Message-State: APjAAAXfoYlNCKHRIN13LuIv9Ag9vnrzZ52VWwVTd9wBw/C0ZgYr0b3B gLkWtyo7htFdi2fdcqigpMUgkg== X-Google-Smtp-Source: APXvYqwajCF/Ni2gYINk1Q8O6nrrwAeA+V/tjYktZunbZSuTYgWkByf1KHH3R+MryZ7lvygLLpsd5Q== X-Received: by 2002:a17:902:1e6:: with SMTP id b93mr77214955plb.295.1560974026261; Wed, 19 Jun 2019 12:53:46 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:45 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 27/28] coresight: platform: add OF/APCI dependency Date: Wed, 19 Jun 2019 13:53:17 -0600 Message-Id: <20190619195318.19254-28-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125347_974021_EB0D7E67 X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Arnd Bergmann When neither CONFIG_OF nor CONFIG_ACPI are set, we get a harmless build warning: drivers/hwtracing/coresight/coresight-platform.c:26:12: error: unused function 'coresight_alloc_conns' [-Werror,-Wunused-function] static int coresight_alloc_conns(struct device *dev, ^ drivers/hwtracing/coresight/coresight-platform.c:46:1: error: unused function 'coresight_find_device_by_fwnode' [-Werror,-Wunused-function] coresight_find_device_by_fwnode(struct fwnode_handle *fwnode) As the code is useless in that configuration anyway, just add a Kconfig dependency that only allows building when at least one of the two is set. This should not hinder compile-testing, as CONFIG_OF can be enabled on any architecture. Fixes: ac0e232c12f0 ("coresight: platform: Use fwnode handle for device search") Signed-off-by: Arnd Bergmann Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/Kconfig b/drivers/hwtracing/coresight/Kconfig index 5487d4a1abc2..14638db4991d 100644 --- a/drivers/hwtracing/coresight/Kconfig +++ b/drivers/hwtracing/coresight/Kconfig @@ -4,6 +4,7 @@ # menuconfig CORESIGHT bool "CoreSight Tracing Support" + depends on OF || ACPI select ARM_AMBA select PERF_EVENTS help From patchwork Wed Jun 19 19:53:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11005175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBA9C76 for ; Wed, 19 Jun 2019 20:03:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAFE9286A1 for ; Wed, 19 Jun 2019 20:03:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DB69286BF; Wed, 19 Jun 2019 20:03:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 51256286A1 for ; Wed, 19 Jun 2019 20:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=cLkrFJqDXObFWBHij2XMxinnZ2lJiQVmrUfk6/wkCAg=; b=swkyyFcXcZnDl2m59+WnENVY7A vrejlcXQo1XJu3sh247QKPTsvFF7+Tvcgx2WwyvIp+qa9gFRq/PUeXPWq5HHyIBsXIuAxATHgS+rA IX9Ropq7crhHsVs37cPd19o3Iv9bi+fdLGtrvUNKsegy7hga6ycW9iVFeboqA5BrCYSkG66arFOTU XKvZnoKjLfeg09IOJhHhg3IooRthF+AXzhKxwr0zLz3Y17+zDm+Tl8oflyFxlWSPYwu1KwdVehTiF ErNyGjAdDQf46gXRACekGNfSX5J71hEk6UTHQPtmb5ZKsHa6h3uRtvc6gUWIQ1/GaK7a/h3e8gfpZ /0oxIK3w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdgnm-0000TI-Ez; Wed, 19 Jun 2019 20:03:26 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdgeS-0006jx-Jd for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 19:53:54 +0000 Received: by mail-pl1-x641.google.com with SMTP id ay6so251485plb.9 for ; Wed, 19 Jun 2019 12:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DXUk5qmda2XK8XQ2pM+me+/3tfkapIvCeu+/dr6te0Q=; b=D7SumMElwipLy66O/ZMn1+WCIIMYzoCOqwwrgl6H5EfM7KvuRRqpSN9RL1tUHuJf5M 8A5JkRYEyHQxbthu6jPxVcfZcQJwiyIBxKbRHXxnmY3Xh290j37d1y9hqd2W5xfZSMKC uKkec/fIBSCDRQT+qfJIfxmDlg3D/xIsA0lTPgK/ui5jTxrdbqMA+xc9bhEUE9kPzzD2 uX6aJWNwc5Kj7C9s1eDN26z7qpR9WnlmN+bgzAS9hV67FWtZeBKCZeXGLHWPPnqVQjdb 4sLAXg67eWC1J5DjlZOiCeJ7/CfNVXnsIQeYFgMXdrqyXvoLr++/IHo43fJbql2E5SBF GhoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DXUk5qmda2XK8XQ2pM+me+/3tfkapIvCeu+/dr6te0Q=; b=U7XXWVg3TfUWTJd72qxQ+zA0llbaaUC33U0vrwuMeGQo6ZEmuI9GwRTHiB1d7VeJqS O5xqnfb2dUOmsgvshcdcq/MnJca+P5NZVN2C5uwGswNhTfCnTNtuIjzJoRq/QZMhZ3/k oYv4LoxX5d88BJN1Zwci1mWykP5ViQLdtsRfRcE+rdtkqxQRTaXVGAnVv3uCYVIKX6c3 5iKXDJe375n40SnmgyPFhSWnv/5V1p71bRFBaFDyfOqt6JybKFfU29V4pibnyX7IRrrL Xz+nEPtUo85mdqhfGRNn9Ak8llmL0nl2SCkLYiEmdxiNuD9jShURZEKowaiAi0vKVpey fLew== X-Gm-Message-State: APjAAAWTKDbV8/W5GE7YQon+I340yF3KRmHG26+g85bYuaftTVolKaO2 xIi/Oca8quqOywdlNRmnce6yzZ8kdyDA7w== X-Google-Smtp-Source: APXvYqy6blWusyZenvL/3DbvgDhX5R8pICjmUdxNuxU3HT7JFS6zCnQEgPYNGBpJph8bNrU7rttqHA== X-Received: by 2002:a17:902:aa8a:: with SMTP id d10mr84248834plr.159.1560974027207; Wed, 19 Jun 2019 12:53:47 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j14sm21615993pfn.120.2019.06.19.12.53.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 12:53:46 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 28/28] coresight: replicator: Add terminate entry for acpi_device_id tables Date: Wed, 19 Jun 2019 13:53:18 -0600 Message-Id: <20190619195318.19254-29-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619195318.19254-1-mathieu.poirier@linaro.org> References: <20190619195318.19254-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_125348_801643_1B666698 X-CRM114-Status: GOOD ( 11.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun Make sure acpi_device_id tables have terminate entry. Fixes: fe446287ec9f ("coresight: acpi: Support for platform devices") Signed-off-by: Wei Yongjun Reviewed-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-replicator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 542952759941..b7d6d59d56db 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -300,6 +300,7 @@ static const struct of_device_id static_replicator_match[] = { #ifdef CONFIG_ACPI static const struct acpi_device_id static_replicator_acpi_ids[] = { {"ARMHC985", 0}, /* ARM CoreSight Static Replicator */ + {} }; #endif