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: 50485 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2395845wrn; Mon, 30 Jan 2023 13:04:50 -0800 (PST) X-Google-Smtp-Source: AK7set/+akH3D5w6hCjHdW1SpSp+Xmg2DjvgGwwEdRZwOw2b+OwUbRoxhFdipuCxmxqfgzpO69Mb X-Received: by 2002:a17:903:32d2:b0:196:3ecd:c39a with SMTP id i18-20020a17090332d200b001963ecdc39amr20906995plr.43.1675112690444; Mon, 30 Jan 2023 13:04:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112690; cv=none; d=google.com; s=arc-20160816; b=xZsg4oOG7/y/LrkJQ1u7wU624BHq6BBk6fRAfKKOLpkgfNOoVAInB5ouWFeyzUu64Y lVoKcgEWbfbrSpgiUscMCQXjoutTsimcZC5/1H6DcXJAJxRfkHiz++lIChFLJb0LmRzl Os4jNJKV4ay2VVmOQ5lN3CiQl9ehnlY1PNmuotZUz20Mc9D+mz1ZG0qaUMypIGY7m+Zx 37HztbZHW0Wh2J9wtr/EUENRqNTXMbNB/CDPqh0RpEJjO38d5aMZVrobIDrqGOhpeNrG PkF5Q9dTpjUQ5wLHHaPiog4xcB8zP9NpGD9c9D3MyeMHlZyysZqDsnTOD+NQmS+BPk6h TQ8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hMq3JNiaNSjQXwZ1boO/j34bxxGpJn4ZMoNDU6z/FXU=; b=oETFZkJtt8SVDyrnW7BWnXRKugw5YmUe5c4gkl0LQW+GZEpCN8pC+lhO9f7HqCuCbH VPirWw3KKLyfAGDorH5RbVQo/F0xO/zmA6dTQmG1vhs/41PygpgFCyH4muWFQZBR2dqz ck6RGQzikQi/8YYHnVGccvYn0t40O5cirQtFnpzvXAzmkXpQOXYfuQF7eqiBxbXlC0PK 7dtYkIKRtigN7E24nIf9Hx0+9WBGkkZFU+BefwqcRbT4qoVpVYayKUUNlFkg9hfL2Vxy i8L/Q1y7nPRHgiGhLTM4QZ6sVLsNgSErlDGaD5f/rzl9qVsVX2n8q3Dg25JE9EViJu1R 9Hcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VZt9ikiN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170903124600b001926b94d6b8si15835285plh.356.2023.01.30.13.04.38; Mon, 30 Jan 2023 13:04:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VZt9ikiN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229596AbjA3VDE (ORCPT + 99 others); Mon, 30 Jan 2023 16:03:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229851AbjA3VDB (ORCPT ); Mon, 30 Jan 2023 16:03:01 -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 5772693D3 for ; Mon, 30 Jan 2023 13:02:59 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id u7so4173687ilg.4 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=75iwDgruu87W7KvVA6IRCau28HtthoFt1cPoXaTwMWe5rwoyylKKmehiskRV8/Xli4 OtpbKIgzt15rz6I8XgNiiPuifAPIeWZyfjMxN1FE/YsLC+CYr3DIgFyPSRXhBjsCJk2D igRkZwG2XCl1sSFQpKscMdLeBwkFCvd6MoStifhRsl+zUNr0fQeVXBpBHm+FQaHlUq24 xfrf9b2KFN/5dUKsIcCVDcKrwCWFCEoC4KWIBmxNNtvkKjoP4NPYsFHvUMoL8Wx3Hjei 6JqMxy7Lq0YW/6S7maK3luz41rYYY6BtIJBEr4lMWQfA5DrCY4A41u29A385GrH2WNWW hE1w== X-Gm-Message-State: AO0yUKWIdXJK+4MTAJmQZaL3+/VNdQahQtxIznctht4w6QbMYQwRYBfx CKKWfCv3De5oqrBDqwVLNhyCRg== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756482964510342798?= X-GMAIL-MSGID: =?utf-8?q?1756482964510342798?= 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: 50487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2396182wrn; Mon, 30 Jan 2023 13:05:39 -0800 (PST) X-Google-Smtp-Source: AK7set+wSvUYid+uFVv+UNRQPO134L9Mv7dIHmbwBRQmt4RX3RWSRPCb4IXo5Zz60Ko3WjW8R2hG X-Received: by 2002:a17:903:2447:b0:196:7d67:e193 with SMTP id l7-20020a170903244700b001967d67e193mr7948249pls.47.1675112739584; Mon, 30 Jan 2023 13:05:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112739; cv=none; d=google.com; s=arc-20160816; b=wFO/fQ5t+D1F0nI/axorWJeV1IH+MATrW/D2Nn1o2FsEi+EZGfoBkwSvhstMxxexHE M/BtIcy6qw7XsfKsj39nLuEjl1SaGfhE0K1xVshCR7lN3YFN1oEo6H5gnUecn1lio6lO KgQlv80/I0vUDxe+loujJKEVHTKKu+5Di+Y+GwNUaj2yDxRg1dOHmWZ/LhBdIwb/afgC 3s8nm9OUhxxCcEdfHasvospkPNFylP9rovkFu52nzXlHYbTGV117eTsYW1qR8sjpQjEp yVXbQMiSJx5hLxqi1SLw8bDZ+lrskOt6eXbeYrKp7uxA7q8EeeyH+CmdUENBl1+P184x ZNlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kOMLzNh0yK/0qTgNUqpARcKHC/PDBTSkI4Jf9pY8gkc=; b=zE2UnJdWv3LNS05in4UpHyz3wOUXX09vs/0nW1F12+jbkr0rqzsjk0WO+n4NA76fvs Zhuy8jrifdVm5pUZ1qfhsl/fEViVbeMdXJFabzpSXmYB+dkO35UVtfUsQHUsnctXnBqh vkH8Z2DlPjXmlQ5tfgWDes50zqHx3HgtrnBcbbNiGVuwG5cDlxPXvlrcZnkzcipc4xU9 K1hQyAi8r3tgFc+4L01Voh1tQEWlZK4gEMmoKcY5RTt21oujWyIxCvv56djLa4qp3bkw T/6jjLtJtbw3AqPofB1gX5M+q8FWadUcDn2muK5MFWB1b27h0acP+MHQV8me3k+zBZ5d jEMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Am8GWon3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q3-20020a170902dac300b001926d680150si15121348plx.329.2023.01.30.13.05.27; Mon, 30 Jan 2023 13:05:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Am8GWon3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbjA3VD3 (ORCPT + 99 others); Mon, 30 Jan 2023 16:03:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbjA3VD1 (ORCPT ); Mon, 30 Jan 2023 16:03:27 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 753FD14217 for ; Mon, 30 Jan 2023 13:03:20 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id u7so4174110ilg.4 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=Iy8MTo/9YN5QSbEbgXDHE/oYn5S1cJqkqhWEv/X3FJWkzKIO1CmJpxEV2LduZrLKDw oU+wazYJdkLkwivDDVnbqNs8So9LlC7Y4A+y79YAYD3yJ8LKyIswz98F0jVoDelu94mD 89YsARIycRQBuN8RAeVqdRtUY8na/Q99yoG1GyzogTM1ceDFKqsvTRu0AYLXbGymjVGP ode+OEDDgYzbO/Ls/33jrpBrbysJ4oRV6qbgA/UNHZ79JAUbzFyRvO/evtncJhMAJyXc nvZvDExDbE8Smkel5X7MDEaXDErg4+ptGKUJX97I93QdZAj4X9e+OOoJxUecEJrx6Npp zUfQ== X-Gm-Message-State: AO0yUKUZitdy3vQK3Y0N3p2U9MiC51vm+Jntj5Qthzld/mXU+98Pqav4 /GKch7bSijUZO6IQBbxDjGi88Q== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756483016090005840?= X-GMAIL-MSGID: =?utf-8?q?1756483016090005840?= 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: 50489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2396523wrn; Mon, 30 Jan 2023 13:06:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfNO5puqDbRt2L5ZdBGkrrmcG0hgDo1+b2O7a+mJTE8nehwI9ZUO2m15HdTJlQdgCtJzNl X-Received: by 2002:a62:1d12:0:b0:56c:232e:395e with SMTP id d18-20020a621d12000000b0056c232e395emr49315677pfd.15.1675112779146; Mon, 30 Jan 2023 13:06:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112779; cv=none; d=google.com; s=arc-20160816; b=J3YW0YQND9Cd3TibM3HbdNc6WtR1+Vx4fcJm17qnn/52McmrD6du4vMIdh6KHch0Vz NlzVx7K2RF8yux3+fWREvPlHhGBKhnvsebaovwK8Onn2zoO2JnEz0diDhZL7KXoTo83D dCsTC+dTSDG5uRH1g9y8Eiyb1oFF1SUQIjpdkQW4pdsk0AjwVXd/ZTxZ9f5xWqS1NqZr 5hxVk0FfaNO3qxXHhGvpCPmF8RYhGRCM8LcTKE832R2vxkSdvDLzvFVazYPccBaBd97k dXXqipYpQgzZiDWUQIqbn7rP1y+ybxEoQOwQJVRnywqPgklVikQFMq0FguQsd28TeZVo dKjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tOyLjlWftaazOIBf1HphYUtK4tgdVdjT0p+urwc0ffk=; b=Iz+hIFtExumwaq0B2vMCL7ejxP5YyAAdv5zYAlQmIU7xcph9NMS7/9LprsNnE5vmS8 kBWoo+B2uZsbJ0LuSVhTARpgcGquHH9ySEwWFh2oPQIIN9s8e5JJW2vSECDl83KdyM6A TMGdy9BixbP057X949tRPqf0ji26LG6+VxvSvTwrHKJeJBKW3NXGJjkn4wkdsWPAwCcD cq+LL9rEDIzY4Erz9wneY6Ped4rke7K3AJ0wzFKzmKDIaGKc0uoc14BvkTBu9BbyRA2R sjBxcvnuSztgyt2KQ8/ABU37etCV5H92SZyLALee6jbxwKELepV/P2czdIUaA+K6Ki77 G0kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BRiJl/Sx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w190-20020a6282c7000000b0056e4c95266bsi14349770pfd.77.2023.01.30.13.06.06; Mon, 30 Jan 2023 13:06:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BRiJl/Sx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230360AbjA3VEL (ORCPT + 99 others); Mon, 30 Jan 2023 16:04:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbjA3VDz (ORCPT ); Mon, 30 Jan 2023 16:03:55 -0500 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B52FCDDB for ; Mon, 30 Jan 2023 13:03:48 -0800 (PST) Received: by mail-il1-x132.google.com with SMTP id u8so5686271ilq.13 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=QWcvK3gypsRkFh4/+Cefs1UYDp/t2xgBfUg5TLipDxmuxdaLS5orRiqfTOMhYeRJDm laz0wx79nmWi+sInPXLuMeI2EQZq4SqQTrizSokpKZLp2EO8wMgDLucKCFQPserjtBVL AcstsIuW8kzcWNAYZs0XGfp3IX8SNClv+jtXgyyK0f1dCDP5oBR6YNe4gdEDNSzdbr5w YR2BBDi2x8yQ1Vy4opuSc1YoM2lfxPd95hS5nSvS7RfbFKTvpcAuY+1ga+SnQyrXDoYC rmwY07MOFtA3L7Jdnv3zS55d6PwG4ZJrmgaJCOIg2EAuHB4xe+VbOWN60GuCUIWPS+XO 01uA== X-Gm-Message-State: AO0yUKWZctOyAwsO6aAa9BC05MT4zMxSNfqJNfg8VTWMK+Ni5Z6AWM4d f8KOHvjQg6IMX7qjPRfp8DeXrw== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756483057162095681?= X-GMAIL-MSGID: =?utf-8?q?1756483057162095681?= 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: 50486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2396069wrn; Mon, 30 Jan 2023 13:05:22 -0800 (PST) X-Google-Smtp-Source: AK7set/zOK00+VGvqylAggwyxgJk/qRJPD798pw388Uxk8S4F5PoTkOEJCg7IM15tgmoPSH//zel X-Received: by 2002:a17:90b:1b4a:b0:22b:f93b:b5c0 with SMTP id nv10-20020a17090b1b4a00b0022bf93bb5c0mr25167312pjb.44.1675112722364; Mon, 30 Jan 2023 13:05:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112722; cv=none; d=google.com; s=arc-20160816; b=Ir3cVuMhyQ3NsrEbA+Lr4NPyQQmqMwulR+tPPD+NtBP3Ak273c/gWjVHt++MQ/0wHa VtdKH03m+D2C/8h/ahr3m5mdsW18Wuo1DpwXTaiOmDHus5StVbtILxfaD9UesXNjZygI bUEOXOXwpZTJ91OpVTSIZn2+YSg1DfS79MhX0oPeARwxnM33G5+DGGc10O/3y0udQhs8 Eikzl6A/KrugA/vCkvsDlzVEdx5CNDrni/BuBJ0Fgg8tNJgcUkQh7MZWAoWVKZDmnxL5 iaSntPZ5yuiUzDJMfoKcUvl1F5R317YsrQpuNwToY/WHz1I2AfL+mFHwmbP/43ftWolQ rrgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/wNCgzH7OXXpYksxcizbVKUE/CMJ5l2Lr3suZg8TUds=; b=qbkfrZU8IxBftQtVXl3ee1L68eAPjwOgiojxviJ9QZOBypCNhaP9106axJooIxia8q DW/2rSaTAHV3Bt9bPl0rbzMKA2Oa8IQ7+Autk9+vTzFgmMxzuei5Fi/U5+A+HzkrA4Qb bZ8EMCPY9UJHrhZg9plREiOkEul5uAWQKM+rSsp8aBl2wSZ6UnBzu0/8dcbtcOvKxdBs VVTjZvAXUdMf61s/tg7WFwaC0oO+ezJa8zKw7x+AuA561CaSW0oJWIHqGSPOMQFOlfQb t8PBK5USeLME5DR02LfiYCRWvi8BShChA0EVrM6zOR92CqE4Vq2z+MYxCGV+S00DQhxL qSFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wBLF6pnJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lj6-20020a17090b344600b00229290e462fsi13593392pjb.90.2023.01.30.13.05.10; Mon, 30 Jan 2023 13:05:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wBLF6pnJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbjA3VD4 (ORCPT + 99 others); Mon, 30 Jan 2023 16:03:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbjA3VDy (ORCPT ); Mon, 30 Jan 2023 16:03:54 -0500 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 017E4144B6 for ; Mon, 30 Jan 2023 13:03:50 -0800 (PST) Received: by mail-il1-x12b.google.com with SMTP id h18so2926912ilj.6 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=gHGMnuaxhrMMyfRmca6t1AtYKqNWR/7JLqPog6LCjIP+TPW09viB+wKQuEVKFMMj+3 EYD3+0y9eNPpmx+Bh//UNgd+nzZWlchi20XbA4WSt1ZVpWq/oMwTeLv2iGUQ1muj+svb 9JyeEoHKPemh9ofy8TG2Ms6Uh1e8CCuw8BBsWIE42xihh4GO/+I7F29YiBb405FCw75T yBlQwpQUw9GJq/DApnUsjJACFQIe3bgFSxjLDKTsQZ+kMZdNrdGeZEcJhl936tOAWyQ7 99O87eBpaoJZiKCqSXSCVWfnfbSPVabhPzzm4oOgNUUevvy/Ck2Q/cZCWuGvpnDXxO5v CRiQ== X-Gm-Message-State: AO0yUKX0+KDmaWSVpkuM7T9/7k9aIqbS8ojvshWD/pc7nXkhD+v6iBKn wRAt1Sumc2NJHf9RmcvB60foKg== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756482997638559677?= X-GMAIL-MSGID: =?utf-8?q?1756482997638559677?= 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: 50490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2396558wrn; Mon, 30 Jan 2023 13:06:23 -0800 (PST) X-Google-Smtp-Source: AK7set8rAvoMOM+TcOsULfxW50DJHmCIMBIc8sXxfhmNh/8/GtDM/HQyGk+BMH2oBMFgTbZnqD1P X-Received: by 2002:aa7:8482:0:b0:593:b0f7:8734 with SMTP id u2-20020aa78482000000b00593b0f78734mr6488120pfn.20.1675112782739; Mon, 30 Jan 2023 13:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112782; cv=none; d=google.com; s=arc-20160816; b=vpzHyOnnANgi5pQfnSNCJTWlFrX54scbAmRebMdxnke3tArATkgElLTIBqFpMjRprw mXmjxIVlCol2CwKh7poReoNxUCyAsriHchJDmLQ3wdJ3q/fMAqifG/rcOuCDo1GFQmwx OJi8YorS32WbuonlljNGFIc+56FhBgj8H6rhk8ZmYFjmAtqHIQjZMRHSjjOdwBAl4H1E N7qLBCaRGh65rsYSUQGyZ9/HczDzj21/3YXb9syLNJVad5WwWcaF0mEAWNczv5v9gk7i jjXc4gCkKCv7FDVoiy4JQYssi0XQuqK9To01h7pcil1apmzFlLN8RfrDuadSxbHe7kJG Pt1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6Q3ZO5XASIsXMpDUmQAaU+Lb+omH36X+YOT42bBfC3M=; b=U/BUfqHGAeTXgMYVXk4zZDJ1nE8se2rxj2zOY6kokPq/lBQE9UaezBkNUyyqzq8SY4 /lqZ5qiyhQpYSNYsI58PEx7aABhpXi4UbUb5lQzsKVU+TajZfXGxuKCmdzDqsWJWNzGO zqXMYsYK9LXQi+fqrf5mOweK8Sh9W1iNcVxkf//HCPGrj1FJrYcR6nmTErh+Jzw2gLql /nwuHbKYG2SKYNNIIZznuepKl01qtlXtQQr9ZuGv+lnd4chbJk+7xnfutO/EMc3rOZ6m V6RfDceeTOdxDCWs5Bgf6kkV7TX9DWr5wfFQ76IHUGgAPEs+vOTZ8Pzvax9kEyLXGD7W csVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M7Q2dK7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020aa79834000000b00593cc8f94c7si3514287pfl.328.2023.01.30.13.06.10; Mon, 30 Jan 2023 13:06:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M7Q2dK7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230346AbjA3VEN (ORCPT + 99 others); Mon, 30 Jan 2023 16:04:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230320AbjA3VD7 (ORCPT ); Mon, 30 Jan 2023 16:03:59 -0500 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 39E6E166F7 for ; Mon, 30 Jan 2023 13:03:52 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id q6so2264284ior.12 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=ShZYgtyE9NCbabEoWMVmZUltWsHdJnpZeqJFywKtNJ5PlZz5zAPuOgs6r2thIqZ3LN k1X3G/2wMx+kOtSoGNnx/P/lLOIZ7HdXDlUib5sqE4uVti08/jWNjHROiVlvcWXxxw1F VXYAOL+m55fgFBLmxbBRB6TDWZ3FtSSkFxPGQuHKzx5rNZ7XTdq+WA8f4JUD0vRFmyrJ 5KofFQJk//eAPRy+OVwAF/hYnthjxxmwq6ZQlXUnUzhdUmQKlX/lLJ975uht8gYIosnI d20aSNmmBQY5W+SiogDAvtER5I9uyVvxZ/dtM2q9Fn7jVR+hBiIV9xr90cNVeJVhtRRg T4yA== X-Gm-Message-State: AO0yUKUNbRdl9ASybYcy8b2LuO19j73O5ALIH56HvlAW9TURSd17QzZx jo8rxQ8E5+Au97jCsLyjpKBPJg== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756483061290282352?= X-GMAIL-MSGID: =?utf-8?q?1756483061290282352?= 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: 50488 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2396511wrn; Mon, 30 Jan 2023 13:06:17 -0800 (PST) X-Google-Smtp-Source: AK7set+jz6slxIDYZPDsE8skvi2eFXVWzN43qjtUUmfRMVEOe3wE1Hfm4uvxmx1d8TwAy6FoLf57 X-Received: by 2002:a17:90b:1bd1:b0:22c:9078:181 with SMTP id oa17-20020a17090b1bd100b0022c90780181mr7232886pjb.33.1675112777300; Mon, 30 Jan 2023 13:06:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112777; cv=none; d=google.com; s=arc-20160816; b=EGnM/LnymyH4rOrUbGq5XwjCHYcMC7p9jtwcrQlBWXPkdc5FzQiOVbkBupmT7XnuYV URCf9eCAmWWh2TYwc6HzKcYgwWmR+NU9xtx59Se40LMyip5W/HyZmFisMJg0PYqWNBq/ 3pr/TITQ/DfOc7PSM+8jOWYd+S0bHR9GyBfNtq1OVEH3xOawrVogCY68IqYt3g6QfG+B F1rkeR/HeYrU3LUsC/S1N2TBaUzUYqioNvmfIj6tGiyVlTC4QrK7x5LE7Ceu58Pwjuc2 wC/5qtqwIbEHSuLKv/bdGLGabOeJTs49TZEAk307kFnzRwJ8RX1EztsRLgLbkNEBtz/m QXog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dM0y1yQcXWiFMZI5D02Tn6gafxuwKDl7gTmaBAdj+n8=; b=tHasm6NQDZ61WNEPIMKZvzVWc2gFcyOsVkEiaCsRBclx97rJ535ApylHdTLqnlASes +/0Nq/GEFhLTpzNDtQv7W4kwQgRkiZQBWGy5sR3UhIsRrhXhmvKyPQl/3ZixhcyhcHzL n6EUAWDed0SdnvELuSBWtUcLJMoFQFd1DmNhAFhySZM72nQnrHY5GbVeEeyQp3qYLbVV ykF/MsB0iom8Zl84Z4U2nMva2qGRZROYa9crlevMhUIHUTuW5WJHAvXCrvFkt2I9vfbV N/Vx3N+N0jT7VmQpW19o6+6ZPeL5mUcBPx3vSQV5DcT88KmCrwd7s0Ihpn5S5Vj83BJ6 h9iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j5jAfAy0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y30-20020a63b51e000000b004da2c9dcc73si12451527pge.868.2023.01.30.13.06.04; Mon, 30 Jan 2023 13:06:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j5jAfAy0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbjA3VEB (ORCPT + 99 others); Mon, 30 Jan 2023 16:04:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbjA3VDz (ORCPT ); Mon, 30 Jan 2023 16:03:55 -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 92EF01E1CC for ; Mon, 30 Jan 2023 13:03:53 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id u7so4174757ilg.4 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=CrZitPdRCGrgpUfSPdt28795QVAFP2CG9Jw3K0lBKvN/uV2+R7pheASj4H5FeLBY/6 vL8AoAW7V2dvjGg3E297K1XvN4EfYITTUTUn99ZOOm+vuQBIMrFxeFl1ihgmMSCC/ImF wErdGo2/x2FEWflQVfV7pPC3BPl2NoWxtzs21j/VtgdErkgUtS9OiLapsgZ0VlovUEXi 9/oe6dU4rGTVjfaf+tyfUXVM8gZnoPGAlO9aBLwZXKAeIg0eqcFb7TmuEXCVEwKVqmeY 9tt8eHJg6WUPDMdAS2qtD/Ih2gp9QoIKHIzp6vYKpdWDLUn8U460Svgel1eeT43mm5Dv 8jNA== X-Gm-Message-State: AO0yUKXOTb0aC16izCEsFni6BQSrSSIBNFPaGk86QAU81kDz0LzPte+s 7fYkQWwly8flNAUu+cm8UVDV6g== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756483055729982159?= X-GMAIL-MSGID: =?utf-8?q?1756483055729982159?= 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: 50491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2396589wrn; Mon, 30 Jan 2023 13:06:28 -0800 (PST) X-Google-Smtp-Source: AK7set8KXMcn2CiT+uUAOqeEx5Hb8slyLO8SycH87ouzt8F8mcdaS02i0oIHIdBfAAzmXANehwrC X-Received: by 2002:a17:90b:17ca:b0:22c:4693:ca93 with SMTP id me10-20020a17090b17ca00b0022c4693ca93mr14870784pjb.20.1675112788002; Mon, 30 Jan 2023 13:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112787; cv=none; d=google.com; s=arc-20160816; b=ig6yDzCAtaTbG3CTunxHL7szPfZXLBTX4k2XZ35Fys1C6n66k0QgrxkfUerHGwiWVR xoJIrbd2t8lX2/t0SVWjpZUBvaOWX3/bMK5COSJM18o07DO9YrTuOWuTAjFVTgxvGo6v so3KggZKC4gH61upGmiGJpNPht03LXt26KCx4f17JHS4R6ADQihBsCv2DLAZ5KcPrhYB 7eiElhLoyCyj2mRURN2XZ//D/3JRXmhZir+Li6LLrorWAverEg3jIna5ny4XNC1FYlxU TDzPp2ec6p/alT8faQmqbdcEfUi+awZVkgin7dq4De/27YC4yZAUgoN017lyK6AFe5Lf cJzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4fo8/oJYkHVkmTqER82lUxzE/JMQrzARbb9xB0zqsC4=; b=d9CfqY+uw9DPlNnkqypyNpBuc54JDlRDUiwiiHsRqDUY84reBSb/+eyzZO3T/7rlpn HTSwTU32gkpvbcnhgTYbzNHybL2hyH1XRgTfJiqkd97n3V9/FoBBY0FTDWFBhOAovsqq JKmusPwjGr8zOyvD7pzWB6xYRBzeWcLWQGOLNGT8yOCZhm1HgcqZ8qF7WjDP8n2iS8QT W745NI38grjErOZOhV8wz3KDDGvF655Av9qeGQlg/3weEZm7d5XfKhsx0SBveDfWU5MK uB1b5+KGRIG5CtqgeNaqYwtHV3FZkpvDFQ/TT1KFs7Yv8O3R7pVViAfabZ/aOExfCUcV xsMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZbVl4Huw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a17090a461700b0020af2411705si13239240pjg.104.2023.01.30.13.06.15; Mon, 30 Jan 2023 13:06:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZbVl4Huw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230443AbjA3VEQ (ORCPT + 99 others); Mon, 30 Jan 2023 16:04:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbjA3VEL (ORCPT ); Mon, 30 Jan 2023 16:04:11 -0500 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C3011E1CC for ; Mon, 30 Jan 2023 13:03:59 -0800 (PST) Received: by mail-io1-xd29.google.com with SMTP id e204so4965351iof.1 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=y3WmJ9vQbReW8gh0fMX84RLnBoGBOKdMHUtweDRsH4OQBXbkESUlhfEZkR0zBZcCtz PW6o6/EE3xgxaxu9tB39yO8MYpKaRXLH96ggk5gHj6X6iHchHoP5U5y86ClIQ9n9sTbg gYdQYVTLPCcQDMR5B4f99LjgcghLTL+FpM1SO0xFO4x2fJV9+yIMVtEBXAkRRaovgAwl SfoH9gXQFZs+ogjeYDLe+Cxa+o7VrjkIIqow3bTp8NnFr2/ZGSme/o61fMMKd3zwkbLj NthPt6vL6toei9M7rek3lzHGoqdpe6ZM6zPPVIZ2GETc0zovtw5ay6V17braSWvGMcOq UtIA== X-Gm-Message-State: AO0yUKXrud4YyEYbm6MXA2mLE+bvm/Te4n5c0DiRRV2mxpyov7LoOkL/ 3W+2HirxSuXLLpwCyq2Zy6nXOg== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756483066768170169?= X-GMAIL-MSGID: =?utf-8?q?1756483066768170169?= 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: 50494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2397060wrn; Mon, 30 Jan 2023 13:07:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXvXfZ0NEQIfsiH4t6Ak/Gpjm8V3kw4yGdH1Akso0SK5wJ0I8qvwwoRBlg+VLsbuXtaSXYm0 X-Received: by 2002:a17:902:7889:b0:192:b5a8:3eb6 with SMTP id q9-20020a170902788900b00192b5a83eb6mr41827153pll.44.1675112857690; Mon, 30 Jan 2023 13:07:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112857; cv=none; d=google.com; s=arc-20160816; b=FgQmjRX7mX80Qu0/qRfZ3S9N2Rve1prhu9wfmL204k+++xqmI7kNpNIWKwZZWu9LnC 4xNngOsE/GZ/jBnyydiXj2kldHU8rljeR4eGrBKWkmtRyGsmZ5+GtMI1qa73BQFOfdTA CGkP7j2EtRiVZm6+T6uNigE98u4s4ryfB5t59vjI8rsIKAR/DV3nod+1JyZrss0gcpk6 5BNlfnh9DRcTESuwVuFEMEXrTKtDcxb4zfSxIqy7pJiy8m+vU9wvRsCBLRC+m9Mem1RW TucElJdfYdO/x8i4E7QjbdrAFvbOaEu6PWxTvqso+jEE8Ly4xUjLcj9Wm19DmcdQ2yP+ GQWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hjEtYXJDp6iclp+CacIWVQrUALk4651QlhNhwW9psWc=; b=A0Dz94GmRnq2ZfyoPdZToMgr5CJ9cLrw1U3D2W6inq8R33GwCPK+wnVuFKFGNqI8em 98xBviCdRfKwJC87pQvgEb2PTGgskEyB6su3r8AQfQxttL5ezWEBtFRwnfbIrmLFcDvo OSyMLqreZhjqTMoM4ck+bogfe6msYMlTSpPpXnr60O5qpoCdKg7J6cFtV4ayc3EhedTY cNsionY7iptN51gnhcmL7eMxjtj8SNLcTjSMDlFTVEpoNDro8UqcEyfgBpRYySG2k471 D1mC1veuNj2jBaO5OXn9gHRl0hfxgZ8MK/j18TcPySFOCXajKfMrHbzF5YXss4PvrgHx ej7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y07MbFOY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a17090282c500b001949d488c0asi13448323plz.508.2023.01.30.13.07.24; Mon, 30 Jan 2023 13:07:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y07MbFOY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230308AbjA3VFH (ORCPT + 99 others); Mon, 30 Jan 2023 16:05:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbjA3VFD (ORCPT ); Mon, 30 Jan 2023 16:05:03 -0500 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA734485BE for ; Mon, 30 Jan 2023 13:04:37 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id o1so1171854ioo.10 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=w0lNhvX6tliH1yFZvPu8nlKjZfKknx6JX2ZIxWlZ3Ykj0bArnwUcKuM9Kk3qjI9scD 1qk8+tGAE/aZIa/xHtvVXdl9eF3STp5c/u3o+LMbEpiY6f084IY5ZUlcwm6HS/fSC/2H 9b3UcI3EazyQV98IMx2azKFwfNQMuM6vYugCGIYM9KsJJfktb1j/ylu9ni/Uq93brYnQ 3YU6Wm4SvEkl2dnuWYKufpXoW2491wVMo3rLdB4JpUrRyanF4/Ft/Dx9MmevaM30PnUb SUdAbgZawA3+H2sVxW0TVI1r0jenhVRI6U2/pFvEAy0fsaoXWWoCPsMJFJLHT701H8uL BJ6w== X-Gm-Message-State: AO0yUKWp/fiuq9SN0Oy5nt0Nqg4qrBjTvw0ANu94tIm39IdPTfZTb+QD Gx/+PDNjA7TWaR0pE6wvka8F3g== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756483139842399500?= X-GMAIL-MSGID: =?utf-8?q?1756483139842399500?= 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) */