From patchwork Tue Jun 30 12:58:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 192073 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp3790951ilg; Tue, 30 Jun 2020 05:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbipXU38RE4kAfK/cbjbfgusUCY4SUMlVaIV0Ekh36+DLQnLSyvfWTnmPaGgKqHoNar1TT X-Received: by 2002:a05:6402:1687:: with SMTP id a7mr22528057edv.358.1593521936274; Tue, 30 Jun 2020 05:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593521936; cv=none; d=google.com; s=arc-20160816; b=o9EUwVUeCk1hlwoLK3YzsGtAm33hgd0oS2JqJIL7bXNUyl2krVb26zCNx3i4HXkqv6 zmIGgjHRM9XQ5bhUYTAcT8AUtnHYduX/cySBda386b8uKzIc2GxSRaqEnH8v9KBaHVXG RBe814KZY7craPJrqIDD3FJ5VpuaSq4ZJsmd3OEehvVUHp+2YGh5MR7VvtxSqSEMhUhB vGwtJjrvWtUcmnMmrgF8Pyz8l5sOtYqz+yWUrKONDgyZnvDWUQv1EFFs9UEqNGE+0TvL pwCMIZ960/bD6LPot5BvgdG+zoyaWHHsRW0f+QzDSx1Q/YLi29n0CBtPMY2LAcynmP7d RJtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zvwmuOxhUd9gYI7ZmOWVfT8VxRuFbGiVGtVR+SU80d8=; b=uL43vI4CebDzYz9AGfm3WWaL0F/lqFtUwYR+ZuHOGi/y0XuxT8dil0zts/hh2Q44D5 ibR+hhLUCli1OJckkRLFQmBgQkTKJU/KV7hoWgdnHJCBQG9ZVxK0kGHHS4I8KgjwYLv/ QnI+CSICN5VEYOzOYRvE9P5I61B+GG+f/rdZXAaiMaQ3WDtpJ5EUDB5q0OhIgJOLPE8S 5tek+BGAKoBc2d0PrnmQfRbL+LXMwM3GfvrlEXuUjSVeYInK2rFfv0TIx55UiLVMR7an fsvWYCkwOjF/Pxyv4HDVsxFw6UjdHQW3De7yKr7yJoCGH8LZ9avXi6MvpGIyqct92nmA 4tlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jcJyeHuZ; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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. [23.128.96.18]) by mx.google.com with ESMTP id ca10si1608778edb.224.2020.06.30.05.58.55; Tue, 30 Jun 2020 05:58:56 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jcJyeHuZ; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S2388128AbgF3M6y (ORCPT + 9 others); Tue, 30 Jun 2020 08:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387971AbgF3M6w (ORCPT ); Tue, 30 Jun 2020 08:58:52 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8B47C03E979 for ; Tue, 30 Jun 2020 05:58:51 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id y2so20866280ioy.3 for ; Tue, 30 Jun 2020 05:58:51 -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=zvwmuOxhUd9gYI7ZmOWVfT8VxRuFbGiVGtVR+SU80d8=; b=jcJyeHuZhgei633Ns+gF8MPjHBpaLmONY+fD0uvur0WjNqyKe697npjSZTYugGZzq3 CyeTPqgF4IZwqJ1rNcSJL/5KiWJdfkS4Ew3LbCylq+mNPY2HOG9CAtjA1aAf4RhOlV9n p75o2bILLbT5KiPcKXhxrOaF2ruP0LMWj9lA3Irm52wWkuEoil2YgpOWWGxKU9zKfAG7 2arx33Glcc/hoJvUjyFwVBViwzMPtN/I02Y3rOyRWVEtXk7lenzJ/r3guGziEr1BBPj8 GvD2Jyjj3p2KUBmK/G2BQL8Xp7rgxdlKoS4rk7tdWUrrhTFEOl7UUyu7ONe48hxWba+b LQmA== 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=zvwmuOxhUd9gYI7ZmOWVfT8VxRuFbGiVGtVR+SU80d8=; b=JhoviFHuqjn8HMQZLhzhAoj8cj2UUouco0ZpxIn4zB4vLE4FqK3L7VDBwt5VAbYiRM 2FAPYgbxKsC2YxmoLi7PzKMzD+PUaBMeOUeMn4IghsJSFCgSvvLUXZyU2NxO2WaiW/0a Yvrm2Pt6IiY4lYbApHjm3A7/Cw8qp1PuhGPhcaRlVBXAlvUj2ZfAW59e4wvCbBARP/NR Q7WkzjBFxIQTm0yuzb3RJD6T8wpDhqFbkaNWzD1ALw4f8EP7WB7IBc1TB9E4DVlS91gS jvWRYGEAYNAQWqoDkYAoz0TPA7aUBzRq9LwpZWqNeLVv/XL7tho6yOGbmqtcjBwYTi4h h2Hg== X-Gm-Message-State: AOAM533qj8CLJBShDORB4Sin2Ii2lfuVMLaraPfqjeNhvfSBh6b8NEys EdQ+Yqt6Z+oiMi11R3FBkIIL9H5LNJ8= X-Received: by 2002:a5e:dd4c:: with SMTP id u12mr21046408iop.14.1593521931183; Tue, 30 Jun 2020 05:58:51 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id z9sm1622588ilb.41.2020.06.30.05.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 05:58:50 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 1/3] net: ipa: always report GSI state errors Date: Tue, 30 Jun 2020 07:58:44 -0500 Message-Id: <20200630125846.1281988-2-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630125846.1281988-1-elder@linaro.org> References: <20200630125846.1281988-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We check the state of an event ring or channel both before and after any GSI command issued that will change that state. In most--but not all--cases, if the state is something different than expected we report an error message. Add error messages where missing, so that all unexpected states provide information about what went wrong. Drop the parentheses around the state value shown in all cases. Signed-off-by: Alex Elder --- v2: No change from v1. drivers/net/ipa/gsi.c | 54 ++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 24 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 55226b264e3c..7e4e54ee09b1 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -358,13 +358,15 @@ static int gsi_evt_ring_alloc_command(struct gsi *gsi, u32 evt_ring_id) /* Get initial event ring state */ evt_ring->state = gsi_evt_ring_state(gsi, evt_ring_id); - - if (evt_ring->state != GSI_EVT_RING_STATE_NOT_ALLOCATED) + if (evt_ring->state != GSI_EVT_RING_STATE_NOT_ALLOCATED) { + dev_err(gsi->dev, "bad event ring state %u before alloc\n", + evt_ring->state); return -EINVAL; + } ret = evt_ring_command(gsi, evt_ring_id, GSI_EVT_ALLOCATE); if (!ret && evt_ring->state != GSI_EVT_RING_STATE_ALLOCATED) { - dev_err(gsi->dev, "bad event ring state (%u) after alloc\n", + dev_err(gsi->dev, "bad event ring state %u after alloc\n", evt_ring->state); ret = -EIO; } @@ -381,14 +383,14 @@ static void gsi_evt_ring_reset_command(struct gsi *gsi, u32 evt_ring_id) if (state != GSI_EVT_RING_STATE_ALLOCATED && state != GSI_EVT_RING_STATE_ERROR) { - dev_err(gsi->dev, "bad event ring state (%u) before reset\n", + dev_err(gsi->dev, "bad event ring state %u before reset\n", evt_ring->state); return; } ret = evt_ring_command(gsi, evt_ring_id, GSI_EVT_RESET); if (!ret && evt_ring->state != GSI_EVT_RING_STATE_ALLOCATED) - dev_err(gsi->dev, "bad event ring state (%u) after reset\n", + dev_err(gsi->dev, "bad event ring state %u after reset\n", evt_ring->state); } @@ -399,14 +401,14 @@ static void gsi_evt_ring_de_alloc_command(struct gsi *gsi, u32 evt_ring_id) int ret; if (evt_ring->state != GSI_EVT_RING_STATE_ALLOCATED) { - dev_err(gsi->dev, "bad event ring state (%u) before dealloc\n", + dev_err(gsi->dev, "bad event ring state %u before dealloc\n", evt_ring->state); return; } ret = evt_ring_command(gsi, evt_ring_id, GSI_EVT_DE_ALLOC); if (!ret && evt_ring->state != GSI_EVT_RING_STATE_NOT_ALLOCATED) - dev_err(gsi->dev, "bad event ring state (%u) after dealloc\n", + dev_err(gsi->dev, "bad event ring state %u after dealloc\n", evt_ring->state); } @@ -448,21 +450,23 @@ gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode) static int gsi_channel_alloc_command(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; + struct device *dev = gsi->dev; enum gsi_channel_state state; int ret; /* Get initial channel state */ state = gsi_channel_state(channel); - if (state != GSI_CHANNEL_STATE_NOT_ALLOCATED) + if (state != GSI_CHANNEL_STATE_NOT_ALLOCATED) { + dev_err(dev, "bad channel state %u before alloc\n", state); return -EINVAL; + } ret = gsi_channel_command(channel, GSI_CH_ALLOCATE); /* Channel state will normally have been updated */ state = gsi_channel_state(channel); if (!ret && state != GSI_CHANNEL_STATE_ALLOCATED) { - dev_err(gsi->dev, "bad channel state (%u) after alloc\n", - state); + dev_err(dev, "bad channel state %u after alloc\n", state); ret = -EIO; } @@ -472,21 +476,23 @@ static int gsi_channel_alloc_command(struct gsi *gsi, u32 channel_id) /* Start an ALLOCATED channel */ static int gsi_channel_start_command(struct gsi_channel *channel) { + struct device *dev = channel->gsi->dev; enum gsi_channel_state state; int ret; state = gsi_channel_state(channel); if (state != GSI_CHANNEL_STATE_ALLOCATED && - state != GSI_CHANNEL_STATE_STOPPED) + state != GSI_CHANNEL_STATE_STOPPED) { + dev_err(dev, "bad channel state %u before start\n", state); return -EINVAL; + } ret = gsi_channel_command(channel, GSI_CH_START); /* Channel state will normally have been updated */ state = gsi_channel_state(channel); if (!ret && state != GSI_CHANNEL_STATE_STARTED) { - dev_err(channel->gsi->dev, - "bad channel state (%u) after start\n", state); + dev_err(dev, "bad channel state %u after start\n", state); ret = -EIO; } @@ -496,13 +502,16 @@ static int gsi_channel_start_command(struct gsi_channel *channel) /* Stop a GSI channel in STARTED state */ static int gsi_channel_stop_command(struct gsi_channel *channel) { + struct device *dev = channel->gsi->dev; enum gsi_channel_state state; int ret; state = gsi_channel_state(channel); if (state != GSI_CHANNEL_STATE_STARTED && - state != GSI_CHANNEL_STATE_STOP_IN_PROC) + state != GSI_CHANNEL_STATE_STOP_IN_PROC) { + dev_err(dev, "bad channel state %u before stop\n", state); return -EINVAL; + } ret = gsi_channel_command(channel, GSI_CH_STOP); @@ -515,8 +524,7 @@ static int gsi_channel_stop_command(struct gsi_channel *channel) if (state == GSI_CHANNEL_STATE_STOP_IN_PROC) return -EAGAIN; - dev_err(channel->gsi->dev, - "bad channel state (%u) after stop\n", state); + dev_err(dev, "bad channel state %u after stop\n", state); return -EIO; } @@ -524,6 +532,7 @@ static int gsi_channel_stop_command(struct gsi_channel *channel) /* Reset a GSI channel in ALLOCATED or ERROR state. */ static void gsi_channel_reset_command(struct gsi_channel *channel) { + struct device *dev = channel->gsi->dev; enum gsi_channel_state state; int ret; @@ -532,8 +541,7 @@ static void gsi_channel_reset_command(struct gsi_channel *channel) state = gsi_channel_state(channel); if (state != GSI_CHANNEL_STATE_STOPPED && state != GSI_CHANNEL_STATE_ERROR) { - dev_err(channel->gsi->dev, - "bad channel state (%u) before reset\n", state); + dev_err(dev, "bad channel state %u before reset\n", state); return; } @@ -542,21 +550,20 @@ static void gsi_channel_reset_command(struct gsi_channel *channel) /* Channel state will normally have been updated */ state = gsi_channel_state(channel); if (!ret && state != GSI_CHANNEL_STATE_ALLOCATED) - dev_err(channel->gsi->dev, - "bad channel state (%u) after reset\n", state); + dev_err(dev, "bad channel state %u after reset\n", state); } /* Deallocate an ALLOCATED GSI channel */ static void gsi_channel_de_alloc_command(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; + struct device *dev = gsi->dev; enum gsi_channel_state state; int ret; state = gsi_channel_state(channel); if (state != GSI_CHANNEL_STATE_ALLOCATED) { - dev_err(gsi->dev, - "bad channel state (%u) before dealloc\n", state); + dev_err(dev, "bad channel state %u before dealloc\n", state); return; } @@ -565,8 +572,7 @@ static void gsi_channel_de_alloc_command(struct gsi *gsi, u32 channel_id) /* Channel state will normally have been updated */ state = gsi_channel_state(channel); if (!ret && state != GSI_CHANNEL_STATE_NOT_ALLOCATED) - dev_err(gsi->dev, - "bad channel state (%u) after dealloc\n", state); + dev_err(dev, "bad channel state %u after dealloc\n", state); } /* Ring an event ring doorbell, reporting the last entry processed by the AP. From patchwork Tue Jun 30 12:58:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 192075 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp3791066ilg; Tue, 30 Jun 2020 05:59:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybv7Rl/HQFZuM1xRz2MvwIOpjgfEsW2h84Y+Fj4IIu6GTsPNYj3U5F4FuNzWecNQeKPSq2 X-Received: by 2002:a05:6402:158d:: with SMTP id c13mr23263278edv.103.1593521947399; Tue, 30 Jun 2020 05:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593521947; cv=none; d=google.com; s=arc-20160816; b=gI9Ws84rLi5zb7fOHtBOL5v7D2pEvIQqRI9UoCa5Kvy9FThdxfNDMVVPAHARj3HydG tKt6T0wQzAP+769Op5HumIHOqZh2lYW624D3elVdZjniCnaRp5zd58nvcC60PfLgappu okZmz0CGU+zFbHqZrRErgw1cF+/gzgMTKG7URGOl6iIdoRmSxqgsQcsPPuUkcyT9ib6e SMUCXf0/JFnrxUcl6XDiZPWPSqv/na94uTUPFxoqrFDFbfbAcbCFh/EZQg1tsm67S0LX UUyQ/VrQ8N7O0aaPdN/6vPj4fPdcqWl//+3G6wy8UahwfFyqvE/18YzzI94dlt8VZOnd tFLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UdQQMyfGrlolCh1BnbuyYqAEi0ViFKDhVICFJSF0SgM=; b=NeGFw7njMm6ZUzpksCYR7C3sjZFzNnSDiki9XSRC/4dge+eMePNRB3qextki8vJFaV 5Nko7P+V2IBETst0BkZGJ0+n/cklFa7KnHgA8fA1CilZhHkFJp/pkZRi5UrdtnH2/5LE uq9vpHGBOdCYnqSoUZdb9JO/ewaUSzDmXEiXOksV+bm8V7LqQVPxBYISJiyluElVglqa /xY35wAVBy3OX+dE+y8ImMGkOnJNSys8UaGjm0rzw/Q62qSSfUGLCMU+Pur8PeuK09IM wxM9TNix1p0Rh4xbTpZMhN/Cu4YoO0Pfko3Jg5a2d7s6ElzmIo2XApy3u/iOU+Aw5xYG S2Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n+Us5OkI; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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. [23.128.96.18]) by mx.google.com with ESMTP id rp17si1554234ejb.67.2020.06.30.05.59.07; Tue, 30 Jun 2020 05:59:07 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n+Us5OkI; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S2388153AbgF3M7G (ORCPT + 9 others); Tue, 30 Jun 2020 08:59:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388114AbgF3M6x (ORCPT ); Tue, 30 Jun 2020 08:58:53 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E72DC061755 for ; Tue, 30 Jun 2020 05:58:53 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id a12so20855630ion.13 for ; Tue, 30 Jun 2020 05:58: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 :mime-version:content-transfer-encoding; bh=UdQQMyfGrlolCh1BnbuyYqAEi0ViFKDhVICFJSF0SgM=; b=n+Us5OkI7c0Z8lMtIUZA3IpusUNx46SJMAt7aVzumio2pBDogN7972fK9OR6ahtuJl Rdo5pnOuMtbpsdCF5sp5Ov4WzW+q3I7iRAkpcecv36tpdn7JD9KoPNwHABAZPAgNDTLh 3TUUwaoX2oMobnx47P6W+cGY+Edp40HoCoMDjNOVUipeft6vNj/5GxoDOcvoPwjB2n2K vtQtiXDBWQ+yktOwPo4/pdQLp5GN38ll4tqm3IstW/Exh3G7lQE1yY+huVp/VlRZghGW 0UsULhS30Tp9b9xd1hOqOxbyfaOHt6XcArtOQvTyvdoTtM27US7KjhcL625Vly+OMhQS nimg== 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=UdQQMyfGrlolCh1BnbuyYqAEi0ViFKDhVICFJSF0SgM=; b=rh96Qe2idgYBGlwGXU+eB1rHu8mxFp2yycANHNCdUGjzAS0mCSUxjFsXDi5ifeORMa Za1tb7lOxIuFGyyJ4EhWo5eTiTmm4SC3SaWAjFn2bko/mg1Gk7cZF17PNNy7n+pFk1QV aGG39peLjJAD/G1RvvY7tZ7ZxmM4OINcIq9/uD5/ug8uLKFzrdKOPh+dOvtLS6iH51AM obQloWTSgEod+e5oiSBXwI1+WA02n8DB8HITnPiLuykveZAsmMp60qslAO9Lf44MWdSI qO99+tgmXpMqAAJuwd7JYtxYTn72Gfi2LjMD3HLGwMdCf55AoCmsD+HsZOtRIlQ+xy1O +MRQ== X-Gm-Message-State: AOAM531Xvj6qyFV3YuQYRfNNh+rnj7QzK7qygzH2wdQPAw6iVu17UgfA vM7kYijnh+BF9Ldk8mXGkPwIng== X-Received: by 2002:a05:6602:21c3:: with SMTP id c3mr10296358ioc.93.1593521932441; Tue, 30 Jun 2020 05:58:52 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id z9sm1622588ilb.41.2020.06.30.05.58.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 05:58:52 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/3] net: ipa: standarize more GSI error messages Date: Tue, 30 Jun 2020 07:58:45 -0500 Message-Id: <20200630125846.1281988-3-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630125846.1281988-1-elder@linaro.org> References: <20200630125846.1281988-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Make minor updates to error messages reported in "gsi.c": - Use local variables to reduce multi-line function calls - Don't use parentheses in messages - Do some slight rewording in a few cases Signed-off-by: Alex Elder --- v2: Fixed two indentation issues reported by checkpatch.pl. drivers/net/ipa/gsi.c | 57 ++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 28 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 7e4e54ee09b1..c84b8d92caa9 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -336,6 +336,7 @@ static int evt_ring_command(struct gsi *gsi, u32 evt_ring_id, { struct gsi_evt_ring *evt_ring = &gsi->evt_ring[evt_ring_id]; struct completion *completion = &evt_ring->completion; + struct device *dev = gsi->dev; u32 val; val = u32_encode_bits(evt_ring_id, EV_CHID_FMASK); @@ -344,8 +345,8 @@ static int evt_ring_command(struct gsi *gsi, u32 evt_ring_id, if (gsi_command(gsi, GSI_EV_CH_CMD_OFFSET, val, completion)) return 0; /* Success! */ - dev_err(gsi->dev, "GSI command %u to event ring %u timed out " - "(state is %u)\n", opcode, evt_ring_id, evt_ring->state); + dev_err(dev, "GSI command %u for event ring %u timed out, state %u\n", + opcode, evt_ring_id, evt_ring->state); return -ETIMEDOUT; } @@ -431,6 +432,7 @@ gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode) struct completion *completion = &channel->completion; u32 channel_id = gsi_channel_id(channel); struct gsi *gsi = channel->gsi; + struct device *dev = gsi->dev; u32 val; val = u32_encode_bits(channel_id, CH_CHID_FMASK); @@ -439,8 +441,7 @@ gsi_channel_command(struct gsi_channel *channel, enum gsi_ch_cmd_opcode opcode) if (gsi_command(gsi, GSI_CH_CMD_OFFSET, val, completion)) return 0; /* Success! */ - dev_err(gsi->dev, - "GSI command %u to channel %u timed out (state is %u)\n", + dev_err(dev, "GSI command %u for channel %u timed out, state %u\n", opcode, channel_id, gsi_channel_state(channel)); return -ETIMEDOUT; @@ -1154,8 +1155,8 @@ static irqreturn_t gsi_isr(int irq, void *dev_id) break; default: dev_err(gsi->dev, - "%s: unrecognized type 0x%08x\n", - __func__, gsi_intr); + "unrecognized interrupt type 0x%08x\n", + gsi_intr); break; } } while (intr_mask); @@ -1259,7 +1260,7 @@ static int gsi_ring_alloc(struct gsi *gsi, struct gsi_ring *ring, u32 count) if (ring->virt && addr % size) { dma_free_coherent(dev, size, ring->virt, ring->addr); dev_err(dev, "unable to alloc 0x%zx-aligned ring buffer\n", - size); + size); return -EINVAL; /* Not a good error value, but distinct */ } else if (!ring->virt) { return -ENOMEM; @@ -1650,12 +1651,13 @@ static void gsi_channel_teardown(struct gsi *gsi) /* Setup function for GSI. GSI firmware must be loaded and initialized */ int gsi_setup(struct gsi *gsi, bool legacy) { + struct device *dev = gsi->dev; u32 val; /* Here is where we first touch the GSI hardware */ val = ioread32(gsi->virt + GSI_GSI_STATUS_OFFSET); if (!(val & ENABLED_FMASK)) { - dev_err(gsi->dev, "GSI has not been enabled\n"); + dev_err(dev, "GSI has not been enabled\n"); return -EIO; } @@ -1663,24 +1665,24 @@ int gsi_setup(struct gsi *gsi, bool legacy) gsi->channel_count = u32_get_bits(val, NUM_CH_PER_EE_FMASK); if (!gsi->channel_count) { - dev_err(gsi->dev, "GSI reports zero channels supported\n"); + dev_err(dev, "GSI reports zero channels supported\n"); return -EINVAL; } if (gsi->channel_count > GSI_CHANNEL_COUNT_MAX) { - dev_warn(gsi->dev, - "limiting to %u channels (hardware supports %u)\n", + dev_warn(dev, + "limiting to %u channels; hardware supports %u\n", GSI_CHANNEL_COUNT_MAX, gsi->channel_count); gsi->channel_count = GSI_CHANNEL_COUNT_MAX; } gsi->evt_ring_count = u32_get_bits(val, NUM_EV_PER_EE_FMASK); if (!gsi->evt_ring_count) { - dev_err(gsi->dev, "GSI reports zero event rings supported\n"); + dev_err(dev, "GSI reports zero event rings supported\n"); return -EINVAL; } if (gsi->evt_ring_count > GSI_EVT_RING_COUNT_MAX) { - dev_warn(gsi->dev, - "limiting to %u event rings (hardware supports %u)\n", + dev_warn(dev, + "limiting to %u event rings; hardware supports %u\n", GSI_EVT_RING_COUNT_MAX, gsi->evt_ring_count); gsi->evt_ring_count = GSI_EVT_RING_COUNT_MAX; } @@ -1766,19 +1768,19 @@ static bool gsi_channel_data_valid(struct gsi *gsi, /* Make sure channel ids are in the range driver supports */ if (channel_id >= GSI_CHANNEL_COUNT_MAX) { - dev_err(dev, "bad channel id %u (must be less than %u)\n", + dev_err(dev, "bad channel id %u; must be less than %u\n", channel_id, GSI_CHANNEL_COUNT_MAX); return false; } if (data->ee_id != GSI_EE_AP && data->ee_id != GSI_EE_MODEM) { - dev_err(dev, "bad EE id %u (AP or modem)\n", data->ee_id); + dev_err(dev, "bad EE id %u; not AP or modem\n", data->ee_id); return false; } if (!data->channel.tlv_count || data->channel.tlv_count > GSI_TLV_MAX) { - dev_err(dev, "channel %u bad tlv_count %u (must be 1..%u)\n", + dev_err(dev, "channel %u bad tlv_count %u; must be 1..%u\n", channel_id, data->channel.tlv_count, GSI_TLV_MAX); return false; } @@ -1796,13 +1798,13 @@ static bool gsi_channel_data_valid(struct gsi *gsi, } if (!is_power_of_2(data->channel.tre_count)) { - dev_err(dev, "channel %u bad tre_count %u (not power of 2)\n", + dev_err(dev, "channel %u bad tre_count %u; not power of 2\n", channel_id, data->channel.tre_count); return false; } if (!is_power_of_2(data->channel.event_count)) { - dev_err(dev, "channel %u bad event_count %u (not power of 2)\n", + dev_err(dev, "channel %u bad event_count %u; not power of 2\n", channel_id, data->channel.event_count); return false; } @@ -1956,6 +1958,7 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch, u32 count, const struct ipa_gsi_endpoint_data *data, bool modem_alloc) { + struct device *dev = &pdev->dev; struct resource *res; resource_size_t size; unsigned int irq; @@ -1963,7 +1966,7 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch, gsi_validate_build(); - gsi->dev = &pdev->dev; + gsi->dev = dev; /* The GSI layer performs NAPI on all endpoints. NAPI requires a * network device structure, but the GSI layer does not have one, @@ -1974,43 +1977,41 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch, /* Get the GSI IRQ and request for it to wake the system */ ret = platform_get_irq_byname(pdev, "gsi"); if (ret <= 0) { - dev_err(gsi->dev, - "DT error %d getting \"gsi\" IRQ property\n", ret); + dev_err(dev, "DT error %d getting \"gsi\" IRQ property\n", ret); return ret ? : -EINVAL; } irq = ret; ret = request_irq(irq, gsi_isr, 0, "gsi", gsi); if (ret) { - dev_err(gsi->dev, "error %d requesting \"gsi\" IRQ\n", ret); + dev_err(dev, "error %d requesting \"gsi\" IRQ\n", ret); return ret; } gsi->irq = irq; ret = enable_irq_wake(gsi->irq); if (ret) - dev_warn(gsi->dev, "error %d enabling gsi wake irq\n", ret); + dev_warn(dev, "error %d enabling gsi wake irq\n", ret); gsi->irq_wake_enabled = !ret; /* Get GSI memory range and map it */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gsi"); if (!res) { - dev_err(gsi->dev, - "DT error getting \"gsi\" memory property\n"); + dev_err(dev, "DT error getting \"gsi\" memory property\n"); ret = -ENODEV; goto err_disable_irq_wake; } size = resource_size(res); if (res->start > U32_MAX || size > U32_MAX - res->start) { - dev_err(gsi->dev, "DT memory resource \"gsi\" out of range\n"); + dev_err(dev, "DT memory resource \"gsi\" out of range\n"); ret = -EINVAL; goto err_disable_irq_wake; } gsi->virt = ioremap(res->start, size); if (!gsi->virt) { - dev_err(gsi->dev, "unable to remap \"gsi\" memory\n"); + dev_err(dev, "unable to remap \"gsi\" memory\n"); ret = -ENOMEM; goto err_disable_irq_wake; } From patchwork Tue Jun 30 12:58:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 192074 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp3790984ilg; Tue, 30 Jun 2020 05:58:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoZIykXyjQH7gw3btwfz5yVUKl1yFpbu/DxTv8CrDgQNNTGFUECaLSpkv0+mBOR90aubaO X-Received: by 2002:a17:906:a459:: with SMTP id cb25mr18032077ejb.234.1593521939160; Tue, 30 Jun 2020 05:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593521939; cv=none; d=google.com; s=arc-20160816; b=NSldTehr2J/xKnVVHNynIi4TRX8zU3v4eGtYpRxVkGBnpt7kEVTo64crfBSxyHgQgl FRfld7yHsUfqgRyCTuC6ym/5lG1CtmtpjgZ6YmbacDasZN53dUWen2guaJJR9HPhMJPi pSPACNc3feM0Weu6hHsLeCijr+XvfaraXy/wHENrhEdJd/c8zT5dFoMAKLG8KgqkSWqS W/wrI9Ofz+EGLFZgMpVvgaQvjTQMj9L9h0iG27O2TbJcu07Ga/OB97UasK9HhbqXvzUh 0MdHVmyWUKm/0+3EsF+53eKDLL6BtEjgObi4N0dMu66l7hfwHHybi/0m4O5rWqUrBGks NZgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nae080oEZX7FnMGUXLt4+wKsFcs0lNWW0DRxHmTZnmM=; b=IW7U7ceNrgMJE6rL8I9gqweK/BWNVGsRWnmXYE0Tj1WHh5fOe95QhQfilSQRv5bDPp QpyO5td8I6MJ8kTfGboayH2tDqDKSKhJiH1oLPSRsr4FuwFOw+yJVd469F8F2a//pFgP QfxoBT9deJbzegqMIAENNKpriQ+nPYnTY+7nrkfMUNFoaFf57g8h/GlYQUyyf9mGcOvU SmzZ19twc9HUC5QNrb6azvtBtI4RpXd6dNjHKF+WWOMzQ3a71Pf1josV0RMm2xbOImfO 2KZDl8BawBP+VDVEKsjcySgyOOTumJs4qEeZ0pEPYj7M6nlrx/uPxjHKahQIZde/UqSe 1ceQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zBHXI769; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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. [23.128.96.18]) by mx.google.com with ESMTP id ca10si1608778edb.224.2020.06.30.05.58.59; Tue, 30 Jun 2020 05:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zBHXI769; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S2388147AbgF3M65 (ORCPT + 9 others); Tue, 30 Jun 2020 08:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388125AbgF3M6y (ORCPT ); Tue, 30 Jun 2020 08:58:54 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 217FFC03E97B for ; Tue, 30 Jun 2020 05:58:54 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id v6so7156955iob.4 for ; Tue, 30 Jun 2020 05:58: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 :mime-version:content-transfer-encoding; bh=nae080oEZX7FnMGUXLt4+wKsFcs0lNWW0DRxHmTZnmM=; b=zBHXI769t9uyz8WBfdyyP9ALh1MsJ5LaGP07LTYIJH8Dkufa1muknxr/m4u32IKesg RKkKzyxfQ4SsXmS1/oyNegmI9clfMwrqWQtIQJzzpOQC3KmN6KaAl0q5nvJURf/V6iuv qBHnsEfeHoMM8TtinepXa8kazRAq2jxMe/16ERmlxmfz1IIsoobUhzLRuSXsfvu/MwmY 8GDyCBpbL1aDcfW+ZYSn2e9jalJi0GMsGkiJXoQ/ChT08ohORR/RFx1iSXf3BuB87Y9g twQI+nQFJ7+Qoi3yvvCX2kAjDeIMjdKqxyyLbpQuNA156JW3GQeOPLlm2R+w1D8/Ag6p Sk7w== 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=nae080oEZX7FnMGUXLt4+wKsFcs0lNWW0DRxHmTZnmM=; b=YjWJUr09tQfbNmD8rZTzQkqf29/3IDlchOdpk7UOREWm3D2EdZqcQhY9QuecYyZJIA jWH1G6VbEEgC/xhgsTiBuk7EMMgLSb3cHxt+j9+x8QoPaWoI+R/J20s6SvblrnmLONPD eoH9P7GUKbfp1PEmnkmMW1yLKCe4qgXLRVQbNEFvuhIWXkMYVOo3RNFcyQu7n8at1UbM 6BRPHnS49QAOWdT1Zi3cUC0kpktOhGM73N4hVWFHNTCaGcwIIHtjahRuq94tCKHvJbgT kipKCH+lWxpOL14c4zQ8K+XKEYbOvmBPaDOne1h+3VKgnietwsd2DKrQqjg0UIlP8LcK OmGQ== X-Gm-Message-State: AOAM532Gi/J0+b2ZoUaTBcvzJNT6OmZNC/EhkTDLT/upjhS6aYkhaF9y pIA46OTAYQuJdN1WfUvAP3UV6Q== X-Received: by 2002:a6b:15c2:: with SMTP id 185mr21540522iov.207.1593521933515; Tue, 30 Jun 2020 05:58:53 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id z9sm1622588ilb.41.2020.06.30.05.58.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 05:58:52 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 3/3] net: ipa: kill IPA_MEM_UC_OFFSET Date: Tue, 30 Jun 2020 07:58:46 -0500 Message-Id: <20200630125846.1281988-4-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200630125846.1281988-1-elder@linaro.org> References: <20200630125846.1281988-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The microcontroller shared memory area is at the beginning of the IPA resident memory. IPA_MEM_UC_OFFSET was defined as the offset within that region where it's found, but it's 0, and it's never actually used. Just get rid of the definition, and move some of the description it had to be above the definition of the ipa_uc_mem_area structure. Signed-off-by: Alex Elder --- v2: No change from v1. drivers/net/ipa/ipa_uc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index a1f8db00d55a..9f9980ec2ed3 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -35,12 +35,6 @@ */ /* Supports hardware interface version 0x2000 */ -/* Offset relative to the base of the IPA shared address space of the - * shared region used for communication with the microcontroller. The - * region is 128 bytes in size, but only the first 40 bytes are used. - */ -#define IPA_MEM_UC_OFFSET 0x0000 - /* Delay to allow a the microcontroller to save state when crashing */ #define IPA_SEND_DELAY 100 /* microseconds */ @@ -60,6 +54,10 @@ * @hw_state: state of hardware (including error type information) * @warning_counter: counter of non-fatal hardware errors * @interface_version: hardware-reported interface version + * + * A shared memory area at the base of IPA resident memory is used for + * communication with the microcontroller. The region is 128 bytes in + * size, but only the first 40 bytes (structured this way) are used. */ struct ipa_uc_mem_area { u8 command; /* enum ipa_uc_command */