From patchwork Fri Mar 26 15:11:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409512 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1518907jai; Fri, 26 Mar 2021 08:12:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBoo04VebLmuQ2WO3RIFfLP5Epy2qN79zXNPdXlRN/bs7ujjuYGgjjr2zW9ub7jwq+kr7b X-Received: by 2002:a05:6402:51d0:: with SMTP id r16mr15572374edd.48.1616771552097; Fri, 26 Mar 2021 08:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771552; cv=none; d=google.com; s=arc-20160816; b=dF/97gBX2WvwSKMAWsO3lMCxwJepugiRE9ipEKpv0G4isLheyDNxVSJsPlAFip5GA8 hHQmBBtrVaCVwXgtCM8BLyVA8xg9H4LtjSameXxAi7qM/FMssNfIAZQdhBPajFpYoArz MsPBYbB38/39zeg+7LgSCoFrWbldjYGj/r8akxhKdfBPCtmCyhvsNZfNdpzuZ92WxEaZ 3pcdk5fELgJsDkdVdUq3NlUjh0lJSgX6A8XqF5u1AbZjwZ+8RoR+TwQkoD1U+gMDMxUD NfBKN83sn4lRixedONriljvPApk1NremdypsWNUGaPfFpl7zuBTj2bGAR1/933WvQIUI TRhQ== 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=CI0IEbIt6ADsRK1kKMJEBC+VlvOpAHtt8wXdX5zUKRQ=; b=zDwd3NVE72GHjDTdMmswsNsXqjWobXJwFqjmpOwlXTM8oYlq81veqxkdeyyzGNcWQ0 B0++TCH66+IP5MY3g8z/ZazMIL3M12aJXznVNr2Ja4lfp8cIGDg+InRrIXH3MfiRZPZL 8t9Biq9jvCMXNgLwH15X6wLVsSPRT4DH9ikI13T09vuumzUkF1cEkEpyKwW0tANiaaKV xs3ofNH0XeN78c3455XSEwbVi3eWBQyKEyuGkdasW6mX34sEsOQ3jzeDCbhVn7G2gnCI AdA26Bl4gqnbh5w2Qj2nkBwiTgySkS2YRK0YYryLY/LJ65BGK7Ae7M0nlFYrhRF9c8ux UXkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e0J7xi78; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.31; Fri, 26 Mar 2021 08:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e0J7xi78; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230381AbhCZPMC (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbhCZPL2 (ORCPT ); Fri, 26 Mar 2021 11:11:28 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29361C0613AA for ; Fri, 26 Mar 2021 08:11:28 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id k25so5721559iob.6 for ; Fri, 26 Mar 2021 08:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CI0IEbIt6ADsRK1kKMJEBC+VlvOpAHtt8wXdX5zUKRQ=; b=e0J7xi787wtjkUZFZF7HeTkFylJT66bACTOOdgcHsY9zlcA59eTomwnpSXVC87TYPF FYs4YtFpTrdUu9Kpga6/SG+fe6CwqIfLVg/7l9yV/nYykhF2PorfJKugYojfokCmmynQ blrkDPgVeNWuKeMThD23KL7XGl8i/pksR16wTQWzKUGQlhyigM29DwJgfrzqlUYP/dIQ c2ikb29GXCrU/h1qRnnBKbnNoL9nAOzDC6fqATxgDHGAgNm4JRgdVAt92/xHLzjKmrWU 7SOhBeckkWD3zrWVgNdR/h1j7MMUyRbRxakuoQgr3lZ46o4lUGPJOGvizxHx4k8keMok l8eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CI0IEbIt6ADsRK1kKMJEBC+VlvOpAHtt8wXdX5zUKRQ=; b=LhzTOBeSHyrAXg0ku2nW7RORpvM1BBy0DsTuZSGfyulSVHeleO/Gj/eQobNEuBFxl2 iEjuyZ+5yU13ZGXAoYrx/OkHi2pb6fjjDTkphz1MkYBLJesyVE3ru01N7jysmErokRBM OLDSUC6XxZyoGRF4JuLwsPAQFoC7FIiUKq3PVl9x8H1tGSyBkOGcpQeewbvU0FClWcvT brZ5XswmstAy4ydZvRDgCjKTwG5WnwYqpgSg1cypRKFl8lc7dF3covd0G0stO0SYa2Ez GBd6NaKfcMS5W3ZfiffaQ0cgqu7qvZ56LKA22zwaZst+E7fCibEhaKuaVDpUW7vaqRzB kWRg== X-Gm-Message-State: AOAM533cGCGg3UTG2j67gMios7Po8awAxZCmQN56Ci8CgJOvp2UO5xKw FiAU91Q3rVszQ4RRSFHVK14ThA== X-Received: by 2002:a5d:9e18:: with SMTP id h24mr10696270ioh.80.1616771487495; Fri, 26 Mar 2021 08:11:27 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:27 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 01/12] net: ipa: introduce ipa_resource.c Date: Fri, 26 Mar 2021 10:11:11 -0500 Message-Id: <20210326151122.3121383-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Separate the IPA resource-related code into a new source file, "ipa_resource.c", and matching header file "ipa_resource.h". Signed-off-by: Alex Elder --- drivers/net/ipa/Makefile | 2 +- drivers/net/ipa/ipa_main.c | 148 +----------------------- drivers/net/ipa/ipa_reg.h | 42 ------- drivers/net/ipa/ipa_resource.c | 204 +++++++++++++++++++++++++++++++++ drivers/net/ipa/ipa_resource.h | 27 +++++ 5 files changed, 234 insertions(+), 189 deletions(-) create mode 100644 drivers/net/ipa/ipa_resource.c create mode 100644 drivers/net/ipa/ipa_resource.h -- 2.27.0 diff --git a/drivers/net/ipa/Makefile b/drivers/net/ipa/Makefile index afe5df1e6eeee..14a7d8429baa2 100644 --- a/drivers/net/ipa/Makefile +++ b/drivers/net/ipa/Makefile @@ -7,6 +7,6 @@ ipa-y := ipa_main.o ipa_clock.o ipa_reg.o ipa_mem.o \ ipa_table.o ipa_interrupt.o gsi.o gsi_trans.o \ ipa_gsi.o ipa_smp2p.o ipa_uc.o \ ipa_endpoint.o ipa_cmd.o ipa_modem.o \ - ipa_qmi.o ipa_qmi_msg.o + ipa_resource.o ipa_qmi.o ipa_qmi_msg.o ipa-y += ipa_data-sdm845.o ipa_data-sc7180.o diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index f071e90de5409..e18029152d780 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-2020 Linaro Ltd. + * Copyright (C) 2018-2021 Linaro Ltd. */ #include @@ -22,6 +22,7 @@ #include "ipa_clock.h" #include "ipa_data.h" #include "ipa_endpoint.h" +#include "ipa_resource.h" #include "ipa_cmd.h" #include "ipa_reg.h" #include "ipa_mem.h" @@ -452,151 +453,6 @@ static void ipa_hardware_deconfig(struct ipa *ipa) ipa_hardware_dcd_deconfig(ipa); } -#ifdef IPA_VALIDATION - -static bool ipa_resource_limits_valid(struct ipa *ipa, - const struct ipa_resource_data *data) -{ - u32 group_count; - u32 i; - u32 j; - - /* We program at most 6 source or destination resource group limits */ - BUILD_BUG_ON(IPA_RESOURCE_GROUP_SRC_MAX > 6); - - group_count = ipa_resource_group_src_count(ipa->version); - if (!group_count || group_count > IPA_RESOURCE_GROUP_SRC_MAX) - return false; - - /* Return an error if a non-zero resource limit is specified - * for a resource group not supported by hardware. - */ - for (i = 0; i < data->resource_src_count; i++) { - const struct ipa_resource_src *resource; - - resource = &data->resource_src[i]; - for (j = group_count; j < IPA_RESOURCE_GROUP_SRC_MAX; j++) - if (resource->limits[j].min || resource->limits[j].max) - return false; - } - - group_count = ipa_resource_group_dst_count(ipa->version); - if (!group_count || group_count > IPA_RESOURCE_GROUP_DST_MAX) - return false; - - for (i = 0; i < data->resource_dst_count; i++) { - const struct ipa_resource_dst *resource; - - resource = &data->resource_dst[i]; - for (j = group_count; j < IPA_RESOURCE_GROUP_DST_MAX; j++) - if (resource->limits[j].min || resource->limits[j].max) - return false; - } - - return true; -} - -#else /* !IPA_VALIDATION */ - -static bool ipa_resource_limits_valid(struct ipa *ipa, - const struct ipa_resource_data *data) -{ - return true; -} - -#endif /* !IPA_VALIDATION */ - -static void -ipa_resource_config_common(struct ipa *ipa, u32 offset, - const struct ipa_resource_limits *xlimits, - const struct ipa_resource_limits *ylimits) -{ - u32 val; - - val = u32_encode_bits(xlimits->min, X_MIN_LIM_FMASK); - val |= u32_encode_bits(xlimits->max, X_MAX_LIM_FMASK); - if (ylimits) { - val |= u32_encode_bits(ylimits->min, Y_MIN_LIM_FMASK); - val |= u32_encode_bits(ylimits->max, Y_MAX_LIM_FMASK); - } - - iowrite32(val, ipa->reg_virt + offset); -} - -static void ipa_resource_config_src(struct ipa *ipa, - const struct ipa_resource_src *resource) -{ - u32 group_count = ipa_resource_group_src_count(ipa->version); - const struct ipa_resource_limits *ylimits; - u32 offset; - - offset = IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type); - ylimits = group_count == 1 ? NULL : &resource->limits[1]; - ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); - - if (group_count < 2) - return; - - offset = IPA_REG_SRC_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type); - ylimits = group_count == 3 ? NULL : &resource->limits[3]; - ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits); - - if (group_count < 4) - return; - - offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type); - ylimits = group_count == 5 ? NULL : &resource->limits[5]; - ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); -} - -static void ipa_resource_config_dst(struct ipa *ipa, - const struct ipa_resource_dst *resource) -{ - u32 group_count = ipa_resource_group_dst_count(ipa->version); - const struct ipa_resource_limits *ylimits; - u32 offset; - - offset = IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type); - ylimits = group_count == 1 ? NULL : &resource->limits[1]; - ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); - - if (group_count < 2) - return; - - offset = IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type); - ylimits = group_count == 3 ? NULL : &resource->limits[3]; - ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits); - - if (group_count < 4) - return; - - offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type); - ylimits = group_count == 5 ? NULL : &resource->limits[5]; - ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); -} - -static int -ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data) -{ - u32 i; - - if (!ipa_resource_limits_valid(ipa, data)) - return -EINVAL; - - for (i = 0; i < data->resource_src_count; i++) - ipa_resource_config_src(ipa, &data->resource_src[i]); - - for (i = 0; i < data->resource_dst_count; i++) - ipa_resource_config_dst(ipa, &data->resource_dst[i]); - - return 0; -} - -static void ipa_resource_deconfig(struct ipa *ipa) -{ - /* Nothing to do */ -} - /** * ipa_config() - Configure IPA hardware * @ipa: IPA pointer diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index 8820e08d2535e..9c798cef7b2e2 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -346,48 +346,6 @@ enum ipa_pulse_gran { IPA_GRAN_655350_US = 0x7, }; -/* # IPA source resource groups available based on version */ -static inline u32 ipa_resource_group_src_count(enum ipa_version version) -{ - switch (version) { - case IPA_VERSION_3_5_1: - case IPA_VERSION_4_0: - case IPA_VERSION_4_1: - return 4; - - case IPA_VERSION_4_2: - return 1; - - case IPA_VERSION_4_5: - return 5; - - default: - return 0; - } -} - -/* # IPA destination resource groups available based on version */ -static inline u32 ipa_resource_group_dst_count(enum ipa_version version) -{ - switch (version) { - case IPA_VERSION_3_5_1: - return 3; - - case IPA_VERSION_4_0: - case IPA_VERSION_4_1: - return 4; - - case IPA_VERSION_4_2: - return 1; - - case IPA_VERSION_4_5: - return 5; - - default: - return 0; - } -} - /* Not all of the following are present (depends on IPA version) */ #define IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(rt) \ (0x00000400 + 0x0020 * (rt)) diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c new file mode 100644 index 0000000000000..2f0f2dca36785 --- /dev/null +++ b/drivers/net/ipa/ipa_resource.c @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. + * Copyright (C) 2018-2021 Linaro Ltd. + */ + +#include +#include + +#include "ipa.h" +#include "ipa_data.h" +#include "ipa_reg.h" +#include "ipa_resource.h" + +/** + * DOC: IPA Resources + * + * The IPA manages a set of resources internally for various purposes. + * A given IPA version has a fixed number of resource types, and a fixed + * total number of resources of each type. "Source" resource types + * are separate from "destination" resource types. + * + * Each version of IPA also has some number of resource groups. Each + * endpoint is assigned to a resource group, and all endpoints in the + * same group share pools of each type of resource. A subset of the + * total resources of each type is assigned for use by each group. + */ + +/* # IPA source resource groups available based on version */ +static u32 ipa_resource_group_src_count(enum ipa_version version) +{ + switch (version) { + case IPA_VERSION_3_5_1: + case IPA_VERSION_4_0: + case IPA_VERSION_4_1: + return 4; + + case IPA_VERSION_4_2: + return 1; + + case IPA_VERSION_4_5: + return 5; + + default: + return 0; + } +} + +/* # IPA destination resource groups available based on version */ +static u32 ipa_resource_group_dst_count(enum ipa_version version) +{ + switch (version) { + case IPA_VERSION_3_5_1: + return 3; + + case IPA_VERSION_4_0: + case IPA_VERSION_4_1: + return 4; + + case IPA_VERSION_4_2: + return 1; + + case IPA_VERSION_4_5: + return 5; + + default: + return 0; + } +} + +static bool ipa_resource_limits_valid(struct ipa *ipa, + const struct ipa_resource_data *data) +{ +#ifdef IPA_VALIDATION + u32 group_count; + u32 i; + u32 j; + + /* We program at most 6 source or destination resource group limits */ + BUILD_BUG_ON(IPA_RESOURCE_GROUP_SRC_MAX > 6); + + group_count = ipa_resource_group_src_count(ipa->version); + if (!group_count || group_count > IPA_RESOURCE_GROUP_SRC_MAX) + return false; + + /* Return an error if a non-zero resource limit is specified + * for a resource group not supported by hardware. + */ + for (i = 0; i < data->resource_src_count; i++) { + const struct ipa_resource_src *resource; + + resource = &data->resource_src[i]; + for (j = group_count; j < IPA_RESOURCE_GROUP_SRC_MAX; j++) + if (resource->limits[j].min || resource->limits[j].max) + return false; + } + + group_count = ipa_resource_group_dst_count(ipa->version); + if (!group_count || group_count > IPA_RESOURCE_GROUP_DST_MAX) + return false; + + for (i = 0; i < data->resource_dst_count; i++) { + const struct ipa_resource_dst *resource; + + resource = &data->resource_dst[i]; + for (j = group_count; j < IPA_RESOURCE_GROUP_DST_MAX; j++) + if (resource->limits[j].min || resource->limits[j].max) + return false; + } +#endif /* !IPA_VALIDATION */ + return true; +} + +static void +ipa_resource_config_common(struct ipa *ipa, u32 offset, + const struct ipa_resource_limits *xlimits, + const struct ipa_resource_limits *ylimits) +{ + u32 val; + + val = u32_encode_bits(xlimits->min, X_MIN_LIM_FMASK); + val |= u32_encode_bits(xlimits->max, X_MAX_LIM_FMASK); + if (ylimits) { + val |= u32_encode_bits(ylimits->min, Y_MIN_LIM_FMASK); + val |= u32_encode_bits(ylimits->max, Y_MAX_LIM_FMASK); + } + + iowrite32(val, ipa->reg_virt + offset); +} + +static void ipa_resource_config_src(struct ipa *ipa, + const struct ipa_resource_src *resource) +{ + u32 group_count = ipa_resource_group_src_count(ipa->version); + const struct ipa_resource_limits *ylimits; + u32 offset; + + offset = IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type); + ylimits = group_count == 1 ? NULL : &resource->limits[1]; + ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); + + if (group_count < 2) + return; + + offset = IPA_REG_SRC_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type); + ylimits = group_count == 3 ? NULL : &resource->limits[3]; + ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits); + + if (group_count < 4) + return; + + offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type); + ylimits = group_count == 5 ? NULL : &resource->limits[5]; + ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); +} + +static void ipa_resource_config_dst(struct ipa *ipa, + const struct ipa_resource_dst *resource) +{ + u32 group_count = ipa_resource_group_dst_count(ipa->version); + const struct ipa_resource_limits *ylimits; + u32 offset; + + offset = IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type); + ylimits = group_count == 1 ? NULL : &resource->limits[1]; + ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); + + if (group_count < 2) + return; + + offset = IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type); + ylimits = group_count == 3 ? NULL : &resource->limits[3]; + ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits); + + if (group_count < 4) + return; + + offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type); + ylimits = group_count == 5 ? NULL : &resource->limits[5]; + ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); +} + +/* Configure resources */ +int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data) +{ + u32 i; + + if (!ipa_resource_limits_valid(ipa, data)) + return -EINVAL; + + for (i = 0; i < data->resource_src_count; i++) + ipa_resource_config_src(ipa, &data->resource_src[i]); + + for (i = 0; i < data->resource_dst_count; i++) + ipa_resource_config_dst(ipa, &data->resource_dst[i]); + + return 0; +} + +/* Inverse of ipa_resource_config() */ +void ipa_resource_deconfig(struct ipa *ipa) +{ + /* Nothing to do */ +} diff --git a/drivers/net/ipa/ipa_resource.h b/drivers/net/ipa/ipa_resource.h new file mode 100644 index 0000000000000..9f74036fb95c5 --- /dev/null +++ b/drivers/net/ipa/ipa_resource.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. + * Copyright (C) 2019-2021 Linaro Ltd. + */ +#ifndef _IPA_RESOURCE_H_ +#define _IPA_RESOURCE_H_ + +struct ipa; +struct ipa_resource_data; + +/** + * ipa_resource_config() - Configure resources + * @ipa: IPA pointer + * @data: IPA resource configuration data + * + * Return: true if all regions are valid, false otherwise + */ +int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data); + +/** + * ipa_resource_deconfig() - Inverse of ipa_resource_config() + * @ipa: IPA pointer + */ +void ipa_resource_deconfig(struct ipa *ipa); + +#endif /* _IPA_RESOURCE_H_ */ From patchwork Fri Mar 26 15:11:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409515 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1518965jai; Fri, 26 Mar 2021 08:12:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTxY9XH0Fb2VhvMlGzbfshnPK3CWrl9UYSiB1wkJJtNXD1dLAN9ojkO+kPAMV2MoN1t4l4 X-Received: by 2002:a17:906:704a:: with SMTP id r10mr15893325ejj.312.1616771556099; Fri, 26 Mar 2021 08:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771556; cv=none; d=google.com; s=arc-20160816; b=h47dMzFgQdRf0aV2L+HYF0ORCSHOLi2LarVqYEqDFD/qYZvATYHnAhZ9EBu5DxGd8m 5vGsaOE1MJXXZHh1gvi0bQwTRiknSGFAw4UXxK1G5QNugZElAbn+hm3PytHmNTV7bnyf unnBeEuHi7sEalqMV1Hnw6p9L/i48LGg46tVnPrNpAc6lD0mcdKJJe66At+76YeHw+tY D+UEHf3lawQw45lE2GLPb1ayJv1MMH859geEH+lcUwFVoG+PXc/F+bQ5aou64C22ZcOH ++Lve6iWXWDvGON6MurLPhbhIEXRa7y3qUKHf8gb0z/PutFvXQVleQBXPHX8q2akKX3S 0uXw== 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=ON7mTEa9Z5iycj+8Dq01c6t5kdr65s/3oEf4V/BNG54=; b=phU7Nv6maV2O0srbFZR4l9uNyBLjOsIjk93YTmlsYBvGLL8thErl7AZ5f0o4IHN3iX pXYlnhZELU3aqLopXlqmS9FCcg4W0HXmZAseApC8QkZnws3TPR3skgOlLDTYY9ymiZwd iVnMOAKUghryePznGiITHfKS7Kr3qLJikH55iYeEj3Y8NoipN9E+Ha1y2fgzPMEDoUJF 3qQ5MZ4e7hjmgfC0iXKUy+c461BeBRQUXkUMxGyc/jeCblnpXt3fEl2loM2LCNXK07Ff gkEgafMp2KJESEAylV+jFBxahRPVScjJIXduq4h9m9x5hoNGumnyXDC7vyN4OCdoLSP7 ltdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uSytPxU0; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.35; Fri, 26 Mar 2021 08:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uSytPxU0; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbhCZPMK (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbhCZPL3 (ORCPT ); Fri, 26 Mar 2021 11:11:29 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2943BC0613B4 for ; Fri, 26 Mar 2021 08:11:29 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id e8so5719552iok.5 for ; Fri, 26 Mar 2021 08:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ON7mTEa9Z5iycj+8Dq01c6t5kdr65s/3oEf4V/BNG54=; b=uSytPxU0fioXBXMUp74Lq1wYb48z4DVbO8EaBufLVXSI3G3ZySDuz4Nd16MiOnPVff /87vuHuWCfn/wcX3RoqnBnunpudy1P3D46oHVsXzgqXglJRz1hj3t1S/gKj5Rirwq/r8 dodflE51CWocOj+jxPtxq/b5qW51EQZ9jIcOiMljQF37ymvUIY9MH4HctmV/8O1PaiXr aVuuVJk6nUYvT4nksgYiPkbhBwzB4z+gqGQ+Pq0O1+9vb0MzcPsAkaXOrDHXdS5nY884 czM3u2//HNtlB1KPqJCu3oNk2S2yfNAz6PaSZ41ulA7IjoAzlFC3i/IyxViyek92PHpX Pfgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ON7mTEa9Z5iycj+8Dq01c6t5kdr65s/3oEf4V/BNG54=; b=Zb2GdaJLjPUT6aACeHVci0A2Cd5F1p3m1u/raT3Prj4ZivqZEiTE4IgpGHRYEZdWxD +y3ZSD9fDipte0AHUkRh/GKz+ZN0Ae0a1SPSSAIma5iOSr8t+7K+gVAkidqOsolmMFjO bSnHTSWXe3zTXM+bLlv2bxV7rHlSvuf6FE8axKfsi1Jvetq/F104T3jTCPmvuJDWiVXS aZ6XzkoEe088Q5zb7mV0nfXLdHmmdkywUZ6mX2kok4MXBwAIpZJERvL6xNQHF+EBx2TT JUqclKrxSiXHPpCjQRRKceRN9Cf2PwL880/PNmhp4TM6kTPvRML09gXjkxhg03rwGLSi Tm0g== X-Gm-Message-State: AOAM532nx6e1ORnFUuB8T9NaGl2HO0/Jxgs46zFyqJkN+mJnx8OISUf6 mOi7BOfRfQuXWpcQ41I0SILOmA== X-Received: by 2002:a05:6638:35ab:: with SMTP id v43mr12347521jal.65.1616771488582; Fri, 26 Mar 2021 08:11:28 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:28 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 02/12] net: ipa: fix bug in resource group limit programming Date: Fri, 26 Mar 2021 10:11:12 -0500 Message-Id: <20210326151122.3121383-3-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If the number of resource groups supported by the hardware is less than a certain number, we return early in ipa_resource_config_src() and ipa_resource_config_dst() (to avoid programming resource limits for non-existent groups). Unfortunately, these checks are off by one. Fix this problem in the four places it occurs. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c index 2f0f2dca36785..edd9d1e5cbb62 100644 --- a/drivers/net/ipa/ipa_resource.c +++ b/drivers/net/ipa/ipa_resource.c @@ -139,14 +139,14 @@ static void ipa_resource_config_src(struct ipa *ipa, ylimits = group_count == 1 ? NULL : &resource->limits[1]; ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); - if (group_count < 2) + if (group_count < 3) return; offset = IPA_REG_SRC_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type); ylimits = group_count == 3 ? NULL : &resource->limits[3]; ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits); - if (group_count < 4) + if (group_count < 5) return; offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type); @@ -165,14 +165,14 @@ static void ipa_resource_config_dst(struct ipa *ipa, ylimits = group_count == 1 ? NULL : &resource->limits[1]; ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); - if (group_count < 2) + if (group_count < 3) return; offset = IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type); ylimits = group_count == 3 ? NULL : &resource->limits[3]; ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits); - if (group_count < 4) + if (group_count < 5) return; offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type); From patchwork Fri Mar 26 15:11:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409514 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1518943jai; Fri, 26 Mar 2021 08:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2L+nXbw5H7RZM7+mfmwaA5jJQm+5TcF8eZSU1l4U07IZhEOFGdG0pwYSZe/NHYpC/P0Im X-Received: by 2002:a05:6402:704:: with SMTP id w4mr16274924edx.175.1616771554761; Fri, 26 Mar 2021 08:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771554; cv=none; d=google.com; s=arc-20160816; b=vDuOJzdcT2Z/RCelEnP7vz9S7T2HFtBVgO7+UWgWVbj4FR++tCMAI3sD0AXfm9W4xs 2u+zA0ea0xFuOtW36OHaF7GPbDS8zjZcDlnmcJ2ssC62wueFqTkIAjbWdA5dN4v54U0p XEOjJoOnDrvhQOzJqet8L+5QB1xD2geaLDnSusXe0LcF3QD5hSdEn/aEYjidIpxYtdYz oGKFJjGiFtohQln3wZ1CJJYYSsO8eRw1MdcPUO0zuk5dnK2OswaYQKVCcM9Cf8xAXP22 Hgdc6hQe0Au7QP33jTvxDQ7HGoIpiHQveXIHjn6KP93pvbXy+3COuFovFIa0laZbrqrR ehIA== 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=o3Amz4sRXqrDeeMEBKQe2cGc+ePyC2Wm+fZmxeTt5jY=; b=lSO84XH7k4g8SywPH0WeoNEC+ceDnq2gCPJR4DTIBVLdUSpD3uYjE2YOBNZXX3M88r UL9VKtUemRNd9dKE8I+20IIHAKli3nTLpwvsazQoPH/1+SdqNwIOQTMGCFfejfjO0tTP fe7TKzkH/0V0xkhLg+N+aum7wWu/a3yuaZlIKpbWXR+LHkqM2XL11MD9JtKzuo04AQbL o8xNTyeI9tKyu3JBh8wNf8mzhe6mFMCo1YgZKfKt0/XUdi7ozsieCQ4HHtuXQ6QVMc+J FnuuvvgP9MmBikyn2KtAbkKC/PGlSSHihSUFB+yTd4nADMhqd7BEQdMrxSW1sUJ/VA1H /cMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kdfXL7dP; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.34; Fri, 26 Mar 2021 08:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kdfXL7dP; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230476AbhCZPMJ (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbhCZPLa (ORCPT ); Fri, 26 Mar 2021 11:11:30 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11784C0613AA for ; Fri, 26 Mar 2021 08:11:30 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id b10so5726140iot.4 for ; Fri, 26 Mar 2021 08:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o3Amz4sRXqrDeeMEBKQe2cGc+ePyC2Wm+fZmxeTt5jY=; b=kdfXL7dPCD+/9w8rraTmM/vobvbdbr33L08nwKp5QHre+h0stt4UQKj7mZndLNn6hI Ac31b4ILq+6qBnBmrWNDxtsHWL3QJmntwuZYVkRWsC3cRaLre8WhC+W9YTCSqrrjUdp+ btEaRf4gMro7ljk58/xyVtdgTKh4aVqay4DuWxmNDSeLQLv0ZvrMSftyWqLACr05roPX NYQdF8y79SyRy5cy1IDmxjiscFZSAKnB4kwLj9FsBNyNXKHzi7swODHE5E0USMdrIkWk 6f1py4TOjKE4yi8aj43wB9hyHTpWZz3Z3NEelZmbOSBANSvqIBjyXClUhbVnzvCvEpP7 Jlcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o3Amz4sRXqrDeeMEBKQe2cGc+ePyC2Wm+fZmxeTt5jY=; b=cF8Vz7GtDSkNr1GX2UFT6H3alHnc1QimWuXW4o/jHjRn5+mMgkRFwWO0Es1SelD5r9 1EDbI2qeUwcZfRDT8CFlc4QDvUC0q+IyrAEBaAx4yEvoK7pNa83RuYM5xqQdEZ5iHYOT NfPLf0vuh5MuNvUw0GqQx0/nnQ1+y0CV0zM1Va08zuKkN8TQq4inYoHPUgBZ22Lry3Zr /+Bb6PYUphsxSd/hNV63D9G4RohLqBwj89Imxs9CNTCgjSbEK6sWBYKdk3LR6RoVrwvA oqyH9X8jtwX/P+d1KntM4DjD7g5rlsFIgggcVS4vK6A8rvAfkUtIUTONYKc1rbkptCsp mrYA== X-Gm-Message-State: AOAM5311IeR3wiM9C4QKrMV2ItTU9gMKTZ1kPewg3VBtdquKf7ZZlMz1 4ZqOkO2AdGEgkChL+NSIydWdiA== X-Received: by 2002:a02:2412:: with SMTP id f18mr12534463jaa.142.1616771489534; Fri, 26 Mar 2021 08:11:29 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:29 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 03/12] net: ipa: identify resource groups Date: Fri, 26 Mar 2021 10:11:13 -0500 Message-Id: <20210326151122.3121383-4-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Define a new ipa_resource_group_id enumerated type, whose members have numeric values that match the resource group number used when programming the hardware. Each platform supports a different number of source and destination resource groups, so define the type separately for each platform in its configuration data file. Use these new symbolic values when specifying the resource group an endpoint is associated with. And use them to index the limits arrays for source and destination resources, making it clearer how these values are used. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-sc7180.c | 38 ++++++++++++--------- drivers/net/ipa/ipa_data-sdm845.c | 56 +++++++++++++++++++------------ 2 files changed, 57 insertions(+), 37 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index 621ad15c9e67d..e9b741832a1d7 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 -/* Copyright (C) 2019-2020 Linaro Ltd. */ +/* Copyright (C) 2019-2021 Linaro Ltd. */ #include @@ -9,6 +9,15 @@ #include "ipa_endpoint.h" #include "ipa_mem.h" +/* Resource groups used for the SC7180 SoC */ +enum ipa_rsrc_group_id { + /* Source resource group identifiers */ + IPA_RSRC_GROUP_SRC_UL_DL = 0, + + /* Destination resource group identifiers */ + IPA_RSRC_GROUP_DST_UL_DL_DPL = 0, +}; + /* QSB configuration for the SC7180 SoC. */ static const struct ipa_qsb_data ipa_qsb_data[] = { [IPA_QSB_MASTER_DDR] = { @@ -32,7 +41,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }, .endpoint = { .config = { - .resource_group = 0, + .resource_group = IPA_RSRC_GROUP_SRC_UL_DL, .dma_mode = true, .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX, .tx = { @@ -53,7 +62,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }, .endpoint = { .config = { - .resource_group = 0, + .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL, .aggregation = true, .status_enable = true, .rx = { @@ -75,7 +84,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .endpoint = { .filter_support = true, .config = { - .resource_group = 0, + .resource_group = IPA_RSRC_GROUP_SRC_UL_DL, .checksum = true, .qmap = true, .status_enable = true, @@ -100,7 +109,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }, .endpoint = { .config = { - .resource_group = 0, + .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL, .checksum = true, .qmap = true, .aggregation = true, @@ -139,58 +148,57 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }, }; -/* For the SC7180, resource groups are allocated this way: - * group 0: UL_DL - */ +/* Source resource configuration data for the SC7180 SoC */ static const struct ipa_resource_src ipa_resource_src[] = { { .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 3, .max = 63, }, }, { .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 3, .max = 3, }, }, { .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 10, .max = 10, }, }, { .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 1, .max = 1, }, }, { .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 5, .max = 5, }, }, }; +/* Destination resource configuration data for the SC7180 SoC */ static const struct ipa_resource_dst ipa_resource_dst[] = { { .type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { .min = 3, .max = 3, }, }, { .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { .min = 1, .max = 63, }, diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index 6b5173f474444..b6ea6295e7598 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2020 Linaro Ltd. + * Copyright (C) 2019-2021 Linaro Ltd. */ #include @@ -11,6 +11,20 @@ #include "ipa_endpoint.h" #include "ipa_mem.h" +/* Resource groups used for the SDM845 SoC */ +enum ipa_rsrc_group_id { + /* Source resource group identifiers */ + IPA_RSRC_GROUP_SRC_LWA_DL = 0, + IPA_RSRC_GROUP_SRC_UL_DL, + IPA_RSRC_GROUP_SRC_MHI_DMA, + IPA_RSRC_GROUP_SRC_UC_RX_Q, + + /* Destination resource group identifiers */ + IPA_RSRC_GROUP_DST_LWA_DL = 0, + IPA_RSRC_GROUP_DST_UL_DL_DPL, + IPA_RSRC_GROUP_DST_UNUSED_2, +}; + /* QSB configuration for the SDM845 SoC. */ static const struct ipa_qsb_data ipa_qsb_data[] = { [IPA_QSB_MASTER_DDR] = { @@ -37,7 +51,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }, .endpoint = { .config = { - .resource_group = 1, + .resource_group = IPA_RSRC_GROUP_SRC_UL_DL, .dma_mode = true, .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX, .tx = { @@ -58,7 +72,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }, .endpoint = { .config = { - .resource_group = 1, + .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL, .aggregation = true, .status_enable = true, .rx = { @@ -80,7 +94,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { .endpoint = { .filter_support = true, .config = { - .resource_group = 1, + .resource_group = IPA_RSRC_GROUP_SRC_UL_DL, .checksum = true, .qmap = true, .status_enable = true, @@ -104,7 +118,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }, .endpoint = { .config = { - .resource_group = 1, + .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL, .checksum = true, .qmap = true, .aggregation = true, @@ -152,72 +166,70 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }, }; -/* For the SDM845, resource groups are allocated this way: - * group 0: LWA_DL - * group 1: UL_DL - */ +/* Source resource configuration data for the SDM845 SoC */ static const struct ipa_resource_src ipa_resource_src[] = { { .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 1, .max = 255, }, - .limits[1] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 1, .max = 255, }, }, { .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 10, .max = 10, }, - .limits[1] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 10, .max = 10, }, }, { .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 12, .max = 12, }, - .limits[1] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 14, .max = 14, }, }, { .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 0, .max = 63, }, - .limits[1] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 0, .max = 63, }, }, { .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, - .limits[0] = { + .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 14, .max = 14, }, - .limits[1] = { + .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 20, .max = 20, }, }, }; +/* Destination resource configuration data for the SDM845 SoC */ static const struct ipa_resource_dst ipa_resource_dst[] = { { .type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_DST_LWA_DL] = { .min = 4, .max = 4, }, @@ -228,11 +240,11 @@ static const struct ipa_resource_dst ipa_resource_dst[] = { }, { .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS, - .limits[0] = { + .limits[IPA_RSRC_GROUP_DST_LWA_DL] = { .min = 2, .max = 63, }, - .limits[1] = { + .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { .min = 1, .max = 63, }, From patchwork Fri Mar 26 15:11:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409513 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1518930jai; Fri, 26 Mar 2021 08:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVT0sn7UTzRrfU/KBdCSFDcbDLhrrfJl/GpQN/78P0r93kRxdnN45oECgp5oDFnXZhimWt X-Received: by 2002:a05:6402:110b:: with SMTP id u11mr16239708edv.356.1616771554084; Fri, 26 Mar 2021 08:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771554; cv=none; d=google.com; s=arc-20160816; b=d6cZA+3mVe1fPwmxtFoq9lF/9t+iW3oQ0Txz7Uzh1l7Irsgh2RaFHaUrLtmh1OytN6 yrgFD7Ohc1+okXLPpxCK7Apy4QTU5U6qwcgKQqUiOz/0pOTHL2VHZIX7srGx/FwKgklS Ys0fW6xnuFHD6ok8SN7Iw1miqY0MPmtwfdYGCKW9bJt1dYQHEODU/uWPI3wKh9OnqfLe vAKSdX74I1Mgf4yIb3dPhUCqS6OpaP3PbLqtGsF2yE0vj7Tidc5sAgGHwlRB3tm0lnHr 1s44rXFQFTIh9PETIULI2o+Z60isHuGBkx4esMomUuv56bafVonCdf1O8I48aLOK5VsN VGfA== 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=gq3i0wnBHrNwz9Pi4M/j7GEgiiLGmWSM/j0zInRMGy0=; b=T5kvX5gPAUZcyJbZ8WbNc3diq7gzUWpUfeCzXJzq3j/HQ+kSivY8AzNMEha9ocgEXA qjxCIUVsnJU3heEfU+Gsr72gqaS7ShPu3PgJRDCeUxbCjW+EaKQtbF3YFoiXEPqi/NeG xGXUu568gBiy1qHBV+EmqZit2OasGLsIIQWyR02nWzzg4bs7NcRoTNsdLAy1UtfJ33pH EukVtRP8W7QMfFrgbSUnnFg9KMa3n3I6pMPy3RO+a+IN60t6VIWX7w/JujP2c0CyfRvo QNm37cf1kJtjxDXbgAILKSdI0YSt9axtSMOFKHz7Ecqa3ETEMUlAa3luwfe8fE8dQmcx BQ1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mfJGjMk3; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.33; Fri, 26 Mar 2021 08:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mfJGjMk3; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbhCZPMI (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230142AbhCZPLb (ORCPT ); Fri, 26 Mar 2021 11:11:31 -0400 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 F2867C0613B1 for ; Fri, 26 Mar 2021 08:11:30 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id y17so5295188ila.6 for ; Fri, 26 Mar 2021 08:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gq3i0wnBHrNwz9Pi4M/j7GEgiiLGmWSM/j0zInRMGy0=; b=mfJGjMk3qC8fryl2SB0+14KfpqSt36cPEfQ53Vszh/9NzcrX54yxes9Z5toBpl1axq LBRwoamhag4/lozkX/JaC5+Svdu5SIdbpwIIhWrss3ZJvvYZApLRN1IzOYPgjVZ4D4OZ kghUKYCRlbbReJ0LJxl7cOMDhbqhc9gTtVWM1IvAzpWxJ/YMtyfd+Ha041FrQGL2fKtG aiR9M1EmLjjnziCWvWUSedBoMwvJOjLOt520ngqhLfsOr1/y3DXIaAOCOp9XwFfeWUBt nzyEIKfuB04vAZYwjwblPMdIm1v0715NeSRPhgTmDt04skQWAXJQxOwQ5OlYWXsIOlNh D1nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gq3i0wnBHrNwz9Pi4M/j7GEgiiLGmWSM/j0zInRMGy0=; b=n94rq3Ri11Us1/QTAcmoLsGlk3h45lOpTez13X1Z90lnnHjKtOIetlIghyjdM3zGsW rB/43nd93JqE66M0fxVE0z5zUfYKNUE1oGpuruEp1VAfI/JRld8p6cRGLgmaXnFN3+fY jx1hpqcbV+dk0sWResg/AsE0k1Fznn5m9uiBKaIZGfFNLuCTQawsM8lrE6pHhaRli9ZR Oh9fNIFavNuYbPVKlCbrLgJRFQ8Msf17wnryri65fZLrJtULQe/f6mU0OHBIEOFpIk9y a+7Ji8O7yKRE4oyIu/GAAo+L64GzbI/nKzD5RmorDxvNiqJji+v5e3XA1OS3Js2p96Ac C98g== X-Gm-Message-State: AOAM533Xy+NN1LBjJHQZGsFnsG3SKOYOM+YyAWMASyp0R1vU9zW2aAJc XV8ybAXhQYSey8dVG+bYcNSEW5qCiGpKOyRE X-Received: by 2002:a92:dc83:: with SMTP id c3mr11445675iln.167.1616771490412; Fri, 26 Mar 2021 08:11:30 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:30 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 04/12] net: ipa: add some missing resource limits Date: Fri, 26 Mar 2021 10:11:14 -0500 Message-Id: <20210326151122.3121383-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently, the SDM845 configuration data defines resource limits for the first two resource groups (for both source and destination resource types). The hardware supports additional resource groups, and we should program the resource limits for those groups as well. Even the "unused" destination resource group (number 2) should have non-zero limits programmed in some cases, to ensure correct operation. Add these missing resource group limit definitions to the SDM845 configuration data. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-sdm845.c | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index b6ea6295e7598..3bc5fcfdf960c 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -178,6 +178,10 @@ static const struct ipa_resource_src ipa_resource_src[] = { .min = 1, .max = 255, }, + .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { + .min = 1, + .max = 63, + }, }, { .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, @@ -189,6 +193,10 @@ static const struct ipa_resource_src ipa_resource_src[] = { .min = 10, .max = 10, }, + .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { + .min = 8, + .max = 8, + }, }, { .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, @@ -200,6 +208,10 @@ static const struct ipa_resource_src ipa_resource_src[] = { .min = 14, .max = 14, }, + .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { + .min = 8, + .max = 8, + }, }, { .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS, @@ -211,6 +223,14 @@ static const struct ipa_resource_src ipa_resource_src[] = { .min = 0, .max = 63, }, + .limits[IPA_RSRC_GROUP_SRC_MHI_DMA] = { + .min = 0, + .max = 63, + }, + .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { + .min = 0, + .max = 63, + }, }, { .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, @@ -222,6 +242,10 @@ static const struct ipa_resource_src ipa_resource_src[] = { .min = 20, .max = 20, }, + .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { + .min = 14, + .max = 14, + }, }, }; @@ -237,6 +261,10 @@ static const struct ipa_resource_dst ipa_resource_dst[] = { .min = 4, .max = 4, }, + .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = { + .min = 3, + .max = 3, + } }, { .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS, @@ -248,6 +276,10 @@ static const struct ipa_resource_dst ipa_resource_dst[] = { .min = 1, .max = 63, }, + .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = { + .min = 1, + .max = 2, + } }, }; From patchwork Fri Mar 26 15:11:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409516 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1518970jai; Fri, 26 Mar 2021 08:12:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGsHrojs5v6a57QtjY+lic0402iA+ezDcURIljtTLo+OPgn9iUU5qsc3Ueq6rK7oJXlumV X-Received: by 2002:a17:907:5090:: with SMTP id fv16mr1123822ejc.90.1616771556497; Fri, 26 Mar 2021 08:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771556; cv=none; d=google.com; s=arc-20160816; b=KYp7QchNREIcvV/BIeAV4ELhbuO/yYfjntSlNnl+d1K/QT303lzgvDPgUN1vBKInfF hppzwRn/1Pkl4TnTFXZ37uteCvYHIJ6CszUBW+cLMb1QfgQbPdi0suZP9z16Jj5MPntk pk5QoxsDI8nJ5IVQ4d/8GBPH+uu4ZrGXaXExzDEdAlYApJJyp1BmxgM/ACrc7AhTJQnp A8up2t+AHc4O4li3K/FcmgqZXMdMeIsixYDLDakM8OstynBv2mmdiVE/rnuZN7M8E0Am azF4kFFFjHtVU04IHkWHh9YVPERFehyrkyxdb0/QNPBTbu62dJ0DfhZbkZikVB01dDDI q3kA== 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=sC24X9eVETwq1UezdzZlfsOF0sx5rw5KK7vWBUXE6Qw=; b=sZepkbxPv0BUjNavrxGVsi1amErBcNVePpp1WQzP6RbnfnIQDpq9Ghp6UWfYHS236U YVPnuO10vpCptIQIp8NQ0VcW6e+jjhoYIz44ojyPeNEU56XEq0c7WJxZyJhYx/3tbucH vbM6VXgl6FWQ//PyR2TvRoraUkrEWyn37OTh+Vnrc6Cwb1GvW1UTlGwMo7j/TcfGMjvD HH1bW4xP3q4Zz8EB6+xnw67FFN9VoPANwWqWThRzKzerQSHvRwINQptcL/gx6SJ/I6M8 Rh+e21MjDy5gYyWzTSw7TQp6Tl5P7Ouxy5AVy3JeS8Xy7SiPbkBr4J3fhBdf7Uw1ocxc LYnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a1DLZNjX; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.36; Fri, 26 Mar 2021 08:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a1DLZNjX; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230506AbhCZPML (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230240AbhCZPLc (ORCPT ); Fri, 26 Mar 2021 11:11:32 -0400 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 D2F5DC0613B1 for ; Fri, 26 Mar 2021 08:11:31 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id r8so5291763ilo.8 for ; Fri, 26 Mar 2021 08:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sC24X9eVETwq1UezdzZlfsOF0sx5rw5KK7vWBUXE6Qw=; b=a1DLZNjXzLglvrjS707eab2z4YMmQqszsW+Qkqf8QxRSpabUnPDUO2Upakkswdvc6G Z/mQMQ88Rm8n2456b4oIKhQ2JCQwj7EbptIgAFd8In594QEC50uXB1U5+6rz6DL/ANz/ wZ3tHc8itohB0cCBiDi9VoO5wfeG/zywquPdSAiUAw3DLAxzDA4y5d40flB8JIUdF26Z mMjn8/pYVr9dgbd4lPzrG9uiS69YLl+lfbzM4BNKex9mNgbhY8WTgKKx6fQ0/7Cej45+ dbfaDIm7zhu3DzYRRvWONF9an0qKcTRiRu8i7mnKAxe+43ZL0pU3MGkOoRVfiLCsyHFk vgRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sC24X9eVETwq1UezdzZlfsOF0sx5rw5KK7vWBUXE6Qw=; b=jWaIvOiquhy+799W0wgYmdlZViIPQvBW+s2sFy/1x1UuPL+n6gTaCMmv5MQPk1KD7x AU3nAAiKbQUZXuUDjMwAe46cDFAfXZh3hW94RHyScEfJyPeKjeGAbJa+gtjUu1ZZxM0b XqpxODJvO0Pq1dX/rH9Tim8/J+vPA5zkCB6segC/O6dcVq3U3mJanlmkJHU/39uXL38K y++/V0K5d0noNTTbP8YNk/N6J7cg1cYeeC0CEwCM/ieDe/TiDZMNzyTQQ8vtInbN4R8x JHc9H2iK8sYpk2OQKsDVOfamhB0/P2vJ/MtKiNaG50piuNCuqJh4kzvKeWpAmPtKiblX 7KkQ== X-Gm-Message-State: AOAM531IuGRpRycOqbiRmbhQeEup6cu7aW9Jq9tItDD4gtaPSog+IBLo oMmtgiIPLn5rTkfqh/06iVsrIg== X-Received: by 2002:a05:6e02:1564:: with SMTP id k4mr10575019ilu.65.1616771491284; Fri, 26 Mar 2021 08:11:31 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:30 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 05/12] net: ipa: combine resource type definitions Date: Fri, 26 Mar 2021 10:11:15 -0500 Message-Id: <20210326151122.3121383-6-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Combine the ipa_resource_type_src and ipa_resource_type_dst enumerated types into a single enumerated type, ipa_resource_type. Assign value 0 to the first element for the source and destination types, so their numeric values are preserved. Add some additional commentary where these are defined, stating explicitly that code assumes the first source and first destination member must have numeric value 0. Fix the kerneldoc comments for the ipa_gsi_endpoint_data structure. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data.h | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index 7816583fc14aa..ccd7fd0b801aa 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2020 Linaro Ltd. + * Copyright (C) 2019-2021 Linaro Ltd. */ #ifndef _IPA_DATA_H_ #define _IPA_DATA_H_ @@ -177,12 +177,12 @@ struct ipa_endpoint_data { /** * struct ipa_gsi_endpoint_data - GSI channel/IPA endpoint data - * ee: GSI execution environment ID - * channel_id: GSI channel ID - * endpoint_id: IPA endpoint ID - * toward_ipa: direction of data transfer - * gsi: GSI channel configuration data (see above) - * ipa: IPA endpoint configuration data (see above) + * @ee_id: GSI execution environment ID + * @channel_id: GSI channel ID + * @endpoint_id: IPA endpoint ID + * @toward_ipa: direction of data transfer + * @channel: GSI channel configuration data (see above) + * @endpoint: IPA endpoint configuration data (see above) */ struct ipa_gsi_endpoint_data { u8 ee_id; /* enum gsi_ee_id */ @@ -194,18 +194,17 @@ struct ipa_gsi_endpoint_data { struct ipa_endpoint_data endpoint; }; -/** enum ipa_resource_type_src - source resource types */ -enum ipa_resource_type_src { - IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS, +/** enum ipa_resource_type - IPA resource types */ +enum ipa_resource_type { + /* Source resource types; first must have value 0 */ + IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0, IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, IPA_RESOURCE_TYPE_SRC_HPS_DMARS, IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, -}; -/** enum ipa_resource_type_dst - destination resource types */ -enum ipa_resource_type_dst { - IPA_RESOURCE_TYPE_DST_DATA_SECTORS, + /* Destination resource types; first must have value 0 */ + IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0, IPA_RESOURCE_TYPE_DST_DPS_DMARS, }; @@ -225,7 +224,7 @@ struct ipa_resource_limits { * @limits: array of limits to use for each resource group */ struct ipa_resource_src { - enum ipa_resource_type_src type; + enum ipa_resource_type type; /* IPA_RESOURCE_TYPE_SRC_* */ struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_SRC_MAX]; }; @@ -235,7 +234,7 @@ struct ipa_resource_src { * @limits: array of limits to use for each resource group */ struct ipa_resource_dst { - enum ipa_resource_type_dst type; + enum ipa_resource_type type; /* IPA_RESOURCE_TYPE_DST_* */ struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_DST_MAX]; }; From patchwork Fri Mar 26 15:11:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409521 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1519048jai; Fri, 26 Mar 2021 08:12:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd/ecLDzJv0c0CO++X6xH/5c/JMcqMwFAnj5tHBxOSHkVjycH4aitUfUC+mVl6i9DQcOpj X-Received: by 2002:a17:907:94cc:: with SMTP id dn12mr15963016ejc.177.1616771561422; Fri, 26 Mar 2021 08:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771561; cv=none; d=google.com; s=arc-20160816; b=FhTbUrD0mQ0shgWzXuPhYDOQ90W/R1GJYiblW23K/ql8exM7LzauLpElutDl44Em4K l5VHzNek9b0UBwIs66gIgEWCgbKRN5qVbT9bJsYkj1D1MOlX0NaX1Fq+5qx8w6tw1RMx 8ZSwKYJTopoBiQUf+0mq1hRQ+Ra4ma/IEC9ikYxNDsnyHTAIH7m+eWdTCUATzeVcSHOs nvYGxFhV/KUq4ezNZSSKJDRMUTQY8sH+qjtkN7UGkeGKoE8AAMZOvEov2iJ+iEQR4EG+ 0jITV5lW4IxERHqKG0ZMUzdfPKt9R0hWqf+p6o/h4iD48RsMrAW8yuuyop3LCJEFwa9v nkPg== 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=ExZayPUZjQrCngYFQGmavK/VEKOrkf3H2hg2gfVHU8I=; b=utqWzd0K1RdkSO3/HpyEbizdNae/1cWRY7i8S1tV2BoIwSSRVsn17Mq5cUbMWKC0Rl oQd3GscU2AEKJ6SjM9iRzvnTOZx+OWWiS+l5wJnZRSlNGxnqK1sOKIhDDIuW2VG/KDeF wGZ876XitiJW0EYGC2aYRHHuZylEdIQGSOIj4jMWX3mCYMtUXjF/c8uWhxOgQecsvt5y wnxM7UmOlWgG/yulAX60YwtmtTi/UJyHi34HGPu2jTzPWH9kOiz5akvoVmbSE6zTDn8S +qNC/Es7+4DICI4kMOg/MO2OTVUKy9fHZxlMimtbh6aUxOrXuaC4+tuQLT0Ee+OF5b7t ID1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=thZ5Gbkw; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.41; Fri, 26 Mar 2021 08:12:41 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=thZ5Gbkw; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231134AbhCZPMM (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbhCZPLd (ORCPT ); Fri, 26 Mar 2021 11:11:33 -0400 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 BBF09C0613B2 for ; Fri, 26 Mar 2021 08:11:32 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id v26so5705294iox.11 for ; Fri, 26 Mar 2021 08:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ExZayPUZjQrCngYFQGmavK/VEKOrkf3H2hg2gfVHU8I=; b=thZ5Gbkwu/6nG4hxZ+T9fwrACubOo1AcaLFubMrJ62tZBOEGewgiZfSaeqbgA4l7Lo sIKIuqNPX/R4wXDRK7NN1TGuj+6JY5nDmtlkPwBZ1mFFA3zhIYPKAkKYR/nSVhpI3ao7 /J4cArRcDEEnczJs1jLy/RHpto9ZxwwGC7BsBKKIbDiqUTepiy8yS/M2eURRpjkCSXzS p2LVBsdjdBbaLAw4KERKYP17OXzMJH1LS+pQ+4EO0+1WuaW4eKp5dvJMgHbQIXXzfTIs 9TkSeRsRwzmWrbLQzXpY9FqJNhGfbXxWRZNoCXIuuv2N4vJOm+xCX90VobciAfA9HXDY aV/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ExZayPUZjQrCngYFQGmavK/VEKOrkf3H2hg2gfVHU8I=; b=hsddhaDV9jy+f9PLUzc8IcBEEVterfMLmWAIesP2GbXhxanfhP8A15JGc9kv/l/nbt wqolRyjDYVtGhtmFGTHmKs5qilcV1erhCxhROSr+2IilJ6I9NJrR2yWdKmXVroN8ATgk oqQnZaPqFs4wiA918g1gY5PaPRjakKwBHXvYg7EWwgBoAYZ0+l+bTN83QlcDIUQCAAz+ M9mbn30I/uD8opOvMSjOi1T0ezE0bxJ1iVuUYNGvQ+D9rkULXf3ct0ELpD5UfnMgOLjB xCmNaF3KDMN/cKiKk2RIkAsDmz2pTP2vwJMpGkanVtVSllQy39P+L+QBPoHt4/Vj7lPy yr3A== X-Gm-Message-State: AOAM532s/WHsDmxNUY8m/lCNO0iSpKptyn9NglzaiMKl8QJIVdZW2FQT p7f4I4ugIa/SX1PdoVuajyoezw== X-Received: by 2002:a02:c6ae:: with SMTP id o14mr12413055jan.33.1616771492191; Fri, 26 Mar 2021 08:11:32 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:31 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 06/12] net: ipa: index resource limits with type Date: Fri, 26 Mar 2021 10:11:16 -0500 Message-Id: <20210326151122.3121383-7-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Remove the type field from the ipa_resource_src and ipa_resource_dst structures, and instead use that value as the index into the arrays of source and destination resources. Change ipa_resource_config_src() and ipa_resource_config_dst() so the resource type is passed in as an argument. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-sc7180.c | 21 +++++++-------------- drivers/net/ipa/ipa_data-sdm845.c | 21 +++++++-------------- drivers/net/ipa/ipa_data.h | 4 ---- drivers/net/ipa/ipa_resource.c | 20 ++++++++++---------- 4 files changed, 24 insertions(+), 42 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index e9b741832a1d7..eba14d7bc8ac3 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -150,36 +150,31 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { /* Source resource configuration data for the SC7180 SoC */ static const struct ipa_resource_src ipa_resource_src[] = { - { - .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS, + [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 3, .max = 63, }, }, - { - .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, + [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 3, .max = 3, }, }, - { - .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, + [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 10, .max = 10, }, }, - { - .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS, + [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 1, .max = 1, }, }, - { - .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, + [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 5, .max = 5, @@ -189,15 +184,13 @@ static const struct ipa_resource_src ipa_resource_src[] = { /* Destination resource configuration data for the SC7180 SoC */ static const struct ipa_resource_dst ipa_resource_dst[] = { - { - .type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS, + [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = { .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { .min = 3, .max = 3, }, }, - { - .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS, + [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = { .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { .min = 1, .max = 63, diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index 3bc5fcfdf960c..4a4b3bd8a17c0 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -168,8 +168,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { /* Source resource configuration data for the SDM845 SoC */ static const struct ipa_resource_src ipa_resource_src[] = { - { - .type = IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS, + [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 1, .max = 255, @@ -183,8 +182,7 @@ static const struct ipa_resource_src ipa_resource_src[] = { .max = 63, }, }, - { - .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, + [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 10, .max = 10, @@ -198,8 +196,7 @@ static const struct ipa_resource_src ipa_resource_src[] = { .max = 8, }, }, - { - .type = IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, + [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 12, .max = 12, @@ -213,8 +210,7 @@ static const struct ipa_resource_src ipa_resource_src[] = { .max = 8, }, }, - { - .type = IPA_RESOURCE_TYPE_SRC_HPS_DMARS, + [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 0, .max = 63, @@ -232,8 +228,7 @@ static const struct ipa_resource_src ipa_resource_src[] = { .max = 63, }, }, - { - .type = IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, + [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 14, .max = 14, @@ -251,8 +246,7 @@ static const struct ipa_resource_src ipa_resource_src[] = { /* Destination resource configuration data for the SDM845 SoC */ static const struct ipa_resource_dst ipa_resource_dst[] = { - { - .type = IPA_RESOURCE_TYPE_DST_DATA_SECTORS, + [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = { .limits[IPA_RSRC_GROUP_DST_LWA_DL] = { .min = 4, .max = 4, @@ -266,8 +260,7 @@ static const struct ipa_resource_dst ipa_resource_dst[] = { .max = 3, } }, - { - .type = IPA_RESOURCE_TYPE_DST_DPS_DMARS, + [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = { .limits[IPA_RSRC_GROUP_DST_LWA_DL] = { .min = 2, .max = 63, diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index ccd7fd0b801aa..44b93f93ee608 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -220,21 +220,17 @@ struct ipa_resource_limits { /** * struct ipa_resource_src - source endpoint group resource usage - * @type: source group resource type * @limits: array of limits to use for each resource group */ struct ipa_resource_src { - enum ipa_resource_type type; /* IPA_RESOURCE_TYPE_SRC_* */ struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_SRC_MAX]; }; /** * struct ipa_resource_dst - destination endpoint group resource usage - * @type: destination group resource type * @limits: array of limits to use for each resource group */ struct ipa_resource_dst { - enum ipa_resource_type type; /* IPA_RESOURCE_TYPE_DST_* */ struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_DST_MAX]; }; diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c index edd9d1e5cbb62..506bcccaef64f 100644 --- a/drivers/net/ipa/ipa_resource.c +++ b/drivers/net/ipa/ipa_resource.c @@ -128,54 +128,54 @@ ipa_resource_config_common(struct ipa *ipa, u32 offset, iowrite32(val, ipa->reg_virt + offset); } -static void ipa_resource_config_src(struct ipa *ipa, +static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, const struct ipa_resource_src *resource) { u32 group_count = ipa_resource_group_src_count(ipa->version); const struct ipa_resource_limits *ylimits; u32 offset; - offset = IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type); + offset = IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 1 ? NULL : &resource->limits[1]; ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); if (group_count < 3) return; - offset = IPA_REG_SRC_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type); + offset = IPA_REG_SRC_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 3 ? NULL : &resource->limits[3]; ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits); if (group_count < 5) return; - offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type); + offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 5 ? NULL : &resource->limits[5]; ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); } -static void ipa_resource_config_dst(struct ipa *ipa, +static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, const struct ipa_resource_dst *resource) { u32 group_count = ipa_resource_group_dst_count(ipa->version); const struct ipa_resource_limits *ylimits; u32 offset; - offset = IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource->type); + offset = IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 1 ? NULL : &resource->limits[1]; ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); if (group_count < 3) return; - offset = IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource->type); + offset = IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 3 ? NULL : &resource->limits[3]; ipa_resource_config_common(ipa, offset, &resource->limits[2], ylimits); if (group_count < 5) return; - offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource->type); + offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 5 ? NULL : &resource->limits[5]; ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); } @@ -189,10 +189,10 @@ int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data) return -EINVAL; for (i = 0; i < data->resource_src_count; i++) - ipa_resource_config_src(ipa, &data->resource_src[i]); + ipa_resource_config_src(ipa, i, &data->resource_src[i]); for (i = 0; i < data->resource_dst_count; i++) - ipa_resource_config_dst(ipa, &data->resource_dst[i]); + ipa_resource_config_dst(ipa, i, &data->resource_dst[i]); return 0; } From patchwork Fri Mar 26 15:11:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409517 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1518975jai; Fri, 26 Mar 2021 08:12:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW+omd+mEol/GRrKJuwcWXUpWvBt98tCVBE3Dkh9fO8sp6KtPFn0rF1Xvm7hwgA604FdXF X-Received: by 2002:a17:906:874f:: with SMTP id hj15mr15550504ejb.404.1616771556918; Fri, 26 Mar 2021 08:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771556; cv=none; d=google.com; s=arc-20160816; b=IQGeFHvMz7WXC+Ua5No7KmGDmnarOfi8fb4auJo5vw7qL1KJJp4B7qxrrdVn1iqsQD H76xtHP2CpuZ9h/0Wez7POAlR7McBW1KBnzPzwFHSY6/RewvUwN8rb5bPR07BahoB9u2 YcElMnHfGO5qVqO2oYFSdVVIBLq+I28eDyBGcEckhBLUDUEs0I0sEvS0QLi63txpQaDn KK4Wg59layZogPw5GEcB8PbrjtLvl2NgKlSY7FjAUJHnlTemLn2B3bclclmJpo+Pc2Mj Vg+HtumUngJ1Bup46e4DHcsKPmY7pdrlPnO9Q/9p62L9N+DyDVe2cIocp7Iiy7VLBZuA tOxg== 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=d6nn2zLKWR0hFTH8zPwibjMvpmzqL8ByDIyW+9Wf32M=; b=iHBCC8+QYFazqi8XK12B339ClS0w3Ccd9k2+I+Z8UQ2nJMtuCm9/JtGpugA/rsSU6X k2WhsH9VVFCP/1t5jxgdwhv8oLmbPuHyr+JC/oKSybIZkpuJI8kcWDAeIUu6EvjiArKN XSqqMeYUfvOwWXxbmBy7tdVDfi9eAJZ81cj0c4o6dlJNnppmuntX4SWB67np/uCagGhB D4Lr8T/MyGp+O4NgXXsSriigsD4lm7KsL0ZhAYW3S4wGH11QW23NBhRB1zZgCd8KqYST is8NW2pUkQXAnk6f2ITVaUEpaNQ5ulYPT5iBrGSs8DPWUSq0eg8MiL3+EBgBhcRplHkj 9KsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lPePDFya; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.36; Fri, 26 Mar 2021 08:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lPePDFya; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231151AbhCZPMN (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbhCZPLe (ORCPT ); Fri, 26 Mar 2021 11:11:34 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A96C0C0613AA for ; Fri, 26 Mar 2021 08:11:33 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id x17so5737356iog.2 for ; Fri, 26 Mar 2021 08:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d6nn2zLKWR0hFTH8zPwibjMvpmzqL8ByDIyW+9Wf32M=; b=lPePDFyaeOfIjTrWvk5nsN2PgFGWiNt014D4uETe+MZ7iceHHEdB2X8FCtZzuw6akH Sgf6XvYB1vfJdqdi/ea4kaRBc41zkXyGmnp6s8siCMQJwgS7x1Iq8mZOI8dQC4I0IuwH D20Ra4cZR+4ooclsSBF+y+LG2NvYT/XwYwdLUE3Fva8yCaO1Y84iR1lmjgSCWtIMemna 3+JF76ZWOnJKu8p6DI3dVQcW6i4WCYxWK0N7dm09vsS+GANP2wjBAtRmbR9JRaySoPsA POWzDa9iRqn6SXA00iYcTFxB3dCXTQvd6utAfyyGO5uA9mCbwqVNrrdl4jQ1qE39w1YQ Qz/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d6nn2zLKWR0hFTH8zPwibjMvpmzqL8ByDIyW+9Wf32M=; b=t3xj5bsAvs3H+HwJKGOjxGTojHZnuS2HE/9YrEOA+zUZibpGWISqq5jj9y4JNfvURE LcaTrE3vsPq4csjPB0wD/43Uo1HdnQ/h/qUa2RwQm7T38Te0gR5UXTEzPyFsfuBBNK6u bCEBB3e0UzaoAb0Fk0rTYceoIehMWen83GIJbKf1l2aPS64HpFWLzZhddBKD8tbn0EJp hpAz9xGV6st5DxGaxoiwnP3siaDaD7JJ4DGYru1rJ3I6mVg8zzS10AUKaNwiJIf+U7Kb xL9qErelF5jxACy1jYaayCijx5TUMGsCeFpP+wNUoQm3DSwl1montisNqIahct69xHyr f3nA== X-Gm-Message-State: AOAM531RVdTbWhinX5o08II+IXZ1rY4hfIDq0HRLIiP7ieQCKlGj/QKa MUJAlH4qv5u4Nfzr51xb79JpAQ== X-Received: by 2002:a05:6638:1914:: with SMTP id p20mr12340457jal.92.1616771493155; Fri, 26 Mar 2021 08:11:33 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:32 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 07/12] net: ipa: move ipa_resource_type definition Date: Fri, 26 Mar 2021 10:11:17 -0500 Message-Id: <20210326151122.3121383-8-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Most platforms have the same set of source and destination resource types. But some older platforms have some additional ones, and it's possible different resources will be used in the future. Move the definition of the ipa_resource_type enumerated type so it is defined for each platform in its configuration data file. This permits each to have a distinct set of resources. Shorten the data files slightly, by putting the min and max limit values on the same line. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-sc7180.c | 35 ++++++++------ drivers/net/ipa/ipa_data-sdm845.c | 80 ++++++++++++++----------------- drivers/net/ipa/ipa_data.h | 14 ------ 3 files changed, 57 insertions(+), 72 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index eba14d7bc8ac3..24ff315175653 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -9,6 +9,20 @@ #include "ipa_endpoint.h" #include "ipa_mem.h" +/** enum ipa_resource_type - IPA resource types */ +enum ipa_resource_type { + /* Source resource types; first must have value 0 */ + IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0, + IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, + IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, + IPA_RESOURCE_TYPE_SRC_HPS_DMARS, + IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, + + /* Destination resource types; first must have value 0 */ + IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0, + IPA_RESOURCE_TYPE_DST_DPS_DMARS, +}; + /* Resource groups used for the SC7180 SoC */ enum ipa_rsrc_group_id { /* Source resource group identifiers */ @@ -152,32 +166,27 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { static const struct ipa_resource_src ipa_resource_src[] = { [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 3, - .max = 63, + .min = 3, .max = 63, }, }, [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 3, - .max = 3, + .min = 3, .max = 3, }, }, [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 10, - .max = 10, + .min = 10, .max = 10, }, }, [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 1, - .max = 1, + .min = 1, .max = 1, }, }, [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 5, - .max = 5, + .min = 5, .max = 5, }, }, }; @@ -186,14 +195,12 @@ static const struct ipa_resource_src ipa_resource_src[] = { static const struct ipa_resource_dst ipa_resource_dst[] = { [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = { .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { - .min = 3, - .max = 3, + .min = 3, .max = 3, }, }, [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = { .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { - .min = 1, - .max = 63, + .min = 1, .max = 63, }, }, }; diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index 4a4b3bd8a17c0..357e8ba43a364 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -11,6 +11,20 @@ #include "ipa_endpoint.h" #include "ipa_mem.h" +/** enum ipa_resource_type - IPA resource types */ +enum ipa_resource_type { + /* Source resource types; first must have value 0 */ + IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0, + IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, + IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, + IPA_RESOURCE_TYPE_SRC_HPS_DMARS, + IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, + + /* Destination resource types; first must have value 0 */ + IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0, + IPA_RESOURCE_TYPE_DST_DPS_DMARS, +}; + /* Resource groups used for the SDM845 SoC */ enum ipa_rsrc_group_id { /* Source resource group identifiers */ @@ -170,76 +184,60 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { static const struct ipa_resource_src ipa_resource_src[] = { [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { - .min = 1, - .max = 255, + .min = 1, .max = 255, }, .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 1, - .max = 255, + .min = 1, .max = 255, }, .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { - .min = 1, - .max = 63, + .min = 1, .max = 63, }, }, [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { - .min = 10, - .max = 10, + .min = 10, .max = 10, }, .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 10, - .max = 10, + .min = 10, .max = 10, }, .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { - .min = 8, - .max = 8, + .min = 8, .max = 8, }, }, [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { - .min = 12, - .max = 12, + .min = 12, .max = 12, }, .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 14, - .max = 14, + .min = 14, .max = 14, }, .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { - .min = 8, - .max = 8, + .min = 8, .max = 8, }, }, [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { - .min = 0, - .max = 63, + .min = 0, .max = 63, }, .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 0, - .max = 63, + .min = 0, .max = 63, }, .limits[IPA_RSRC_GROUP_SRC_MHI_DMA] = { - .min = 0, - .max = 63, + .min = 0, .max = 63, }, .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { - .min = 0, - .max = 63, + .min = 0, .max = 63, }, }, [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { - .min = 14, - .max = 14, + .min = 14, .max = 14, }, .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { - .min = 20, - .max = 20, + .min = 20, .max = 20, }, .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = { - .min = 14, - .max = 14, + .min = 14, .max = 14, }, }, }; @@ -248,30 +246,24 @@ static const struct ipa_resource_src ipa_resource_src[] = { static const struct ipa_resource_dst ipa_resource_dst[] = { [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = { .limits[IPA_RSRC_GROUP_DST_LWA_DL] = { - .min = 4, - .max = 4, + .min = 4, .max = 4, }, .limits[1] = { - .min = 4, - .max = 4, + .min = 4, .max = 4, }, .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = { - .min = 3, - .max = 3, + .min = 3, .max = 3, } }, [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = { .limits[IPA_RSRC_GROUP_DST_LWA_DL] = { - .min = 2, - .max = 63, + .min = 2, .max = 63, }, .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { - .min = 1, - .max = 63, + .min = 1, .max = 63, }, .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = { - .min = 1, - .max = 2, + .min = 1, .max = 2, } }, }; diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index 44b93f93ee608..e1096d8ba5751 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -194,20 +194,6 @@ struct ipa_gsi_endpoint_data { struct ipa_endpoint_data endpoint; }; -/** enum ipa_resource_type - IPA resource types */ -enum ipa_resource_type { - /* Source resource types; first must have value 0 */ - IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0, - IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS, - IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF, - IPA_RESOURCE_TYPE_SRC_HPS_DMARS, - IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES, - - /* Destination resource types; first must have value 0 */ - IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0, - IPA_RESOURCE_TYPE_DST_DPS_DMARS, -}; - /** * struct ipa_resource_limits - minimum and maximum resource counts * @min: minimum number of resources of a given type From patchwork Fri Mar 26 15:11:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409518 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1518993jai; Fri, 26 Mar 2021 08:12:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP6NYhftD2VzDcM3zVncgPznRJH0+rnqcLujI/pcmp/O/VZGM3GXdEa5xHCsvfUfI/1mc2 X-Received: by 2002:a17:906:4cd6:: with SMTP id q22mr15797717ejt.469.1616771558035; Fri, 26 Mar 2021 08:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771558; cv=none; d=google.com; s=arc-20160816; b=Sj/wu1y102/Sc/g0YYivsGKbE8MG3LsbIw3Hapn61fBud6mvbrHG4rOnIJBpmpwvas geOF2QiPFEWynPAyX+IGZimJovWksQEQrggp0Ab9bZaFdC6f/iAXvCJuH91Qjhjz3ho8 rquvTw0PAQGgcMMWcTXOL7TvjgGE0FVnC4PbrsIyGWkO7Dtc9Jdae+tclCJCZH3ed7vZ QPkVcy2JhFqe4KoXb5erb3gCuWAcY3KPM8VmNkfusoLlPLElWcQynz8cTHgSrZdZcfFs 0JkcJmJr0/QW3StTWv8W17uBl+c2gTDUv8beJdOiXqD+2jD6WJy5s6QnzNNasm5+Ozwq HjBg== 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=/5IZFT/IwO11mtS+DXxe3NtvichQwOJMJ1ayd2gN1yo=; b=a2cu5nAFmLIUF+S8juAq71lFjUW9Fz1qCBwuIYP7fR1BZlg2CmFQKGWDnvRPv/kp+2 Kkp5nfXJs0VtV46jxk9zFP+Sm4QYUyujEYJYDyQZMzhDOMv4+eHnXwfnf8/TmdqdnHD2 gxhMi7dLY1/FxJ9e2GlEfpso8AnICj9ck5T6NZuNBttq7s3BOj94l25fs+CIchY9E6UK ZGS/kyOrLmTCB0ILI8n7r7SXxZ1KO6xMRJ4cHhp2BquT4c2nuT6NsrjFsSFQh4Q3nkdY BLXwLwHitpyK6AHQtAvW+ypVs7rTjnp9Fq9e/wzpBL3I1BgdUqu9hkBrK0Cq1qi0+Kyr hL9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ixexIqir; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.37; Fri, 26 Mar 2021 08:12:38 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ixexIqir; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231180AbhCZPMO (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbhCZPLf (ORCPT ); Fri, 26 Mar 2021 11:11:35 -0400 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 E5D42C0613B5 for ; Fri, 26 Mar 2021 08:11:34 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id x17so5737402iog.2 for ; Fri, 26 Mar 2021 08:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/5IZFT/IwO11mtS+DXxe3NtvichQwOJMJ1ayd2gN1yo=; b=ixexIqirmRdA+c2o4TECW8V8V4Gwi+ZzcC0cLlqgrkkCjNUrNVWx9/v2SbU6xHFUNB OKwxejb4yKc22ZNjtaYKZ1jMPRV71zYwkP5vuUbW7NmgLGIouur87Rp5YinP0mhCBrfn Z/5IpULs+1me7bxb/jKmwuKuIqEaYGQbI51TY4UQrJC5aE0AbWyxvgAm2vROguaGKzyl QHrK2Z8uliO/ig6ejLTdTtvp6HhwB61i7F5tT6Fm/EQMFInaZDFokIuJVSLUvAqMpyMQ sWuyiIyNXz9i850Iur41SE+HrrIpUaAANh4tTqgZs8VDLrrqncsJSwmfjYFaWq7FHsEc Jz0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/5IZFT/IwO11mtS+DXxe3NtvichQwOJMJ1ayd2gN1yo=; b=aS/a5Csxx4Lq9bd3f/WkmKVvNIv36jZzAJgSjI8gxjUx6nl+2IsIhk8T8bCD4EKcuY MG6TapNj4WJq7x4Yr9uZRBRNb2GQ/Q9F+g6FVjDxfbvSc1gSJbJTcFpSMRkL5H8Uo1Fa KgdVhvC76xMuTUsFDD7oRDPPHpXBAZVtuEaIeWUTKo0L40Kmjjw/2lKvKucUoMmSMKL1 AMmU8LcuczSmHiFBaNJTlpvDzXGM1nooCCkxHKty+zfeLQQ/GoIjIdqeGb+JptfHFY6o Z+eM3Ycwzvh5sHHqHkv8rtH0kj7oCgBDHmy6kEhQ+d8Vif7pI80pW65oxPfOK55XyUhg NDoQ== X-Gm-Message-State: AOAM530VlhlMuxuzoICFAtP+/2OiDMsu1W8XUn5VHfM8dOZc32pxhFs1 duthYYHK9a3FUWN8xEkRH7G6dA== X-Received: by 2002:a02:ccd9:: with SMTP id k25mr12310553jaq.43.1616771494040; Fri, 26 Mar 2021 08:11:34 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:33 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 08/12] net: ipa: combine source and destination group limits Date: Fri, 26 Mar 2021 10:11:18 -0500 Message-Id: <20210326151122.3121383-9-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Replace IPA_RESOURCE_GROUP_SRC_MAX and IPA_RESOURCE_GROUP_DST_MAX with a single symbol, IPA_RESOURCE_GROUP_MAX. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data.h | 11 +++++------ drivers/net/ipa/ipa_resource.c | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index e1096d8ba5751..d6d14818a3968 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -47,8 +47,7 @@ */ /* The maximum value returned by ipa_resource_group_{src,dst}_count() */ -#define IPA_RESOURCE_GROUP_SRC_MAX 5 -#define IPA_RESOURCE_GROUP_DST_MAX 5 +#define IPA_RESOURCE_GROUP_MAX 5 /** enum ipa_qsb_master_id - array index for IPA QSB configuration data */ enum ipa_qsb_master_id { @@ -206,18 +205,18 @@ struct ipa_resource_limits { /** * struct ipa_resource_src - source endpoint group resource usage - * @limits: array of limits to use for each resource group + * @limits: array of source resource limits, indexed by group */ struct ipa_resource_src { - struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_SRC_MAX]; + struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_MAX]; }; /** * struct ipa_resource_dst - destination endpoint group resource usage - * @limits: array of limits to use for each resource group + * @limits: array of destination resource limits, indexed by group */ struct ipa_resource_dst { - struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_DST_MAX]; + struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_MAX]; }; /** diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c index 506bcccaef64f..38b95b6a5193d 100644 --- a/drivers/net/ipa/ipa_resource.c +++ b/drivers/net/ipa/ipa_resource.c @@ -77,10 +77,10 @@ static bool ipa_resource_limits_valid(struct ipa *ipa, u32 j; /* We program at most 6 source or destination resource group limits */ - BUILD_BUG_ON(IPA_RESOURCE_GROUP_SRC_MAX > 6); + BUILD_BUG_ON(IPA_RESOURCE_GROUP_MAX > 6); group_count = ipa_resource_group_src_count(ipa->version); - if (!group_count || group_count > IPA_RESOURCE_GROUP_SRC_MAX) + if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX) return false; /* Return an error if a non-zero resource limit is specified @@ -90,20 +90,20 @@ static bool ipa_resource_limits_valid(struct ipa *ipa, const struct ipa_resource_src *resource; resource = &data->resource_src[i]; - for (j = group_count; j < IPA_RESOURCE_GROUP_SRC_MAX; j++) + for (j = group_count; j < IPA_RESOURCE_GROUP_MAX; j++) if (resource->limits[j].min || resource->limits[j].max) return false; } group_count = ipa_resource_group_dst_count(ipa->version); - if (!group_count || group_count > IPA_RESOURCE_GROUP_DST_MAX) + if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX) return false; for (i = 0; i < data->resource_dst_count; i++) { const struct ipa_resource_dst *resource; resource = &data->resource_dst[i]; - for (j = group_count; j < IPA_RESOURCE_GROUP_DST_MAX; j++) + for (j = group_count; j < IPA_RESOURCE_GROUP_MAX; j++) if (resource->limits[j].min || resource->limits[j].max) return false; } From patchwork Fri Mar 26 15:11:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409520 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1519035jai; Fri, 26 Mar 2021 08:12:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6o7bQv56gD0nHw0Vk3DxlkSHsO1t4lKt75g3uP5yglF0FA3dolEoda6Wxc89l/LN2iv0n X-Received: by 2002:a17:907:76b3:: with SMTP id jw19mr15543862ejc.202.1616771560792; Fri, 26 Mar 2021 08:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771560; cv=none; d=google.com; s=arc-20160816; b=Ej3E4kPm2yIcvIwXeNEjNJo5yrZWpa6P4Zd8yrWk8eyhtus4B4LL3uDQC85TWgH+z+ gLqu/HEorFWps/HwYqdiL272GRhW6BOh0bq4y3i7HWRDKq20HXSNfjOjF1YWhOvq2oM3 yMT/DUj7x2rF1+q2PppdiuSqwE0oZ+B0sgyTYphGl+GD8yDzuRumEagMtkn/6NWn2LVf 6z4WsgqQkDywPtpQ3v0zyQZD1zzUb9HfeEPpAuSdOG6h1pCTze8w3F6Z8POjqx23ub+p YLSkjfDn3V8F6kxJV9nYSzA2nG/K2x3T73IM28XzOCwSv8j03Tfd5qVx07BpZOgInMZP Bybw== 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=1SaFkQw5ra/MhjdSrVDbweSgeBOe0ryrQaUo5/px9lE=; b=HO+r6NdrIaftBmNPmMcCyJN1GbGfEWe/c9pOKD49DWj9pvnTiiYNpXWklLFS6PGZxX 8IdhzlOx7YyodS6TdW7vK56/ZWhhGqcCxbAOx2IImM7gUZA+nu4VrZqe/V1BbIpeAUYf j17p+1zdzELINwxHgueIn2esw1oxbToM3Et9rv/ZGPoj8fZLCSkfZIcPkfKX6gsjjAdM sCFMyn5KpiaoEqqTvqhMZNVqiclwoRnNjFaqnWKN9hK+rkcbUu5bhhuJ+YK37vHTgzs0 uwm8YJZK6mSI6/qAGqNO9ZCtymN1W24vUP5ri3MMBUULxh8oNZYpDbGt2bCzgcUvxKd7 829A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MJuoFsFg; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.40; Fri, 26 Mar 2021 08:12:40 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MJuoFsFg; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbhCZPMV (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbhCZPLf (ORCPT ); Fri, 26 Mar 2021 11:11:35 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B44D1C0613B2 for ; Fri, 26 Mar 2021 08:11:35 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id x16so5726986iob.1 for ; Fri, 26 Mar 2021 08:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1SaFkQw5ra/MhjdSrVDbweSgeBOe0ryrQaUo5/px9lE=; b=MJuoFsFgZYfRvVWzz9Iy3qrBK7H8pgZYRP+F7uuzXSuD5TZW+1DJByKPEbyTrdB0S2 3YJluQYAsLBa4gkJoXBhsliKYG5PT/9neEHWAU9y8UZK9EL/9RJX05azglE10EaOEZz6 hf5JsGlj2Xi0NCbGgJTYrbIfjGEHklaiAPSD9O15aHSzjEF7qYxQklJoTmXOKc0FzGRh fznq1URTWvzfEoQNdAK6CW1DrqgwRkkVLafCZvnKIswcxRNNKt7Oq4Wl51GDMuBT3IMX K3/uv1DDK5LJ/+hngk05vSaBwmCb/mgbqaJuS5ecarFiBwYAXif4szUDc/vZ4FlKmX5N D99w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1SaFkQw5ra/MhjdSrVDbweSgeBOe0ryrQaUo5/px9lE=; b=HLz7mwMjqfr27XgeA5aZaW2uTr86UMLz6iPiVJQydsIBVdu5idyqznowGWS7kbwjlq rkMy7JLP0EJtooKDF7B5zJITaxIm87SoVk707CgEoSD3YdQT/Tgac/Z4FhhQ6/tNT08o HS/Ko0rdwdipaZ5vg6VhsKbT4h3HCKTeMyq7vWxWiZaKZvuuXv/e1e11FLiOrFWOCs/w Hj322fWOCebsiiJsaW2b3EPWFG9sDx9GF9jr1Mp6AqgdqwSX4npZc1XPsKcb04b8Wb22 PAOb91zsGDNlhl5IKJNS1XXBf3DjfFP4Ofu6aFJxzi4l6Gkkbq/5gGRmdjHpPicFczM9 pcXg== X-Gm-Message-State: AOAM530xGswNqrc+47EGFmXVcrIdMdpMl360iPxhGSOTQb6smKq4DGF/ zonV5b0oRcOkUexhNwn4qeNkKg== X-Received: by 2002:a02:c894:: with SMTP id m20mr12578246jao.80.1616771494926; Fri, 26 Mar 2021 08:11:34 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:34 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 09/12] net: ipa: combine source and destation resource types Date: Fri, 26 Mar 2021 10:11:19 -0500 Message-Id: <20210326151122.3121383-10-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The ipa_resource_src and ipa_resource_dst structures are identical in form, so just replace them with a single structure. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-sc7180.c | 4 ++-- drivers/net/ipa/ipa_data-sdm845.c | 4 ++-- drivers/net/ipa/ipa_data.h | 18 +++++------------- drivers/net/ipa/ipa_resource.c | 8 ++++---- 4 files changed, 13 insertions(+), 21 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index 24ff315175653..631b50fc8d534 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -163,7 +163,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }; /* Source resource configuration data for the SC7180 SoC */ -static const struct ipa_resource_src ipa_resource_src[] = { +static const struct ipa_resource ipa_resource_src[] = { [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = { .limits[IPA_RSRC_GROUP_SRC_UL_DL] = { .min = 3, .max = 63, @@ -192,7 +192,7 @@ static const struct ipa_resource_src ipa_resource_src[] = { }; /* Destination resource configuration data for the SC7180 SoC */ -static const struct ipa_resource_dst ipa_resource_dst[] = { +static const struct ipa_resource ipa_resource_dst[] = { [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = { .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = { .min = 3, .max = 3, diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index 357e8ba43a364..3c9675ce556ce 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -181,7 +181,7 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = { }; /* Source resource configuration data for the SDM845 SoC */ -static const struct ipa_resource_src ipa_resource_src[] = { +static const struct ipa_resource ipa_resource_src[] = { [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = { .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = { .min = 1, .max = 255, @@ -243,7 +243,7 @@ static const struct ipa_resource_src ipa_resource_src[] = { }; /* Destination resource configuration data for the SDM845 SoC */ -static const struct ipa_resource_dst ipa_resource_dst[] = { +static const struct ipa_resource ipa_resource_dst[] = { [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = { .limits[IPA_RSRC_GROUP_DST_LWA_DL] = { .min = 4, .max = 4, diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index d6d14818a3968..9060586eb7cba 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -204,18 +204,10 @@ struct ipa_resource_limits { }; /** - * struct ipa_resource_src - source endpoint group resource usage - * @limits: array of source resource limits, indexed by group + * struct ipa_resource - resource group source or destination resource usage + * @limits: array of resource limits, indexed by group */ -struct ipa_resource_src { - struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_MAX]; -}; - -/** - * struct ipa_resource_dst - destination endpoint group resource usage - * @limits: array of destination resource limits, indexed by group - */ -struct ipa_resource_dst { +struct ipa_resource { struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_MAX]; }; @@ -233,9 +225,9 @@ struct ipa_resource_dst { */ struct ipa_resource_data { u32 resource_src_count; - const struct ipa_resource_src *resource_src; + const struct ipa_resource *resource_src; u32 resource_dst_count; - const struct ipa_resource_dst *resource_dst; + const struct ipa_resource *resource_dst; }; /** diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c index 38b95b6a5193d..c7edacfa7d19d 100644 --- a/drivers/net/ipa/ipa_resource.c +++ b/drivers/net/ipa/ipa_resource.c @@ -87,7 +87,7 @@ static bool ipa_resource_limits_valid(struct ipa *ipa, * for a resource group not supported by hardware. */ for (i = 0; i < data->resource_src_count; i++) { - const struct ipa_resource_src *resource; + const struct ipa_resource *resource; resource = &data->resource_src[i]; for (j = group_count; j < IPA_RESOURCE_GROUP_MAX; j++) @@ -100,7 +100,7 @@ static bool ipa_resource_limits_valid(struct ipa *ipa, return false; for (i = 0; i < data->resource_dst_count; i++) { - const struct ipa_resource_dst *resource; + const struct ipa_resource *resource; resource = &data->resource_dst[i]; for (j = group_count; j < IPA_RESOURCE_GROUP_MAX; j++) @@ -129,7 +129,7 @@ ipa_resource_config_common(struct ipa *ipa, u32 offset, } static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, - const struct ipa_resource_src *resource) + const struct ipa_resource *resource) { u32 group_count = ipa_resource_group_src_count(ipa->version); const struct ipa_resource_limits *ylimits; @@ -155,7 +155,7 @@ static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, } static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, - const struct ipa_resource_dst *resource) + const struct ipa_resource *resource) { u32 group_count = ipa_resource_group_dst_count(ipa->version); const struct ipa_resource_limits *ylimits; From patchwork Fri Mar 26 15:11:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409519 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1519020jai; Fri, 26 Mar 2021 08:12:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoIAAozTI/s+tV0JGN/JLRZz0gdN/7e7Vh1A6a1YMdDH1Caf9t0Wlbdo0pGBh5oFqhsUez X-Received: by 2002:a17:906:4747:: with SMTP id j7mr15694849ejs.221.1616771559913; Fri, 26 Mar 2021 08:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771559; cv=none; d=google.com; s=arc-20160816; b=vlqfUxp+pgLdc9n7iw8XEZKflM2CpOqWEJp6LobBNB0zSQZGlgfN45J5tXe0pCT6u1 Ley5ZcfqgTJ4sEYtHaLMR6SM2v4UDNXR8stED4kMdEyeqTl7qo9ORNJJDLjGSNlXLTBa 4xC2QkYVlbBzijgFC2tAhKqIoBY6BFKuIcIxvGIIjuL4I3X+xQIOM58OIEFWD7SZBX9j XjOSNAiT/dZbkEvPPxHsHA1UHSjfvQ77/Mxwmhx+ZcXWd80yv6q2Bv2GZElzO1v8t8DT IapCN9zvAPu3tKWWKrVucJfPxOCczU3Ka3COMozlKxHImajiJZZnCnTB08NuFey+Ju2S LByA== 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=r8MCXM9rweH39xKCcaLePx4yJlcBdDekCxD8KpCehno=; b=EktXVzfAnqwz8ZvrsKTeuNHbAbrfuGRscjnD0DkjnRf/BWIzt+I6JiCzS0U/nBqGET KEQukcvdJNWJPRaJl5lRUmgxyKgP+YFQ/KhZK1NGXnmWTvkdbw8s7Q+rCmKmMP3JPyDl uX+z7zcYxgdUTb8StEsyosY5qiFF4VuVP4bGDCYI3YP1tVrDgs/ga37g0XeUZ3h0xMZ/ ghTy9UhcmjE5lRa+qLBSScNpfBy0sqNJ4BYUg9Wp0fdYy44l8DYfXYXmgQhfuW6qtW2c UU4sNeQ3cEmCD6SUYjWdmaUddn3uW6yRL4MrfJky1H5q8gNWBvBDpG8m3BPSiLXuqf3q wi1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FoGSzOJj; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.39; Fri, 26 Mar 2021 08:12:39 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FoGSzOJj; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231197AbhCZPMQ (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230339AbhCZPLg (ORCPT ); Fri, 26 Mar 2021 11:11:36 -0400 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 681BDC0613AA for ; Fri, 26 Mar 2021 08:11:36 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id c17so5298292ilj.7 for ; Fri, 26 Mar 2021 08:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r8MCXM9rweH39xKCcaLePx4yJlcBdDekCxD8KpCehno=; b=FoGSzOJjyXBWowm3oGpug3mjAbOr+Qoo5WNMpnOnqGRqBh+yVQwzVexrvRrcfsKIrR KYXnEjyHC+sc6P7lLoabkx0Jca/PS+43CuYWuyfa9a4E++j/ZrIQ5C9gENlMopYDkf/k HYjeNduL55MCO6IeGGyPwYjnS8QLNeZV2lYMPq8qkbKrJrHLL1rXgQny+OqC0EilpIOI maHsBeK6JrHptQV0b2mNBZKkcpOb1vOSZK7i0nU94kBpP4/BFHkYVTFe7JtmJKYZz/56 sZgj6Tf0ma0Ym7EsyGq5MmTqedpQTip8LKZn2nH2MOA+aSlkcDKyONl7HBpjFCeb2IXW Pufw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r8MCXM9rweH39xKCcaLePx4yJlcBdDekCxD8KpCehno=; b=s6/hGrIXgrBJMcoGyR9uWjLgNvUfg8YWAnXammBGbKn0MTx20rzxdyPWC6ZehsEvSi k8rWQ/UHn4N5w4lLo9NayV+LHztbOkbNesZL8PhWcqvEI+I2lWQB+F4RivkQvsHgD73n HS2HYQ8Z7JPqjGPGegfkq84P7PVLyjf9au39RGbeLvboUGsvDQ5FGbzkavhvudlm6fpu 262sWXKz3Mk7UyBJPBYiUqgJzv1HoSj/PKwjvhGcn6Mlh/0pMaEommxseU0CWhVCn0A6 RMI8lKwWDUF9r4aiuwJAbzh7NcAaSVhQLybQZozZ6yocVVnwjuu0ILauDWM3piHmUblq gzaw== X-Gm-Message-State: AOAM531IQHPjThD/xEpFR3z7pVWzUr0rUcMujosriN0sHGpAbYX4ETJO su+FJhQc9Ig41g0t+RBtqBr2pA== X-Received: by 2002:a05:6e02:781:: with SMTP id q1mr10855183ils.59.1616771495867; Fri, 26 Mar 2021 08:11:35 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:35 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 10/12] net: ipa: pass data for source and dest resource config Date: Fri, 26 Mar 2021 10:11:20 -0500 Message-Id: <20210326151122.3121383-11-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Pass the resource data pointer to ipa_resource_config_src() and ipa_resource_config_dst() to be used for configuring resource limits. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_resource.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c index c7edacfa7d19d..3db4dd3bda9cc 100644 --- a/drivers/net/ipa/ipa_resource.c +++ b/drivers/net/ipa/ipa_resource.c @@ -129,12 +129,15 @@ ipa_resource_config_common(struct ipa *ipa, u32 offset, } static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, - const struct ipa_resource *resource) + const struct ipa_resource_data *data) { u32 group_count = ipa_resource_group_src_count(ipa->version); const struct ipa_resource_limits *ylimits; + const struct ipa_resource *resource; u32 offset; + resource = &data->resource_src[resource_type]; + offset = IPA_REG_SRC_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 1 ? NULL : &resource->limits[1]; ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); @@ -155,12 +158,15 @@ static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, } static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, - const struct ipa_resource *resource) + const struct ipa_resource_data *data) { u32 group_count = ipa_resource_group_dst_count(ipa->version); const struct ipa_resource_limits *ylimits; + const struct ipa_resource *resource; u32 offset; + resource = &data->resource_dst[resource_type]; + offset = IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 1 ? NULL : &resource->limits[1]; ipa_resource_config_common(ipa, offset, &resource->limits[0], ylimits); @@ -189,10 +195,10 @@ int ipa_resource_config(struct ipa *ipa, const struct ipa_resource_data *data) return -EINVAL; for (i = 0; i < data->resource_src_count; i++) - ipa_resource_config_src(ipa, i, &data->resource_src[i]); + ipa_resource_config_src(ipa, i, data); for (i = 0; i < data->resource_dst_count; i++) - ipa_resource_config_dst(ipa, i, &data->resource_dst[i]); + ipa_resource_config_dst(ipa, i, data); return 0; } From patchwork Fri Mar 26 15:11:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409523 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1519097jai; Fri, 26 Mar 2021 08:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqQADhs7YVr2DJ0DcO/VMXP7Px5Ja2n89kEbc/YWkbOsnIIbm6MZ6+VFvFJQqdeC0kJHD5 X-Received: by 2002:a17:906:704a:: with SMTP id r10mr15894163ejj.312.1616771564038; Fri, 26 Mar 2021 08:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771564; cv=none; d=google.com; s=arc-20160816; b=Ov4B3ev9ciqTxUQvb2rerENTZnRt6C5h0hFA3RvaHdEIwwdm4QwSl9AwYnDG6s+sIm cmnOOqcGqzRqbT0dZzep8HOGnYz+aXoZ7xSqdBAoseQ2bG/zfb+VXIuI2D9heddBoH9W W2Ggd7Y4+6mcb3U1AkeY9Rrha5CibfZUCLzuBERlsTFQYy3bMGK+g9pNpK/SH2WFBUeM 6za+9C9lB2utE89Axr859wZMSfoHQ8Y2hMtu9Gf7acPV9qZVRpicT3GEYeOj+udAMLc7 B2TjTxlDqbNJJ/EFecdaFTpWj2atW2i3o/MDVBXnJr0UNgOiuB2rpCcRVPyGNe5L9MiL yVGA== 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=gUmB/zFwJkKaeTOJTTMdrrWCynBS5WfLyS187adEfr4=; b=Ys7YKsLYh6cCsAuCeXmnCbnTMrfc3gPumJTBH7+y0YKhjKZwXw1lx3CxQ47L+c9cDk l3QY8Lay7M14WTkVrQAHrDWl1TfHLGp2yr5FmLs/NLazgG77VvotdNNZ/4Kn7gOkwCGj uukghvRJCKtgLQBcl35hD7DKUBx503RsXNSQ3bVjTxZXgTMK89FDUkwZelVt5f7FefAV UygHOIJGkNhlw77e6DQIJ+OQ+gRNztdbhfAgPoedLYLC43WHd+l/t4TGCPP+UReSqSTi fxVv0l5dQyHKA3B9EJpNTj9Av4OviA9QH8BWNv8mYd1A48BArSp5HQCLB2EB6jz1PxNq NZLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pB8heAQG; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.43; Fri, 26 Mar 2021 08:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pB8heAQG; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231258AbhCZPM0 (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230350AbhCZPLj (ORCPT ); Fri, 26 Mar 2021 11:11:39 -0400 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 D5566C0613B1 for ; Fri, 26 Mar 2021 08:11:38 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id u2so5323711ilk.1 for ; Fri, 26 Mar 2021 08:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gUmB/zFwJkKaeTOJTTMdrrWCynBS5WfLyS187adEfr4=; b=pB8heAQG7+9AYNZHFCpRstpwd+JeNtO1kWEiyYFgeMBLrHoSgMLIWACKH4cKO5kq4N g6nwhd+KYqA3rTT4K4YtGn+sCgOavBu0+GnNHmH7hsalwgAtNF5xskV9N4Dx4yzJ2VAI hisNmi6B42FWUGrD3soHhEM8Fjlg8YgmHyc2ZjcGAY41+cSux6yW6FvTCRkvq09MA/Mx qLpZhekgyurUjlmXJKBc3DNy6SZln1MzPMN8/zi6bx3bXCzK3QtACoJnX69aJLBohFUr V5Us5baRzHj7ZOX14OFBehOP4yOVvaUBaFF7aIFQMlfSDovzDrO7OR4EUCqAH1hIgBVV iOmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gUmB/zFwJkKaeTOJTTMdrrWCynBS5WfLyS187adEfr4=; b=mgXlYagvlTeA2GWNeLejOuwi0POVoUBXXmCmU/11CTk0FprGD/b56tWsOgzvk4YQoH Uh3/vXTbe+Xcd+8MmOV/eeR+EE9yAUIYqjUCnqDM0aLDUIRVxEIw+JfuxUwDFsks7cFj 01Afq5XkHRAjTSjc5U3EsYbDCbfLNZxyb+ecoaR03i9YvtzJn7JTd5obpDtj00fie8wk 6K6PIcj7pfUXKPxMSAER7+mba5DGrhe4H5Bqf+za8gu5qb4c+ZuRftDwo4NqACViTYx6 49oZwiinizKnGjiC+Jh2v4rwiUhw2ixOaPtNMFMtwLPJGpMzgghv+T0u9JDbzpQcUmZ6 dpKw== X-Gm-Message-State: AOAM532M7HIDBJB9ijaLe868jg6wamAovSVLRKX3p44f+Y+7x1JqCnIb hff+bC0sVUIdj1MZmdIwRIOjcRJSK/c/rNyf X-Received: by 2002:a05:6e02:532:: with SMTP id h18mr4902523ils.267.1616771496768; Fri, 26 Mar 2021 08:11:36 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:36 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 11/12] net: ipa: record number of groups in data Date: Fri, 26 Mar 2021 10:11:21 -0500 Message-Id: <20210326151122.3121383-12-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The arrays of source and destination resource limits defined in configuration data are of a fixed size--which is the maximum number of resource groups supported for any platform. Most platforms will use fewer than that many groups. Add new members to the ipa_rsrc_group_id enumerated type to define the number of source and destination resource groups are defined for the platform. (This type is defined for each platform in its data file.) Add a new field to the resource configuration data that indicates how many of the source and destination resource groups are actually used for the platform, and initialize it with the count value. This allows us to determine the number of groups defined for the platform without exposing the ipa_rsrc_group_id enumerated type. As a result, we no longer need ipa_resource_group_src_count() and ipa_resource_group_dst_count(), because each platform now defines its supported number of resource groups. So get rid of those two functions. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-sc7180.c | 4 +++ drivers/net/ipa/ipa_data-sdm845.c | 4 +++ drivers/net/ipa/ipa_data.h | 4 +++ drivers/net/ipa/ipa_resource.c | 50 +++---------------------------- 4 files changed, 16 insertions(+), 46 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index 631b50fc8d534..c9b6a6aaadacc 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -27,9 +27,11 @@ enum ipa_resource_type { enum ipa_rsrc_group_id { /* Source resource group identifiers */ IPA_RSRC_GROUP_SRC_UL_DL = 0, + IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */ /* Destination resource group identifiers */ IPA_RSRC_GROUP_DST_UL_DL_DPL = 0, + IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */ }; /* QSB configuration for the SC7180 SoC. */ @@ -207,6 +209,8 @@ static const struct ipa_resource ipa_resource_dst[] = { /* Resource configuration for the SC7180 SoC. */ static const struct ipa_resource_data ipa_resource_data = { + .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT, + .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT, .resource_src_count = ARRAY_SIZE(ipa_resource_src), .resource_src = ipa_resource_src, .resource_dst_count = ARRAY_SIZE(ipa_resource_dst), diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index 3c9675ce556ce..e14e3fb1d9700 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -32,11 +32,13 @@ enum ipa_rsrc_group_id { IPA_RSRC_GROUP_SRC_UL_DL, IPA_RSRC_GROUP_SRC_MHI_DMA, IPA_RSRC_GROUP_SRC_UC_RX_Q, + IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */ /* Destination resource group identifiers */ IPA_RSRC_GROUP_DST_LWA_DL = 0, IPA_RSRC_GROUP_DST_UL_DL_DPL, IPA_RSRC_GROUP_DST_UNUSED_2, + IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */ }; /* QSB configuration for the SDM845 SoC. */ @@ -270,6 +272,8 @@ static const struct ipa_resource ipa_resource_dst[] = { /* Resource configuration for the SDM845 SoC. */ static const struct ipa_resource_data ipa_resource_data = { + .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT, + .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT, .resource_src_count = ARRAY_SIZE(ipa_resource_src), .resource_src = ipa_resource_src, .resource_dst_count = ARRAY_SIZE(ipa_resource_dst), diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index 9060586eb7cba..c5d763a3782fd 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -213,6 +213,8 @@ struct ipa_resource { /** * struct ipa_resource_data - IPA resource configuration data + * @rsrc_group_src_count: number of source resource groups supported + * @rsrc_group_dst_count: number of destination resource groups supported * @resource_src_count: number of entries in the resource_src array * @resource_src: source endpoint group resources * @resource_dst_count: number of entries in the resource_dst array @@ -224,6 +226,8 @@ struct ipa_resource { * programming it at initialization time, so we specify it here. */ struct ipa_resource_data { + u32 rsrc_group_src_count; + u32 rsrc_group_dst_count; u32 resource_src_count; const struct ipa_resource *resource_src; u32 resource_dst_count; diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c index 3db4dd3bda9cc..578ff070d4055 100644 --- a/drivers/net/ipa/ipa_resource.c +++ b/drivers/net/ipa/ipa_resource.c @@ -26,48 +26,6 @@ * total resources of each type is assigned for use by each group. */ -/* # IPA source resource groups available based on version */ -static u32 ipa_resource_group_src_count(enum ipa_version version) -{ - switch (version) { - case IPA_VERSION_3_5_1: - case IPA_VERSION_4_0: - case IPA_VERSION_4_1: - return 4; - - case IPA_VERSION_4_2: - return 1; - - case IPA_VERSION_4_5: - return 5; - - default: - return 0; - } -} - -/* # IPA destination resource groups available based on version */ -static u32 ipa_resource_group_dst_count(enum ipa_version version) -{ - switch (version) { - case IPA_VERSION_3_5_1: - return 3; - - case IPA_VERSION_4_0: - case IPA_VERSION_4_1: - return 4; - - case IPA_VERSION_4_2: - return 1; - - case IPA_VERSION_4_5: - return 5; - - default: - return 0; - } -} - static bool ipa_resource_limits_valid(struct ipa *ipa, const struct ipa_resource_data *data) { @@ -79,7 +37,7 @@ static bool ipa_resource_limits_valid(struct ipa *ipa, /* We program at most 6 source or destination resource group limits */ BUILD_BUG_ON(IPA_RESOURCE_GROUP_MAX > 6); - group_count = ipa_resource_group_src_count(ipa->version); + group_count = data->rsrc_group_src_count; if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX) return false; @@ -95,7 +53,7 @@ static bool ipa_resource_limits_valid(struct ipa *ipa, return false; } - group_count = ipa_resource_group_dst_count(ipa->version); + group_count = data->rsrc_group_src_count; if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX) return false; @@ -131,7 +89,7 @@ ipa_resource_config_common(struct ipa *ipa, u32 offset, static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, const struct ipa_resource_data *data) { - u32 group_count = ipa_resource_group_src_count(ipa->version); + u32 group_count = data->rsrc_group_src_count; const struct ipa_resource_limits *ylimits; const struct ipa_resource *resource; u32 offset; @@ -160,7 +118,7 @@ static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, const struct ipa_resource_data *data) { - u32 group_count = ipa_resource_group_dst_count(ipa->version); + u32 group_count = data->rsrc_group_dst_count; const struct ipa_resource_limits *ylimits; const struct ipa_resource *resource; u32 offset; From patchwork Fri Mar 26 15:11:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 409522 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1519056jai; Fri, 26 Mar 2021 08:12:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4HOMMjOyzqq0xAOEMP8qR+9cuev28SZ9eqpDFd63bzoNZWBHbaPLWYlLfyp0/ysPpW6YS X-Received: by 2002:a05:6402:51d0:: with SMTP id r16mr15573483edd.48.1616771561857; Fri, 26 Mar 2021 08:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616771561; cv=none; d=google.com; s=arc-20160816; b=i8mHQts9AC36hBpt+6fP4ubQzOuSZa5nCZwCTitR7/n0OfSoBM5p2LtnrHBSgzcvpZ pFojYw4nscQIApK8uJcWR9EJlJlu+zszWypv5vKOgmGkjqymOCZCYc6x9OOZTFkwdNWc 29qyPtf+V7kDqNzSH/QY6gIm2DYf+J9kSsroFa+h1utZnEJu9DxrFlsNYa2t3P/gyqYh Umd6MwAYB7SLLrzm6omcXbxwpOQgz//DafXdtYrZL9Q3TDfyTPEdhFSXHVALXyz4Gwr9 BWv7sRdMjIv/yzMG34fDr1MD11vmrjUAihP2F0wfPTrs1wcdMbOQvC0/uxavd79+ChpC y9+w== 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=9ZnJjMZ3j1jPK7KyRsp3AHHKqIeEkct5/pc3t9X9wys=; b=QxJBX1XBo6F4pKif8q9djXAg7DzGW2/Num+W7DIdKqwttP4D/WzUlvUPVUiOE/qjRK R6zYtq1Q5hIBfDX8nvboidrwf8ZAxqgUFwJ9zmzrQGDn7oJ3GfZOiCQ5KZo1AXvtgnY7 HvPBkip3d7wcWiFpXOOimYpBdR/oWhPafNG7Fy1YpbVZd4opIHq7fns19LthFszMvwFF +ijxqff8lGYe/m6BzXW/7ZrvqZo2vqShn+BROwihieWQQj5dMBuaWs/8kVqPPUzYO6Z3 Qd2VKhNvoSqvRmxjQc59stPXBpDdITzZ4v95mB+zl9re1ojJs32i11XXu445JVZAFoqa 0aMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L15UEagC; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si6533712ejb.357.2021.03.26.08.12.41; Fri, 26 Mar 2021 08:12:41 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L15UEagC; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231239AbhCZPMY (ORCPT + 8 others); Fri, 26 Mar 2021 11:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbhCZPLi (ORCPT ); Fri, 26 Mar 2021 11:11:38 -0400 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42AB8C0613AA for ; Fri, 26 Mar 2021 08:11:38 -0700 (PDT) Received: by mail-il1-x133.google.com with SMTP id u10so5363403ilb.0 for ; Fri, 26 Mar 2021 08:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9ZnJjMZ3j1jPK7KyRsp3AHHKqIeEkct5/pc3t9X9wys=; b=L15UEagCnDLpE6eOQf1L+E3tQwhY+xffEXGrsTI7J7yQLZvaiBtsixRtCpc4YJI4DR RLpp4hituhJQbFKNgQbgoIpP53kUtR+wpNEu7HW32dmYnyZ95oHsHy2fH4lAQziRZBCf 1R/YfCDfgjnv4EDY1Zq3B7BoD/NShraqFjArRIWFdV96GlxoD8oiKpGhM09qUpL1gApM qxEE1b7orHCCGrg02s6rACCHHVx4PjlWr/uw0/qcI8MMOI5EPchrA+zZNHmFaJ3LuzOO 8es50kHcWercjS6jGVftQJssxVypISwcSkiapZKmsYOO1Rl+ujTVQZHqqj9BcvN/SN/E Rlcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9ZnJjMZ3j1jPK7KyRsp3AHHKqIeEkct5/pc3t9X9wys=; b=nK6J9NCMmtuKtplca4LrLwmsOT2R9J0iaO17byxfwA5NXLdLdTaxqPrU6+M7lIA5n9 CxlNG06He8w1hnRX/TqrprDTdqVlQ47Ymnmm0il1FB54ZpIyxKVED6NdhZjqvNcyK+zt IxPmzzYg2J4OvZWN2IHAzLeqDmqQDwjc84OkBJN0AnVkLxtLUpByv2tSVh7J2ecxlT5Z 73gBrnyVFf6LZzfxiyYDl5pWum9+DZKdReG+Tp48UlS1iw93xvIe9hkXocAMlPd2ugdf RziO4wMoSkTe5u9fjJ3riciPbo33tfL8LPskJl1jyb1Ose8PAjxWLD86n+l0/tDswGxc Xq8A== X-Gm-Message-State: AOAM533CFMbmSaQj7D+iggrdmmk7365mUwWuic4bwjtfRaQSk0mPJ1/a sxT03Dbrg8njZNoC7P1Onm9E7fUJ9gviS7zN X-Received: by 2002:a05:6e02:1ba5:: with SMTP id n5mr11350090ili.4.1616771497683; Fri, 26 Mar 2021 08:11:37 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j17sm4537706iok.37.2021.03.26.08.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 08:11:37 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 12/12] net: ipa: support more than 6 resource groups Date: Fri, 26 Mar 2021 10:11:22 -0500 Message-Id: <20210326151122.3121383-13-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210326151122.3121383-1-elder@linaro.org> References: <20210326151122.3121383-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org IPA versions 3.0 and 3.1 support up to 8 resource groups. There is some interest in supporting these older versions of the hardware, so update the resource configuration code to program resource limits for these groups if specified. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data.h | 4 ++-- drivers/net/ipa/ipa_reg.h | 4 ++++ drivers/net/ipa/ipa_resource.c | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index c5d763a3782fd..ea8f99286228e 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -46,8 +46,8 @@ * the IPA endpoint. */ -/* The maximum value returned by ipa_resource_group_{src,dst}_count() */ -#define IPA_RESOURCE_GROUP_MAX 5 +/* The maximum possible number of source or destination resource groups */ +#define IPA_RESOURCE_GROUP_MAX 8 /** enum ipa_qsb_master_id - array index for IPA QSB configuration data */ enum ipa_qsb_master_id { diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index 9c798cef7b2e2..de2a944bad86b 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -353,12 +353,16 @@ enum ipa_pulse_gran { (0x00000404 + 0x0020 * (rt)) #define IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(rt) \ (0x00000408 + 0x0020 * (rt)) +#define IPA_REG_SRC_RSRC_GRP_67_RSRC_TYPE_N_OFFSET(rt) \ + (0x0000040c + 0x0020 * (rt)) #define IPA_REG_DST_RSRC_GRP_01_RSRC_TYPE_N_OFFSET(rt) \ (0x00000500 + 0x0020 * (rt)) #define IPA_REG_DST_RSRC_GRP_23_RSRC_TYPE_N_OFFSET(rt) \ (0x00000504 + 0x0020 * (rt)) #define IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(rt) \ (0x00000508 + 0x0020 * (rt)) +#define IPA_REG_DST_RSRC_GRP_67_RSRC_TYPE_N_OFFSET(rt) \ + (0x0000050c + 0x0020 * (rt)) /* The next four fields are used for all resource group registers */ #define X_MIN_LIM_FMASK GENMASK(5, 0) #define X_MAX_LIM_FMASK GENMASK(13, 8) diff --git a/drivers/net/ipa/ipa_resource.c b/drivers/net/ipa/ipa_resource.c index 578ff070d4055..85f922d6f222f 100644 --- a/drivers/net/ipa/ipa_resource.c +++ b/drivers/net/ipa/ipa_resource.c @@ -34,8 +34,8 @@ static bool ipa_resource_limits_valid(struct ipa *ipa, u32 i; u32 j; - /* We program at most 6 source or destination resource group limits */ - BUILD_BUG_ON(IPA_RESOURCE_GROUP_MAX > 6); + /* We program at most 8 source or destination resource group limits */ + BUILD_BUG_ON(IPA_RESOURCE_GROUP_MAX > 8); group_count = data->rsrc_group_src_count; if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX) @@ -113,6 +113,13 @@ static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type, offset = IPA_REG_SRC_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 5 ? NULL : &resource->limits[5]; ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); + + if (group_count < 7) + return; + + offset = IPA_REG_SRC_RSRC_GRP_67_RSRC_TYPE_N_OFFSET(resource_type); + ylimits = group_count == 7 ? NULL : &resource->limits[7]; + ipa_resource_config_common(ipa, offset, &resource->limits[6], ylimits); } static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, @@ -142,6 +149,13 @@ static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type, offset = IPA_REG_DST_RSRC_GRP_45_RSRC_TYPE_N_OFFSET(resource_type); ylimits = group_count == 5 ? NULL : &resource->limits[5]; ipa_resource_config_common(ipa, offset, &resource->limits[4], ylimits); + + if (group_count < 7) + return; + + offset = IPA_REG_DST_RSRC_GRP_67_RSRC_TYPE_N_OFFSET(resource_type); + ylimits = group_count == 7 ? NULL : &resource->limits[7]; + ipa_resource_config_common(ipa, offset, &resource->limits[6], ylimits); } /* Configure resources */