From patchwork Thu Sep 20 19:18:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 147164 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2378034ljw; Thu, 20 Sep 2018 12:20:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZU+pJbPuWMrS2LfCUg/VuM5VCwig+geDu/tp17DDD842VTMtzNQDuEoPJQIOwFPe3J9woK X-Received: by 2002:a17:902:82c9:: with SMTP id u9-v6mr40755992plz.138.1537471239061; Thu, 20 Sep 2018 12:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537471239; cv=none; d=google.com; s=arc-20160816; b=htFF4ynVhbxgl1c2XaXamVkAtszkr7Dzz2XRo9OZAU++P2G2VpLKESEaifT7I5nu9s JYPoAdyLTkDZKXaOevWCINJu24+5sFNicR5A/+RhnBf3qhaBXBnc7kmdfJCyZP3f0AAo XUHPP18fKP+eK/PjYn0mGKgo6XE3gBWFTtPMkMNCK330j4uB94eLD/r/PQYRMwDVJBT4 Yrj5tfPYA6Unmpwq9BC9hMhdu/hvzpWJhxGx6v8VeUmEJnBz7lv87OIBDz8uoqZOoErv I4f+DYobO6a+6TRA4Gp/qNfRGinu6kIwOkOApDqahM8ZLBt5lzfQsLTcHPz0q6u7ulUy BF9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=V6vu1RIZBsPM7h6OM/OfrWdKkRSO5vP9cV5FH4ePhdM=; b=CKmijKPw2mTM0nv9g8STaCHnWPpdLNETkG7pBZO5NHG5w8sp1AXrx0iTwHH0kDK9UP YqChSPTfe/ENPh5cHY9+IkzRwNLi7DasdKrZKQj/U72xPFNRu0khARCP0Ymm5eqvtyIu /TT4Whgz9deJOEjwsQuQP3xwLZkEzWGv6lZl1mg3UqsWRIQL58pUXJZOe2ZRa1TKf1K/ 1H9Kv5caltbzmJ5TdUhxezVVWS/iDCaXUOLVN2YTT8Ro7YnCvoDVQFpSYswvRJLsD0Bh GCAdsaEo9vuxQINLmzFtLvvxLMPqmf91cr+z2FXNZq2MEeMAWVgk6ANoUaoXpDZP06hP RgiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C6c/Xhga"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18-v6si24327788pfn.317.2018.09.20.12.20.38; Thu, 20 Sep 2018 12:20:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C6c/Xhga"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388555AbeIUBFg (ORCPT + 32 others); Thu, 20 Sep 2018 21:05:36 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:33545 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389005AbeIUBEH (ORCPT ); Thu, 20 Sep 2018 21:04:07 -0400 Received: by mail-pl1-f196.google.com with SMTP id b97-v6so4812091plb.0 for ; Thu, 20 Sep 2018 12:19: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=V6vu1RIZBsPM7h6OM/OfrWdKkRSO5vP9cV5FH4ePhdM=; b=C6c/XhgaZor+HAv6JiOxdav3v6vR8+mbX1mUgcpeTuJgztugUORTRCiW7s9mmA81Ih 1c7xx8hIxug/bPhBcJBsegcbNLI4WKHtf+86pYzPuj8dpyijFYXkCrHofCG8YKk2fLPP A2koKFJyK1vFXrX3h80f5hPrt1jV9tlhRpzt8= 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=V6vu1RIZBsPM7h6OM/OfrWdKkRSO5vP9cV5FH4ePhdM=; b=Gq2fzUjO9sKv/THMZLG5Km61Jq3V5ItO8g7D53uOUpKcFrqKGwhYcNrlQGGaBK5k/6 U9Z6rwP7Vr9aZqbcKE64lT8FQM6+9UE+WCj6jnpcc4yRLcXUAe48tEkGFllihgQxvbCE Lm+4hZdFZ/gx4eZZkMzDfNZM+tsHysq48Y7XoVrt6+EILvck80jhM0EhghOv4zJsEanc aP5K9VapsuxehVUJZwEfM4a7QR7AuGE9GT9iZghkMZBNAgo4KFzqeSlnRNcfdK4BWcZo /ieCYF89IcNOQav1n3nU+yoo0/ilZcu8KPN/zb26pBTmPVLtoQ5RB3dtLU9IpLT3XNp/ PO+Q== X-Gm-Message-State: APzg51B8cfvD0eZyWvLZhc4hXbz7G8nn0eBou5hsY05YB8pdb8MlPzK5 OXcfYfFyX9CT7E1g1goHkCXIk1O3XUw= X-Received: by 2002:a17:902:c85:: with SMTP id 5-v6mr40952054plt.141.1537471147788; Thu, 20 Sep 2018 12:19:07 -0700 (PDT) Received: from localhost.localdomain ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id k13-v6sm4424443pgf.37.2018.09.20.12.19.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Sep 2018 12:19:06 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 30/44] coresight: tmc-etr: Handle errors enabling CATU Date: Thu, 20 Sep 2018 13:18:05 -0600 Message-Id: <1537471099-19781-31-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> References: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose Make sure we honor the errors in CATU device and abort the operation. While at it, delay setting the etr_buf for the session until we are sure that we are indeed enabling the ETR. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index c42693542ec8..daad52146140 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -751,12 +751,14 @@ tmc_etr_get_catu_device(struct tmc_drvdata *drvdata) return NULL; } -static inline void tmc_etr_enable_catu(struct tmc_drvdata *drvdata) +static inline int tmc_etr_enable_catu(struct tmc_drvdata *drvdata, + struct etr_buf *etr_buf) { struct coresight_device *catu = tmc_etr_get_catu_device(drvdata); if (catu && helper_ops(catu)->enable) - helper_ops(catu)->enable(catu, drvdata->etr_buf); + return helper_ops(catu)->enable(catu, etr_buf); + return 0; } static inline void tmc_etr_disable_catu(struct tmc_drvdata *drvdata) @@ -971,6 +973,8 @@ static void __tmc_etr_enable_hw(struct tmc_drvdata *drvdata) static int tmc_etr_enable_hw(struct tmc_drvdata *drvdata, struct etr_buf *etr_buf) { + int rc; + /* Callers should provide an appropriate buffer for use */ if (WARN_ON(!etr_buf)) return -EINVAL; @@ -982,16 +986,17 @@ static int tmc_etr_enable_hw(struct tmc_drvdata *drvdata, if (WARN_ON(drvdata->etr_buf)) return -EBUSY; - /* Set the buffer for the session */ - drvdata->etr_buf = etr_buf; /* * If this ETR is connected to a CATU, enable it before we turn * this on. */ - tmc_etr_enable_catu(drvdata); + rc = tmc_etr_enable_catu(drvdata, etr_buf); + if (!rc) { + drvdata->etr_buf = etr_buf; + __tmc_etr_enable_hw(drvdata); + } - __tmc_etr_enable_hw(drvdata); - return 0; + return rc; } /*