From patchwork Mon Sep 28 16:35:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804091 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 037FD139A for ; Mon, 28 Sep 2020 16:40:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A10A12080C for ; Mon, 28 Sep 2020 16:40:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HgEKbxNv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="os6AcU2w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A10A12080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0MKOTsCp3QPka409fqZ0qfGgZ2UDJD7mnx80V2ndxfM=; b=HgEKbxNvJA5cqmlrtXo3ITA2s zqhPCFQ/4gOZPf+PqaR8gh6vsHZ5PsKEsd+QBL7bCWPs/wP3FeunyFCTuS/QiPnbEmgenutZ9Ed6+ t8xp9C8mUk1cxH+3ZmpS6amCjLFlgAn/oTjQK6JQ6ODBcQ1TVB0EPs2LKzsR1N7MxcspiOtFV2Uyr P6bvXqECDq0C+hhyB7NN/ikgSQA57iW2iVSc5ykaOShtC5Q61qaEbNHNybh/YjRd5lzr1ek5XOmgO ZJrpm6mREXuXMqQ/ThWVvjld00xoLgaNVH7NNCUW208NTZtpX6LQh2rxziCM3jB+PqS/LCvn9E+4F IVZ25cZBw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwCI-0002Wt-QE; Mon, 28 Sep 2020 16:40:18 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7l-0000dg-5M for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:43 +0000 Received: by mail-pf1-x444.google.com with SMTP id x22so1495136pfo.12 for ; Mon, 28 Sep 2020 09:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PFNZXtI95g0K6EiyKzxVVKdekKnnD7HXNlnqY5psBQg=; b=os6AcU2wpUMO0LwxaiVbIb+NVpIgu3Edd4DRyzo+QSz8Z+xB5gnAuvQ0ZYVGUOmNUP ltE8DtXJ/t27XSxIO+hc3HEpKKOa89eikipbsSo91ZMAOzMup4JZU3F71V7lbVdKvcKM XjTbDZ9nBjNHkuZJ6ciMWZDef32e+jz/IQY6ZE96KPTY5zQSd45c1H+EU2VajYEigK7H xpwZCclXk6QTkNulj6B4s9MMeQ3vMbB+9I0xwsAJy1kW7xet4+JjxwTjpwYjpzFqlNgk QrdhNyso5S1rJhNKVhwMqexKu5BZqTpwNaj9k98l1bgA2mq+V0zWdgDXUJaYh+Z7bA7Z ktag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PFNZXtI95g0K6EiyKzxVVKdekKnnD7HXNlnqY5psBQg=; b=Ci7tnylESiSLM5kQP1xEo/M1cFt33+l5blFNDqm2MNDHilxJC3M/ViSX0rDmKKkqMz 1XCXmuXY1zbR68Vf8LgyjSkBplEMlvsPZtrhjB1IsaIWTMin6zqY0+2gjwKEOt00guQd U7U7xunLkBzFmEwgkZ13yablEhHon0Q2NcEguAo0/+yTBVPhiPwojSHEt9UQyOZYW8A3 o4lO8nLgDIKCune7V6krGaGgtWZI8L+FaDecRDxHgEhSV1t976T+UVdWxfuqmZgi0LF7 iPUaofY2h80W4EoZX/nrHoErYeiRBK6Lw80Prq77oNQGJeJKdTksjmaIwLESA2sZzAzy 04Bg== X-Gm-Message-State: AOAM532+fdSWsZ1t42OzR0W9K9dUOZWgYXAYp+aiWO4GSz2m4cWWz82G 7GWbY3eU0dIKDiBBauYbWYHmiI9vB9/YUg== X-Google-Smtp-Source: ABdhPJzxzKRXw7hgSldaGRbgnB6lTm4etRUB+E3moLb2conlDyuo1tUJTqJZ5ymj2fdq+XbugsKEyA== X-Received: by 2002:a65:5902:: with SMTP id f2mr1714479pgu.379.1601310935258; Mon, 28 Sep 2020 09:35:35 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:34 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 19/25] coresight: cti: Don't disable ect device if it's not enabled Date: Mon, 28 Sep 2020 10:35:07 -0600 Message-Id: <20200928163513.70169-20-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200928_123537_254276_78627988 X-CRM114-Status: GOOD ( 18.79 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:444 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Tingwei Zhang If associated ect device is not enabled at first place, disable routine should not be called. Add ect_enabled flag to check whether ect device is enabled. Fix the issue in below case. Ect device is not available when associated coresight device enabled and the association is established after coresight device is enabled. Signed-off-by: Mike Leach Signed-off-by: Tingwei Zhang Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 11 ++++++++--- include/linux/coresight.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index b8b0a20e93c9..711beb92166a 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -244,13 +244,18 @@ coresight_control_assoc_ectdev(struct coresight_device *csdev, bool enable) if (!ect_csdev) return 0; + if ((!ect_ops(ect_csdev)->enable) || (!ect_ops(ect_csdev)->disable)) + return 0; if (enable) { - if (ect_ops(ect_csdev)->enable) - ect_ret = ect_ops(ect_csdev)->enable(ect_csdev); + ect_ret = ect_ops(ect_csdev)->enable(ect_csdev); + if (!ect_ret) + csdev->ect_enabled = true; } else { - if (ect_ops(ect_csdev)->disable) + if (csdev->ect_enabled) { ect_ret = ect_ops(ect_csdev)->disable(ect_csdev); + csdev->ect_enabled = false; + } } /* output warning if ECT enable is preventing trace operation */ diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 3bb738f9a326..7d3c87e5b97c 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -208,6 +208,7 @@ struct coresight_device { /* sysfs links between components */ int nr_links; bool has_conns_grp; + bool ect_enabled; /* true only if associated ect device is enabled */ }; /*