net: final GSI register updates
cover net: final GSI register updates
I believe this is the last set of changes required to allow IPA v5.0 to be supported. There is a little cleanup work remaining, but that can happen in the next Linux release cycle. Otherwise we just need config data and register definitions for IPA v5.0 (and DTS updates). These are ready but won't be posted without further testing.
The first patch in this series fixes a minor bug in a patch just posted, which I found too late. The second eliminates the GSI memory "adjustment"; this was done previously to avoid/delay the need to implement a more general way to define GSI register offsets. Note that this patch causes "checkpatch" warnings due to indentation that aligns with an open parenthesis.
The third patch makes use of the newly-defined register offsets, to eliminate the need for a function that hid a few details. The next modifies a different helper function to work properly for IPA v5.0+. The fifth patch changes the way the event ring size is specified based on how it's now done for IPA v5.0+. And the last defines a new register required for IPA v5.0+.
-Alex
Alex Elder (6):
net: ipa: fix an incorrect assignment
net: ipa: kill gsi->virt_raw
net: ipa: kill ev_ch_e_cntxt_1_length_encode()
net: ipa: avoid setting an undefined field
net: ipa: support different event ring encoding
net: ipa: add HW_PARAM_4 GSI register
drivers/net/ipa/gsi.c | 36 ++++----- drivers/net/ipa/gsi.h | 3 +- drivers/net/ipa/gsi_reg.c | 35 ++------ drivers/net/ipa/gsi_reg.h | 23 ++++-- drivers/net/ipa/reg/gsi_reg-v3.1.c | 22 ++--- drivers/net/ipa/reg/gsi_reg-v3.5.1.c | 22 ++--- drivers/net/ipa/reg/gsi_reg-v4.0.c | 22 ++--- drivers/net/ipa/reg/gsi_reg-v4.11.c | 116 ++++++++++++++------------- drivers/net/ipa/reg/gsi_reg-v4.5.c | 64 ++++++++------- drivers/net/ipa/reg/gsi_reg-v4.9.c | 74 ++++++++--------- 10 files changed, 205 insertions(+), 212 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/6 net: ipa: fix an incorrect assignment
I spotted an error in a patch posted this week, unfortunately just after it got accepted. The effect of the bug is that time-based interrupt moderation is disabled. This is not technically a bug, but it is not what is intended. The problem is that a |= assignment got implemented as a simple assignment, so the previously assigned value was ignored.
--- drivers/net/ipa/gsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/gsi.c +1 -1
@@ -762,7 +762,7 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id)/* Enable interrupt moderation by setting the moderation delay */ reg =gsi_reg (gsi,EV_CH_E_CNTXT_8 ); val =reg_encode (reg,EV_MODT ,GSI_EVT_RING_INT_MODT ); - val =reg_encode (reg,EV_MODC ,1 );/* comes from channel */ + val |=reg_encode (reg,EV_MODC ,1 );/* comes from channel */ /* EV_MOD_CNT is 0 (no counter-based interrupt coalescing) */ iowrite32 (val, gsi->virt +reg_n_offset (reg, evt_ring_id));
Signature · 1 line
2.34.1
PATCH 2/6 net: ipa: kill gsi->virt_raw
In reply to Alex ElderStarting at IPA v4.5, almost all GSI registers had their offsets changed by a fixed amount (shifted downward by 0xd000). Rather than defining offsets for all those registers dependent on version, an adjustment was applied for most register accesses. This was implemented in commit cdeee49f3ef7f ("net: ipa: adjust GSI register addresses"). It was later modified to be a bit more obvious about the adjusment, in commit 571b1e7e58ad3 ("net: ipa: use a separate pointer for adjusted GSI memory").
We now are able to define every GSI register with its own offset, so there's no need to implement this special adjustment.
So get rid of the "virt_raw" pointer, and just maintain "virt" as the (non-adjusted) base address of I/O mapped GSI register memory.
Redefine the offsets of all GSI registers (other than the INTER_EE ones, which were not subject to the adjustment) for IPA v4.5+, subtracting 0xd000 from their defined offsets instead.
Move the ERROR_LOG and ERROR_LOG_CLR definitions further down in the register definition files so all registers are defined in order of their offset.
--- drivers/net/ipa/gsi.c | 5 +- drivers/net/ipa/gsi.h | 3 +- drivers/net/ipa/gsi_reg.c | 35 ++------- drivers/net/ipa/gsi_reg.h | 3 +- drivers/net/ipa/reg/gsi_reg-v3.1.c | 14 ++-- drivers/net/ipa/reg/gsi_reg-v3.5.1.c | 14 ++-- drivers/net/ipa/reg/gsi_reg-v4.0.c | 14 ++-- drivers/net/ipa/reg/gsi_reg-v4.11.c | 110 +++++++++++++-------------- drivers/net/ipa/reg/gsi_reg-v4.5.c | 58 +++++++------- drivers/net/ipa/reg/gsi_reg-v4.9.c | 66 ++++++++-------- 10 files changed, 141 insertions(+), 181 deletions(-)
drivers/net/ipa/gsi.c +2 -3
@@ -1999,12 +1999,11 @@ static int gsi_irq_setup(struct gsi *gsi)/* The inter-EE interrupts are not supported for IPA v3.0-v3.1 */ if (gsi->version >IPA_VERSION_3_1 ) { -/* These registers are in the non-adjusted address range */ reg =gsi_reg (gsi,INTER_EE_SRC_CH_IRQ_MSK ); -iowrite32 (0 , gsi->virt_raw +reg_offset (reg)); +iowrite32 (0 , gsi->virt +reg_offset (reg)); reg =gsi_reg (gsi,INTER_EE_SRC_EV_CH_IRQ_MSK ); -iowrite32 (0 , gsi->virt_raw +reg_offset (reg)); +iowrite32 (0 , gsi->virt +reg_offset (reg)); } reg =gsi_reg (gsi,CNTXT_GSI_IRQ_EN );
drivers/net/ipa/gsi.h +1 -2
@@ -140,8 +140,7 @@ struct gsi_evt_ring {struct gsi {struct device *dev;/* Same as IPA device */ enum ipa_version version; -void __iomem *virt_raw;/* I/O mapped address range */ -void __iomem *virt;/* Adjusted for most registers */ +void __iomem *virt;/* I/O mapped registers */ const struct regs *regs;u32 irq;
drivers/net/ipa/gsi_reg.c +5 -30
@@ -9,20 +9,6 @@#include "reg.h" #include "gsi_reg.h" -/* GSI EE registers as a group are shifted downward by a fixed constant amount -* for IPA versions 4.5 and beyond. This applies to all GSI registers we use -* *except* the ones that disable inter-EE interrupts for channels and event -* channels. -* -* The "raw" (not adjusted) GSI register range is mapped, and a pointer to -* the mapped range is held in gsi->virt_raw. The inter-EE interrupt -* registers are accessed using that pointer. -* -* Most registers are accessed using gsi->virt, which is a copy of the "raw" -* pointer, adjusted downward by the fixed amount. -*/ -#define GSI_EE_REG_ADJUST 0x0000d000/* IPA v4.5+ */ -/* Is this register ID valid for the current GSI version? */ static bool gsi_reg_id_valid (struct gsi *gsi,enum gsi_reg_id reg_id) {
@@ -121,13 +107,12 @@ static const struct regs *gsi_regs(struct gsi *gsi) } } -/* Sets gsi->virt_raw and gsi->virt, and I/O maps the "gsi" memory range */ +/* Sets gsi->virt and I/O maps the "gsi" memory range for registers */ int gsi_reg_init (struct gsi *gsi,struct platform_device *pdev) {struct device *dev = &pdev->dev;struct resource *res;resource_size_t size; -u32 adjust;/* Get GSI memory range and map it */ res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"gsi" );
@@ -142,27 +127,17 @@ int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev)return -EINVAL ; } -/* Make sure we can make our pointer adjustment if necessary */ - adjust = gsi->version <IPA_VERSION_4_5 ?0 :GSI_EE_REG_ADJUST ; -if (res->start < adjust) { -dev_err (dev,"DT memory resource \"gsi\" too low (< %u)\n" , - adjust); -return -EINVAL ; - } - gsi->regs =gsi_regs (gsi);if (!gsi->regs) {dev_err (dev,"unsupported IPA version %u (?)\n" , gsi->version);return -EINVAL ; } - gsi->virt_raw =ioremap (res->start, size); -if (!gsi->virt_raw) { + gsi->virt =ioremap (res->start, size); +if (!gsi->virt) {dev_err (dev,"unable to remap \"gsi\" memory\n" );return -ENOMEM ; } -/* Most registers are accessed using an adjusted register range */ - gsi->virt = gsi->virt_raw - adjust;return 0 ; }
@@ -170,7 +145,7 @@ int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev)/* Inverse of gsi_reg_init() */ void gsi_reg_exit (struct gsi *gsi) { +iounmap (gsi->virt); gsi->virt =NULL ; -iounmap (gsi->virt_raw); - gsi->virt_raw =NULL ; + gsi->regs =NULL ; }
drivers/net/ipa/gsi_reg.h +1 -2
@@ -351,8 +351,7 @@ const struct reg *gsi_reg(struct gsi *gsi, enum gsi_reg_id reg_id);* @pdev: GSI (IPA) platform device * * Initialize GSI registers, including looking up and I/O mapping -* the "gsi" memory space. This function sets gsi->virt_raw and -* gsi->virt. +* the "gsi" memory space. */ int gsi_reg_init (struct gsi *gsi,struct platform_device *pdev);
drivers/net/ipa/reg/gsi_reg-v3.1.c +6 -8
@@ -8,16 +8,12 @@#include "../reg.h" #include "../gsi_reg.h" -/* The inter-EE IRQ registers are relative to gsi->virt_raw (IPA v3.5+) */ -REG (INTER_EE_SRC_CH_IRQ_MSK , inter_ee_src_ch_irq_msk,0x0000c020 +0x1000 *GSI_EE_AP );REG (INTER_EE_SRC_EV_CH_IRQ_MSK , inter_ee_src_ev_ch_irq_msk,0x0000c024 +0x1000 *GSI_EE_AP ); -/* All other register offsets are relative to gsi->virt */ -static const u32 reg_ch_c_cntxt_0_fmask[] = { [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), [CHTYPE_DIR ] =BIT (3 ),
@@ -66,10 +62,6 @@ static const u32 reg_error_log_fmask[] = { [ERR_EE ] =GENMASK (31 ,28 ), }; -REG_FIELDS (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP ); - -REG (ERROR_LOG_CLR , error_log_clr,0x0001f210 +0x4000 *GSI_EE_AP ); -REG_STRIDE (CH_C_SCRATCH_0 , ch_c_scratch_0,0x0001c060 +0x4000 *GSI_EE_AP ,0x80 );
@@ -152,6 +144,7 @@ REG_FIELDS(GSI_STATUS, gsi_status, 0x0001f000 + 0x4000 * GSI_EE_AP);static const u32 reg_ch_cmd_fmask[] = { [CH_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [CH_OPCODE ] =GENMASK (31 ,24 ), };
@@ -159,6 +152,7 @@ REG_FIELDS(CH_CMD, ch_cmd, 0x0001f008 + 0x4000 * GSI_EE_AP);static const u32 reg_ev_ch_cmd_fmask[] = { [EV_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [EV_OPCODE ] =GENMASK (31 ,24 ), };
@@ -220,6 +214,10 @@ static const u32 reg_cntxt_intset_fmask[] = {REG_FIELDS (CNTXT_INTSET , cntxt_intset,0x0001f180 +0x4000 *GSI_EE_AP ); +REG_FIELDS (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP ); + +REG (ERROR_LOG_CLR , error_log_clr,0x0001f210 +0x4000 *GSI_EE_AP ); +static const u32 reg_cntxt_scratch_0_fmask[] = { [INTER_EE_RESULT ] =GENMASK (2 ,0 ),/* Bits 3-4 reserved */
drivers/net/ipa/reg/gsi_reg-v3.5.1.c +6 -8
@@ -8,16 +8,12 @@#include "../reg.h" #include "../gsi_reg.h" -/* The inter-EE IRQ registers are relative to gsi->virt_raw (IPA v3.5+) */ -REG (INTER_EE_SRC_CH_IRQ_MSK , inter_ee_src_ch_irq_msk,0x0000c020 +0x1000 *GSI_EE_AP );REG (INTER_EE_SRC_EV_CH_IRQ_MSK , inter_ee_src_ev_ch_irq_msk,0x0000c024 +0x1000 *GSI_EE_AP ); -/* All other register offsets are relative to gsi->virt */ -static const u32 reg_ch_c_cntxt_0_fmask[] = { [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), [CHTYPE_DIR ] =BIT (3 ),
@@ -66,10 +62,6 @@ static const u32 reg_error_log_fmask[] = { [ERR_EE ] =GENMASK (31 ,28 ), }; -REG_FIELDS (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP ); - -REG (ERROR_LOG_CLR , error_log_clr,0x0001f210 +0x4000 *GSI_EE_AP ); -REG_STRIDE (CH_C_SCRATCH_0 , ch_c_scratch_0,0x0001c060 +0x4000 *GSI_EE_AP ,0x80 );
@@ -152,6 +144,7 @@ REG_FIELDS(GSI_STATUS, gsi_status, 0x0001f000 + 0x4000 * GSI_EE_AP);static const u32 reg_ch_cmd_fmask[] = { [CH_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [CH_OPCODE ] =GENMASK (31 ,24 ), };
@@ -159,6 +152,7 @@ REG_FIELDS(CH_CMD, ch_cmd, 0x0001f008 + 0x4000 * GSI_EE_AP);static const u32 reg_ev_ch_cmd_fmask[] = { [EV_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [EV_OPCODE ] =GENMASK (31 ,24 ), };
@@ -231,6 +225,10 @@ static const u32 reg_cntxt_intset_fmask[] = {REG_FIELDS (CNTXT_INTSET , cntxt_intset,0x0001f180 +0x4000 *GSI_EE_AP ); +REG_FIELDS (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP ); + +REG (ERROR_LOG_CLR , error_log_clr,0x0001f210 +0x4000 *GSI_EE_AP ); +static const u32 reg_cntxt_scratch_0_fmask[] = { [INTER_EE_RESULT ] =GENMASK (2 ,0 ),/* Bits 3-4 reserved */
drivers/net/ipa/reg/gsi_reg-v4.0.c +6 -8
@@ -8,16 +8,12 @@#include "../reg.h" #include "../gsi_reg.h" -/* The inter-EE IRQ registers are relative to gsi->virt_raw (IPA v3.5+) */ -REG (INTER_EE_SRC_CH_IRQ_MSK , inter_ee_src_ch_irq_msk,0x0000c020 +0x1000 *GSI_EE_AP );REG (INTER_EE_SRC_EV_CH_IRQ_MSK , inter_ee_src_ev_ch_irq_msk,0x0000c024 +0x1000 *GSI_EE_AP ); -/* All other register offsets are relative to gsi->virt */ -static const u32 reg_ch_c_cntxt_0_fmask[] = { [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), [CHTYPE_DIR ] =BIT (3 ),
@@ -67,10 +63,6 @@ static const u32 reg_error_log_fmask[] = { [ERR_EE ] =GENMASK (31 ,28 ), }; -REG_FIELDS (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP ); - -REG (ERROR_LOG_CLR , error_log_clr,0x0001f210 +0x4000 *GSI_EE_AP ); -REG_STRIDE (CH_C_SCRATCH_0 , ch_c_scratch_0,0x0001c060 +0x4000 *GSI_EE_AP ,0x80 );
@@ -153,6 +145,7 @@ REG_FIELDS(GSI_STATUS, gsi_status, 0x0001f000 + 0x4000 * GSI_EE_AP);static const u32 reg_ch_cmd_fmask[] = { [CH_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [CH_OPCODE ] =GENMASK (31 ,24 ), };
@@ -160,6 +153,7 @@ REG_FIELDS(CH_CMD, ch_cmd, 0x0001f008 + 0x4000 * GSI_EE_AP);static const u32 reg_ev_ch_cmd_fmask[] = { [EV_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [EV_OPCODE ] =GENMASK (31 ,24 ), };
@@ -236,6 +230,10 @@ static const u32 reg_cntxt_intset_fmask[] = {REG_FIELDS (CNTXT_INTSET , cntxt_intset,0x0001f180 +0x4000 *GSI_EE_AP ); +REG_FIELDS (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP ); + +REG (ERROR_LOG_CLR , error_log_clr,0x0001f210 +0x4000 *GSI_EE_AP ); +static const u32 reg_cntxt_scratch_0_fmask[] = { [INTER_EE_RESULT ] =GENMASK (2 ,0 ),/* Bits 3-4 reserved */
drivers/net/ipa/reg/gsi_reg-v4.11.c +54 -56
258 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v4.5.c +28 -30
155 lines not on this page · raw message
drivers/net/ipa/reg/gsi_reg-v4.9.c +32 -34
157 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 3/6 net: ipa: kill ev_ch_e_cntxt_1_length_encode()
In reply to Alex ElderNow that we explicitly define each register field width there is no need to have a special encoding function for the event ring length. Add a field for this to the EV_CH_E_CNTXT_1 GSI register, and use it in place of ev_ch_e_cntxt_1_length_encode() (which can be removed).
--- drivers/net/ipa/gsi.c | 15 +-------------- drivers/net/ipa/gsi_reg.h | 6 ++++++ drivers/net/ipa/reg/gsi_reg-v3.1.c | 8 ++++++-- drivers/net/ipa/reg/gsi_reg-v3.5.1.c | 8 ++++++-- drivers/net/ipa/reg/gsi_reg-v4.0.c | 8 ++++++-- drivers/net/ipa/reg/gsi_reg-v4.11.c | 8 ++++++-- drivers/net/ipa/reg/gsi_reg-v4.5.c | 8 ++++++-- drivers/net/ipa/reg/gsi_reg-v4.9.c | 8 ++++++-- 8 files changed, 43 insertions(+), 26 deletions(-)
drivers/net/ipa/gsi.c +1 -14
@@ -193,17 +193,6 @@ static u32 ch_c_cntxt_0_type_encode(enum ipa_version version,return val |reg_encode (reg,CHTYPE_PROTOCOL_MSB , type); } -/* Encode the length of the event channel ring buffer for the -* EV_CH_E_CNTXT_1 register. -*/ -static u32 ev_ch_e_cntxt_1_length_encode (enum ipa_version version,u32 length) -{ -if (version <IPA_VERSION_4_9 ) -return u32_encode_bits (length,GENMASK (15 ,0 )); - -return u32_encode_bits (length,GENMASK (19 ,0 )); -} -/* Update the GSI IRQ type register with the cached value */ static void gsi_irq_type_update (struct gsi *gsi,u32 val) {
@@ -731,7 +720,6 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id)struct gsi_evt_ring *evt_ring = &gsi->evt_ring[evt_ring_id];struct gsi_ring *ring = &evt_ring->ring;const struct reg *reg; -size_t size;u32 val; reg =gsi_reg (gsi,EV_CH_E_CNTXT_0 );
@@ -743,8 +731,7 @@ static void gsi_evt_ring_program(struct gsi *gsi, u32 evt_ring_id)iowrite32 (val, gsi->virt +reg_n_offset (reg, evt_ring_id)); reg =gsi_reg (gsi,EV_CH_E_CNTXT_1 ); - size = ring->count *GSI_RING_ELEMENT_SIZE ; - val =ev_ch_e_cntxt_1_length_encode (gsi->version, size); + val =reg_encode (reg,R_LENGTH , ring->count *GSI_RING_ELEMENT_SIZE );iowrite32 (val, gsi->virt +reg_n_offset (reg, evt_ring_id));/* The context 2 and 3 registers store the low-order and
drivers/net/ipa/gsi_reg.h +6 -0
@@ -135,6 +135,7 @@ enum gsi_reg_ch_c_qos_field_id {PREFETCH_MODE ,/* IPA v4.5+ */ EMPTY_LVL_THRSHOLD ,/* IPA v4.5+ */ DB_IN_BYTES ,/* IPA v4.9+ */ + LOW_LATENCY_EN, /* IPA v5.0+ */ };/** enum gsi_prefetch_mode - PREFETCH_MODE field in CH_C_QOS */
@@ -155,6 +156,11 @@ enum gsi_reg_ch_c_ev_ch_e_cntxt_0_field_id { EV_ELEMENT_SIZE, }; +/* EV_CH_E_CNTXT_1 register */ +enum gsi_reg_ev_ch_c_cntxt_1_field_id { +R_LENGTH , +}; +/* EV_CH_E_CNTXT_8 register */ enum gsi_reg_ch_c_ev_ch_e_cntxt_8_field_id {EV_MODT ,
drivers/net/ipa/reg/gsi_reg-v3.1.c +6 -2
@@ -87,8 +87,12 @@ static const u32 reg_ev_ch_e_cntxt_0_fmask[] = {REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0,0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, -0x0001d004 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_1_fmask[] = { + [R_LENGTH ] =GENMASK (15 ,0 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, +0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_2 , ev_ch_e_cntxt_2,0x0001d008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v3.5.1.c +6 -2
@@ -87,8 +87,12 @@ static const u32 reg_ev_ch_e_cntxt_0_fmask[] = {REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0,0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, -0x0001d004 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_1_fmask[] = { + [R_LENGTH ] =GENMASK (15 ,0 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, +0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_2 , ev_ch_e_cntxt_2,0x0001d008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.0.c +6 -2
@@ -88,8 +88,12 @@ static const u32 reg_ev_ch_e_cntxt_0_fmask[] = {REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0,0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, -0x0001d004 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_1_fmask[] = { + [R_LENGTH ] =GENMASK (15 ,0 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, +0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_2 , ev_ch_e_cntxt_2,0x0001d008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.11.c +6 -2
@@ -91,8 +91,12 @@ static const u32 reg_ev_ch_e_cntxt_0_fmask[] = {REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0,0x00010000 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, -0x00010004 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_1_fmask[] = { + [R_LENGTH ] =GENMASK (19 ,0 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, +0x00010004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_2 , ev_ch_e_cntxt_2,0x00010008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.5.c +6 -2
@@ -90,8 +90,12 @@ static const u32 reg_ev_ch_e_cntxt_0_fmask[] = {REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0,0x00010000 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, -0x00010004 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_1_fmask[] = { + [R_LENGTH ] =GENMASK (15 ,0 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, +0x00010004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_2 , ev_ch_e_cntxt_2,0x00010008 +0x4000 *GSI_EE_AP ,0x80 );
drivers/net/ipa/reg/gsi_reg-v4.9.c +6 -2
@@ -91,8 +91,12 @@ static const u32 reg_ev_ch_e_cntxt_0_fmask[] = {REG_STRIDE_FIELDS (EV_CH_E_CNTXT_0 , ev_ch_e_cntxt_0,0x0001d000 +0x4000 *GSI_EE_AP ,0x80 ); -REG_STRIDE (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, -0x0001d004 +0x4000 *GSI_EE_AP ,0x80 ); +static const u32 reg_ev_ch_e_cntxt_1_fmask[] = { + [R_LENGTH ] =GENMASK (15 ,0 ), +}; + +REG_STRIDE_FIELDS (EV_CH_E_CNTXT_1 , ev_ch_e_cntxt_1, +0x0001d004 +0x4000 *GSI_EE_AP ,0x80 );REG_STRIDE (EV_CH_E_CNTXT_2 , ev_ch_e_cntxt_2,0x0001d008 +0x4000 *GSI_EE_AP ,0x80 );
Signature · 1 line
2.34.1
PATCH 4/6 net: ipa: avoid setting an undefined field
In reply to Alex ElderThe GSI channel protocol field in the CH_C_CNTXT_0 GSI register is widened starting IPA v5.0, making the CHTYPE_PROTOCOL_MSB field added in IPA v4.5 unnecessary. Update the code to reflect this.
--- drivers/net/ipa/gsi.c | 2 +- drivers/net/ipa/gsi_reg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ipa/gsi.c +1 -1
@@ -185,7 +185,7 @@ static u32 ch_c_cntxt_0_type_encode(enum ipa_version version,u32 val; val =reg_encode (reg,CHTYPE_PROTOCOL , type); -if (version <IPA_VERSION_4_5 ) +if (version <IPA_VERSION_4_5 || version >=IPA_VERSION_5_0 )return val; type >>=hweight32 (reg_fmask (reg,CHTYPE_PROTOCOL ));
drivers/net/ipa/gsi_reg.h +1 -1
@@ -101,7 +101,7 @@ enum gsi_reg_ch_c_cntxt_0_field_id {CHTYPE_DIR ,CH_EE ,CHID , -CHTYPE_PROTOCOL_MSB ,/* IPA v4.9+ */ +CHTYPE_PROTOCOL_MSB ,/* IPA v4.5-4.11 */ ERINDEX ,CHSTATE , ELEMENT_SIZE,
Signature · 1 line
2.34.1
PATCH 5/6 net: ipa: support different event ring encoding
In reply to Alex ElderStarting with IPA v5.0, a channel's event ring index is encoded in a field in the CH_C_CNTXT_1 GSI register rather than CH_C_CNTXT_0. Define a new field ID for the former register and encode the event ring in the appropriate register.
--- drivers/net/ipa/gsi.c | 5 ++++- drivers/net/ipa/gsi_reg.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ipa/gsi.c +4 -1
@@ -840,12 +840,15 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) val =ch_c_cntxt_0_type_encode (gsi->version, reg,GSI_CHANNEL_TYPE_GPI );if (channel->toward_ipa) val |=reg_bit (reg,CHTYPE_DIR ); - val |=reg_encode (reg,ERINDEX , channel->evt_ring_id); +if (gsi->version <IPA_VERSION_5_0 ) + val |=reg_encode (reg,ERINDEX , channel->evt_ring_id); val |=reg_encode (reg,ELEMENT_SIZE ,GSI_RING_ELEMENT_SIZE );iowrite32 (val, gsi->virt +reg_n_offset (reg, channel_id)); reg =gsi_reg (gsi,CH_C_CNTXT_1 ); val =reg_encode (reg,CH_R_LENGTH , size); +if (gsi->version >=IPA_VERSION_5_0 ) + val |=reg_encode (reg,CH_ERINDEX , channel->evt_ring_id);iowrite32 (val, gsi->virt +reg_n_offset (reg, channel_id));/* The context 2 and 3 registers store the low-order and
drivers/net/ipa/gsi_reg.h +2 -1
@@ -102,7 +102,7 @@ enum gsi_reg_ch_c_cntxt_0_field_id {CH_EE ,CHID ,CHTYPE_PROTOCOL_MSB ,/* IPA v4.5-4.11 */ -ERINDEX , +ERINDEX ,/* Not IPA v5.0+ */ CHSTATE , ELEMENT_SIZE, };
@@ -124,6 +124,7 @@ enum gsi_channel_type {/* CH_C_CNTXT_1 register */ enum gsi_reg_ch_c_cntxt_1_field_id {CH_R_LENGTH , +CH_ERINDEX ,/* IPA v5.0+ */ };/* CH_C_QOS register */
Signature · 1 line
2.34.1
PATCH 6/6 net: ipa: add HW_PARAM_4 GSI register
In reply to Alex ElderStarting at IPA v5.0, the number of event rings per EE is defined in a field in a new HW_PARAM_4 GSI register rather than HW_PARAM_2. Define this new register and its fields, and update the code that checks the number of rings supported by hardware to use the proper field based on IPA version.
--- drivers/net/ipa/gsi.c | 7 ++++++- drivers/net/ipa/gsi_reg.h | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/net/ipa/gsi.c +6 -1
@@ -2042,7 +2042,12 @@ static int gsi_ring_setup(struct gsi *gsi) } gsi->channel_count = count; - count =reg_decode (reg,NUM_EV_PER_EE , val); +if (gsi->version <IPA_VERSION_5_0 ) { + count =reg_decode (reg,NUM_EV_PER_EE , val); + }else { + reg =gsi_reg (gsi,HW_PARAM_4 ); + count =reg_decode (reg,EV_PER_EE , val); + }if (!count) {dev_err (dev,"GSI reports zero event rings supported\n" );return -EINVAL ;
drivers/net/ipa/gsi_reg.h +8 -1
@@ -71,6 +71,7 @@ enum gsi_reg_id {EV_CH_CMD ,GENERIC_CMD ,HW_PARAM_2 ,/* IPA v3.5.1+ */ +HW_PARAM_4 ,/* IPA v5.0+ */ CNTXT_TYPE_IRQ ,CNTXT_TYPE_IRQ_MSK , CNTXT_SRC_CH_IRQ,
@@ -224,7 +225,7 @@ enum gsi_generic_cmd_opcode {enum gsi_hw_param_2_field_id {IRAM_SIZE ,NUM_CH_PER_EE , -NUM_EV_PER_EE , +NUM_EV_PER_EE ,/* Not IPA v5.0+ */ GSI_CH_PEND_TRANSLATE ,GSI_CH_FULL_LOGIC ,GSI_USE_SDMA ,/* IPA v4.0+ */
@@ -247,6 +248,12 @@ enum gsi_iram_size { IRAM_SIZE_FOUR_KB = 0x5, }; +/* HW_PARAM_4 register */ /* IPA v5.0+ */ +enum gsi_hw_param_4_field_id { +EV_PER_EE , +IRAM_PROTOCOL_COUNT , +}; +/** * enum gsi_irq_type_id: GSI IRQ types * @GSI_CH_CTRL: Channel allocation, deallocation, etc.
Signature · 1 line
2.34.1
Re: [PATCH net-next 2/6] net: ipa: kill gsi->virt_raw
In reply to Alex ElderFrom: Alex Elder <[email protected]>
Date: Wed, 15 Feb 2023 13:53:48 -0600
Quoted 8 lines
Starting at IPA v4.5, almost all GSI registers had their offsets changed by a fixed amount (shifted downward by
0xd000). Rather than defining offsets for all those registers dependent on version, an adjustment was applied for most register accesses. This was implemented in commitcdeee49f3ef7f("net: ipa: adjust GSI register addresses"). It was later modified to be a bit more obvious about the adjusment, in commit571b1e7e58ad3("net: ipa: use a separate pointer for adjusted GSI memory").
[...]
Quoted 11 lines
drivers/net/ipa/gsi_reg.c +0
-7@@ -142,27 +127,17 @@ int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev)return -EINVAL ; } -/* Make sure we can make our pointer adjustment if necessary */ - adjust = gsi->version <IPA_VERSION_4_5 ?0 :GSI_EE_REG_ADJUST ; -if (res->start < adjust) { -dev_err (dev,"DT memory resource \"gsi\" too low (< %u)\n" , - adjust); -return -EINVAL ; - }
drivers/net/ipa/gsi_reg.c int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev) · line 136
Quoted 10 lines
drivers/net/ipa/gsi_reg.c +1
-3- gsi->regs =gsi_regs (gsi);if (!gsi->regs) {dev_err (dev,"unsupported IPA version %u (?)\n" , gsi->version);return -EINVAL ; } - gsi->virt_raw =ioremap (res->start, size); -if (!gsi->virt_raw) { + gsi->virt =ioremap (res->start, size);
Now that at least one check above went away and the second one might be or be not correct (I thought ioremap core takes care of this), can't just devm_platform_ioremap_resource_byname() be used here for simplicity?
Quoted 10 lines
drivers/net/ipa/gsi_reg.c +1
-2+if (!gsi->virt) {dev_err (dev,"unable to remap \"gsi\" memory\n" );return -ENOMEM ; } -/* Most registers are accessed using an adjusted register range */ - gsi->virt = gsi->virt_raw - adjust;return 0 ; }
drivers/net/ipa/gsi_reg.c int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev) · line 148
Quoted 4 lines
drivers/net/ipa/gsi_reg.c +1
-0@@ -170,7 +145,7 @@ int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev)/* Inverse of gsi_reg_init() */ void gsi_reg_exit (struct gsi *gsi) { +iounmap (gsi->virt);
(don't forget to remove this unmap if you decide to switch to devm_)
Quoted 5 lines
drivers/net/ipa/gsi_reg.c +1
-2gsi->virt =NULL ; -iounmap (gsi->virt_raw); - gsi->virt_raw =NULL ; + gsi->regs =NULL ; }
[...]
Quoted 41 lines
drivers/net/ipa/reg/gsi_reg-v3.1.c +1
-8@@ -8,16 +8,12 @@#include "../reg.h" #include "../gsi_reg.h" -/* The inter-EE IRQ registers are relative to gsi->virt_raw (IPA v3.5+) */ -REG (INTER_EE_SRC_CH_IRQ_MSK , inter_ee_src_ch_irq_msk,0x0000c020 +0x1000 *GSI_EE_AP );REG (INTER_EE_SRC_EV_CH_IRQ_MSK , inter_ee_src_ev_ch_irq_msk,0x0000c024 +0x1000 *GSI_EE_AP ); -/* All other register offsets are relative to gsi->virt */ -static const u32 reg_ch_c_cntxt_0_fmask[] = { [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), [CHTYPE_DIR ] =BIT (3 ),@@ -66,10 +62,6 @@ static const u32 reg_error_log_fmask[] = { [ERR_EE ] =GENMASK (31 ,28 ), }; -REG_FIELDS (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP ); - -REG (ERROR_LOG_CLR , error_log_clr,0x0001f210 +0x4000 *GSI_EE_AP ); -REG_STRIDE (CH_C_SCRATCH_0 , ch_c_scratch_0,0x0001c060 +0x4000 *GSI_EE_AP ,0x80 );@@ -152,6 +144,7 @@ REG_FIELDS(GSI_STATUS, gsi_status, 0x0001f000 + 0x4000 * GSI_EE_AP);static const u32 reg_ch_cmd_fmask[] = { [CH_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [CH_OPCODE ] =GENMASK (31 ,24 ), };
drivers/net/ipa/reg/gsi_reg-v3.1.c REG_FIELDS(CH_CMD, ch_cmd, 0x0001f008 + 0x4000 * GSI_EE_AP); · line 158
Quoted 7 lines
drivers/net/ipa/reg/gsi_reg-v3.1.c +1
-0@@ -159,6 +152,7 @@ REG_FIELDS(CH_CMD, ch_cmd, 0x0001f008 + 0x4000 * GSI_EE_AP);static const u32 reg_ev_ch_cmd_fmask[] = { [EV_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [EV_OPCODE ] =GENMASK (31 ,24 ), };
[...]
(offtopic)
I hope all those gsi_reg-v*.c are autogenerated? They look pretty scary to be written and edited manually each time :D
Thanks,
Olek
Re: [PATCH net-next 2/6] net: ipa: kill gsi->virt_raw
Quoted 32 lines · Alexander Lobakin
From: Alex Elder <[email protected]>
Date: Wed, 15 Feb 2023 13:53:48 -0600Quoted 8 lines
Starting at IPA v4.5, almost all GSI registers had their offsets changed by a fixed amount (shifted downward by
0xd000). Rather than defining offsets for all those registers dependent on version, an adjustment was applied for most register accesses. This was implemented in commitcdeee49f3ef7f("net: ipa: adjust GSI register addresses"). It was later modified to be a bit more obvious about the adjusment, in commit571b1e7e58ad3("net: ipa: use a separate pointer for adjusted GSI memory").[...]
Quoted 18 lines
drivers/net/ipa/gsi_reg.c +0
-8@@ -142,27 +127,17 @@ int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev)return -EINVAL ; } -/* Make sure we can make our pointer adjustment if necessary */ - adjust = gsi->version <IPA_VERSION_4_5 ?0 :GSI_EE_REG_ADJUST ; -if (res->start < adjust) { -dev_err (dev,"DT memory resource \"gsi\" too low (< %u)\n" , - adjust); -return -EINVAL ; - } - gsi->regs =gsi_regs (gsi);if (!gsi->regs) {dev_err (dev,"unsupported IPA version %u (?)\n" , gsi->version);return -EINVAL ; }
Quoted 7 lines
drivers/net/ipa/gsi_reg.c int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev) · line 136
Quoted 3 lines
drivers/net/ipa/gsi_reg.c +1
-2- gsi->virt_raw =ioremap (res->start, size); -if (!gsi->virt_raw) { + gsi->virt =ioremap (res->start, size);Now that at least one check above went away and the second one might be or be not correct (I thought ioremap core takes care of this), can't just
devm_platform_ioremap_resource_byname()be used here for simplicity?
Previously, virt_raw would be the "real" re-mapped pointer, and then virt would be adjusted downward from that. It was a weird thing to do, because the result pointed to a non-mapped address. But all uses of the virt pointer added an offset that was enough to put the result into the mapped range.
The new code updates all offsets to account for what the adjustment previously did. The test that got removed isn't necessary any more.
Quoted 8 lines
Quoted 8 lines
drivers/net/ipa/gsi_reg.c +1
-2+if (!gsi->virt) {dev_err (dev,"unable to remap \"gsi\" memory\n" );return -ENOMEM ; } -/* Most registers are accessed using an adjusted register range */ - gsi->virt = gsi->virt_raw - adjust;
Quoted 9 lines
drivers/net/ipa/gsi_reg.c int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev) · line 148
Quoted 7 lines
drivers/net/ipa/gsi_reg.c +1
-0return 0 ; }@@ -170,7 +145,7 @@ int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev)/* Inverse of gsi_reg_init() */ void gsi_reg_exit (struct gsi *gsi) { +iounmap (gsi->virt);(don't forget to remove this unmap if you decide to switch to
devm_)
As far as devm_*() calls, I don't use those anywhere in the driver currently. If I were going to use them in one place I'd want do it consistently, everywhere. I don't want to do that.
Quoted 59 lines
Quoted 5 lines
drivers/net/ipa/gsi_reg.c +1
-2gsi->virt =NULL ; -iounmap (gsi->virt_raw); - gsi->virt_raw =NULL ; + gsi->regs =NULL ; }[...]
Quoted 48 lines
drivers/net/ipa/reg/gsi_reg-v3.1.c +2
-8@@ -8,16 +8,12 @@#include "../reg.h" #include "../gsi_reg.h" -/* The inter-EE IRQ registers are relative to gsi->virt_raw (IPA v3.5+) */ -REG (INTER_EE_SRC_CH_IRQ_MSK , inter_ee_src_ch_irq_msk,0x0000c020 +0x1000 *GSI_EE_AP );REG (INTER_EE_SRC_EV_CH_IRQ_MSK , inter_ee_src_ev_ch_irq_msk,0x0000c024 +0x1000 *GSI_EE_AP ); -/* All other register offsets are relative to gsi->virt */ -static const u32 reg_ch_c_cntxt_0_fmask[] = { [CHTYPE_PROTOCOL ] =GENMASK (2 ,0 ), [CHTYPE_DIR ] =BIT (3 ),@@ -66,10 +62,6 @@ static const u32 reg_error_log_fmask[] = { [ERR_EE ] =GENMASK (31 ,28 ), }; -REG_FIELDS (ERROR_LOG , error_log,0x0001f200 +0x4000 *GSI_EE_AP ); - -REG (ERROR_LOG_CLR , error_log_clr,0x0001f210 +0x4000 *GSI_EE_AP ); -REG_STRIDE (CH_C_SCRATCH_0 , ch_c_scratch_0,0x0001c060 +0x4000 *GSI_EE_AP ,0x80 );@@ -152,6 +144,7 @@ REG_FIELDS(GSI_STATUS, gsi_status, 0x0001f000 + 0x4000 * GSI_EE_AP);static const u32 reg_ch_cmd_fmask[] = { [CH_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [CH_OPCODE ] =GENMASK (31 ,24 ), };@@ -159,6 +152,7 @@ REG_FIELDS(CH_CMD, ch_cmd, 0x0001f008 + 0x4000 * GSI_EE_AP);static const u32 reg_ev_ch_cmd_fmask[] = { [EV_CHID ] =GENMASK (7 ,0 ), +/* Bits 8-23 reserved */ [EV_OPCODE ] =GENMASK (31 ,24 ), };[...]
Quoted 4 lines
(offtopic)
I hope all those gsi_reg-v*.c are autogenerated? They look pretty scary to be written and edited manually each time :D
I know they look scary, but no, they're manually generated and it's a real pain to review them. I try to be consistent enough that a "diff" is revealing and helpful. For the GSI registers, most of them don't change (until IPA v5.0). I intend to modify this a bit further so that registers that are the same as the previous version don't have to be re-stated (so each new version only has to highlight the differences).
All that said, once created, they don't change.
Thanks.
-Alex
Quoted 3 lines
Thanks,
Olek
Re: [PATCH net-next 2/6] net: ipa: kill gsi->virt_raw
From: Alex Elder <[email protected]>
Date: Thu, 16 Feb 2023 12:11:11 -0600
Quoted 3 lines · Alexander Lobakin
Quoted 2 lines
From: Alex Elder <[email protected]>
Date: Wed, 15 Feb 2023 13:53:48 -0600
[...]
Quoted 14 lines
Quoted 10 lines
Quoted 9 lines
gsi->regs=gsi_regs(gsi);
if (!gsi->regs) {
dev_err(dev, "unsupported IPA version %u (?)\n", gsi->version);
return-EINVAL;
}
-gsi->virt_raw=ioremap(res->start, size); - if (!gsi->virt_raw) {
+gsi->virt=ioremap(res->start, size);Quoted 3 lines
Now that at least one check above went away and the second one might be or be not correct (I thought ioremap core takes care of this), can't just
devm_platform_ioremap_resource_byname()be used here for simplicity?
Quoted 8 lines
Previously,
virt_rawwould be the "real" re-mapped pointer, and then virt would be adjusted downward from that. It was a weird thing to do, because the result pointed to a non-mapped address. But all uses of the virt pointer added an offset that was enough to put the result into the mapped range.The new code updates all offsets to account for what the adjustment previously did. The test that got removed isn't necessary any more.
Yeah I got it, just asked that maybe you can now use platform_ioremap_resource_byname() instead of platform_get_resource_byname() + ioremap() :)
Quoted 19 lines
Quoted 18 lines
Quoted 11 lines
+ if (!gsi->virt) {
dev_err(dev, "unable to remap \"gsi\" memory\n"); return-ENOMEM;
}
- /* Most registers are accessed using an adjusted register range */ -gsi->virt=gsi->virt_raw- adjust;
return 0;
}drivers/net/ipa/gsi_reg.c int gsi_reg_init(struct gsi *gsi, struct · line 149
Quoted 5 lines
drivers/net/ipa/gsi_reg.c +1
-0@@ -170,7 +145,7 @@ int gsi_reg_init(struct gsi *gsi, struct platform_device *pdev) /* Inverse of gsi_reg_init() */ void gsi_reg_exit(struct gsi *gsi) { + iounmap(gsi->virt);(don't forget to remove this unmap if you decide to switch to
devm_)
Quoted 3 lines
As far as devm_*() calls, I don't use those anywhere in the driver currently. If I were going to use them in one place I'd want do it consistently, everywhere. I don't want to do that.
+
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/net/ipa/gsi_reg.c +1
-2gsi->virt = NULL; - iounmap(gsi->virt_raw); - gsi->virt_raw = NULL; + gsi->regs = NULL;
[...]
Quoted 5 lines
Quoted 4 lines
(offtopic)
I hope all those gsi_reg-v*.c are autogenerated? They look pretty scary to be written and edited manually each time :D
Quoted 7 lines
I know they look scary, but no, they're manually generated and it's a real pain to review them. I try to be consistent enough that a "diff" is revealing and helpful. For the GSI registers, most of them don't change (until IPA v5.0). I intend to modify this a bit further so that registers that are the same as the previous version don't have to be re-stated (so each new version only has to highlight the differences).
No, it's +/- okay to review, as you say, they're pretty consistent in terms of code.
Quoted 6 lines
All that said, once created, they don't change.
Thanks.
-Alex
Thanks,
Olek
Re: [PATCH net-next 2/6] net: ipa: kill gsi->virt_raw
Quoted 7 lines · Alexander Lobakin
Quoted 7 lines
Quoted 1 line
just
devm_platform_ioremap_resource_byname()be used here for simplicity?Previously,
virt_rawwould be the "real" re-mapped pointer, and then virt would be adjusted downward from that. It was a weird thing to do, because the result pointed to a non-mapped address. But all uses of the virt pointer added an offset that was enough to put the result into the mapped range.
Quoted 5 lines
Quoted 2 lines
The new code updates all offsets to account for what the adjustment previously did. The test that got removed isn't necessary any more.
Yeah I got it, just asked that maybe you can now use
platform_ioremap_resource_byname()instead ofplatform_get_resource_byname()+ioremap():)
Sorry, I focused on the "devm" part and not this part. Yes I like that, but let me do that as a follow-on patch, and I think I can do it in more than this spot (possibly three, but I have to look closely).
Thanks.
-Alex
This series was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:
Quoted 6 lines · On Wed, 15 Feb 2023 13:53:46 -0600 you wrote:
I believe this is the last set of changes required to allow IPA v5.0 to be supported. There is a little cleanup work remaining, but that can happen in the next Linux release cycle. Otherwise we just need config data and register definitions for IPA v5.0 (and DTS updates). These are ready but won't be posted without further testing.
Quoted 8 lines
The first patch in this series fixes a minor bug in a patch just posted, which I found too late. The second eliminates the GSI memory "adjustment"; this was done previously to avoid/delay the need to implement a more general way to define GSI register offsets. Note that this patch causes "checkpatch" warnings due to indentation that aligns with an open parenthesis.
[...]
Here is the summary with links:
- [net-next,1/6] net: ipa: fix an incorrect assignment
https://git.kernel.org/netdev/net-next/c/ecfa80ce3b87 - [net-next,2/6] net: ipa: kill gsi->virt_raw https://git.kernel.org/netdev/net-next/c/59b12b1d27f3 - [net-next,3/6] net: ipa: kill ev_ch_e_cntxt_1_length_encode() https://git.kernel.org/netdev/net-next/c/f75f44ddd4cb - [net-next,4/6] net: ipa: avoid setting an undefined field https://git.kernel.org/netdev/net-next/c/62747512ebe6 - [net-next,5/6] net: ipa: support different event ring encoding https://git.kernel.org/netdev/net-next/c/37cd29ec8401 - [net-next,6/6] net: ipa: add HW_PARAM_4 GSI register https://git.kernel.org/netdev/net-next/c/f651334e1ef5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH net-next 2/6] net: ipa: kill gsi->virt_raw
In reply to Alex ElderQuoted 10 lines · Alex Elder
Quoted 9 lines · Alexander Lobakin
Quoted 9 lines
Quoted 1 line
just
devm_platform_ioremap_resource_byname()be used here for simplicity?Previously,
virt_rawwould be the "real" re-mapped pointer, and then virt would be adjusted downward from that. It was a weird thing to do, because the result pointed to a non-mapped address. But all uses of the virt pointer added an offset that was enough to put the result into the mapped range.The new code updates all offsets to account for what the adjustment previously did. The test that got removed isn't necessary any more.
Quoted 8 lines
Quoted 3 lines
Yeah I got it, just asked that maybe you can now use
platform_ioremap_resource_byname()instead ofplatform_get_resource_byname()+ioremap():)Sorry, I focused on the "devm" part and not this part. Yes I like that, but let me do that as a follow-on patch, and I think I can do it in more than this spot (possibly three, but I have to look closely).
Looking at this today, the only OF functions that look up a resource and I/O remap it in one call are devm_*() variants. There is no platform_ioremap_resource_byname() function.
One that's available is devm_platform_ioremap_resource_byname(), which could possibly be used in the two locations that call platform_get_resource_byname() followed by ioremap().
As I said earlier, if I were to use any devm_*() function calls the driver, I would want to convert *everything* to use devm_*() variants, and I have no plans to do that at this time.
So I will not be implementing your suggestion.
-Alex
Quoted 5 lines
Thanks.
-Alex
Re: [PATCH net-next 2/6] net: ipa: kill gsi->virt_raw
From: Alex Elder <[email protected]>
Date: Sun, 5 Mar 2023 10:58:19 -0600
Quoted 29 lines · Alex Elder
Quoted 11 lines · Alexander Lobakin
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
just
devm_platform_ioremap_resource_byname()be used here for simplicity?Previously,
virt_rawwould be the "real" re-mapped pointer, and then virt would be adjusted downward from that. It was a weird thing to do, because the result pointed to a non-mapped address. But all uses of the virt pointer added an offset that was enough to put the result into the mapped range.The new code updates all offsets to account for what the adjustment previously did. The test that got removed isn't necessary any more.
Quoted 8 lines
Quoted 3 lines
Yeah I got it, just asked that maybe you can now use
platform_ioremap_resource_byname()instead ofplatform_get_resource_byname()+ioremap():)Sorry, I focused on the "devm" part and not this part. Yes I like that, but let me do that as a follow-on patch, and I think I can do it in more than this spot (possibly three, but I have to look closely).
Looking at this today, the only OF functions that look up a resource and I/O remap it in one call are devm_*() variants. There is no
platform_ioremap_resource_byname()function.One that's available is
devm_platform_ioremap_resource_byname(), which could possibly be used in the two locations that callplatform_get_resource_byname()followed byioremap().
Quoted 6 lines
As I said earlier, if I were to use any devm_*() function calls the driver, I would want to convert *everything* to use devm_*() variants, and I have no plans to do that at this time.
So I will not be implementing your suggestion.
Sure. It's fully up to the developers as it doesn't make the code worse in any way.
Quoted 9 lines
-Alex
Quoted 5 lines
Thanks.
-Alex
Thanks,
Olek