From patchwork Thu Apr 16 08:15:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 11492491 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 9CD6C913 for ; Thu, 16 Apr 2020 08:21:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E5C1206B9 for ; Thu, 16 Apr 2020 08:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441346AbgDPIVM (ORCPT ); Thu, 16 Apr 2020 04:21:12 -0400 Received: from mga09.intel.com ([134.134.136.24]:23576 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440881AbgDPIQi (ORCPT ); Thu, 16 Apr 2020 04:16:38 -0400 IronPort-SDR: 8ANFgpdH5BTQ48ZE+Wmx5aXUguayGdOkZbbm/h37LhKo8IX9PSa8K3Dr5bAZEE3rDZtNx9eqqJ 7H7AnKnJfPTA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 01:15:59 -0700 IronPort-SDR: HeqOZtHZHt7ASB2zzLpML2efNhEasCcduKN0SFYlvV0/icBHTkWqM4nOe3IFnSm0h/R7d+O8wm 0r3tdD7h/xYw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,390,1580803200"; d="scan'208";a="244334020" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 16 Apr 2020 01:15:53 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 276D449F; Thu, 16 Apr 2020 11:15:53 +0300 (EEST) From: Mika Westerberg To: Andy Shevchenko , Darren Hart , Lee Jones , Greg Kroah-Hartman Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Zha Qipeng , "David E . Box" , Guenter Roeck , Heikki Krogerus , Wim Van Sebroeck , Mika Westerberg , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 02/20] platform/x86: intel_scu_ipc: Log more information if SCU IPC command fails Date: Thu, 16 Apr 2020 11:15:34 +0300 Message-Id: <20200416081552.68083-3-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200416081552.68083-1-mika.westerberg@linux.intel.com> References: <20200416081552.68083-1-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Currently we only log an error if the command times out which makes it hard to figure out the failing command. This changes the driver to log command and subcommand with the error code which should make debugging easier. This also allows us to simplify the callers as they don't need to log these errors themselves. Signed-off-by: Mika Westerberg Reviewed-by: Andy Shevchenko --- drivers/platform/x86/intel_scu_ipc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index 584e33c37708..e8ea250aeda3 100644 --- a/drivers/platform/x86/intel_scu_ipc.c +++ b/drivers/platform/x86/intel_scu_ipc.c @@ -147,7 +147,6 @@ static inline int busy_loop(struct intel_scu_ipc_dev *scu) usleep_range(50, 100); } while (time_before(jiffies, end)); - dev_err(&scu->dev, "IPC timed out"); return -ETIMEDOUT; } @@ -156,10 +155,8 @@ static inline int ipc_wait_for_interrupt(struct intel_scu_ipc_dev *scu) { int status; - if (!wait_for_completion_timeout(&scu->cmd_complete, IPC_TIMEOUT)) { - dev_err(&scu->dev, "IPC timed out\n"); + if (!wait_for_completion_timeout(&scu->cmd_complete, IPC_TIMEOUT)) return -ETIMEDOUT; - } status = ipc_read_status(scu); if (status & IPC_STATUS_ERR) @@ -331,6 +328,7 @@ EXPORT_SYMBOL(intel_scu_ipc_update_register); int intel_scu_ipc_simple_command(int cmd, int sub) { struct intel_scu_ipc_dev *scu; + u32 cmdval; int err; mutex_lock(&ipclock); @@ -339,9 +337,12 @@ int intel_scu_ipc_simple_command(int cmd, int sub) return -ENODEV; } scu = ipcdev; - ipc_command(scu, sub << 12 | cmd); + cmdval = sub << 12 | cmd; + ipc_command(scu, cmdval); err = intel_scu_ipc_check_status(scu); mutex_unlock(&ipclock); + if (err) + dev_err(&scu->dev, "IPC command %#x failed with %d\n", cmdval, err); return err; } EXPORT_SYMBOL(intel_scu_ipc_simple_command); @@ -362,6 +363,7 @@ int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, u32 *out, int outlen) { struct intel_scu_ipc_dev *scu; + u32 cmdval; int i, err; mutex_lock(&ipclock); @@ -374,7 +376,8 @@ int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, for (i = 0; i < inlen; i++) ipc_data_writel(scu, *in++, 4 * i); - ipc_command(scu, (inlen << 16) | (sub << 12) | cmd); + cmdval = (inlen << 16) | (sub << 12) | cmd; + ipc_command(scu, cmdval); err = intel_scu_ipc_check_status(scu); if (!err) { @@ -383,6 +386,8 @@ int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, } mutex_unlock(&ipclock); + if (err) + dev_err(&scu->dev, "IPC command %#x failed with %d\n", cmdval, err); return err; } EXPORT_SYMBOL(intel_scu_ipc_command);