All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Robert Ijtsma" <robertijtsma@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next 3/3] net: ipa: add SC8180X (IPA v4.1) configuration data
Date: Wed, 25 Nov 2026 23:02:00 +0000	[thread overview]
Message-ID: <sashiko-outbox-234346@kernel.org> (raw)
In-Reply-To: <20261125-qcom-ipa-sc8180x-v1-3-48a889acbe6b@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] net: ipa: tre_count exceeds event_count on v4.1 AP_COMMAND_TX
  channel
- [Low] net: ipa: unused resource enums, raw BCR hex, and extra modem
  endpoints
--

commit aa6515fd37eb0fd75ac7af4e3c2122ec4fe34431
Author: Robert Ijtsma <robertijtsma@gmail.com>

net: ipa: add SC8180X (IPA v4.1) configuration data

This commit adds IPA v4.1 configuration data for the Qualcomm SC8180X SoC
and binds it to the qcom,sc8180x-ipa compatible string.

> diff --git a/drivers/net/ipa/data/ipa_data-v4.1.c b/drivers/net/ipa/data/ipa_data-v4.1.c
> new file mode 100644
> index 0000000000000..9b52c60b5cc7f
> --- /dev/null
> +++ b/drivers/net/ipa/data/ipa_data-v4.1.c
> @@ -0,0 +1,319 @@

[ ... ]

> +/** enum ipa_resource_type - IPA resource types for an SoC having IPA v4.1 */
> +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 an SoC having IPA v4.1 */
> +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_UNUSED_2,
> +	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_UC_RX_Q,
> +	IPA_RSRC_GROUP_DST_COUNT,	/* Last; not a destination group */
> +};

[ ... ]

> +/* Endpoint data for an SoC having IPA v4.1 */
> +static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
> +	[IPA_ENDPOINT_AP_COMMAND_TX] = {
> +		.ee_id		= GSI_EE_AP,
> +		.channel_id	= 4,
> +		.endpoint_id	= 5,
> +		.toward_ipa	= true,
> +		.channel = {
> +			.tre_count	= 512,
> +			.event_count	= 256,
> +			.tlv_count	= 20,
> +		},

[Severity: High]
Can setting tre_count (512) higher than event_count (256) on
IPA_ENDPOINT_AP_COMMAND_TX cause an out-of-bounds access in
channel->trans_info.map[]?

In gsi_channel_init_one(), tre_count > event_count triggers a warning and
clamps channel->tre_count to 256, but gsi_ring_alloc() still allocates
channel->tre_ring with the unclamped data->channel.tre_count (512):

drivers/net/ipa/gsi.c:gsi_channel_init_one() {
	...
	if (channel->tre_count > channel->event_count) {
		channel->tre_count = channel->event_count;
		...
	}

	ret = gsi_ring_alloc(gsi, &channel->tre_ring, data->channel.tre_count);
	...
}

gsi_channel_trans_init() then allocates channel->trans_info.map with
channel->tre_count (256) entries, whereas gsi_trans_map() and
gsi_channel_trans_mapped() index trans_info.map modulo
channel->tre_ring.count (512).  Because IPA_ENDPOINT_AP_COMMAND_TX is not
reset across modem crash/stop cycles, tre_ring.index advances across
command transactions and writes past the end of trans_info.map once it
reaches 256.  Setting .tre_count = 256 (matching the other IPA v4.x/v5.x
configurations) avoids the mismatch.

[ ... ]

> +	[IPA_ENDPOINT_MODEM_COMMAND_TX] = {
> +		.ee_id		= GSI_EE_MODEM,
> +		.channel_id	= 1,
> +		.endpoint_id	= 4,
> +		.toward_ipa	= true,
> +	},
> +	[IPA_ENDPOINT_MODEM_LAN_RX] = {
> +		.ee_id		= GSI_EE_MODEM,
> +		.channel_id	= 4,
> +		.endpoint_id	= 14,
> +		.toward_ipa	= false,
> +	},
> +	[IPA_ENDPOINT_MODEM_AP_TX] = {
> +		.ee_id		= GSI_EE_MODEM,
> +		.channel_id	= 0,
> +		.endpoint_id	= 3,
> +		.toward_ipa	= true,
> +		.endpoint = {
> +			.filter_support	= true,
> +		},
> +	},
> +	[IPA_ENDPOINT_MODEM_AP_RX] = {
> +		.ee_id		= GSI_EE_MODEM,
> +		.channel_id	= 3,
> +		.endpoint_id	= 13,
> +		.toward_ipa	= false,
> +	},
> +};
> +
> +/* Source resource configuration data for an SoC having IPA v4.1 */
> +static const struct ipa_resource ipa_resource_src[] = {
> +	{
> +		.limits[0] = { .min = 1, .max = 63 },
> +		.limits[1] = { .min = 1, .max = 63 },
> +		.limits[2] = { .min = 0, .max = 0 },
> +		.limits[3] = { .min = 1, .max = 63 },
> +	},

[ ... ]

> +/* Configuration data for an SoC having IPA v4.1 */
> +const struct ipa_data ipa_data_v4_1 = {
> +	.version		= IPA_VERSION_4_1,
> +	.backward_compat	= 0x39,

[Severity: Low]
Should IPA_ENDPOINT_MODEM_COMMAND_TX and IPA_ENDPOINT_MODEM_LAN_RX be
omitted here?

Per commit d21d1f33b190 ("net: ipa: don't define endpoints
unnecessarily"), non-v4.2 targets only define modem endpoints that
support filtering or are referenced by another endpoint; defining these
two causes the AP to program pause, HOLB clear, and exception reset on
those modem-owned endpoints during modem lifecycle transitions.

Also, ipa_resource_src[] and ipa_resource_dst[] use positional entries
and numeric .limits[0..3] indices instead of the IPA_RESOURCE_TYPE_* and
IPA_RSRC_GROUP_* enums defined at the top of the file (leaving enum
ipa_resource_type unused), and .backward_compat uses raw 0x39 instead of
the BIT(BCR_*) flags from enum ipa_bcr_compat.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-qcom-ipa-sc8180x-v1-0-48a889acbe6b@gmail.com?part=3

  parent reply	other threads:[~2026-11-25 23:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 23:01 [PATCH net-next 0/3] net: ipa: add Qualcomm SC8180X (IPA v4.1) support Robert Ijtsma via B4 Relay
2026-11-24 23:01 ` Robert Ijtsma
2026-11-24 23:01 ` [PATCH net-next 1/3] dt-bindings: net: qcom,ipa: add qcom,sc8180x-ipa compatible Robert Ijtsma via B4 Relay
2026-11-24 23:01   ` Robert Ijtsma
2026-11-25  7:41   ` Krzysztof Kozlowski
2026-11-24 23:01 ` [PATCH net-next 2/3] net: ipa: add IPA v4.1 register definitions Robert Ijtsma via B4 Relay
2026-11-24 23:01   ` Robert Ijtsma
2026-11-25 23:01   ` sashiko-bot
2026-11-29  0:43   ` netdev-bot+sashiko
2026-11-29 10:59     ` Robert IJtsma
2026-11-24 23:01 ` [PATCH net-next 3/3] net: ipa: add SC8180X (IPA v4.1) configuration data Robert Ijtsma via B4 Relay
2026-11-24 23:01   ` Robert Ijtsma
2026-11-25 10:49   ` Konrad Dybcio
2026-11-25 23:02   ` sashiko-bot [this message]
2026-11-29  0:43   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-234346@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robertijtsma@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.