From patchwork Wed Jun 19 17:29: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: 11004855 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 C5B9813AF for ; Wed, 19 Jun 2019 17:30:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A603627F86 for ; Wed, 19 Jun 2019 17:30:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99E8E283B2; Wed, 19 Jun 2019 17:30:51 +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 3941D27F86 for ; Wed, 19 Jun 2019 17:30:51 +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=+sKPTS8Q9g1ZQ9vTc5BSH+taZi9bJ3C4umPB6ZjOX18=; b=tnEUGFnGTJHxRkzvX+SMJ0ZkLF zy9+jJ69aldMxTa97vYuL8od+DYHF22/OqPsx1uhJhqjxUrp7wM2w7zepf7HZBY+LXNr9LzXR9adp 3E2Ugc55AdyeiA8slmQEuvESd5QxWhO7+gnblLgxIsf79TGU2yw9Q5gWaOf9brytvk/WK9OSJ5ezy d1MRkzesEWMRvXZh9CU5yOF6prI7H5xlyFuN+M2h2Y7dfQiJopAK2rBOJ61lyODemdreAgYU3lqxn B8ljNtGX+bfu6A7bi9rltMa09Djw80z8OmTGAquAsP9jg3XZ8Co9wQwzOAvV3WQc6PO+MPKxLLXCI Vub4mf0g==; 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 1hdeQ5-0000S9-PM; Wed, 19 Jun 2019 17:30:49 +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 1hdePB-00071W-D1 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:29:54 +0000 Received: by mail-pg1-x541.google.com with SMTP id v11so48908pgl.5 for ; Wed, 19 Jun 2019 10:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qltR8cfVnuvR/vnmhmjDlPUX6JMRjkKXDYkgNNI9oR0=; b=bDdm8XwtacWvLf9KoGjr7mQPFlpr7qp3Yev9o7XnudlvpCMGwMGpIFUq3c8jJcX+qS zSxxUknUKriKvi494yk8jwab6c9/Ns50uY3EQ+S+T27UI/kbDQ6co6lUf72e6I0X6Ag8 frX6C2a1L8sHJpQ5/CBQBnks05yJod2C1alZ0Wsduu92TXP4cxg3nVE7TWTPNDGFmHLc Rr6dyH014fyN/eP/hFQXaOuKdBlxQKhuolExIKolytddMEEl7Ld1axfMTCdoIhU3rYZM bSNJwWEnMn3Grz0dpZDJ8YiwFBFaL4LVEaudQMqVFaXN0mTQaj7M4Udvp+o3j01xjo6X ZLZQ== 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=qltR8cfVnuvR/vnmhmjDlPUX6JMRjkKXDYkgNNI9oR0=; b=XftsTxe4/MGq9n+IbsOiPcX5R6XrsmY2R+S9v/BjLocqGKdJGnj2gFRIrK5C2GJVMx fBzItyaU4qzp+S4oziJKkwN5jpYHAZIZN60AWf6HiW0fZpmnL9Wv/UVHp9aDUXfGs5vh 49bIyeJiDt8RwabbyB2D6vEKqDfYZSwP0Rs04z7Ov5Ry9ynIf4J/KMS/Ux9/L/FIwsX+ GjIABjX6A1valkr/P+qBuDsaZErTcmizw4GG0xDR/k10SnIPB7zp7M3CaRWP2lHn0wbO BqassVD0dccYsy1VcxLgUwf3VDusceEVMoMXrM/l4cHRZD3/hMXDb0c8I8nV5Ypmd8nq 1sIA== X-Gm-Message-State: APjAAAWKdxXtJ/QwtfKJtpjttxuUziH51opFLywYpJY/CQDz/peVFfwS CdJo1iMRyfV4QTQY5pml8tjKTg== X-Google-Smtp-Source: APXvYqw9TAAW6kjBKuo7BtHsWKko/yqBtDqxA8WyxomxQQtoGcAXnIVVNhx2R4/E1WvpNDKiAMm2/A== X-Received: by 2002:a63:4e10:: with SMTP id c16mr8575609pgb.214.1560965391976; Wed, 19 Jun 2019 10:29:51 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:51 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 01/45] coresight: etb10: Properly set AUX buffer head in snapshot mode Date: Wed, 19 Jun 2019 11:29:05 -0600 Message-Id: <20190619172949.4522-2-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_102953_440245_B686C12B X-CRM114-Status: GOOD ( 13.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 Unify amongst sink drivers how the AUX ring buffer head is communicated to user space. That way the same algorithm in user space can be used to determine where the latest data is and how much of it to access. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etb10.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 4ee4c80a4354..60e753b1768d 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -548,13 +548,14 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, writel_relaxed(0x0, drvdata->base + ETB_RAM_WRITE_POINTER); /* - * In snapshot mode we have to update the handle->head to point - * to the new location. + * In snapshot mode we simply increment the head by the number of byte + * that were written. User space function cs_etm_find_snapshot() will + * figure out how many bytes to get from the AUX buffer based on the + * position of the head. */ - if (buf->snapshot) { - handle->head = (cur * PAGE_SIZE) + offset; - to_read = buf->nr_pages << PAGE_SHIFT; - } + if (buf->snapshot) + handle->head += to_read; + __etb_enable_hw(drvdata); CS_LOCK(drvdata->base); out: From patchwork Wed Jun 19 17:29: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: 11004853 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 59D2714DB for ; Wed, 19 Jun 2019 17:30:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 441DF20223 for ; Wed, 19 Jun 2019 17:30:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38795283A5; Wed, 19 Jun 2019 17:30:42 +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 B6DF120223 for ; Wed, 19 Jun 2019 17:30:41 +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=B8kXT2z6dkg8cHT1WDBcExAkH7U7CBEgQfMKzGQGa2I=; b=nOfnmscAAVJ44aGYdYu+Xb1tW6 zv9qEsUx59BSCiGsTRM/+OOZFqvg+9ZgW+HtwekNiRUMU0w2CWg+hWv3s8AplbXR7L631Wk/pDXZD oSsSBXWA25Cpmo0546/zV8wNNf64Kj4EUYmbwxJzLypQV7r/ncqfgImVXduuVBl7IhX+iEUAiDK6a ccZlilIB2cGHQq7FsGDx7wHCEn2oL2yam4P39cRnXy9sniz0L9KT31xfotlnNZdTFxDXmS22dHTTG jt1cfQnkx+nMkaqhGyBAjljoixr7QpjWWvJ7pqrolqfjo6bz5DNP47l6m4Q7U39gzlpR7mU6OJPpG BvUstQEQ==; 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 1hdePq-0000Ak-TS; Wed, 19 Jun 2019 17:30:34 +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 1hdePB-00071X-EG for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:29:54 +0000 Received: by mail-pl1-x642.google.com with SMTP id e5so76830pls.13 for ; Wed, 19 Jun 2019 10:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HbwbF/59DYmxqRT7LuBdinHC/slAn0pZe4OVFN9ATCA=; b=YQ94VBRSx9IOZTvrMgeyc2aoRiHejrweqB2Anm16UWCVul15KtGdHE8I2PYHobpy2R ZZnFDYkJ/HrlrLH+z12tKbVCxPBNmBhld9fBrm8fAKiyH/paIZYIb+1aH0ad8IR+OmFK Hs2HmIaTCceDPNwsqGHp0E2U7GWOj0iliQRTsm13bd0jLBfb0GnJBSucurepL1ANu7ui 5NTawpdcCr8fkQhVwLKTSugH6iDKkPDxL3cQhL6QROcMxfPgV8oEqTcyUzgnUDeKuWY8 GjlCResoYqOUILUMHZnqrtln8LfuPju99dDSTbcjro4cuybxIrLj408juc0cY22kWbf7 qh7A== 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=HbwbF/59DYmxqRT7LuBdinHC/slAn0pZe4OVFN9ATCA=; b=VOmmRfTbdQwnYrbzSlmmNR493EBWkHHa0+PDFl0RzP9EiQ/mTFw6GhRY9p/sYiPcpm r8NrUa6ocMlb7XqIi2dYxqdlTX7SX7nknTmVOaGrc0LMmCHQ+Cq5SnbqkUqqwnOHfGZK aM+TxoYF8YhkJhk31hCQBSBzDgHQVo4MEZhTtB9jwWos9XuCeHd03CcTp8Fu7hf9CVBg JSenRnKNS6J0jvL7KAkULmadsKZUTNNAUYpq5Ym0g0cVlm8ta/XaURwK+x3kt0ptggEd Kg02mNT8TLRDf04SnwISF9Hmm5QK50Lpub1c0KEvtdm9TZimT/ZXqrCgNSUYJa6hdLGq hjvg== X-Gm-Message-State: APjAAAUcf0w4kLB1qSOKsqhrEaYrE9Y4sdM/y7baqxSVAZEm4gegOMe0 vh+z3oK1hbrT8tHU5Jz3hn1I8w== X-Google-Smtp-Source: APXvYqyEGU76hbyzAXnq2/2bJ9iA9TLFPvOwSAlzyK7OhudhmdCh/VGJnEmKcTjU11NoWt5eelvmTw== X-Received: by 2002:a17:902:b592:: with SMTP id a18mr95884696pls.278.1560965392974; Wed, 19 Jun 2019 10:29:52 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:52 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 02/45] coresight: tmc-etr: Properly set AUX buffer head in snapshot mode Date: Wed, 19 Jun 2019 11:29:06 -0600 Message-Id: <20190619172949.4522-3-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_102953_488577_E9DADF63 X-CRM114-Status: GOOD ( 13.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Unify amongst sink drivers how the AUX ring buffer head is communicated to user space. That way the same algorithm in user space can be used to determine where the latest data is and how much of it to access. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index df6e4b0b84e9..cc8401c76c39 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1501,14 +1501,13 @@ tmc_update_etr_buffer(struct coresight_device *csdev, tmc_etr_sync_perf_buffer(etr_perf); /* - * Update handle->head in snapshot mode. Also update the size to the - * hardware buffer size if there was an overflow. + * In snapshot mode we simply increment the head by the number of byte + * that were written. User space function cs_etm_find_snapshot() will + * figure out how many bytes to get from the AUX buffer based on the + * position of the head. */ - if (etr_perf->snapshot) { + if (etr_perf->snapshot) handle->head += size; - if (etr_buf->full) - size = etr_buf->size; - } lost |= etr_buf->full; out: From patchwork Wed Jun 19 17:29:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DAFD13AF for ; Wed, 19 Jun 2019 17:31:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4958E20223 for ; Wed, 19 Jun 2019 17:31:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A88C28515; Wed, 19 Jun 2019 17:31:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF45220223 for ; Wed, 19 Jun 2019 17:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XonHFz5eiXJswPu4D8CFGTzxWHkyYrx5W2Orliy8mV8=; b=IGfYL5fWKCoVFPZgKuPySr5PAs LjJdGfRv6coI0iudijBtgsbTk1tDZ1ElKR3j4QiEFOYO3skzfuKV8yE+NhRBDhjw5KwUbSF96J9mp bbP+qvgbD92zIatVUXziAMkv56HnWqcfoWzdT07KfmmPuh3EjIsS/YXGolLEOTw24RgC6LkKDQ79U J8TVgPqJG09eEgAGHbee00QbKgWAsGWloVXbr4FksDLEqtB4l7VmFGet302TbIl7lTIinfHr3rjeC xLbAgFEXk7T9Chj4v9xhgD67fAdLjh5sjmTgg78Ck8/zBVulvO3E2tkl6NZO08K/emeSLw5T7ZNC8 cwJTVKSA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdeQY-0000kr-NX; Wed, 19 Jun 2019 17:31:19 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdePC-000726-IT for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:29:56 +0000 Received: by mail-pl1-x644.google.com with SMTP id p1so101348plo.2 for ; Wed, 19 Jun 2019 10:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xNRhHxUPWncB5rk9ccCc3nU/kF5YdxipsSBDqELFwA4=; b=vcKfhxX/oosFu3ZomeEpMgjZGgs/d+rYYAl2uFr9m5l3fGvil3fFS3fC/sUnOvw/1H mpX+EMJvI8Ur0umZkCP9MdTaFkj8WIFHY6f5pqkhchzsm7/tG2jM3AGnqZdoDBdFQUbN Z5cT+Ck7rKhscV4/MxXDNiBP+mAw98zqUBiB5CHOMqmK9MuChfNrKNOKLYI4nCGjDmlg 0ksv1KitZqMRx7FD6l7G3T85srJW/k+NC1eKTITOO0FZPKp0w6ymVzfz8DBkQQE8jvxF N5x1gN7K3FNf/BnnJ1ZFCy6Ao7hSuMmPWA65Lx6YCbL9v7VEpznmYTxIcme8rUAubWii sy3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xNRhHxUPWncB5rk9ccCc3nU/kF5YdxipsSBDqELFwA4=; b=mjj/tKLjHJ9DZgcCylkqKJHTAfYoB4H+gOFU56Vvj2VuzB1vCfjGM5/DSSfk6LehEU S6Qk8q3egj1Z3RwMKmxmT9fJObaqzwYxePD6lL9eIUtFSbfeHDNgBQa4FWYpizADkN+r DlHiRRIUqsSRuAwMao6bYFu+npD2E3rDXm2Ztp3Nk9mlzYJ7RNz/CBDOtPd7Ctuv4m7N 4GuOphzetZwzZzB1eaaOghiwiWqp8MIc29NkwW0hVusm/j8JGfownCal9Nn+ch8pI6IC f3U+16QX+pt41r647zdpLR/kLTH22orlXlcKrfZHpnq+ZN5+iSwpB3vbGv59c6ZsX2q8 FhoA== X-Gm-Message-State: APjAAAWggZ+f7kupoY+qsKHO94F/nPsH6A1Cmcwc5Fki+lOdRLc/isXq ojWg78sQlHSMCdtbaFzfoLRx++iYROlS0g== X-Google-Smtp-Source: APXvYqxasAH5gx1S8sAFZBvO4s6IxUVYwvwnwNgLptvOyIe1OPflgarFzrEGeNPAEMDvjBxTuCP3AQ== X-Received: by 2002:a17:902:e281:: with SMTP id cf1mr39640055plb.271.1560965394018; Wed, 19 Jun 2019 10:29:54 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:53 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 03/45] coresight: tmc-etf: Properly set AUX buffer head in snapshot mode Date: Wed, 19 Jun 2019 11:29:07 -0600 Message-Id: <20190619172949.4522-4-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_102954_605632_3A161C31 X-CRM114-Status: GOOD ( 14.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Unify amongst sink drivers how the AUX ring buffer head is communicated to user space. That way the same algorithm in user space can be used to determine where the latest data is and how much of it to access. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 2527b5d3b65e..d026bd04a6af 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -542,11 +542,15 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, } } - /* In snapshot mode we have to update the head */ - if (buf->snapshot) { - handle->head = (cur * PAGE_SIZE) + offset; - to_read = buf->nr_pages << PAGE_SHIFT; - } + /* + * In snapshot mode we simply increment the head by the number of byte + * that were written. User space function cs_etm_find_snapshot() will + * figure out how many bytes to get from the AUX buffer based on the + * position of the head. + */ + if (buf->snapshot) + handle->head += to_read; + CS_LOCK(drvdata->base); out: spin_unlock_irqrestore(&drvdata->spinlock, flags); From patchwork Wed Jun 19 17:29: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: 11004861 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 3CB5013AF for ; Wed, 19 Jun 2019 17:32:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 296F828515 for ; Wed, 19 Jun 2019 17:32:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E3D1285CB; Wed, 19 Jun 2019 17:32: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 8D44E285BE for ; Wed, 19 Jun 2019 17:32:02 +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=2F08bqIQEMFid/2m+3shHTt26fMMKWMxTmFDxQnd7Kk=; b=MjiStC0uEfxr88zzkXordiVUZB 1yAqptmUmSHIDbAfY/rS0D3a1GQ9iAyykDeF1u7U5LDZWTa3TIxiIE/QZcYcDS9Fj6oYc4X9fj/08 /q9LWyo4tDT7+qk4+fHS01TwuhteSITy+xXP92Za02cLATGeFtGDXzPE14iFb9eEGZldMtb3S/nbi GG3BdKTXEi1aiPA2enctIe0CiJVwwmUIdvqE0YdBNVDKs19epii/hcjTjEqnkXDRV52K8FROF4+9K GVnGaV8iYYjIhreH48cRsLhWjt1juK6BqMeYjrcxnlFEqHiQXQq7vxYQ4XNjuGYUrc5GU63Cv6m0F WtgYou/A==; 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 1hdeRF-0001E4-OM; Wed, 19 Jun 2019 17:32:01 +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 1hdePD-00072e-EI for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:29:57 +0000 Received: by mail-pl1-x641.google.com with SMTP id bh12so96572plb.4 for ; Wed, 19 Jun 2019 10:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DntHf6qmXjOCyFeWUksN07Ur/NuqwmdmF3FS5Sa+EJ0=; b=ovFVM3s48TGhF8GijshVlefEngqpAJFK7CnqJJwvS7KlyTi57OAaq8VzSW+I1OM4Ew e6R2fyrxS3aFTVRTTka0CXAHymjGhO3rrKR6VTd1b4MFYXHdT3w0oL9KATbvZ+/1Lnu3 /0qW07EhsKIcNVvF5+/W+3lx5enouHyvG1/UfGPRqWZFaNZwuVj+PibrUgm06TdZb5u3 hWd4p4aW+dTG64zhLheuxzMpKem4OxrkXKMBrKLajigbDHcfSxkfQmDU/Mkc1jMeR34V /Kg9i+S+qGmuQYq3XFg241PqrrGPZa24SdTg5DwILZC1LC3S2daZ3VyYZTJXITsXOCXF aBOA== 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=DntHf6qmXjOCyFeWUksN07Ur/NuqwmdmF3FS5Sa+EJ0=; b=RDT0iCOeNmXB4zRKAKO7HlVkz4vUZG70mAQCLgR1iHPK5g7Ba2XZnGGBG9rFtalDiu hkH7fXoWy8kztn70vhyycHk6WoeR/YDyoTnvAtZXIqSJyrYo7sp9LH6MTCXEqobXwJTk /a1KQcdwCKBBSoAC3vXba23TJdFcYLtTj+qHsNx7n02ry5g31H97/0hHDVNdZmWAQyBl JXftmAaiVoBGwyBB5Xam1kxznWhPksmukVHWz85ngxcvPiILoZ/2dhQSQydbkNoYxiYz yB3jVgMqRTGJWgj1i+o2QomOuzwkXxNPFuP+ZrSbw1qK1HDHoubYPC9Ti3TBTtExTYSa MaMA== X-Gm-Message-State: APjAAAW108Bj7nXDaOI1E+i+pIssoksudRXWcmKPY33pZWP80Pfbf495 naDi+MM2wJhoJWbMTME83xOzt7pVj/s+qg== X-Google-Smtp-Source: APXvYqzpPkaTpHgaLpXe48rxJ1cBMYvomI+njAAwpmnnf0U7iwfs8oOr5VPEkXP0soieDO4pj3LhYw== X-Received: by 2002:a17:902:23:: with SMTP id 32mr58900748pla.34.1560965394880; Wed, 19 Jun 2019 10:29:54 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:54 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 04/45] coresight: tmc-etf: Fix snapshot mode update function Date: Wed, 19 Jun 2019 11:29:08 -0600 Message-Id: <20190619172949.4522-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_102955_494141_B7EF65C0 X-CRM114-Status: GOOD ( 13.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 When working in snapshot mode function perf_aux_output_begin() does not set the handle->size because the size is expected to be deduced by the placement of the "head" and "old" pointers in user space. As such there is no point in trying to adjust the amount of data to copy to the ring buffer. Signed-off-by: Mathieu Poirier Reviewed-by: Leo Yan Reviewed-by: Suzuki K Poulose Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index d026bd04a6af..31d41e2ad955 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -477,9 +477,11 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, /* * The TMC RAM buffer may be bigger than the space available in the * perf ring buffer (handle->size). If so advance the RRP so that we - * get the latest trace data. + * get the latest trace data. In snapshot mode none of that matters + * since we are expected to clobber stale data in favour of the latest + * traces. */ - if (to_read > handle->size) { + if (!buf->snapshot && to_read > handle->size) { u32 mask = 0; /* From patchwork Wed Jun 19 17:29: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: 11004859 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 0DE3A1395 for ; Wed, 19 Jun 2019 17:31:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA90020223 for ; Wed, 19 Jun 2019 17:31:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB47C28515; Wed, 19 Jun 2019 17:31:37 +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 3900A20223 for ; Wed, 19 Jun 2019 17:31:37 +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=JBByjoYJtLuVu0ENVKyXlm1OB1KqjuOYdx/IWp5yd8c=; b=KWTIid9aLOgEfRWVZoE+Ne60i/ +RQKUgp7MIAokzrCXXXXdd00aqmsKX7UNSsT9xZD3/P5hsOVyJjVf2/X9sDaWo5UHcJur4sMG5pF+ K+n6E01KTHMrXZQmsM7T0PnT//8mwnbybXvicwO8Hi4fUIcFycvVd4+5ptE1kcZHsu3luiL5pmoTj NFOeuesVm2oOoK5J4bofmGb3e42h1BekY7Zy+t+8tcHwMI1dSoD49WWADD/JvzAqWeOC6PscjNbm5 qqWHPphr90oFdstu6Y5IUwWPjV6rPyfUDkxkfMrD3avrrvxH2TL2jRZJ0LEGTecV+dTfZGoDHr3Qm +eqClDFQ==; 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 1hdeQn-0000yS-FO; Wed, 19 Jun 2019 17:31:33 +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 1hdePE-00073e-Ia for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:29:58 +0000 Received: by mail-pl1-x644.google.com with SMTP id bh12so96589plb.4 for ; Wed, 19 Jun 2019 10:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g7AMxzETUjdQhAYV0qKHvB+BIVp8O1/Fn7xIZVqRJ+Q=; b=y1962C3eL4xm9Ks9S0Sgk0nA5KeFxYUg90Gfu4ziiZfMe6D6zFg+52XzwrdyZEwUnM +uIHegLtiMrJlExn44ULReSqjDXLV9/Lt1tWUE8Q/PBv0nWUFuP9LchByF5hnPmz/nlU jFoyYoX3wkXhizpMDdz6yPagTGtFI7k+dX4QOpOiN6ivmCJjdQltx+Zd0Y7BblLUm4XY EJY8pRVQ6MWQBltkg5yvqJB2NxmO8dgbqgr3sve//jBpyX7padtirTzuDkB87jorN+Ye CMaDUgpVmwV4NGPYUGCfd4AGg84vEZmY+Dsju0Z5T6/ylsmwNXzgXurADPY7b6SxlrDg 1EtQ== 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=g7AMxzETUjdQhAYV0qKHvB+BIVp8O1/Fn7xIZVqRJ+Q=; b=d6Qn4mU251jZhs7LYkGrnlqms8UH3h5UxBzOEx5/id02/rT8Vkl1Vif0EvyJBqznOZ IH9zfC/0Y8tvYHpoN4n2TzrIElyh/WSwVXkGqlD/tsI7mHlyPAV23kijLzgd70/P+t1o 9SwLGohodRSmiBFsn47UEOL1wQjyRMMZZNHIst5aUJDxT/bhoS10oUTjzap7/OkmMjdb vDyrjVd3lttCsfJWJYNznrmQOAIDX5SkugsL5eA9HhT2Mwt0obmeOB8Czhct2Zrr7KHL 6HWQepzAE0hOrz9owuYdgJH9Ir3r3gTUlQSSwg6lA9+zlQzl402VxMH8FHXKi45W6HJa LKgg== X-Gm-Message-State: APjAAAVe4Qo3uX3H1fX1IgKb/xC4m4QziMoPrUv1SbRUL7XLiPl0EGiS 0veBSjgNpJD8ZVpSx/eb8dvEe+Efkw9sBw== X-Google-Smtp-Source: APXvYqzUT5vlNPd4b/FSCo4mVNhX+uvg7icV06Cj95CunAiCCGxeBiBXf1mwFsbM9HUlNp95h1JWjA== X-Received: by 2002:a17:902:e582:: with SMTP id cl2mr105723202plb.60.1560965396104; Wed, 19 Jun 2019 10:29:56 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:55 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 05/45] coresight: perf: Don't set the truncated flag in snapshot mode Date: Wed, 19 Jun 2019 11:29:09 -0600 Message-Id: <20190619172949.4522-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_102956_628578_E9374251 X-CRM114-Status: GOOD ( 11.79 ) 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 This patch avoids setting the truncated flag when operating in snapshot mode since the trace buffer is expected to be truncated and discontinuous from one snapshot to another. Moreover when the truncated flag is set the perf core stops enabling the event, waiting for user space to consume the data. In snapshot mode this is clearly not what we want since it results in stale data. Signed-off-by: Mathieu Poirier Reviewed-by: Suzuki K Poulose Tested-by: Leo Yan --- drivers/hwtracing/coresight/coresight-etb10.c | 8 +++++++- drivers/hwtracing/coresight/coresight-tmc-etf.c | 8 +++++++- drivers/hwtracing/coresight/coresight-tmc-etr.c | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 60e753b1768d..516d67cd7759 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -512,7 +512,13 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, lost = true; } - if (lost) + /* + * Don't set the TRUNCATED flag in snapshot mode because 1) the + * captured buffer is expected to be truncated and 2) a full buffer + * prevents the event from being re-enabled by the perf core, + * resulting in stale data being send to user space. + */ + if (!buf->snapshot && lost) perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED); /* finally tell HW where we want to start reading from */ diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 31d41e2ad955..bd5f3b57eebd 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -518,7 +518,13 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, lost = true; } - if (lost) + /* + * Don't set the TRUNCATED flag in snapshot mode because 1) the + * captured buffer is expected to be truncated and 2) a full buffer + * prevents the event from being re-enabled by the perf core, + * resulting in stale data being send to user space. + */ + if (!buf->snapshot && lost) perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED); cur = buf->cur; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index cc8401c76c39..1fc3db8045e1 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1511,7 +1511,13 @@ tmc_update_etr_buffer(struct coresight_device *csdev, lost |= etr_buf->full; out: - if (lost) + /* + * Don't set the TRUNCATED flag in snapshot mode because 1) the + * captured buffer is expected to be truncated and 2) a full buffer + * prevents the event from being re-enabled by the perf core, + * resulting in stale data being send to user space. + */ + if (!etr_perf->snapshot && lost) perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED); return size; } From patchwork Wed Jun 19 17:29: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: 11004863 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 D5FEB1395 for ; Wed, 19 Jun 2019 17:32:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C14CD1FF40 for ; Wed, 19 Jun 2019 17:32:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5A4A22A68; Wed, 19 Jun 2019 17:32:23 +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 DC23A285FF for ; Wed, 19 Jun 2019 17:32:22 +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=JhAIHCKrVwKM4w+kXIcBVGW4S9qkgnkT9fsppXed1V4=; b=ry4EtQPnzmJmgHV89NyGq8Gx80 UrdUj0UiDMgwPmUgrditfv4X7gguJx84CsZwPzmxp3sUhIqhZQxaIt/O3nSPC7QLXXSbHCRpixMVV coHlABWvoxOJIqxWTkMa/NpJDfci3ZbdWzLisCeAiAJMUqN2CdVI6NNMvwfaXI0mt+kuotnxvyrrT a9dy+C/ao3XJymRKZWkiI4bVcL3T+VzavRvH4I1MXC2EwbZ/A8eBjH8W99n4ATjLpcAXym+VBf5Hv SVvFoAO8NpG30UV/xY0wgPzyP9B1IqTDB97O25JPIsBii4FnHPR5ftgkgw2WJAaXI0gVuQqVvyYDM FccBBXIw==; 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 1hdeRR-0001SX-CN; Wed, 19 Jun 2019 17:32:13 +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 1hdePF-00074w-Lp for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:29:59 +0000 Received: by mail-pl1-x643.google.com with SMTP id t7so80567plr.11 for ; Wed, 19 Jun 2019 10:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AgYewqbl8iSJQRrA3NRCvtvG59aXYoMecD7NpQO4c4M=; b=Mnb5DfKw9t5I4GT8GQd8zyP2p/jZpeYyEMsPLL++qR3PoJptYomk0tePj3MaEPXFn2 rPi+pDsoqORrp4Vyj5vI8uWkABh62YmGcQ9wBn9Bs//B3cmsajbvTa5rcsUBwuUm3ulv vV91hUiOwYla/M2Gmgpu9dIE7whTWQ6u9nKyxglpvySyosD1L4UO8+wNqnezcSuVPtnZ UrjfLYohn+60nlZiEx/ugixfPs00nlROTk93eBZcrPbUk/9peDQl2m4sQpGjyPPmHlkd WC83E//J1zVfd2aSEFXGSqs1RKHnIS+5m1ec0JHHJBZLBA+BNyusneibeCbqysCpohGn rlag== 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=AgYewqbl8iSJQRrA3NRCvtvG59aXYoMecD7NpQO4c4M=; b=AWJ4LrfvAdsqtcNm+6i+5O24r2Sy1Xx8uQAKCQcroIFUEmVgwqPsgEMgYy/Sz1Ehzv xJZ3VuROT4kf6jvQQT+r2TZLvidNJ2Pa2GlQlkkLOFeyGvth5esi7r6NU/Bu+q4xP2ZG NCkpQzxM5ozr3xCjQ8zwJar+8HZaA5s6d/KiWIN6yHwI2l4cJO2ISdIwj9VM2j1QWFXC OBqbp47grW89F7Aj0DaEZIqof2cGfX8xT8sqFdMBNTU7byXk1HGBQLeLuxjeo60q1BKe 2KMPzzG6S6wrcTfEDxHerCDFTUoVH5LHHg3v3/3oRsd9T78nt7B6suEg3QS5gDsS7e7S VIgA== X-Gm-Message-State: APjAAAUyXEvuhK9fBZa8DdzexxfFAKO9I+gQMdAUuPV/ydHHoSWAMgxG 7UvcKAAtKffX9rZjXmjMvXW4NgMuqIuOdA== X-Google-Smtp-Source: APXvYqx6VKCXT6TVD/0dK/+sgOUkYHjS5u79v5XhW/RfgZPyDElf185Pf4OdVcLUpon7X/gzI5HV4A== X-Received: by 2002:a17:902:7687:: with SMTP id m7mr38585711pll.310.1560965396915; Wed, 19 Jun 2019 10:29:56 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:56 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 06/45] coresight: funnel: Clean up device book keeping Date: Wed, 19 Jun 2019 11:29:10 -0600 Message-Id: <20190619172949.4522-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_102957_720928_1435E53A X-CRM114-Status: GOOD ( 14.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: Suzuki K Poulose In preparation to use a consistent device naming scheme, clean up the device link tracking in funnel driver. Use the "coresight" device instead of the "real" parent device for all internal purposes. All other requests (e.g, power management, DMA operations) must use the "real" device which is the parent device. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-funnel.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 16b0c0e1e43a..6236a847bb0b 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -32,14 +32,12 @@ /** * struct funnel_drvdata - specifics associated to a funnel component * @base: memory mapped base address for this component. - * @dev: the device entity associated to this component. * @atclk: optional clock for the core parts of the funnel. * @csdev: component vitals needed by the framework. * @priority: port selection order. */ struct funnel_drvdata { void __iomem *base; - struct device *dev; struct clk *atclk; struct coresight_device *csdev; unsigned long priority; @@ -80,7 +78,7 @@ static int funnel_enable(struct coresight_device *csdev, int inport, rc = dynamic_funnel_enable_hw(drvdata, inport); if (!rc) - dev_dbg(drvdata->dev, "FUNNEL inport %d enabled\n", inport); + dev_dbg(&csdev->dev, "FUNNEL inport %d enabled\n", inport); return rc; } @@ -110,7 +108,7 @@ static void funnel_disable(struct coresight_device *csdev, int inport, if (drvdata->base) dynamic_funnel_disable_hw(drvdata, inport); - dev_dbg(drvdata->dev, "FUNNEL inport %d disabled\n", inport); + dev_dbg(&csdev->dev, "FUNNEL inport %d disabled\n", inport); } static const struct coresight_ops_link funnel_link_ops = { @@ -165,11 +163,11 @@ static ssize_t funnel_ctrl_show(struct device *dev, u32 val; struct funnel_drvdata *drvdata = dev_get_drvdata(dev->parent); - pm_runtime_get_sync(drvdata->dev); + pm_runtime_get_sync(dev->parent); val = get_funnel_ctrl_hw(drvdata); - pm_runtime_put(drvdata->dev); + pm_runtime_put(dev->parent); return sprintf(buf, "%#x\n", val); } @@ -205,7 +203,6 @@ static int funnel_probe(struct device *dev, struct resource *res) if (!drvdata) return -ENOMEM; - drvdata->dev = dev; drvdata->atclk = devm_clk_get(dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); From patchwork Wed Jun 19 17:29: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: 11004865 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 61A2F1395 for ; Wed, 19 Jun 2019 17:32:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC0120223 for ; Wed, 19 Jun 2019 17:32:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FE29285BE; Wed, 19 Jun 2019 17:32:39 +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 5692128515 for ; Wed, 19 Jun 2019 17:32:38 +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=tuUCai124IWtJ236/9mmYo5SgCs+cmk1DeNChdDkTZc=; b=T3Y0Zz9MyZiLNicyH8rC54gLWw D6lkKUdAe4HYadnAlcweBD35UU7BzO9plTsqHHJoBnNT4rAvqr9GnR2Om0OTXFukIWr3X1uuCdXRC ZtRo9qgspD5ZsvsvFYaGCRCbsz4/VopoU+ZSgSGWXD+cOrrI0J9vpc7qrUavuZgGYv6Ktn9lX7qjP HfZqUQeETuOt/Dm0IORo0pY5ZnumAsL8q6Z+Odn/LxkQ0m+P2YNfPFf0KIPQMAadmJbB28FgrFwkn 1fOljxXCtttfR9Xc58lRqzHQFiBYSfmMQ0ShlR7RQFLWln+bNLcRyzlgnLIkFGxlN0EU3Pqvx7FZn 4CkQOQNA==; 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 1hdeRo-0001jk-Un; Wed, 19 Jun 2019 17:32:36 +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 1hdePG-00075u-HR for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:00 +0000 Received: by mail-pl1-x644.google.com with SMTP id bi6so78480plb.12 for ; Wed, 19 Jun 2019 10:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DThV8U7/6lnQCq1brl48bQF0wGungTqjO3Krt6EpRiA=; b=RhyWi9l+o7wI5kCTCaRehz+yAK2h424fzerS8WhKkd5a7lQx5pqMqPNPInZVJuIfRe hBVoiJ9WgYmyeD0uW+dUUwugoWyPIRIw7e8zusF+PnQmz1e+6YUWtrcjvdz2e1Z3KX6L D9H6GLWmG2i3zmMl8amG3lvSEsEt3wi8sCJw6J3hQT0oN+IBsp4Hg22dLOwzJ9owTOIp imJ09vqJOTfxkjVgIAMTJZVcvJHHE6Bqdt6D9DPZZVOKDf5v7gYSDTNvpeDi+AatqBec TGBfKmscz/8UtOptSijJzti6dzWt6RB43u5+73KvzK3F0+R/5WgdqTlHjqHijliUIYzn rs9A== 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=DThV8U7/6lnQCq1brl48bQF0wGungTqjO3Krt6EpRiA=; b=oFo/zEOADLcWIUavNfN01ob1gnua5a2nM0wQev8EBZRNsLskn2MYH77CelDs+0K4f4 HBxDihNdgIU/rky6BkV87En8lDoG6B2JH3+z7UY0MDY+L+h7TW9srR/uL7L553bmKYbm vasqu3HyUJV60Trehrvy2nAR++Hs81lhCVMr7QvG01k5wmsZi05tfeVOxS0MCZLoQmE9 CiQK4Ao8bFkXIhEFNq3EvmbZzLP6NMxEYKRP3vHnnNnvUP3Xk6x0q4NHqgpADolQr1Pn dNIK2KGUkWtboKS4txBoFSyKuJIT9C87Qn5q4BjunnEK5OQvI54ZIRgVuV0QIHsjj6Km 8sQA== X-Gm-Message-State: APjAAAXlyCcfuO8D+jaZ7Iw6Pgc3oqplMvWtr4HXsADb6feOQHiVjqpQ D6KKGstHDyFK8GaKWcTIsPMFUg== X-Google-Smtp-Source: APXvYqwtiLzdAwA7+IaOCZ5aYz0L7FZAypRW8ANASPO5Dbk3vF6DUcRCRXnVjYIJviprg3H1gQJwkQ== X-Received: by 2002:a17:902:24c:: with SMTP id 70mr119602547plc.2.1560965397883; Wed, 19 Jun 2019 10:29:57 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:57 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 07/45] coresight: replicator: Cleanup device tracking Date: Wed, 19 Jun 2019 11:29:11 -0600 Message-Id: <20190619172949.4522-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_102958_652637_6FE4DC1E X-CRM114-Status: GOOD ( 15.58 ) 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 In preparation to use a consistent device naming scheme, clean up the device link tracking in replicator driver. Use the "coresight" device instead of the "real" parent device for all internal purposes. All other requests (e.g, power management, DMA operations) must use the "real" device which is the parent device. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-replicator.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index 8c9ce74498e1..ee6ad34061a5 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -26,13 +26,11 @@ * struct replicator_drvdata - specifics associated to a replicator component * @base: memory mapped base address for this component. Also indicates * whether this one is programmable or not. - * @dev: the device entity associated with this component * @atclk: optional clock for the core parts of the replicator. * @csdev: component vitals needed by the framework */ struct replicator_drvdata { void __iomem *base; - struct device *dev; struct clk *atclk; struct coresight_device *csdev; }; @@ -100,7 +98,7 @@ static int replicator_enable(struct coresight_device *csdev, int inport, if (drvdata->base) rc = dynamic_replicator_enable(drvdata, inport, outport); if (!rc) - dev_dbg(drvdata->dev, "REPLICATOR enabled\n"); + dev_dbg(&csdev->dev, "REPLICATOR enabled\n"); return rc; } @@ -139,7 +137,7 @@ static void replicator_disable(struct coresight_device *csdev, int inport, if (drvdata->base) dynamic_replicator_disable(drvdata, inport, outport); - dev_dbg(drvdata->dev, "REPLICATOR disabled\n"); + dev_dbg(&csdev->dev, "REPLICATOR disabled\n"); } static const struct coresight_ops_link replicator_link_ops = { @@ -196,7 +194,6 @@ static int replicator_probe(struct device *dev, struct resource *res) if (!drvdata) return -ENOMEM; - drvdata->dev = dev; drvdata->atclk = devm_clk_get(dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); From patchwork Wed Jun 19 17:29: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: 11004869 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 B01A11395 for ; Wed, 19 Jun 2019 17:33:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99495285D2 for ; Wed, 19 Jun 2019 17:33:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D8DC285F0; Wed, 19 Jun 2019 17:33: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 8C850285EA for ; Wed, 19 Jun 2019 17:33:26 +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=ZCrgglx9vP9pbvXGTEPXhxMK7NdDNeGXuNgUqVfTUlM=; b=N0XNOMSSUmCdL6GzIOcuLrA34D KDWhpHZRY/xYcDYtyNtuQR24kyJ4rfeELct7fuoqZET4Dx84vsrEWtVYbKhFKMHjRnwXZugndaz8p 3QtnwyFbfqLz90uscQPWnd3RbhuwaVm1Z1bGy2XSivExLw7coVZA6rJn1bBXFDO12YLNoQ+GhEhOc i/azO7bJNg9/OyleUDDbGLAE5hNTQFKKGz0wvU6In5moFcY0pK/rXIJQGufUoOf/oy2rkLTpLwTlZ 3tuUjlp669Lcvt3Y4XpwxflTMMHDJi3opUfV8PPDyWkxukKAW0qaMGlvpGEjHkJJi84tf5ZdfI3WD L0mMWWJg==; 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 1hdeSW-0002F5-Bc; Wed, 19 Jun 2019 17:33:20 +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 1hdePI-000779-1V for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:03 +0000 Received: by mail-pf1-x444.google.com with SMTP id a186so5597pfa.5 for ; Wed, 19 Jun 2019 10:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F7Cq2lI0n7+SPPwtsXL0SImUek6kVLEGw5hWBqCNIpc=; b=TMLYhRolfuzAa2mZ2nuQ5MFFsnveRreMcd/KUfHqzPw8i7V02RbFsu5XA5asSiMm83 hkEiPaAh2xVVq0wgkRD+yUUlGj05nm2ZZ6Ahwl3jS/sQtIJK69J0tTeoV8iGib2+cJFg C5pQ+CgWUeTh2TqDCl6Pe+356g2kXCBPliGy/tjF6BLGOietmec2FlPm8kig/9ltDLHC CG5A4cit61jCTyjzQuA8yhTJo/lNYnNQPfhawaPADnBwBAsobztddPQdSkmQuCsBJ2s3 Xs7Uw3d6Cd8NIiVSs/04KEcYnIYo7J5adghr24wkqTVMvqsEotp0lJ5g8hQakpH1WQVV uoWw== 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=F7Cq2lI0n7+SPPwtsXL0SImUek6kVLEGw5hWBqCNIpc=; b=DWu84K2toJ+/XeF7Qt9uIJky7urXcA5MNIp8aOTNMbIjiyMXqq23Ip+5fo3ewQlHv9 keWJ9zxlsXIVTGc5LV5n68LCN34HBJq3Qa3M2Bf8pzzpq3BFbQO+KFRST4A2KstUZ6uu 9JfszRQ/198Q+jukPgh9YawrQEmxE4sXFPPUzPm36AuceyuEN+ACZr+B2EiVjcdOWto4 WcGKmgtpavUwxUFakuenacT2XlP/P3SS3U0wk/zW7qcYWSs4bWzMlbI0KZj65d264FpF WYi+NUFWy4oSOGPhzUNgm2CMoSlNq7dP42gDrm7GxWjrCXQB/dbhX/nfz99XSCz6t3+g UZrw== X-Gm-Message-State: APjAAAX0rSwJcukPap6v0YlM2ufeQVwORZ9dEhM6+cuA5wS+Ob4GBFw8 k6GIkp28kb14YVAoVJOKTzedHA== X-Google-Smtp-Source: APXvYqwdceg7kVIeW8CwuHllImxj7SsPFybiHAxvhXCx0l7e3c+DF8PZDjATw1KOoux2g3PsoV3EnQ== X-Received: by 2002:a63:6241:: with SMTP id w62mr3413760pgb.401.1560965399015; Wed, 19 Jun 2019 10:29:59 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:58 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 08/45] coresight: tmc: Clean up device specific data Date: Wed, 19 Jun 2019 11:29:12 -0600 Message-Id: <20190619172949.4522-9-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103000_276635_45A29C0C X-CRM114-Status: GOOD ( 20.21 ) 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 In preparation to use a consistent device naming scheme, clean up the device link tracking in replicator driver. Use the "coresight" device instead of the "real" parent device for all internal purposes. All other requests (e.g, power management, DMA operations) must use the "real" device which is the parent device. Since the CATU driver also uses the TMC-SG infrastructure, update the callers to ensure they pass the appropriate device argument for the tables. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-catu.c | 5 +-- .../hwtracing/coresight/coresight-tmc-etf.c | 9 ++--- .../hwtracing/coresight/coresight-tmc-etr.c | 40 +++++++++++-------- drivers/hwtracing/coresight/coresight-tmc.c | 38 +++++++++--------- drivers/hwtracing/coresight/coresight-tmc.h | 2 - 5 files changed, 47 insertions(+), 47 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index 4ea68a3522e9..d948a72aa6a3 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -328,19 +328,18 @@ static int catu_alloc_etr_buf(struct tmc_drvdata *tmc_drvdata, struct etr_buf *etr_buf, int node, void **pages) { struct coresight_device *csdev; - struct device *catu_dev; struct tmc_sg_table *catu_table; struct catu_etr_buf *catu_buf; csdev = tmc_etr_get_catu_device(tmc_drvdata); if (!csdev) return -ENODEV; - catu_dev = csdev->dev.parent; catu_buf = kzalloc(sizeof(*catu_buf), GFP_KERNEL); if (!catu_buf) return -ENOMEM; - catu_table = catu_init_sg_table(catu_dev, node, etr_buf->size, pages); + catu_table = catu_init_sg_table(&csdev->dev, node, + etr_buf->size, pages); if (IS_ERR(catu_table)) { kfree(catu_buf); return PTR_ERR(catu_table); diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index bd5f3b57eebd..b89e29c5b39d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -280,7 +280,6 @@ static int tmc_enable_etf_sink(struct coresight_device *csdev, u32 mode, void *data) { int ret; - struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); switch (mode) { case CS_MODE_SYSFS: @@ -298,7 +297,7 @@ static int tmc_enable_etf_sink(struct coresight_device *csdev, if (ret) return ret; - dev_dbg(drvdata->dev, "TMC-ETB/ETF enabled\n"); + dev_dbg(&csdev->dev, "TMC-ETB/ETF enabled\n"); return 0; } @@ -328,7 +327,7 @@ static int tmc_disable_etf_sink(struct coresight_device *csdev) spin_unlock_irqrestore(&drvdata->spinlock, flags); - dev_dbg(drvdata->dev, "TMC-ETB/ETF disabled\n"); + dev_dbg(&csdev->dev, "TMC-ETB/ETF disabled\n"); return 0; } @@ -351,7 +350,7 @@ static int tmc_enable_etf_link(struct coresight_device *csdev, spin_unlock_irqrestore(&drvdata->spinlock, flags); if (!ret) - dev_dbg(drvdata->dev, "TMC-ETF enabled\n"); + dev_dbg(&csdev->dev, "TMC-ETF enabled\n"); return ret; } @@ -371,7 +370,7 @@ static void tmc_disable_etf_link(struct coresight_device *csdev, drvdata->mode = CS_MODE_DISABLED; spin_unlock_irqrestore(&drvdata->spinlock, flags); - dev_dbg(drvdata->dev, "TMC-ETF disabled\n"); + dev_dbg(&csdev->dev, "TMC-ETF disabled\n"); } static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 1fc3db8045e1..709448cf2dff 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -162,10 +162,11 @@ static void tmc_pages_free(struct tmc_pages *tmc_pages, struct device *dev, enum dma_data_direction dir) { int i; + struct device *real_dev = dev->parent; for (i = 0; i < tmc_pages->nr_pages; i++) { if (tmc_pages->daddrs && tmc_pages->daddrs[i]) - dma_unmap_page(dev, tmc_pages->daddrs[i], + dma_unmap_page(real_dev, tmc_pages->daddrs[i], PAGE_SIZE, dir); if (tmc_pages->pages && tmc_pages->pages[i]) __free_page(tmc_pages->pages[i]); @@ -193,6 +194,7 @@ static int tmc_pages_alloc(struct tmc_pages *tmc_pages, int i, nr_pages; dma_addr_t paddr; struct page *page; + struct device *real_dev = dev->parent; nr_pages = tmc_pages->nr_pages; tmc_pages->daddrs = kcalloc(nr_pages, sizeof(*tmc_pages->daddrs), @@ -216,8 +218,8 @@ static int tmc_pages_alloc(struct tmc_pages *tmc_pages, page = alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0); } - paddr = dma_map_page(dev, page, 0, PAGE_SIZE, dir); - if (dma_mapping_error(dev, paddr)) + paddr = dma_map_page(real_dev, page, 0, PAGE_SIZE, dir); + if (dma_mapping_error(real_dev, paddr)) goto err; tmc_pages->daddrs[i] = paddr; tmc_pages->pages[i] = page; @@ -304,7 +306,7 @@ static int tmc_alloc_data_pages(struct tmc_sg_table *sg_table, void **pages) * and data buffers. TMC writes to the data buffers and reads from the SG * Table pages. * - * @dev - Device to which page should be DMA mapped. + * @dev - Coresight device to which page should be DMA mapped. * @node - Numa node for mem allocations * @nr_tpages - Number of pages for the table entries. * @nr_dpages - Number of pages for Data buffer. @@ -348,13 +350,13 @@ void tmc_sg_table_sync_data_range(struct tmc_sg_table *table, { int i, index, start; int npages = DIV_ROUND_UP(size, PAGE_SIZE); - struct device *dev = table->dev; + struct device *real_dev = table->dev->parent; struct tmc_pages *data = &table->data_pages; start = offset >> PAGE_SHIFT; for (i = start; i < (start + npages); i++) { index = i % data->nr_pages; - dma_sync_single_for_cpu(dev, data->daddrs[index], + dma_sync_single_for_cpu(real_dev, data->daddrs[index], PAGE_SIZE, DMA_FROM_DEVICE); } } @@ -363,11 +365,11 @@ void tmc_sg_table_sync_data_range(struct tmc_sg_table *table, void tmc_sg_table_sync_table(struct tmc_sg_table *sg_table) { int i; - struct device *dev = sg_table->dev; + struct device *real_dev = sg_table->dev->parent; struct tmc_pages *table_pages = &sg_table->table_pages; for (i = 0; i < table_pages->nr_pages; i++) - dma_sync_single_for_device(dev, table_pages->daddrs[i], + dma_sync_single_for_device(real_dev, table_pages->daddrs[i], PAGE_SIZE, DMA_TO_DEVICE); } @@ -590,6 +592,7 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata, void **pages) { struct etr_flat_buf *flat_buf; + struct device *real_dev = drvdata->csdev->dev.parent; /* We cannot reuse existing pages for flat buf */ if (pages) @@ -599,7 +602,7 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata, if (!flat_buf) return -ENOMEM; - flat_buf->vaddr = dma_alloc_coherent(drvdata->dev, etr_buf->size, + flat_buf->vaddr = dma_alloc_coherent(real_dev, etr_buf->size, &flat_buf->daddr, GFP_KERNEL); if (!flat_buf->vaddr) { kfree(flat_buf); @@ -607,7 +610,7 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata, } flat_buf->size = etr_buf->size; - flat_buf->dev = drvdata->dev; + flat_buf->dev = &drvdata->csdev->dev; etr_buf->hwaddr = flat_buf->daddr; etr_buf->mode = ETR_MODE_FLAT; etr_buf->private = flat_buf; @@ -617,9 +620,10 @@ 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) - dma_free_coherent(flat_buf->dev, flat_buf->size, + dma_free_coherent(real_dev, flat_buf->size, flat_buf->vaddr, flat_buf->daddr); kfree(flat_buf); } @@ -666,8 +670,9 @@ static int tmc_etr_alloc_sg_buf(struct tmc_drvdata *drvdata, void **pages) { struct etr_sg_table *etr_table; + struct device *dev = &drvdata->csdev->dev; - etr_table = tmc_init_etr_sg_table(drvdata->dev, node, + etr_table = tmc_init_etr_sg_table(dev, node, etr_buf->size, pages); if (IS_ERR(etr_table)) return -ENOMEM; @@ -823,9 +828,10 @@ static struct etr_buf *tmc_alloc_etr_buf(struct tmc_drvdata *drvdata, bool has_etr_sg, has_iommu; bool has_sg, has_catu; struct etr_buf *etr_buf; + struct device *dev = &drvdata->csdev->dev; has_etr_sg = tmc_etr_has_cap(drvdata, TMC_ETR_SG); - has_iommu = iommu_get_domain_for_dev(drvdata->dev); + has_iommu = iommu_get_domain_for_dev(dev->parent); has_catu = !!tmc_etr_get_catu_device(drvdata); has_sg = has_catu || has_etr_sg; @@ -863,7 +869,7 @@ static struct etr_buf *tmc_alloc_etr_buf(struct tmc_drvdata *drvdata, return ERR_PTR(rc); } - dev_dbg(drvdata->dev, "allocated buffer of size %ldKB in mode %d\n", + dev_dbg(dev, "allocated buffer of size %ldKB in mode %d\n", (unsigned long)size >> 10, etr_buf->mode); return etr_buf; } @@ -1162,7 +1168,7 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev) tmc_etr_free_sysfs_buf(free_buf); if (!ret) - dev_dbg(drvdata->dev, "TMC-ETR enabled\n"); + dev_dbg(&csdev->dev, "TMC-ETR enabled\n"); return ret; } @@ -1358,7 +1364,7 @@ static void *tmc_alloc_etr_buffer(struct coresight_device *csdev, etr_perf = tmc_etr_setup_perf_buf(drvdata, event, nr_pages, pages, snapshot); if (IS_ERR(etr_perf)) { - dev_dbg(drvdata->dev, "Unable to allocate ETR buffer\n"); + dev_dbg(&csdev->dev, "Unable to allocate ETR buffer\n"); return NULL; } @@ -1617,7 +1623,7 @@ static int tmc_disable_etr_sink(struct coresight_device *csdev) spin_unlock_irqrestore(&drvdata->spinlock, flags); - dev_dbg(drvdata->dev, "TMC-ETR disabled\n"); + dev_dbg(&csdev->dev, "TMC-ETR disabled\n"); return 0; } diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 3f718729d741..3b39f43c583d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -32,7 +32,7 @@ void tmc_wait_for_tmcready(struct tmc_drvdata *drvdata) /* Ensure formatter, unformatter and hardware fifo are empty */ if (coresight_timeout(drvdata->base, TMC_STS, TMC_STS_TMCREADY_BIT, 1)) { - dev_err(drvdata->dev, + dev_err(&drvdata->csdev->dev, "timeout while waiting for TMC to be Ready\n"); } } @@ -49,7 +49,7 @@ void tmc_flush_and_stop(struct tmc_drvdata *drvdata) /* Ensure flush completes */ if (coresight_timeout(drvdata->base, TMC_FFCR, TMC_FFCR_FLUSHMAN_BIT, 0)) { - dev_err(drvdata->dev, + dev_err(&drvdata->csdev->dev, "timeout while waiting for completion of Manual Flush\n"); } @@ -83,7 +83,7 @@ static int tmc_read_prepare(struct tmc_drvdata *drvdata) } if (!ret) - dev_dbg(drvdata->dev, "TMC read start\n"); + dev_dbg(&drvdata->csdev->dev, "TMC read start\n"); return ret; } @@ -105,7 +105,7 @@ static int tmc_read_unprepare(struct tmc_drvdata *drvdata) } if (!ret) - dev_dbg(drvdata->dev, "TMC read end\n"); + dev_dbg(&drvdata->csdev->dev, "TMC read end\n"); return ret; } @@ -122,7 +122,7 @@ static int tmc_open(struct inode *inode, struct file *file) nonseekable_open(inode, file); - dev_dbg(drvdata->dev, "%s: successfully opened\n", __func__); + dev_dbg(&drvdata->csdev->dev, "%s: successfully opened\n", __func__); return 0; } @@ -152,12 +152,13 @@ static ssize_t tmc_read(struct file *file, char __user *data, size_t len, return 0; if (copy_to_user(data, bufp, actual)) { - dev_dbg(drvdata->dev, "%s: copy_to_user failed\n", __func__); + dev_dbg(&drvdata->csdev->dev, + "%s: copy_to_user failed\n", __func__); return -EFAULT; } *ppos += actual; - dev_dbg(drvdata->dev, "%zu bytes copied\n", actual); + dev_dbg(&drvdata->csdev->dev, "%zu bytes copied\n", actual); return actual; } @@ -172,7 +173,7 @@ static int tmc_release(struct inode *inode, struct file *file) if (ret) return ret; - dev_dbg(drvdata->dev, "%s: released\n", __func__); + dev_dbg(&drvdata->csdev->dev, "%s: released\n", __func__); return 0; } @@ -332,24 +333,22 @@ const struct attribute_group *coresight_tmc_groups[] = { NULL, }; -static inline bool tmc_etr_can_use_sg(struct tmc_drvdata *drvdata) +static inline bool tmc_etr_can_use_sg(struct device *dev) { - return fwnode_property_present(drvdata->dev->fwnode, - "arm,scatter-gather"); + return fwnode_property_present(dev->fwnode, "arm,scatter-gather"); } /* Detect and initialise the capabilities of a TMC ETR */ -static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata, - u32 devid, void *dev_caps) +static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps) { int rc; - u32 dma_mask = 0; + struct tmc_drvdata *drvdata = dev_get_drvdata(parent); /* Set the unadvertised capabilities */ tmc_etr_init_caps(drvdata, (u32)(unsigned long)dev_caps); - if (!(devid & TMC_DEVID_NOSCAT) && tmc_etr_can_use_sg(drvdata)) + if (!(devid & TMC_DEVID_NOSCAT) && tmc_etr_can_use_sg(parent)) tmc_etr_set_cap(drvdata, TMC_ETR_SG); /* Check if the AXI address width is available */ @@ -367,15 +366,15 @@ static int tmc_etr_setup_caps(struct tmc_drvdata *drvdata, case 44: case 48: case 52: - dev_info(drvdata->dev, "Detected dma mask %dbits\n", dma_mask); + dev_info(parent, "Detected dma mask %dbits\n", dma_mask); break; default: dma_mask = 40; } - rc = dma_set_mask_and_coherent(drvdata->dev, DMA_BIT_MASK(dma_mask)); + rc = dma_set_mask_and_coherent(parent, DMA_BIT_MASK(dma_mask)); if (rc) - dev_err(drvdata->dev, "Failed to setup DMA mask: %d\n", rc); + dev_err(parent, "Failed to setup DMA mask: %d\n", rc); return rc; } @@ -405,7 +404,6 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) goto out; - drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ @@ -450,7 +448,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) desc.type = CORESIGHT_DEV_TYPE_SINK; desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_BUFFER; desc.ops = &tmc_etr_cs_ops; - ret = tmc_etr_setup_caps(drvdata, devid, + ret = tmc_etr_setup_caps(dev, devid, coresight_get_uci_data(id)); if (ret) goto out; diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 503f1b3a3741..1ed50411cc3c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -161,7 +161,6 @@ struct etr_buf { /** * struct tmc_drvdata - specifics associated to an TMC component * @base: memory mapped base address for this component. - * @dev: the device entity associated to this component. * @csdev: component vitals needed by the framework. * @miscdev: specifics to handle "/dev/xyz.tmc" entry. * @spinlock: only one at a time pls. @@ -184,7 +183,6 @@ struct etr_buf { */ struct tmc_drvdata { void __iomem *base; - struct device *dev; struct coresight_device *csdev; struct miscdevice miscdev; spinlock_t spinlock; From patchwork Wed Jun 19 17:29: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: 11004867 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 2614213AF for ; Wed, 19 Jun 2019 17:32:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 113F8285EA for ; Wed, 19 Jun 2019 17:32:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0574B285FF; Wed, 19 Jun 2019 17:32:58 +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 967EF285EA for ; Wed, 19 Jun 2019 17:32: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=uLEZNd3dpcfHhQJT7FbQ80y6uVig4un0hq3VxFKxj8Q=; b=qXXMPwFVcreoYSsyTqGMgZvh6t ZTF18MVKwssA1KYBGIGoqctrmLrxFXXOYXOxqXnhvzscw8D9pe8bD46+7AWL/KelSl09GtoSsfB21 8ZXCbxWEDKqAQxjW/iLVcfBr4nDimHUUDuE3CtU3E0LbyQeJnpal2SB6oyywjeMaUfGpyU9694XPv YaZ+qLmgeztbAqY7VxwBD0GWzXtpqXLkiH+qZy0DEdyh7ads6kE6mSX649Ap8UKtKQdS3dy6OCCgo we1UMz/0sL8PxZPJlHzjMTklRexHytdWl30QgUNx+D8O+l1pcjosi7FIRxlZZ+XJ/uDyilp/RFzzZ JF7bR0QA==; 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 1hdeS8-00020a-VC; Wed, 19 Jun 2019 17:32:56 +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 1hdePI-00078P-Ub for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:02 +0000 Received: by mail-pf1-x444.google.com with SMTP id m30so10158289pff.8 for ; Wed, 19 Jun 2019 10:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0wsJZXo9A14FgE/m5MQDcxOKCwD8FwUJ59OhI9p4wbc=; b=uSuk7FT94w5mdtgT0LCcJsrRUSiksk7CTFHdvKqho/DSuxnTqoKm50P52npIFiAhJT CKlRVZKp4yWKQ2Ew8IEwpREbkWxOjBRPDlLHCp0JPGKKLGMaNq7hE9j6YOiptIEkCjzd hCn1yAB9IXG7cXJ/tdEesJJ+kL7/+r7ClxFTO6X0skvmh/zVRLD5fsxu4P/OYIRhAEzA oZHhBR++FCRzSnuDh9MBw2fzNGkw0b8bPlEUl4EeI1yv7CaQ6HpJQfbjIuVksKwD5SP0 VTgfVhIKHmglTDmzph7kavKbZaG049/4Cg/f59xgSg21q7QXaNzdyPKURhJugzVWbDSJ Pshg== 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=0wsJZXo9A14FgE/m5MQDcxOKCwD8FwUJ59OhI9p4wbc=; b=A6JOnjqG3r5BicwLZUzpKf2+FcexDqQdtfm2NFn7WcV3lYhie/jAUAVxqtV66bawK0 t/S6mfs3oBzUkXWxRyCIE63BkEEnkoBMp8JOqMhAM45rtHvWmI/l8FSqaZyEJ6kIO8yo xeJ1gHH2PdecpkWyfEHDdJrWrAArTURfmBCtLyHcFnpx6W/ib6GUCKwI00/rDVgJ/Zlw yOFfG+7u+FIwWOkrvXC0+wDAd2YgzOV7wEjJeYw6e5DKsyBG7dr+WuhDdGqlYnK7uHQG z3DfecK4gGJ128j9OfVWu42WgxpQiR16OcHQAnnTPc8WVkRsPrRtEuF7I0tz9isL3YsW 9cdQ== X-Gm-Message-State: APjAAAVj6gmrDrlf/XhQI/T6IlhgZ+K61gUXvJjUh1aAIHKMuY7gYQp4 4wIcF9ZmrZCmwXKHcWWIZU1GSw== X-Google-Smtp-Source: APXvYqzZrqE8kycjjUeWiySvzYw8XMuIQ+uVWIE06DJ9i4K05OSyU0HircWVQiF8/B4+iBTfLZO/7A== X-Received: by 2002:a65:63c3:: with SMTP id n3mr8653125pgv.139.1560965400132; Wed, 19 Jun 2019 10:30:00 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.29.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:29:59 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 09/45] coresight: catu: Cleanup device specific data Date: Wed, 19 Jun 2019 11:29:13 -0600 Message-Id: <20190619172949.4522-10-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103001_037476_1B567EC9 X-CRM114-Status: GOOD ( 13.33 ) 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 Switch to using the CoreSight device instead of the real amba device. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-catu.c | 13 +++++++------ drivers/hwtracing/coresight/coresight-catu.h | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index d948a72aa6a3..63109c98765c 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -408,13 +408,14 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, void *data) int rc; u32 control, mode; struct etr_buf *etr_buf = data; + struct device *dev = &drvdata->csdev->dev; if (catu_wait_for_ready(drvdata)) - dev_warn(drvdata->dev, "Timeout while waiting for READY\n"); + dev_warn(dev, "Timeout while waiting for READY\n"); control = catu_read_control(drvdata); if (control & BIT(CATU_CONTROL_ENABLE)) { - dev_warn(drvdata->dev, "CATU is already enabled\n"); + dev_warn(dev, "CATU is already enabled\n"); return -EBUSY; } @@ -440,7 +441,7 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, void *data) catu_write_irqen(drvdata, 0); catu_write_mode(drvdata, mode); catu_write_control(drvdata, control); - dev_dbg(drvdata->dev, "Enabled in %s mode\n", + dev_dbg(dev, "Enabled in %s mode\n", (mode == CATU_MODE_PASS_THROUGH) ? "Pass through" : "Translate"); @@ -461,15 +462,16 @@ static int catu_enable(struct coresight_device *csdev, void *data) static int catu_disable_hw(struct catu_drvdata *drvdata) { int rc = 0; + struct device *dev = &drvdata->csdev->dev; catu_write_control(drvdata, 0); coresight_disclaim_device_unlocked(drvdata->base); if (catu_wait_for_ready(drvdata)) { - dev_info(drvdata->dev, "Timeout while waiting for READY\n"); + dev_info(dev, "Timeout while waiting for READY\n"); rc = -EAGAIN; } - dev_dbg(drvdata->dev, "Disabled\n"); + dev_dbg(dev, "Disabled\n"); return rc; } @@ -519,7 +521,6 @@ static int catu_probe(struct amba_device *adev, const struct amba_id *id) goto out; } - drvdata->dev = dev; dev_set_drvdata(dev, drvdata); base = devm_ioremap_resource(dev, &adev->res); if (IS_ERR(base)) { diff --git a/drivers/hwtracing/coresight/coresight-catu.h b/drivers/hwtracing/coresight/coresight-catu.h index 1d2ad183fd92..80ceee3c739c 100644 --- a/drivers/hwtracing/coresight/coresight-catu.h +++ b/drivers/hwtracing/coresight/coresight-catu.h @@ -61,7 +61,6 @@ #define CATU_IRQEN_OFF 0x0 struct catu_drvdata { - struct device *dev; void __iomem *base; struct coresight_device *csdev; int irq; From patchwork Wed Jun 19 17:29: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: 11004871 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 B71451395 for ; Wed, 19 Jun 2019 17:33:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A299528329 for ; Wed, 19 Jun 2019 17:33:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F619285E2; Wed, 19 Jun 2019 17:33:38 +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 2EB8A285E1 for ; Wed, 19 Jun 2019 17:33:38 +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=T0iRhbSwxffPqHiTWCgZdQeA34riDlP1IWk43PVncfY=; b=D5s4jaymxcfkLPImstoefqFLoF +TWuW2pbeLNL1aSw3sy3oKbx9zSYGP1WeXIehFjrdLUnX4uK46fxFef7d0xS7hx2q+KJVT/oq82Bo Gywdo38tDDPAlB3/idltcpio5EaI0bQtrCOe03xTdBOQYMZ/DR+alNElN9oihW48/A73ZqUgOifWu ZrslwW16bjKzNbC50Zzmnq5OtV+zIIBn5T+dK0skDmaUgWRuweue5Yu3LxYfiLeP19vvcOKblJvBs FiIdDORbB6AZEhgmz9qmctZ2zOtY2KltQjSx9EOySDEmtjIGDA/QfLjRFoT0bfbR69DIjogZZbsMd 9eOkMBGw==; 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 1hdeSm-0002Ut-Mk; Wed, 19 Jun 2019 17:33:36 +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 1hdePK-00079Q-Ej for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:04 +0000 Received: by mail-pl1-x643.google.com with SMTP id bi6so78541plb.12 for ; Wed, 19 Jun 2019 10:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Wz7fvVs2eik72LBKTLRReCkmyi964JSVLfODR2C9W48=; b=MKsGjOMowuaChmnzliPs4i1ecoFGnYFNTf2NI96TPsKQKJBP9pv7HN6iQ021021jea GZHneNSCNxXk5SJkiI8MJJp6FMGQZagbxgAyDTkM2C6ohyIqnlk3f+5GGoSPK752mhC9 FMfVTP303t4wvWIwMEmeT8NBHI6+wgxr6UDCGpaKN6l5h/UN/XvUE1nS2AcQVLIX2T2b MWS1tYnw9HDM8NeM1K0Z/vsCDz7Y+aLeuZpEPv9bMwT/rlhz6HhgsAaSgCpF9niUFXse hBXPwoiAJMPLGM2mzdzHWiwYpgZrl6oRDwRXbVxMoz6OOJh+gw5qyqM38mRpb04bcDt9 GlrQ== 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=Wz7fvVs2eik72LBKTLRReCkmyi964JSVLfODR2C9W48=; b=T7PiDhkCkPt6VEfvHMkXC+eyDuJILv3ocld5xaeUyuKV+YLNV1pV3ebNwtUcOmpxH3 X2qnHWla0acaeL7DuhCsQRWAoeKw6cwPoph9M6KeUoUpDGFlP3prSCx8rTeEzm038b0q cxXwy4Sbx9gNteFdb6cM8j0PrZ9KaE+F6L1sDsrAAn2cOnk3tqPVMErd+Eo0mGj43vy6 +4UBxRS24X0TaTT47iwiAZgTM1FK+1txw5XmmH9AWYUfs2IcVde7TQyAl6He/Dd1MBfM ljB631gID3eGsJl4+/TGyQas41FWQqaU1soLwvC8EmdpchsiEepFFOyOkkHD6YWTvchA EhNQ== X-Gm-Message-State: APjAAAXoRPa1JI/dHNQJX/+UTDFKtN2qMs3US6mNa4s523jKpireV2fU cUQxJmbBCR+Ct5Rscrg3LdXo5jhX+atxqA== X-Google-Smtp-Source: APXvYqxDOwDPDA3uyuH+oOerLNz/t3C0T7PgregQAEAYKbamJ8hvmeyBcV2P71FDKYRorsGHyFTZeg== X-Received: by 2002:a17:902:e105:: with SMTP id cc5mr101508087plb.320.1560965401020; Wed, 19 Jun 2019 10:30:01 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:00 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 10/45] coresight: tpiu: Clean up device specific data Date: Wed, 19 Jun 2019 11:29:14 -0600 Message-Id: <20190619172949.4522-11-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103002_696191_3776B0BA X-CRM114-Status: GOOD ( 13.16 ) 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 Switch to using the coresight device instead of the parent amba device. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tpiu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index 63d9af31f57f..4dd3e7f63050 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -49,13 +49,11 @@ /** * @base: memory mapped base address for this component. - * @dev: the device entity associated to this component. * @atclk: optional clock for the core parts of the TPIU. * @csdev: component vitals needed by the framework. */ struct tpiu_drvdata { void __iomem *base; - struct device *dev; struct clk *atclk; struct coresight_device *csdev; }; @@ -75,7 +73,7 @@ static int tpiu_enable(struct coresight_device *csdev, u32 mode, void *__unused) tpiu_enable_hw(drvdata); atomic_inc(csdev->refcnt); - dev_dbg(drvdata->dev, "TPIU enabled\n"); + dev_dbg(&csdev->dev, "TPIU enabled\n"); return 0; } @@ -104,7 +102,7 @@ static int tpiu_disable(struct coresight_device *csdev) tpiu_disable_hw(drvdata); - dev_dbg(drvdata->dev, "TPIU disabled\n"); + dev_dbg(&csdev->dev, "TPIU disabled\n"); return 0; } @@ -139,7 +137,6 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; - drvdata->dev = &adev->dev; drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); From patchwork Wed Jun 19 17:29: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: 11004873 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 B403A13AF for ; Wed, 19 Jun 2019 17:34:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D5FB28562 for ; Wed, 19 Jun 2019 17:34:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 915A9285E1; Wed, 19 Jun 2019 17:34:02 +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 DCFF7285EA for ; Wed, 19 Jun 2019 17:34:01 +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=1ZZ2djJqg1UUhk281J5g55FLutkOBgOqpLPGHfwveyw=; b=uhhKjCH665sTkTqAXmRhHnTvs0 gwBvKsa+Go6FPaVsOD/rphsRkvzrl5b5RkuSxZ2Iyz/m9H8Od02pS4dj2G98cvl9MZS/dZmv0g/aQ OpmkF41yNliqiOLJLJlihIOdI+pJPOTXjEdvX/PbXpvxrkEL5W0Y91TgXMdoJXmguUT8CkrBgeJwZ sl59A1caE4n5U8tc71Q6OX+MjNjdCoxkUcZM6NczS2mXOelfgSXotzr55QQBNLcFM01/pHmcN0itx iahACCLo834A50xj05PqmiZ2X0obSy6wcCWHUFUM7AouJLdDq7PiWfIVStTKDK4PhrOHL7M1IZp4x 7DLlTnIQ==; 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 1hdeT8-0002kL-OR; Wed, 19 Jun 2019 17:33:58 +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 1hdePM-0007F4-Rf for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:09 +0000 Received: by mail-pg1-x543.google.com with SMTP id s21so29762pga.12 for ; Wed, 19 Jun 2019 10:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OjYsJsrxVFriL99Ses2BUVQeARKKndkJ4ZL7nCdVEZg=; b=vXQvBMHBlWrLFmS3uYX9FW7Y9hHnEL6H04HHaGXwEQb3a53f1FramvbnKb82GJTD3E uH2JgqWyl44FwSfa2ajCrVM3w7EeE7LxXZDWmvI1dbxAEomFXCLC6FYU1yTg/YxBqRDp wmxZgxtOTF7jhTdc2lOnPnumZrpM1Gm9//Ypm9p4r1qhwUZYC0M/35QGzezupKttClni Me2HyphANwhUgE0aV9A/qLMmlHA8euQ1QSH0EuUk5l7+gcRz/9eJuQFqqCKL+BKAiW0s vtcxOVNNiUls11qeh1htR24CAugONn1sAmK6O2PggskyLB1FVpp0JTpfsuQe/jNQPmPj OqTQ== 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=OjYsJsrxVFriL99Ses2BUVQeARKKndkJ4ZL7nCdVEZg=; b=M19CF/dI2ix9cGo2k6yFZKj7m2NTzlMh99ECL/YZ9M4Fvq7MgmUzXjiImnOcHVkGYE aBJhMR0hKzWTf1sQfG6faxe43ykC2tHLetrfyU7cQDrm2w/GyLnspZsyh34QRZ1/Kat7 nbvyjUJvZvlGYtCQRXLSaiPlcpIUKLi8BH1EziLwWhRBJuW6hD9y1W9Xd9xMVQm5DVrK Qg/uT+RMXamYCKIgFAU0LTVGDgCsuM1hE+I7ORwg/ZPve+Gm8UTqVVmQewYcxOqtp1Dd CeY/GHHzogjrl+RbXqRfByhI9PARRjXNUDrGA+Ttqvto0y3l2RTfrHLiyMMaNR1XwV9t g2pg== X-Gm-Message-State: APjAAAUeM6jscyiPHQQN098uxwjAQAQYhRvEpHyuqvgjcN8fZ3AHCajr +zvxLlQ4nRJ2wy7pOTtEQanWNg== X-Google-Smtp-Source: APXvYqw6YJjvWzHdoDLvTRsCfjvHZ75S+kf2RMB+x9kSN2SWprU0LsGjzkIJaza/EqZmV01xBTk1Mg== X-Received: by 2002:a63:ca0f:: with SMTP id n15mr8401290pgi.197.1560965401795; Wed, 19 Jun 2019 10:30:01 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:01 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 11/45] coresight: stm: Cleanup device specific data Date: Wed, 19 Jun 2019 11:29:15 -0600 Message-Id: <20190619172949.4522-12-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103005_358570_605977AE X-CRM114-Status: GOOD ( 15.90 ) 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 Keep track of the STM coresight device which is a child device of the AMBA device. Since we can get to the coresight_device from the "device" instance, remove the explicit field. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-stm.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 9f8a844ed7aa..8f504849b782 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -110,7 +110,6 @@ struct channel_space { /** * struct stm_drvdata - specifics associated to an STM component * @base: memory mapped base address for this component. - * @dev: the device entity associated to this component. * @atclk: optional clock for the core parts of the STM. * @csdev: component vitals needed by the framework. * @spinlock: only one at a time pls. @@ -128,7 +127,6 @@ struct channel_space { */ struct stm_drvdata { void __iomem *base; - struct device *dev; struct clk *atclk; struct coresight_device *csdev; spinlock_t spinlock; @@ -205,13 +203,13 @@ static int stm_enable(struct coresight_device *csdev, if (val) return -EBUSY; - pm_runtime_get_sync(drvdata->dev); + pm_runtime_get_sync(csdev->dev.parent); spin_lock(&drvdata->spinlock); stm_enable_hw(drvdata); spin_unlock(&drvdata->spinlock); - dev_dbg(drvdata->dev, "STM tracing enabled\n"); + dev_dbg(&csdev->dev, "STM tracing enabled\n"); return 0; } @@ -271,10 +269,10 @@ static void stm_disable(struct coresight_device *csdev, /* Wait until the engine has completely stopped */ coresight_timeout(drvdata->base, STMTCSR, STMTCSR_BUSY_BIT, 0); - pm_runtime_put(drvdata->dev); + pm_runtime_put(csdev->dev.parent); local_set(&drvdata->mode, CS_MODE_DISABLED); - dev_dbg(drvdata->dev, "STM tracing disabled\n"); + dev_dbg(&csdev->dev, "STM tracing disabled\n"); } } @@ -763,9 +761,10 @@ static void stm_init_default_data(struct stm_drvdata *drvdata) bitmap_clear(drvdata->chs.guaranteed, 0, drvdata->numsp); } -static void stm_init_generic_data(struct stm_drvdata *drvdata) +static void stm_init_generic_data(struct stm_drvdata *drvdata, + const char *name) { - drvdata->stm.name = dev_name(drvdata->dev); + drvdata->stm.name = name; /* * MasterIDs are assigned at HW design phase. As such the core is @@ -807,7 +806,6 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; - drvdata->dev = &adev->dev; drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); @@ -848,7 +846,7 @@ 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); + stm_init_generic_data(drvdata, dev_name(dev)); if (stm_register_device(dev, &drvdata->stm, THIS_MODULE)) { dev_info(dev, @@ -870,7 +868,8 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) pm_runtime_put(&adev->dev); - dev_info(dev, "%s initialized\n", (char *)coresight_get_uci_data(id)); + dev_info(&drvdata->csdev->dev, "%s initialized\n", + (char *)coresight_get_uci_data(id)); return 0; stm_unregister: From patchwork Wed Jun 19 17:29: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: 11004881 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 0EC8513AF for ; Wed, 19 Jun 2019 17:35:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB4B6285FB for ; Wed, 19 Jun 2019 17:35:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF9EB285EA; Wed, 19 Jun 2019 17:35: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 1A3BE285FB for ; Wed, 19 Jun 2019 17:35: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=fOp2/oOk7Zz9ZjAZ6Zc2e0BwUlGOhM3hQYY0PAKzhxk=; b=n4kMNRjYTVFm3OMAKirzcqV/IS qf2i3XMTODCpoPBodhe+urx/vzFN+ONe4+hvGGpJELk+msGKzrobAVg1BY81Gbx2/l3uuVVrDUT/I eRse1FJxgMmx3WvyxjDwwvf0u7m+53hfWAONqV7g1x9IP2FRlnoj9pbVoixOq1oTH+ed9+vaRqjsx WhR6fyXode0ZssOac0SXlAegWz3JKO6pIyWerbofU/5gFpNDQT5gIlXRfuYsbNx0exefAKW6GoPJd dOBCyFxlr6VlszzSooub5KzYKeK5XH0fbQKVPhZ5siyV2sihXmEIQxqGnqG/uvAlRaRUlLaNUVheD m+s9xQgg==; 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 1hdeUO-0004xX-Ja; Wed, 19 Jun 2019 17:35:16 +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 1hdePO-0007Kz-Dr for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:12 +0000 Received: by mail-pl1-x641.google.com with SMTP id cl9so83930plb.10 for ; Wed, 19 Jun 2019 10:30:04 -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=lvgzx4njTfDigJ2kDesfu5Opq/+bwO83R2/El41gk9k=; b=BBSQ3HqJUV596JN2ghSG7u3nSDPnDYJ4RUAwuEsBZtCqlY8a3O5uHlXcaZzPDkuv0v UHH2WPAzHFN+oWktHIxdZRw2Ry2ABen/htfSbtbjvpycPyh+QqoMXtlqjkBOz2L+ojSB /viY3iA0yp69rkLprs+1B/GTjtoVt8RQWdAaMSEgA9B5kdaDc1OUnWgNvLa6FLrdL58N 8xMewUb9Vu26H3HYObmk4tgEnDctjUwUiW2MkbI2p2Ih2TPhS3dZKta0vpFsgznK808x 5cHkGDgxRaCs7ay0Da2/39vcUAWxsHfOnC566iyChsv0bR71VaUAedFhkOGX8pmeMdxD 86vg== 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=lvgzx4njTfDigJ2kDesfu5Opq/+bwO83R2/El41gk9k=; b=mVAE/RCwtYvrUcxw2Yd04le+UepOJoa1A3C8Hd+MlTaZsXadknu1IGl9EVMWvTOOnL sGnKFjGt7O2TAnudzmDOu38KGHpB4v7CzxFvPvH9zqhcDwkxSGzM6zW8bQXq+Bpg+wAZ MVYYMjD0p4/p1R9NHNX+RZ2GXkhH/27kRQQwf+XSrwGIlwPTyJ2FV9N+pa2DUsYPUzGe EBHk6ZJENfp4nV63bWqTxn61piBKHYiDmNPBJOPGO8A67zErXXtcwBNFv3Qgb3wEGqqz fpcX2wDfZ1ZbJsdvX6EB7oGtiDEtZKTW2Dx8x7aFKxJKZ/JAXTMK0wIDYXusbgHDE044 1F7Q== X-Gm-Message-State: APjAAAUf4wlCKeTMavcsvky60StSebGXXc7Jld6GjRTkGopoKPsbcd8O IIWq2IGFAA2ylxV0bnCnoA0OS/ZHGTbz8Q== X-Google-Smtp-Source: APXvYqwuz+047K8HunEGAwBw4iwyc7Yi6l3Q33Sj6LWkGDDL9MU0GSxPrru0h+RvJAtEGtyQeIeOew== X-Received: by 2002:a17:902:2a69:: with SMTP id i96mr111387111plb.108.1560965402940; Wed, 19 Jun 2019 10:30:02 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:02 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 12/45] coresight: etm: Clean up device specific data Date: Wed, 19 Jun 2019 11:29:16 -0600 Message-Id: <20190619172949.4522-13-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103006_804197_0E7CE154 X-CRM114-Status: GOOD ( 16.17 ) 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 Track the coresight device instead of the real device. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm.h | 6 ++--- .../coresight/coresight-etm3x-sysfs.c | 12 +++++----- drivers/hwtracing/coresight/coresight-etm3x.c | 22 ++++++++++--------- drivers/hwtracing/coresight/coresight-etm4x.c | 17 +++++++------- drivers/hwtracing/coresight/coresight-etm4x.h | 2 -- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm.h b/drivers/hwtracing/coresight/coresight-etm.h index 79e1ad860d8a..f3ab96eaf44e 100644 --- a/drivers/hwtracing/coresight/coresight-etm.h +++ b/drivers/hwtracing/coresight/coresight-etm.h @@ -208,7 +208,6 @@ struct etm_config { /** * struct etm_drvdata - specifics associated to an ETM component * @base: memory mapped base address for this component. - * @dev: the device entity associated to this component. * @atclk: optional clock for the core parts of the ETM. * @csdev: component vitals needed by the framework. * @spinlock: only one at a time pls. @@ -232,7 +231,6 @@ struct etm_config { */ struct etm_drvdata { void __iomem *base; - struct device *dev; struct clk *atclk; struct coresight_device *csdev; spinlock_t spinlock; @@ -260,7 +258,7 @@ static inline void etm_writel(struct etm_drvdata *drvdata, { if (drvdata->use_cp14) { if (etm_writel_cp14(off, val)) { - dev_err(drvdata->dev, + dev_err(&drvdata->csdev->dev, "invalid CP14 access to ETM reg: %#x", off); } } else { @@ -274,7 +272,7 @@ static inline unsigned int etm_readl(struct etm_drvdata *drvdata, u32 off) if (drvdata->use_cp14) { if (etm_readl_cp14(off, &val)) { - dev_err(drvdata->dev, + dev_err(&drvdata->csdev->dev, "invalid CP14 access to ETM reg: %#x", off); } } else { diff --git a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c index 75487b3fad86..e8c7649f123e 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-sysfs.c @@ -48,7 +48,7 @@ static ssize_t etmsr_show(struct device *dev, unsigned long flags, val; struct etm_drvdata *drvdata = dev_get_drvdata(dev->parent); - pm_runtime_get_sync(drvdata->dev); + pm_runtime_get_sync(dev->parent); spin_lock_irqsave(&drvdata->spinlock, flags); CS_UNLOCK(drvdata->base); @@ -56,7 +56,7 @@ static ssize_t etmsr_show(struct device *dev, CS_LOCK(drvdata->base); spin_unlock_irqrestore(&drvdata->spinlock, flags); - pm_runtime_put(drvdata->dev); + pm_runtime_put(dev->parent); return sprintf(buf, "%#lx\n", val); } @@ -131,7 +131,7 @@ static ssize_t mode_store(struct device *dev, if (config->mode & ETM_MODE_STALL) { if (!(drvdata->etmccr & ETMCCR_FIFOFULL)) { - dev_warn(drvdata->dev, "stall mode not supported\n"); + dev_warn(dev, "stall mode not supported\n"); ret = -EINVAL; goto err_unlock; } @@ -141,7 +141,7 @@ static ssize_t mode_store(struct device *dev, if (config->mode & ETM_MODE_TIMESTAMP) { if (!(drvdata->etmccer & ETMCCER_TIMESTAMP)) { - dev_warn(drvdata->dev, "timestamp not supported\n"); + dev_warn(dev, "timestamp not supported\n"); ret = -EINVAL; goto err_unlock; } @@ -945,7 +945,7 @@ static ssize_t seq_curr_state_show(struct device *dev, goto out; } - pm_runtime_get_sync(drvdata->dev); + pm_runtime_get_sync(dev->parent); spin_lock_irqsave(&drvdata->spinlock, flags); CS_UNLOCK(drvdata->base); @@ -953,7 +953,7 @@ static ssize_t seq_curr_state_show(struct device *dev, CS_LOCK(drvdata->base); spin_unlock_irqrestore(&drvdata->spinlock, flags); - pm_runtime_put(drvdata->dev); + pm_runtime_put(dev->parent); out: return sprintf(buf, "%#lx\n", val); } diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index be302ec5f66b..9c92491d3fb2 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -165,7 +165,7 @@ static void etm_set_prog(struct etm_drvdata *drvdata) */ isb(); if (coresight_timeout_etm(drvdata, ETMSR, ETMSR_PROG_BIT, 1)) { - dev_err(drvdata->dev, + dev_err(&drvdata->csdev->dev, "%s: timeout observed when probing at offset %#x\n", __func__, ETMSR); } @@ -184,7 +184,7 @@ static void etm_clr_prog(struct etm_drvdata *drvdata) */ isb(); if (coresight_timeout_etm(drvdata, ETMSR, ETMSR_PROG_BIT, 0)) { - dev_err(drvdata->dev, + dev_err(&drvdata->csdev->dev, "%s: timeout observed when probing at offset %#x\n", __func__, ETMSR); } @@ -425,7 +425,7 @@ static int etm_enable_hw(struct etm_drvdata *drvdata) done: CS_LOCK(drvdata->base); - dev_dbg(drvdata->dev, "cpu: %d enable smp call done: %d\n", + dev_dbg(&drvdata->csdev->dev, "cpu: %d enable smp call done: %d\n", drvdata->cpu, rc); return rc; } @@ -455,6 +455,7 @@ int etm_get_trace_id(struct etm_drvdata *drvdata) { unsigned long flags; int trace_id = -1; + struct device *etm_dev = drvdata->csdev->dev.parent; if (!drvdata) goto out; @@ -462,7 +463,7 @@ int etm_get_trace_id(struct etm_drvdata *drvdata) if (!local_read(&drvdata->mode)) return drvdata->traceid; - pm_runtime_get_sync(drvdata->dev); + pm_runtime_get_sync(etm_dev); spin_lock_irqsave(&drvdata->spinlock, flags); @@ -471,7 +472,7 @@ int etm_get_trace_id(struct etm_drvdata *drvdata) CS_LOCK(drvdata->base); spin_unlock_irqrestore(&drvdata->spinlock, flags); - pm_runtime_put(drvdata->dev); + pm_runtime_put(etm_dev); out: return trace_id; @@ -526,7 +527,7 @@ static int etm_enable_sysfs(struct coresight_device *csdev) spin_unlock(&drvdata->spinlock); if (!ret) - dev_dbg(drvdata->dev, "ETM tracing enabled\n"); + dev_dbg(&csdev->dev, "ETM tracing enabled\n"); return ret; } @@ -581,7 +582,8 @@ static void etm_disable_hw(void *info) CS_LOCK(drvdata->base); - dev_dbg(drvdata->dev, "cpu: %d disable smp call done\n", drvdata->cpu); + dev_dbg(&drvdata->csdev->dev, + "cpu: %d disable smp call done\n", drvdata->cpu); } static void etm_disable_perf(struct coresight_device *csdev) @@ -628,7 +630,7 @@ static void etm_disable_sysfs(struct coresight_device *csdev) spin_unlock(&drvdata->spinlock); cpus_read_unlock(); - dev_dbg(drvdata->dev, "ETM tracing disabled\n"); + dev_dbg(&csdev->dev, "ETM tracing disabled\n"); } static void etm_disable(struct coresight_device *csdev, @@ -803,7 +805,6 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) drvdata->use_cp14 = of_property_read_bool(np, "arm,cp14"); } - drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ @@ -871,7 +872,8 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) } pm_runtime_put(&adev->dev); - dev_info(dev, "%s initialized\n", (char *)coresight_get_uci_data(id)); + dev_info(&drvdata->csdev->dev, + "%s initialized\n", (char *)coresight_get_uci_data(id)); if (boot_enable) { coresight_enable(drvdata->csdev); drvdata->boot_enable = true; diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 8bb0092c7ec2..77d1d837da52 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -88,6 +88,7 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) { int i, rc; struct etmv4_config *config = &drvdata->config; + struct device *etm_dev = &drvdata->csdev->dev; CS_UNLOCK(drvdata->base); @@ -102,7 +103,7 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) /* wait for TRCSTATR.IDLE to go up */ if (coresight_timeout(drvdata->base, TRCSTATR, TRCSTATR_IDLE_BIT, 1)) - dev_err(drvdata->dev, + dev_err(etm_dev, "timeout while waiting for Idle Trace Status\n"); writel_relaxed(config->pe_sel, drvdata->base + TRCPROCSELR); @@ -184,13 +185,13 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) /* wait for TRCSTATR.IDLE to go back down to '0' */ if (coresight_timeout(drvdata->base, TRCSTATR, TRCSTATR_IDLE_BIT, 0)) - dev_err(drvdata->dev, + dev_err(etm_dev, "timeout while waiting for Idle Trace Status\n"); done: CS_LOCK(drvdata->base); - dev_dbg(drvdata->dev, "cpu: %d enable smp call done: %d\n", + dev_dbg(etm_dev, "cpu: %d enable smp call done: %d\n", drvdata->cpu, rc); return rc; } @@ -400,7 +401,7 @@ static int etm4_enable_sysfs(struct coresight_device *csdev) spin_unlock(&drvdata->spinlock); if (!ret) - dev_dbg(drvdata->dev, "ETM tracing enabled\n"); + dev_dbg(&csdev->dev, "ETM tracing enabled\n"); return ret; } @@ -461,7 +462,8 @@ static void etm4_disable_hw(void *info) CS_LOCK(drvdata->base); - dev_dbg(drvdata->dev, "cpu: %d disable smp call done\n", drvdata->cpu); + dev_dbg(&drvdata->csdev->dev, + "cpu: %d disable smp call done\n", drvdata->cpu); } static int etm4_disable_perf(struct coresight_device *csdev, @@ -511,7 +513,7 @@ static void etm4_disable_sysfs(struct coresight_device *csdev) spin_unlock(&drvdata->spinlock); cpus_read_unlock(); - dev_dbg(drvdata->dev, "ETM tracing disabled\n"); + dev_dbg(&csdev->dev, "ETM tracing disabled\n"); } static void etm4_disable(struct coresight_device *csdev, @@ -1095,7 +1097,6 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) adev->dev.platform_data = pdata; } - drvdata->dev = &adev->dev; dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ @@ -1157,7 +1158,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) } pm_runtime_put(&adev->dev); - dev_info(dev, "CPU%d: ETM v%d.%d initialized\n", + dev_info(&drvdata->csdev->dev, "CPU%d: ETM v%d.%d initialized\n", drvdata->cpu, drvdata->arch >> 4, drvdata->arch & 0xf); if (boot_enable) { diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 52786e9d8926..4523f10ddd0f 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -284,7 +284,6 @@ struct etmv4_config { /** * struct etm4_drvdata - specifics associated to an ETM component * @base: Memory mapped base address for this component. - * @dev: The device entity associated to this component. * @csdev: Component vitals needed by the framework. * @spinlock: Only one at a time pls. * @mode: This tracer's mode, i.e sysFS, Perf or disabled. @@ -340,7 +339,6 @@ struct etmv4_config { */ struct etmv4_drvdata { void __iomem *base; - struct device *dev; struct coresight_device *csdev; spinlock_t spinlock; local_t mode; From patchwork Wed Jun 19 17:29: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: 11004877 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 F0A3C1395 for ; Wed, 19 Jun 2019 17:34:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D904D2846C for ; Wed, 19 Jun 2019 17:34:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCB07285D2; Wed, 19 Jun 2019 17:34:38 +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 478E52846C for ; Wed, 19 Jun 2019 17:34:38 +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=tM+9UJO0AtaMtIxVAvvs7wnocYIIUCELPxwPH6EUo8k=; b=JrD/viMucltB2+4haCUgBz3l1F dIWJCEU8BIZAJWHtAl4siw6m5y3Vgt4y5/9KRnvaQg9tNXcymt2j+rF03U5/zmKBZUUgf7IJyijw0 cg+czVxnP5qKMybzGyvSSzuFysQsl8fzyoSMr+Fk3ZvWdNe9RKC40Nnr7LyDn5pMbkltaFl5lyWk8 pF4+v1qtY1Py9rBg9WHCArJIW1ciIgfM4Zi7jwzRz8oH4/TAxtaKqX3Uctj7OvzevyJCqIHFSTvjd ww3RWLVPrlwv6hn8cmyGItGpCZhxU8YSgiD5HJV9DrJV288VAJgJ+jB/iJYHv4esJ7mv7/3YKn1lG Gl6iIMWw==; 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 1hdeTk-0003D8-Lx; Wed, 19 Jun 2019 17:34:36 +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 1hdePO-0007Re-OT for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:12 +0000 Received: by mail-pg1-x543.google.com with SMTP id n2so32508pgp.11 for ; Wed, 19 Jun 2019 10:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i9B/70j+KVPtpl7paUqbm+CZkyeg3RB2d1/vlpd8aOo=; b=bERDPwdOXjw0QYqaffDK6yPuqd5LEDEpg/DdWM69lI6Vqdv6a/o0y9xika88EXEWvk khX+zTwTF+FC8MIHibbrCJRioWbOhxzKC+9HmQ42fBXLSCaVdphl0la8NdIbTs1uQ6Yz sKYeZukdt+AB2+M+Gfs4i9F5sxBGNQf+7BZjXGS74ofG5YWPR3XrWcWXKoUi1a8eBGyI WrNy1vIQup9nJK7pE7OpMjIuRuNCTCZfx2EgrGsVezH+e0OxoIHWVh20nuiGl/OQxXT3 Zwk/dneVdPgNa112ujg1LyIcRjmSAk8YQDwlzwOmT5TnwEDYjXCE+mZmUbWgkD9jmyEk O9+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=i9B/70j+KVPtpl7paUqbm+CZkyeg3RB2d1/vlpd8aOo=; b=K0uu2Exl38X5uD386HiB7GF7Mct1dWxrWwb4h/8xjGeg2tL0G1ZXXe4jho2pQtkA3h U0F4Jj7TKAmVWe8z4kK89EZuTPpJZqOxyL0JKcIHKUfYOoIOG0u0m66eilP6F8+Hi2Yk dFp0oEUajfa+k5RCfkTJizlr7xbthicGthqRKwkGXfGxlOBEOOaL3kJCtnbQjo+y/See sDSRI10JWKSAY+QLEHr2sofSBgq550A9EbpIJZ7X2Sh3nCgZ9Fg1BJQ44ZsgzPodXi0G +ENnEHW9lWBMtnpJ4SU9zdcwzOflHTO9E2pAB9YACihjJ7nTjs3NRU5fchGZHCkq52Ap DoDg== X-Gm-Message-State: APjAAAV9gxmbcvjYE3N6xcGslM0JgZLEapvKTO9pYtpuymmMqy7b9CIH TjHvg/sPRlXpYUVeuHhxBzrVeJ+dqDuBMQ== X-Google-Smtp-Source: APXvYqwc6JwNBqLYwKk6hE+gYkgsjxacrL6CTDBrvQ6mQsO9R0rTAFjetL3uZlRGEse2QNeX9jdmnA== X-Received: by 2002:a65:6541:: with SMTP id a1mr8638481pgw.409.1560965403969; Wed, 19 Jun 2019 10:30:03 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:03 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 13/45] coresight: etb10: Clean up device specific data Date: Wed, 19 Jun 2019 11:29:17 -0600 Message-Id: <20190619172949.4522-14-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103007_160886_012193EB X-CRM114-Status: GOOD ( 14.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: Suzuki K Poulose Track the coresight device instead of the real device. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 516d67cd7759..0c9161fe4233 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -66,7 +66,6 @@ /** * struct etb_drvdata - specifics associated to an ETB component * @base: memory mapped base address for this component. - * @dev: the device entity associated to this component. * @atclk: optional clock for the core parts of the ETB. * @csdev: component vitals needed by the framework. * @miscdev: specifics to handle "/dev/xyz.etb" entry. @@ -81,7 +80,6 @@ */ struct etb_drvdata { void __iomem *base; - struct device *dev; struct clk *atclk; struct coresight_device *csdev; struct miscdevice miscdev; @@ -227,7 +225,6 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data) static int etb_enable(struct coresight_device *csdev, u32 mode, void *data) { int ret; - struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); switch (mode) { case CS_MODE_SYSFS: @@ -244,13 +241,14 @@ static int etb_enable(struct coresight_device *csdev, u32 mode, void *data) if (ret) return ret; - dev_dbg(drvdata->dev, "ETB enabled\n"); + dev_dbg(&csdev->dev, "ETB enabled\n"); return 0; } static void __etb_disable_hw(struct etb_drvdata *drvdata) { u32 ffcr; + struct device *dev = &drvdata->csdev->dev; CS_UNLOCK(drvdata->base); @@ -263,7 +261,7 @@ static void __etb_disable_hw(struct etb_drvdata *drvdata) writel_relaxed(ffcr, drvdata->base + ETB_FFCR); if (coresight_timeout(drvdata->base, ETB_FFCR, ETB_FFCR_BIT, 0)) { - dev_err(drvdata->dev, + dev_err(dev, "timeout while waiting for completion of Manual Flush\n"); } @@ -271,7 +269,7 @@ static void __etb_disable_hw(struct etb_drvdata *drvdata) writel_relaxed(0x0, drvdata->base + ETB_CTL_REG); if (coresight_timeout(drvdata->base, ETB_FFSR, ETB_FFSR_BIT, 1)) { - dev_err(drvdata->dev, + dev_err(dev, "timeout while waiting for Formatter to Stop\n"); } @@ -286,6 +284,7 @@ static void etb_dump_hw(struct etb_drvdata *drvdata) u32 read_data, depth; u32 read_ptr, write_ptr; u32 frame_off, frame_endoff; + struct device *dev = &drvdata->csdev->dev; CS_UNLOCK(drvdata->base); @@ -295,10 +294,10 @@ static void etb_dump_hw(struct etb_drvdata *drvdata) frame_off = write_ptr % ETB_FRAME_SIZE_WORDS; frame_endoff = ETB_FRAME_SIZE_WORDS - frame_off; if (frame_off) { - dev_err(drvdata->dev, + dev_err(dev, "write_ptr: %lu not aligned to formatter frame size\n", (unsigned long)write_ptr); - dev_err(drvdata->dev, "frameoff: %lu, frame_endoff: %lu\n", + dev_err(dev, "frameoff: %lu, frame_endoff: %lu\n", (unsigned long)frame_off, (unsigned long)frame_endoff); write_ptr += frame_endoff; } @@ -365,7 +364,7 @@ static int etb_disable(struct coresight_device *csdev) drvdata->mode = CS_MODE_DISABLED; spin_unlock_irqrestore(&drvdata->spinlock, flags); - dev_dbg(drvdata->dev, "ETB disabled\n"); + dev_dbg(&csdev->dev, "ETB disabled\n"); return 0; } @@ -460,7 +459,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, * chance to fix things. */ if (write_ptr % ETB_FRAME_SIZE_WORDS) { - dev_err(drvdata->dev, + dev_err(&csdev->dev, "write_ptr: %lu not aligned to formatter frame size\n", (unsigned long)write_ptr); @@ -594,7 +593,7 @@ static void etb_dump(struct etb_drvdata *drvdata) } spin_unlock_irqrestore(&drvdata->spinlock, flags); - dev_dbg(drvdata->dev, "ETB dumped\n"); + dev_dbg(&drvdata->csdev->dev, "ETB dumped\n"); } static int etb_open(struct inode *inode, struct file *file) @@ -605,7 +604,7 @@ static int etb_open(struct inode *inode, struct file *file) if (local_cmpxchg(&drvdata->reading, 0, 1)) return -EBUSY; - dev_dbg(drvdata->dev, "%s: successfully opened\n", __func__); + dev_dbg(&drvdata->csdev->dev, "%s: successfully opened\n", __func__); return 0; } @@ -615,6 +614,7 @@ static ssize_t etb_read(struct file *file, char __user *data, u32 depth; struct etb_drvdata *drvdata = container_of(file->private_data, struct etb_drvdata, miscdev); + struct device *dev = &drvdata->csdev->dev; etb_dump(drvdata); @@ -623,13 +623,14 @@ static ssize_t etb_read(struct file *file, char __user *data, len = depth * 4 - *ppos; if (copy_to_user(data, drvdata->buf + *ppos, len)) { - dev_dbg(drvdata->dev, "%s: copy_to_user failed\n", __func__); + dev_dbg(dev, + "%s: copy_to_user failed\n", __func__); return -EFAULT; } *ppos += len; - dev_dbg(drvdata->dev, "%s: %zu bytes copied, %d bytes left\n", + dev_dbg(dev, "%s: %zu bytes copied, %d bytes left\n", __func__, len, (int)(depth * 4 - *ppos)); return len; } @@ -640,7 +641,7 @@ static int etb_release(struct inode *inode, struct file *file) struct etb_drvdata, miscdev); local_set(&drvdata->reading, 0); - dev_dbg(drvdata->dev, "%s: released\n", __func__); + dev_dbg(&drvdata->csdev->dev, "%s: released\n", __func__); return 0; } @@ -744,7 +745,6 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) if (!drvdata) return -ENOMEM; - drvdata->dev = &adev->dev; drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */ if (!IS_ERR(drvdata->atclk)) { ret = clk_prepare_enable(drvdata->atclk); From patchwork Wed Jun 19 17:29: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: 11004879 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 B348F1395 for ; Wed, 19 Jun 2019 17:35:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C9B228433 for ; Wed, 19 Jun 2019 17:35:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E607285D2; Wed, 19 Jun 2019 17:35:01 +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 6F9B528433 for ; Wed, 19 Jun 2019 17:35:00 +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=YAAlbDemzDo0sQptMMRx9uhi1c7oeIlWeBm9TKbIVT8=; b=eAAESiwXSiWXvRuMih3lXtj+H2 hacz9dPUrzUr+W6cB3k1F6c8n+HznKoHYuHH5jEjZ2tunbWMqx9iU0a/skPqwIW0go47Mr2tJealA OrelP4XxRXHk7CK6ABk6eEZjuEu6iLBdWWq1EtOxZ84ABFZfdFlpLo0709qtfW+1RfBlNXraM8bbt qGhQ2Sefmpmf8lc6mGeRn3DtrrHVSFyFAPMLP3KgUWz9hTv0SbssRa/kNtucoMNz2DKcgBIO46a1i dpn9nBbYS5oy98J4eW47LOZ3aHd3y/VMKnc+/ILOO+Eq0Cd0b6qvLYdfjMzlcFGhVT/YUZR/HP33/ MkvMiDLA==; 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 1hdeU0-0003SO-GD; Wed, 19 Jun 2019 17:34:52 +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 1hdePP-0007WV-NS for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:13 +0000 Received: by mail-pf1-x444.google.com with SMTP id 19so8981pfa.4 for ; Wed, 19 Jun 2019 10:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YiiXxjdGItwuAF+iuZlgiXWIyVvrN8mFr1/a4zBxeWE=; b=hD6CxMf4ROlRMtggcqf9YjAAo2onCZrLji5WJHTEYDm2MeFB2hL57T5sT3vuY08vVj /AlR6y3rW4RVxGRzMX1jrqphJ106Qu4naY4PrsX/qMyA+uYtPhhPwGCHlInuQAAowcKs Z3oH2rq98VH0QKOe++LWJX4w39o7VhviaJRO4EFGiwdBUQXQLgaera8ocHlAhoBf1VRj A40pn44t+LQcv0KtPLMPABtyt45xg1TDnNNuN3lNPYKyJetkWTdcGj3Qmk+aPtKfyOON oiiLY0liO4gHXJsHsLYJOXMGR1TCwwUCUZjaRPZo3ycsucsp81KEpSGs+3rTL5ERU1rl gutQ== 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=YiiXxjdGItwuAF+iuZlgiXWIyVvrN8mFr1/a4zBxeWE=; b=lFonUqnzRckpz4oWWKl4n8V4IjarG6eyLCB5Ce62kJgKgl0l6eyO9jsnwybj9AoVsX aSrW4FB0T/bsSIKEgpyRVkvgM5kooHFPPjBqJVqyslWJtw+LTPdoEcX3PQuQw3Rz1A+b S1occtvIDkBVeXVXzEBA9bySBJtz6yu5uovUknpl75OEx9mPeWjRJPvJyKQjjjfKZst7 5PZkBngglPLWP+IOwwJMJd0T1f01rc9poyIEt7PGZR0E3Sp0QSzvGfCuFKiTSQarkwx5 wSwDhaRyplK03mDi0irAHU9+S/OLalEldBne1qcec8vNTkNW9pdyZyyO4Y1WDJFi+bRC XELg== X-Gm-Message-State: APjAAAVx00ZjbPWGPdjp0axn1xxW4eedCPZfebqGy6n0J8SslU+hCSGE sB2fzfxaFIpSaxVSGbXWI3lfa/mmC7v75g== X-Google-Smtp-Source: APXvYqz9eX40+g6xlY6jeaLeH4KFf5GQFIZXzE+Wc0EB0/SxiALn6Mx4prcGoyEI62v43UijFW9EtQ== X-Received: by 2002:a62:640c:: with SMTP id y12mr19989074pfb.166.1560965404999; Wed, 19 Jun 2019 10:30:04 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:04 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 14/45] coresight: Use coresight device names for sinks in PMU attribute Date: Wed, 19 Jun 2019 11:29:18 -0600 Message-Id: <20190619172949.4522-15-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103007_994773_7651CDE1 X-CRM114-Status: GOOD ( 11.72 ) 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 Move to using the coresight device name instead of the parent device name for SINK attribute for PMU. Signed-off-by: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm-perf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 3c6294432748..5c1ca0df5cb0 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -523,7 +523,7 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev) unsigned long hash; const char *name; struct device *pmu_dev = etm_pmu.dev; - struct device *pdev = csdev->dev.parent; + struct device *dev = &csdev->dev; struct dev_ext_attribute *ea; if (csdev->type != CORESIGHT_DEV_TYPE_SINK && @@ -536,15 +536,15 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev) if (!etm_perf_up) return -EPROBE_DEFER; - ea = devm_kzalloc(pdev, sizeof(*ea), GFP_KERNEL); + ea = devm_kzalloc(dev, sizeof(*ea), GFP_KERNEL); if (!ea) return -ENOMEM; - name = dev_name(pdev); + name = dev_name(dev); /* See function coresight_get_sink_by_id() to know where this is used */ hash = hashlen_hash(hashlen_string(NULL, name)); - ea->attr.attr.name = devm_kstrdup(pdev, name, GFP_KERNEL); + ea->attr.attr.name = devm_kstrdup(dev, name, GFP_KERNEL); if (!ea->attr.attr.name) return -ENOMEM; From patchwork Wed Jun 19 17:29:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004875 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 239AC13AF for ; Wed, 19 Jun 2019 17:34:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D77E28562 for ; Wed, 19 Jun 2019 17:34:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0145E28607; Wed, 19 Jun 2019 17:34:26 +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 93583285E1 for ; Wed, 19 Jun 2019 17:34:26 +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=Kf/ghVj1EHTt67e5yD3iq7vORm i+cghTiXlDAESaE5cPiFLo1lK51utYxYIsFfG1KvF3S5KhE8zyaNmysFM1boOlyY5HcxoaxFZ0qPf Ue4yevreo7w0bsSOxybzDUEm0BKPjcbSBjUbxHsoHynJQ5QaERx+6GDUrJ9M4mV9BhDGLj0c28YfY wKIFc0Jd6+/zx6Gf2+cw85ecPoPJD7jlayBZeCmf/jZQsozE3ciYD9RgrQC+u52YRXh+8M8e9wmpg nnWxhm2vcI+lcQ6XMh/WHzMUMUE7Hl8gCfcnuxbQnrQi9yFVVvFK1vjxIQCt8DQBbQvHpMF/+EW8O pGZEv/AQ==; 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 1hdeTZ-00030Q-9g; Wed, 19 Jun 2019 17:34:25 +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 1hdePQ-0007bT-B4 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:13 +0000 Received: by mail-pf1-x443.google.com with SMTP id x15so21845pfq.0 for ; Wed, 19 Jun 2019 10:30:07 -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=mI5HlunS1Zl4dApBNACKFOMxFMjwRL01V7dJfcljXwL7g4an/CGfsy9xi5001tN8Xl BtiVhdW0EbX96BlnIORI9eBF6tf1KS2v3qe6BO92DwGY/nj2Z882eBuU3N0dfoLWOXtg qMPAYO0l5HDCY6rgM2AVYa3E3Wnn2tGH1kwW8HFQ4AsjtWMjob89uoB1KDaLiuZQLpR/ s5vwW18MwDku3Rj+DFK6zxX36vw/Zc58JunI2hO7JkuAf3zEZo/hZRcXYHL89fcRMjdQ 1bCZJJQUzwdJdcA/9VIYyO4DInbqlCFvb6nAHPRS4eLJ+nr+U2eGbZbtkEkBvIXqVScM AO8Q== 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=dcU6ptBoOvWPmCJlNBA0xf350kLyGWe9yzNggD4OiQGanCLDFx807OE3hWo2bC61IG YrFE/f7zDe8SLq8YIbvL1a2GeMQTJ36OONLgCBQLQPufxchgxNiiYOcmtMsrQBDercSf TGkdGJBp9cjpLo34E/MxJ4cIkVY5jLKI3iIu6JXnzfEc04aNF1AFwBifIYEOwoDNfq/F qk8Q6ZcmObbnKr+fP0W/vF2bn2hwkVQSHTsJVhftSXheqGzeoHwHBekX22gg7QkSlxwj v6EWUrEltL2gU6f6R5dzcxJKNqVBwXHXKUvrMqX3o56fdF0KZ52M82hWmvDA0G5e1AQ5 KpRg== X-Gm-Message-State: APjAAAW/r5xfi4meQRp6tjlC51KTgkyBkS3DH+ckbsQkV2Hy48lLOE52 2bu8701a8WLCyC8yMixmz4qnzTL12uUEGg== X-Google-Smtp-Source: APXvYqxKuUXJHQwgNUp0GvkNZoW8yDkDBhQH6SLvUIRN/+cdQSskwMEa25VCKgvu9Hj+5CoV+BHB2Q== X-Received: by 2002:aa7:83d4:: with SMTP id j20mr130779372pfn.90.1560965405824; Wed, 19 Jun 2019 10:30:05 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:05 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 15/45] coresight: Rename of_coresight to coresight-platform Date: Wed, 19 Jun 2019 11:29:19 -0600 Message-Id: <20190619172949.4522-16-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103008_850095_E1DBFF25 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 17:29:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004887 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 84E1914DB for ; Wed, 19 Jun 2019 17:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7110627CF3 for ; Wed, 19 Jun 2019 17:36:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 655A128607; Wed, 19 Jun 2019 17:36: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 1B7C127CF3 for ; Wed, 19 Jun 2019 17:36: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=lCdK5TZiIn0f+T2aUUMLOGhazs11ar/N43HAylT4G0Q=; b=KZpZCF3ni4Re4cXp0L8f8/n27N U2puQ089ZrF26HDm8FN43Dz/LHowMDePB6yN9hgjjXgXtai121sOlLSXZeWzE53YfVrLOy0RFZakV 0alkOqxSzGHlloQ6ARhSDiCposx23ScVxfBfSZh4MQ8Bv6livIBqG0NJDqtcmfXdaSGYBgDALOd88 IxLf02a0LrjJdLSc8z87SrtjsrUpqIiMwYIAPDPryHCTxJaMxlnYuhcp1a77jTw+iurAOAErSq4Ch p7yLySVcATM51A7qcMANatiWx/kcs/L73eLsmS0Gqigrk4Vg2xgP3JaIxXiMU8tDyksCQcxfHi2JL D3+qcUIQ==; 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 1hdeVK-0005gL-9Z; Wed, 19 Jun 2019 17:36:14 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdePR-0007gy-LG for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:15 +0000 Received: by mail-pg1-x541.google.com with SMTP id f25so35024pgv.10 for ; Wed, 19 Jun 2019 10:30:08 -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=prwAII+ZGtojVUuaXNz0SCoaMA6E9CoFK+EWZu9cgw8=; b=s9Fe7VHL9KBzy6CsGS5e6Qn+rQ6tQgjBqnBuCyLjiEo+b+wDqTaXrJu9bqAARnoj3Z L2zU2tR5yEncgSWWAWk/8Q/xlNuoe6ZKWkwacid6LANFuwCd0bgLnKWo3TrKc/UNplKd D6KjqCWnQSw5Ps4Tz55M3yFubX9r7yNb3JRdcJGNnjwqiOjWCJcy/RRgF/p2dyHut++k rmVuS840X2wLtBo/hmtzcRGkHr8nbT205qJRT4oS/vZ0gRvLDxyRIveNMjYoHINQcftr 24kqNvun9dcx4bMMJQHsl1wXqdQn4zZCXJArqgV58+5JwUIND+qPKDi5u1LmUr75UrYZ YMQw== 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=prwAII+ZGtojVUuaXNz0SCoaMA6E9CoFK+EWZu9cgw8=; b=M+aV41cljbqbJXjUz2BhZCFQuAWz0oQbktOvUCipJvOEE+PY4NuL6MIGcVrgqy+gV7 8btt6tArWULHgtTYKmzk/F6GThLAJwyYmOiT4jQ4HB/NRzOTmDjaECYcJEEHjH2fptnV qA6iZwLyAlX1gCSDNjB0E7N940FPWgjUXSN/JoF7gIcqe4F6WEInBW4qemw5H7/gIkOP 0WeJdS/8pReDs8Zpnc2dm4mBSoPUZDw4NxtFMOB+JeSmn+8HPlxZeWaI6yuJxH0YUK20 WfyWdJJEwKIyIu72EWiOayLb6+8tCnVChXxHPgzR3LXxvnurWMZ9R97rbZrmRzRTr0eE wjXw== X-Gm-Message-State: APjAAAU3W8BS87V8tMq3EzFTWCw1DUE3RmmV2MhgKNd3R++kguAWvsGV u0iw6km3Vfwbh7wstjWbmLNqCKoBMxagaQ== X-Google-Smtp-Source: APXvYqyrQtjUmiZrlYv5ebeeSSnbptnwGGapYTRB2F7uvoXj9xSsyd1PSpAWKvGK7vzycX5oaBUw4g== X-Received: by 2002:a17:90a:3247:: with SMTP id k65mr3591993pjb.49.1560965406693; Wed, 19 Jun 2019 10:30:06 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:06 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 16/45] coresight: etm3x: Rearrange cp14 access detection Date: Wed, 19 Jun 2019 11:29:20 -0600 Message-Id: <20190619172949.4522-17-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103010_054034_A72BF4D5 X-CRM114-Status: GOOD ( 13.18 ) 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 are about to refactor the platform specific handling, move the DT property handling to generic helpers. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm3x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index 9c92491d3fb2..fa2f1417cafb 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -802,9 +802,9 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR(pdata); adev->dev.platform_data = pdata; - drvdata->use_cp14 = of_property_read_bool(np, "arm,cp14"); } + drvdata->use_cp14 = fwnode_property_read_bool(dev->fwnode, "arm,cp14"); dev_set_drvdata(dev, drvdata); /* Validity for the resource is already checked by the AMBA core */ From patchwork Wed Jun 19 17:29:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004885 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 7416713AF for ; Wed, 19 Jun 2019 17:35:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E7C8284C5 for ; Wed, 19 Jun 2019 17:35:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5315528607; Wed, 19 Jun 2019 17:35: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 E8F95285FB for ; Wed, 19 Jun 2019 17:35: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=qRbnFXV911tuggLtPzbjmL5H3h685KVc9GS6drB0BwA=; b=mkOY8vNquuMJLiFTLTBeVUJECk gAKWW9+7AC/mKB7tjmdUPw26tJQp4wtxa36grb2ZsqQI7ruYpxZjhmbwIZka7Cqd7tIqecFkuI64M rv+TaoA+oNdtIADiBG+9dU+CiHgB+JqpNVFPa+j/X+EW/bwmwwaVrb20oRW0wWeysswY6UeUJbcfn dtzDFvgqRpnmEnmjxxBSUT8MVX+eYYG9aNLNCi8R7T554vyx32QHK3nbsbdPdX1h2aJZs8Ni6QVCN f9oDfMH1AunTnfiUIEcmvBTV6XriTQIZhFWkvTvKzrMOutnG6TgiFggnK/I2GxtAwMWWcx7osqYA6 HkAtX/tg==; 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 1hdeV0-0005Rz-MC; Wed, 19 Jun 2019 17:35:54 +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 1hdePT-0007m2-6I for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:16 +0000 Received: by mail-pg1-x541.google.com with SMTP id s27so58150pgl.2 for ; Wed, 19 Jun 2019 10:30:09 -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=9b6Q0Ru1HZhRXustwN/lJPIpnVo+U7gJWcg7O4lhWOs=; b=EzvVa1Y2jOY6B8Ne9LsWCSPhDU3edmzwu/ilOtOd2VUMVacqtxANJlY9qhmDETgq5A 45C91G2+tarHMp28Y9naO4mUs12RlD8e38C8jBzM1VUtEI6uTjV20YXl/WgBzKsX1iuz QFB4HKQcAbb3qDgQlwIMJ7imPsnhMq/udLCkOvwJf4vnVYWj+eBIwVJ5Jy2GpvMPr4OD ntp7oq0odIRAzL9YTTibvrIhQNXsd2MFw3B0xOS9YbrELuziB/1XpSlDDmerJ1ILGF5F rBNIMZYdhe6J0llTwLowGrE+RwoGiFHsdNCodxtwq+dUt4cJ3x8cu8b3ezUbCWBiE8o4 Vu1Q== 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=9b6Q0Ru1HZhRXustwN/lJPIpnVo+U7gJWcg7O4lhWOs=; b=hhllj0fHm/jRQ3b/MeAVAR8eK3jcz/oAJMLXAAMls3Ll7JUZcMatAxJYvXlA1YkwsB kY2uKKM+t7fmsvIoz90swHjnUULbv/wRvwJAgYPwKr8y8MOWizYtKdQfmUyyCHCnAMlC ZzgAaMx5xGxTCG133vlr6f+6Wo8p3BdV9tVCQaXaBzXIzeoMJNRqsp2pgCyvCxlHFycW 7eKXjfrGKKR4KwDeQxdUBDQ85WUMIu/IZpYlUmUdGOgwdaTj44xFkOOicpiwppLnTL+i AwSrDoDLTpwEuk1SNGh2t9+Re+w8S5hEg9TuyKffbHfxifu8aPpVh4tFnO0x8l+rHTOK cdYg== X-Gm-Message-State: APjAAAUrooH4azazH3hLZUEtlzzhU4S1ZLI5Lid1qTqZoMP3ZSveahOB C25mK5u2tbvafgXWEpuBzBbYdyI6quQ0WA== X-Google-Smtp-Source: APXvYqwIJQ+L5h7S9lDShhxn52QbUDJc3rMIhn6Col9OFefLVvxxo84fKQTB7ZOXAaVeWcXJ/nwwaA== X-Received: by 2002:a63:4d50:: with SMTP id n16mr8852821pgl.146.1560965407610; Wed, 19 Jun 2019 10:30:07 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:07 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 17/45] coresight: stm: Rearrange probing the stimulus area Date: Wed, 19 Jun 2019 11:29:21 -0600 Message-Id: <20190619172949.4522-18-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103011_740402_92ED73F3 X-CRM114-Status: GOOD ( 13.30 ) 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 are about to refactor the platform specific handling re-arrange some of the DT specific property handling. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-stm.c | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index 8f504849b782..3992a35e34e4 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -683,14 +683,15 @@ static const struct attribute_group *coresight_stm_groups[] = { NULL, }; -static int stm_get_resource_byname(struct device_node *np, - char *ch_base, struct resource *res) +#ifdef CONFIG_OF +static int of_stm_get_stimulus_area(struct device *dev, struct resource *res) { const char *name = NULL; int index = 0, found = 0; + struct device_node *np = dev->of_node; while (!of_property_read_string_index(np, "reg-names", index, &name)) { - if (strcmp(ch_base, name)) { + if (strcmp("stm-stimulus-base", name)) { index++; continue; } @@ -705,6 +706,20 @@ static int stm_get_resource_byname(struct device_node *np, return of_address_to_resource(np, index, res); } +#else +static inline int of_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))) + return of_stm_get_stimulus_area(dev, res); + return -ENOENT; +} static u32 stm_fundamental_data_size(struct stm_drvdata *drvdata) { @@ -819,7 +834,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) return PTR_ERR(base); drvdata->base = base; - ret = stm_get_resource_byname(np, "stm-stimulus-base", &ch_res); + ret = stm_get_stimulus_area(dev, &ch_res); if (ret) return ret; drvdata->chs.phys = ch_res.start; From patchwork Wed Jun 19 17:29:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004889 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 15CFC14DB for ; Wed, 19 Jun 2019 17:36:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 011B928438 for ; Wed, 19 Jun 2019 17:36:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E96B3285FF; Wed, 19 Jun 2019 17:36: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 89C1E2847E for ; Wed, 19 Jun 2019 17:36:29 +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=1/DsfR8o8CLWuMNPXn9BiLJ3vn+DCaUU7w9U1HwWTIY=; b=DWYE5U6HBccEDTEZtTbVpIKg+S ++OCR3MC/wZ6dG60oR7yoqYWL+P/IFr4EcNXzK06n7UeG0Whc5F0Z4DtXuOwhhsiWLCisvDfdwScU bs4AEtYvwFfa53NYvmbzPXDrpVaw4eWLwCTtppg4BQlgtkMWejXiKTLBluS1Gq0g0XGN5LWDj2rwh hfCN81B3d9+9pYjStraQaNlC3K4KL56M59HQweHjfsW7FAu8Us6pbAx/TWBruA/qHksvvqCnsW0+8 adHAgL+bo4SAaRRpR++t+kc0OM8Nb3TMmOfNIR+SCHuMenbQnnuX9F7150YMzUC9aQP4NkDFPuynD N7TE5kRg==; 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 1hdeVY-0005vm-9N; Wed, 19 Jun 2019 17:36:28 +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 1hdePT-0007qf-Is for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:16 +0000 Received: by mail-pg1-x541.google.com with SMTP id v11so49258pgl.5 for ; Wed, 19 Jun 2019 10:30:10 -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=f0OEP82lk9pN05bJgvTcbMJBT6vO9afCPfXu5DFNwE8=; b=fN6+0lL9DoTPEw6XbkRt0gDsma+YO28KxU2llsh5uwvJgI5XTddd0XHrdoXDmOvGVK r7GeE1KvK63FR5YZDEYi0BJx2boyPL+9yTDz1abKzVBXxzdSa+AQNi1SxsvSpTji+MLX fhbEQALRbn8O1XJF+aAqIZTX7sO9NbaaLHqVmPe7kEYdcDaz7dfnrQXlDDqPIJ0ZZgJG vcHkRYByd8Ot+sKQqObB/wQQs6AdZhd+5zPNT0w+tvH2bXtO4GFnJFY7HV/9PetDT5wC BcwtkAgLXX34hyrhMgWXmsbucsx71zFWkf5FOjT4xRnbXtvJ7iqYSyYPA64XBLrY5Pk8 f5Dg== 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=f0OEP82lk9pN05bJgvTcbMJBT6vO9afCPfXu5DFNwE8=; b=W2kwTs0h0rYSNFFT0WZ5taV1xs98rnd8z/R0k5JqT7/gpl90lep75CN8t6d7sIF/Ri auP1LplFXKpp3VVIA5RJJCM/oZCe2ZW1ynke3aWUEWBgeuJjSTzoDvHRdIqmCzlGAgny TFrNTehueOTCUd3ShilIAZnEBK32C4B19y+gjeqpU1LbUKkJ0xHKcO8qVbioh9ggs5rI db6bZbTACrtyWglxYma6kMyplQeT2bVtCvk2PiUvh+34W1t5jD9lCSlBGboZU7Kaeoy+ Q7mv0AuOYAjL/Y2XeARx/Kj0jZn/DVy1kn5PZ5Mahj+8MJyUAU8+OdZ5+yoKi0uVSJ+N P4yw== X-Gm-Message-State: APjAAAVaxEDbTHg0QkBendIATIu7BwHcCb3uG7cIUGNZUXuS+LZ12eS3 DQV1HdHdMU2y4zHuxeCwGvPIPg== X-Google-Smtp-Source: APXvYqxEQNTxospyi5LZA9x+QYioaJ/Nki48e9z/nrANNd64z4iPi0efySfVH6Tyd7KRWnCFhT4Yhw== X-Received: by 2002:a62:e806:: with SMTP id c6mr16449905pfi.158.1560965408517; Wed, 19 Jun 2019 10:30:08 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:07 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 18/45] coresight: tmc-etr: Rearrange probing default buffer size Date: Wed, 19 Jun 2019 11:29:22 -0600 Message-Id: <20190619172949.4522-19-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103012_129652_57357B25 X-CRM114-Status: GOOD ( 15.09 ) 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 are about to refactor the platform specific handling, make the default buffer size probing generic. Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 3b39f43c583d..9c5e615c1486 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -378,6 +378,15 @@ static int tmc_etr_setup_caps(struct device *parent, u32 devid, void *dev_caps) return rc; } +static u32 tmc_etr_get_default_buffer_size(struct device *dev) +{ + u32 size; + + if (fwnode_property_read_u32(dev->fwnode, "arm,buffer-size", &size)) + size = SZ_1M; + return size; +} + static int tmc_probe(struct amba_device *adev, const struct amba_id *id) { int ret = 0; @@ -423,16 +432,10 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) /* This device is not associated with a session */ drvdata->pid = -1; - if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) { - if (np) - ret = of_property_read_u32(np, - "arm,buffer-size", - &drvdata->size); - if (ret) - drvdata->size = SZ_1M; - } else { + if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) + drvdata->size = tmc_etr_get_default_buffer_size(dev); + else drvdata->size = readl_relaxed(drvdata->base + TMC_RSZ) * 4; - } desc.pdata = pdata; desc.dev = dev; From patchwork Wed Jun 19 17:29:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004897 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 9FF686C5 for ; Wed, 19 Jun 2019 17:37:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AB6C1FFD9 for ; Wed, 19 Jun 2019 17:37:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F422283AD; Wed, 19 Jun 2019 17:37:40 +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 0FF961FFD9 for ; Wed, 19 Jun 2019 17:37: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=noXKls5VRq76zZMKstRTDzGS8SA+7SleCAI/20+HEjc=; b=XFikOiV4EIyZHDsXx4qPkXYwU6 PJsCNp/Kuro/eLPGI6v/TrWd9vFNyzOWMj8GnM0jyT+hGWSWNjRm+l8/HlcscGY4aVxW0G/Elfv8g S/LCHJUgZl1bDbgeyvVF2gxKTw00zOCRUYvs1pi3AQBZpph6nRsmUcUFsj2/CARtpKhhYeJOEt/Yn yWmVEkEMYfj1DarubYoN/VKY2JvOEbvqFJwNkcPbLcvWoDbxat/RKysUlFFkMMFcV/PYLW4MIU2lo GdgXXoHFC4yrKhRMolizwqM4E3hOdrBpGJotvx5YSwjh0tKAxsZMq2jadTg/1e442SwSSquodf0az 1gtRhJ9A==; 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 1hdeWf-00071P-CR; Wed, 19 Jun 2019 17:37:37 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdePX-00086w-8h for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:19 +0000 Received: by mail-pf1-x442.google.com with SMTP id r7so11943pfl.3 for ; Wed, 19 Jun 2019 10:30:13 -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=j+vwQNKrlxU0pB2aMYfXLTrSXtIol5Z5NrZcceuavtkupVjU8t8XpwO2kpWWYmCrog 8Np0B/qhoAYgf8mu1huXxDEwcaCc3BWfxTPfk1h62NUqiEV9eSKA23BKAwUtmJsfklv0 Ln/Lkxcb5nurTLFXR89FtYprIxEFGzFJQzkMDnzTRwE3It41Iaq55zLL4hXXBIJwLYHA fwFmSdxK9zyHjp4d7BIt89Bpke6JuDM9eoY3qDbxiA4M6iuoxQ43cqHj/Im1Qn/3Up56 zRLadea8O1Rue4uXiknyw0W8t1V0n7u1/NZaw1kQ222T0StxPD8J8u3HAoj4l4fBmkp0 9uMg== 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=ND6YNn3tTiPGsP9jlSZL1RDio3py2b9UAepv7TAuzQFcJdYDZ/hyNRbg+LzDI5HMOh oVojId7Gr7gSTE13Slb2lcx2KxCsMAsNxr7axCbhW7yk2iMYWou6uCdaWzmqZ9hBf59a Hm9SQT7BS8njZAt6h8manbT7qNFRDw/25nuXrzXfvzUMA9t2GQVDGJWuTYPUKRDYtKUO e4ZUkyghW3agvT/mKQG4Ro7pNalD7wdJR5dHSUdQzdY9spUt7uHK3m4xaBTofrwoGr4J lgL3DA1eq95KTRetTyTspnSNpJQ98zU3g496o8m2efJbezTbBXSRu6iuqgQqkFsf7BsM AK0Q== X-Gm-Message-State: APjAAAUu6QDdQmveYm0muZD33+dRe/Vx/wQGz5h8zzp/3PNXXdufdr3D TbWavNE8jXaNEkvesK4exzJDJA== X-Google-Smtp-Source: APXvYqw0WmRFdcNA37h3eEdFVwC7qHM3Cwg7PD/8zJDmC77AHVz9oLFcJzbPAND/Cu7FmI40yJ6nzg== X-Received: by 2002:aa7:9a8a:: with SMTP id w10mr10792808pfi.66.1560965409280; Wed, 19 Jun 2019 10:30:09 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:08 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 19/45] coresight: platform: Make memory allocation helper generic Date: Wed, 19 Jun 2019 11:29:23 -0600 Message-Id: <20190619172949.4522-20-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103015_554966_8D65B9C4 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 17:29:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004883 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 A109313AF for ; Wed, 19 Jun 2019 17:35:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D210283AD for ; Wed, 19 Jun 2019 17:35:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81B1F28562; Wed, 19 Jun 2019 17:35:45 +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 7DE63284D4 for ; Wed, 19 Jun 2019 17:35:44 +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=D6ZRyf0ZkxxzBehw+elT4dRi4N zHiTpklotfmyYG9DyECkHmwc26/qDD66HMhHCWVRlS/1L/YvEwt7QYO4VqeqaoNrQICnJ9+lRHNVw KvmAf7PSlthdfe7z/bR0YrbcUUAA1ZNMhYYi8mgM6IBnU93SsPhvqXAzsSNbNCmbsMAa+x46pKFe+ SC+h4gfvYFOadgzQKN1b+Mer6qtODevMplhfhQ4M6GxzGCbwi3lIGM2kY3zmkfF9tuTsTtqkgwzQB D8YCgEFWqBFLwUw4zQIrHKNya+c7DLi+NC1V1C7xjAjMXRiuarVj3/1UL978w2YM3+GLHS1BeJlNV ADXB74lA==; 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 1hdeUj-0005Bz-G2; Wed, 19 Jun 2019 17:35: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 1hdePT-0007yh-Py for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:17 +0000 Received: by mail-pf1-x441.google.com with SMTP id c85so18513pfc.1 for ; Wed, 19 Jun 2019 10:30:11 -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=idUSOBxDV2dQTLvpv1Ojh3SttaPO5sD4jB3cRXvFNrp08eUJ5Xtcz9Vrl+gtlk/YYW rai+SUShwUpC7qJc6V067XN8LJvzRyJ2lib4wBqKvpJKTLcn2i4suMyMpOUNOJXrj9CE cw5ZwbxdpRJNp3Cq4WVAfBqwFOntg8SVnz/H6c8XUNOQLvCK/6201FQzquWiEA0ChJYE PONxpKgQEHRSbVlyN0TqrMuTSpkW4BWkaw3YNCdhsS5vMgmV2gVW0+u6sVPlS3O7gaUd E/MpX4CchxISQDae5LvKFHFZT2wkobaz16qKTU6k6rQjlGmzFIYA8vG9gdmlp49F4QhC BVig== 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=nBpdPQ+0VuZbLMcPpI7DFhv5ygovPBtAhoiWgI2gVd2Se9ool/O7y0wJ3LecfSoDuD 4HImJDlGpB3xR2zxc8Z2XNyYtnP3vY2AKrhdKL3ouwnSqztQEqpa4H4RRcrzCh7h8NQ6 NJRGPC6GHVt4GOIs8Gtst0Zb+KEur8EVUB4L8RffKkgERMNM/XWube30MsOUiC3Ki8Lu fv9c8o1LIOQmA9NtIVLK/T50ng4D1WkfmgOwo9jN/Xxa5j877hsTp8o0xQM3nsQ7T6NH QGu7Kn+QxrimvHqMj/5nJb+fGiW5XwUGORLdLxdx0nG/s1Gzd6eS/CyWJL8TcRIti2mP JrIA== X-Gm-Message-State: APjAAAUSg+wbNEdpDS8h0QDRwkly+SoTqwDbXjttG26ZR52FI3CRDUMd PG8GxY3AbKdO/wQR/kPX3LxeZg== X-Google-Smtp-Source: APXvYqyNe+QUzZaE5AJOmbOnR3kg+SIPBPo5Wxo8m5w1g9cjVOEpazy3QomISvuejMesuKRHs7VCUw== X-Received: by 2002:a62:14c4:: with SMTP id 187mr52834108pfu.241.1560965410009; Wed, 19 Jun 2019 10:30:10 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:09 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 20/45] coresight: Make sure device uses DT for obsolete compatible check Date: Wed, 19 Jun 2019 11:29:24 -0600 Message-Id: <20190619172949.4522-21-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103012_177730_4D175595 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 17:29:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004895 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 CBB1A6C5 for ; Wed, 19 Jun 2019 17:37:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4ED21FFD9 for ; Wed, 19 Jun 2019 17:37:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8C8E283AD; Wed, 19 Jun 2019 17:37: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 C04E61FFD9 for ; Wed, 19 Jun 2019 17:37: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=VvqhZvvUDC1OvrGWdUhWD6z2C/dL7hLfDFByTF2FJ7Y=; b=WvJVg+duf7DTw9Sn+sK7R9weP7 O3ywAXy8xny4veKLccf6JI0JUYmpK3tcV+UZ4XPTWgnfG9QTBv/biAwYRlgmeAESOLMte+YmZhrwS D0Xn83AOhKwciDq9fdyVZPMePQsGxRaoHVBXCwWQ6M163dPYjpYzlnCWG8okRj+VcIQGqAdpeb4aB rAHz1hKWvvHVhZu7QVqUrKnSfJcOpmKWLLMmDqZR+1BrozwMKw52S4Fvds7LBX/9EDfSU76nb9AS8 31NJc6yHxomvRx+KehwWMmAHhRI0RusVJPtJxr/7bkRA88KX/ldDmFa1FT6DPxQvp1yiV9+IICmnP uYoIXGng==; 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 1hdeWU-0006j5-Db; Wed, 19 Jun 2019 17:37:26 +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 1hdePU-000836-HR for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:19 +0000 Received: by mail-pg1-x542.google.com with SMTP id v9so27440pgr.13 for ; Wed, 19 Jun 2019 10:30:11 -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=ZREzVdjIvM+cgJka3y0JHovKirmwcPkcT5kJNRohbrIZELECxIFzmcIuZoJyMLouO+ KsBc9Uj7u9PZzNdnUN+hAI1Sf7kjLkKNMvQ8ix2CpfBwkH3phEugWot7lyBSgTh7MphT Bp7geoYlyZbi3GHi5aqjfN82bCriyzv/ENpGg1QzwJKKwEHOuW3yDk58OD8hlU2pwT3q r0005TjwvxgiNwQc/JIVtq3nnPVPtooI9AFl0nOdTmtXAJZ+CSD8h5kAAHDrlV7w03p6 Oj0d8WedizvxzwG31BbMrVw3KsA7wb7SVrFyCqVKP/8CAdeszFCNmE0FkGS7hlOZIPzd n+Ng== 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=kjwxwGB4/G8+PHSiTZlmnDr01JRYtgcE8/47FwilKqH4v8Uatjy5m+bja13cN/n2oE swJEHahcO9K+QNQv10+HVhRkx8mu/O4CmnbfV59SJTnec/V204/0Ef3qKEBBAKfg6tlD L+EUGyGKwzM9/GkdBziSSPdWdRmP39zUSsBY+p+iMH316hXz744ROHCXWqJFYB6QVHc4 tfPmfPXOE3k5kfYvXlU6x4jEWBmJwGjaKn2bM8Q/2qb2RoMlg8wsfdJrhw5sk1W/xfC4 n9X5xekQRpzwOczTZDlcrAsK7YzkYvjJOJ+R5bY8jE8Y4LWwpwHNiMFoXNVWsvIiggRm 2Stg== X-Gm-Message-State: APjAAAWcGpdOezjqioO0ygI3jMN6BSf+AACQS9OAJt51/c9T3HhMNOC2 k6NE982laF4ZAvFbEImlcW65TQ== X-Google-Smtp-Source: APXvYqz8aidAZ24K5VZZoCWJOR9un+XWWLtsYe71y8TKsfYvFQ6hmcw2tdxbEJF0S5eYTpfz4Z0ANg== X-Received: by 2002:aa7:8e50:: with SMTP id d16mr119235109pfr.65.1560965410863; Wed, 19 Jun 2019 10:30:10 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:10 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 21/45] coresight: Introduce generic platform data helper Date: Wed, 19 Jun 2019 11:29:25 -0600 Message-Id: <20190619172949.4522-22-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103012_847151_F2BF0032 X-CRM114-Status: GOOD ( 18.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 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 17:29:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004891 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 41D4114DB for ; Wed, 19 Jun 2019 17:36:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2961A26E96 for ; Wed, 19 Jun 2019 17:36:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C26F283AD; Wed, 19 Jun 2019 17:36: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 7C5F026E96 for ; Wed, 19 Jun 2019 17:36: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=MpzfYU/cIAMRtdX3uMNENFwu/NcXL0W8+cFkC/8WRIc=; b=NsZLsFQ+IVWiOu460GLWL0sVXV 7mtygHPH0SEQeD0qLJAnOZiQAxX6WUwD/PiR/K7WeYhC2zzZCCKNvuCQRoIiP7ADOtbbdCoeqSVnN vY4YXV8WydGxnvWEdo2w305R14XAXFQ87TmqfWlKKx+cMC+P1Kw/M3SPBYpZx2CWIrsuXWIxcy7n1 DtmfHGfMBKy8hj7wi8vo7eWd4agHjWbi7Xb7OaI7Y3nyZ64+liUxXWa/1HmuPpEfGqiAteOqPRH3X wFNXiW7ILPLmF+plMrLrnQGkKxEBUht15UvRDqTF9y0of4wJd+m7+kNXuTdOaTyR+p2Fy2KZJYBOZ 56CF8ECw==; 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 1hdeVq-0006Bv-Ej; Wed, 19 Jun 2019 17:36:46 +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 1hdePW-00087X-M4 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:18 +0000 Received: by mail-pf1-x443.google.com with SMTP id x15so22022pfq.0 for ; Wed, 19 Jun 2019 10:30:13 -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=IoesthkWNzTFdDnqz3GxWUz5KARPVHuXzxOLBy7aMQjBtvE5VcejJELdnAFy8Y5mfn TJohe4pEu8gc+HgUOrqoVHBBqREJHKV3P/oNim2OIeTOCJfVQ0qoKP2253ovoaLEAqnQ 1zirHvFJwmoeL90w/uufjCLDZQJIJxH2f+lhXwSz54Bgo7dR+xkQ691UwYyIKfmym22k k1ikc/+UPrrC0sviN6EIwGMQTSBZM0d1WwI9U2MQTCnC6Qobt0IuCEQVAogp7hCZ+r/x Ol7MPHfrB1/p3e0RMjZoUK5XFZPtJAjQqtYIxA+ZUIZ01ejkjQZIm6r5PBlfDCuoWTom GyLA== 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=n1yk9uy0UrnAKRiAc6FDXPfY+I9598f0j2bPGeiCrzfgcfOHQ4PfFItDV1qBL/ChGm aO54jCpldDofLH8kH6+fE136wxiMX+AhdcAT3zPVfPTPUf1+DnhvdpOf395w48K5FZ3P 8eJtyVokXqokrZu1YgK8gvDzsx8RnTy1k16emPhjEzlzccSmhxIjYG04h3RH/vxN98aB YowfZqseHc9awXTGGy84eJDnGlx5CI89+QOGy2DiK3Ntil0st2Q+fyv91QWQj4JR+u+f Gfw3mhSWdNWfPoBFAaf4DJCoSj3P5Vwl0SlFlO8+snIgqFnIog9I9PmIDxt//lWhM7dA RopA== X-Gm-Message-State: APjAAAXoGeo3vh000UfNlSnsWfKPRNWII8Wv7TgeFBtn/IY90IsrkCIK cP6/fYxYsXfQQbkTU09jhiSjVQ== X-Google-Smtp-Source: APXvYqxXYuBOQATdjO0p16ejlyEXTfYrpaC6zQMIfyOQAy4TeoRABBLd/9H9Y3Zju+JwTLOE5CJSnQ== X-Received: by 2002:a17:90a:1c17:: with SMTP id s23mr12408843pjs.108.1560965411862; Wed, 19 Jun 2019 10:30:11 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:11 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 22/45] coresight: Make device to CPU mapping generic Date: Wed, 19 Jun 2019 11:29:26 -0600 Message-Id: <20190619172949.4522-23-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103014_851168_A6AD7279 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 17:29:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004899 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 72B7E14DB for ; Wed, 19 Jun 2019 17:38:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D4E21FFD9 for ; Wed, 19 Jun 2019 17:38:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ECE528438; Wed, 19 Jun 2019 17:38: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 CB75E1FFD9 for ; Wed, 19 Jun 2019 17:38:02 +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=dvsi5Y8IwKD5L/gXLja2BfOoLW UgqzFb4dEqKHyS7ixwZXntVxgOaLzUQFPUnm5zXIfULKuIwGJHcp6PT5AY+tqcDjIvYiwRB5Dgdkb ck1RRrckh0EleoqK29fhZYBir4ngu84LSfZ9lfqWHEi3owe5pz5X9DFK5Y6hFRk3GiTPIikIm5y4u gonN3m5ucK1UOhLr5y3ZI7mB9jtP8LAycoSv5HxNYpAwC/ApedD6Ya3vlp2k/d2FV01kNhsw4Y7DH hgqSq+c4v303X3zhzmO29oVcpbmoYN9j2xxkUEiYr7Wzq5Wz/G1kMNmH88ejzsB5AzuhRbui/YtrY 0YQE8DWw==; 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 1hdeX3-0007JS-Vo; Wed, 19 Jun 2019 17:38:02 +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 1hdePX-0008Cn-2w for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:19 +0000 Received: by mail-pg1-x544.google.com with SMTP id k187so63920pga.0 for ; Wed, 19 Jun 2019 10:30:14 -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=a7mihi4J+oTITqcMQOmSnrsxCw9JBQNy/j3baJHuaaOFZaY2VIdn6qNWLDRWfNqkHa bvtID88voosR7JeRM3trRKARvqRhjGtOU+rAcZ/8IZyc9wcN2nWEBc0y9GgwG19nn/0t f1PL3mLU+evnUwhwyyl3fP5bdxxoaH39SLUXv6pdXM5IPSgx3hCm4Wuxd3lsRHQfQFHh 4JgUJHPLymJRyaEfD8iKKyHb9GaR0L+IZv/AAvefQBCC1rsp2xf3KwEiMTSyej14Lt4p T43tixIdjxT2Fl5Lj4qC7Q/QORgyw23N37d7v8Hs0ILtZRJJwD7zb/6tjU/CAJi3S+/G 6V7g== 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=Ua5AO2gCLnnRbvC9GV9gCtNHLJGdDdAordr7QG6JjL6TfytOMjQT+VUODsY+uXYQjc pew8/y6qCeJc72CAmqiIcjCzpznyRlnBkpPa99uaOtC0ojqUMxeNoWXfMj5s32PoYo+9 9ttf1R9zD51i0Neb13pIc3xczvXOGaiZ7gDykgZvzfzohpBJly6CeZ6hWInl9KalByq8 NbM6ssmH+aP6xVbs110tUenXBNAHEc5vTK4KDsLUlS5aMaBkFOU/jMSUddmRBg2/mGea O/AOJH9KDJocjiBKHMXiLRMDkn5TsBtfT8OZT0BlN+GVgpxmGqoPRPyuhkqxyU5f1T5F rrxQ== X-Gm-Message-State: APjAAAXBaskbFAixLcEIcHZGR/QQYQZpntU+gM23vNgKUDf/eZEmdk/z Locro9Y7ah1g0xFRao/3o50vNw== X-Google-Smtp-Source: APXvYqxL6E8l8j0RESM2w0kipOADrPl+klya4JKIJuDnvk/HwBo+MhDh6bo1z5IvCMu+srggyRduTQ== X-Received: by 2002:a17:90a:a505:: with SMTP id a5mr12506460pjq.27.1560965412795; Wed, 19 Jun 2019 10:30:12 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:12 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 23/45] coresight: Remove cpu field from platform data Date: Wed, 19 Jun 2019 11:29:27 -0600 Message-Id: <20190619172949.4522-24-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103015_345586_80740BFA 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 17:29:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004901 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 6BDC26C5 for ; Wed, 19 Jun 2019 17:38:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5579728438 for ; Wed, 19 Jun 2019 17:38:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49FC82847E; Wed, 19 Jun 2019 17:38:20 +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 7835C28438 for ; Wed, 19 Jun 2019 17:38:19 +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=mOmq1YS5c+hjExVdBAvT3NkIrw qfb3EkJPDbDuTtNhPipN4fpTmbf2fJrfJ/jfhtJ8CAfIWMBQ1I2wauXH+RNqBATweofKMqolxcZua ipXDGAYQPU/cNPa4gYDiAItRlGKBEisqflkatn+67VCZrm/pY+cTkiLf9wiqNn+nJtGQIgx8bMjD9 A/xN2u+opQ9OSlfUf0WxyZmOGAlcOkKzo1A1JdWCdDxaAiFva0KamcbDe5Xi2T7UrUNlzLP8SfQUG lBSaiap0m32/oF/13HhEArC6EfztGHqpvzppbP7Q/yVP1Vv6N2k5vendRmat5ydQw1eanuC9vx2GD E6RFSpdA==; 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 1hdeXK-0007aJ-0a; Wed, 19 Jun 2019 17:38:18 +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 1hdePX-0008IH-Sw for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:24 +0000 Received: by mail-pf1-x441.google.com with SMTP id p184so186pfp.7 for ; Wed, 19 Jun 2019 10:30:14 -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=SDlxCsR/oPQJdWKgl/yHmZHp661cNQzR2fZ+qa7GdeyUThhntMfyMfKMjaRlS50m5j eePMit6ml3fj2Avm5esx7jiv+VV482/mieg1hSY42WaC59JuWgEFCi8gMR/aRSrbtOlD NYhLa6oOjcykv1he/SFHf7PqrUt26Uv58FJffh0I3y2fyGE1O85UQSsjrQYbW6w8l3og CR6muw7gCbUu1I4AjImgTDosN/pTKiawaIkMeLUrsZB6lY8DeHmax0/PTB0H9+l54HuW KrxKIzyjMc1cQyL21vAcWaPXtzUVty2VZ7QRHQHf8LPLZCk/jHMMujDhw51FYoy7iD5+ cCZg== 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=T36qDtZd4WoDDOLgRZc0uWPmmP27Dupg5GXcHiXbK3mtQLxjsvIDGiicpmKosqZJwg yeamRfNZjNp1gfwKmq0wPg9f+dkifXkaolvFnwrvVeSL5Uc7liHXhaIOOfQtrRVFvXVN ahlAAmkpSr4Lfwiwyo6odVfNoBvjIG87vTi5QM4KDwoQNDYA2YnXrD1hPxretxyx0Gb/ XPklE9d5guYjTjDKMJS5nIfMEnyZuo9z3xZXjB5BouibvWH0tgr9YiwCbUJ7hrf+L71o xV+5JuRRJfu4tYa67E8a56/6fP2wbfCq6nmlkemTp58+mAtruRXxFEtpNzz1dOcO+0mE ZmvA== X-Gm-Message-State: APjAAAUI7GgbGhENqs1AY62cjY9aPTwZC1McmTbsVVsbMLFGaaEaqQ4Y PAr5NBm4g7us/VJMO2Z07bmxaqpOxKaVBA== X-Google-Smtp-Source: APXvYqz4dYeG2vic1CiFnmIt6llrNqojEMYhjwRiL/OzOqpCJxdzxMYB3YNoS27obAN3iwD6PYODKg== X-Received: by 2002:a63:d24f:: with SMTP id t15mr7841276pgi.301.1560965413624; Wed, 19 Jun 2019 10:30:13 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:13 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 24/45] coresight: Remove name from platform description Date: Wed, 19 Jun 2019 11:29:28 -0600 Message-Id: <20190619172949.4522-25-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103017_400454_6A72A844 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 17:29:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004893 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 DAE696C5 for ; Wed, 19 Jun 2019 17:37:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C604426E96 for ; Wed, 19 Jun 2019 17:37:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA748283AD; Wed, 19 Jun 2019 17:37:01 +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 594B426E96 for ; Wed, 19 Jun 2019 17:37:01 +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=BusuABNb6jF35okGx79O8enrvM 6CLHr47lLETZNcyh2abGAbKmN1gNNaNvegyL2m1yJLVoD0ua/yJOW9ps+o8wOETFIBsUTtDF+SLrF LQnex66tJlOxH+k9kxovXwBDd4dqKDq2C0Rgg/FdGETWZIAd/C5z8jNoZ1JzP/8l/2CYe1/69Wg2x s/ONcz7RZPF90lG4RoOJfngtrabah5nQau7s4s3u7qQvwCTSnPE6ga3XakTUYQhMaHGzDcPvGQdL5 yUII0X4jByhuTOaqa2r8hAVYo+K5HQofh+TAg87MLrwDHI9MezWYS5HfWYzmD25TmTXwvLU/MUxQL IxZXjqig==; 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 1hdeW3-0006PW-Q6; Wed, 19 Jun 2019 17:36:59 +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 1hdePY-0008NS-1h for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:20 +0000 Received: by mail-pf1-x443.google.com with SMTP id m30so10158689pff.8 for ; Wed, 19 Jun 2019 10:30:15 -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=PnfE3MEU8njbGMFhU9AJgJ82QOSy6M/S+feTB67U5RPayCAFuVwFi9QLhvmL4s4G1/ fm8X8SpkVVSurgL3XoktLnAoFVUnPmln7LH4KD2BAC2u/N9ZhVfp7tBLYAoZNzDxJla8 kkgjnZMO37pZ+r4brvO36f4PPIRdsUxS62Q2ij6WikHFXp2dERk2RNBmjL5xVSqpWXXB ipEeqJcXr+xnqONOdtchrf8V9BRo3IPqJopMOdgndgGCjUBmYronbxEv834k8L7Vc6r+ ugQ7EkryqUPKU/anGq9RiNK3KNIm1UHfUWn40vejQ2ti+638oaCcdxzpWivk58VUJ1Ef /4dw== 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=hyJf3VZLITxjy6PzoPvxtX8ykUqr5AHNv7znXDjPOemIfBV4ixzTwkBHugu1MUH2/z 6DdQ3D7XVfuzLobeeLuLrZSCCE304E8s2LrpC996fcY+2SD0NdXfz3yatiYcBbsEBOFa FfqO11OesH0/w2R4x6DSqUsi01OMypjNLmG/S72ZH9Y11HidtM+eMX2XP7l4bgIDhI4g EDMMv0MtsNtxTZbggt+LR0DeQ1FBKtClafSGBWEwLgGFfqp8oeDLZILyFzlw+VxN6dxD NttlkQZH4T4Y43PQJCFE/0409OlY2u94nOG6ZajAnwGsmirY6k5qYOs/tpkUvVHS7BhV D0OQ== X-Gm-Message-State: APjAAAU/al3zP0m25Ts+wBDgwvMgs00GczMG/KttfohAPfmPBAkhVFGq 5IBOyTMKfD0ZhKsrkPIYddOEXg== X-Google-Smtp-Source: APXvYqzucdb3p/qA/jGKrb0h6lhKXos7M6ZqMhzW5Hv5kfz0+gVUkstwYzZqVjPe8uCNbCMjygLUuw== X-Received: by 2002:a63:4a20:: with SMTP id x32mr8659681pga.107.1560965414597; Wed, 19 Jun 2019 10:30:14 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:14 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 25/45] coresight: Cleanup coresight_remove_conns Date: Wed, 19 Jun 2019 11:29:29 -0600 Message-Id: <20190619172949.4522-26-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103017_382650_CF9CC5B1 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 17:29:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004907 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 35F0114DB for ; Wed, 19 Jun 2019 17:39:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FADB28438 for ; Wed, 19 Jun 2019 17:39:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 144AB2847E; Wed, 19 Jun 2019 17:39:17 +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 7946228438 for ; Wed, 19 Jun 2019 17:39:16 +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=LvzHdRvQvNqrkY0gUNK7cfYIH1 MmO1efpJeUEsl3rz5io/pgn2XB5e8DZiCUfgxpxIDa6XrGZgEGHXI1QgEyursNv2segcmHHCpMMdY EmzKLcr1KPvTv2fZpUiV6Nw+vwkv1fHJ9a8BMJv9BDN6l/2/l0l5B2gFFdMyVTvNVhj/woPO5e1zZ mgACklrfzsEJ6NZsHWZzwGSnmRmwiRkMReQBfEbu3hubRG/I7jbKz8pjRQqDB5S0kMpqRFkYlJLcM MEmXs/7/2ttqY1mUKKhQM+qpoLBIL1OvFjJBfz9wosOqWVe3JorfwyRVn+C7bipE2+sEEvtayxGXS OBWkLCxg==; 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 1hdeY9-0008J7-Q5; Wed, 19 Jun 2019 17:39:09 +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 1hdePY-0008Sw-AX for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:24 +0000 Received: by mail-pf1-x441.google.com with SMTP id j2so3261pfe.6 for ; Wed, 19 Jun 2019 10:30:16 -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=H3JXBicR3qKwyWEPhIqKhO9E+n2SNjZdvv5kd+MNp+ndBJp8YYQ68zTggVecjZcsX/ f7TUisYMZpLL1xN5ZB5HhXdr4yPy4bQJS/H6y6IOM/ZjPuJSoXsKs6RsLcAqj0EcAFAx Ik/V2xpRq4rDZiDBeiXkXsAF/3sTkFDuh6JUUUIQDG/5/EjoiWkr5TOoUva0F3d6hXEG UvENKKR72ioP7uQ5XOvIvnxjrF29/58HewOU65BA628RMD4ljxdsQKYPVJbLlC5mYpWy 54SjwI3jh1DvpzV5Fs2Wyyjw9zKocO3Vb01ygOX4KUxcKoPeGKIVPT2UJwhtzwVY6xg4 xVvg== 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=rV8SYzYaZrbZwnTYBBpa1jUxrF4clbu74iMHexyuZf2G4UXQkd0QZZsIrf2M2qX4fm 7MkBMbCQTX4EI4puK3IgcSEWvgQWrbcak/E/nPf5SfhHpKvLMVQdllPXM26chyvr3M9D e9N/qLqvepkbfb6coDQDiCRho3FS6WoaogZLGhXvgxIUOYeMc0TbBOZG721THicwf/Y2 oCC6eXqrcFKKbkVFofe0cpTVuVsS5QB2KZ7YpdRLuxZAPgMqJJzDU2mj5m2rSAPD7pdz i16KVwXyKUVtlPJXF6a++19E42k1Q42a6zevyXyw98k9JgdGBFjWj6r8nKDiccC9jGrR cNyg== X-Gm-Message-State: APjAAAUp8MVeO/uKqkh8BPHJeyEFAuON3gVaBFSP5jrI2kNkVtvbtvqX k2ds7FTz+ic73B0quP4JX9MjiTXyhMx80w== X-Google-Smtp-Source: APXvYqxZBZSGl16DYMifjpBzv6RiT8K1Auf4mcyU+D5rXiF/UIIg+UIiWWrbuLlpR3CwIvtP8D1M3A== X-Received: by 2002:a17:90a:bc42:: with SMTP id t2mr12272654pjv.121.1560965415418; Wed, 19 Jun 2019 10:30:15 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:14 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 26/45] coresight: Reuse platform data structure for connection tracking Date: Wed, 19 Jun 2019 11:29:30 -0600 Message-Id: <20190619172949.4522-27-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103017_409474_918EEAD0 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 17:29:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004905 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 C6D776C5 for ; Wed, 19 Jun 2019 17:38:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AED7028438 for ; Wed, 19 Jun 2019 17:38:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A31C22847E; Wed, 19 Jun 2019 17:38: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 D767028438 for ; Wed, 19 Jun 2019 17:38:52 +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=Eg2acs0LDQJuHPupfnlR7EpjA0 DcCvOdb0FlYUtQXXALzmzMLFY4eNlsF/8hf6Aa5Qki2xLPZ19BUIYMfo0Rf/zkq++BHhEEJrBTQfi cduW1DVMpTyUxz2tFitC4FqoQOzN03plMPrYwcCt1mFFlfxY5gLn9+Ol/60Tyr10m0uggLWA3Ugvl o3iguVxS5HPITunpXqFfDH0ozgGzqd5wo1qzRbdh7E1ygVxZ/zUqy4VCpZHIU52DyBU8PYi6gVO0A ays0h/hZ0bMplFMnG6/J+obwaHzWCjKwh2KLfKTeIB9yKluPT1mCKPZAbb9mfNEn1XG9pq4R9mKRi c6TxhusQ==; 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 1hdeXq-00084o-Da; Wed, 19 Jun 2019 17:38:50 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdePY-0008TV-Vs for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:25 +0000 Received: by mail-pg1-x544.google.com with SMTP id y72so41414pgd.8 for ; Wed, 19 Jun 2019 10:30:16 -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=s3gDVLnaHSbkhGEoVslDxwS58FUplX3jFX0dBsVGHXC3UX8i1mYysiIj/ZXLRxVNHh b+O1QIjE7EvxuW1m9Kw5rnbkpRP2U+yDqklGsvhOKPOompySs8vcYnRyYrI60+hFnX0z F3UYfgn70nXtuyNhgB9YKucZDnhq5L4Pc1X5WWsvviF4HTGw9wdta9zDtA3mQHx86Zq0 +XrS7ufku/mLQGQxD7niINeUksdfLV25psCmeWAv9R5i129lU8aXmzGVoNMqbWtwD0ZW rHEG/nkJ/GCtk8fsBBTeaF9pKHuDFA1oKbSk6Jr/zhW0+luR1OuIGGMlmAwQ0BUko6lc GU3w== 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=SCuMBXTU/aHVO+T95U3NvsA5XnFGaCbNU0rnJS96v9cqB5C5gFAmwbeyv0RHX8jk3Z vMAkY9ST4MHW9reElt6N6sFA0BaIc1du9O8XFgKrKbl06mbiphbGOp1OSjMtoY1Snd6/ tL6t9ESHI9JfFfUr41g5AGin7t30bhaY100jM129nXeg/u2SrAyMpOZzSVLZpATMaoIX rcvUGwMsIxciRRnCzZQtkDk8qTAD7z2QajKNd2++tviBvAXUyaZJMiKr8b9YUgclFvWX HNd0N6ywDYDktOxhSLoCzUmHnEiDE6wBSCpQyconeZXtGrl4XoGUplzheiMeswSDXdTH AXVg== X-Gm-Message-State: APjAAAU+lBWZpV8WywPbKqt0ci0MzBVhG8fOa/EiqTmG911tvRr9X3zV L2PfwNgg1vtcxrYEId4Dredh53eM+L/6dg== X-Google-Smtp-Source: APXvYqytGUXx4OFwTd5WLVT0RiZo8KiGzFnMYN5r+4DYkv/cvE5lC84kk+viAlUL7mw7CvIJOTArLg== X-Received: by 2002:a63:4103:: with SMTP id o3mr2784696pga.385.1560965416292; Wed, 19 Jun 2019 10:30:16 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:15 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 27/45] coresight: Rearrange platform data probing Date: Wed, 19 Jun 2019 11:29:31 -0600 Message-Id: <20190619172949.4522-28-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103017_699486_AF3C9A16 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 17:29:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004903 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 B18546C5 for ; Wed, 19 Jun 2019 17:38:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B5332847E for ; Wed, 19 Jun 2019 17:38:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FC95284BD; Wed, 19 Jun 2019 17:38:38 +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 2ACB92847E for ; Wed, 19 Jun 2019 17:38:38 +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=Uurfn1PgCYSbN99TvDIJL15D4/ i0OLiq1WhMuNZwTx8+hyOWTPPqZHNWvZbmQEtE+9NlOGlZ1A+cIWu1FsKF7YkBmlFYgzc28LBTdNx qa+HZ/f7K+9YhlTgs2NC8o2RgSpjv7P0yJq/X9LrxPGCJbXndZT+iPDPyEeQyVDZKUtnJHApcHbTD fGGnKq7g6eLQ+G8hgPUSagOueDrx9V6NR6Vp3D7JRHbrdYIPJGqZ+hPUHlWwH7IkTzgYiEOOiKX3X fkX4TzoK6nRHEiGMdERyrFZF6ACQxUhcb6xK1uyPHPRk1BbpRCRNzKTuI+ecEBUc9pD9rltZ42B8C f/lcp52w==; 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 1hdeXV-0007lx-Vj; Wed, 19 Jun 2019 17:38:30 +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 1hdePa-0008W7-KP for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:24 +0000 Received: by mail-pg1-x541.google.com with SMTP id s21so30152pga.12 for ; Wed, 19 Jun 2019 10:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ErY5wp85e3XhtR5Z0E4YUaVt5Ce9QaUAmTEfjZRCKV8=; b=UjHafWEoDz3DZuhMTjFRQGMVsWF4ASFIIsUiNhOCH0FiJIs84orobVrzd8u6cQ5PUZ NOtRf5jIBZBbO1kgmlTYCcLSRIHbS7A/PF1oAqOD2T6GR1fHtgJVBds0zah/5gnk+g7P RoN2t/4nakViDcy0jwaZepoMvitP/2xNZteGzHA9Mpacw+Muk+b8q5RCinmYdq1jsUSR 8RrQYkkt6JKX6vpuPIk2AJX51Fx6d1Y41b60lu2BEVfHudFzkfUKEjGWprsDDmedcfk3 8TTo316WqUH3B185uwZLVGFTKrtV03PueHzNwDfXTcxAEIkJu3UK1MI+EM4u2s0HPioO CpzQ== 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=ibw1UILrOdi2OjiBZ7s9q9vLmgPZLxDnwLHtUnnj61MkliGYs0QIWmsmzTOXbnMG2O hwMIqO/gWmyugaMNeZsCcOGPTlGWUNuHl48SKlb2tEofVw5PzjrAQpeW1Jf3kD0IV6A/ 89yXxOaqyJWepmsPPzV1p+1nZIMoYzFGOEZtoF3dRyAr+rrc0lNSw/XVKg8DkUhTCZ/5 Xz1H9d1jJDg38Ogg3CPRVdOFMEDTWk5dJdmsDfE/gjuqP/VTVsrMz9J7pPZ8/tsMD5Uh nBgfO8IixNOEzb4idjYktq5Ji1J7r9ZM66tcnc6JCc2JQb/EzsLVw5mfXG9d4ZpJcsYl HeQg== X-Gm-Message-State: APjAAAWMh2wDQHnuFdKT9JObsdQVwD7MmNGM//XAQdI+Ie+C7axnb3oi i4rP9akfkj+BNBvQoyLYwnqUi/G9Q/2Qwg== X-Google-Smtp-Source: APXvYqwrWE9534EWG72q0SdzBYBO1JOdODGm3LNjNiTDTSi8b/SIehox14914DN8m0c0M06HTw7snw== X-Received: by 2002:a17:90a:9b8a:: with SMTP id g10mr12067319pjp.66.1560965417481; Wed, 19 Jun 2019 10:30:17 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:16 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 28/45] coresight: Add support for releasing platform specific data Date: Wed, 19 Jun 2019 11:29:32 -0600 Message-Id: <20190619172949.4522-29-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103018_791796_43429B4D 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 17:29:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004909 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 AE36E6C5 for ; Wed, 19 Jun 2019 17:39:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96F4728438 for ; Wed, 19 Jun 2019 17:39:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AE5E2847E; Wed, 19 Jun 2019 17:39:28 +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 EDCFF28438 for ; Wed, 19 Jun 2019 17:39: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=TgNiRp4hW6FT4aXaqE1sSfzXPdhtc83qvYHIEOl67Ro=; b=PXVrbF8D4qwHObD8T1+TNYB9VU a5W+e9416NigwaSDywicASaizLtBPpUQpUfOzGlDy2s6TeXfbAV3hJ2cKZpr0h8HTenvGaoVlR66G 2famDpP6Dlxt7aURP/HlpWpbPfvKMfa/RjmihzqQ5gwNjvVEMovO0HqK9yobsDhV+dTrSBWtA2uDg Hw3WEqainiMUkAcKPdnB1cyai7Vy8/DtAHPDPsV4r+/v/SJkot627HMAGonG/5+cYOtZQh7uszAxK /kJnIxmGcV17XhNpFE10u/DlVpklHHXT0a0aqF3+sp1T5dhK2OVTq0j4CWgDMryGKBn+k1tCDltu/ AbioRTqA==; 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 1hdeYQ-0000Sq-80; Wed, 19 Jun 2019 17:39: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 1hdePb-00005E-Df for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:26 +0000 Received: by mail-pl1-x641.google.com with SMTP id i2so103385plt.1 for ; Wed, 19 Jun 2019 10:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rpOaaV9d83fotu4AxFyBdRWe6I4s8YAmRXD80aehfeA=; b=FJuV0vl27EOU1IxvFJ4+4/jLTgAKKtWOP5whZm0/yGGx0+7aom/eRNlo38YEwTXnVd lqsu2KtUjDiSRWr83Gw1NZa95h3CGUQUnrOYtPB8DGXpth1X0MGm/LKPHOSjdn7mcR5q Czssslwyute8s8xYAkB4hmiQnlXq7/EbHcagesCXnT+SkC5TH2lJ4C5C/hVovsnJGBzK 9th4A6+B57PmYjNYK1igv6gRsZWOpw7L9XbbbowqZsoQnZByGZhZEmXH1Rdgf5frKFTS sP7itO9dHMtz9xeXjCyMZK8VoAp4scton3SZ+sACR7ELiypFhrCN69d+s7Ccg2xQK94j QKZA== 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=a7dlhArvtWTJN4ae9wwcibnV0zEUtBmAbCpyjOTyVEKXLMZ9YhmTLxsgM8NUodQ+QF 9fnEt0Wvt3naxlEov+56F0dmN0TxU0rzhGtREByg2mmVLbHCe7KSNdxEbq4P/hTfZkys QmHyxyjvyzTOiXFpLYNSrvYDhwA0gbXKCY8cGvdWd6ESebA8IeXwY9ZWr+8G865tTXin SYHjhbhfjJNSnNnUQGukonY4Jh+e3FhplkbxZi34cjgUbjau9tI2JC1acfHNoavk8f+Z CyBOr2KltvnnjLyQP/xamZa1hCxMzvSerVFsVrzk7ENLHfh0PjzuGCM5s+ifaDrTEwln JRnw== X-Gm-Message-State: APjAAAWVTPkHjjUKt76SB3AvkyXFuaRnmM2CC8brA4ORzm8mKafqGnPW Msc4at6YeTGl7NOxGXisoQJhqg== X-Google-Smtp-Source: APXvYqw8GvVBCUshAybFpNxSi0vSQGCXJwI4tIOzLoSfv2YXZCgtQLvOjNdCtLGBezmLUru9dnGg+g== X-Received: by 2002:a17:902:f01:: with SMTP id 1mr119544511ply.170.1560965418518; Wed, 19 Jun 2019 10:30:18 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:18 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 29/45] coresight: platform: Use fwnode handle for device search Date: Wed, 19 Jun 2019 11:29:33 -0600 Message-Id: <20190619172949.4522-30-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103019_505547_67AB16E1 X-CRM114-Status: GOOD ( 14.96 ) 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 17:29:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004911 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 13C8B6C5 for ; Wed, 19 Jun 2019 17:39:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDC5628438 for ; Wed, 19 Jun 2019 17:39:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF8532847E; Wed, 19 Jun 2019 17:39: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 3F41A28438 for ; Wed, 19 Jun 2019 17:39: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=BYSqHX6GvtEctJPVrLl82GuaUXxj0KRDBSX+Bs6evOY=; b=oUaIfxvoWoF/WWCAd485RAIPlD gTLzayMPlR6inXIdXuWR1OlEB1CfsZAC+5BfSdH8ozmxtKXUhtUgQfZnSgVK9Ww/YnuqFbbaPz0ct RG856z8ym/PcSFnhL8HoLFcsKjisD1iCWYhu4O+YBYrjsx4SoL+X+SsFYkwDcRBIWvgaBWo7hou52 fdF5hCu1PfOLQlJVsm6VgMjC9A4xcXhuOIVstjEQHESb0HAL2LZ2r7HVVM7IARvEi1DNsFdJZSSdq N7UENvS/kAPfLpitU42OKZ+6Ws4KXJ0FC6FqsOTe+oKwGXAa9+fdQzPlacXbD2Z7xot4NnKXyy/S9 SNLX/Kfw==; 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 1hdeYt-0001Gx-IE; Wed, 19 Jun 2019 17:39:55 +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 1hdePc-00006O-Kl for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:29 +0000 Received: by mail-pg1-x542.google.com with SMTP id y72so41485pgd.8 for ; Wed, 19 Jun 2019 10:30:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7YDLpLX/Ao2epAEvhkSMe8zwQunMhzBFxABY8GfNG7c=; b=pzgvEWS8uoHUSM1xnTD37cT7HA+1BRM9oBQhLmcHEaHY7oq4p2vtuHlkqhVhp+aEtZ cl0jfFEqi9OSmSWtEOEGioT3r6UkA8QJBJJ8Vsz0w/Squ40+W+BOOyYosgmEIjuhx4PY 6JedixviT7xNLFneecMyRUtPPZmnh5sbIOFcBxcU8rXvvNL2TVDDjK82D2hJICjy/taB I/GRvrrkXdHdj0q8tgum5I9Rs/p70A1bXhhAzZAxevMO0Yi+pfYfKMdw05MSCUa8s8Wx TIkSgmIP5wsA4DUVyx0HRouxNnmXTuqvJ5Vdz8vXpp0+6IY0vq2SqLffpjNe46UX9Zhb Gg0Q== 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=FbBWyYgDHIKkoJPwrjkcTpgnjKAkbR3euqu+/TKv7asb1h7G0QQmoBt8xxVirL2zaf IazDK/GS8hpS+bL+TFJY+IKMZ1vEMV4HGrB1i6ScApWP7Yzj+UGioFDTS/m86aBEkMud r7xBFf4HPpzXw3g+IQgjldMvIqAHmeZgTBFv2s8+XglD2y+THAP2uBxUV52Ar1TwneZp 5GlJ7MqzzlEWH7iQ0vjHuIrYIdeA8vLvmWbp80oIqKb3tYRjOxzWsOchVjhWDhkcxRLV 5JM6CBDxtCoNGtkROnOlj4Hu5m3hfL+p7XouwH3hLjnoForASG77iwCgOE2A91+E85uP KF5Q== X-Gm-Message-State: APjAAAVD+AAKdR76A6Mp32bXWUdORxbY64a+m4gse1Aw+JkqPCpN48DB r1obTJmhs7Z4KUJjdQ2W71YrhhHaIUcbVQ== X-Google-Smtp-Source: APXvYqz0mgZIeKVqI04LZDt0q2jJWSMQQ7nflMIgHxlBCqrJmG54LH2fxeezcQPDeKmQymm9dkx21A== X-Received: by 2002:a63:1d2:: with SMTP id 201mr3180465pgb.232.1560965419295; Wed, 19 Jun 2019 10:30:19 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:18 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 30/45] coresight: Use fwnode handle instead of device names Date: Wed, 19 Jun 2019 11:29:34 -0600 Message-Id: <20190619172949.4522-31-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103020_789310_98046589 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 17:29:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004917 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 A08831580 for ; Wed, 19 Jun 2019 17:40:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8784028488 for ; Wed, 19 Jun 2019 17:40:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AA4E284C5; Wed, 19 Jun 2019 17:40:58 +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 60C8C28488 for ; Wed, 19 Jun 2019 17:40: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=9DyflVBjc7lcIQUHC3KxJeKJi80u0/4JxiLX1aVmVBI=; b=XQgqu2ybRrQ1dOPJvEsUgK7Spp bmSrOZwy2kmpT2Bs6yQnkhEN/OdiNlaZblwYEDLQQciR2XOSmvPES8uedCcRvLLj2xujvM8nL2F3k fNohNdXEzxWlGmESzpeHA8fgvCbdoANY1+UJ8/w3e3TmfZV7bAtwApnBAfwZXBq7oMfv04o4Fm4sU 93ofjce4MRo9gyPlRa5GYLixJhXEm9rKk3Kw6xiQtMnKhe5H8qFsUlfAWDntXAjl0/vl9HSGmEU8A QHsDB3i+1eB5NCUEjc/DzWbiNyTFHv+H47L0GQ4Ub4sIn7Xe5GZGsuqbhkBRBjPBu8Pr4Bu22EHNb UI74WPew==; 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 1hdeZs-0004h7-Nt; Wed, 19 Jun 2019 17:40:56 +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 1hdePd-00007P-RQ for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:32 +0000 Received: by mail-pf1-x444.google.com with SMTP id d126so15215pfd.2 for ; Wed, 19 Jun 2019 10:30: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=MxLVRESGWnDH2zvmmePpLBwulWSPMEeC+OC/yVsqt3g=; b=f1ofHdRfvpovqh8NrV5PZyJa0SBy37uPZ1gVrz/RcP3IUFSQZCVhfeuJ0Q08fhxp2f sMRSOFNhVj5XmDwj6+6FGkXXfAKIwZ9aom05JsV3eVugVvZjj5CPxbL51dV9Lpqy8AqU e3TDyxMzeHb3+ob9Gz5ONy70EVUduDjkzqwcFUEBo1DPaZcPDJieke0EaoAxw34sRJCU ygJNXCIqb9W3zYSVdjZbiQDBVOTVV2kFoXCWLAopjRq8cZUqbUub+dBVKsmkEqX33qFf 9556W0F+qlMYFIpXIexuCsQz9W+DNqvDPqOpGwycbT4p8ud5ZKr0a6aiZevx1T/iJ/UD 2NZg== 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=TgvjK58SCKzYIUQfMPs9yfJRlBkpv/402GYIRwea/dgC0R7TlTH0zEZy55Y1LUCved EoF9cXEfo+SStkKS+gTb41IFY82Q9mNrzoucAbSKdpDg7MvsRrAJJ62gsO8OjKRAyqt7 vmhy73Sc1OFM/tusVJbcGtekTUnpkf08MLc9TLSHCNfD4ceA+GIaK0uUPw5sdJaQd76t gPlftUqMS1zRLHFJB0aB07R7zHx6uJNtOc9UpnzDHfsIrG+Eab6sDMg1FtYjuKgZ566Y mAI1RWcU7DPdVsGCTe9l15Lw09cC6xrfysEonoqVQBxQPZG4OltNG4w9Ueq2L1Uun0TJ RZyg== X-Gm-Message-State: APjAAAVA9MIpzvuNoBC8gu004P9yx/PrV6J4LS3p0vXiR8VdoGKtOmk1 feYQ0ZJMSiJNO+pC+9VemIrT5g== X-Google-Smtp-Source: APXvYqz7HoxJHj8IkWoraRCg/O0Cdomj13Im+gcmlTEHm8k5UhSbiQ1haJCdfPOVld/8Tf/Jlm5CUw== X-Received: by 2002:a65:6204:: with SMTP id d4mr8667691pgv.104.1560965420377; Wed, 19 Jun 2019 10:30:20 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:19 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 31/45] coresight: Use platform agnostic names Date: Wed, 19 Jun 2019 11:29:35 -0600 Message-Id: <20190619172949.4522-32-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103021_976036_E45FA8A1 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 17:29:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004913 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 210F814DB for ; Wed, 19 Jun 2019 17:40:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09D062810E for ; Wed, 19 Jun 2019 17:40:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F13E12846C; Wed, 19 Jun 2019 17:40:20 +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 641CC2810E for ; Wed, 19 Jun 2019 17:40: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=VrGkGlGxjBhwq571MHpxpX5sZq c/SEpQy0tAG7ocJzLTh0ozT+s395JWUraiT+/nwtNuLXwZGXUcZQsc4FkVVBR7tazjWPWKYyGSG35 3c3NfEZU08mRZok8HANra5Zjw6s95KDyWY/GauBKcyfasp1ntYnoLLBIeyLGgGu/o++z28qJ0U+LE 2wnpSVCWGZVTMHodsYJufGLrK6iOmV8osphNDYh0obC+j21OelD5MJ0l+i2gd/ZNWfYMfzRQpNanb M1CKon3kE/pH1ytVVK6l18xq4tAgvBqfCUqgWbLQ1JSKe8JtZF3NYKIHU/x40A1V0raCdiYeXnONO x1SvpbkA==; 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 1hdeZG-0003XW-Fb; Wed, 19 Jun 2019 17:40:18 +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 1hdePe-00007r-OX for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:29 +0000 Received: by mail-pl1-x642.google.com with SMTP id k8so99688plt.3 for ; Wed, 19 Jun 2019 10:30: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=3eeHPEaBB7ibPeJGVTZBxrjCY9Q44woJ91BY0XbG0Qw=; b=PC6Mqnlfe+IGFJoho2q2hvurUCPsd7GTu7Bk6DYjliF+s5PVREROrFQtTRuSYiZ6s6 ePLQxWI8REQJU+xBffVM+vZuxABk1GWua5iouOBOuBNFQXE0j93luur6y0VVfmRR9QCr 1yRCeVydV8uwfmTLk3Lw9P0s/g8rM90x49UsVfsITQ9rvUTZbPNV73ge55XFc5/dRdpj lC6AlJFW0XkY4+gRJmKVESe6Jt+UC5NdGyFq+N4lSmjj55FN0NP4Sshih03yy7Vpg4yx F6bjJzFJ5pbC61BGlxacGgFHWFI+g+y92iVpgohocuJFjeFOjbVWnAMSnIKpx8fSPzfn 5QBA== 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=T4TcICfZCjRwEVjuOOdCiXFpDCUFH9FhftB0ta4vAtssyWE9+q37zwmXyqJYpJ4joy yRVgPYs4ZX4r1Nikj2w+nIcJ+C2uLA6E1Q/NblG3pzXXeAO+MGiwKSabBHDheATfG9tI BhJ/xbYRIjkGPttxcGaaBVK+Okrovn3/HizsStEAYK3FUnxFZd03s/RZax+LiX886jSS ORjM5a/Gpd1GMrNaJHMEKz9/sViuTMGX30JD4CsbcuGU14hUdGaFU/DZ9I+GrKN28BUk cs8Kwn/EFTsR6h0lwtvsnbw8YZQFYgsppT7eq9jyqz1OX+etcE0eH8BznJxD5iL8hjrF 3i/Q== X-Gm-Message-State: APjAAAXZEUEKcd1v1j3yORaLKpi1oDMiW/QI8we/IXbkBWwNb8EWjkj+ HLXuy1aioWE00Iu73wA2C7G/RA== X-Google-Smtp-Source: APXvYqzJd+LEwjPQQBAjtrcJVCHtg/1eH6CQB3XJj7f9G9RkGVHFwfLWTEkVkxc9fdee/rMhRp1mhA== X-Received: by 2002:a17:902:aa8a:: with SMTP id d10mr83675207plr.159.1560965421449; Wed, 19 Jun 2019 10:30:21 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:20 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 32/45] coresight: stm: ACPI support for parsing stimulus base Date: Wed, 19 Jun 2019 11:29:36 -0600 Message-Id: <20190619172949.4522-33-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103022_889283_DC955B3D 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 17:29:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004939 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 B2BBC6C5 for ; Wed, 19 Jun 2019 17:42:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B8501FF62 for ; Wed, 19 Jun 2019 17:42:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E946284BD; Wed, 19 Jun 2019 17:42:50 +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 6167D1FF62 for ; Wed, 19 Jun 2019 17:42: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=eeSksW/0oLQSTrck0xrilNxgck1/UnTIgS+mZaskbzg=; b=DtY9UMKAFIdf3Z7LAHnex18nAt 4iTWQyyqTgAQE0qLxOnGMDqWpOyPWOG+35DU7CA+hZFQjh+MGP5x4Kk4wgRDMh3VaUpEqxAu+kK4y BMhCIzYkeaDuNs+I70FLC+UZPo4txk1fSMYTX3n+v5PAswxiWphaT0fCBt1AU8FgE80fKov343tYK w1dmnuWQfgiEblkOmcm4HKyIIzxy5gnXfcMPHUkIRZEAp2SC4OWLeAOLT3y+pBd6BgcZLASpkjlIv MaiZZKjistZqdRlbUcPgxYc0H2Ts+I/C0O+UEi5BLLc9dwQ+xLuYexmvttyz9w6inFQ27AFFgA1+T bkpDgb9w==; 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 1hdebg-0006Nd-SZ; Wed, 19 Jun 2019 17:42:48 +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 1hdePf-00008W-Ec for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:34 +0000 Received: by mail-pf1-x444.google.com with SMTP id t16so10147608pfe.11 for ; Wed, 19 Jun 2019 10:30: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=wGRvmzNJ0evrnLywjNiC/f2VpFf8RGJN+GMZoDDi1RE=; b=AKTtcy+1yM5KwACmXQyNThWf5Q0iA5/OGSNl06ZiVLokwnrirVXUswtQdC1AzNT4JJ dOtCbj8TEWtdKr6y/CfybCOjMDn6ultqMW6nTxl0+Rmuk6ZsEYg7UrcQO5S0Z2mf70V3 45SgEKMGXV8ykrvR9K2FDdMlpimvpLJDWgHL7Xl8iFAzA/ZJRa6r4lSl7BE/jNcWsF9T /Ydx3ZQDDsuGA4E7CCyihWRNRHeG5KqrdL28q1TCMH1wyowqq4ixbMsE0M/j53wh1bcP UWvvwKZ4/niha5jq5zOsi9QLwck2er5ySOYmzDxZ62aQxrn0WAtgTYl3I5Yupjc0Ew7O fb/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wGRvmzNJ0evrnLywjNiC/f2VpFf8RGJN+GMZoDDi1RE=; b=pJ2DBbBt81oMfO9DCBQKBbb3isOElFyX7vZULt5c4LSBz5W6S5ZFDVfWl4wSEfE3AZ fcsAlOt4sLq8pYYJ4eEVLl/zVU9yyIKxUs0wIvz212X2iE+fCNW64GhNdZXcIqOUOPJm kBp2nWJPNREPLEvAoSQbAaOC4S+Orq7e6ifWeBYDikWe9HIAbtvK4dfM5RPqOObgr43w KvOWN+N3j7Wwwyz7WzpqBUuRyNL1yKh/mGT8HwOIcglDfdZE/9WVFdK67J5ypxmYjSJI W+c3a9hTROgvFVF4OYpWveh24wtvZC7swfmXQy9aJsVpqEzgJgoIeY+BKEOJXW0AKUUi HDiw== X-Gm-Message-State: APjAAAU3wYcbO+BvynNqgyclbacEmgj7oMA1QQ2VyWBwHQ2D428UnTvy IeEDRopuaq1b9hbFC32SYuszRpkmmZAzgw== X-Google-Smtp-Source: APXvYqzMWpkfkiZtdxhn17c9r2i6AorU/oXQJcCa95ijgh5QRrDGn4SiupMQJzIFB/eac54IL6hGcg== X-Received: by 2002:a65:4209:: with SMTP id c9mr8966027pgq.111.1560965422367; Wed, 19 Jun 2019 10:30:22 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:21 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 33/45] coresight: Support for ACPI bindings Date: Wed, 19 Jun 2019 11:29:37 -0600 Message-Id: <20190619172949.4522-34-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103023_704022_6D552057 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 17:29:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004915 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 04F4C6C5 for ; Wed, 19 Jun 2019 17:40:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4C0927CF3 for ; Wed, 19 Jun 2019 17:40:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D90182837E; Wed, 19 Jun 2019 17:40:48 +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 8045827CF3 for ; Wed, 19 Jun 2019 17:40: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=wleYmFdcHrd41WOGLSVfpca3NCayJt4gz22k1/OjGFo=; b=aJHofjXY/zMXFolOdJXKaGn/OC OHFE2aurQOjZ1MQoFq/f6xrnihiLFve0jqMCSIIWzITK+noq3WFn76XtQ290UW4g83YUr5y2JC+9k wWXSvUcr0zqyDkoMkIP6TOvIQxxaXneZ5D7WwDMP3Ouv/HXe4qczj8ZCQpQXxNk6VpHRNOoscTQ/4 zstXuJgLXolw4TkkD+5405+GwjQmq8JWMUSJ3bejXvBjdMMYbtCTPJKXO0aUMU/BJCdYBEADZavHr NvP5uUSbqSqum2wvxiDq+8aIWAd5DETUMOpTgnqz7gVe2b7yw3e51N5URD/xrOdfLEp7bll9tsxT4 HqnXrKfQ==; 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 1hdeZc-0004QZ-RN; Wed, 19 Jun 2019 17:40:40 +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 1hdePg-000095-06 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:32 +0000 Received: by mail-pg1-x541.google.com with SMTP id w10so44032pgj.7 for ; Wed, 19 Jun 2019 10:30: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=XhEC8YM9URAom24Z8CuHErk7aYgxQCn+3C30lnGzOD0=; b=INO0uopgOi0JgJhTO0TId/Re+Vi3mREAqkuGTw0BkeARuGHwYbfTjBG7eDUoACbb5K xiXbNyqM3g/DeBJNXTl8pVyrb6bdZXpo+tIDv/iHKZ3k6VRg15X4eXBHx/Or9mICE8oH LdfvjmSO7Yp1kKdUK7O3T+wTOOg7CbdHiBFh5yooxdPgV9WCuMdXs4NeJzJYAWpuCT74 NR2PphB1s9SvYa1L11dGGV0XqbMLSJtmhyfaWwhh4JoKlAZdWmiRtk35IS0vA1Sx06Ki mOWmKxVZdTQZgk2zQRqvFNeYHRe7pJ3WZ0HUitP5vmeyl7gMbILNivUuF8w/cQmyY8GI zDPg== 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=bOU3Q7PSvBmDQiTqdundpWJ0nqxKKtAUt792N1425Z6RM3WdjWq+IeXQrMj8nx7Zsh iupxJATYBhM+XfjCwjATNdsonI/Z+wreywfWn8cXkk4nxrn3AeALsETAStFUzoJAU/Xu Xk0iUvlbZuFEDJP2uhgTEzZbtgRM4Rwinyh9GR1iU168VPIuS/h6tJ3LR+xN2yWj2UC5 FtDvrVBtTJA6TtZuChtbCPXps1nOZTgN+ZCZTpvraK1en0WT7r5H/f6KZlR18+/aCFfB 6CehJrYArLORCWiWrBBhBOuXifh0YFde/jqwFy+hjfMjMgxqigvy8ry+6exsimAd2FSa XGGQ== X-Gm-Message-State: APjAAAViB9QECZ5cL3JIsn9QFsaUErafCnINJO3uaG3l+E4p5X/0sNH/ G5bxNaH2ECV8oqqZ8qMtHiCq2CsmFZ+PQQ== X-Google-Smtp-Source: APXvYqy3F8D65mfy3WqGNn1SEUNv2TTp6VRpdRj7wHXQeBQ9Jw9xAi1OB+qfCmnguBuR38ONiRjNtA== X-Received: by 2002:aa7:91c5:: with SMTP id z5mr35274878pfa.34.1560965423435; Wed, 19 Jun 2019 10:30:23 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:22 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 34/45] coresight: acpi: Support for AMBA components Date: Wed, 19 Jun 2019 11:29:38 -0600 Message-Id: <20190619172949.4522-35-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103024_088875_0BCAE8E6 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 17:29:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004919 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 DE58E14DB for ; Wed, 19 Jun 2019 17:41:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8AA428488 for ; Wed, 19 Jun 2019 17:41:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCC63284C5; Wed, 19 Jun 2019 17:41:52 +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 5347C28488 for ; Wed, 19 Jun 2019 17:41:52 +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=f3I0HvuqDlbFyCiF4lJKQrzNVf z7QW2niK2pFCgxOHYarJ6X/vIEL5dO/z5kwTwyPqoKHT8ggcEDukrQ80cucvWndbt+LYbOJAa3gQK 6XMMKt40ai9d8A2Ms4UJ5mZEL2nIDL0gZZTcbD4nkM6TzQn9GY/FyvEIhQijBaLDX1cfoBBrLsuln 4OMdh2Lto6bbSKS06RF8p9CLsBMDM/i6oyyIuUGqjRt4OqW8lXEbWKU26YFrsXwJr8eh4dTRQuZ6N 6fmmnEdGdivE0FQT+kRcXFsm62Drv21N1lVLNjU9o1XrjJpocuCMyKR7zcxvdMjKN/tXvDM8I0qJz eBVPqE6g==; 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 1hdeak-0005Z8-ME; Wed, 19 Jun 2019 17:41:50 +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 1hdePh-00009w-1V for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:35 +0000 Received: by mail-pl1-x643.google.com with SMTP id c14so106144plo.0 for ; Wed, 19 Jun 2019 10:30: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=f6b6EF22LZj9j5GmFlrz6dxNen9pTHUz+onNfHBegq0=; b=ElIPXGxgNK90oGAeKnp1F+vnvFzR095a4S4NoiXEDks3600RRaqzGjWkpRRrfEvbmj ha4UARUqJ78/py9st2e1/lEXJR6LBVpIDEHKNcd/YqWKrokRUyX6cd+5D4LE0iy6lM1h w9mQGzBDqZCUGDCmwFMVXNZX56BneGXvy64Kiuvwwj4Fa87ibJU63D1S7yp6XERQg8Ay L316uCN5SYHweOAaH0WgQkVCsVMNnNpTd+qnXaLXBiJ1GSxbedSJOHmhlEvqg98dLI+W SFrLrauH30K+fzW4zgxkd7vPn5i6NdDiJwJ2eFBNIrb7qGQGWSDXdWX+es9W3l4S5wfF TgPg== 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=QisoOx0UpGkUy21A+ndv3z+kWK0ZlW6VoNrjmKQxrXkGP9K9VrW9HiLzjeY4IVw4sb +I7mcrkhcTgfD4iYD8MaaeyHvzNdskt78VQZFkwXmRONlxbxpcidb5uY8FvaBn9tTy8j ++NwzIuKU1jmQ907Jo2PlxGw1ET3kTLf50Rng4aJK7xpwEc2Yjsc5oic6Fd2hIVyjTG/ tmTZGHPgwyFx3dqpqWrt3xnIt6gWuI0nLXOYIhWtU/o0cFOHru4NHfNlfbDJaQQmqXZM uU/YohefduvpU35WJSUoQVHvTW8tXlzu+YObvvnok6+TuEv/OPJ0qVmtojuLv117C3qS +50g== X-Gm-Message-State: APjAAAW5EFZxAqk3ENbouga7woSXWZiv2xyPnGFthl8SPjMecCzWZu8F +L4DWiRpUg/3jRhZ9hympX9j4Q== X-Google-Smtp-Source: APXvYqxXjzug4NAMBjqidGI7fWaxp5Wyur1jEIFE4NwUBFSZN7xr06lmY2dRJ0Dra5jCHSVKuVBhOw== X-Received: by 2002:a17:902:bb97:: with SMTP id m23mr54159476pls.141.1560965424299; Wed, 19 Jun 2019 10:30:24 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:23 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 35/45] coresight: acpi: Support for platform devices Date: Wed, 19 Jun 2019 11:29:39 -0600 Message-Id: <20190619172949.4522-36-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103025_196722_0FE1D6CD 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 17:29:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004935 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 1A32714DB for ; Wed, 19 Jun 2019 17:42:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 046AA26E55 for ; Wed, 19 Jun 2019 17:42:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECF21284BD; Wed, 19 Jun 2019 17:42: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 7C8D426E55 for ; Wed, 19 Jun 2019 17:42:19 +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=R2N39/9I7SijaNBl+v35EGC4mf IPuMKh5ZA3v+xJ9/n/FusRuUmPl7TnEedWVwMtnAFis1wNn8tOkgc2O1QnnGgyKpbbPVAxdKUphKw uhUicFvFY31cTzEr5PgUt4Bg9F0b5X4mNFS+SUZeLOn0Mud83xsDSJxu9qedGKa2xMhzYQuzLtf6I v7NMPFAAC5wnvG/+nJBhz1UPpqE0s7L3fafXxSrxqlwRZfsZQHTkjDTNEqpPpg3rpQPUVnvtCt4oj Ly45PDt3XTD1fn1HCYw0cg92WXPYcvK7vWGoSI5Yhhv9A457rvKJL2x7+ltCw0npIbOBzSYvN1ITC ynvgDo9Q==; 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 1hdeb7-0005pU-2J; Wed, 19 Jun 2019 17:42:13 +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 1hdePh-0000AW-L6 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:35 +0000 Received: by mail-pl1-x641.google.com with SMTP id ay6so85444plb.9 for ; Wed, 19 Jun 2019 10:30: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=TV+NMprqoFfwSyp0QoUYpBDwrINgLFtHUcekXEvVDhU=; b=sBpo5CFqXRXLDhCv8y62pUR5V7GZgSVA03X0GZk67zTB3ho1ducCBLwhTvly1KHNmh i/YwqSfZgrBOl1sGaeY1mjoOuWmA9tLRkSUFLcHTr6hwA/UV+ifx2dW9u/4WQKHWVD57 3iOp0gDsitnJQpoAMuvZDN1JvIhAa1jdeFu1Ml5UdCAFolGgOaaoD5JHVS9gEly+ipZm mG0KRE3KC73UFd9aHq42rZU0STVGjdvvZcmQtu/Qzz2HlYDBkhDB2hZlYuYgxi86U50W yBHen+fjXp1WSGCiuGLjpojnsGgZ49HR/TscBoVQXnSaGjFseAiRqSTmtol2k2sCH3pT ez5Q== 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=QVfhdml6aK1K+zWhvgnqC0QHSwgzvPZgziUgtj+Q+V1+k5qWuchouYlxyHOTB5K4mn LhGAsgS++V4SfFtcpF4ZN3Hf3e6UTi//5YJh+2kWMB+LB/sAW+RcPZj3pgsrZVHTP5tL mx7N5vTYL+aJIKFrT1gydGn407z+ORlnsVQzBmOwEReOnwlRusaZkXTf30eybatOt7BQ axvV2QgQoX+uJSLWJjT70EtlFJcXB6ROvbnN1rSdIzSbnlncyKg84RTeTS5dwCTlGUB+ Bfe1UuQZd6I3V3UE0Sg6pk57yUdgH6DjA/D2LwXp6u/i2a8eFSIi7SnCn7+iLJkqbnBB LaTQ== X-Gm-Message-State: APjAAAUqIaw9qb1f3HmzFJ4Q7CPmXlDU3K3XmlWpcyIpGi4j6CvoE1u4 8CTXusCwJ2Zh/MRSUIShuXtwEA== X-Google-Smtp-Source: APXvYqyfMoUypJOJ2YTeNWcgddITRAmy7V80Ob6ua2a/Ytaw+9PXpgs1DsivzdeAO+15b11X851YBQ== X-Received: by 2002:a17:902:70cb:: with SMTP id l11mr3381579plt.151.1560965425069; Wed, 19 Jun 2019 10:30:25 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:24 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 36/45] coresight: Add dummy definition for of_coresight_get_cpu() Date: Wed, 19 Jun 2019 11:29:40 -0600 Message-Id: <20190619172949.4522-37-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103025_783212_389B39C1 X-CRM114-Status: GOOD ( 10.75 ) 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 17:29:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004943 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 D942714DB for ; Wed, 19 Jun 2019 17:43:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C41DB1FF62 for ; Wed, 19 Jun 2019 17:43:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7E19284BD; Wed, 19 Jun 2019 17:43: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 56F641FF62 for ; Wed, 19 Jun 2019 17:43: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=y8ikfQO94n3bsaAswX+Etw0/eBNzID98aWWchm70IJc=; b=P1CCmS34muGfcfHYaYtMIr0yXR Ti3UzTdrJ4v//MnjsJEhx/+VgNvkNSM7D/DFLRqfbvTV7EmhqOShGMEw2PtiTn0SpQwTE4OA9QpNI XjRz4zILlwEVdenu55yEA7ryTvE1O6KuuwRQu0OiVzLRLFxMPaJSGjRF9xEGIXySbQdHVyhWnGuW0 duEr5RRcPgCpw3OKWsByITEpmFjhIXUHBN06GtVGkt9+ibFoeVhGuYW9OPrZwomIgIMoxgJGngPoV qgo+KTTsUgpNAdXIQdjf8+Zjg+rDm0uypbSJ3xcOC4gp74W3inJ7VWQBZPie6shebuwEcr+rF2Aiz bcNaYYIQ==; 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 1hdecB-0006qd-Hu; Wed, 19 Jun 2019 17:43:19 +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 1hdePi-0000BJ-JV for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:37 +0000 Received: by mail-pf1-x444.google.com with SMTP id 19so9519pfa.4 for ; Wed, 19 Jun 2019 10:30: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=U+080fyAUiTJTh9JJ5MaKbNtEVXayYcNMjeizWilaNg=; b=jjvjrf5em+qq0b3ji52nC5vHMkInyqu5hnwQOPG9S17R16YxILUdkig5Ydtuz4YcjF h77FBhj2WPPXa896Kk0/m45lBfpne0f3MsAQDLJu/cH0IuIOeJk3PcFkt/2gK7aK5lYJ 6B9t5vgr/LanC4CixUjQQKLKbTZ6nOQ0lPruTduia7vxl1RQZSz1H5ynxzHMsnIcTXIQ afnQthfdkSB97VO8N3bGxfwLrq/HRCpLPAPpKZEEX1aEYLjl7EezhQegk7nMAIuEip6u 3exs80H5637eNy/Myd0/T5L/60/dF9P3KUhxI/sb8DfnE+s8md/cMQCfC7aKieSyCLGB pP+g== 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=CThPfm0xWFQ9sopsjErUWvg5MdYh/NuwPRRZ73pNhfE0FhZUlG8/lB6p2dJo5XYuWI r0ymbEsAV28CiPjxS2HgL/GVPpF2AwLwEs79IbTA3222xnhUf+inmRz3qqH8pMePWllr KrU6wlm15cW8g5n7I64tbcutVBC3uk7kVvfpwM/L7XiXG/ToApqy7bZDjUNTViPM9jt0 ixsVt5cPHlVe8H26ZQ/F1xJ3nooELnW3uRx2o8ZgOxVhlqaMm7L257cfv4jE6dqw6PL0 vGe2mvk7KCbvierNY329nfttxhJ6P8LF4fsRKkwv2Ta0gL+J3wobTGMtMXE10K+g5enw ORZA== X-Gm-Message-State: APjAAAWfT2B1R4JiaVMHBl6N0qbMgDvaOM/ZtX2vNRUq2/LDBxO4xiHN oW7z64JTh3Zdtlnkt6xL8kkBS9Z4gVKmxA== X-Google-Smtp-Source: APXvYqzVPrjgLGfAVwOVdWEtbQqYpnhq6yQqdbRbo28+kOI9c6oMo5bIBR/9f+691D20t7YLyzt+yQ== X-Received: by 2002:aa7:97bb:: with SMTP id d27mr59024903pfq.93.1560965425897; Wed, 19 Jun 2019 10:30:25 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:25 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 37/45] coresight: tmc-etr: Do not call smp_processor_id() from preemptible Date: Wed, 19 Jun 2019 11:29:41 -0600 Message-Id: <20190619172949.4522-38-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103026_736955_06515881 X-CRM114-Status: GOOD ( 14.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 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 17:29:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004941 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 77FA914DB for ; Wed, 19 Jun 2019 17:43:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61EB11FF62 for ; Wed, 19 Jun 2019 17:43:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 563D6284BD; Wed, 19 Jun 2019 17:43:04 +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 29ACC1FF62 for ; Wed, 19 Jun 2019 17:43: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=+Rm6Lll5Wss4K714CrfmfMfsLslb/P7xm5UNw1baPJ8=; b=dc1eETHgt8SoIHPCiXtpekYUI7 o+q6F45r36ipRpRdDL1+0QHBs8QzMP9RTliobUJ2BFbcE7bFeOhxikWwmhNK/9pzknCePR2/c/nlT jOy5WSKkK69QWEVK6bCOWmpnTTACEUIklk7Jtl4UcxF5gMCnT5u9tfhdrGRF0Yr92Lhzps1FItF6L +KNaduPjR1dmX0v81gShuqpAF5WytDXa/S1sfGklZNXW9OFCIUDMIAzz80xYVrBsSw/P4OAol1jkt mh6x14aopCTJY+GjVIoo5KaoeU5ONJ2/HR5L2ArbkBuEdYvd1PWvVlJevIrT1IHPbd6edHO/3nyaP hduvBqaA==; 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 1hdebs-0006ah-TZ; Wed, 19 Jun 2019 17:43:00 +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 1hdePk-0000Bz-8U for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:37 +0000 Received: by mail-pl1-x644.google.com with SMTP id m7so88744pls.8 for ; Wed, 19 Jun 2019 10:30: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=QfxiSC10lT2kIdBoLtEEdrvPoomT9IvwdXsx/Fv3PE8=; b=XraDcixbl8h/NkohNV2nfG35sBDr0DZ2cSITPZnIa74aMsdfJHiDZuUId2iQVNTC9o Yirw9nHY0MJjcOLAWNB/QrYV7YAflDbVsCxf77+I9XCB5G/QhcQnE+HjhKBKedkWRHIu zUquCKHidxTWR5fGAO79yKKblChqQEuE3K3+DiwiEq5dxU1MZMKH8tEGFmp+E/hXZjZi PqP2jOJAtgN39O6mqprFYFnoREi0kQcwspinhKTSeX+9tUsfpcaaRJPeROReA1ajZz0s 3TKVXnkOk2+gZFdVFPt4cm+12fSlMz7DvUKvuAXsenHvv+FOet/P4rbbJFVpifDVtgI9 dcFw== 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=eb5BcM7/X87IOkjJ4VlCI3YBoyLw0zhCJDHSOV7G2pp/Q4YNEQ+g4CpxD6kyHnwJjJ mrNNzCwcrUwjLcsEySYLYf+Gi0yAdtHz1ZQwxT2qdW2DPtzGawkdbKU28VjfwgVTqLIp B2DCVSWx5efd0NgfHwLbKJm58SijAUXGMAFhaiXVNWG5haCzvOYXfnnEw8/xk3oqoyDN cO1C+l7lLd86ShvdKSSRJgs9nOOIWqPVLJuwx+klv7TrtVcr9VDd+T0f1KRmQP6WovMq UJ4q/ReYYx0v/wruD2tu3ZWGuLiPaarnWi/JGM/WLIWe62tl8aJTB9hFR4OziDL2UMuM pSxg== X-Gm-Message-State: APjAAAXFrB4zoclAjwAKQI59OkaH9XKlzCJb98DbdfbByFNHKYz2ACS6 zyfn/2QC85y7XFMWV45QJCfDrQ== X-Google-Smtp-Source: APXvYqzvFYMxudXhqXZSGVnT9cZFpUcPOyCa64iYGpJprmqz0jdGAFN/MbgpQNtLUWG6Xb8dRIuvOQ== X-Received: by 2002:a17:902:c83:: with SMTP id 3mr62342581plt.326.1560965426835; Wed, 19 Jun 2019 10:30:26 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:26 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 38/45] coresight: tmc-etr: alloc_perf_buf: Do not call smp_processor_id from preemptible Date: Wed, 19 Jun 2019 11:29:42 -0600 Message-Id: <20190619172949.4522-39-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103028_471942_A73BBA69 X-CRM114-Status: GOOD ( 15.19 ) 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 17:29:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004955 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 6439B14DB for ; Wed, 19 Jun 2019 17:44:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B80028528 for ; Wed, 19 Jun 2019 17:44:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A3C42858A; Wed, 19 Jun 2019 17:44: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 C246D28528 for ; Wed, 19 Jun 2019 17:44: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=I3kNfH7AEn9Q2mcGoXiLSeK083Dx/fz58N/mPL27m10=; b=d65+cyOvQd/jkrQqlSODZMCmNv lt4eCSeW/v72y5/gJkPKHFBDvszD3Y1qv+l+K2sJrNdD4/CrbJ08rQZb8c/o/juiRC12jUQDR+VFc MnRU7qBS/FSurnqn89G4udbdqt4bwAwUtsKljlScR7PQMNZzYt0oQ3hGkDRxIOZQErI/BBnj6tyZs nhTWx0eyo8lwr7hibicrvDXSnYxkcVYLWTDlN4PMjUNvDlaPYWfEVY5eczvY1Hb42KV++oJ+ZPqRZ 6hkptDuBWY5y1r5Gv61P5zaKQYj1BCHO6bZMYy3E07gZm6JR95MFt68CJCEX/OR/oOav2BC//uOw7 BXifHC2g==; 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 1hdedb-0008Op-F5; Wed, 19 Jun 2019 17:44:47 +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 1hdePu-0000Je-31 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:42 +0000 Received: by mail-pg1-x542.google.com with SMTP id 196so46774pgc.6 for ; Wed, 19 Jun 2019 10:30: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=UC0Qh+uUJVyhwc88NCYhgwMpRvPxciHY87Ex0aW5HaU=; b=qaLf13jk+477hT7eRzJ6BA2cbH8hzJOacy+9bDkAzmUtJS+GkxOk1SHZiHVbDsdkBB hybmfo4leNktsBRk8HvD66CTq+G2UfJhhB3/7ULVyZzvk8fbEqWPV5uKnSI/t3d9JMuI PrRi59JyVcxVUXJV5/Sc4l3mX9MShuGyvkW0grVecQKjY3R/8pYHo56RYl4BmgLzuyD3 tontbQUq0DamVbPeRKl+4WGhXYdodA41QqvUZLjHFQ2CMgV90uCEBEkJpExHs5DQp6Ww JEcT/u++Kz+wOtvPAPV5QRPV+Woobdo4c4e6JzL9psb5iczi/sEUyYtQBKc16o1ioe57 KslA== 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=akQggIGTs3TRFFe4597+mHAilKORbEWCMwD11GfqBSNslVFAyn+S9QhUCfWPGXuEOx 2ZIOpEhDhFzVuPKMqK0fqV/ntSHg/3NwFF/tDnx1tpzu3NkIrEzA8vF/R2jaQmegUzax uuxmxSF7sEYDBlDZM+Ml0yqraWFK2HE/luIoSYP8CiTTxzN8bMwhCxH0lZfE5JefFX90 C5XBUo6TPIWOYwsDBs4WHUGSZ1F5hExE0++uCx3Tweqz28LpLeSftJLhz0mAnkr7y/eW QqcI+NMk+uA/06riEUsuIZDqWebT2baxok/kpor1Z0mvsiouZhUKmnwpNbNpDL89Jdxf dHYg== X-Gm-Message-State: APjAAAXrb+1UhCcH+IOLowwiquAE8Et+JnJfaAeUvx7gmuUD87BIrKTI CVkKFKISFTYlHw/z/4RV4xhl84+K3KM+/Q== X-Google-Smtp-Source: APXvYqycSYlKNwH8NHrVKea2BMaHxAxbe/pH1NC/7ZyOtbxnUZ3MPSIvHnbouAKjQo6yyp+rICIbPA== X-Received: by 2002:aa7:8dd1:: with SMTP id j17mr11540521pfr.52.1560965427796; Wed, 19 Jun 2019 10:30:27 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:27 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 39/45] coresight: tmc-etf: Do not call smp_processor_id from preemptible Date: Wed, 19 Jun 2019 11:29:43 -0600 Message-Id: <20190619172949.4522-40-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103038_217801_8B9A3D0B X-CRM114-Status: GOOD ( 14.35 ) 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 17:29:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004945 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 5A4126C5 for ; Wed, 19 Jun 2019 17:43:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 446611FF62 for ; Wed, 19 Jun 2019 17:43:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 381DB284BD; Wed, 19 Jun 2019 17:43: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 DB4D91FF62 for ; Wed, 19 Jun 2019 17:43: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=o0Gf3YtzLBi3PKWcCxDb+wNfUkrquMhEWej+RvZmURg=; b=jxnf2iwyABta8sPbei9r/bhjtf 7N9WQ5/xNuFqqS9hc8ILHC5oWUoJlyfmX+0uXNjQgUTtiytIwB6KYFRfjEAaJV+VzpYM0oRlE/BCu SUhUidBME6qVXWPlhAOMexf/gway/3qJIEHX0H9hUtoyKm8mpHVdUrrhK1taK3sZXjuP4HDv4Bv/+ Git/l/kUPOqgro8/Uu+PRzLBR//6JGMKGLtS5lWm0u2OfgBjUFblf+ujY+pDBi9pijyrP3/9lo+0z qyeuNPnr9Dmnr39FAL+HZwfe/xeseeSbc7sE+tPXX/ARKqAfqdqkUue2pZpg3ubDsl7Wo2jERZW20 LS3ZMelA==; 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 1hdecN-00077B-6U; Wed, 19 Jun 2019 17:43:31 +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 1hdePl-0000Cy-Tk for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:37 +0000 Received: by mail-pf1-x442.google.com with SMTP id 19so9587pfa.4 for ; Wed, 19 Jun 2019 10:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=R0Wh2bB4q/aIbgHc3QWovDYztq8qq4nwX/0TMGUqdNo=; b=eGu3zK3e/8xFK+edBUESsVbviEGPnxWRdeQ7QHnxit7Mnua3cmct4i1nZh5+snnEYU +XsVjSBnb7JS9peHUCNOQQ9Aa2yghbPmqPTSZBkUF7HapQfa+EnypIeNzn7A8bSEOU0I OQr9KwCQ0AR/TExSHx93y92X02LxEfek19X7wdxAsNuO6EBh09TehGX65yzm1zgGl876 jnlvvvFQ7EwPLVfAt+j1h6Ruib/CTpfhE/PTZn1BW4ujABAdI+5eFHBZ+my3k6o3hawZ VuU7X9o+zB1VpPdLTXLJo1sbAN9JWiCh1LBEDQFA24gcKX+s+TTYwEaP8jn+B4dmRVif GphA== 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=pRSK3MBZjGhUEJiDp1ia1V47/3ds8ohmJkQJvsopD9OUWA0Wi0iF/7eRd9w/kakI0/ bs8ZwPoulo1OKggxOB8Vu2LPw36bULooA+5XS1OVEaBdv6zDSbN67aB+BSS4Naj5ddvO Q/mDaEtjtsKdmoiyy6G8K4rGKzNzL/ruSmHQrWFqMb6lqalfdR0qiTRCT2ccqwY5Iocc kIN45mxbO0g4n4LKvw86+lHUY1YOFLc7YzaQXccstYKoRbFnfVVdM6S7qUC9axGIG1tv a6/NUsSO5r1GsNqgoaezwc15umwT3xhgG6U8QvylHRQ0iOxtAGa8bx5brurzlkU+nyOX P5sA== X-Gm-Message-State: APjAAAXTekAUsuSSCcw1b3su3NBCGC5EoaSJDMHKTydpoiwgMOKrh/s/ QhACp05Pyn47T1EjrSyMMQ4shaUCnigpGg== X-Google-Smtp-Source: APXvYqxlJgyrhw5cqpNGrNcquoqHADbHAx6Odfz/myvR1j6IHIjllR1PZKqdVb2NrRNDn2VlaQo6JQ== X-Received: by 2002:aa7:9a92:: with SMTP id w18mr5340936pfi.167.1560965428463; Wed, 19 Jun 2019 10:30:28 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:28 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 40/45] coresight: etb10: Do not call smp_processor_id from preemptible Date: Wed, 19 Jun 2019 11:29:44 -0600 Message-Id: <20190619172949.4522-41-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103030_062279_6AB99E70 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 17:29:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004937 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 CFC2C14DB for ; Wed, 19 Jun 2019 17:42:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB3A626E55 for ; Wed, 19 Jun 2019 17:42:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF904284BD; Wed, 19 Jun 2019 17:42:28 +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 6CFE926E55 for ; Wed, 19 Jun 2019 17:42: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=AF2rde6Soo3Dp9Y936Shh+Z79tXGwMf5PNBTwWvruag=; b=d3KdBsW05m5u40DoD09e1yjSY0 Pa+3kMVSc7NNZbRIYw67BD5P3MrbhXpUf1fTJkr/kFwgN0ctElhzwBfO8klgaft9/3HDslr8VOC0E HNM2AncDI3FXtj0cGcPGEGkps13AypxkISzVLEsl7rJvFajZ8OLWkS7X39/Mg89WKfrKXUUFl54kD 6nAI5KHxU8xkDpXMOaZ+nbi4CCIvyVb1ViXIckWr/vy+gVxuxs4Xl9FARYWTmKF+K3v4F5/SnHoUn DrqWl0PLmmRG4Hd9tMjdIC+XY95IDQrhj1uhiRw2EwLgFYNaBwQBxWK2l9gOjaMpa5HPHiTAghwQh qTYQfrTg==; 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 1hdebK-00064t-HQ; Wed, 19 Jun 2019 17:42:26 +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 1hdePm-0000DN-Fu for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:37 +0000 Received: by mail-pf1-x441.google.com with SMTP id x15so22486pfq.0 for ; Wed, 19 Jun 2019 10:30: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=gXxfLSHgLZGmqkWHxSJZdsVy2kycSL/GwJEpQt6NxwI=; b=MYWAOF89UTDdjQWWWohBssrYKQrXNaTQb56i7BbF5LGx26L4oGZgb5gkAY1Hw9DMiK oaPtHV6LRFCJmkH7LqAOOEx1hn2yN61ihVlvb6rn72tcqxhkPDNBgMARPCUbAB3gbg0m 0Ya911l5a4N9IWPeROvLWi3XQZKtH/omvrvn5nLDSXDnVriBPqn18WPhhJCpEhAAUpbz 6urvzQscOHWEVRBAXvtEOI/Fn+lAdIEePaVgkW8btvhp0EKGk3ng3l1vqJ4yfPV7SAw2 bVs7qTE4GNFAMRuOWFwcQaWcdJGaHRq24fCp+1w7w5l769AwhlSevrFTTsFA2FS5Erpm GcGQ== 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=GVu1MqfYSvG8JNvm6C4AFP0BDWzPPk+64E5P4Tla/eT7prHO2L3BHh2gPViReAo0ib bBt4V5PJdWQDfhpbz76w0qu1e1uY1yg1M66M4pfndxyMqDs8ifIM6xucxdJVuqSOqmiu edoD6krhxj66jVebkU5q9PlH+hHaV2xS3DPi6shSEv6tI4/V3tQM7KfAUuawCVCK3dDT PShY9AWJ/DzMdI/db77rrAHnoB/I3TkMEmtOsO01SjUu68B9DHPC4+Yidf2SVX9ladBZ QMcFam1JyX+nfPm7M8ZpTouF90HbxYULIJiS3oKPaAe3vr1xYRQdHg1BDAe6Y6O138Rx UWjQ== X-Gm-Message-State: APjAAAWU1srjDWqeLbY36xkAiDX8kio6fLwXEta11ZjDCDOJfbomOt87 kurm1S2Biszt+dJl39CIdO/Zhg== X-Google-Smtp-Source: APXvYqwt1SLpyPw/jXGyV2ykafaf4cucnch+RU+wUoI8YNfR5SEFznigUAD9eCXftf3ef72n6KauAg== X-Received: by 2002:aa7:8e46:: with SMTP id d6mr126457815pfr.91.1560965429219; Wed, 19 Jun 2019 10:30:29 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:28 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 41/45] coresight: Potential uninitialized variable in probe() Date: Wed, 19 Jun 2019 11:29:45 -0600 Message-Id: <20190619172949.4522-42-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103030_584444_66CBFE8A 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 17:29:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004947 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 7AEFD14DB for ; Wed, 19 Jun 2019 17:43:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64DC0284C5 for ; Wed, 19 Jun 2019 17:43:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57FD828518; Wed, 19 Jun 2019 17:43: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 F33BD284C5 for ; Wed, 19 Jun 2019 17:43:55 +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=IeQGdHYqDWIKFCKhSk+ezZtj7F LdRp1o1dXbtxrrxKgY2uFzJM4ac+8aoSJ4tqf89/7vlm6A2JQypGX8kbWInS7/L+/IJMzTDyLkrS0 uO6Q5jl+kPLOzAeaMi4k0TXsm3462nCoM36xjH3DNP0tHj9H2Nbp89rZM912xSweFeecahBkL2Xt5 WwJCS3BjBY3tfq2Qu6B0a8Y8K8hn8drLL6E/TIMnYuYqs0sbzSbNNuEW0BaU4R+SQxLkUOa8X+SOk QuJTssdffuMVZl7wRYZuvqXOnquMK41csw5xWiOQPhsCMK1a42ik/SV9UJQHFGlD9lXaC417leYpZ zKlTgf0w==; 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 1hdecg-0007OA-AR; Wed, 19 Jun 2019 17:43:50 +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 1hdePn-0000Dz-Q7 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:40 +0000 Received: by mail-pf1-x443.google.com with SMTP id j2so3650pfe.6 for ; Wed, 19 Jun 2019 10:30: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=ZB/QEA/K3clWkDbM4qhRU5KEkoHlA3Iglne8yOGj5AU=; b=QcODEJ84zMKBUPy7MU9JLoqZbWUGOZnN/aJ6C6bKq0TSnJXXbjdAfcRiaj+CgjMcK5 RmUsBa+qNayYqQzhL3wqqOKGwIF5tL97njrwOxs+et37l5v0sLnII2QysImpntV9bpyv s9RIXOQwADaF7ssw7IeRsOqZ06W97ZEhxJWUGPKilMuWbFRC4Pw+VfJvxpi+7VKxD9wi 5kcUiwajuOycemYtBq2aMXZxRKuImj5NxKFNsPqh5Y7y434m3Yaxi4fsjllluTXrLbax WTg/iybifnKP5gVaXLOtEoZEZ+T4+KqI1T4a7CLqyqs168BYJNOXNpmv4i2rKSAOicRx GJFg== 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=s7nz+jmFXmQmy25sRnb/Ip6J37ewpT5aTFZahL8E/RmnXAyG5B7hBVlDs2r5Cl5Gr4 uVTFUH8gdkUxXcwyEHfjrbISAPaWwlBmyK8JCpAaLQNQdSMwwlzbOhwiBKwcm1Eex+VJ G9IvqgjDfHQPJGDlZjAfE8kRVAkQ8QzahNpslRsiL50TEDWOZM8QUqvjZ2shLZoLHU6U TEQjuEJHQj0xrTz5t+qn6RBelTC3OQ2+Fon4giuP1DOup9opk7mbs7DuKZ/KTh5VJh73 nir8KbCMFeBD1VoIgHq3IWFFpZuL6P7dAk7y0W2pyNwVU65NHMxS3jTsIN62y43iypFS NKUg== X-Gm-Message-State: APjAAAU9dVrmz4Fm0tRTc68t4Qc5fACMcV8jYCv0J/jgNsDUpE1e3fMQ y6rOaZJzXHczq7cIgcU77oZb6Q== X-Google-Smtp-Source: APXvYqxyQ5hbhuTMzw/xgUs1RsAXMnyGGtqRAYCz9fMRvk6IpUj82HnnNjXztaud2FeBHZSSYCYAkw== X-Received: by 2002:a62:1b0c:: with SMTP id b12mr123160088pfb.230.1560965430143; Wed, 19 Jun 2019 10:30:30 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:29 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 42/45] coresight: etm3x: Smatch: Fix potential NULL pointer dereference Date: Wed, 19 Jun 2019 11:29:46 -0600 Message-Id: <20190619172949.4522-43-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103031_904073_57132968 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 17:29:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004953 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 673DA6C5 for ; Wed, 19 Jun 2019 17:44:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50D5328528 for ; Wed, 19 Jun 2019 17:44:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44E782858A; Wed, 19 Jun 2019 17:44:31 +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 E420528528 for ; Wed, 19 Jun 2019 17:44: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=Z6tLJRWKrMfTjjT063aPSyCtl4+qcccqWj+YCGa07eM=; b=Pct7/h1KYi3ju3CwYo3+Z+dDze 9cq1uFejT/OUIf1XsinXQjKxt8XXqvhvKUueKnS2bZDFoTokVZ9umooPIG2CSNK8ecECXSWiFlyoW fDJ1eMIfnjUe1Ikr+Q8ky/DOXrULl1YiIfwgFcOMfX7OcKkH5TNVnV0VplI4U1ij1NvSS/rD8f4rb oqBl3FLXSn4bqOEArq17zFaow0pbLMo8DZ8n2EXkAMwEVBzE1qIILR4EPQ4yVoIjXHZdaymiAJ1rm pbpnrUil6ySPwruLCqF1fgBvkPYjGL/uQIkofMhKDNbBPyvCPUl37zi7SCP/sgzhqLXRUDl3Q7yuH rkaKmvUw==; 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 1hdedK-00088w-3S; Wed, 19 Jun 2019 17:44:30 +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 1hdePo-0000Ex-Ce for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:40 +0000 Received: by mail-pg1-x541.google.com with SMTP id f25so35632pgv.10 for ; Wed, 19 Jun 2019 10:30: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=eVDBdMkApj9sKJLqD9SjgtJkupY/dvzVE0zp0XjJG6s=; b=Gs7LQ1SNavZhD84PpA2ZIRxbNydD8V86LavwZdjIWkbaJbr1YopRI+Vy8M/PgGDAIY IZRLvWKtZhXPGmLh29cQ9+3w8X4zmYtCRjvlmacT994vFS2SkGvkyDKJ0Q3adjT/6LtO qdBdtSZ0C8pK5Z5s1/8OQ9Z4qEuy9DtNFofgoeHXdybHLRdLvfqcxK3c/YX3SDc8O5Lo PiIQXKJazE3NGBXVR/upVb7ND8YUgSX3Xq1v7zV9grSuoyr1yXD42vyVihyiZQcZ0r5I bHDVWM2VsQSPtkimT5cOpbEFEkNhjNZyAeHk9JjbX4V8XCZC6JDogUNiMXGMfsC27VYQ UzeA== 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=c//XMR0QW2F14ZuZ1gGlcpl4l0jEKIjAE+/DG1T7xlCxEAUzt9F5NDA1sytan/wVMe ajXZjcTxmXbsxemSHmFrgig1UtPNFmlzGTEZCAsg2DlJXGQJe/FqziKq2tiyEgzv6hkM NJp7zHQMGMoqtd12ly9zRY90fqY7+eR5pl5dlorvqxfmW6dklObgcewM0bzgqDRYzqSc Enp007R196a+rpPfDervYGzJHmvaPvnHOEl378VAZw2AGb/w8epJzpmXcndptA+lkaIA jygsyezDVUIlOCqI7ip8aLhuTM4Dake80iFTiQub2GVLmEGiK3jRBhB4XGIt/c9xOwf4 wGOg== X-Gm-Message-State: APjAAAXafLYeypG2ziMoCIQE3WSDZKbRVleDLRKoSaHxj31aWmEdQ6Ly X9Yl+/vU05RTJ7/9icb9FO+v3w== X-Google-Smtp-Source: APXvYqwU9yO6eME2CW4xirO4im0SAo3i5ckxnsCY6VgEQ8ncGNsHlfScTCsiClrkMwE4zm+zcAt4kg== X-Received: by 2002:a63:4813:: with SMTP id v19mr8564005pga.124.1560965431017; Wed, 19 Jun 2019 10:30:31 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:30 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 43/45] coresight: tmc: Smatch: Fix potential NULL pointer dereference Date: Wed, 19 Jun 2019 11:29:47 -0600 Message-Id: <20190619172949.4522-44-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103032_556021_303F1AB6 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 17:29:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004949 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 5C3F614DB for ; Wed, 19 Jun 2019 17:44:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 469A128569 for ; Wed, 19 Jun 2019 17:44:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ACF7285BD; Wed, 19 Jun 2019 17:44:04 +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 BE90228569 for ; Wed, 19 Jun 2019 17:44: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=E3cPg6TBrenfG9Rzhhl3qj76+PnLE9aEKWGwJn2YDog=; b=K+yspSyIkwHBZ5CFGufmVfnlyy HyDb408eHcUpWTV4I90FkyLTMX9dYWq8xNaQ2GqtY4S1fo+luHg1A8f84mQVwaGA/sjHyonwWluVD v0MJI5vVZtYpuGKV9gbvVGgxFp421UPYJ4xczVCqG5GkHYBNa9uP0FXRcVs2qgn3SuxX1Z60WiaUp 55ZuGHTI94iugx82rBYpnwfnpRK2RsmO1V9QwuxA9yVcHoQwFsLGi/LylvkSeaN/Jn1Qe6gXm9Wbz OPTB5jI0iGLyzGTmQhdzJlnlI5tKbY5uKJgyY+X6FODo/2yfe/QD1EskWslsKBP7pOp4fqfOspvjj S2+0P91g==; 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 1hdecs-0007fQ-8O; Wed, 19 Jun 2019 17:44:02 +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 1hdePo-0000Fj-TM for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:40 +0000 Received: by mail-pg1-x542.google.com with SMTP id w10so44216pgj.7 for ; Wed, 19 Jun 2019 10:30:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cNm/Gnvmoe8OMqI3hroQMow+nr0a1GxGDg/6aibpR2w=; b=FeSBeq6K3WxdPuyFRN2Ijw3FmMGnHtGG3CgMfBpi2XORigj6LLvQE1PUQ15R3/svS0 Ub/GMWBQzgYqqwwSBftzYvKPakALXTzbRNoYvSuZTdwoX02QYcmqxM9v/I6hW1EW8VCl uvk5X7pqS/5adKljzBptgY5eqLyB53U7jEuby0xwvXG5OCUazfbYhBzaCxT2DuQ8n2nv iwcB74cU/v8+881igpzBqNh3IqaE+T0zoD/8iGRPLZwaijku+xU0UH5o0ISFPz3rROby 6QfZqTXQhTcQJGSJdIn2Baks8wHqd3+2v1PpHXDukP/cket8DcQr5QGBMxIeWBhwiNam wKfA== 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=bfmZHex5lVXqkwS8SFSqPCYHxmZJE56P3koLWoB31pofweEUsofpwidlSWzp4IV2Fq WxSzmtfqhXyt/KiHJl70bEftktGwhzKmpCSZOlFHfiKUFYAVi7eX0zWQflaSIfh3LooD RtEi85uiRIR1VlhDMCNxK+uHkqbdHz6MopmcD2HHxztN+GXuzQIveULw9RRSWGIdGL+t vQ2Lzzk7vsQ4DSul+R8CJV3Cl/I1XLS9c7QJebC3tgjhO5VUt+Grg3uMIgA3g0aQvY3+ 3LEcmqL/nY2oNXmV2mR3bFt/pVErrtTk6EAPkuKuQpgXc4QLOZwLuzvs8xel7lTPOJAd NPPw== X-Gm-Message-State: APjAAAUqJPZNX/ubhs/KiUeOJnkeh0KlDsBYDCR+f/89xB7wQOoihtcN BWL02NouZ/HNJbyJYXJj6dZXFyfjYNHObA== X-Google-Smtp-Source: APXvYqw2GxRge0z71cUM70fIValKIvUJsIW3TxvNczgL/WJMT5PYEa7s68jBEuSLLh6k0IQdbn3LhQ== X-Received: by 2002:aa7:8555:: with SMTP id y21mr70481315pfn.104.1560965432024; Wed, 19 Jun 2019 10:30:32 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:31 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 44/45] coresight: platform: add OF/APCI dependency Date: Wed, 19 Jun 2019 11:29:48 -0600 Message-Id: <20190619172949.4522-45-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103032_999877_5780BE86 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 17:29:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11004951 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 4B32C6C5 for ; Wed, 19 Jun 2019 17:44:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32A4128528 for ; Wed, 19 Jun 2019 17:44:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2187A2858A; Wed, 19 Jun 2019 17:44: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 AA76428528 for ; Wed, 19 Jun 2019 17:44: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=cLkrFJqDXObFWBHij2XMxinnZ2lJiQVmrUfk6/wkCAg=; b=mq9+8I8k8DbKTO7+i5fsE3AJOv lzRfzu58govFKI1N46fGu2hNsIoQ3g7IuxWgt7tcWVlnvdK4Vf7E9SJjeCfg9Vnas3dLRy7OXKDkV qYepLnNvfmGmo8b6UtCeUTwAOawLThuI25xGSJIVnR3iTbPW853CrkxF8Qu34PvRqNfP3Y8e1Jnta f5rwpcEirsUtuWWVAZNAICDYVw2uJGmk/7oSYEjvOHhn5j9QU/xHO4jEl2eglMk5CDsjH+iT1iXg1 9yS8rmVRZEeyvfaCiJh4wXEhxTmlFeE7H5ieWwIYdm2rjSdpL9t008YlhsHYLcbF+rKLERONBCr2M nQfO/RMg==; 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 1hded8-0007tF-Er; Wed, 19 Jun 2019 17:44:18 +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 1hdePq-0000Go-Hf for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2019 17:30:40 +0000 Received: by mail-pf1-x443.google.com with SMTP id r1so10159885pfq.12 for ; Wed, 19 Jun 2019 10:30: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=DXUk5qmda2XK8XQ2pM+me+/3tfkapIvCeu+/dr6te0Q=; b=vxyQUCZ04GDZhmUfTaGO10SVer4VSPFl/6/gm+NUQnWQZA2zUs1H0oXaxhRr7SRyT6 zSl6LGY1nQkyErXj/kKiCbira9KuqhU5go0tP5Qk1eLdKYdaDiZbSrhN5mOfddDadCxD /gJjuVE8yBPyueUFE5kySYRcn4fezCK0sHW1EFtfulijZqB/XAOu5KOzB9k3NZ+COoEr Q52Ymov4SIqJHVG0hVLRsipJwnP3zrYFky2GWFSQS7vEQZURMPS47mKGBX79b3JOfV1t csYIzUkB4y5szvW8QF6Wp51/ykUHzI0QLGEVku0LT1qpYlALJVuXe2KkL7Cf2/14DmbV MFDw== 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=jLkQ9y2qbuGdXHTnfG6QhIQv3uvI2D2ndxSrMcVKvz3a4wDy9ZRZH2dBA0g1CRCKzp vNtAe7++fXJVqiAyXs2ZSHiWsX0UvXL3PJLWP3u+5rURfnMZwXl5Ie/zo/kaD09okRIR yXAJNRcEDJqBC5tPpbzLc6nWp8ui4F4FUer+4tateMRl+KFzzbot99sRBfRK3WhvSVi1 KR+Nqe6T/J5mc5hjzHZxv69K4Al/jrDbXW89o4sVIGUiDuv8KLuAhqZLJiydiDQOrOcr EIffFeMjo8h3L1Yh+h/mSoyc29P1E9mp+PJQx2ICo0vWgj8/lTh5FC6r5nXb6fpnPNIG fAeA== X-Gm-Message-State: APjAAAUjgKlcjJgyvnig/EfnRzCe1aex8mR2aAXrMy0wknwlGXMtJnI5 R0qYENnQllQrSEl5LNiJhwl0xvPTUyijNw== X-Google-Smtp-Source: APXvYqw9Mudp321XeT3+tO1OHS6OfbtuVXp2P2SFCqhhUuZIid/NCnt36Qfzedbh5GmeFVFzVP0dGA== X-Received: by 2002:a63:4e10:: with SMTP id c16mr8577976pgb.214.1560965432754; Wed, 19 Jun 2019 10:30:32 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id g2sm31348406pfb.95.2019.06.19.10.30.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 10:30:32 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 45/45] coresight: replicator: Add terminate entry for acpi_device_id tables Date: Wed, 19 Jun 2019 11:29:49 -0600 Message-Id: <20190619172949.4522-46-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190619172949.4522-1-mathieu.poirier@linaro.org> References: <20190619172949.4522-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_103034_734688_1E50EEBC 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