From patchwork Wed Mar 24 13:15:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12161137 X-Patchwork-Delegate: kuba@kernel.org 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 57209C433E5 for ; Wed, 24 Mar 2021 13:16:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1381161A11 for ; Wed, 24 Mar 2021 13:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235006AbhCXNQG (ORCPT ); Wed, 24 Mar 2021 09:16:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234669AbhCXNPd (ORCPT ); Wed, 24 Mar 2021 09:15:33 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EE9BC0613DE for ; Wed, 24 Mar 2021 06:15:32 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id e8so21435734iok.5 for ; Wed, 24 Mar 2021 06:15:32 -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=R188tgNnW6Iy6m81+dkSI8iVQ4LK81VtFqse+ajK9/U=; b=n2a5FBqYjczsk3jxGWJOxLd9X6RUdPq2uyPRIBopDhogE/gOuCSeehyE3Tb/Ncf54J MMZB9FlfImf5rBFPkhvORz0oxiDZe+QDtE0DUAJ9FPe5GuI0I3jy226rA54HOB3AwcFA uc2t6Gg+qpvrdcleCABbiXJg4Cs/wpbuH0YyDzwBMDxVso05XFO6+yEGoWv0BI6d9abh Q3SdGIOCM1R3CIUbwDppEnbUhc+0XDltRoByRPBB1T5yOaWEk6otCn0naQrsketQzo79 +IsX4HAU+D9MPWWXH+09buriGt/TrwI9pEWg65pXjxR+cMlXHKuYk2ba6Esv6mQVurcX T68g== 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=R188tgNnW6Iy6m81+dkSI8iVQ4LK81VtFqse+ajK9/U=; b=U/y2mhKzoy5jgj/bgkFm3srn8UdLQcFb5Yckx//gr2UA+u8xN3qJnF8ORfvtDSwa1d 3PW7i7q1P9cme2oPts9BgWenEnHx2N/VhMAyaRFfKga/n3yUmncqHt57i6Z7Rfsc7+1B tyynw5IFObgDj4r9Zd8aTbCxjHaNFUQwwkTQKm0YnGv/lQBRKC05R/pPVfu+5eKHfsAv vBOCmXqTzwVXMdg5INfwzXl9VCCbIHKbosE6B09r62FMwNzAsfpTTyENNJhzPvwVLM9U wHH8K4rK9Sm9XUuel2RkcgQ73mvtEs+9Id0oYyVqCmX/dB3rzgPd6nKf7KV0RW6ebPtd Z5dw== X-Gm-Message-State: AOAM531NykKQKCSwSl6wpGmQ9o2nVT+AmfR60FbQCez222QvXvMBOWPl XY6TkPfA4f7aaxLXKpuky9/hhg== X-Google-Smtp-Source: ABdhPJwJcovIsQf8H+48uabWXSQrwTWAD2UGhUDuFpRD2Zuagke1PyU6kuZw69ME8N2adRB0fl1AuQ== X-Received: by 2002:a02:a506:: with SMTP id e6mr2779002jam.56.1616591731962; Wed, 24 Mar 2021 06:15:31 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id n7sm1160486ile.12.2021.03.24.06.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 06:15:31 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 1/6] net: ipa: reduce IPA version assumptions Date: Wed, 24 Mar 2021 08:15:23 -0500 Message-Id: <20210324131528.2369348-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210324131528.2369348-1-elder@linaro.org> References: <20210324131528.2369348-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Modify conditional tests throughout the IPA code so they do not assume that IPA v3.5.1 is the oldest version supported. Also remove assumptions that IPA v4.5 is the newest version of IPA supported. Augment versions in comments with "+", to be clearer that the comment applies to a version and subsequent versions. (E.g., "present for IPA v4.2+" instead of just "present for v4.2".) Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 8 ++++---- drivers/net/ipa/ipa_cmd.c | 26 +++++++++++++++----------- drivers/net/ipa/ipa_endpoint.c | 25 ++++++++++++++----------- drivers/net/ipa/ipa_main.c | 6 +++--- drivers/net/ipa/ipa_qmi.c | 2 +- 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index b6355827bf900..7f2a8fce5e0db 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -827,14 +827,14 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) /* Max prefetch is 1 segment (do not set MAX_PREFETCH_FMASK) */ - /* We enable the doorbell engine for IPA v3.5.1 */ - if (gsi->version == IPA_VERSION_3_5_1 && doorbell) + /* No need to use the doorbell engine starting at IPA v4.0 */ + if (gsi->version < IPA_VERSION_4_0 && doorbell) val |= USE_DB_ENG_FMASK; /* v4.0 introduces an escape buffer for prefetch. We use it * on all but the AP command channel. */ - if (gsi->version != IPA_VERSION_3_5_1 && !channel->command) { + if (gsi->version >= IPA_VERSION_4_0 && !channel->command) { /* If not otherwise set, prefetch buffers are used */ if (gsi->version < IPA_VERSION_4_5) val |= USE_ESCAPE_BUF_ONLY_FMASK; @@ -973,7 +973,7 @@ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell) gsi_channel_reset_command(channel); /* Due to a hardware quirk we may need to reset RX channels twice. */ - if (gsi->version == IPA_VERSION_3_5_1 && !channel->toward_ipa) + if (gsi->version < IPA_VERSION_4_0 && !channel->toward_ipa) gsi_channel_reset_command(channel); gsi_channel_program(channel, doorbell); diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index 35e35852c25c5..a0be25f1f4427 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -71,13 +71,12 @@ struct ipa_cmd_hw_hdr_init_local { /* IPA_CMD_REGISTER_WRITE */ -/* For IPA v4.0+, this opcode gets modified with pipeline clear options */ - +/* For IPA v4.0+, the pipeline clear options are encoded in the opcode */ #define REGISTER_WRITE_OPCODE_SKIP_CLEAR_FMASK GENMASK(8, 8) #define REGISTER_WRITE_OPCODE_CLEAR_OPTION_FMASK GENMASK(10, 9) struct ipa_cmd_register_write { - __le16 flags; /* Unused/reserved for IPA v3.5.1 */ + __le16 flags; /* Unused/reserved prior to IPA v4.0 */ __le16 offset; __le32 value; __le32 value_mask; @@ -85,12 +84,12 @@ struct ipa_cmd_register_write { }; /* Field masks for ipa_cmd_register_write structure fields */ -/* The next field is present for IPA v4.0 and above */ +/* The next field is present for IPA v4.0+ */ #define REGISTER_WRITE_FLAGS_OFFSET_HIGH_FMASK GENMASK(14, 11) -/* The next field is present for IPA v3.5.1 only */ +/* The next field is not present for IPA v4.0+ */ #define REGISTER_WRITE_FLAGS_SKIP_CLEAR_FMASK GENMASK(15, 15) -/* The next field and its values are present for IPA v3.5.1 only */ +/* The next field and its values are not present for IPA v4.0+ */ #define REGISTER_WRITE_CLEAR_OPTIONS_FMASK GENMASK(1, 0) /* IPA_CMD_IP_PACKET_INIT */ @@ -123,7 +122,7 @@ struct ipa_cmd_hw_dma_mem_mem { /* Field masks for ipa_cmd_hw_dma_mem_mem structure fields */ #define DMA_SHARED_MEM_FLAGS_DIRECTION_FMASK GENMASK(0, 0) -/* The next two fields are present for IPA v3.5.1 only. */ +/* The next two fields are not present for IPA v4.0+ */ #define DMA_SHARED_MEM_FLAGS_SKIP_CLEAR_FMASK GENMASK(1, 1) #define DMA_SHARED_MEM_FLAGS_CLEAR_OPTIONS_FMASK GENMASK(3, 2) @@ -237,11 +236,12 @@ static bool ipa_cmd_register_write_offset_valid(struct ipa *ipa, u32 bit_count; /* The maximum offset in a register_write immediate command depends - * on the version of IPA. IPA v3.5.1 supports a 16 bit offset, but - * newer versions allow some additional high-order bits. + * on the version of IPA. A 16 bit offset is always supported, + * but starting with IPA v4.0 some additional high-order bits are + * allowed. */ bit_count = BITS_PER_BYTE * sizeof(payload->offset); - if (ipa->version != IPA_VERSION_3_5_1) + if (ipa->version >= IPA_VERSION_4_0) bit_count += hweight32(REGISTER_WRITE_FLAGS_OFFSET_HIGH_FMASK); BUILD_BUG_ON(bit_count > 32); offset_max = ~0U >> (32 - bit_count); @@ -440,7 +440,11 @@ void ipa_cmd_register_write_add(struct gsi_trans *trans, u32 offset, u32 value, /* pipeline_clear_src_grp is not used */ clear_option = clear_full ? pipeline_clear_full : pipeline_clear_hps; - if (ipa->version != IPA_VERSION_3_5_1) { + /* IPA v4.0+ represents the pipeline clear options in the opcode. It + * also supports a larger offset by encoding additional high-order + * bits in the payload flags field. + */ + if (ipa->version >= IPA_VERSION_4_0) { u16 offset_high; u32 val; diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 88310d3585574..5f93bd60c7586 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -266,7 +266,7 @@ ipa_endpoint_init_ctrl(struct ipa_endpoint *endpoint, bool suspend_delay) * if (endpoint->toward_ipa) * assert(ipa->version != IPA_VERSION_4.2); * else - * assert(ipa->version == IPA_VERSION_3_5_1); + * assert(ipa->version < IPA_VERSION_4_0); */ mask = endpoint->toward_ipa ? ENDP_DELAY_FMASK : ENDP_SUSPEND_FMASK; @@ -347,7 +347,7 @@ ipa_endpoint_program_suspend(struct ipa_endpoint *endpoint, bool enable) { bool suspended; - if (endpoint->ipa->version != IPA_VERSION_3_5_1) + if (endpoint->ipa->version >= IPA_VERSION_4_0) return enable; /* For IPA v4.0+, no change made */ /* assert(!endpoint->toward_ipa); */ @@ -515,7 +515,7 @@ static void ipa_endpoint_init_hdr(struct ipa_endpoint *endpoint) /* Where IPA will write the length */ offset = offsetof(struct rmnet_map_header, pkt_len); /* Upper bits are stored in HDR_EXT with IPA v4.5 */ - if (version == IPA_VERSION_4_5) + if (version >= IPA_VERSION_4_5) offset &= field_mask(HDR_OFST_PKT_SIZE_FMASK); val |= HDR_OFST_PKT_SIZE_VALID_FMASK; @@ -562,7 +562,7 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint) /* IPA v4.5 adds some most-significant bits to a few fields, * two of which are defined in the HDR (not HDR_EXT) register. */ - if (ipa->version == IPA_VERSION_4_5) { + if (ipa->version >= IPA_VERSION_4_5) { /* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0, so MSB is 0 */ if (endpoint->data->qmap && !endpoint->toward_ipa) { u32 offset; @@ -776,7 +776,7 @@ static u32 hol_block_timer_val(struct ipa *ipa, u32 microseconds) if (!microseconds) return 0; /* Nothing to compute if timer period is 0 */ - if (ipa->version == IPA_VERSION_4_5) + if (ipa->version >= IPA_VERSION_4_5) return hol_block_timer_qtime_val(ipa, microseconds); /* Use 64 bit arithmetic to avoid overflow... */ @@ -1468,8 +1468,7 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint) * is active, we need to handle things specially to recover. * All other cases just need to reset the underlying GSI channel. */ - special = ipa->version == IPA_VERSION_3_5_1 && - !endpoint->toward_ipa && + special = ipa->version < IPA_VERSION_4_0 && !endpoint->toward_ipa && endpoint->data->aggregation; if (special && ipa_endpoint_aggr_active(endpoint)) ret = ipa_endpoint_reset_rx_aggr(endpoint); @@ -1567,8 +1566,10 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) (void)ipa_endpoint_program_suspend(endpoint, true); } - /* IPA v3.5.1 doesn't use channel stop for suspend */ - stop_channel = endpoint->ipa->version != IPA_VERSION_3_5_1; + /* Starting with IPA v4.0, endpoints are suspended by stopping the + * underlying GSI channel rather than using endpoint suspend mode. + */ + stop_channel = endpoint->ipa->version >= IPA_VERSION_4_0; ret = gsi_channel_suspend(gsi, endpoint->channel_id, stop_channel); if (ret) dev_err(dev, "error %d suspending channel %u\n", ret, @@ -1588,8 +1589,10 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) if (!endpoint->toward_ipa) (void)ipa_endpoint_program_suspend(endpoint, false); - /* IPA v3.5.1 doesn't use channel start for resume */ - start_channel = endpoint->ipa->version != IPA_VERSION_3_5_1; + /* Starting with IPA v4.0, the underlying GSI channel must be + * restarted for resume. + */ + start_channel = endpoint->ipa->version >= IPA_VERSION_4_0; ret = gsi_channel_resume(gsi, endpoint->channel_id, start_channel); if (ret) dev_err(dev, "error %d resuming channel %u\n", ret, diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 64b92dfdd3f5c..62d82d48aed69 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -227,8 +227,8 @@ static void ipa_hardware_config_comp(struct ipa *ipa) { u32 val; - /* Nothing to configure for IPA v3.5.1 */ - if (ipa->version == IPA_VERSION_3_5_1) + /* Nothing to configure prior to IPA v4.0 */ + if (ipa->version < IPA_VERSION_4_0) return; val = ioread32(ipa->reg_virt + IPA_REG_COMP_CFG_OFFSET); @@ -388,7 +388,7 @@ static void ipa_hardware_config(struct ipa *ipa, const struct ipa_data *data) } /* Implement some hardware workarounds */ - if (version != IPA_VERSION_3_5_1 && version < IPA_VERSION_4_5) { + if (version >= IPA_VERSION_4_0 && version < IPA_VERSION_4_5) { /* Enable open global clocks (not needed for IPA v4.5) */ val = GLOBAL_FMASK; val |= GLOBAL_2X_CLK_FMASK; diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c index af8666b89b375..7b833e92a0ac7 100644 --- a/drivers/net/ipa/ipa_qmi.c +++ b/drivers/net/ipa/ipa_qmi.c @@ -377,7 +377,7 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi) /* None of the stats fields are valid (IPA v4.0 and above) */ - if (ipa->version != IPA_VERSION_3_5_1) { + if (ipa->version >= IPA_VERSION_4_0) { mem = &ipa->mem[IPA_MEM_STATS_QUOTA_MODEM]; if (mem->size) { req.hw_stats_quota_base_addr_valid = 1; From patchwork Wed Mar 24 13:15:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12161141 X-Patchwork-Delegate: kuba@kernel.org 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 942E8C433E6 for ; Wed, 24 Mar 2021 13:16:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B2DE619B3 for ; Wed, 24 Mar 2021 13:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235121AbhCXNQJ (ORCPT ); Wed, 24 Mar 2021 09:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234688AbhCXNPe (ORCPT ); Wed, 24 Mar 2021 09:15:34 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D14C0613E0 for ; Wed, 24 Mar 2021 06:15:33 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id n198so21430277iod.0 for ; Wed, 24 Mar 2021 06:15:33 -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=jEdK7HODEXGaHkN0tnvNi4JdIE04/obrX1IK6/1t7T4=; b=yd5bAmiXbtr+I8BpZsrowONFEdcu9LIc0uxTJpFW/umz0BZFdG+gFe6M/fT5HPi4GD AZ3P4EzTCvhIUPgsIeB4TMyIud5TZTTylwcx1w8pg5+ZNLAtJoJgCTFzM3+7mzojfBJd XqBN5DYmqBRgkPMVNA2+MMXYYOkHMy300TCLOQzJ3swRBXSedCiLPUXrLStvNEHtqNzs BC8XZPNWu9+kDyHpDHr9jA5GdEe/eLKvIZ5jLxkIcgbGGEHmOLr+OkPLxzffqtNlvyXb y8tRdtTybASbk9Cot0Nbfui8pZWbmCBe3lGnYg+99qv4PUEs9bpiv3CYtzTUH00pBNjS ZQYA== 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=jEdK7HODEXGaHkN0tnvNi4JdIE04/obrX1IK6/1t7T4=; b=i/JaKbbpRKMS/zPCwG3kiPoos4lRF8FXRIWhmO+8Ld20e3/s+xH87HIM9ZX6VaEiCO ed1ZJmuY8czz6bMKYhkvVh0PbhVk7ZVEt27GVpeLr2lLQ+p28905J27DNoxQXw5xX2y4 bKi5XUt3r5Lpu7OffjxxnsXpcYk1IkoUj9RvxwkUuJaMMq6JrEAhWxwNhHmZgO4HCcsQ P23mkYOxwRHfPNg3jRrlSNue4yqqrMUFMA5zBq2JRom7IrmBwoFowcMNvwe97f79UWSr PA3J0SL9kvPuGZryihddZMqubpvWcNrrNgMrz1FLietfMTPI48pRZIW+aEeim9Rx47rG jFHg== X-Gm-Message-State: AOAM532OmvVcLkGCfKlbGFwlS4oE0tcJeo0lwC0nPcba8WhClIwLPrWH WdPoe/ejp7DH8NQhHddbzT7/wA== X-Google-Smtp-Source: ABdhPJxCQk2NaFFUj5DSTJ/Hin8w5JteNpb2QDiHIQ4dkUk3JoGciH49oGv6htzeYaPv6kskaHR7Bg== X-Received: by 2002:a02:cb8f:: with SMTP id u15mr2735141jap.45.1616591732787; Wed, 24 Mar 2021 06:15:32 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id n7sm1160486ile.12.2021.03.24.06.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 06:15:32 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/6] net: ipa: update version definitions Date: Wed, 24 Mar 2021 08:15:24 -0500 Message-Id: <20210324131528.2369348-3-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210324131528.2369348-1-elder@linaro.org> References: <20210324131528.2369348-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add IPA version definitions for all IPA v3.x and v4.x. Fix the GSI version associated with IPA version 4.1. Signed-off-by: Alex Elder --- v2: - Add kernel-doc descriptions for ipa_version members. drivers/net/ipa/ipa_version.h | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/net/ipa/ipa_version.h b/drivers/net/ipa/ipa_version.h index 2944e2a890231..ee2b3d02f3cd3 100644 --- a/drivers/net/ipa/ipa_version.h +++ b/drivers/net/ipa/ipa_version.h @@ -8,17 +8,32 @@ /** * enum ipa_version + * @IPA_VERSION_3_0: IPA version 3.0/GSI version 1.0 + * @IPA_VERSION_3_1: IPA version 3.1/GSI version 1.1 + * @IPA_VERSION_3_5: IPA version 3.5/GSI version 1.2 + * @IPA_VERSION_3_5_1: IPA version 3.5.1/GSI version 1.3 + * @IPA_VERSION_4_0: IPA version 4.0/GSI version 2.0 + * @IPA_VERSION_4_1: IPA version 4.1/GSI version 2.0 + * @IPA_VERSION_4_2: IPA version 4.2/GSI version 2.2 + * @IPA_VERSION_4_5: IPA version 4.5/GSI version 2.5 + * @IPA_VERSION_4_7: IPA version 4.7/GSI version 2.7 + * @IPA_VERSION_4_9: IPA version 4.9/GSI version 2.9 + * @IPA_VERSION_4_11: IPA version 4.11/GSI version 2.11 (2.1.1) * * Defines the version of IPA (and GSI) hardware present on the platform. - * It seems this might be better defined elsewhere, but having it here gets - * it where it's needed. */ enum ipa_version { - IPA_VERSION_3_5_1, /* GSI version 1.3.0 */ - IPA_VERSION_4_0, /* GSI version 2.0 */ - IPA_VERSION_4_1, /* GSI version 2.1 */ - IPA_VERSION_4_2, /* GSI version 2.2 */ - IPA_VERSION_4_5, /* GSI version 2.5 */ + IPA_VERSION_3_0, + IPA_VERSION_3_1, + IPA_VERSION_3_5, + IPA_VERSION_3_5_1, + IPA_VERSION_4_0, + IPA_VERSION_4_1, + IPA_VERSION_4_2, + IPA_VERSION_4_5, + IPA_VERSION_4_7, + IPA_VERSION_4_9, + IPA_VERSION_4_11, }; #endif /* _IPA_VERSION_H_ */ From patchwork Wed Mar 24 13:15:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12161145 X-Patchwork-Delegate: kuba@kernel.org 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 B8D17C433E9 for ; Wed, 24 Mar 2021 13:16:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9022F61A0E for ; Wed, 24 Mar 2021 13:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235155AbhCXNQM (ORCPT ); Wed, 24 Mar 2021 09:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234706AbhCXNPf (ORCPT ); Wed, 24 Mar 2021 09:15:35 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37E44C0613E1 for ; Wed, 24 Mar 2021 06:15:34 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id b10so21392203iot.4 for ; Wed, 24 Mar 2021 06:15:34 -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=qKrY3MtVV0SjI4PDoOYPSEatpvEs6DJpVc9j1EaE/t0=; b=L3n+VQn1qdXmxu7Rh61rfDoILCtfUVK8hsLTP4ZuGECASWlB/wKK/f4aTw45pgnN/f wZfqgjPdz4HRKnfe5cY2R6U09qIFv0jmaldskybBClMKo71rqSOanamk5DEuJiozGnYK 872KCjNsmphXPIwu5VXGGKgXFDkYUyo+n8FQvvTIuvpMXM2Oqj620Ws5Nk/ygbo5KdJd C5J+3q2h1TwWN2VYe+xtXAwStuoJ48o3cAnm7hVw38SZVOlsCasDJW4tkG29fphO3yXW NW29fzaEa4d4dZjpVoFh2O+ubJ5bnyjeRerzbus0PG/169Zr/bVRg6wX7JzGcIup0NST /Vgw== 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=qKrY3MtVV0SjI4PDoOYPSEatpvEs6DJpVc9j1EaE/t0=; b=tGrZ4jHnSUuMhF7Qi7bR7hSpbSEQPYwHiFtHKTjibrH+3kFMNdzpm6zj5rfHfdN8So 3ExbpxdMaX834vaSTd6EL7S7Rf0G+h2xpJQ4sNvoY8N1PFRZdUwxAC7CA8XHcbFTvo6/ zvi/NSgtLa2SCiBlI+AlgGxFwaeYE3ednKJH6+ARmabR8B6O4bBi39pw7PNPleTdt14C RWqp1rSxCAVlyyMUNCXnEUnQZVti7pmIP8MgveQReNqsEwLW95YqiJSLRjVvYCJ/bOWr sSEvy6Awjuk6MmxYLePgeiAV2ua0VbK0MO8gNazKaBghCX9RmrBSaQJ+crwsUYk9O6i+ iA4A== X-Gm-Message-State: AOAM532fr3wEYHUsGL1RJkB/14x5FoU6FiuFe8uNeyp3QmpHKSEOwKfC jEShzEqgSpJeTYHJYipWIUICxw== X-Google-Smtp-Source: ABdhPJy9LIgxH4R/07ozWEIAcUy8IHgGKJ07llkCBlBWankLC6a6R2mdT8gd0OUb1dls93yKhRzBQA== X-Received: by 2002:a5e:8c16:: with SMTP id n22mr2423380ioj.156.1616591733651; Wed, 24 Mar 2021 06:15:33 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id n7sm1160486ile.12.2021.03.24.06.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 06:15:33 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 3/6] net: ipa: define the ENDP_INIT_NAT register Date: Wed, 24 Mar 2021 08:15:25 -0500 Message-Id: <20210324131528.2369348-4-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210324131528.2369348-1-elder@linaro.org> References: <20210324131528.2369348-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Define the ENDP_INIT_NAT register for setting up the NAT configuration for an endpoint. We aren't using NAT at this time, so explicitly set the type to BYPASS for all endpoints. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 17 ++++++++++++++++- drivers/net/ipa/ipa_reg.h | 14 +++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 5f93bd60c7586..38e83cd467b52 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2020 Linaro Ltd. + * Copyright (C) 2019-2021 Linaro Ltd. */ #include @@ -468,6 +468,20 @@ static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint) iowrite32(val, endpoint->ipa->reg_virt + offset); } +static void ipa_endpoint_init_nat(struct ipa_endpoint *endpoint) +{ + u32 offset; + u32 val; + + if (!endpoint->toward_ipa) + return; + + offset = IPA_REG_ENDP_INIT_NAT_N_OFFSET(endpoint->endpoint_id); + val = u32_encode_bits(IPA_NAT_BYPASS, NAT_EN_FMASK); + + iowrite32(val, endpoint->ipa->reg_virt + offset); +} + /** * ipa_endpoint_init_hdr() - Initialize HDR endpoint configuration register * @endpoint: Endpoint pointer @@ -1488,6 +1502,7 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint) else (void)ipa_endpoint_program_suspend(endpoint, false); ipa_endpoint_init_cfg(endpoint); + ipa_endpoint_init_nat(endpoint); ipa_endpoint_init_hdr(endpoint); ipa_endpoint_init_hdr_ext(endpoint); ipa_endpoint_init_hdr_metadata_mask(endpoint); diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index 36fe746575f6b..bba088e80cd1e 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2018-2020 Linaro Ltd. + * Copyright (C) 2018-2021 Linaro Ltd. */ #ifndef _IPA_REG_H_ #define _IPA_REG_H_ @@ -388,6 +388,18 @@ enum ipa_cs_offload_en { IPA_CS_OFFLOAD_DL = 0x2, }; +/* Valid only for TX (IPA consumer) endpoints */ +#define IPA_REG_ENDP_INIT_NAT_N_OFFSET(ep) \ + (0x0000080c + 0x0070 * (ep)) +#define NAT_EN_FMASK GENMASK(1, 0) + +/** enum ipa_nat_en - ENDP_INIT_NAT register NAT_EN field value */ +enum ipa_nat_en { + IPA_NAT_BYPASS = 0x0, + IPA_NAT_SRC = 0x1, + IPA_NAT_DST = 0x2, +}; + #define IPA_REG_ENDP_INIT_HDR_N_OFFSET(ep) \ (0x00000810 + 0x0070 * (ep)) #define HDR_LEN_FMASK GENMASK(5, 0) From patchwork Wed Mar 24 13:15:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12161147 X-Patchwork-Delegate: kuba@kernel.org 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 6C656C433ED for ; Wed, 24 Mar 2021 13:16:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4011761A1F for ; Wed, 24 Mar 2021 13:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235221AbhCXNQX (ORCPT ); Wed, 24 Mar 2021 09:16:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234712AbhCXNPf (ORCPT ); Wed, 24 Mar 2021 09:15:35 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BAAC0613E4 for ; Wed, 24 Mar 2021 06:15:35 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id j26so21396654iog.13 for ; Wed, 24 Mar 2021 06:15:35 -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=urnf0slLMOPXg7nga5dabZHaUvtoQMaa3zOQvFLPfpg=; b=XXnUftby1PJstg1QGnrNCyvVockAvhoQ4xBqC3Kf5fXe0U9HwzNSpk/AcZ6lMxVnV5 YpIHmEPU26v+ECSQKHWVT15lyU8o90U+CdvemETr7dq3mWdRX89pRvWPVH0uCSq5BIcs oZhyUN3H7ptyM0YL7XbZ4AvLU8CLuY0vM1bpVE9rwnl2GsYK+MO0tAWcKzxMRdSMTc+K GKwQA294TDJ0NoaOOzaZLFpDIOlg1JPImV/q9OyZS2cGs0Shc73ISRQF5w9x1Tvl435X pTn97IR50kxQ8CsvOXIDGhuQStJ6UTPv2WcpJQm9ZnKB+S7AbTWDU7z4TNEd0VqWfvQE sGUQ== 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=urnf0slLMOPXg7nga5dabZHaUvtoQMaa3zOQvFLPfpg=; b=DSQ/41xBLP57tqKg5KOX7fb8tv6/8uDHCag6iIaVtlgWsA2mENer6iTHsQdp1Jd5Fd d8zQoIOKdWCxf8+rjQvveZD69ZJdQGOMSgJ7JIWRDSsKR6WgT5iJCaomtgSHvBofGjqO fziFE5QYV/cBJOcAOITQvoq+7X20iWgtNl+BnfPhi9OkWt5PJRWicf1FgQbrm+THVuz8 JQv0bZI76WlGK2DdsIFbHuddQjaqr4+aaAKh1jrG1upB5rJ9U/aSvjC3afgMxW2vu+5Z RjIo3Iqu32IeO69pN/6GUVph6t4qrvgpVm2sF2eI7DoYhzsKh8mBUyDoGjcz/QuqySsa Gvyw== X-Gm-Message-State: AOAM530je6lhKa+ED6SYqKixTq5fU0MAsY7crZPWWw+Knp5RBiRui2u3 ucbOy5FzXR82lM+Z6OZYQrzrqegAnZeEWdQW X-Google-Smtp-Source: ABdhPJwhm6deOM+Slv8dvjshL8No2AngclJGGLSLkeePXmkZ61SPgto/1KAIFFtRV6Yn6foyp7Hgiw== X-Received: by 2002:a02:cad9:: with SMTP id f25mr2799645jap.26.1616591734490; Wed, 24 Mar 2021 06:15:34 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id n7sm1160486ile.12.2021.03.24.06.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 06:15:34 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 4/6] net: ipa: limit local processing context address Date: Wed, 24 Mar 2021 08:15:26 -0500 Message-Id: <20210324131528.2369348-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210324131528.2369348-1-elder@linaro.org> References: <20210324131528.2369348-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Not all of the bits of the LOCAL_PKT_PROC_CNTXT register are valid. Until IPA v4.5, there are 17 valid bits (though the bottom three must be zero). Starting with IPA v4.5, 18 bits are valid. Introduce proc_cntxt_base_addr_encoded() to encode the base address for use in the register using only the valid bits. Shorten the name of the register (omit "_BASE") to avoid the need to wrap the line in the one place it's used. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_mem.c | 6 ++++-- drivers/net/ipa/ipa_reg.h | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c index f25029b9ec857..32907dde5dc6a 100644 --- a/drivers/net/ipa/ipa_mem.c +++ b/drivers/net/ipa/ipa_mem.c @@ -61,6 +61,7 @@ int ipa_mem_setup(struct ipa *ipa) struct gsi_trans *trans; u32 offset; u16 size; + u32 val; /* Get a transaction to define the header memory region and to zero * the processing context and modem memory regions. @@ -89,8 +90,9 @@ int ipa_mem_setup(struct ipa *ipa) gsi_trans_commit_wait(trans); /* Tell the hardware where the processing context area is located */ - iowrite32(ipa->mem_offset + ipa->mem[IPA_MEM_MODEM_PROC_CTX].offset, - ipa->reg_virt + IPA_REG_LOCAL_PKT_PROC_CNTXT_BASE_OFFSET); + offset = ipa->mem_offset + ipa->mem[IPA_MEM_MODEM_PROC_CTX].offset; + val = proc_cntxt_base_addr_encoded(ipa->version, offset); + iowrite32(val, ipa->reg_virt + IPA_REG_LOCAL_PKT_PROC_CNTXT_OFFSET); return 0; } diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index bba088e80cd1e..cbfef27bbcf2c 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -217,8 +217,18 @@ static inline u32 ipa_reg_bcr_val(enum ipa_version version) return 0x00000000; } -/* The value of the next register must be a multiple of 8 */ -#define IPA_REG_LOCAL_PKT_PROC_CNTXT_BASE_OFFSET 0x000001e8 +/* The value of the next register must be a multiple of 8 (bottom 3 bits 0) */ +#define IPA_REG_LOCAL_PKT_PROC_CNTXT_OFFSET 0x000001e8 + +/* Encoded value for LOCAL_PKT_PROC_CNTXT register BASE_ADDR field */ +static inline u32 proc_cntxt_base_addr_encoded(enum ipa_version version, + u32 addr) +{ + if (version < IPA_VERSION_4_5) + return u32_encode_bits(addr, GENMASK(16, 0)); + + return u32_encode_bits(addr, GENMASK(17, 0)); +} /* ipa->available defines the valid bits in the AGGR_FORCE_CLOSE register */ #define IPA_REG_AGGR_FORCE_CLOSE_OFFSET 0x000001ec From patchwork Wed Mar 24 13:15:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12161139 X-Patchwork-Delegate: kuba@kernel.org 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 53B9AC433EB for ; Wed, 24 Mar 2021 13:16:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D734619B3 for ; Wed, 24 Mar 2021 13:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235210AbhCXNQU (ORCPT ); Wed, 24 Mar 2021 09:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234735AbhCXNPh (ORCPT ); Wed, 24 Mar 2021 09:15:37 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3255C0613DE for ; Wed, 24 Mar 2021 06:15:35 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id j26so21396719iog.13 for ; Wed, 24 Mar 2021 06:15:35 -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=mz7860lZzk6VZ253Yqzghlj/rfYbeBGQaKOgyWdMwc4=; b=SfYkeKXApi7lSZKgVpP2M8uiYF1rBLg4p9+gmn9IUpwPXMoq00r16kxp3vCdmAW2Gz JIIqu02uE7Tf6n6dCfjqvb0etdxlSWOSq7lBrpS0wBOaKrQuSWPc49g+3GzvqwOuLcnc /Rcm8CdDB7yJg8Ah+8SP+um7FVyE/k72032V9dKXx/3VmYzX6+YMoiquNchfa/B2mQNq R1GlCjfPciEd9XJ6gTnE9ggJFIBlHi24db9B7W1MVwHncVVGDFRnPPjtY4n9DXbSU1SN jsKN0a8YdXC5YxnmCPsdS2eQdYvN6HmLWTKQTIggN+9ae2TckUNaPHfPOAVl06c6wxYx oA3w== 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=mz7860lZzk6VZ253Yqzghlj/rfYbeBGQaKOgyWdMwc4=; b=Qv873gx01lhS+Wx6Zz7QEsIYT3CHfVd0F9xe4Ixlx7qZa5Use6w/NGAWUybHBRlLoZ o9hyTT5mJ9wkaAKe1Ksx1r/R8SuNJlm+DGq+ZIFKZUBjCnmBPWS9Km+pgCLQR8QDW9Dc boi78VYjuYlEWJo62tdPHEap6L2aXh2KET/pCb0oWkVEMEYoNZtBVK2QSzZtWCpd5DU3 HDZ6oZhmC+4lye5a52IfwThuiEMhhBS0EXfb2JwUkgnyUVRwV/+spj4PbJ/KHGiaTlMD 3G21I6hve5CJuFKMYPKIdp6pVMhkncYt7EzwSncMyzGZ+yQZJltZaGHbUbOBYJHKaW7H CzIg== X-Gm-Message-State: AOAM533Bj34bwPrXNJRQYneIgNgmqOXGgs6Gj/DtGnFRxEWuoW5JmHn7 oZPtbkJJ+8tCaWB26QerKiVPkA== X-Google-Smtp-Source: ABdhPJxTfRhz12RmMPUuybokjmzbbesH/g0RtrmjDVhfbrTUp0p/ZGLZVWgmNjuC1cacLZ0zTNle4g== X-Received: by 2002:a02:aa92:: with SMTP id u18mr2797673jai.119.1616591735389; Wed, 24 Mar 2021 06:15:35 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id n7sm1160486ile.12.2021.03.24.06.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 06:15:35 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 5/6] net: ipa: move ipa_aggr_granularity_val() Date: Wed, 24 Mar 2021 08:15:27 -0500 Message-Id: <20210324131528.2369348-6-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210324131528.2369348-1-elder@linaro.org> References: <20210324131528.2369348-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We only use ipa_aggr_granularity_val() inside "ipa_main.c", so it doesn't really need to be defined in a header file. It makes some sense to be grouped with the register definitions, but it is unlike the other inline functions now defined in "ipa_reg.h". So move it into "ipa_main.c" where it's used. TIMER_FREQUENCY is used only by that function, so move that definition as well. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 15 +++++++++++++++ drivers/net/ipa/ipa_reg.h | 12 ------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 62d82d48aed69..ba1bfc30210a3 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -287,6 +287,21 @@ ipa_hardware_config_qsb(struct ipa *ipa, const struct ipa_data *data) iowrite32(val, ipa->reg_virt + IPA_REG_QSB_MAX_READS_OFFSET); } +/* The internal inactivity timer clock is used for the aggregation timer */ +#define TIMER_FREQUENCY 32000 /* 32 KHz inactivity timer clock */ + +/* Compute the value to use in the COUNTER_CFG register AGGR_GRANULARITY + * field to represent the given number of microseconds. The value is one + * less than the number of timer ticks in the requested period. 0 is not + * a valid granularity value. + */ +static u32 ipa_aggr_granularity_val(u32 usec) +{ + /* assert(usec != 0); */ + + return DIV_ROUND_CLOSEST(usec * TIMER_FREQUENCY, USEC_PER_SEC) - 1; +} + /* IPA uses unified Qtime starting at IPA v4.5, implementing various * timestamps and timers independent of the IPA core clock rate. The * Qtimer is based on a 56-bit timestamp incremented at each tick of diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index cbfef27bbcf2c..86fe2978e8102 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -237,18 +237,6 @@ static inline u32 proc_cntxt_base_addr_encoded(enum ipa_version version, #define IPA_REG_COUNTER_CFG_OFFSET 0x000001f0 #define AGGR_GRANULARITY_FMASK GENMASK(8, 4) -/* The internal inactivity timer clock is used for the aggregation timer */ -#define TIMER_FREQUENCY 32000 /* 32 KHz inactivity timer clock */ - -/* Compute the value to use in the AGGR_GRANULARITY field representing the - * given number of microseconds. The value is one less than the number of - * timer ticks in the requested period. 0 not a valid granularity value. - */ -static inline u32 ipa_aggr_granularity_val(u32 usec) -{ - return DIV_ROUND_CLOSEST(usec * TIMER_FREQUENCY, USEC_PER_SEC) - 1; -} - /* The next register is not present for IPA v4.5 */ #define IPA_REG_TX_CFG_OFFSET 0x000001fc /* The first three fields are present for IPA v3.5.1 only */ From patchwork Wed Mar 24 13:15:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12161143 X-Patchwork-Delegate: kuba@kernel.org 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 22191C433EA for ; Wed, 24 Mar 2021 13:16:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF61F61A0F for ; Wed, 24 Mar 2021 13:16:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235181AbhCXNQS (ORCPT ); Wed, 24 Mar 2021 09:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234738AbhCXNPh (ORCPT ); Wed, 24 Mar 2021 09:15:37 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8621C0613E5 for ; Wed, 24 Mar 2021 06:15:36 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id d10so14546473ils.5 for ; Wed, 24 Mar 2021 06:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FQFA2QStDKmo1XhVZ4KOEMpN+hi3li+F67WfkjwPMWs=; b=WeDb3w8CTitNL7fiuwx+cOti4cQKBLcjExxqeMWo37GnH6C6+LRup+izK3itSPaCJb A5anL4t6Ar5H7xQe7JJ3UC4nvW9CR2nVc6TBklSLUY4skzJO+/+vSM9/KBdKH6uh4eQX 1wkSfJVsyVbwbe1UpQT4pCWIEkUNF/eW4+vSMVQ7cGDoArCop7lzkLv1y/pQ3/AF7AeU JPFYKXclr0SuCOnz1u4CiZpXoOH3oRrrMHaGZdpE/m4TMHUvJ8mvY70d5GlWRivr7wqA O/cAB5//lqMxT5ZqGHd/9VW1R8jBtI33CpRPWvaoupgYZvHrrcc7RGYB8KdfzkIrzTra rKEQ== 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=FQFA2QStDKmo1XhVZ4KOEMpN+hi3li+F67WfkjwPMWs=; b=U3JmOziUEcO1UQyEbk1OxeCMgZR0xQkPnznwKjo/ZMQvTk44NMlp7why09QLo7b1C2 1KPUGJ/abwdi1fmWgxRUlL/1uEmBFXZWBgdK+04VzIFfkMt2VIhtX8CeQ4H1BkZSqZ8m k/GLEReppzNgs39UpBjzSHHciA/+4LFVYVm5On2cU0AP/8L3BemIO5wyIHJa7kAgs+Wm saWFMU5RZQUGP1l9EWbes18xttyS+E+bkcM/eWL6np9FEItiIQThS6+7x+71W8eUFk9N vMSqqGPBDIQyZT5pWL2bmL1ewfhe8osz+Qvx+3nml/IcLYPxOhxYZ93uN/jaqV9FafgY QKKQ== X-Gm-Message-State: AOAM533tCVNHTm7N/ZYo3LInh9nQoJCjh/Y5o7cQAbEuxk9LWOu3rOHF LAt6DT0ZHf2djJkf5hDf2djWIQ== X-Google-Smtp-Source: ABdhPJxgqUoXVAUq3XhOK9/xiuwRElTHsbJ8mq0GmNX+XUfXi2axSbQ5PPrxXNjQyq0a1hn/+Ri1vQ== X-Received: by 2002:a92:b011:: with SMTP id x17mr2598180ilh.113.1616591736340; Wed, 24 Mar 2021 06:15:36 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id n7sm1160486ile.12.2021.03.24.06.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 06:15:35 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 6/6] net: ipa: increase channels and events Date: Wed, 24 Mar 2021 08:15:28 -0500 Message-Id: <20210324131528.2369348-7-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210324131528.2369348-1-elder@linaro.org> References: <20210324131528.2369348-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Increase the maximum number of channels and event rings supported by the driver, to allow the maximum available on the SDX55. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index efc980f96109e..d5996bdb20ef5 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -16,8 +16,8 @@ #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 +#define GSI_CHANNEL_COUNT_MAX 23 +#define GSI_EVT_RING_COUNT_MAX 20 /* Maximum TLV FIFO size for a channel; 64 here is arbitrary (and high) */ #define GSI_TLV_MAX 64