From patchwork Mon Nov 2 17:53:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 315796 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02505C388F9 for ; Mon, 2 Nov 2020 17:54:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D71421D91 for ; Mon, 2 Nov 2020 17:54:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aa9HrT4K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbgKBRyJ (ORCPT ); Mon, 2 Nov 2020 12:54:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbgKBRyH (ORCPT ); Mon, 2 Nov 2020 12:54:07 -0500 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 250E8C061A04 for ; Mon, 2 Nov 2020 09:54:06 -0800 (PST) Received: by mail-il1-x144.google.com with SMTP id t13so5786026ilp.2 for ; Mon, 02 Nov 2020 09:54:06 -0800 (PST) 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=jmjVYy285nrY064kTbgnLlqLx5ORT9uOKTs5XvuM26I=; b=aa9HrT4KFzTRTl/TvhwLmu5Bar+f6KQX4ZtYjdg062aEHcu/cXYKt0YkzcAehApQEV BKsf1xL2RNn/7D7Cw9ZKNngfTSr9qzsAgQ4OOLlrAJtZedGnPWetWY0rq12/iI/GNMt2 OIiBcFmIi9cNg90DtpvNGC44ayWbCYB5eiLKJG4p1o3vKf5CpUH6zv3KFeicl7QJAgfw eIzYyWV4iO1YxiEM/2NdUf2Zkb1VL8AcLdlrcSqF4vLjQNAwmG2PxASHYUTtt+AXsU/T Q/ggyS+WwWgsLEAK3/uWl9HBRyJbDP1uS4wAbTXsgG1n+B0/6+qnWsXFpUNLjCFxu1oy 7Gww== 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=jmjVYy285nrY064kTbgnLlqLx5ORT9uOKTs5XvuM26I=; b=lx54uf5x62ShPhJ+RJw0loHglZmP+accMCg+LjBDAO5U0/xHr7kbQfw99Onb5RuTCW uR/TMsxNqBpy2dxqC2XhkWuEl+js19sqnTZ43d9nezZNwu0hKevxfG/cbpuV44W6geLU oXcZ5QzkA4vCm+45xHvYYVCg2a/dT7hUGS1zGwMM9kRUTXJTbKSZkjTL3bIoCGvz2LCD 8mmD4h+erN8a/0wouzRaRGA0O7nM6C3MNCaFd6TBSeaW1ferqhII8hFQ7JUxab21MN6K 1h/Mk+pDr4HvaUfoPjozntHco9OW6SgradUQa3Vp+QrcEdWAcDHhMyScAEhTlpMlnPyZ uYRQ== X-Gm-Message-State: AOAM533GDge/IKw09OtH9zEwtbbPRhtcHr3mittMJ5uiLc54u0xQRQV8 nTOzFCVZxh8qQ8YvQshUFUXGeg== X-Google-Smtp-Source: ABdhPJz3qED4+mO8Wcgds1VbIstJ9djidzGpnlWjBjj4l+Mvk9I1suRiRZDmG/0QAGqBHZf0dzyXIA== X-Received: by 2002:a92:bb8d:: with SMTP id x13mr11699971ilk.225.1604339645362; Mon, 02 Nov 2020 09:54:05 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id r4sm11089591ilj.43.2020.11.02.09.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:54:04 -0800 (PST) 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 1/6] net: ipa: expose IPA version to the GSI layer Date: Mon, 2 Nov 2020 11:53:55 -0600 Message-Id: <20201102175400.6282-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201102175400.6282-1-elder@linaro.org> References: <20201102175400.6282-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Although GSI is integral to IPA, it is a separate hardware component and the IPA code supporting it has been structured to avoid explicit dependence on IPA details. An example of this is that gsi_init() is passed a number of Boolean flags to indicate special behaviors, whose values are dependent on the IPA hardware version. Looking ahead, newer hardware versions would require even more such special behaviors. For any given version of IPA hardware (like 3.5.1 or 4.2), the GSI hardware version is fixed (in this case, 1.3 and 2.2, respectively). So the IPA version *implies* the GSI version, and the IPA version can be used as effectively the equivalent of the GSI hardware version. Rather than proliferating new special behavior flags, just provide the IPA version to the GSI layer when it is initialized. The GSI code can then use that directly to determine whether special behaviors are required. The IPA version enumerated type is already isolated to its own header file, so the exposure of this IPA detail is very limited. For now, just change gsi_init() to pass the version rather than the Boolean flags, and set the flag values internal to that function. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 14 +++++++++++--- drivers/net/ipa/gsi.h | 11 ++++++++--- drivers/net/ipa/ipa_main.c | 11 ++--------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 6bfac1efe037c..1e19160281dd3 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -21,6 +21,7 @@ #include "gsi_trans.h" #include "ipa_gsi.h" #include "ipa_data.h" +#include "ipa_version.h" /** * DOC: The IPA Generic Software Interface @@ -1952,18 +1953,25 @@ static void gsi_channel_exit(struct gsi *gsi) } /* Init function for GSI. GSI hardware does not need to be "ready" */ -int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch, - u32 count, const struct ipa_gsi_endpoint_data *data, - bool modem_alloc) +int gsi_init(struct gsi *gsi, struct platform_device *pdev, + enum ipa_version version, u32 count, + const struct ipa_gsi_endpoint_data *data) { struct device *dev = &pdev->dev; struct resource *res; resource_size_t size; unsigned int irq; + bool modem_alloc; + bool prefetch; int ret; gsi_validate_build(); + /* IPA v4.0+ (GSI v2.0+) uses prefetch for the command channel */ + prefetch = version != IPA_VERSION_3_5_1; + /* IPA v4.2 requires the AP to allocate channels for the modem */ + modem_alloc = version == IPA_VERSION_4_2; + gsi->dev = dev; /* The GSI layer performs NAPI on all endpoints. NAPI requires a diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 3f9f29d531c43..2dd8ee78aa8c7 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -20,6 +20,8 @@ /* Maximum TLV FIFO size for a channel; 64 here is arbitrary (and high) */ #define GSI_TLV_MAX 64 +enum ipa_version; + struct device; struct scatterlist; struct platform_device; @@ -236,15 +238,18 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start); * gsi_init() - Initialize the GSI subsystem * @gsi: Address of GSI structure embedded in an IPA structure * @pdev: IPA platform device + * @version: IPA hardware version (implies GSI version) + * @count: Number of entries in the configuration data array + * @data: Endpoint and channel configuration data * * Return: 0 if successful, or a negative error code * * Early stage initialization of the GSI subsystem, performing tasks * that can be done before the GSI hardware is ready to use. */ -int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch, - u32 count, const struct ipa_gsi_endpoint_data *data, - bool modem_alloc); +int gsi_init(struct gsi *gsi, struct platform_device *pdev, + enum ipa_version version, u32 count, + const struct ipa_gsi_endpoint_data *data); /** * gsi_exit() - Exit the GSI subsystem diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index f4dd14d9550fe..0d3d1a5cf07c1 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -723,10 +723,8 @@ static int ipa_probe(struct platform_device *pdev) const struct ipa_data *data; struct ipa_clock *clock; struct rproc *rproc; - bool modem_alloc; bool modem_init; struct ipa *ipa; - bool prefetch; phandle ph; int ret; @@ -788,13 +786,8 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_reg_exit; - /* GSI v2.0+ (IPA v4.0+) uses prefetch for the command channel */ - prefetch = ipa->version != IPA_VERSION_3_5_1; - /* IPA v4.2 requires the AP to allocate channels for the modem */ - modem_alloc = ipa->version == IPA_VERSION_4_2; - - ret = gsi_init(&ipa->gsi, pdev, prefetch, data->endpoint_count, - data->endpoint_data, modem_alloc); + ret = gsi_init(&ipa->gsi, pdev, ipa->version, data->endpoint_count, + data->endpoint_data); if (ret) goto err_mem_exit; From patchwork Mon Nov 2 17:53:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 320367 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp3925443ilc; Mon, 2 Nov 2020 09:54:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXxl2Lw0c83wv4+Wj0a1wvoJhg92cOK5oDL2Sd4pwoo8cT9RRsEM0PShjVNw92n1rOe4vz X-Received: by 2002:a17:906:1c83:: with SMTP id g3mr16089934ejh.168.1604339674386; Mon, 02 Nov 2020 09:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604339674; cv=none; d=google.com; s=arc-20160816; b=i21MYiffkikdcXrWd5/3DYMmh00VBQy/j6KVObTUf6ihWDV0OQknOgbyFjKRIX4eew 92eq5cXdIqQrBDolvZVig6BPgqbupzGodM8SNiVYBAPl3j+BRE4tGGgkHJ9zSy1j8l2k BZzI6T6i53326dYx+vhasiEjhvggZU75cUk8xD7AoBwtp16ew0WEgFC0zeNSFznLVz8K eedPkBlklM6lp8bt5xPG8kini8HTl1Umxf/olrkOwe+Wz7cNvyu6KqNtRmt3rTIMNJ6r umoMm6N9Me8twwWaWNO5+DQPk2kCyeQoxFkLgABkB4iqYanUTu2AbD0U2A6VQePgDH+U Z/PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uQkch3MA8NUfknMqZNI4RlophsHH876j+HFe2EhGf3U=; b=JQsOOI4vp/PdZc+NHF6XEpWj9vlUP4oQM1Wa1Ms632oHiXm2Tbz6UfA5HQb25T4LF2 t4U/QKdpDehrkrYoIrJFZZD3OQnR4si8Xk8BHWyfnU7QiJvOlvOFs46OVv/sOpoE+qvc Ziud945nWmMnHbm0gIIMGp4G51M1NzQDxpjZbMEiPfUMwdlV/bjwXDsJROp7LxUVumLo nWcUN9D+UehnVIe2XhB/5K16rIggg6dYkSlWOn8t6VkLZxMUdbMhbIQcyBl+Uz+LzDSh eilqNeRXlhAfHd74ahyO6q2lfxboeB7xBDXvaQlS5svSiA8vQd+x/DlcfMGRiYdUXpmP P66g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lvBU5EAl; 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 y7si10494463ejd.450.2020.11.02.09.54.34; Mon, 02 Nov 2020 09:54:34 -0800 (PST) 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=lvBU5EAl; 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 S1726449AbgKBRyb (ORCPT + 8 others); Mon, 2 Nov 2020 12:54:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726412AbgKBRyI (ORCPT ); Mon, 2 Nov 2020 12:54:08 -0500 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 621A0C0617A6 for ; Mon, 2 Nov 2020 09:54:07 -0800 (PST) Received: by mail-il1-x141.google.com with SMTP id q1so13731019ilt.6 for ; Mon, 02 Nov 2020 09:54:07 -0800 (PST) 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=uQkch3MA8NUfknMqZNI4RlophsHH876j+HFe2EhGf3U=; b=lvBU5EAlIGuN1EshizyFdjWBOAwRTLHSx8Hnm1+B7oYHwCgwb0aRGAeGck3MBY8eVR h7pE45OZ/XVxxoWBcOWAhCDSCjcv26JrM6SBgEQNORvOqSSB8/cbHCVM9at2UtyKY+77 4+/KR5DmshnZrmjAjZmI7zOPZUK0zR2VE8x5CG/SmslfEKBR7JiYZWNqMC80YZYfUU+o vRCVOdKn0YTLMc6Zm9Txrp++OCIwxFSaKvhnDPWYyuh3emo3coWYjD/K6UhwhwLwIxKv W/s8j+Xq/zDuEI/U3j3xbb5IIYnMOK/OZaRThMnhln9O4hXntLD/kL3gv05rYGj/Hpvh 0/Jg== 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=uQkch3MA8NUfknMqZNI4RlophsHH876j+HFe2EhGf3U=; b=fS7ZzEiOeliJQZwa4UWlNvodtZa5dq5F4x6jLSVShSZZ5YRijSkbyBirrfbQZFhPdb BWYpjSGvrj//b/h1m5bv7M+4PB4d+Xw5xFJsgUsPF05uMh2ZxKXl7fzjbAZDRxgFn4Ij n6Al2QIv4mNUlc6WfQLTSsM3F1x7B+Wg3/DCNSIGX/YOCOlONv5pDrZJVQ5CPYumCB3K 4nppmL306UFdhoDrJhIHFVRwiEK8UpktD7ym+tU/N4ohCkSswFMrwFP5xP4q5JVRyTGO oNOWTPLcExQ4sOVA8bsba32o9nnZehMzMHN9lsCxAprDXI/qmrbpgJV1u7mSg7Wp58um XHXA== X-Gm-Message-State: AOAM531hUNS/ErVoMaAyNZM0yK5QhszN0ssCJUFfXYGOY8QaAqk79WP2 NofyxfZJuYBzl7NZJQ0MncEKnA== X-Received: by 2002:a92:41cf:: with SMTP id o198mr11832519ila.262.1604339646728; Mon, 02 Nov 2020 09:54:06 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id r4sm11089591ilj.43.2020.11.02.09.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:54:05 -0800 (PST) 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 2/6] net: ipa: record IPA version in GSI structure Date: Mon, 2 Nov 2020 11:53:56 -0600 Message-Id: <20201102175400.6282-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201102175400.6282-1-elder@linaro.org> References: <20201102175400.6282-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Record the IPA version passed to gsi_init() in the GSI structure. This allows that value to be used directly where needed, rather than passing and storing certain flag arguments through the code. In particular, for all but one supported version of IPA, the command channel is programmed to only use an "escape buffer". By storing the IPA version, we can do a simple version check in one location, and avoid storing a flag field in every channel (and passing a flag along while initializing channels to set that field properly). Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 16 +++++++--------- drivers/net/ipa/gsi.h | 6 +++--- 2 files changed, 10 insertions(+), 12 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 1e19160281dd3..178d6ec2699eb 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -747,7 +747,8 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) if (doorbell) val |= USE_DB_ENG_FMASK; - if (!channel->use_prefetch) + /* Starting with IPA v4.0 the command channel uses the escape buffer */ + if (gsi->version != IPA_VERSION_3_5_1 && channel->command) val |= USE_ESCAPE_BUF_ONLY_FMASK; iowrite32(val, gsi->virt + GSI_CH_C_QOS_OFFSET(channel_id)); @@ -1815,7 +1816,7 @@ static bool gsi_channel_data_valid(struct gsi *gsi, /* Init function for a single channel */ static int gsi_channel_init_one(struct gsi *gsi, const struct ipa_gsi_endpoint_data *data, - bool command, bool prefetch) + bool command) { struct gsi_channel *channel; u32 tre_count; @@ -1839,7 +1840,6 @@ static int gsi_channel_init_one(struct gsi *gsi, channel->gsi = gsi; channel->toward_ipa = data->toward_ipa; channel->command = command; - channel->use_prefetch = command && prefetch; channel->tlv_count = data->channel.tlv_count; channel->tre_count = tre_count; channel->event_count = data->channel.event_count; @@ -1893,7 +1893,7 @@ static void gsi_channel_exit_one(struct gsi_channel *channel) } /* Init function for channels */ -static int gsi_channel_init(struct gsi *gsi, bool prefetch, u32 count, +static int gsi_channel_init(struct gsi *gsi, u32 count, const struct ipa_gsi_endpoint_data *data, bool modem_alloc) { @@ -1917,7 +1917,7 @@ static int gsi_channel_init(struct gsi *gsi, bool prefetch, u32 count, continue; } - ret = gsi_channel_init_one(gsi, &data[i], command, prefetch); + ret = gsi_channel_init_one(gsi, &data[i], command); if (ret) goto err_unwind; } @@ -1962,17 +1962,15 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, resource_size_t size; unsigned int irq; bool modem_alloc; - bool prefetch; int ret; gsi_validate_build(); - /* IPA v4.0+ (GSI v2.0+) uses prefetch for the command channel */ - prefetch = version != IPA_VERSION_3_5_1; /* IPA v4.2 requires the AP to allocate channels for the modem */ modem_alloc = version == IPA_VERSION_4_2; gsi->dev = dev; + gsi->version = version; /* The GSI layer performs NAPI on all endpoints. NAPI requires a * network device structure, but the GSI layer does not have one, @@ -2016,7 +2014,7 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, goto err_free_irq; } - ret = gsi_channel_init(gsi, prefetch, count, data, modem_alloc); + ret = gsi_channel_init(gsi, count, data, modem_alloc); if (ret) goto err_iounmap; diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 2dd8ee78aa8c7..cf117b52496c1 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -13,6 +13,8 @@ #include #include +#include "ipa_version.h" + /* Maximum number of channels and event rings supported by the driver */ #define GSI_CHANNEL_COUNT_MAX 17 #define GSI_EVT_RING_COUNT_MAX 13 @@ -20,8 +22,6 @@ /* Maximum TLV FIFO size for a channel; 64 here is arbitrary (and high) */ #define GSI_TLV_MAX 64 -enum ipa_version; - struct device; struct scatterlist; struct platform_device; @@ -109,7 +109,6 @@ struct gsi_channel { struct gsi *gsi; bool toward_ipa; bool command; /* AP command TX channel or not */ - bool use_prefetch; /* use prefetch (else escape buf) */ u8 tlv_count; /* # entries in TLV FIFO */ u16 tre_count; @@ -149,6 +148,7 @@ struct gsi_evt_ring { struct gsi { struct device *dev; /* Same as IPA device */ + enum ipa_version version; struct net_device dummy_dev; /* needed for NAPI */ void __iomem *virt; u32 irq; From patchwork Mon Nov 2 17:53:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 320363 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp3925244ilc; Mon, 2 Nov 2020 09:54:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwD+0wUFv0F3B7Fv8Q4QNpY75/5QX5ZqYTCzIIg2lan+BupudbquYFiUvfebLIdbPc3N0cl X-Received: by 2002:a17:906:4d93:: with SMTP id s19mr12193359eju.271.1604339654464; Mon, 02 Nov 2020 09:54:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604339654; cv=none; d=google.com; s=arc-20160816; b=rkRxjxpsTl0nYIoN9+bG7Vssz+NreX1dGC/rpJ9SOjSTcodBTnwwSMfu56oPIhYStU ArTDXN8BhdNnfTNpPCpcS1kel+oPkFLlYe8V2Gas9Ic67PgjP9QDFa68wWCPa/oTk2fP VZJd97xrrjnr4hkN6LoXRKl+F81tIZ6+/ryMYuGwj7xa5XWqO9STx2VQDrZeIUIbRFl4 ikf0giVhGQF9IBmNCoEptS1SFuGWW97cV3Wxg/lR0IG40SMNhMDiIzhFAJVwcKMSKcmE 1i5egYJxGBmYx34ExB5D4xkTKhtOizjfKEgG3TvkFYsRPHWJGjzSvfESFnF+faXOSu9a SK5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2yVM2+cSsEC1ByDwnNPBPLtup/RwymccxagL8bfkbms=; b=AUDNwVvSBV6PmfF0G6VAnlV+rB65mhO6fUOD34iphztjkFlUF7m3EWGKNR21EzRMEm W4hZB9ngbsldSTXLNfsRylQ/pRHodbnd+dDxWtrJPNSTrTJ/wrg8aKnPGgeBm+dYDXRd fLZ9aEaAoum9pmb/0rb42W3IJ6IyvFeZnmuTzV8Z1RG0PRHVr0XReLIYUsKR+U4Gx7ea ZCGrHVsL+roh0MGfPFCjitNW7/E4LmyELhvgNjfZ6/jEoR3WOwohTSH5fP42NqRfJM7s mTGLad3zMnok8rGiK4QUpzt7JdDuWLU2JryaflBqY5diBbd0kEUdDjNj/ybg2UTcfvF9 lBOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=liY9yaQo; 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 r26si12226619ejb.125.2020.11.02.09.54.14; Mon, 02 Nov 2020 09:54:14 -0800 (PST) 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=liY9yaQo; 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 S1726430AbgKBRyK (ORCPT + 8 others); Mon, 2 Nov 2020 12:54:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbgKBRyJ (ORCPT ); Mon, 2 Nov 2020 12:54:09 -0500 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25C39C061A04 for ; Mon, 2 Nov 2020 09:54:09 -0800 (PST) Received: by mail-il1-x143.google.com with SMTP id q1so13731097ilt.6 for ; Mon, 02 Nov 2020 09:54:09 -0800 (PST) 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=2yVM2+cSsEC1ByDwnNPBPLtup/RwymccxagL8bfkbms=; b=liY9yaQoXgmxGExwxwR7G24/uux6kd/yUeR+y82X18MFNIwOEzWDscNUWmx0wdHJMr SMg8XqP2tIi/4xEDOVcMdIRBBDfY3HheYvGh1mcY5JwxuyP7uc9TIqu8GLLuZGQrhL8K lX43UkiqjibTG5TYpdpnQVPI54c7/LKAfSp/p68hg9Hxg5ymW1eQ3QudwYnBIH8W3JN7 dyYtPlIyxT9orhkMqbUHt4iVV9+wuJzAAqMQTrFkzykmdzAGewIeCECKBIqwDbigwGrH ySeEbJeFtqjbPjRpwlgnVmJYgu5YAxc3t48mE2dH4miBv+F72CthNvAqeNK9eT/85Bzz 1DvQ== 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=2yVM2+cSsEC1ByDwnNPBPLtup/RwymccxagL8bfkbms=; b=ZFNz14v7DVns5ajnhYzM6Jgtl5U45pwVXUWJRCxx9XBqoZ8EvHX7jgveG4CjPDVqZH omgItGqIqCAkJUxRETVSLU/uOeL+PRG1tGevOjQScXYZw0fHjAVG0+0ufo0vAxoOaoju JmWvPLeMsATqKX6/FIU1Go/elVUI0bJfb6NY9013Jt6BcCDea7MC3heKvMRGTldviTan yKeEHaSKP3hTlXVZQRiDl+2+wdu2KrOpKulT1B196LtF76j6FP6uaNjquz0e7OJGKdn+ QTeaXZOMTPpbZCCn0G9crJB++s74KNaUD8n4Uq4NVxmAu4l/0pdTH+CxDR+s76PNHqKQ 9rgw== X-Gm-Message-State: AOAM532JMRu7YreNQmQlwLgvlcI+mCf85Y1ENPzE3SIZneKyc7EI1M6z ofMRkG7NeEvhvAVu+BCbywNNzg== X-Received: by 2002:a92:da92:: with SMTP id u18mr11971550iln.266.1604339648566; Mon, 02 Nov 2020 09:54:08 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id r4sm11089591ilj.43.2020.11.02.09.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:54:07 -0800 (PST) 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 3/6] net: ipa: use version in gsi_channel_init() Date: Mon, 2 Nov 2020 11:53:57 -0600 Message-Id: <20201102175400.6282-4-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201102175400.6282-1-elder@linaro.org> References: <20201102175400.6282-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org A quirk of IPA v4.2 requires the AP to allocate the GSI channels that are owned by the modem. Rather than pass a flag argument to gsi_channel_init(), use the IPA version directly in that function to determine whether modem channels need to be allocated. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 178d6ec2699eb..eae8ed83c1004 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1894,12 +1894,15 @@ static void gsi_channel_exit_one(struct gsi_channel *channel) /* Init function for channels */ static int gsi_channel_init(struct gsi *gsi, u32 count, - const struct ipa_gsi_endpoint_data *data, - bool modem_alloc) + const struct ipa_gsi_endpoint_data *data) { + bool modem_alloc; int ret = 0; u32 i; + /* IPA v4.2 requires the AP to allocate channels for the modem */ + modem_alloc = gsi->version == IPA_VERSION_4_2; + gsi_evt_ring_init(gsi); /* The endpoint data array is indexed by endpoint name */ @@ -1961,14 +1964,10 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, struct resource *res; resource_size_t size; unsigned int irq; - bool modem_alloc; int ret; gsi_validate_build(); - /* IPA v4.2 requires the AP to allocate channels for the modem */ - modem_alloc = version == IPA_VERSION_4_2; - gsi->dev = dev; gsi->version = version; @@ -2014,7 +2013,7 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, goto err_free_irq; } - ret = gsi_channel_init(gsi, count, data, modem_alloc); + ret = gsi_channel_init(gsi, count, data); if (ret) goto err_iounmap; From patchwork Mon Nov 2 17:53:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 315795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CEF0C388F9 for ; Mon, 2 Nov 2020 17:54:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05EDE22245 for ; Mon, 2 Nov 2020 17:54:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CcTmczI+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726482AbgKBRyN (ORCPT ); Mon, 2 Nov 2020 12:54:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726424AbgKBRyK (ORCPT ); Mon, 2 Nov 2020 12:54:10 -0500 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 792FEC0617A6 for ; Mon, 2 Nov 2020 09:54:10 -0800 (PST) Received: by mail-io1-xd42.google.com with SMTP id o11so4508216ioo.11 for ; Mon, 02 Nov 2020 09:54:10 -0800 (PST) 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=Kjh9WgiqBVSUAvLs7toC2QhJpUJCRR5iDChKKMxmY5I=; b=CcTmczI+e6uTjpaawiLSYDUqp792Sn7sA/r9gm1izHUo647K3CHwxKtZ085XolY3Es isR+3a6NY7BHH2N8YHguNM0TtOB+RzUDNQw7hOsayZX3NWrMoDSLHg1DEYfn4bCzGiN1 WY9cI6XjWBQx/G86WAzj3ElFRQxsKf5oOdeL/H8fB6qQKUjeXnyd2X+a2ibeqvC/mspT 1o1Y1S0HigSf5Nw+0pZWJQW6Don39xIe8k3LZuJDuMSn5U4Pv+45MvAqx2HhvBCw1rNQ ntXjA9A5RoPPyiTXiyd0fIVP2otB6JPyTilObR/cSmzKGsdrcWKstqwKSzn8/gEiiaFl 0ZXw== 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=Kjh9WgiqBVSUAvLs7toC2QhJpUJCRR5iDChKKMxmY5I=; b=W6ju+NAUOCA1uknOiaIdCbvk4FT+sq6PlcpshRvMOYRbr/aSAoUKqvFei4VKMMhUJ+ +6c6kJYoBtgksnLeo5SU+xH/xY0yd+CPIdY0ciRypesrpbKQyHf1uA2pwARESmOIX3wx QrQ3b+b+Q7DCSAUH6V3JTdfU8EeJIKtffDirRPd927sRrjtfXqsKizwbP09BgqoErYeG KH/+1JPtXAzc7BV8yVojP3gOfBrTSZlzbKIc4Soy2ypOkOLWZmjnvC9wVptkVZwTpgr1 WsXW/2MhwwSyP6EIOwI5Uzh6mBnxWeYNOHVqPBqeXLK5n0sFFBoQeFYF89M+RVvE27M6 SYVg== X-Gm-Message-State: AOAM532v8WO6JCwYiT10FVc+p54/EVmTHMpkTojReeYUYl7dcdLBgE8D 0XS/JtbWjuX6+bbw034f0af+7g== X-Google-Smtp-Source: ABdhPJzTN5SMSgrGOauj/u3STIPdZbm9FGQeb35n0CNSWxpjGZXtBAuaqh+gU+T3wPw1e0gm0KfPkA== X-Received: by 2002:a02:c817:: with SMTP id p23mr12650309jao.138.1604339649852; Mon, 02 Nov 2020 09:54:09 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id r4sm11089591ilj.43.2020.11.02.09.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:54:09 -0800 (PST) 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 4/6] net: ipa: use version in gsi_channel_reset() Date: Mon, 2 Nov 2020 11:53:58 -0600 Message-Id: <20201102175400.6282-5-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201102175400.6282-1-elder@linaro.org> References: <20201102175400.6282-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org A quirk of IPA v3.5.1 requires a channel reset on an RX channel to be performed twice. Use the IPA version in gsi_channel_reset() rather than the passed-in legacy flag to determine that. This is actually a bug fix, because this double reset is supposed to occur independent of whether we're enabling the doorbell engine. Now they will be independent. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index eae8ed83c1004..729ef712a10fd 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -840,7 +840,7 @@ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy) gsi_channel_reset_command(channel); /* Due to a hardware quirk we may need to reset RX channels twice. */ - if (legacy && !channel->toward_ipa) + if (gsi->version == IPA_VERSION_3_5_1 && !channel->toward_ipa) gsi_channel_reset_command(channel); gsi_channel_program(channel, legacy); From patchwork Mon Nov 2 17:53:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 315794 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AF7FC00A89 for ; Mon, 2 Nov 2020 17:54:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14A0A22243 for ; Mon, 2 Nov 2020 17:54:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="odoQ12IQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726533AbgKBRyZ (ORCPT ); Mon, 2 Nov 2020 12:54:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgKBRyM (ORCPT ); Mon, 2 Nov 2020 12:54:12 -0500 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 05EB0C061A47 for ; Mon, 2 Nov 2020 09:54:12 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id r12so6778744iot.4 for ; Mon, 02 Nov 2020 09:54:11 -0800 (PST) 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=TY8f/hJb7UErE9l1O52/R43lnZDyIHDAaaf9Om5UBk0=; b=odoQ12IQQQ86bEKXbuj2rNLJXk/yR8omYiCjtdscZKttTWH47NAApFjVvrBknz8fIa SsFStRd7Z1ulg4BRGqoYtOUnx8KM27tt3NtoGcpfgu1EKrloowlef8auU1sQF/eSdGTr GvRJd4F9xuCYkBu6g5AUvgsGuUPXRTYxuBKSC3y7B2WPeCO3Am6/1SQlUMX5mYvFOxL8 quFGtYeDts06wUsw+XJfQ7N/gBQM9RDYzPv+TDvoG81GKadIIULLqCScJjE1H98Fhp9G DJ/E1L+67n3QpsmrZCh3ttIpBthkGysSSCP9U8Y6uWjQtvfqqZw1wRF6xgJYTsPkUhxu PF/Q== 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=TY8f/hJb7UErE9l1O52/R43lnZDyIHDAaaf9Om5UBk0=; b=kPQ8uQFwcSfVr2s+fgINNJ6+CQGRGoo88wdMXwtGUSGmMuvIUwOSLCmC6Ndqpab7Jw dVeZOqIFLN43b61kYL0g0aNI/3rQutVuB8MUdgO/WQtGvq/Cl6zs3558GySUn8mJ/plE yXT2718WYvJ/lkfOB/9T/S2MB+7kbX2EjwlLSl/GyXllQqSJTRgyza/YRQq0WaSYMxOl N9mioEUDDR5rhVxKpWSp8gPA/kQ144yOsBAVpbjzdLDQ0nuSGweB2LDg/lAt78RcUJZz s/JJD7VPNAK89ICQth7CR0+wO/WXkhEFaYHi7TksTg6juZ/Zsm+VSv1YR7Qw2T4zR5Ok 7hug== X-Gm-Message-State: AOAM531gihBJBUk08ba5RuGVdSj3VqGsrldo12hCRwzXc7Xi08bsPStD /qPsQQVH2qykV6rx0t3irH0KUg== X-Google-Smtp-Source: ABdhPJy1FuCPH779RMcdRimZdawwLdFGf4366Hm9dd0i36HcZfm6/3n/xeUg3b2LMNZXi5PfV3btVw== X-Received: by 2002:a05:6602:2407:: with SMTP id s7mr11099495ioa.79.1604339651325; Mon, 02 Nov 2020 09:54:11 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id r4sm11089591ilj.43.2020.11.02.09.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:54:10 -0800 (PST) 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 5/6] net: ipa: use version in gsi_channel_program() Date: Mon, 2 Nov 2020 11:53:59 -0600 Message-Id: <20201102175400.6282-6-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201102175400.6282-1-elder@linaro.org> References: <20201102175400.6282-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use the IPA version in gsi_channel_program() to determine whether we should enable the GSI doorbell engine when requested. This way, callers only say whether or not it should be enabled if needed, regardless of hardware version. Rename the "legacy" argument to gsi_channel_reset(), and have it indicate whether the doorbell engine should be enabled when reprogramming following the reset. Change all callers of gsi_channel_reset() to indicate whether to enable the doorbell engine after reset, independent of hardware version. Rework a little logic in ipa_endpoint_reset() to get rid of the "legacy" variable previously passed to gsi_channel_reset(). Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 10 +++++----- drivers/net/ipa/gsi.h | 8 ++++---- drivers/net/ipa/ipa_endpoint.c | 16 ++++++---------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 729ef712a10fd..f22b5d2efaf9d 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -743,8 +743,8 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) /* Max prefetch is 1 segment (do not set MAX_PREFETCH_FMASK) */ - /* Enable the doorbell engine if requested */ - if (doorbell) + /* We enable the doorbell engine for IPA v3.5.1 */ + if (gsi->version == IPA_VERSION_3_5_1 && doorbell) val |= USE_DB_ENG_FMASK; /* Starting with IPA v4.0 the command channel uses the escape buffer */ @@ -831,8 +831,8 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) return ret; } -/* Reset and reconfigure a channel (possibly leaving doorbell disabled) */ -void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy) +/* Reset and reconfigure a channel, (possibly) enabling the doorbell engine */ +void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell) { struct gsi_channel *channel = &gsi->channel[channel_id]; @@ -843,7 +843,7 @@ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy) if (gsi->version == IPA_VERSION_3_5_1 && !channel->toward_ipa) gsi_channel_reset_command(channel); - gsi_channel_program(channel, legacy); + gsi_channel_program(channel, doorbell); gsi_channel_trans_cancel_pending(channel); mutex_unlock(&gsi->mutex); diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index cf117b52496c1..36f876fb8f5ae 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -221,15 +221,15 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id); * gsi_channel_reset() - Reset an allocated GSI channel * @gsi: GSI pointer * @channel_id: Channel to be reset - * @legacy: Legacy behavior + * @doorbell: Whether to (possibly) enable the doorbell engine * - * Reset a channel and reconfigure it. The @legacy flag indicates - * that some steps should be done differently for legacy hardware. + * Reset a channel and reconfigure it. The @doorbell flag indicates + * that the doorbell engine should be enabled if needed. * * GSI hardware relinquishes ownership of all pending receive buffer * transactions and they will complete with their cancelled flag set. */ -void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy); +void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell); int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop); int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start); diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 6f79028910e3c..548121b1531b7 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1217,7 +1217,6 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint) struct gsi *gsi = &ipa->gsi; bool suspended = false; dma_addr_t addr; - bool legacy; u32 retries; u32 len = 1; void *virt; @@ -1279,8 +1278,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint) * complete the channel reset sequence. Finish by suspending the * channel again (if necessary). */ - legacy = ipa->version == IPA_VERSION_3_5_1; - gsi_channel_reset(gsi, endpoint->channel_id, legacy); + gsi_channel_reset(gsi, endpoint->channel_id, true); msleep(1); @@ -1303,21 +1301,19 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint) u32 channel_id = endpoint->channel_id; struct ipa *ipa = endpoint->ipa; bool special; - bool legacy; int ret = 0; /* On IPA v3.5.1, if an RX endpoint is reset while aggregation * is active, we need to handle things specially to recover. * All other cases just need to reset the underlying GSI channel. - * - * IPA v3.5.1 enables the doorbell engine. Newer versions do not. */ - legacy = ipa->version == IPA_VERSION_3_5_1; - special = !endpoint->toward_ipa && endpoint->data->aggregation; - if (legacy && special && ipa_endpoint_aggr_active(endpoint)) + special = ipa->version == IPA_VERSION_3_5_1 && + !endpoint->toward_ipa && + endpoint->data->aggregation; + if (special && ipa_endpoint_aggr_active(endpoint)) ret = ipa_endpoint_reset_rx_aggr(endpoint); else - gsi_channel_reset(&ipa->gsi, channel_id, legacy); + gsi_channel_reset(&ipa->gsi, channel_id, true); if (ret) dev_err(&ipa->pdev->dev, From patchwork Mon Nov 2 17:54:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 320365 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp3925349ilc; Mon, 2 Nov 2020 09:54:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKYtCsTQqXS1PpwvLWxyqE4q4r+HP8QWuQt9RMKg3H8os1o4xFHBfvfMNXbbmYcNHLwcJA X-Received: by 2002:a17:906:c114:: with SMTP id do20mr16062078ejc.169.1604339664680; Mon, 02 Nov 2020 09:54:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604339664; cv=none; d=google.com; s=arc-20160816; b=O3mvAnwQK8JrMSEWD95ity+FTzSDBcsZ0CL5pX1Tn4sdYh+w7pvTGDgKf/iClWKId6 1yt2KctWlceSqK0QTOkBeNO05QqeTXk2RuurR7SgE5yB9zOc746vaN/l3MX3aeYHAK/I BphROBNLc+1QYWgB84ZhKy0SfUbvsM3sYbuSTeHZy69b62cAsrxhtZy8uUJyP7br6ym7 ErkLhBIJneG9Jj8obeNnWV/Xy9qyvLYSiNmjmEpzeG7Q+o5/Tz2SGiYPH7ObiwBFonqW grNba9LMaRVzHCLOSFrPDs0UmwTV5TWRq83CAGYrgzCZBBEQQzIHZBoUZeuB/TBJEwmw cajQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=inRx9H1T7vReO20GsdvOW3B0eTMy5lZmarlEkrdYr50=; b=wsQUM4ktty/61lCgDsgdm8ovHQEXDI+hGzcqbD1Lg66W5hqT3zIa+Cf092PLNTi5UD ZibmfpH5E+2w7oB5Q4l8LZtHpDgugq8jDfhuJdVH7AQhx4Na4QnOOlc7nuPA+C1nuQhu tVbraz8PUfL6+7hbfraSDdd/Vvq4TvPDWWYnv5smk8uunEBAKM7uDwKEiTujRX+W9UMe uvJ6oPC1+vaI9uLEh+kJeGQi5Wj2Z59B470K04PxJzwzesDqm900IDU1kkP0wpiGk8+m ihJjvchbPCt9sxs8d6yAgyn5UUJhjgq+uMlazk/+0Hs5PY1jwADtpE+yFNrgSV//9uqB Ud5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fAfOp4nV; 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 t26si10479695ejr.336.2020.11.02.09.54.24; Mon, 02 Nov 2020 09:54:24 -0800 (PST) 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=fAfOp4nV; 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 S1726503AbgKBRyR (ORCPT + 8 others); Mon, 2 Nov 2020 12:54:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbgKBRyN (ORCPT ); Mon, 2 Nov 2020 12:54:13 -0500 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADA71C061A49 for ; Mon, 2 Nov 2020 09:54:13 -0800 (PST) Received: by mail-il1-x142.google.com with SMTP id q1so13731306ilt.6 for ; Mon, 02 Nov 2020 09:54:13 -0800 (PST) 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=inRx9H1T7vReO20GsdvOW3B0eTMy5lZmarlEkrdYr50=; b=fAfOp4nVEo3xVkTHEHOTWtOkAf0X5/1dOn765Jd2TuaVzfII00F6yDoN0tu+pZkRxe r5Wy7Bf4FCT3M5RW1Ay5JgLo3GPB0UQh6freZ6piHsjM6VzhUZZEAPwv4Y4V79KUJeJm gBXtgy8a7aZCIv2BclHSVA1WLlL1HN9Xf+9SUK1LkG86jOWuOyuyIU3WRh6NkEtImH6F 80YZq0CgvHgQN2A/ly3KSJckHtgB0QYO7gqG4B8wRUnnu7PahnyiBwAihvuNSgyKyGsW HWsX7b9Z/Wkrii6Kdgh01tP7OGz7VFYsZvvNMXE9ArUUMYz9c2cbXVP05hRd4l58bU7n yKOA== 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=inRx9H1T7vReO20GsdvOW3B0eTMy5lZmarlEkrdYr50=; b=EVdzv9+ouxaDU38Qceu+GUh6ZdJfkSmM5QtJ2fS/pJ2A3WwQFSFal6AvfkOKXn9CH5 h+n1q0cAk3FkxtKX2iAxB/iuU8SGqdS//DN+EX7+2/NqCMrXtR8ULlJDwVdmD6KBYgPE b/ayYWIkMCgaNpOEjMgEJ3Z16xD/1oUjqZNITmZg46YaUlcW2KjELmcsW9wn7P3qScAV V5AhAGJJZW9qr2yJYQUI4ggGd0LdVcXEAOZZOZ1kDCIwUHs/gz6QIPO1RNgPV0R2Pr9z HsXVXVaTljfDyx58WR+b/KN5gRLKlQ83c5B1leZ/IszpmBSpMm5WPeYkCQXEVTXVh5EQ 1efw== X-Gm-Message-State: AOAM532I4a9zDFSdMPJjZnW0cALd2mrlNGGWf+RFdwmNQ30bI13S+Eke fKdzZf/zNLii6x+OvfxP6CxGaw== X-Received: by 2002:a92:d9ca:: with SMTP id n10mr7772408ilq.21.1604339652805; Mon, 02 Nov 2020 09:54:12 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id r4sm11089591ilj.43.2020.11.02.09.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 09:54:12 -0800 (PST) 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 6/6] net: ipa: eliminate legacy arguments Date: Mon, 2 Nov 2020 11:54:00 -0600 Message-Id: <20201102175400.6282-7-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201102175400.6282-1-elder@linaro.org> References: <20201102175400.6282-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We enable a channel doorbell engine only for IPA v3.5.1, and that is now handled directly by gsi_channel_program(). When initially setting up a channel, we want that doorbell engine enabled, and we can request that independent of the IPA version. Doing that makes the "legacy" argument to gsi_channel_setup_one() unnecessary. And with that gone we can get rid of the "legacy" argument to gsi_channel_setup(), and gsi_setup() as well. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 13 ++++++------- drivers/net/ipa/gsi.h | 3 +-- drivers/net/ipa/ipa_main.c | 3 +-- 3 files changed, 8 insertions(+), 11 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index f22b5d2efaf9d..12a2001ee1e9c 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1454,8 +1454,7 @@ static void gsi_evt_ring_teardown(struct gsi *gsi) } /* Setup function for a single channel */ -static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id, - bool legacy) +static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; u32 evt_ring_id = channel->evt_ring_id; @@ -1474,7 +1473,7 @@ static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id, if (ret) goto err_evt_ring_de_alloc; - gsi_channel_program(channel, legacy); + gsi_channel_program(channel, true); if (channel->toward_ipa) netif_tx_napi_add(&gsi->dummy_dev, &channel->napi, @@ -1551,7 +1550,7 @@ static void gsi_modem_channel_halt(struct gsi *gsi, u32 channel_id) } /* Setup function for channels */ -static int gsi_channel_setup(struct gsi *gsi, bool legacy) +static int gsi_channel_setup(struct gsi *gsi) { u32 channel_id = 0; u32 mask; @@ -1563,7 +1562,7 @@ static int gsi_channel_setup(struct gsi *gsi, bool legacy) mutex_lock(&gsi->mutex); do { - ret = gsi_channel_setup_one(gsi, channel_id, legacy); + ret = gsi_channel_setup_one(gsi, channel_id); if (ret) goto err_unwind; } while (++channel_id < gsi->channel_count); @@ -1649,7 +1648,7 @@ 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) +int gsi_setup(struct gsi *gsi) { struct device *dev = gsi->dev; u32 val; @@ -1693,7 +1692,7 @@ int gsi_setup(struct gsi *gsi, bool legacy) /* Writing 1 indicates IRQ interrupts; 0 would be MSI */ iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET); - return gsi_channel_setup(gsi, legacy); + return gsi_channel_setup(gsi); } /* Inverse of gsi_setup() */ diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 36f876fb8f5ae..59ace83d404c4 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -166,14 +166,13 @@ struct gsi { /** * gsi_setup() - Set up the GSI subsystem * @gsi: Address of GSI structure embedded in an IPA structure - * @legacy: Set up for legacy hardware * * Return: 0 if successful, or a negative error code * * Performs initialization that must wait until the GSI hardware is * ready (including firmware loaded). */ -int gsi_setup(struct gsi *gsi, bool legacy); +int gsi_setup(struct gsi *gsi); /** * gsi_teardown() - Tear down GSI subsystem diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 0d3d1a5cf07c1..a580cab794b1c 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -111,8 +111,7 @@ int ipa_setup(struct ipa *ipa) struct device *dev = &ipa->pdev->dev; int ret; - /* Setup for IPA v3.5.1 has some slight differences */ - ret = gsi_setup(&ipa->gsi, ipa->version == IPA_VERSION_3_5_1); + ret = gsi_setup(&ipa->gsi); if (ret) return ret;