From: Alex Elder <elder@ieee.org>
To: robertijtsma@gmail.com, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Alex Elder <elder@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/3] net: ipa: add IPA v4.1 register definitions
Date: Fri, 4 Dec 2026 16:54:34 -0600 [thread overview]
Message-ID: <6bb44016-c84c-473f-89db-ff296241a0b3@ieee.org> (raw)
In-Reply-To: <20261125-qcom-ipa-sc8180x-v1-2-48a889acbe6b@gmail.com>
On 11/24/26 5:01 PM, Robert Ijtsma via B4 Relay wrote:
> From: Robert Ijtsma <robertijtsma@gmail.com>
>
> Add the IPA v4.1 register table (ipa_regs_v4_1) and map IPA_VERSION_4_1
> to gsi_regs_v4_0 so SC8180X IPA v4.1 hardware can be driven by the
> Qualcomm IPA driver.
>
> Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
Sashiko did a really nice job doing comparisons and asking
about certain differences. I haven't looked very closely
at what it asks about/comments on, but they seem like the
kind of thing I'd want to know.
I don't have access to the Qualcomm documentation that
would allow me to verify that you got all the right
register offsets and bit positions and field widths.
But of course you can find your way through these downstream:
drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_reg.c
drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_reg_i.h
I don't verify all your bit positions and field widths, but
I have confirmed all the register offsets you use and they
match the downstream code.
It would be very helpful if you would refer in your patches,
somewhere (maybe in the cover page?) the downstream source
code you used as a basis for what you do here.
Overall this looks good, but there are a few formatting
issues I point out.
> ---
> drivers/net/ipa/Makefile | 2 +-
> drivers/net/ipa/gsi_reg.c | 1 +
> drivers/net/ipa/ipa_reg.c | 2 +
> drivers/net/ipa/ipa_reg.h | 1 +
> drivers/net/ipa/reg/ipa_reg-v4.1.c | 475 +++++++++++++++++++++++++++++++++++++
> 5 files changed, 480 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ipa/Makefile b/drivers/net/ipa/Makefile
> index e148ec3..2420af0 100644
> --- a/drivers/net/ipa/Makefile
> +++ b/drivers/net/ipa/Makefile
> @@ -2,7 +2,7 @@
> #
> # Makefile for the Qualcomm IPA driver.
>
> -IPA_REG_VERSIONS := 3.1 3.5.1 4.2 4.5 4.7 4.9 4.11 5.0 5.5
> +IPA_REG_VERSIONS := 3.1 3.5.1 4.1 4.2 4.5 4.7 4.9 4.11 5.0 5.5
>
> # Some IPA versions can reuse another set of GSI register definitions.
> GSI_REG_VERSIONS := 3.1 3.5.1 4.0 4.5 4.9 4.11 5.0
> diff --git a/drivers/net/ipa/gsi_reg.c b/drivers/net/ipa/gsi_reg.c
> index e13cf83..bad9fc8 100644
> --- a/drivers/net/ipa/gsi_reg.c
> +++ b/drivers/net/ipa/gsi_reg.c
> @@ -96,6 +96,7 @@ static const struct regs *gsi_regs(struct gsi *gsi)
> case IPA_VERSION_3_5_1:
> return &gsi_regs_v3_5_1;
>
> + case IPA_VERSION_4_1:
> case IPA_VERSION_4_2:
> return &gsi_regs_v4_0;
It's nice that the GSI registers are the same.
>
> diff --git a/drivers/net/ipa/ipa_reg.c b/drivers/net/ipa/ipa_reg.c
> index 30bd69f..06dffc0 100644
> --- a/drivers/net/ipa/ipa_reg.c
> +++ b/drivers/net/ipa/ipa_reg.c
> @@ -114,6 +114,8 @@ static const struct regs *ipa_regs(enum ipa_version version)
> return &ipa_regs_v3_1;
> case IPA_VERSION_3_5_1:
> return &ipa_regs_v3_5_1;
> + case IPA_VERSION_4_1:
> + return &ipa_regs_v4_1;
> case IPA_VERSION_4_2:
> return &ipa_regs_v4_2;
> case IPA_VERSION_4_5:
> diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h
> index 61b7c44..8bf908e 100644
> --- a/drivers/net/ipa/ipa_reg.h
> +++ b/drivers/net/ipa/ipa_reg.h
> @@ -631,6 +631,7 @@ enum ipa_reg_ipa_irq_uc_field_id {
>
> extern const struct regs ipa_regs_v3_1;
> extern const struct regs ipa_regs_v3_5_1;
> +extern const struct regs ipa_regs_v4_1;
> extern const struct regs ipa_regs_v4_2;
> extern const struct regs ipa_regs_v4_5;
> extern const struct regs ipa_regs_v4_7;
> diff --git a/drivers/net/ipa/reg/ipa_reg-v4.1.c b/drivers/net/ipa/reg/ipa_reg-v4.1.c
> new file mode 100644
> index 0000000..75f47b2
> --- /dev/null
> +++ b/drivers/net/ipa/reg/ipa_reg-v4.1.c
> @@ -0,0 +1,475 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/* Copyright (C) 2022 Linaro Ltd. */
You should probably update at least the date on this copyright.
> +#include <linux/array_size.h>
> +#include <linux/bits.h>
> +#include <linux/types.h>
> +
> +#include "../ipa_reg.h"
> +#include "../ipa_version.h"
> +
In the downstream code, if a version of IPA does not define
entries in an array (such as in the ipahal_reg_objs[][] array),
the definitions should use the ones for the immediately *lower*
version number. So for IPA_4_1, the values in IPA_4_0 should
be used. (I think you know this, but I'm stating it for the
benefit of anyone who doesn't know.)
> +static const u32 reg_comp_cfg_fmask[] = {
. . .
All the same as IPA v4.2 here.
> +
> +REG_FIELDS(QSB_MAX_READS, qsb_max_reads, 0x00000078);
> +
I'm pretty sure IPA v4.2 is the only one that defines the
FILT_ROUT_HASH_EN register.
> +static const u32 reg_filt_rout_hash_flush_fmask[] = {
> + [IPV6_ROUTER_HASH] = BIT(0),
> + /* Bits 1-3 reserved */
> + [IPV6_FILTER_HASH] = BIT(4),
> + /* Bits 5-7 reserved */
> + [IPV4_ROUTER_HASH] = BIT(8),
> + /* Bits 9-11 reserved */
> + [IPV4_FILTER_HASH] = BIT(12),
> + /* Bits 13-31 reserved */
> +};
> +
> +REG_FIELDS(FILT_ROUT_HASH_FLUSH, filt_rout_hash_flush, 0x000014c);
> +
. . .
> +static const u32 reg_flavor_0_fmask[] = {
> + [MAX_PIPES] = GENMASK(3, 0),
> + /* Bits 4-7 reserved */
> + [MAX_CONS_PIPES] = GENMASK(12, 8),
> + /* Bits 13-15 reserved */
> + [MAX_PROD_PIPES] = GENMASK(20, 16),
> + /* Bits 21-23 reserved */
> + [PROD_LOWEST] = GENMASK(27, 24),
> + /* Bits 28-31 reserved */
> +};
> +
> +REG_FIELDS(FLAVOR_0, flavor_0, 0x00000210);
Are you sure IPA v4.1 has this register? I don't see it in
the downstream code, and I can't check the documentation.
(If you read it and it reports sensible values, I'd trust
that it's there.)
> +
> +static const u32 reg_idle_indication_cfg_fmask[] = {
> + [ENTER_IDLE_DEBOUNCE_THRESH] = GENMASK(15, 0),
> + [CONST_NON_IDLE_ENABLE] = BIT(16),
> + /* Bits 17-31 reserved */
> +};
> +
> +REG_FIELDS(IDLE_INDICATION_CFG, idle_indication_cfg, 0x00000220);
I concur, 0x220 for the IDLE_INDICATION_CFG register is
correct for IPA v4.1, while 0x240 is correct for IPA v4.2.
. . .
> +static const u32 reg_endp_init_hol_block_en_fmask[] = {
> + [HOL_BLOCK_EN] = BIT(0),
> + /* Bits 1-31 reserved */
> +};
> +
> +REG_STRIDE_FIELDS(ENDP_INIT_HOL_BLOCK_EN, endp_init_hol_block_en,
> + 0x0000082c, 0x0070);
> +
> +static const u32 reg_endp_init_hol_block_timer_fmask[] = {
> + [TIMER_BASE_VALUE] = GENMASK(31, 0),
Please align "= GENMASK..." the above with all the others.
IPA v3.5.1 included this comment too, which might be appropriate:
/* Entire register is a tick count */
> +};
> +
> +REG_STRIDE_FIELDS(ENDP_INIT_HOL_BLOCK_TIMER, endp_init_hol_block_timer,
> + 0x00000830, 0x0070);
> +
> +static const u32 reg_endp_init_deaggr_fmask[] = {
> + [DEAGGR_HDR_LEN] = GENMASK(5, 0),
> + [SYSPIPE_ERR_DETECTION] = BIT(6),
> + [PACKET_OFFSET_VALID] = BIT(7),
> + [PACKET_OFFSET_LOCATION] = GENMASK(13, 8),
> + [IGNORE_MIN_PKT_ERR] = BIT(14),
> + /* Bit 15 reserved */
> + [MAX_PACKET_LEN] = GENMASK(31, 16),
> +};
> +
> +REG_STRIDE_FIELDS(ENDP_INIT_DEAGGR, endp_init_deaggr, 0x00000834, 0x0070);
> +
> +static const u32 reg_endp_init_rsrc_grp_fmask[] = {
> + [ENDP_RSRC_GRP] = GENMASK(1, 0),
Please align "= GENMASK..." the above with all the others.
Also add this, as is done in *all* other definitions:
/* Bits 1-31 reserved */
> +};
> +
> +REG_STRIDE_FIELDS(ENDP_INIT_RSRC_GRP, endp_init_rsrc_grp, 0x00000838, 0x0070);
> +
> +static const u32 reg_endp_init_seq_fmask[] = {
> + [SEQ_TYPE] = GENMASK(7, 0),
> + [SEQ_REP_TYPE] = GENMASK(15, 8),
> + /* Bits 16-31 reserved */
> +};
> +
> +REG_STRIDE_FIELDS(ENDP_INIT_SEQ, endp_init_seq, 0x0000083c, 0x0070);
. . .
> +
> +static const struct reg *reg_array[] = {
> + [ENDP_INIT_CTRL] = ®_endp_init_ctrl,
> + [ENDP_FILTER_ROUTER_HSH_CFG] = ®_endp_filter_router_hsh_cfg,
> + [COMP_CFG] = ®_comp_cfg,
> + [CLKON_CFG] = ®_clkon_cfg,
> + [ROUTE] = ®_route,
> + [SHARED_MEM_SIZE] = ®_shared_mem_size,
> + [QSB_MAX_WRITES] = ®_qsb_max_writes,
> + [QSB_MAX_READS] = ®_qsb_max_reads,
> +
Why a blank line here?
-Alex
> + [FILT_ROUT_HASH_FLUSH] = ®_filt_rout_hash_flush,
> + [STATE_AGGR_ACTIVE] = ®_state_aggr_active,
> + [IPA_BCR] = ®_ipa_bcr,
> + [LOCAL_PKT_PROC_CNTXT] = ®_local_pkt_proc_cntxt,
> + [AGGR_FORCE_CLOSE] = ®_aggr_force_close,
> + [COUNTER_CFG] = ®_counter_cfg,
> + [IPA_TX_CFG] = ®_ipa_tx_cfg,
> + [FLAVOR_0] = ®_flavor_0,
> + [IDLE_INDICATION_CFG] = ®_idle_indication_cfg,
> + [SRC_RSRC_GRP_01_RSRC_TYPE] = ®_src_rsrc_grp_01_rsrc_type,
> + [SRC_RSRC_GRP_23_RSRC_TYPE] = ®_src_rsrc_grp_23_rsrc_type,
> + [DST_RSRC_GRP_01_RSRC_TYPE] = ®_dst_rsrc_grp_01_rsrc_type,
> + [DST_RSRC_GRP_23_RSRC_TYPE] = ®_dst_rsrc_grp_23_rsrc_type,
> + [ENDP_INIT_CFG] = ®_endp_init_cfg,
> + [ENDP_INIT_NAT] = ®_endp_init_nat,
> + [ENDP_INIT_HDR] = ®_endp_init_hdr,
> + [ENDP_INIT_HDR_EXT] = ®_endp_init_hdr_ext,
> + [ENDP_INIT_HDR_METADATA_MASK] = ®_endp_init_hdr_metadata_mask,
> + [ENDP_INIT_MODE] = ®_endp_init_mode,
> + [ENDP_INIT_AGGR] = ®_endp_init_aggr,
> + [ENDP_INIT_HOL_BLOCK_EN] = ®_endp_init_hol_block_en,
> + [ENDP_INIT_HOL_BLOCK_TIMER] = ®_endp_init_hol_block_timer,
> + [ENDP_INIT_DEAGGR] = ®_endp_init_deaggr,
> + [ENDP_INIT_RSRC_GRP] = ®_endp_init_rsrc_grp,
> + [ENDP_INIT_SEQ] = ®_endp_init_seq,
> + [ENDP_STATUS] = ®_endp_status,
> + [IPA_IRQ_STTS] = ®_ipa_irq_stts,
> + [IPA_IRQ_EN] = ®_ipa_irq_en,
> + [IPA_IRQ_CLR] = ®_ipa_irq_clr,
> + [IPA_IRQ_UC] = ®_ipa_irq_uc,
> + [IRQ_SUSPEND_INFO] = ®_irq_suspend_info,
> + [IRQ_SUSPEND_EN] = ®_irq_suspend_en,
> + [IRQ_SUSPEND_CLR] = ®_irq_suspend_clr,
> +};
> +
> +const struct regs ipa_regs_v4_1 = {
> + .reg_count = ARRAY_SIZE(reg_array),
> + .reg = reg_array,
> +};
>
next prev parent reply other threads:[~2026-12-04 22:54 UTC|newest]
Thread overview: 11+ 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 ` [PATCH net-next 1/3] dt-bindings: net: qcom,ipa: add qcom,sc8180x-ipa compatible Robert Ijtsma via B4 Relay
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-29 0:43 ` netdev-bot+sashiko
2026-11-29 10:59 ` Robert IJtsma
2026-12-04 22:54 ` Alex Elder [this message]
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-25 10:49 ` Konrad Dybcio
2026-11-29 0:43 ` netdev-bot+sashiko
2026-12-04 22:54 ` Alex Elder
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=6bb44016-c84c-473f-89db-ff296241a0b3@ieee.org \
--to=elder@ieee.org \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=elder@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robertijtsma@gmail.com \
--cc=robh@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®