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);