From patchwork Mon Jan 30 21:01:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 648695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91E0FC54EAA for ; Mon, 30 Jan 2023 21:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229826AbjA3VDB (ORCPT ); Mon, 30 Jan 2023 16:03:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbjA3VDA (ORCPT ); Mon, 30 Jan 2023 16:03:00 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 547387EE9 for ; Mon, 30 Jan 2023 13:02:59 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id l7so3825861ilf.0 for ; Mon, 30 Jan 2023 13:02:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hMq3JNiaNSjQXwZ1boO/j34bxxGpJn4ZMoNDU6z/FXU=; b=VZt9ikiN+21jBHUUuDf6aSL8Q1sjS2JZsHMvuEb/YPohu8UFnG+0enzAlO5dDSIJMM OMy6vsJbz+Ds3lKztH+FzQopalTZj2oqhLBeKXdZPA8BJrgStrnHE845X/Qra2htvXWa IsP8LkAwQFn2HfyBnzW2K32UgggAC1WZNw3esxTHs23TeCLtHWO32Gm/NUiIQYaZQ+Bj WUhr8RtVrawRMwdhn7YM2NM1qEgcGCSQIR+eLd3Wwuj5YckOdV7Yw5aW8pmGFcaizNsA NGMCZdZevfj/kS7/eixfa2kLTwmhV/Bjo8+iZPTSefFNe5n9kZKtOVXGkCHE90Va1WCJ IEdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hMq3JNiaNSjQXwZ1boO/j34bxxGpJn4ZMoNDU6z/FXU=; b=dZUR0S2T6bYXaa7EO8JE6Az6UDkc1neIfpuDzHmn0iMVnVShyrms+U+PjhW5YG8qV+ UKm/E+lY6IGZ4c5zsbCCJsjH8feg57zPkTG+nRWo1OfMfRsNIND2SbC9l2lP0BC2xC/Y XN5yBuB01IFKKfApoBMewnavKD15jqaibjL44OvpRoAdk0sPvJwzvtvSZE9O9aLx6+DC LTPQSiZRvU+Ubm2TLLkcExWCbBoot4tbKAE5WfdLgBVnDJow+KCU8+AOBRs5dyX8zBa4 BQslnvgy/+T8FtU7mUj+MAgsEDJPntXFX2AC33+HQn/sJJv/iVGMwNLFxB5siEVXF4U+ lsuQ== X-Gm-Message-State: AO0yUKVcgsK45GYIMJD5THcS3pEkyED83SpaUCVYQWx8lxDLKI9cXUdl X6jPxd2uccFJSE2MG20YZK+Gjg== X-Google-Smtp-Source: AK7set9TSD4n14c/WyeF+aojzUX61n96RMQWDPaZa6tz9I3XGVGIXKChMmSkPRMBYXSYNcruCyZ/Fg== X-Received: by 2002:a05:6e02:2181:b0:310:f912:5a7c with SMTP id j1-20020a056e02218100b00310f9125a7cmr3450789ila.25.1675112578623; Mon, 30 Jan 2023 13:02:58 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id a30-20020a02735e000000b003aef8fded9asm1992046jae.127.2023.01.30.13.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:02:47 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/8] net: ipa: support more endpoints Date: Mon, 30 Jan 2023 15:01:51 -0600 Message-Id: <20230130210158.4126129-2-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130210158.4126129-1-elder@linaro.org> References: <20230130210158.4126129-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Increase the number of endpoints supported by the driver to 36, which IPA v5.0 supports. This makes it impossible to check at build time whether the supported number is too big to fit within the (5-bit) PACKET_INIT destination endpoint field. Instead, convert the build time check to compare against what fits in 8 bits. Add a check in ipa_endpoint_config() to also ensure the hardware reports an endpoint count that's in the expected range. Just open-code 32 as the limit (the PACKET_INIT field mask is not available where we'd want to use it). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_cmd.c | 13 +++++++++---- drivers/net/ipa/ipa_endpoint.c | 11 ++++++++++- drivers/net/ipa/ipa_endpoint.h | 4 ++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index bb3dfa9a2bc81..aa2b594ca5067 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2022 Linaro Ltd. + * Copyright (C) 2019-2023 Linaro Ltd. */ #include @@ -157,9 +157,14 @@ static void ipa_cmd_validate_build(void) BUILD_BUG_ON(field_max(IP_FLTRT_FLAGS_HASH_ADDR_FMASK) != field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK)); - /* Valid endpoint numbers must fit in the IP packet init command */ - BUILD_BUG_ON(field_max(IPA_PACKET_INIT_DEST_ENDPOINT_FMASK) < - IPA_ENDPOINT_MAX - 1); + /* Prior to IPA v5.0, we supported no more than 32 endpoints, + * and this was reflected in some 5-bit fields that held + * endpoint numbers. Starting with IPA v5.0, the widths of + * these fields were extended to 8 bits, meaning up to 256 + * endpoints. If the driver claims to support more than + * that it's an error. + */ + BUILD_BUG_ON(IPA_ENDPOINT_MAX - 1 > U8_MAX); } /* Validate a memory region holding a table */ diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index ce7f2d6e447ed..8909ba8bfd0e9 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-2022 Linaro Ltd. + * Copyright (C) 2019-2023 Linaro Ltd. */ #include @@ -1986,6 +1986,7 @@ int ipa_endpoint_config(struct ipa *ipa) struct device *dev = &ipa->pdev->dev; const struct ipa_reg *reg; u32 endpoint_id; + u32 hw_limit; u32 tx_count; u32 rx_count; u32 rx_base; @@ -2031,6 +2032,14 @@ int ipa_endpoint_config(struct ipa *ipa) return -EINVAL; } + /* Until IPA v5.0, the max endpoint ID was 32 */ + hw_limit = ipa->version < IPA_VERSION_5_0 ? 32 : U8_MAX + 1; + if (limit > hw_limit) { + dev_err(dev, "unexpected endpoint count, %u > %u\n", + limit, hw_limit); + return -EINVAL; + } + /* Allocate and initialize the available endpoint bitmap */ ipa->available = bitmap_zalloc(limit, GFP_KERNEL); if (!ipa->available) diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h index 4a5c3bc549df5..3ad2e802040aa 100644 --- a/drivers/net/ipa/ipa_endpoint.h +++ b/drivers/net/ipa/ipa_endpoint.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2022 Linaro Ltd. + * Copyright (C) 2019-2023 Linaro Ltd. */ #ifndef _IPA_ENDPOINT_H_ #define _IPA_ENDPOINT_H_ @@ -38,7 +38,7 @@ enum ipa_endpoint_name { IPA_ENDPOINT_COUNT, /* Number of names (not an index) */ }; -#define IPA_ENDPOINT_MAX 32 /* Max supported by driver */ +#define IPA_ENDPOINT_MAX 36 /* Max supported by driver */ /** * struct ipa_endpoint_tx - Endpoint configuration for TX endpoints From patchwork Mon Jan 30 21:01:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 648967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7A86C54EAA for ; Mon, 30 Jan 2023 21:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229851AbjA3VD2 (ORCPT ); Mon, 30 Jan 2023 16:03:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbjA3VD1 (ORCPT ); Mon, 30 Jan 2023 16:03:27 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7562D17CEA for ; Mon, 30 Jan 2023 13:03:20 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id m8so5693818ili.7 for ; Mon, 30 Jan 2023 13:03:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kOMLzNh0yK/0qTgNUqpARcKHC/PDBTSkI4Jf9pY8gkc=; b=Am8GWon3yO+XZpbh2vH4WXuITnbyYP6+zqEC6IYJV5Zo8ApLD4K4QnCyfwph0c2GeP iVYFTxNcTH9ds5rT8rxSGn+xgS4FFh0VlIiT1ZzKo8EUq7t29YQQU6IzgURvR3uxYNyK YOInMA9M9a8FUWOIWkGQg3zDfEwEWVY4hpTTWwtOlfwBFY3bwNbttozjR7KAReXREqW5 0KshzktYoMfi4dqMUZKMngEG3/v/c+0MTVQxuJLGEVC551B6nAzW6w1ZeupF92sIkned qtggfxDLkRdxj7r2vtddlmIgHYRGT3jj8gQ2sT05Hj9yUGrQFW2EUG7KF/2eFCMlHbdX IP9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kOMLzNh0yK/0qTgNUqpARcKHC/PDBTSkI4Jf9pY8gkc=; b=uF3eR5XHNvSdKEhA8hakWt7OhKHNTP9kFuLW8fX4O9A/cHtO0Vm4XsMAkcDldA1cQk XhUhH4yoxvD+G31QnTefIK8Q8YyZm3DtEdJ55VT4Cx0rbb+9USX+ABgns7hgVfNkVYW7 +GmMB+4CwPCkNnu1r8ZZsZusWRS6Ff2mNJI397eHCpRwbNIzI++Ho9QXq3pQ3Xgm1yMo LsfD1EkWM4FMSoYDLl5JgMxs6V1Kx87VlGI2aUUe9PmrFRXFf5HXIPJ9Mo49+FBECttr C+U4UjeE9cBESIB0+Ls6ndRf2An5Y+uUGcSbpRmbUg2qsV0+aUQ7zYp0Uv52RjlcWDok j3Yg== X-Gm-Message-State: AO0yUKUZQE9Ypzwwu0Ey/yv4ziCF1lin/Vru9Ep7qg5ejYgxSnVqw6f0 ISojDUbi3n7RC/xH2VXxBben7A== X-Google-Smtp-Source: AK7set87Oiqf2yVURDq65Vgtj7g6BYcFlvHTkqi6hILl58lH3403noiOUroQUBwzZr/riR7osXHz9w== X-Received: by 2002:a05:6e02:1aa2:b0:310:cc76:5c9d with SMTP id l2-20020a056e021aa200b00310cc765c9dmr11970789ilv.28.1675112599598; Mon, 30 Jan 2023 13:03:19 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id a30-20020a02735e000000b003aef8fded9asm1992046jae.127.2023.01.30.13.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:03:12 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/8] net: ipa: extend endpoints in packet init command Date: Mon, 30 Jan 2023 15:01:52 -0600 Message-Id: <20230130210158.4126129-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130210158.4126129-1-elder@linaro.org> References: <20230130210158.4126129-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The IP_PACKET_INIT immediate command defines the destination endpoint to which a packet should be sent. Prior to IPA v5.0, a 5 bit field in that command represents the endpoint, but starting with IPA v5.0, the field is extended to 8 bits to support more than 32 endpoints. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_cmd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index aa2b594ca5067..5d3a875e50fee 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -94,11 +94,11 @@ struct ipa_cmd_register_write { /* IPA_CMD_IP_PACKET_INIT */ struct ipa_cmd_ip_packet_init { - u8 dest_endpoint; + u8 dest_endpoint; /* Full 8 bits used for IPA v5.0+ */ u8 reserved[7]; }; -/* Field masks for ipa_cmd_ip_packet_init dest_endpoint field */ +/* Field mask for ipa_cmd_ip_packet_init dest_endpoint field (unused v5.0+) */ #define IPA_PACKET_INIT_DEST_ENDPOINT_FMASK GENMASK(4, 0) /* IPA_CMD_DMA_SHARED_MEM */ @@ -491,8 +491,13 @@ static void ipa_cmd_ip_packet_init_add(struct gsi_trans *trans, u8 endpoint_id) cmd_payload = ipa_cmd_payload_alloc(ipa, &payload_addr); payload = &cmd_payload->ip_packet_init; - payload->dest_endpoint = u8_encode_bits(endpoint_id, - IPA_PACKET_INIT_DEST_ENDPOINT_FMASK); + if (ipa->version < IPA_VERSION_5_0) { + payload->dest_endpoint = + u8_encode_bits(endpoint_id, + IPA_PACKET_INIT_DEST_ENDPOINT_FMASK); + } else { + payload->dest_endpoint = endpoint_id; + } gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr, opcode); From patchwork Mon Jan 30 21:01:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 648694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8992C636D7 for ; Mon, 30 Jan 2023 21:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbjA3VDw (ORCPT ); Mon, 30 Jan 2023 16:03:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbjA3VDw (ORCPT ); Mon, 30 Jan 2023 16:03:52 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68B6D93D3 for ; Mon, 30 Jan 2023 13:03:48 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id d10so5684503ilc.12 for ; Mon, 30 Jan 2023 13:03:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tOyLjlWftaazOIBf1HphYUtK4tgdVdjT0p+urwc0ffk=; b=BRiJl/Sxqr0OJaaeJd62qJfIzmm5RIsUMo9nk/IhN4hNmOZk7/vTtKevXu1EDW7kB4 SrBsiHcrP3nW3Tgu+qgrHJl/VrhpFu6/X6YMdENVrLH2V8Dd+gpgbWVh7bLWoX/KXRCv wwmiicBtD8kCLmK/ghUxR1/btNXSIcjHyb8LsQkBeGHjfcrYeE/MEVlwWR7JrA2jGZth Ii0CTVMycz+XYBQS81KmwlXYI0TiA+/1ppzJT5m9KXJ8Gs9Ld4WC9YHvTTRIgHfe1Mn9 728DizukwpjTZLwaI4n+bMqBROPNk5CvOgeDjhSWDHSTmgev5Ap3UcV0yuBVt9VzFu+4 Rn1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tOyLjlWftaazOIBf1HphYUtK4tgdVdjT0p+urwc0ffk=; b=w5FdESDpDNwVk2etLqFKr8cgXGxQC168hvqyLP5BlgalzI+WCbWPQJVISCvc7w2MJ8 jPKrMKUN6J1xp19CbSYxHrkb3ij7opvFhA5gqX+1pgtmWIYzRbdLODxlAiXAb1AR4Nas xFiy5sOt3MuF4K10WZ0rbGLKZy5jeIUKCIpqB9RRVNSG47/l6vJhUOgUTCLWW+ZuvKH5 drxplSqr3yjCnBQjSuCm3a69ejsHAPy3oePU6cBLjuI1GryxwTrM3b8uU87d96HW2LPx xY1fFVzJ6bxlMz0CCk+hDNW1MemyHorDcZhYvHzNBr0NxhmirRZKmIp+6HpBUKmh/V+7 bNNg== X-Gm-Message-State: AO0yUKWFPaxMo7K8WyDsJgUblnCfQZMZkREo1k2mfcmqRsnNkmT+g1gG yh8NzlF/BmSDItmQsyP59o/eCQ== X-Google-Smtp-Source: AK7set/fvnnk/+ZR+ye7CyMzj6m4N5Gna08GsVWs8CaUWQN281Ph1JGpvK8l76be6RAd7njuZGzMMA== X-Received: by 2002:a05:6e02:1485:b0:310:ef5d:de8a with SMTP id n5-20020a056e02148500b00310ef5dde8amr6327006ilk.27.1675112627758; Mon, 30 Jan 2023 13:03:47 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id a30-20020a02735e000000b003aef8fded9asm1992046jae.127.2023.01.30.13.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:03:26 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/8] net: ipa: define IPA v5.0+ registers Date: Mon, 30 Jan 2023 15:01:53 -0600 Message-Id: <20230130210158.4126129-4-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130210158.4126129-1-elder@linaro.org> References: <20230130210158.4126129-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Define some new registers that appear starting with IPA v5.0, along with enumerated types identifying their fields. Code that uses these will be added by upcoming patches. Most of the new registers are related to filter and routing tables, and in particular, their "hashed" variant. These tables are better described as "cached", where a hash value determines which entries are cached. From now on, naming related to this functionality will use "cache" instead of "hash", and that is reflected in these new register names. Some registers for managing these caches and their contents have changed as well. A few other new field definitions for registers (unrelated to table caches) are also defined. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_reg.h | 43 ++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index b1a3c2c7e1674..82d43eca170ec 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-2022 Linaro Ltd. + * Copyright (C) 2018-2023 Linaro Ltd. */ #ifndef _IPA_REG_H_ #define _IPA_REG_H_ @@ -59,8 +59,10 @@ enum ipa_reg_id { SHARED_MEM_SIZE, QSB_MAX_WRITES, QSB_MAX_READS, - FILT_ROUT_HASH_EN, - FILT_ROUT_HASH_FLUSH, + FILT_ROUT_HASH_EN, /* Not IPA v5.0+ */ + FILT_ROUT_CACHE_CFG, /* IPA v5.0+ */ + FILT_ROUT_HASH_FLUSH, /* Not IPA v5.0+ */ + FILT_ROUT_CACHE_FLUSH, /* IPA v5.0+ */ STATE_AGGR_ACTIVE, IPA_BCR, /* Not IPA v4.5+ */ LOCAL_PKT_PROC_CNTXT, @@ -95,7 +97,9 @@ enum ipa_reg_id { ENDP_INIT_SEQ, /* TX only */ ENDP_STATUS, ENDP_FILTER_ROUTER_HSH_CFG, /* Not IPA v4.2 */ - /* The IRQ registers are only used for GSI_EE_AP */ + ENDP_FILTER_CACHE_CFG, /* IPA v5.0+ */ + ENDP_ROUTER_CACHE_CFG, /* IPA v5.0+ */ + /* The IRQ registers that follow are only used for GSI_EE_AP */ IPA_IRQ_STTS, IPA_IRQ_EN, IPA_IRQ_CLR, @@ -251,14 +255,28 @@ enum ipa_reg_qsb_max_reads_field_id { GEN_QMB_1_MAX_READS_BEATS, /* IPA v4.0+ */ }; +/* FILT_ROUT_CACHE_CFG register */ +enum ipa_reg_filt_rout_cache_cfg_field_id { + ROUTER_CACHE_EN, + FILTER_CACHE_EN, + LOW_PRI_HASH_HIT_DISABLE, + LRU_EVICTION_THRESHOLD, +}; + /* FILT_ROUT_HASH_EN and FILT_ROUT_HASH_FLUSH registers */ -enum ipa_reg_rout_hash_field_id { +enum ipa_reg_filt_rout_hash_field_id { IPV6_ROUTER_HASH, IPV6_FILTER_HASH, IPV4_ROUTER_HASH, IPV4_FILTER_HASH, }; +/* FILT_ROUT_CACHE_FLUSH register */ +enum ipa_reg_filt_rout_cache_field_id { + ROUTER_CACHE, + FILTER_CACHE, +}; + /* BCR register */ enum ipa_bcr_compat { BCR_CMDQ_L_LACK_ONE_ENTRY = 0x0, /* Not IPA v4.2+ */ @@ -298,6 +316,7 @@ enum ipa_reg_ipa_tx_cfg_field_id { DUAL_TX_ENABLE, /* v4.5+ */ SSPND_PA_NO_START_STATE, /* v4,2+, not v4.5 */ SSPND_PA_NO_BQ_STATE, /* v4.2 only */ + HOLB_STICKY_DROP_EN, /* v5.0+ */ }; /* FLAVOR_0 register */ @@ -333,6 +352,7 @@ enum ipa_reg_timers_pulse_gran_cfg_field_id { PULSE_GRAN_0, PULSE_GRAN_1, PULSE_GRAN_2, + PULSE_GRAN_3, }; /* Values for IPA_GRAN_x fields of TIMERS_PULSE_GRAN_CFG */ @@ -415,6 +435,8 @@ enum ipa_reg_endp_init_hdr_ext_field_id { HDR_TOTAL_LEN_OR_PAD_OFFSET_MSB, /* v4.5+ */ HDR_OFST_PKT_SIZE_MSB, /* v4.5+ */ HDR_ADDITIONAL_CONST_LEN_MSB, /* v4.5+ */ + HDR_BYTES_TO_REMOVE_VALID, /* v5.0+ */ + HDR_BYTES_TO_REMOVE, /* v5.0+ */ }; /* ENDP_INIT_MODE register */ @@ -573,6 +595,17 @@ enum ipa_reg_endp_filter_router_hsh_cfg_field_id { ROUTER_HASH_MSK_ALL, /* Bitwise OR of the above 6 fields */ }; +/* ENDP_FILTER_CACHE_CFG and ENDP_ROUTER_CACHE_CFG registers */ +enum ipa_reg_endp_cache_cfg_field_id { + CACHE_MSK_SRC_ID, + CACHE_MSK_SRC_IP, + CACHE_MSK_DST_IP, + CACHE_MSK_SRC_PORT, + CACHE_MSK_DST_PORT, + CACHE_MSK_PROTOCOL, + CACHE_MSK_METADATA, +}; + /* IPA_IRQ_STTS, IPA_IRQ_EN, and IPA_IRQ_CLR registers */ /** * enum ipa_irq_id - Bit positions representing type of IPA IRQ From patchwork Mon Jan 30 21:01:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 648966 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5516C636CD for ; Mon, 30 Jan 2023 21:03:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbjA3VDy (ORCPT ); Mon, 30 Jan 2023 16:03:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230240AbjA3VDx (ORCPT ); Mon, 30 Jan 2023 16:03:53 -0500 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01546FF27 for ; Mon, 30 Jan 2023 13:03:50 -0800 (PST) Received: by mail-il1-x12c.google.com with SMTP id u7so4174710ilg.4 for ; Mon, 30 Jan 2023 13:03:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/wNCgzH7OXXpYksxcizbVKUE/CMJ5l2Lr3suZg8TUds=; b=wBLF6pnJdn3Jnnbb13uL54pswL0stCyhafTbjIvE6CeWY6sOeO3Xeu9buwxhrDrWDP 2IjAIHmkhEaZFZYDrZKRlLcgl+6C8NNFgsQsu+L+MNqyoUyDW5+iRpT/Tmxbqj1zpwc6 Z1ht48ePW7+1SeYmCStPHc/5vyXUOr+h848wi6h8UI7vc8cystuEe7+rbD4KjPCNigTO D3h6zWOZKs1rH1wdMYfOS+zY7HpPi7OkXBpohTsKirXl5FE7CO0yKkaipKOybkJCVYOy p+OlsTB/ox28mRNuRLOL+/NQPJYv8HLIsKYDmPwNs0sF6koHFdkEDOF4uH2Q+ckEHpr5 ErkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/wNCgzH7OXXpYksxcizbVKUE/CMJ5l2Lr3suZg8TUds=; b=bOB1xo00DFAfC1ItbtWMhEvHHkanX8ndw7QQokeX0qVwmHk8ucrNgF5cE4G+xeQ9bP E0QqoMFHRBb8whvVLnodQ8R/qIb0pPLbLUre4pO6a/bY+IKmauXV2Wxa0aPt/YMNMwry IdHy3tTQ6E0PXfCAfHBALvcKv259f9MCv0vaEASccoNfmJnb8rmwfUczGq3ic1mN5UsM FjpBEAT2M3QJ9vef/K0hkhcLE+PbTfIyum7ipXxSGN0MYMhvSvBDiujACQnY3B8akFjr xEz1WrJBQl8GB/op8o1uFRj2Sx1AB8N4ocNYp1ij2DdBjBcXtmYbb+2qAAzoOZ7PGrB1 kxbg== X-Gm-Message-State: AO0yUKUrQU2OAbGJMRakFbv4v96M7tGRDnN+nwE016mGAaDNGOCRznk2 q4NnDZcYl2txYtPPaVuh8q9Z9Q== X-Google-Smtp-Source: AK7set9BSoOOmpQ0C59BIU93sw8ZvwFDjHQeC5zEndueQeZrMBUPeujA3sXeLiKaROaoLbB436rE9w== X-Received: by 2002:a05:6e02:1a42:b0:310:e798:aa2d with SMTP id u2-20020a056e021a4200b00310e798aa2dmr6098956ilv.13.1675112630340; Mon, 30 Jan 2023 13:03:50 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id a30-20020a02735e000000b003aef8fded9asm1992046jae.127.2023.01.30.13.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:03:49 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/8] net: ipa: update table cache flushing Date: Mon, 30 Jan 2023 15:01:54 -0600 Message-Id: <20230130210158.4126129-5-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130210158.4126129-1-elder@linaro.org> References: <20230130210158.4126129-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Update the code that causes filter and router table caches to be flushed so that it supports IPA versions 5.0+. It adds a comment in ipa_hardware_config_hashing() that explains that cacheing does not need to be enabled, just as before, because it's enabled by default. (For the record, the FILT_ROUT_CACHE_CFG register would have been used if we wanted to explicitly enable these.) Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_cmd.c | 6 +++++- drivers/net/ipa/ipa_main.c | 7 ++++++- drivers/net/ipa/ipa_table.c | 23 ++++++++++++++++------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index 5d3a875e50fee..16169641ddebe 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -295,7 +295,11 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa) * offset will fit in a register write IPA immediate command. */ if (ipa_table_hash_support(ipa)) { - reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH); + if (ipa->version < IPA_VERSION_5_0) + reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH); + else + reg = ipa_reg(ipa, FILT_ROUT_CACHE_FLUSH); + offset = ipa_reg_offset(reg); name = "filter/route hash flush"; if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 4fb92f7719741..f3466b913394c 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2018-2022 Linaro Ltd. + * Copyright (C) 2018-2023 Linaro Ltd. */ #include @@ -432,6 +432,11 @@ static void ipa_hardware_config_hashing(struct ipa *ipa) { const struct ipa_reg *reg; + /* Other than IPA v4.2, all versions enable "hashing". Starting + * with IPA v5.0, the filter and router tables are implemented + * differently, but the default configuration enables this feature + * (now referred to as "cacheing"), so there's nothing to do here. + */ if (ipa->version != IPA_VERSION_4_2) return; diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index b81e27b613549..32ed9fec2ca74 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2018-2022 Linaro Ltd. + * Copyright (C) 2018-2023 Linaro Ltd. */ #include @@ -359,13 +359,22 @@ int ipa_table_hash_flush(struct ipa *ipa) return -EBUSY; } - reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH); - offset = ipa_reg_offset(reg); + if (ipa->version < IPA_VERSION_5_0) { + reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH); + offset = ipa_reg_offset(reg); - val = ipa_reg_bit(reg, IPV6_ROUTER_HASH); - val |= ipa_reg_bit(reg, IPV6_FILTER_HASH); - val |= ipa_reg_bit(reg, IPV4_ROUTER_HASH); - val |= ipa_reg_bit(reg, IPV4_FILTER_HASH); + val = ipa_reg_bit(reg, IPV6_ROUTER_HASH); + val |= ipa_reg_bit(reg, IPV6_FILTER_HASH); + val |= ipa_reg_bit(reg, IPV4_ROUTER_HASH); + val |= ipa_reg_bit(reg, IPV4_FILTER_HASH); + } else { + reg = ipa_reg(ipa, FILT_ROUT_CACHE_FLUSH); + offset = ipa_reg_offset(reg); + + /* IPA v5.0+ uses a unified cache (both IPv4 and IPv6) */ + val = ipa_reg_bit(reg, ROUTER_CACHE); + val |= ipa_reg_bit(reg, FILTER_CACHE); + } ipa_cmd_register_write_add(trans, offset, val, val, false); From patchwork Mon Jan 30 21:01:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 648693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E14B7C636D3 for ; Mon, 30 Jan 2023 21:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbjA3VEA (ORCPT ); Mon, 30 Jan 2023 16:04:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230264AbjA3VDy (ORCPT ); Mon, 30 Jan 2023 16:03:54 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38E0913DFC for ; Mon, 30 Jan 2023 13:03:52 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id r6so2464954ioj.5 for ; Mon, 30 Jan 2023 13:03:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6Q3ZO5XASIsXMpDUmQAaU+Lb+omH36X+YOT42bBfC3M=; b=M7Q2dK7BE8v+7dbB8GTF7HUnrgbQGlROg82yKcEvudTV+UfIq3Y8ju26ZYuTHDSE7c JAdF2DqZRDYjtj7uRfMdlA0JvI8kLKN1/Vn5URq884CUxFtDymJrroy+TKkZkGXO4hKg oUnYXJhjciLZkLsRUrrs0E907EUBcsEjgyDUr3iEYpzyML+W9MMFZ5xkUGj7uDMYd5CS WfIfx9x5/JaAZcOKs6yagr7rTPVhVv20Cx1fTcNGEYbaVCKGQPSd1tm1QB7pw/PjZ29j 1Km14Uv7xNuifDhlxwYLRn6wdI34h1k82CLfpaNNRzWdHKu9QvpIJQlWjeLZzsfxCH1m 3qyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Q3ZO5XASIsXMpDUmQAaU+Lb+omH36X+YOT42bBfC3M=; b=rQdJ08JWYLsK7ywA/sn3J+mTEZdQWOaZwaJdqJ7EyYv5BzYv+WJ693bRqS/54cLFT+ RoCiZTH1zanZOvta2odFcBAuGKZcyGM9GQJYUd+FkWCXKpHMsYS2NiapIaGnIBwXNksb FTY5wFedK8FYuzuVCKc/pGmri3uCkhqZxGXN9srMfjdKBezfHWwCVTE7yCoQPD4OYH3b OP3RdHPpAqNVBF3PyHunosUOiIxUmQnhQ7xugD6UKMY/gQZChKxb0bE4qtdVPVLgt7a4 YVS9vNZNC9HcjA12Eccj01i470/vmZm+BcVeLTD7ms833Hwrck9AbOGe9I1oddOFLaIn 6jPA== X-Gm-Message-State: AO0yUKWL8fzjTR5VRNcRRz93u9Kx6cWtnaBYZr0aGmayf8vwdTU7LCwn dYm2h3C50Zfv9cFIW83IRAfUMw== X-Google-Smtp-Source: AK7set+pHPJZjyJPcXcrBm5AZhB8wUYj2LubxHFMJZxqKbGAtWI8NoWPDvO/0BKY5gQ1cN2wIlwA8g== X-Received: by 2002:a05:6602:22d8:b0:71f:2e0b:5c64 with SMTP id e24-20020a05660222d800b0071f2e0b5c64mr1882223ioe.3.1675112631552; Mon, 30 Jan 2023 13:03:51 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id a30-20020a02735e000000b003aef8fded9asm1992046jae.127.2023.01.30.13.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:03:51 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/8] net: ipa: support zeroing new cache tables Date: Mon, 30 Jan 2023 15:01:55 -0600 Message-Id: <20230130210158.4126129-6-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130210158.4126129-1-elder@linaro.org> References: <20230130210158.4126129-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org IPA v5.0+ separates the configuration of entries in the cached (previously "hashed") routing and filtering tables into distinct registers. Previously a single "filter and router" register updated entries in both tables at once; now the routing and filter table caches have separate registers that define their content. This patch updates the code that zeroes entries in the cached filter and router tables to support IPA versions including v5.0+. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_table.c | 38 +++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index 32ed9fec2ca74..b9d505191f884 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -499,13 +499,22 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint) u32 offset; u32 val; - reg = ipa_reg(ipa, ENDP_FILTER_ROUTER_HSH_CFG); + if (ipa->version < IPA_VERSION_5_0) { + reg = ipa_reg(ipa, ENDP_FILTER_ROUTER_HSH_CFG); - offset = ipa_reg_n_offset(reg, endpoint_id); - val = ioread32(endpoint->ipa->reg_virt + offset); + offset = ipa_reg_n_offset(reg, endpoint_id); + val = ioread32(endpoint->ipa->reg_virt + offset); - /* Zero all filter-related fields, preserving the rest */ - val &= ~ipa_reg_fmask(reg, FILTER_HASH_MSK_ALL); + /* Zero all filter-related fields, preserving the rest */ + val &= ~ipa_reg_fmask(reg, FILTER_HASH_MSK_ALL); + } else { + /* IPA v5.0 separates filter and router cache configuration */ + reg = ipa_reg(ipa, ENDP_FILTER_CACHE_CFG); + offset = ipa_reg_n_offset(reg, endpoint_id); + + /* Zero all filter-related fields */ + val = 0; + } iowrite32(val, endpoint->ipa->reg_virt + offset); } @@ -549,13 +558,22 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) u32 offset; u32 val; - reg = ipa_reg(ipa, ENDP_FILTER_ROUTER_HSH_CFG); - offset = ipa_reg_n_offset(reg, route_id); + if (ipa->version < IPA_VERSION_5_0) { + reg = ipa_reg(ipa, ENDP_FILTER_ROUTER_HSH_CFG); + offset = ipa_reg_n_offset(reg, route_id); - val = ioread32(ipa->reg_virt + offset); + val = ioread32(ipa->reg_virt + offset); - /* Zero all route-related fields, preserving the rest */ - val &= ~ipa_reg_fmask(reg, ROUTER_HASH_MSK_ALL); + /* Zero all route-related fields, preserving the rest */ + val &= ~ipa_reg_fmask(reg, ROUTER_HASH_MSK_ALL); + } else { + /* IPA v5.0 separates filter and router cache configuration */ + reg = ipa_reg(ipa, ENDP_ROUTER_CACHE_CFG); + offset = ipa_reg_n_offset(reg, route_id); + + /* Zero all route-related fields */ + val = 0; + } iowrite32(val, ipa->reg_virt + offset); } From patchwork Mon Jan 30 21:01:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 648965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DE7EC636CD for ; Mon, 30 Jan 2023 21:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbjA3VEK (ORCPT ); Mon, 30 Jan 2023 16:04:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbjA3VDz (ORCPT ); Mon, 30 Jan 2023 16:03:55 -0500 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 9369527D5A for ; Mon, 30 Jan 2023 13:03:53 -0800 (PST) Received: by mail-il1-x130.google.com with SMTP id z2so5128378ilq.2 for ; Mon, 30 Jan 2023 13:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dM0y1yQcXWiFMZI5D02Tn6gafxuwKDl7gTmaBAdj+n8=; b=j5jAfAy0SfjdnpKaxOWTdmx/JhW/AWmoGzSpAwZUmP2Zy0IlmVplU1xuKKrZZzLUGg U5vlw8wBNxGR90mztzFpVIZqQcodf/ypx7ZOqk0s5VRfIvtFH2p6YlkbRhCWxchapwjZ 5otexYaTtN87Sm4eXhINjgEhpkoJEqu0JmET4JZlDVepOS9qNmf5qBPnh1aAG6fMFcdV PjyuObiUZCHp6PvWmnuQ3BZtJ0PRbMHUX4zFn3qzQTmuOvnJXcETzLCGerEl6146b3Ev moD7AR+V2+HIaF5VrqRAmkdsgLWav0N8wzUpni3rtbYiciLAJdHARcFUkgvuRq0j7Mxx YdpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dM0y1yQcXWiFMZI5D02Tn6gafxuwKDl7gTmaBAdj+n8=; b=Hc3ZXCOSb+u8/a1srod/YMkZeDS8jYqHAIpyk+O5AW5s25c296r4zkmIRPuvwhcWrp +jPMM727CEookdtmYAq9go0u6KATySAbAiNqPZ3KmzI/fQveKL/YFEbPDq2W6io6VplX y2GmguxCMnLguFo3nsVn1qNCENgYdAatVX4zK9HnPO9ucYz08CyOPkaYpKI6jPxbYz7y yQmyYbw94R/zlpzNtrtSgRMxkPhLSLivAkZHg0Szi7131dG/ySJ2KlvTTlrFM89N2Od1 lPu68ud6rr4ZylDVQ+Po4Sm3LKc7v9R2Ux2O4olcdS8XfolX4u3hDoB1hes1AbCIX9Gh iEsg== X-Gm-Message-State: AO0yUKU/2ZDu5AX1xLgtnfrb6mex6TTeShXegQykapvWMRJEbheFejyw Y4U9xNju19kBqQ51NJUikrGwRA== X-Google-Smtp-Source: AK7set/gHSEF7kOB76p04GVqM2c7AWCq9ftpz+QGvjPhHjCQ/I2JMhz66iBi9fBPqO0kK9OnT2l2cQ== X-Received: by 2002:a05:6e02:1e08:b0:310:f849:83b9 with SMTP id g8-20020a056e021e0800b00310f84983b9mr4044843ila.9.1675112632939; Mon, 30 Jan 2023 13:03:52 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id a30-20020a02735e000000b003aef8fded9asm1992046jae.127.2023.01.30.13.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:03:52 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/8] net: ipa: greater timer granularity options Date: Mon, 30 Jan 2023 15:01:56 -0600 Message-Id: <20230130210158.4126129-7-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130210158.4126129-1-elder@linaro.org> References: <20230130210158.4126129-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Starting with IPA v5.0, the head-of-line blocking timer has more than two pulse generators available to define timer granularity. To prepare for that, change the way the field value is encoded to use ipa_reg_encode() rather than ipa_reg_bit(). The aggregation granularity selection could (in principle) also use an additional pulse generator starting with IPA v5.0. Encode the AGGR_GRAN_SEL field differently to allow that as well. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 8909ba8bfd0e9..c029209191d41 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -965,7 +965,7 @@ static u32 aggr_time_limit_encode(struct ipa *ipa, const struct ipa_reg *reg, ret = ipa_qtime_val(microseconds, max); if (ret < 0) { val = -ret; - gran_sel = ipa_reg_bit(reg, AGGR_GRAN_SEL); + gran_sel = ipa_reg_encode(reg, AGGR_GRAN_SEL, 1); } else { val = ret; gran_sel = 0; @@ -1057,7 +1057,7 @@ static u32 hol_block_timer_encode(struct ipa *ipa, const struct ipa_reg *reg, ret = ipa_qtime_val(microseconds, max); if (ret < 0) { val = -ret; - gran_sel = ipa_reg_bit(reg, TIMER_GRAN_SEL); + gran_sel = ipa_reg_encode(reg, TIMER_GRAN_SEL, 1); } else { val = ret; gran_sel = 0; From patchwork Mon Jan 30 21:01:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 648692 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08BB6C636D3 for ; Mon, 30 Jan 2023 21:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230357AbjA3VET (ORCPT ); Mon, 30 Jan 2023 16:04:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbjA3VEL (ORCPT ); Mon, 30 Jan 2023 16:04:11 -0500 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 2C4D347ED9 for ; Mon, 30 Jan 2023 13:03:59 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id k13so2358826iob.9 for ; Mon, 30 Jan 2023 13:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4fo8/oJYkHVkmTqER82lUxzE/JMQrzARbb9xB0zqsC4=; b=ZbVl4Huwv8a6Zl2VEXke70GYO1eY33pZPkG/bA4G7/Iv3IqfDqHRGSiANdo2bpMhxv sx5GrHGw0Tk4MGQM3l5QPcVtJypYZyRCcrLw7o6D+zRdH2AMvZfZiilvJ7OVt4FaB7Op yzF75UFbSmEjzDZiCmrkq44JxPqqt3UWYVLVC9OigmvPodboT/g2QGRpf4L5RBzr9if9 ztebkPLSbkTSWCYRXUeVMtY5S7Q90OYESSlDNhu8IqKLExaEboNYUIiD7Rlpsr3AgYCn OcMGqD+3NGXv6TEJYLPTFEpkXglFr+o3W5PkqY706b9ZwfK4xGioSYib4zpIrt5olBsu qD2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4fo8/oJYkHVkmTqER82lUxzE/JMQrzARbb9xB0zqsC4=; b=12BQcgeQR8IaO6gHE9fxOL/MZNGJmFbIRvc9JK7RdFu70GIvf6Ec/8aMaF/g7PMgYz pg/oanCl7G2xdtOCvEOz7ivLTHgg4giWBIigxksb6zxjb2I8A+F3U7H2rAr7aMm/jevb YeYWDieR30IozkwePwHF7a0NXBBzY17TIxY7cR9Yy4dJ/83spX2x3yhq3sfvyX1nfgnU wzd2tljE15fEuJ3DGUN8NWZV1z0gRcah/kWi4kEOVh3HCMq2FyCZ6FbCGIJmgae4+0qP Bp89Pr9OjGtmCZl57Tnekmo4ZpTu9orJMz6OQAzqFP7YUX379GHTi9nTo9TD8N/S/4TY oaUA== X-Gm-Message-State: AO0yUKUmu1Z3TyYStsAa37JbM3my7IId59UVw3PLro+GWk+Rvsh/w4Lw Ly2xaatcwSmUY8W7r5M8Lqhqrg== X-Google-Smtp-Source: AK7set8Vrfpwm5KZwHFRRr9R1zxO0mONaZuyf9XhHh+OIdVb5ANOo5qd87I7/XTBfMvltZbzxiHDEg== X-Received: by 2002:a6b:1492:0:b0:716:b6e1:7d39 with SMTP id 140-20020a6b1492000000b00716b6e17d39mr6996892iou.5.1675112638443; Mon, 30 Jan 2023 13:03:58 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id a30-20020a02735e000000b003aef8fded9asm1992046jae.127.2023.01.30.13.03.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:03:56 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 7/8] net: ipa: support a third pulse register Date: Mon, 30 Jan 2023 15:01:57 -0600 Message-Id: <20230130210158.4126129-8-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130210158.4126129-1-elder@linaro.org> References: <20230130210158.4126129-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The AP has third pulse generator available starting with IPA v5.0. Redefine ipa_qtime_val() to support that possibility. Pass the IPA pointer as an argument so the version can be determined. And stop using the sign of the returned tick count to indicate which of two pulse generators to use. Instead, have the caller provide the address of a variable that will hold the selected pulse generator for the Qtime value. And for version 5.0, check whether the third pulse generator best represents the time period. Add code in ipa_qtime_config() to configure the fourth pulse generator for IPA v5.0+; in that case configure both the third and fourth pulse generators to use 10 msec granularity. Consistently use "ticks" for local variables that represent a tick count. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 91 +++++++++++++++++----------------- drivers/net/ipa/ipa_main.c | 7 ++- 2 files changed, 52 insertions(+), 46 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index c029209191d41..798dfa4484d5a 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -922,64 +922,72 @@ static void ipa_endpoint_init_mode(struct ipa_endpoint *endpoint) iowrite32(val, ipa->reg_virt + offset); } -/* For IPA v4.5+, times are expressed using Qtime. The AP uses one of two - * pulse generators (0 and 1) to measure elapsed time. In ipa_qtime_config() - * they're configured to have granularity 100 usec and 1 msec, respectively. - * - * The return value is the positive or negative Qtime value to use to - * express the (microsecond) time provided. A positive return value - * means pulse generator 0 can be used; otherwise use pulse generator 1. +/* For IPA v4.5+, times are expressed using Qtime. A time is represented + * at one of several available granularities, which are configured in + * ipa_qtime_config(). Three (or, starting with IPA v5.0, four) pulse + * generators are set up with different "tick" periods. A Qtime value + * encodes a tick count along with an indication of a pulse generator + * (which has a fixed tick period). Two pulse generators are always + * available to the AP; a third is available starting with IPA v5.0. + * This function determines which pulse generator most accurately + * represents the time period provided, and returns the tick count to + * use to represent that time. */ -static int ipa_qtime_val(u32 microseconds, u32 max) +static u32 +ipa_qtime_val(struct ipa *ipa, u32 microseconds, u32 max, u32 *select) { - u32 val; + u32 which = 0; + u32 ticks; - /* Use 100 microsecond granularity if possible */ - val = DIV_ROUND_CLOSEST(microseconds, 100); - if (val <= max) - return (int)val; + /* Pulse generator 0 has 100 microsecond granularity */ + ticks = DIV_ROUND_CLOSEST(microseconds, 100); + if (ticks <= max) + goto out; - /* Have to use pulse generator 1 (millisecond granularity) */ - val = DIV_ROUND_CLOSEST(microseconds, 1000); - WARN_ON(val > max); + /* Pulse generator 1 has millisecond granularity */ + which = 1; + ticks = DIV_ROUND_CLOSEST(microseconds, 1000); + if (ticks <= max) + goto out; - return (int)-val; + if (ipa->version >= IPA_VERSION_5_0) { + /* Pulse generator 2 has 10 millisecond granularity */ + which = 2; + ticks = DIV_ROUND_CLOSEST(microseconds, 100); + } + WARN_ON(ticks > max); +out: + *select = which; + + return ticks; } /* Encode the aggregation timer limit (microseconds) based on IPA version */ static u32 aggr_time_limit_encode(struct ipa *ipa, const struct ipa_reg *reg, u32 microseconds) { + u32 ticks; u32 max; - u32 val; if (!microseconds) return 0; /* Nothing to compute if time limit is 0 */ max = ipa_reg_field_max(reg, TIME_LIMIT); if (ipa->version >= IPA_VERSION_4_5) { - u32 gran_sel; - int ret; + u32 select; - /* Compute the Qtime limit value to use */ - ret = ipa_qtime_val(microseconds, max); - if (ret < 0) { - val = -ret; - gran_sel = ipa_reg_encode(reg, AGGR_GRAN_SEL, 1); - } else { - val = ret; - gran_sel = 0; - } + ticks = ipa_qtime_val(ipa, microseconds, max, &select); - return gran_sel | ipa_reg_encode(reg, TIME_LIMIT, val); + return ipa_reg_encode(reg, AGGR_GRAN_SEL, select) | + ipa_reg_encode(reg, TIME_LIMIT, ticks); } /* We program aggregation granularity in ipa_hardware_config() */ - val = DIV_ROUND_CLOSEST(microseconds, IPA_AGGR_GRANULARITY); - WARN(val > max, "aggr_time_limit too large (%u > %u usec)\n", + ticks = DIV_ROUND_CLOSEST(microseconds, IPA_AGGR_GRANULARITY); + WARN(ticks > max, "aggr_time_limit too large (%u > %u usec)\n", microseconds, max * IPA_AGGR_GRANULARITY); - return ipa_reg_encode(reg, TIME_LIMIT, val); + return ipa_reg_encode(reg, TIME_LIMIT, ticks); } static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint) @@ -1050,20 +1058,13 @@ static u32 hol_block_timer_encode(struct ipa *ipa, const struct ipa_reg *reg, if (ipa->version >= IPA_VERSION_4_5) { u32 max = ipa_reg_field_max(reg, TIMER_LIMIT); - u32 gran_sel; - int ret; + u32 select; + u32 ticks; - /* Compute the Qtime limit value to use */ - ret = ipa_qtime_val(microseconds, max); - if (ret < 0) { - val = -ret; - gran_sel = ipa_reg_encode(reg, TIMER_GRAN_SEL, 1); - } else { - val = ret; - gran_sel = 0; - } + ticks = ipa_qtime_val(ipa, microseconds, max, &select); - return gran_sel | ipa_reg_encode(reg, TIMER_LIMIT, val); + return ipa_reg_encode(reg, TIMER_GRAN_SEL, 1) | + ipa_reg_encode(reg, TIMER_LIMIT, ticks); } /* Use 64 bit arithmetic to avoid overflow */ diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index f3466b913394c..60d7c558163f1 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -390,7 +390,12 @@ static void ipa_qtime_config(struct ipa *ipa) reg = ipa_reg(ipa, TIMERS_PULSE_GRAN_CFG); val = ipa_reg_encode(reg, PULSE_GRAN_0, IPA_GRAN_100_US); val |= ipa_reg_encode(reg, PULSE_GRAN_1, IPA_GRAN_1_MS); - val |= ipa_reg_encode(reg, PULSE_GRAN_2, IPA_GRAN_1_MS); + if (ipa->version >= IPA_VERSION_5_0) { + val |= ipa_reg_encode(reg, PULSE_GRAN_2, IPA_GRAN_10_MS); + val |= ipa_reg_encode(reg, PULSE_GRAN_3, IPA_GRAN_10_MS); + } else { + val |= ipa_reg_encode(reg, PULSE_GRAN_2, IPA_GRAN_1_MS); + } iowrite32(val, ipa->reg_virt + ipa_reg_offset(reg)); From patchwork Mon Jan 30 21:01:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 648964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64143C54EAA for ; Mon, 30 Jan 2023 21:05:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbjA3VFE (ORCPT ); Mon, 30 Jan 2023 16:05:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbjA3VFD (ORCPT ); Mon, 30 Jan 2023 16:05:03 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA37B47EDE for ; Mon, 30 Jan 2023 13:04:37 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id 65so2191700iou.3 for ; Mon, 30 Jan 2023 13:04:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hjEtYXJDp6iclp+CacIWVQrUALk4651QlhNhwW9psWc=; b=Y07MbFOYxOnlk9zeG1BJM4rCp26i7iCbS7OBlWQEB59AaW7LlF9gqKWobXisdIL/MV 2z0Q5JOa6hTyJg+QkolsD0W55C9JqLU9nWv+2fEKslgqMOXfmvtgVA+kXUN+GhGG2nYS MUamAqiBDqbcmxTtAdjraAICTaftm2lJuYL/lhyfeWlQuNb80ePuX+amS6b/iF/S+Ofq KH6MJoZV+8GcO6Xu1GEGa/vYvJ0qxLzmSutUdk7ln/OWKQJ01H82hw89WHDN6ikQyIMl ofmaCQVYWXFqs0hqbwK7Qs2x7kB//XUlDIdzwVNwaQE79nAZQHRk9nJbNRM2lACSGu1S zOtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hjEtYXJDp6iclp+CacIWVQrUALk4651QlhNhwW9psWc=; b=r0VN3yAS22uqAEJDCmvSDHRuReZ6TFC8HNKJCAVAscI81NExBKVLltDSFzya2WyVrN Wc5NOoAPBMZJXIjb4D1n1FuBi2Lu488YPpAJYkE+IL0EDbMAUsr7awYD/2SYZPZKhpvZ hHmX5dv7Jg6KTQSw0EaG3LXF2PQ6xsDZC14WBwLkcVqTxIb6HzM1Src4Rf/CIB5LjELS baKfS/wXfAuo4rCa7itKpreyTisq9xYx2eksd5uSPltBVGnwn/cLbp16LSAxJF9N1aDp yjHeY/+XfQDoLVCLx+fJs+RXAWOZ15u2liizJzeKc92WMKpiRPXdjjR4LmjIffl1MiGy ydbw== X-Gm-Message-State: AO0yUKVb10UTURqV7fKl9j7WZyb2KnLkOQ0KMcqBYwaNeekW/LgaaoQk mGVG8aiDq0GeqRtjT0eX0h7SuQ== X-Google-Smtp-Source: AK7set/4Zx2FyQuLsaWj/dxoL1fKfr2CII0LxRm/eqsY5DJPZKWVfrnBRrPd9S+HvrF30wvxH2DPXw== X-Received: by 2002:a6b:fb16:0:b0:71a:1b72:5afc with SMTP id h22-20020a6bfb16000000b0071a1b725afcmr4556466iog.19.1675112673912; Mon, 30 Jan 2023 13:04:33 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id a30-20020a02735e000000b003aef8fded9asm1992046jae.127.2023.01.30.13.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:04:07 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 8/8] net: ipa: define two new memory regions Date: Mon, 30 Jan 2023 15:01:58 -0600 Message-Id: <20230130210158.4126129-9-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130210158.4126129-1-elder@linaro.org> References: <20230130210158.4126129-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org IPA v5.0 uses two memory regions not previously used. Define them and treat them as valid only for IPA v5.0. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_mem.c | 8 +++++++- drivers/net/ipa/ipa_mem.h | 8 +++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c index 9ec5af323f731..a07776e20cb0d 100644 --- a/drivers/net/ipa/ipa_mem.c +++ b/drivers/net/ipa/ipa_mem.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2022 Linaro Ltd. + * Copyright (C) 2019-2023 Linaro Ltd. */ #include @@ -163,6 +163,12 @@ static bool ipa_mem_id_valid(struct ipa *ipa, enum ipa_mem_id mem_id) return false; break; + case IPA_MEM_AP_V4_FILTER: + case IPA_MEM_AP_V6_FILTER: + if (version != IPA_VERSION_5_0) + return false; + break; + case IPA_MEM_NAT_TABLE: case IPA_MEM_STATS_FILTER_ROUTE: if (version < IPA_VERSION_4_5) diff --git a/drivers/net/ipa/ipa_mem.h b/drivers/net/ipa/ipa_mem.h index 570bfdd99bffb..868e9c20e8c41 100644 --- a/drivers/net/ipa/ipa_mem.h +++ b/drivers/net/ipa/ipa_mem.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2021 Linaro Ltd. + * Copyright (C) 2019-2023 Linaro Ltd. */ #ifndef _IPA_MEM_H_ #define _IPA_MEM_H_ @@ -62,13 +62,15 @@ enum ipa_mem_id { IPA_MEM_PDN_CONFIG, /* 0/2 canaries (IPA v4.0+) */ IPA_MEM_STATS_QUOTA_MODEM, /* 2/4 canaries (IPA v4.0+) */ IPA_MEM_STATS_QUOTA_AP, /* 0 canaries, optional (IPA v4.0+) */ - IPA_MEM_STATS_TETHERING, /* 0 canaries (IPA v4.0+) */ + IPA_MEM_STATS_TETHERING, /* 0 canaries, optional (IPA v4.0+) */ IPA_MEM_STATS_DROP, /* 0 canaries, optional (IPA v4.0+) */ - /* The next 5 filter and route statistics regions are optional */ + /* The next 7 filter and route statistics regions are optional */ IPA_MEM_STATS_V4_FILTER, /* 0 canaries (IPA v4.0-v4.2) */ IPA_MEM_STATS_V6_FILTER, /* 0 canaries (IPA v4.0-v4.2) */ IPA_MEM_STATS_V4_ROUTE, /* 0 canaries (IPA v4.0-v4.2) */ IPA_MEM_STATS_V6_ROUTE, /* 0 canaries (IPA v4.0-v4.2) */ + IPA_MEM_AP_V4_FILTER, /* 2 canaries (IPA v5.0) */ + IPA_MEM_AP_V6_FILTER, /* 0 canaries (IPA v5.0) */ IPA_MEM_STATS_FILTER_ROUTE, /* 0 canaries (IPA v4.5+) */ IPA_MEM_NAT_TABLE, /* 4 canaries, optional (IPA v4.5+) */ IPA_MEM_END_MARKER, /* 1 canary (not a real region) */