6.12.34-rc1 review
Greg Kroah-Hartman
maintainerPATCH 285/512 perf intel-pt: Fix PEBS-via-PT data_src
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit e00eac6b5b6d956f38d8880c44bf7fd9954063c3 ]
The Fixes commit did not add support for decoding PEBS-via-PT data_src. Fix by adding support.
PEBS-via-PT is a feature of some E-core processors, starting with processors based on Tremont microarchitecture. Because the kernel only supports Intel PT features that are on all processors, there is no support for PEBS-via-PT on hybrids.
Currently that leaves processors based on Tremont, Gracemont and Crestmont, however there are no events on Tremont that produce data_src information, and for Gracemont and Crestmont there are only:
mem-loads event=0xd0,umask=0x5,ldlat=3 mem-stores event=0xd0,umask=0x6
Affected processors include Alder Lake N (Gracemont), Sierra Forest (Crestmont) and Grand Ridge (Crestmont).
Example:
# perf record -d -e intel_pt/branch=0/ -e mem-loads/aux-output/pp uname
Before:
# perf.before script --itrace=o -Fdata_src
0 |OP No|LVL N/A|SNP N/A|TLB N/A|LCK No|BLK N/A
0 |OP No|LVL N/A|SNP N/A|TLB N/A|LCK No|BLK N/AAfter:
# perf script --itrace=o -Fdata_src 10268100142 |OP LOAD|LVL L1 hit|SNP None|TLB L1 or L2 hit|LCK No|BLK N/A 10450100442 |OP LOAD|LVL L2 hit|SNP None|TLB L2 miss|LCK No|BLK N/A
--- tools/perf/util/intel-pt.c | 205 ++++++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 3 deletions(-)
tools/perf/util/intel-pt.c +202 -3
@@ -127,6 +127,7 @@ struct intel_pt {bool single_pebs;bool sample_pebs; +int pebs_data_src_fmt;struct evsel *pebs_evsel;u64 evt_sample_type;
@@ -175,6 +176,7 @@ enum switch_state {struct intel_pt_pebs_event {struct evsel *evsel;u64 id; +int data_src_fmt; };struct intel_pt_queue {
@@ -2232,7 +2234,146 @@ static void intel_pt_add_lbrs(struct branch_stack *br_stack, } } -static int intel_pt_do_synth_pebs_sample (struct intel_pt_queue *ptq,struct evsel *evsel,u64 id) +#define P (a, b) PERF_MEM_S(a, b) +#define OP_LH (P(OP, LOAD) | P(LVL, HIT)) +#define LEVEL (x) P(LVLNUM, x) +#define REM P(REMOTE, REMOTE) +#define SNOOP_NONE_MISS (P(SNOOP, NONE) | P(SNOOP, MISS)) + +#define PERF_PEBS_DATA_SOURCE_GRT_MAX 0x10 +#define PERF_PEBS_DATA_SOURCE_GRT_MASK (PERF_PEBS_DATA_SOURCE_GRT_MAX - 1) + +/* Based on kernel __intel_pmu_pebs_data_source_grt() and pebs_data_source */ +static const u64 pebs_data_source_grt[PERF_PEBS_DATA_SOURCE_GRT_MAX ] = { +P (OP ,LOAD ) |P (LVL ,MISS ) |LEVEL (L3 ) |P (SNOOP ,NA ),/* L3 miss|SNP N/A */ +OP_LH |P (LVL ,L1 ) |LEVEL (L1 ) |P (SNOOP ,NONE ),/* L1 hit|SNP None */ +OP_LH |P (LVL ,LFB ) |LEVEL (LFB ) |P (SNOOP ,NONE ),/* LFB/MAB hit|SNP None */ +OP_LH |P (LVL ,L2 ) |LEVEL (L2 ) |P (SNOOP ,NONE ),/* L2 hit|SNP None */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,NONE ),/* L3 hit|SNP None */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HIT ),/* L3 hit|SNP Hit */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HITM ),/* L3 hit|SNP HitM */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HITM ),/* L3 hit|SNP HitM */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOPX ,FWD ),/* L3 hit|SNP Fwd */ +OP_LH |P (LVL ,REM_CCE1 ) |REM |LEVEL (L3 ) |P (SNOOP ,HITM ),/* Remote L3 hit|SNP HitM */ +OP_LH |P (LVL ,LOC_RAM ) |LEVEL (RAM ) |P (SNOOP ,HIT ),/* RAM hit|SNP Hit */ +OP_LH |P (LVL ,REM_RAM1 ) |REM |LEVEL (L3 ) |P (SNOOP ,HIT ),/* Remote L3 hit|SNP Hit */ +OP_LH |P (LVL ,LOC_RAM ) |LEVEL (RAM ) |SNOOP_NONE_MISS ,/* RAM hit|SNP None or Miss */ +OP_LH |P (LVL ,REM_RAM1 ) |LEVEL (RAM ) |REM |SNOOP_NONE_MISS ,/* Remote RAM hit|SNP None or Miss */ +OP_LH |P (LVL ,IO ) |LEVEL (NA ) |P (SNOOP ,NONE ),/* I/O hit|SNP None */ +OP_LH |P (LVL ,UNC ) |LEVEL (NA ) |P (SNOOP ,NONE ),/* Uncached hit|SNP None */ +}; + +/* Based on kernel __intel_pmu_pebs_data_source_cmt() and pebs_data_source */ +static const u64 pebs_data_source_cmt[PERF_PEBS_DATA_SOURCE_GRT_MAX ] = { +P (OP ,LOAD ) |P (LVL ,MISS ) |LEVEL (L3 ) |P (SNOOP ,NA ),/* L3 miss|SNP N/A */ +OP_LH |P (LVL ,L1 ) |LEVEL (L1 ) |P (SNOOP ,NONE ),/* L1 hit|SNP None */ +OP_LH |P (LVL ,LFB ) |LEVEL (LFB ) |P (SNOOP ,NONE ),/* LFB/MAB hit|SNP None */ +OP_LH |P (LVL ,L2 ) |LEVEL (L2 ) |P (SNOOP ,NONE ),/* L2 hit|SNP None */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,NONE ),/* L3 hit|SNP None */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,MISS ),/* L3 hit|SNP Hit */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HIT ),/* L3 hit|SNP HitM */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOPX ,FWD ),/* L3 hit|SNP HitM */ +OP_LH |P (LVL ,L3 ) |LEVEL (L3 ) |P (SNOOP ,HITM ),/* L3 hit|SNP Fwd */ +OP_LH |P (LVL ,REM_CCE1 ) |REM |LEVEL (L3 ) |P (SNOOP ,HITM ),/* Remote L3 hit|SNP HitM */ +OP_LH |P (LVL ,LOC_RAM ) |LEVEL (RAM ) |P (SNOOP ,NONE ),/* RAM hit|SNP Hit */ +OP_LH |LEVEL (RAM ) |REM |P (SNOOP ,NONE ),/* Remote L3 hit|SNP Hit */ +OP_LH |LEVEL (RAM ) |REM |P (SNOOPX ,FWD ),/* RAM hit|SNP None or Miss */ +OP_LH |LEVEL (RAM ) |REM |P (SNOOP ,HITM ),/* Remote RAM hit|SNP None or Miss */ +OP_LH |P (LVL ,IO ) |LEVEL (NA ) |P (SNOOP ,NONE ),/* I/O hit|SNP None */ +OP_LH |P (LVL ,UNC ) |LEVEL (NA ) |P (SNOOP ,NONE ),/* Uncached hit|SNP None */ +}; + +/* Based on kernel pebs_set_tlb_lock() */ +static inline void pebs_set_tlb_lock (u64 *val,bool tlb,bool lock) +{ +/* +* TLB access +* 0 = did not miss 2nd level TLB +* 1 = missed 2nd level TLB +*/ +if (tlb) + *val |=P (TLB ,MISS ) |P (TLB ,L2 ); +else + *val |=P (TLB ,HIT ) |P (TLB ,L1 ) |P (TLB ,L2 ); + +/* locked prefix */ +if (lock) + *val |=P (LOCK ,LOCKED ); +} + +/* Based on kernel __grt_latency_data() */ +static u64 intel_pt_grt_latency_data (u8 dse,bool tlb,bool lock,bool blk, +const u64 *pebs_data_source) +{ +u64 val; + + dse &=PERF_PEBS_DATA_SOURCE_GRT_MASK ; + val = pebs_data_source[dse]; + +pebs_set_tlb_lock (&val, tlb, lock); + +if (blk) + val |=P (BLK ,DATA ); +else + val |=P (BLK ,NA ); + +return val; +} + +/* Default value for data source */ +#define PERF_MEM_NA (PERF_MEM_S(OP, NA) |\ + PERF_MEM_S(LVL, NA) |\ + PERF_MEM_S(SNOOP, NA) |\ + PERF_MEM_S(LOCK, NA) |\ + PERF_MEM_S(TLB, NA) |\ + PERF_MEM_S(LVLNUM, NA)) + +enum DATA_SRC_FORMAT { +DATA_SRC_FORMAT_ERR =-1 , +DATA_SRC_FORMAT_NA =0 , +DATA_SRC_FORMAT_GRT =1 , +DATA_SRC_FORMAT_CMT =2 , +}; + +/* Based on kernel grt_latency_data() and cmt_latency_data */ +static u64 intel_pt_get_data_src (u64 mem_aux_info,int data_src_fmt) +{ +switch (data_src_fmt) { +case DATA_SRC_FORMAT_GRT : { +union { +u64 val; +struct { +unsigned int dse:4 ; +unsigned int locked:1 ; +unsigned int stlb_miss:1 ; +unsigned int fwd_blk:1 ; +unsigned int reserved:25 ; + }; + } x = {.val = mem_aux_info}; +return intel_pt_grt_latency_data (x.dse, x.stlb_miss, x.locked, x.fwd_blk, + pebs_data_source_grt); + } +case DATA_SRC_FORMAT_CMT : { +union { +u64 val; +struct { +unsigned int dse:5 ; +unsigned int locked:1 ; +unsigned int stlb_miss:1 ; +unsigned int fwd_blk:1 ; +unsigned int reserved:24 ; + }; + } x = {.val = mem_aux_info}; +return intel_pt_grt_latency_data (x.dse, x.stlb_miss, x.locked, x.fwd_blk, + pebs_data_source_cmt); + } +default : +return PERF_MEM_NA ; + } +} + +static int intel_pt_do_synth_pebs_sample (struct intel_pt_queue *ptq,struct evsel *evsel, +u64 id,int data_src_fmt) {const struct intel_pt_blk_items *items = &ptq->state->items;struct perf_sample sample = { .ip =0 , };
@@ -2350,6 +2491,18 @@ static int intel_pt_do_synth_pebs_sample(struct intel_pt_queue *ptq, struct evse } } +if (sample_type &PERF_SAMPLE_DATA_SRC ) { +if (items->has_mem_aux_info && data_src_fmt) { +if (data_src_fmt <0 ) { +pr_err ("Intel PT missing data_src info\n" ); +return -1 ; + } + sample.data_src =intel_pt_get_data_src (items->mem_aux_info, data_src_fmt); + }else { + sample.data_src =PERF_MEM_NA ; + } + } +if (sample_type &PERF_SAMPLE_TRANSACTION && items->has_tsx_aux_info) {u64 ax = items->has_rax ? items->rax :0 ;/* Refer kernel's intel_hsw_transaction() */
@@ -2368,9 +2521,10 @@ static int intel_pt_synth_single_pebs_sample(struct intel_pt_queue *ptq) {struct intel_pt *pt = ptq->pt;struct evsel *evsel = pt->pebs_evsel; +int data_src_fmt = pt->pebs_data_src_fmt;u64 id = evsel->core.id[0 ]; -return intel_pt_do_synth_pebs_sample (ptq, evsel, id); +return intel_pt_do_synth_pebs_sample (ptq, evsel, id, data_src_fmt); }static int intel_pt_synth_pebs_sample (struct intel_pt_queue *ptq)
@@ -2395,7 +2549,7 @@ static int intel_pt_synth_pebs_sample(struct intel_pt_queue *ptq) hw_id);return intel_pt_synth_single_pebs_sample (ptq); } - err =intel_pt_do_synth_pebs_sample (ptq, pe->evsel, pe->id); + err =intel_pt_do_synth_pebs_sample (ptq, pe->evsel, pe->id, pe->data_src_fmt);if (err)return err; }
@@ -3355,6 +3509,49 @@ static int intel_pt_process_itrace_start(struct intel_pt *pt, event->itrace_start.tid); } +/* +* Events with data_src are identified by L1_Hit_Indication +* refer https://github.com/intel/perfmon +*/ +static int intel_pt_data_src_fmt (struct intel_pt *pt,struct evsel *evsel) +{ +struct perf_env *env = pt->machine->env; +int fmt =DATA_SRC_FORMAT_NA ; + +if (!env->cpuid) +return DATA_SRC_FORMAT_ERR ; + +/* +* PEBS-via-PT is only supported on E-core non-hybrid. Of those only +* Gracemont and Crestmont have data_src. Check for: +* Alderlake N (Gracemont) +* Sierra Forest (Crestmont) +* Grand Ridge (Crestmont) +*/ + +if (!strncmp (env->cpuid,"GenuineIntel,6,190," ,19 )) + fmt =DATA_SRC_FORMAT_GRT ; + +if (!strncmp (env->cpuid,"GenuineIntel,6,175," ,19 ) || + !strncmp (env->cpuid,"GenuineIntel,6,182," ,19 )) + fmt =DATA_SRC_FORMAT_CMT ; + +if (fmt ==DATA_SRC_FORMAT_NA ) +return fmt; + +/* +* Only data_src events are: +* mem-loads event=0xd0,umask=0x5 +* mem-stores event=0xd0,umask=0x6 +*/ +if (evsel->core.attr.type ==PERF_TYPE_RAW && + ((evsel->core.attr.config &0xffff ) ==0x5d0 || + (evsel->core.attr.config &0xffff ) ==0x6d0 )) +return fmt; + +return DATA_SRC_FORMAT_NA ; +} +static int intel_pt_process_aux_output_hw_id (struct intel_pt *pt,union perf_event *event,struct perf_sample *sample)
@@ -3375,6 +3572,7 @@ static int intel_pt_process_aux_output_hw_id(struct intel_pt *pt, ptq->pebs[hw_id].evsel = evsel; ptq->pebs[hw_id].id = sample->id; + ptq->pebs[hw_id].data_src_fmt =intel_pt_data_src_fmt (pt, evsel);return 0 ; }
@@ -3924,6 +4122,7 @@ static void intel_pt_setup_pebs_events(struct intel_pt *pt) } pt->single_pebs = true; pt->sample_pebs = true; + pt->pebs_data_src_fmt =intel_pt_data_src_fmt (pt, evsel); pt->pebs_evsel = evsel; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 286/512 perf scripts python: exported-sql-viewer.py: Fix pattern matching with Python 3
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit 17e548405a81665fd14cee960db7d093d1396400 ]
The script allows the user to enter patterns to find symbols.
The pattern matching characters are converted for use in SQL.
For PostgreSQL the conversion involves using the Python maketrans() method which is slightly different in Python 3 compared with Python 2.
Fix to work in Python 3.
--- tools/perf/scripts/python/exported-sql-viewer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/scripts/python/exported-sql-viewer.py +4 -1
@@ -680,7 +680,10 @@ class CallGraphModelBase(TreeModel): s = value.replace("%", "\\%") s = s.replace("_", "\\_") # Translate * and ? into SQL LIKE pattern characters % and _ - trans = string.maketrans("*?", "%_") + if sys.version_info[0] == 3: + trans = str.maketrans("*?", "%_") + else: + trans = string.maketrans("*?", "%_") match = " LIKE '" + str(s).translate(trans) + "'" else: match = " GLOB '" + str(value) + "'"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 287/512 remoteproc: qcom_wcnss_iris: Add missing put_device() on error in probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 0cb4b1b97041d8a1f773425208ded253c1cb5869 ]
The device_del() call matches with the device_add() but we also need to call put_device() to trigger the qcom_iris_release().
--- drivers/remoteproc/qcom_wcnss_iris.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/remoteproc/qcom_wcnss_iris.c +2 -0
@@ -197,6 +197,7 @@ struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo) err_device_del:device_del (&iris->dev); +put_device (&iris->dev);return ERR_PTR (ret); }
@@ -204,4 +205,5 @@ struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo)void qcom_iris_remove (struct qcom_iris *iris) {device_del (&iris->dev); +put_device (&iris->dev); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 288/512 remoteproc: k3-r5: Drop check performed in k3_r5_rproc_{mbox_callback/kick}
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit 9995dbfc2235efabdb3759606d522e1a7ec3bdcb ]
Commit f3f11cfe8907 ("remoteproc: k3-r5: Acquire mailbox handle during probe routine") introduced a check in the "k3_r5_rproc_mbox_callback()" and "k3_r5_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".
The "rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_r5_rproc_kick()" and "k3_r5_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.
--- drivers/remoteproc/ti_k3_r5_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/remoteproc/ti_k3_r5_remoteproc.c +0 -8
@@ -194,10 +194,6 @@ static void k3_r5_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward message from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {
@@ -233,10 +229,6 @@ static void k3_r5_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward message to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 289/512 remoteproc: k3-dsp: Drop check performed in k3_dsp_rproc_{mbox_callback/kick}
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit 349d62ab207f55f039c3ddb40b36e95c2f0b3ed0 ]
Commit ea1d6fb5b571 ("remoteproc: k3-dsp: Acquire mailbox handle during probe routine") introduced a check in the "k3_dsp_rproc_mbox_callback()" and "k3_dsp_rproc_kick()" callbacks, causing them to exit if the remote core's state is "RPROC_DETACHED". However, the "__rproc_attach()" function that is responsible for attaching to a remote core, updates the state of the remote core to "RPROC_ATTACHED" only after invoking "rproc_start_subdevices()".
The "rproc_start_subdevices()" function triggers the probe of the Virtio RPMsg devices associated with the remote core, which require that the "k3_dsp_rproc_kick()" and "k3_dsp_rproc_mbox_callback()" callbacks are functional. Hence, drop the check in the callbacks.
--- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/remoteproc/ti_k3_dsp_remoteproc.c +0 -8
@@ -115,10 +115,6 @@ static void k3_dsp_rproc_mbox_callback(struct mbox_client *client, void *data)const char *name = kproc->rproc->name;u32 msg =omap_mbox_message (data); -/* Do not forward messages from a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -dev_dbg (dev,"mbox msg: 0x%x\n" , msg);switch (msg) {
@@ -159,10 +155,6 @@ static void k3_dsp_rproc_kick(struct rproc *rproc, int vqid)mbox_msg_t msg = (mbox_msg_t )vqid;int ret; -/* Do not forward messages to a detached core */ -if (kproc->rproc->state ==RPROC_DETACHED ) -return ; -/* send the index of the triggered virtqueue in the mailbox payload */ ret =mbox_send_message (kproc->mbox, (void *)msg);if (ret <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 290/512 rpmsg: qcom_smd: Fix uninitialized return variable in __qcom_smd_send()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 5de775df3362090a6e90046d1f2d83fe62489aa0 ]
The "ret" variable isn't initialized if we don't enter the loop. For example, if "channel->state" is not SMD_CHANNEL_OPENED.
--- drivers/rpmsg/qcom_smd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rpmsg/qcom_smd.c +1 -1
@@ -746,7 +746,7 @@ static int __qcom_smd_send(struct qcom_smd_channel *channel, const void *data,__le32 hdr[5 ] = {cpu_to_le32 (len), };int tlen =sizeof (hdr) + len;unsigned long flags; -int ret; +int ret =0 ;/* Word aligned channels only accept word size aligned data */ if (channel->info_word && len %4 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 291/512 mfd: exynos-lpass: Fix an error handling path in exynos_lpass_probe()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 484f0f59f09edd1f6fa63703c12eb30d72a519ac ]
If an error occurs after a successful regmap_init_mmio(), regmap_exit() should be called as already done in the .remove() function.
Switch to devm_regmap_init_mmio() to avoid the leak and simplify the .remove() function.
--- drivers/mfd/exynos-lpass.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/mfd/exynos-lpass.c +2 -3
@@ -122,8 +122,8 @@ static int exynos_lpass_probe(struct platform_device *pdev)if (IS_ERR (lpass->sfr0_clk))return PTR_ERR (lpass->sfr0_clk); - lpass->top =regmap_init_mmio (dev, base_top, - &exynos_lpass_reg_conf); + lpass->top =devm_regmap_init_mmio (dev, base_top, + &exynos_lpass_reg_conf);if (IS_ERR (lpass->top)) {dev_err (dev,"LPASS top regmap initialization failed\n" );return PTR_ERR (lpass->top);
@@ -145,7 +145,6 @@ static void exynos_lpass_remove(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);if (!pm_runtime_status_suspended (&pdev->dev))exynos_lpass_disable (lpass); -regmap_exit (lpass->top); }static int __maybe_unused exynos_lpass_suspend (struct device *dev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 292/512 mfd: exynos-lpass: Avoid calling exynos_lpass_disable() twice in exynos_lpass_remove()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit b70b84556eeca5262d290e8619fe0af5b7664a52 ]
exynos_lpass_disable() is called twice in the remove function. Remove one of these calls.
--- drivers/mfd/exynos-lpass.c | 1 - 1 file changed, 1 deletion(-)
drivers/mfd/exynos-lpass.c +0 -1
@@ -141,7 +141,6 @@ static void exynos_lpass_remove(struct platform_device *pdev) {struct exynos_lpass *lpass =platform_get_drvdata (pdev); -exynos_lpass_disable (lpass);pm_runtime_disable (&pdev->dev);if (!pm_runtime_status_suspended (&pdev->dev))exynos_lpass_disable (lpass);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 293/512 mfd: stmpe-spi: Correct the name used in MODULE_DEVICE_TABLE
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Gladkov <[email protected]>
[ Upstream commit 59d60c16ed41475f3b5f7b605e75fbf8e3628720 ]
The name used in the macro does not exist.
drivers/mfd/stmpe-spi.c:132:26: error: use of undeclared identifier 'stmpe_id'
132 | MODULE_DEVICE_TABLE(spi, stmpe_id);
--- drivers/mfd/stmpe-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/stmpe-spi.c +1 -1
@@ -129,7 +129,7 @@ static const struct spi_device_id stmpe_spi_id[] = { { "stmpe2403", STMPE2403 }, { } }; -MODULE_DEVICE_TABLE(spi, stmpe_id); +MODULE_DEVICE_TABLE(spi, stmpe_spi_id); static struct spi_driver stmpe_spi_driver = { .driver = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 294/512 perf tests switch-tracking: Fix timestamp comparison
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 628e124404b3db5e10e17228e680a2999018ab33 ]
The test might fail on the Arm64 platform with the error:
# perf test -vvv "Track with sched_switch" Missing sched_switch events #
The issue is caused by incorrect handling of timestamp comparisons. The comparison result, a signed 64-bit value, was being directly cast to an int, leading to incorrect sorting for sched events.
The case does not fail everytime, usually I can trigger the failure after run 20 ~ 30 times:
# while true; do perf test "Track with sched_switch"; done 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : FAILED! 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok 106: Track with sched_switch : FAILED! 106: Track with sched_switch : Ok 106: Track with sched_switch : Ok
I used cross compiler to build Perf tool on my host machine and tested on Debian / Juno board. Generally, I think this issue is not very specific to GCC versions. As both internal CI and my local env can reproduce the issue.
My Host Build compiler:
# aarch64-linux-gnu-gcc --version aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Juno Board:
# lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm
Fix this by explicitly returning 0, 1, or -1 based on whether the result is zero, positive, or negative.
--- tools/perf/tests/switch-tracking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/switch-tracking.c +1 -1
@@ -258,7 +258,7 @@ static int compar(const void *a, const void *b)const struct event_node *nodeb = b;s64 cmp = nodea->event_time - nodeb->event_time; -return cmp; +return cmp <0 ?-1 : (cmp >0 ?1 :0 ); } static int process_events(struct evlist *evlist,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 295/512 mailbox: imx: Fix TXDB_V2 sending
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit f5cb07ec6aabd1bb56adbdeb5f0d70cb524db2cd ]
i.MX95 features several processing domains, Cortex-M7, Cortex-A55 secure, Cortex-A55 non-secure. Each domain could communicate with SCMI firmware with a dedicated MU. But the current NXP SCMI firmware is not a RTOS, all processing logic codes are in interrupt context. So if high priority Cortex-M7 is communicating with SCMI firmware and requires a bit more time to handle the SCMI call, Linux MU TXDB_V2 will be timeout with high possiblity in 1000us(the current value in imx-mailbox.c). Per NXP SCMI firmware design, if timeout, there is no recover logic, so SCMI agents should never timeout and always wait until the check condition met.
Based on the upper reason, enlarge the timeout value to 10ms which is less chance to timeout, and retry if timeout really happends.
--- drivers/mailbox/imx-mailbox.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/mailbox/imx-mailbox.c +15 -6
@@ -226,7 +226,7 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv, {u32 *arg = data;u32 val; -int ret; +int ret, count;switch (cp->type) {case IMX_MU_TYPE_TX :
@@ -240,11 +240,20 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,case IMX_MU_TYPE_TXDB_V2 :imx_mu_write (priv,IMX_MU_xCR_GIRn (priv->dcfg->type, cp->idx), priv->dcfg->xCR[IMX_MU_GCR ]); - ret =readl_poll_timeout (priv->base + priv->dcfg->xCR[IMX_MU_GCR ], val, - !(val &IMX_MU_xCR_GIRn (priv->dcfg->type, cp->idx)), -0 ,1000 ); -if (ret) -dev_warn_ratelimited (priv->dev,"channel type: %d failure\n" , cp->type); + ret = -ETIMEDOUT ; + count =0 ; +while (ret && (count <10 )) { + ret = +readl_poll_timeout (priv->base + priv->dcfg->xCR[IMX_MU_GCR ], val, + !(val &IMX_MU_xCR_GIRn (priv->dcfg->type, cp->idx)), +0 ,10000 ); + +if (ret) { +dev_warn_ratelimited (priv->dev, +"channel type: %d timeout, %d times, retry\n" , + cp->type, ++count); + } + }break ;default :dev_warn_ratelimited (priv->dev,"Send data on wrong channel type: %d\n" , cp->type);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 296/512 mailbox: mtk-cmdq: Refine GCE_GCTL_VALUE setting
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason-JH Lin <[email protected]>
[ Upstream commit 9fcebcb37c3e0a4b6eb40768cc5a5faebf166fbe ]
Add cmdq_gctl_value_toggle() to configure GCE_CTRL_BY_SW and GCE_DDR_EN together in the same GCE_GCTL_VALUE register.
For the SoCs whose GCE is located in MMINFRA and uses MMINFRA_AO power, this allows it to be written without enabling the clocks. Otherwise, all GCE registers should be written after the GCE clocks are enabled. Move this function into cmdq_runtime_resume() and cmdq_runtime_suspend() to ensure it is called when the GCE clock is enabled.
--- drivers/mailbox/mtk-cmdq-mailbox.c | 51 +++++++++++++----------------- 1 file changed, 22 insertions(+), 29 deletions(-)
drivers/mailbox/mtk-cmdq-mailbox.c +22 -29
@@ -92,18 +92,6 @@ struct gce_plat {u32 gce_num; }; -static void cmdq_sw_ddr_enable (struct cmdq *cmdq,bool enable) -{ -WARN_ON (clk_bulk_enable (cmdq->pdata->gce_num, cmdq->clocks)); - -if (enable) -writel (GCE_DDR_EN |GCE_CTRL_BY_SW , cmdq->base +GCE_GCTL_VALUE ); -else -writel (GCE_CTRL_BY_SW , cmdq->base +GCE_GCTL_VALUE ); - -clk_bulk_disable (cmdq->pdata->gce_num, cmdq->clocks); -} -u8 cmdq_get_shift_pa (struct mbox_chan *chan) { struct cmdq *cmdq = container_of(chan->mbox, struct cmdq, mbox);
@@ -112,6 +100,19 @@ u8 cmdq_get_shift_pa(struct mbox_chan *chan) }EXPORT_SYMBOL (cmdq_get_shift_pa); +static void cmdq_gctl_value_toggle (struct cmdq *cmdq,bool ddr_enable) +{ +u32 val = cmdq->pdata->control_by_sw ?GCE_CTRL_BY_SW :0 ; + +if (!cmdq->pdata->control_by_sw && !cmdq->pdata->sw_ddr_en) +return ; + +if (cmdq->pdata->sw_ddr_en && ddr_enable) + val |=GCE_DDR_EN ; + +writel (val, cmdq->base +GCE_GCTL_VALUE ); +} +static int cmdq_thread_suspend (struct cmdq *cmdq,struct cmdq_thread *thread) {u32 status;
@@ -140,16 +141,10 @@ static void cmdq_thread_resume(struct cmdq_thread *thread)static void cmdq_init (struct cmdq *cmdq) {int i; -u32 gctl_regval =0 ;WARN_ON (clk_bulk_enable (cmdq->pdata->gce_num, cmdq->clocks)); -if (cmdq->pdata->control_by_sw) - gctl_regval =GCE_CTRL_BY_SW ; -if (cmdq->pdata->sw_ddr_en) - gctl_regval |=GCE_DDR_EN ; -if (gctl_regval) -writel (gctl_regval, cmdq->base +GCE_GCTL_VALUE ); +cmdq_gctl_value_toggle (cmdq, true);writel (CMDQ_THR_ACTIVE_SLOT_CYCLES , cmdq->base +CMDQ_THR_SLOT_CYCLES );for (i =0 ; i <=CMDQ_MAX_EVENT ; i++)
@@ -315,14 +310,21 @@ static irqreturn_t cmdq_irq_handler(int irq, void *dev)static int cmdq_runtime_resume (struct device *dev) {struct cmdq *cmdq =dev_get_drvdata (dev); +int ret; -return clk_bulk_enable (cmdq->pdata->gce_num, cmdq->clocks); + ret =clk_bulk_enable (cmdq->pdata->gce_num, cmdq->clocks); +if (ret) +return ret; + +cmdq_gctl_value_toggle (cmdq, true); +return 0 ; }static int cmdq_runtime_suspend (struct device *dev) {struct cmdq *cmdq =dev_get_drvdata (dev); +cmdq_gctl_value_toggle (cmdq, false);clk_bulk_disable (cmdq->pdata->gce_num, cmdq->clocks);return 0 ; }
@@ -347,9 +349,6 @@ static int cmdq_suspend(struct device *dev)if (task_running)dev_warn (dev,"exist running task(s) in suspend\n" ); -if (cmdq->pdata->sw_ddr_en) -cmdq_sw_ddr_enable (cmdq, false); -return pm_runtime_force_suspend (dev); }
@@ -360,9 +359,6 @@ static int cmdq_resume(struct device *dev)WARN_ON (pm_runtime_force_resume (dev)); cmdq->suspended = false; -if (cmdq->pdata->sw_ddr_en) -cmdq_sw_ddr_enable (cmdq, true); -return 0 ; }
@@ -370,9 +366,6 @@ static void cmdq_remove(struct platform_device *pdev) {struct cmdq *cmdq =platform_get_drvdata (pdev); -if (cmdq->pdata->sw_ddr_en) -cmdq_sw_ddr_enable (cmdq, false); -if (!IS_ENABLED (CONFIG_PM ))cmdq_runtime_suspend (&pdev->dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 297/512 perf symbol: Fix use-after-free in filename__read_build_id
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit fef8f648bb47726d96a5701fe31ed606268da73d ]
The same buf is used for the program headers and reading notes. As the notes memory may be reallocated then this corrupts the memory pointed to by the phdr. Using the same buffer is in any case a logic error. Rather than deal with the duplicated code, introduce an elf32 boolean and a union for either the elf32 or elf64 headers that are in use. Let the program headers have their own memory and grow the buffer for notes as necessary.
Before perf list -j compiled with asan would crash with:
```
==4176189==ERROR: AddressSanitizer: heap-use-after-free on address 0x5160000070b8 at pc 0x555d3b15075b bp 0x7ffebb5a8090 sp 0x7ffebb5a8088
READ of size 8 at 0x5160000070b8 thread T0
#0 0x555d3b15075a in filename__read_build_id tools/perf/util/symbol-minimal.c:212:25
#1 0x555d3ae43aff in filename__sprintf_build_id tools/perf/util/build-id.c:110:8
...
0x5160000070b8 is located 312 bytes inside of 560-byte region [0x516000006f80,0x5160000071b0)
freed by thread T0 here:
#0 0x555d3ab21840 in realloc (perf+0x264840) (BuildId: 12dff2f6629f738e5012abdf0e90055518e70b5e)
#1 0x555d3b1506e7 in filename__read_build_id tools/perf/util/symbol-minimal.c:206:11
...
previously allocated by thread T0 here:
#0 0x555d3ab21423 in malloc (perf+0x264423) (BuildId: 12dff2f6629f738e5012abdf0e90055518e70b5e)
#1 0x555d3b1503a2 in filename__read_build_id tools/perf/util/symbol-minimal.c:182:9
...
```Note: this bug is long standing and not introduced by the other asan fix in commit fa9c4977fbfb ("perf symbol-minimal: Fix double free in filename__read_build_id").
--- tools/perf/util/symbol-minimal.c | 168 +++++++++++++------------------ 1 file changed, 70 insertions(+), 98 deletions(-)
tools/perf/util/symbol-minimal.c +70 -98
@@ -90,11 +90,23 @@ int filename__read_build_id(const char *filename, struct build_id *bid) {FILE *fp;int ret =-1 ; -bool need_swap = false; +bool need_swap = false, elf32;u8 e_ident[EI_NIDENT ]; -size_t buf_size; -void *buf;int i; +union { +struct { +Elf32_Ehdr ehdr32; +Elf32_Phdr *phdr32; + }; +struct { +Elf64_Ehdr ehdr64; +Elf64_Phdr *phdr64; + }; + } hdrs; +void *phdr; +size_t phdr_size; +void *buf =NULL ; +size_t buf_size =0 ; fp =fopen (filename,"r" );if (fp ==NULL )
@@ -108,119 +120,79 @@ int filename__read_build_id(const char *filename, struct build_id *bid) goto out; need_swap =check_need_swap (e_ident[EI_DATA ]); + elf32 = e_ident[EI_CLASS ] ==ELFCLASS32 ; -/* for simplicity */ -fseek (fp,0 ,SEEK_SET ); - -if (e_ident[EI_CLASS ] ==ELFCLASS32 ) { -Elf32_Ehdr ehdr; -Elf32_Phdr *phdr; - -if (fread (&ehdr,sizeof (ehdr),1 , fp) !=1 ) - goto out; +if (fread (elf32 ? (void *)&hdrs.ehdr32 : (void *)&hdrs.ehdr64, + elf32 ?sizeof (hdrs.ehdr32) :sizeof (hdrs.ehdr64), +1 , fp) !=1 ) + goto out; -if (need_swap) { - ehdr.e_phoff =bswap_32 (ehdr.e_phoff); - ehdr.e_phentsize =bswap_16 (ehdr.e_phentsize); - ehdr.e_phnum =bswap_16 (ehdr.e_phnum); +if (need_swap) { +if (elf32) { + hdrs.ehdr32.e_phoff =bswap_32 (hdrs.ehdr32.e_phoff); + hdrs.ehdr32.e_phentsize =bswap_16 (hdrs.ehdr32.e_phentsize); + hdrs.ehdr32.e_phnum =bswap_16 (hdrs.ehdr32.e_phnum); + }else { + hdrs.ehdr64.e_phoff =bswap_64 (hdrs.ehdr64.e_phoff); + hdrs.ehdr64.e_phentsize =bswap_16 (hdrs.ehdr64.e_phentsize); + hdrs.ehdr64.e_phnum =bswap_16 (hdrs.ehdr64.e_phnum); } + } + phdr_size = elf32 ? hdrs.ehdr32.e_phentsize * hdrs.ehdr32.e_phnum + : hdrs.ehdr64.e_phentsize * hdrs.ehdr64.e_phnum; + phdr =malloc (phdr_size); +if (phdr ==NULL ) + goto out; - buf_size = ehdr.e_phentsize * ehdr.e_phnum; - buf =malloc (buf_size); -if (buf ==NULL ) - goto out; - -fseek (fp, ehdr.e_phoff,SEEK_SET ); -if (fread (buf, buf_size,1 , fp) !=1 ) - goto out_free; - -for (i =0 , phdr = buf; i < ehdr.e_phnum; i++, phdr++) { -void *tmp; -long offset; - -if (need_swap) { - phdr->p_type =bswap_32 (phdr->p_type); - phdr->p_offset =bswap_32 (phdr->p_offset); - phdr->p_filesz =bswap_32 (phdr->p_filesz); - } - -if (phdr->p_type !=PT_NOTE ) -continue ; - - offset = phdr->p_offset; -if (phdr->p_filesz > buf_size) { - buf_size = phdr->p_filesz; - tmp =realloc (buf, buf_size); -if (tmp ==NULL ) - goto out_free; - buf = tmp; - } -fseek (fp, offset,SEEK_SET ); -if (fread (buf, phdr->p_filesz,1 , fp) !=1 ) - goto out_free; +fseek (fp, elf32 ? hdrs.ehdr32.e_phoff : hdrs.ehdr64.e_phoff,SEEK_SET ); +if (fread (phdr, phdr_size,1 , fp) !=1 ) + goto out_free; - ret =read_build_id (buf, phdr->p_filesz, bid, need_swap); -if (ret ==0 ) { - ret = bid->size; -break ; - } - } - }else { -Elf64_Ehdr ehdr; -Elf64_Phdr *phdr; +if (elf32) + hdrs.phdr32 = phdr; +else + hdrs.phdr64 = phdr; -if (fread (&ehdr,sizeof (ehdr),1 , fp) !=1 ) - goto out; +for (i =0 ; i < elf32 ? hdrs.ehdr32.e_phnum : hdrs.ehdr64.e_phnum; i++) { +size_t p_filesz;if (need_swap) { - ehdr.e_phoff =bswap_64 (ehdr.e_phoff); - ehdr.e_phentsize =bswap_16 (ehdr.e_phentsize); - ehdr.e_phnum =bswap_16 (ehdr.e_phnum); +if (elf32) { + hdrs.phdr32[i].p_type =bswap_32 (hdrs.phdr32[i].p_type); + hdrs.phdr32[i].p_offset =bswap_32 (hdrs.phdr32[i].p_offset); + hdrs.phdr32[i].p_filesz =bswap_32 (hdrs.phdr32[i].p_offset); + }else { + hdrs.phdr64[i].p_type =bswap_32 (hdrs.phdr64[i].p_type); + hdrs.phdr64[i].p_offset =bswap_64 (hdrs.phdr64[i].p_offset); + hdrs.phdr64[i].p_filesz =bswap_64 (hdrs.phdr64[i].p_filesz); + } } +if ((elf32 ? hdrs.phdr32[i].p_type : hdrs.phdr64[i].p_type) !=PT_NOTE ) +continue ; - buf_size = ehdr.e_phentsize * ehdr.e_phnum; - buf =malloc (buf_size); -if (buf ==NULL ) - goto out; - -fseek (fp, ehdr.e_phoff,SEEK_SET ); -if (fread (buf, buf_size,1 , fp) !=1 ) - goto out_free; - -for (i =0 , phdr = buf; i < ehdr.e_phnum; i++, phdr++) { + p_filesz = elf32 ? hdrs.phdr32[i].p_filesz : hdrs.phdr64[i].p_filesz; +if (p_filesz > buf_size) {void *tmp; -long offset; - -if (need_swap) { - phdr->p_type =bswap_32 (phdr->p_type); - phdr->p_offset =bswap_64 (phdr->p_offset); - phdr->p_filesz =bswap_64 (phdr->p_filesz); - } - -if (phdr->p_type !=PT_NOTE ) -continue ; - offset = phdr->p_offset; -if (phdr->p_filesz > buf_size) { - buf_size = phdr->p_filesz; - tmp =realloc (buf, buf_size); -if (tmp ==NULL ) - goto out_free; - buf = tmp; - } -fseek (fp, offset,SEEK_SET ); -if (fread (buf, phdr->p_filesz,1 , fp) !=1 ) + buf_size = p_filesz; + tmp =realloc (buf, buf_size); +if (tmp ==NULL ) goto out_free; + buf = tmp; + } +fseek (fp, elf32 ? hdrs.phdr32[i].p_offset : hdrs.phdr64[i].p_offset,SEEK_SET ); +if (fread (buf, p_filesz,1 , fp) !=1 ) + goto out_free; - ret =read_build_id (buf, phdr->p_filesz, bid, need_swap); -if (ret ==0 ) { - ret = bid->size; -break ; - } + ret =read_build_id (buf, p_filesz, bid, need_swap); +if (ret ==0 ) { + ret = bid->size; +break ; } } out_free:free (buf); +free (phdr); out:fclose (fp);return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 298/512 perf record: Fix incorrect --user-regs comments
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dapeng Mi <[email protected]>
[ Upstream commit a4a859eb6704a8aa46aa1cec5396c8d41383a26b ]
The comment of "--user-regs" option is not correct, fix it.
"on interrupt," -> "in user space,"
--- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-record.c +1 -1
@@ -3471,7 +3471,7 @@ static struct option __record_options[] = { "sample selected machine registers on interrupt," " use '-I?' to list register names", parse_intr_regs),OPT_CALLBACK_OPTARG (0 ,"user-regs" , &record.opts.sample_user_regs,NULL ,"any register" , -"sample selected machine registers on interrupt," +"sample selected machine registers in user space," " use '--user-regs=?' to list register names" , parse_user_regs),OPT_BOOLEAN (0 ,"running-time" , &record.opts.running_time, "Record running/enabled time of read (:S) events"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 299/512 perf trace: Always print return value for syscalls returning a pid
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anubhav Shelat <[email protected]>
[ Upstream commit c7a48ea9b919e2fa0e4a1d9938fdb03e9afe276c ]
The syscalls that were consistently observed were set_robust_list and rseq. This is because perf cannot find their child process.
This change ensures that the return value is always printed.
Before:
0.256 ( 0.001 ms): set_robust_list(head: 0x7f09c77dba20, len: 24) =
0.259 ( 0.001 ms): rseq(rseq: 0x7f09c77dc0e0, rseq_len: 32, sig: 1392848979) =
After:
0.270 ( 0.002 ms): set_robust_list(head: 0x7f0bb14a6a20, len: 24) = 0
0.273 ( 0.002 ms): rseq(rseq: 0x7f0bb14a70e0, rseq_len: 32, sig: 1392848979) = 0Committer notes:
As discussed in the thread in the Link: tag below, these two don't return a pid, but for syscalls returning one, we need to print the result and if we manage to find the children in 'perf trace' data structures, then print its name as well.
--- tools/perf/builtin-trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-trace.c +1 -1
@@ -2873,8 +2873,8 @@ errno_print: {else if (sc->fmt->errpid) {struct thread *child =machine__find_thread (trace->host, ret, ret); +fprintf (trace->output,"%ld" , ret);if (child !=NULL ) { -fprintf (trace->output,"%ld" , ret);if (thread__comm_set (child))fprintf (trace->output," (%s)" ,thread__comm_str (child));thread__put (child);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 300/512 nfs: clear SB_RDONLY before getting superblock
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
[ Upstream commit 8cd9b785943c57a136536250da80ba1eb6f8eb18 ]
As described in the link, commit 52cb7f8f1778 ("nfs: ignore SB_RDONLY when mounting nfs") removed the check for the ro flag when determining whether to share the superblock, which caused issues when mounting different subdirectories under the same export directory via NFSv3. However, this change did not affect NFSv4.
For NFSv3:
1) A single superblock is created for the initial mount.
2) When mounted read-only, this superblock carries the SB_RDONLY flag.
3) Before commit 52cb7f8f1778 ("nfs: ignore SB_RDONLY when mounting nfs"):
Subsequent rw mounts would not share the existing ro superblock due to flag mismatch, creating a new superblock without SB_RDONLY. After the commit:
The SB_RDONLY flag is ignored during superblock comparison, and this leads to sharing the existing superblock even for rw mounts. Ultimately results in write operations being rejected at the VFS layer.
For NFSv4:
1) Multiple superblocks are created and the last one will be kept.
2) The actually used superblock for ro mounts doesn't carry SB_RDONLY flag. Therefore, commit 52cb7f8f1778 doesn't affect NFSv4 mounts.
Clear SB_RDONLY before getting superblock when NFS_MOUNT_UNSHARED is not set to fix it.
--- fs/nfs/super.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/nfs/super.c +9 -0
@@ -1303,8 +1303,17 @@ int nfs_get_tree_common(struct fs_context *fc)if (IS_ERR (server))return PTR_ERR (server); +/* +* When NFS_MOUNT_UNSHARED is not set, NFS forces the sharing of a +* superblock among each filesystem that mounts sub-directories +* belonging to a single exported root path. +* To prevent interference between different filesystems, the +* SB_RDONLY flag should be removed from the superblock. +*/ if (server->flags &NFS_MOUNT_UNSHARED ) compare_super =NULL ; +else + fc->sb_flags &= ~SB_RDONLY ;/* -o noac implies -o sync */ if (server->flags &NFS_MOUNT_NOAC )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 301/512 nfs: ignore SB_RDONLY when remounting nfs
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
[ Upstream commit 80c4de6ab44c14e910117a02f2f8241ffc6ec54a ]
In some scenarios, when mounting NFS, more than one superblock may be created. The final superblock used is the last one created, but only the first superblock carries the ro flag passed from user space. If a ro flag is added to the superblock via remount, it will trigger the issue described in Link[1].
Link[2] attempted to address this by marking the superblock as ro during the initial mount. However, this introduced a new problem in scenarios where multiple mount points share the same superblock:
[root@a ~]# mount /dev/sdb /mnt/sdb
[root@a ~]# echo "/mnt/sdb *(rw,no_root_squash)" > /etc/exports [root@a ~]# echo "/mnt/sdb/test_dir2 *(ro,no_root_squash)" >> /etc/exports [root@a ~]# systemctl restart nfs-server
[root@a ~]# mount -t nfs -o rw 127.0.0.1:/mnt/sdb/test_dir1 /mnt/test_mp1 [root@a ~]# mount | grep nfs4
127.0.0.1:/mnt/sdb/test_dir1 on /mnt/test_mp1 type nfs4 (rw,relatime,... [root@a ~]# mount -t nfs -o ro 127.0.0.1:/mnt/sdb/test_dir2 /mnt/test_mp2 [root@a ~]# mount | grep nfs4
127.0.0.1:/mnt/sdb/test_dir1 on /mnt/test_mp1 type nfs4 (ro,relatime,... 127.0.0.1:/mnt/sdb/test_dir2 on /mnt/test_mp2 type nfs4 (ro,relatime,... [root@a ~]#
When mounting the second NFS, the shared superblock is marked as ro, causing the previous NFS mount to become read-only.
To resolve both issues, the ro flag is no longer applied to the superblock during remount. Instead, the ro flag on the mount is used to control whether the mount point is read-only.
Link[1]: https://lore.kernel.org/all/[email protected]/
Link[2]: https://lore.kernel.org/all/[email protected]/
--- fs/nfs/super.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/nfs/super.c +10 -0
@@ -1046,6 +1046,16 @@ int nfs_reconfigure(struct fs_context *fc)sync_filesystem (sb); +/* +* The SB_RDONLY flag has been removed from the superblock during +* mounts to prevent interference between different filesystems. +* Similarly, it is also necessary to ignore the SB_RDONLY flag +* during reconfiguration; otherwise, it may also result in the +* creation of redundant superblocks when mounting a directory with +* different rw and ro flags multiple times. +*/ + fc->sb_flags_mask &= ~SB_RDONLY ; +/* * Userspace mount programs that send binary options generally send * them populated with default values. We have no way to know which
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 302/512 perf trace: Set errpid to false for rseq and set_robust_list
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anubhav Shelat <[email protected]>
[ Upstream commit 8c56bfe53bd881c7b598c54a3a06216743c57bbc ]
The 'rseq' and 'set_robust_list' syscalls don't return a pid, so set errpid for both to false.
--- tools/perf/builtin-trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-trace.c +2 -2
@@ -1327,7 +1327,7 @@ static const struct syscall_fmt syscall_fmts[] = { .arg = { [0] = { .scnprintf = SCA_FDAT, /* olddirfd */ }, [2] = { .scnprintf = SCA_FDAT, /* newdirfd */ }, [4] = { .scnprintf = SCA_RENAMEAT2_FLAGS, /* flags */ }, }, }, - { .name = "rseq", .errpid = true, + { .name = "rseq", .arg = { [0] = { .from_user = true /* rseq */, }, }, }, { .name = "rt_sigaction", .arg = { [0] = { .scnprintf = SCA_SIGNUM, /* sig */ }, }, },
@@ -1351,7 +1351,7 @@ static const struct syscall_fmt syscall_fmts[] = { { .name = "sendto", .arg = { [3] = { .scnprintf = SCA_MSG_FLAGS, /* flags */ }, [4] = SCA_SOCKADDR_FROM_USER(addr), }, }, - { .name = "set_robust_list", .errpid = true, + { .name = "set_robust_list", .arg = { [0] = { .from_user = true /* head */, }, }, }, { .name = "set_tid_address", .errpid = true, }, { .name = "setitimer",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 303/512 perf callchain: Always populate the addr_location map when adding IP
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit a913ef6fd883c05bd6538ed21ee1e773f0d750b7 ]
Dropping symbols also meant the callchain maps wasn't populated, but the callchain map is needed to find the DSO.
Plumb the symbols option better, falling back to thread__find_map() rather than thread__find_symbol() when symbols are disabled.
--- tools/perf/util/machine.c | 6 ++++-- tools/perf/util/thread.c | 8 ++++++-- tools/perf/util/thread.h | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-)
tools/perf/util/machine.c +4 -2
@@ -1974,7 +1974,7 @@ static void ip__resolve_ams(struct thread *thread,* Thus, we have to try consecutively until we find a match * or else, the symbol is unknown */ -thread__find_cpumode_addr_location (thread, ip, &al); +thread__find_cpumode_addr_location (thread, ip,/*symbols=*/ true, &al); ams->addr = ip; ams->al_addr = al.addr;
@@ -2076,7 +2076,7 @@ static int add_callchain_ip(struct thread *thread, al.sym =NULL ; al.srcline =NULL ;if (!cpumode) { -thread__find_cpumode_addr_location (thread, ip, &al); +thread__find_cpumode_addr_location (thread, ip, symbols, &al); }else {if (ip >=PERF_CONTEXT_MAX ) {switch (ip) {
@@ -2104,6 +2104,8 @@ static int add_callchain_ip(struct thread *thread, }if (symbols)thread__find_symbol (thread, *cpumode, ip, &al); +else +thread__find_map (thread, *cpumode, ip, &al); }if (al.sym !=NULL ) {
tools/perf/util/thread.c +6 -2
@@ -406,7 +406,7 @@ int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp, bo }void thread__find_cpumode_addr_location (struct thread *thread,u64 addr, -struct addr_location *al) +bool symbols,struct addr_location *al) {size_t i;const u8 cpumodes[] = {
@@ -417,7 +417,11 @@ void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, };for (i =0 ; i <ARRAY_SIZE (cpumodes); i++) { -thread__find_symbol (thread, cpumodes[i], addr, al); +if (symbols) +thread__find_symbol (thread, cpumodes[i], addr, al); +else +thread__find_map (thread, cpumodes[i], addr, al); +if (al->map)break ; }
tools/perf/util/thread.h +1 -1
@@ -122,7 +122,7 @@ struct symbol *thread__find_symbol_fb(struct thread *thread, u8 cpumode, u64 addr, struct addr_location *al);void thread__find_cpumode_addr_location (struct thread *thread,u64 addr, -struct addr_location *al); +bool symbols,struct addr_location *al);int thread__memcpy (struct thread *thread,struct machine *machine,void *buf,u64 ip,int len,bool *is64bit);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 304/512 cifs: Fix validation of SMB1 query reparse point response
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
[ Upstream commit 56e84c64fc257a95728ee73165456b025c48d408 ]
Validate the SMB1 query reparse point response per [MS-CIFS] section 2.2.7.2 NT_TRANSACT_IOCTL.
NT_TRANSACT_IOCTL response contains one word long setup data after which is ByteCount member. So check that SetupCount is 1 before trying to read and use ByteCount member.
Output setup data contains ReturnedDataLen member which is the output length of executed IOCTL command by remote system. So check that output was not truncated before transferring over network.
Change MaxSetupCount of NT_TRANSACT_IOCTL request from 4 to 1 as io_rsp structure already expects one word long output setup data. This should prevent server sending incompatible structure (in case it would be extended in future, which is unlikely).
Change MaxParameterCount of NT_TRANSACT_IOCTL request from 2 to 0 as NT IOCTL does not have any documented output parameters and this function does not parse any output parameters at all.
--- fs/smb/client/cifssmb.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
fs/smb/client/cifssmb.c +18 -2
@@ -2780,10 +2780,10 @@ int cifs_query_reparse_point(const unsigned int xid, io_req->TotalParameterCount =0 ; io_req->TotalDataCount =0 ; - io_req->MaxParameterCount =cpu_to_le32 (2 ); + io_req->MaxParameterCount =cpu_to_le32 (0 );/* BB find exact data count max from sess structure BB */ io_req->MaxDataCount =cpu_to_le32 (CIFSMaxBufSize &0xFFFFFF00 ); - io_req->MaxSetupCount =4 ; + io_req->MaxSetupCount =1 ; io_req->Reserved =0 ; io_req->ParameterOffset =0 ; io_req->DataCount =0 ;
@@ -2810,6 +2810,22 @@ int cifs_query_reparse_point(const unsigned int xid, goto error; } +/* SetupCount must be 1, otherwise offset to ByteCount is incorrect. */ +if (io_rsp->SetupCount !=1 ) { + rc = -EIO ; + goto error; + } + +/* +* ReturnedDataLen is output length of executed IOCTL. +* DataCount is output length transferred over network. +* Check that we have full FSCTL_GET_REPARSE_POINT buffer. +*/ +if (data_count !=le16_to_cpu (io_rsp->ReturnedDataLen)) { + rc = -EIO ; + goto error; + } + end =2 +get_bcc (&io_rsp->hdr) + (__u8 *)&io_rsp->ByteCount; start = (__u8 *)&io_rsp->hdr.Protocol + data_offset;if (start >= end) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 305/512 rust: alloc: add missing invariant in Vec::set_len()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danilo Krummrich <[email protected]>
[ Upstream commit fb1bf1067de979c89ae33589e0466d6ce0dde204 ]
When setting a new length, we have to justify that the set length represents the exact number of elements stored in the vector.
--- rust/kernel/alloc/kvec.rs | 3 +++ 1 file changed, 3 insertions(+)
rust/kernel/alloc/kvec.rs +3 -0
@@ -196,6 +196,9 @@ where#[inline] pub unsafe fn set_len (&mut self, new_len:usize ) {debug_assert! (new_len <= self.capacity ()); + +// INVARIANT: By the safety requirements of this method `new_len` represents the exact +// number of elements stored within `self`. self.len = new_len; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 306/512 rtc: sh: assign correct interrupts with DT
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 8f2efdbc303fe7baa83843d3290dd6ea5ba3276c ]
The DT bindings for this driver define the interrupts in the order as they are numbered in the interrupt controller. The old platform_data, however, listed them in a different order. So, for DT based platforms, they are mixed up. Assign them specifically for DT, so we can keep the bindings stable. After the fix, 'rtctest' passes again on the Renesas Genmai board (RZ-A1 / R7S72100).
--- drivers/rtc/rtc-sh.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/rtc/rtc-sh.c +9 -3
@@ -485,9 +485,15 @@ static int __init sh_rtc_probe(struct platform_device *pdev)return -ENOENT ; } - rtc->periodic_irq = ret; - rtc->carry_irq =platform_get_irq (pdev,1 ); - rtc->alarm_irq =platform_get_irq (pdev,2 ); +if (!pdev->dev.of_node) { + rtc->periodic_irq = ret; + rtc->carry_irq =platform_get_irq (pdev,1 ); + rtc->alarm_irq =platform_get_irq (pdev,2 ); + }else { + rtc->alarm_irq = ret; + rtc->periodic_irq =platform_get_irq (pdev,1 ); + rtc->carry_irq =platform_get_irq (pdev,2 ); + } res =platform_get_resource (pdev,IORESOURCE_IO ,0 );if (!res)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 307/512 phy: rockchip: samsung-hdptx: Fix clock ratio setup
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 0422253ac1919fea8292381c85f11a9decff1bb1 ]
The switch from 1/10 to 1/40 clock ratio must happen when exceeding the 340 MHz rate limit of HDMI 1.4, i.e. when entering the HDMI 2.0 domain, and not before.
Therefore, use the correct comparison operator '>' instead of '>=' when checking the max rate. While at it, introduce a define for this rate limit constant.
--- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +2 -1
@@ -192,6 +192,7 @@#define LN3_TX_SER_RATE_SEL_HBR2 BIT(3)#define LN3_TX_SER_RATE_SEL_HBR3 BIT(2) +#define HDMI14_MAX_RATE 340000000#define HDMI20_MAX_RATE 600000000struct lcpll_config {
@@ -851,7 +852,7 @@ static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx,regmap_write (hdptx->regmap,LNTOP_REG (0200 ),0x06 ); -if (rate >=3400000 ) { +if (rate >HDMI14_MAX_RATE /100 ) {/* For 1/40 bitrate clk */ rk_hdptx_multi_reg_write (hdptx, rk_hdtpx_tmds_lntop_highbr_seq); }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 308/512 phy: rockchip: samsung-hdptx: Do no set rk_hdptx_phy->rate in case of errors
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 1f4d382769e3b38dfc498c806811dae856e40f31 ]
Ensure rk_hdptx_ropll_tmds_cmn_config() updates hdptx->rate only after all the other operations have been successful.
--- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +6 -4
@@ -781,9 +781,7 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx, {const struct ropll_config *cfg =NULL ;struct ropll_config rc = {0 }; -int i; - - hdptx->rate = rate *100 ; +int ret, i;for (i =0 ; i <ARRAY_SIZE (ropll_tmds_cfg); i++)if (rate == ropll_tmds_cfg[i].bit_rate) {
@@ -842,7 +840,11 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx,regmap_update_bits (hdptx->regmap,CMN_REG (0086 ),PLL_PCG_CLK_EN ,PLL_PCG_CLK_EN ); -return rk_hdptx_post_enable_pll (hdptx); + ret =rk_hdptx_post_enable_pll (hdptx); +if (!ret) + hdptx->rate = rate *100 ; + +return ret; } static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 309/512 PCI: Print the actual delay time in pci_bridge_wait_for_secondary_bus()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wilfred Mallawa <[email protected]>
[ Upstream commit d24eba726aadf8778f2907dd42281c6380b0ccaa ]
Print the delay amount that pcie_wait_for_link_delay() is invoked with instead of the hardcoded 1000ms value in the debug info print.
--- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
@@ -4945,7 +4945,7 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type) delay);if (!pcie_wait_for_link_delay (dev, true, delay)) {/* Did not train, no need to wait any further */ -pci_info (dev,"Data Link Layer Link Active not set in 1000 msec\n" ); +pci_info (dev,"Data Link Layer Link Active not set in %d msec\n" , delay);return -ENOTTY ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 310/512 PCI: rcar-gen4: set ep BAR4 fixed size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit b584ab12d59f646b9254b2b16ff197d612fd4935 ]
On rcar-gen4, the ep BAR4 has a fixed size of 256B. Document this constraint in the epc features of the platform.
--- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-rcar-gen4.c +1 -0
@@ -403,6 +403,7 @@ static const struct pci_epc_features rcar_gen4_pcie_epc_features = { .msix_capable = false, .bar[BAR_1] = { .type = BAR_RESERVED, }, .bar[BAR_3] = { .type = BAR_RESERVED, }, + .bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = 256 }, .bar[BAR_5] = { .type = BAR_RESERVED, }, .align = SZ_1M, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 311/512 PCI: cadence: Fix runtime atomic count underflow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit 8805f32a96d3b97cef07999fa6f52112678f7e65 ]
If the call to pci_host_probe() in cdns_pcie_host_setup() fails, PM runtime count is decremented in the error path using pm_runtime_put_sync(). But the runtime count is not incremented by this driver, but only by the callers (cdns_plat_pcie_probe/j721e_pcie_probe). And the callers also decrement the runtime PM count in their error path. So this leads to the below warning from the PM core:
"runtime PM usage count underflow!"
So fix it by getting rid of pm_runtime_put_sync() in the error path and directly return the errno.
--- drivers/pci/controller/cadence/pcie-cadence-host.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/pci/controller/cadence/pcie-cadence-host.c +1 -10
@@ -570,14 +570,5 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)if (!bridge->ops) bridge->ops = &cdns_pcie_host_ops; - ret =pci_host_probe (bridge); -if (ret <0 ) - goto err_init; - -return 0 ; - - err_init: -pm_runtime_put_sync (dev); - -return ret; +return pci_host_probe (bridge); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 312/512 PCI: apple: Use gpiod_set_value_cansleep in probe flow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit 7334364f9de79a9a236dd0243ba574b8d2876e89 ]
We're allowed to sleep here, so tell the GPIO core by using gpiod_set_value_cansleep instead of gpiod_set_value.
--- drivers/pci/controller/pcie-apple.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/pcie-apple.c +2 -2
@@ -541,7 +541,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,rmw_set (PORT_APPCLK_EN , port->base +PORT_APPCLK );/* Assert PERST# before setting up the clock */ -gpiod_set_value (reset,1 ); +gpiod_set_value_cansleep (reset,1 ); ret =apple_pcie_setup_refclk (pcie, port);if (ret <0 )
@@ -552,7 +552,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,/* Deassert PERST# */ rmw_set (PORT_PERST_OFF , port->base +PORT_PERST ); -gpiod_set_value (reset,0 ); +gpiod_set_value_cansleep (reset,0 );/* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ msleep (100 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 313/512 PCI: Explicitly put devices into D0 when initializing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 4d4c10f763d7808fbade28d83d237411603bca05 ]
AMD BIOS team has root caused an issue that NVMe storage failed to come back from suspend to a lack of a call to _REG when NVMe device was probed.
112a7f9c8edbf ("PCI/ACPI: Call _REG when transitioning D-states") added support for calling _REG when transitioning D-states, but this only works if the device actually "transitions" D-states.
967577b062417 ("PCI/PM: Keep runtime PM enabled for unbound PCI devices") added support for runtime PM on PCI devices, but never actually 'explicitly' sets the device to D0.
To make sure that devices are in D0 and that platform methods such as _REG are called, explicitly set all devices into D0 during initialization.
--- drivers/pci/pci-driver.c | 6 ------ drivers/pci/pci.c | 13 ++++++++++--- drivers/pci/pci.h | 1 + 3 files changed, 11 insertions(+), 9 deletions(-)
drivers/pci/pci-driver.c +0 -6
@@ -555,12 +555,6 @@ static void pci_pm_default_resume(struct pci_dev *pci_dev)pci_enable_wake (pci_dev,PCI_D0 , false); } -static void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev) -{ -pci_power_up (pci_dev); -pci_update_current_state (pci_dev,PCI_D0 ); -} -static void pci_pm_default_resume_early (struct pci_dev *pci_dev) {pci_pm_power_up_and_verify_state (pci_dev);
drivers/pci/pci.c +10 -3
@@ -3185,6 +3185,12 @@ void pci_d3cold_disable(struct pci_dev *dev) }EXPORT_SYMBOL_GPL (pci_d3cold_disable); +void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev) +{ +pci_power_up (pci_dev); +pci_update_current_state (pci_dev,PCI_D0 ); +} +/** * pci_pm_init - Initialize PM functions of given PCI device * @dev: PCI device to handle.
@@ -3195,9 +3201,6 @@ void pci_pm_init(struct pci_dev *dev)u16 status;u16 pmc; -pm_runtime_forbid (&dev->dev); -pm_runtime_set_active (&dev->dev); -pm_runtime_enable (&dev->dev);device_enable_async_suspend (&dev->dev); dev->wakeup_prepared = false;
@@ -3259,6 +3262,10 @@ void pci_pm_init(struct pci_dev *dev)pci_read_config_word (dev,PCI_STATUS , &status);if (status &PCI_STATUS_IMM_READY ) dev->imm_ready =1 ; +pci_pm_power_up_and_verify_state (dev); +pm_runtime_forbid (&dev->dev); +pm_runtime_set_active (&dev->dev); +pm_runtime_enable (&dev->dev); }static unsigned long pci_ea_flags (struct pci_dev *dev,u8 prop)
drivers/pci/pci.h +1 -0
@@ -146,6 +146,7 @@ void pci_dev_adjust_pme(struct pci_dev *dev);void pci_dev_complete_resume (struct pci_dev *pci_dev);void pci_config_pm_runtime_get (struct pci_dev *dev);void pci_config_pm_runtime_put (struct pci_dev *dev); +void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev);void pci_pm_init (struct pci_dev *dev);void pci_ea_init (struct pci_dev *dev);void pci_msi_init (struct pci_dev *dev);
Signature · 1 line
2.39.5
Re: [PATCH 6.12 313/512] PCI: Explicitly put devices into D0 when initializing
Quoted 31 lines · Greg Kroah-Hartman
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit
4d4c10f763d7808fbade28d83d237411603bca05]AMD BIOS team has root caused an issue that NVMe storage failed to come back from suspend to a lack of a call to
_REGwhen NVMe device was probed.
112a7f9c8edbf("PCI/ACPI: Call_REGwhen transitioning D-states") added support for calling_REGwhen transitioning D-states, but this only works if the device actually "transitions" D-states.
967577b062417("PCI/PM: Keep runtime PM enabled for unbound PCI devices") added support for runtime PM on PCI devices, but never actually 'explicitly' sets the device to D0.To make sure that devices are in D0 and that platform methods such as
_REGare called, explicitly set all devices into D0 during initialization.Fixes 967577b062417 ("PCI/PM: Keep runtime PM enabled for unbound PCI devices")Signed-off-by Mario Limonciello <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Tested-by Denis Benato <[email protected]>Tested-by Yijun Shen <[email protected]>Tested-by David Perry <[email protected]>Reviewed-by Rafael J. Wysocki <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 1 line
---
Same comment as on 6.6:
I do think this should come back to stable, but I think we need to wait a stable cycle to pick it up so that it can come with this fix too.
https://lore.kernel.org/linux-pci/[email protected]/
Quoted 72 lines
drivers/pci/pci-driver.c | 6 ------ drivers/pci/pci.c | 13 ++++++++++--- drivers/pci/pci.h | 1 + 3 files changed, 11 insertions(+), 9 deletions(-)drivers/pci/pci-driver.c +0
-6@@ -555,12 +555,6 @@ static void pci_pm_default_resume(struct pci_dev *pci_dev)pci_enable_wake (pci_dev,PCI_D0 , false); } -static void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev) -{ -pci_power_up (pci_dev); -pci_update_current_state (pci_dev,PCI_D0 ); -} -static void pci_pm_default_resume_early (struct pci_dev *pci_dev) {pci_pm_power_up_and_verify_state (pci_dev);drivers/pci/pci.c +10
-3@@ -3185,6 +3185,12 @@ void pci_d3cold_disable(struct pci_dev *dev) }EXPORT_SYMBOL_GPL (pci_d3cold_disable); +void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev) +{ +pci_power_up (pci_dev); +pci_update_current_state (pci_dev,PCI_D0 ); +} +/** * pci_pm_init - Initialize PM functions of given PCI device * @dev: PCI device to handle. @@ -3195,9 +3201,6 @@ void pci_pm_init(struct pci_dev *dev)u16 status;u16 pmc; -pm_runtime_forbid (&dev->dev); -pm_runtime_set_active (&dev->dev); -pm_runtime_enable (&dev->dev);device_enable_async_suspend (&dev->dev); dev->wakeup_prepared = false;@@ -3259,6 +3262,10 @@ void pci_pm_init(struct pci_dev *dev)pci_read_config_word (dev,PCI_STATUS , &status);if (status &PCI_STATUS_IMM_READY ) dev->imm_ready =1 ; +pci_pm_power_up_and_verify_state (dev); +pm_runtime_forbid (&dev->dev); +pm_runtime_set_active (&dev->dev); +pm_runtime_enable (&dev->dev); }static unsigned long pci_ea_flags (struct pci_dev *dev,u8 prop)drivers/pci/pci.h +1
-0@@ -146,6 +146,7 @@ void pci_dev_adjust_pme(struct pci_dev *dev);void pci_dev_complete_resume (struct pci_dev *pci_dev);void pci_config_pm_runtime_get (struct pci_dev *dev);void pci_config_pm_runtime_put (struct pci_dev *dev); +void pci_pm_power_up_and_verify_state (struct pci_dev *pci_dev);void pci_pm_init (struct pci_dev *dev);void pci_ea_init (struct pci_dev *dev);void pci_msi_init (struct pci_dev *dev);
Greg Kroah-Hartman
maintainerRe: [PATCH 6.12 313/512] PCI: Explicitly put devices into D0 when initializing
Quoted 34 lines · Mario
Quoted 31 lines · Greg Kroah-Hartman
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit
4d4c10f763d7808fbade28d83d237411603bca05]AMD BIOS team has root caused an issue that NVMe storage failed to come back from suspend to a lack of a call to
_REGwhen NVMe device was probed.
112a7f9c8edbf("PCI/ACPI: Call_REGwhen transitioning D-states") added support for calling_REGwhen transitioning D-states, but this only works if the device actually "transitions" D-states.
967577b062417("PCI/PM: Keep runtime PM enabled for unbound PCI devices") added support for runtime PM on PCI devices, but never actually 'explicitly' sets the device to D0.To make sure that devices are in D0 and that platform methods such as
_REGare called, explicitly set all devices into D0 during initialization.Fixes 967577b062417 ("PCI/PM: Keep runtime PM enabled for unbound PCI devices")Signed-off-by Mario Limonciello <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Tested-by Denis Benato <[email protected]>Tested-by Yijun Shen <[email protected]>Tested-by David Perry <[email protected]>Reviewed-by Rafael J. Wysocki <[email protected]>Signed-off-by Sasha Levin <[email protected]>Quoted 1 line
---
Quoted 6 lines
Same comment as on 6.6:
I do think this should come back to stable, but I think we need to wait a stable cycle to pick it up so that it can come with this fix too.
Now dropped from all queues, thanks!
greg k-h
Greg Kroah-Hartman
maintainerPATCH 314/512 phy: qcom-qmp-usb: Fix an NULL vs IS_ERR() bug
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit d14402a38c2d868cacb1facaf9be908ca6558e59 ]
The qmp_usb_iomap() helper function currently returns the raw result of devm_ioremap() for non-exclusive mappings. Since devm_ioremap() may return a NULL pointer and the caller only checks error pointers with IS_ERR(), NULL could bypass the check and lead to an invalid dereference.
Fix the issue by checking if devm_ioremap() returns NULL. When it does, qmp_usb_iomap() now returns an error pointer via IOMEM_ERR_PTR(-ENOMEM), ensuring safe and consistent error handling.
--- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp-usb.c +5 -1
@@ -2044,12 +2044,16 @@ static void __iomem *qmp_usb_iomap(struct device *dev, struct device_node *np, int index, bool exclusive) {struct resource res; +void __iomem *mem;if (!exclusive) {if (of_address_to_resource (np, index, &res))return IOMEM_ERR_PTR (-EINVAL ); -return devm_ioremap (dev, res.start,resource_size (&res)); + mem =devm_ioremap (dev, res.start,resource_size (&res)); +if (!mem) +return IOMEM_ERR_PTR (-ENOMEM ); +return mem; }return devm_of_iomap (dev, np, index,NULL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 315/512 dmaengine: ti: Add NULL check in udma_probe()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit fd447415e74bccd7362f760d4ea727f8e1ebfe91 ]
devm_kasprintf() returns NULL when memory allocation fails. Currently, udma_probe() does not check for this case, which results in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue.
--- drivers/dma/ti/k3-udma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/ti/k3-udma.c +2 -1
@@ -5572,7 +5572,8 @@ static int udma_probe(struct platform_device *pdev) uc->config.dir =DMA_MEM_TO_MEM ; uc->name =devm_kasprintf (dev,GFP_KERNEL ,"%s chan%d" ,dev_name (dev), i); - +if (!uc->name) +return -ENOMEM ;vchan_init (&uc->vc, &ud->ddev);/* Use custom vchan completion handling */ tasklet_setup (&uc->vc.task, udma_vchan_complete);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 316/512 PCI/ACPI: Fix allocated memory release on error in pci_acpi_scan_root()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhe Qiao <[email protected]>
[ Upstream commit 631b2af2f35737750af284be22e63da56bf20139 ]
In the pci_acpi_scan_root() function, when creating a PCI bus fails, we need to free up the previously allocated memory, which can avoid invalid memory usage and save resources.
--- drivers/pci/pci-acpi.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/pci/pci-acpi.c +13 -10
@@ -1676,24 +1676,19 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)return NULL ; root_ops =kzalloc (sizeof (*root_ops),GFP_KERNEL ); -if (!root_ops) { -kfree (ri); -return NULL ; - } +if (!root_ops) + goto free_ri; ri->cfg =pci_acpi_setup_ecam_mapping (root); -if (!ri->cfg) { -kfree (ri); -kfree (root_ops); -return NULL ; - } +if (!ri->cfg) + goto free_root_ops; root_ops->release_info = pci_acpi_generic_release_info; root_ops->prepare_resources = pci_acpi_root_prepare_resources; root_ops->pci_ops = (struct pci_ops *)&ri->cfg->ops->pci_ops; bus =acpi_pci_root_create (root, root_ops, &ri->common, ri->cfg);if (!bus) -return NULL ; + goto free_cfg;/* If we must preserve the resource configuration, claim now */ host =pci_find_host_bridge (bus);
@@ -1710,6 +1705,14 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)pcie_bus_configure_settings (child);return bus; + +free_cfg: +pci_ecam_free (ri->cfg); +free_root_ops: +kfree (root_ops); +free_ri: +kfree (ri); +return NULL ; }void pcibios_add_bus (struct pci_bus *bus)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 317/512 PCI/DPC: Initialize aer_err_info before using it
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
[ Upstream commit a424b598e6a6c1e69a2bb801d6fd16e805ab2c38 ]
Previously the struct aer_err_info "info" was allocated on the stack without being initialized, so it contained junk except for the fields we explicitly set later.
Initialize "info" at declaration so it starts as all zeros.
--- drivers/pci/pcie/dpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pcie/dpc.c +1 -1
@@ -260,7 +260,7 @@ static int dpc_get_aer_uncorrect_severity(struct pci_dev *dev,void dpc_process_error (struct pci_dev *pdev) {u16 cap = pdev->dpc_cap, status, source, reason, ext_reason; -struct aer_err_info info; +struct aer_err_info info = {};pci_read_config_word (pdev, cap +PCI_EXP_DPC_STATUS , &status);pci_read_config_word (pdev, cap +PCI_EXP_DPC_SOURCE_ID , &source);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 318/512 PCI/DPC: Log Error Source ID only when valid
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
[ Upstream commit a0b62cc310239c7f1323fb20bd3789f21bdd8615 ]
DPC Error Source ID is only valid when the DPC Trigger Reason indicates that DPC was triggered due to reception of an ERR_NONFATAL or ERR_FATAL Message (PCIe r6.0, sec 7.9.14.5).
When DPC was triggered by ERR_NONFATAL (PCI_EXP_DPC_STATUS_TRIGGER_RSN_NFE) or ERR_FATAL (PCI_EXP_DPC_STATUS_TRIGGER_RSN_FE) from a downstream device, log the Error Source ID (decoded into domain/bus/device/function). Don't print the source otherwise, since it's not valid.
For DPC trigger due to reception of ERR_NONFATAL or ERR_FATAL, the dmesg logging changes:
- pci 0000:00:01.0: DPC: containment event, status:0x000d source:0x0200
- pci 0000:00:01.0: DPC: ERR_FATAL detected
+ pci 0000:00:01.0: DPC: containment event, status:0x000d, ERR_FATAL received from 0000:02:00.0
and when DPC triggered for other reasons, where DPC Error Source ID is undefined, e.g., unmasked uncorrectable error:
- pci 0000:00:01.0: DPC: containment event, status:0x0009 source:0x0200
- pci 0000:00:01.0: DPC: unmasked uncorrectable error detected
+ pci 0000:00:01.0: DPC: containment event, status:0x0009: unmasked uncorrectable error detected
Previously the "containment event" message was at KERN_INFO and the "%s detected" message was at KERN_WARNING. Now the single message is at KERN_WARNING.
--- drivers/pci/pcie/dpc.c | 66 +++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 29 deletions(-)
drivers/pci/pcie/dpc.c +37 -29
@@ -263,37 +263,45 @@ void dpc_process_error(struct pci_dev *pdev)struct aer_err_info info = {};pci_read_config_word (pdev, cap +PCI_EXP_DPC_STATUS , &status); -pci_read_config_word (pdev, cap +PCI_EXP_DPC_SOURCE_ID , &source); - -pci_info (pdev,"containment event, status:%#06x source:%#06x\n" , - status, source); reason = status &PCI_EXP_DPC_STATUS_TRIGGER_RSN ; - ext_reason = status &PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT ; -pci_warn (pdev,"%s detected\n" , - (reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_UNCOR ) ? -"unmasked uncorrectable error" : - (reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_NFE ) ? -"ERR_NONFATAL" : - (reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_FE ) ? -"ERR_FATAL" : - (ext_reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_RP_PIO ) ? -"RP PIO error" : - (ext_reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_SW_TRIGGER ) ? -"software trigger" : -"reserved error" ); - -/* show RP PIO error detail information */ -if (pdev->dpc_rp_extensions && - reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_IN_EXT && - ext_reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_RP_PIO ) -dpc_process_rp_pio_error (pdev); -else if (reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_UNCOR && -dpc_get_aer_uncorrect_severity (pdev, &info) && -aer_get_device_error_info (pdev, &info)) { -aer_print_error (pdev, &info); -pci_aer_clear_nonfatal_status (pdev); -pci_aer_clear_fatal_status (pdev); + +switch (reason) { +case PCI_EXP_DPC_STATUS_TRIGGER_RSN_UNCOR : +pci_warn (pdev,"containment event, status:%#06x: unmasked uncorrectable error detected\n" , + status); +if (dpc_get_aer_uncorrect_severity (pdev, &info) && +aer_get_device_error_info (pdev, &info)) { +aer_print_error (pdev, &info); +pci_aer_clear_nonfatal_status (pdev); +pci_aer_clear_fatal_status (pdev); + } +break ; +case PCI_EXP_DPC_STATUS_TRIGGER_RSN_NFE : +case PCI_EXP_DPC_STATUS_TRIGGER_RSN_FE : +pci_read_config_word (pdev, cap +PCI_EXP_DPC_SOURCE_ID , + &source); +pci_warn (pdev,"containment event, status:%#06x, %s received from %04x:%02x:%02x.%d\n" , + status, + (reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_FE ) ? +"ERR_FATAL" :"ERR_NONFATAL" , +pci_domain_nr (pdev->bus),PCI_BUS_NUM (source), +PCI_SLOT (source),PCI_FUNC (source)); +break ; +case PCI_EXP_DPC_STATUS_TRIGGER_RSN_IN_EXT : + ext_reason = status &PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT ; +pci_warn (pdev,"containment event, status:%#06x: %s detected\n" , + status, + (ext_reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_RP_PIO ) ? +"RP PIO error" : + (ext_reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_SW_TRIGGER ) ? +"software trigger" : +"reserved error" ); +/* show RP PIO error detail information */ +if (ext_reason ==PCI_EXP_DPC_STATUS_TRIGGER_RSN_RP_PIO && + pdev->dpc_rp_extensions) +dpc_process_rp_pio_error (pdev); +break ; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 319/512 rtc: loongson: Add missing alarm notifications for ACPI RTC events
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Dalin <[email protected]>
[ Upstream commit 5af9f1fa576874b24627d4c05e3a84672204c200 ]
When an application sets and enables an alarm on Loongson RTC devices, the alarm notification fails to propagate to userspace because the ACPI event handler omits calling rtc_update_irq().
As a result, processes waiting via select() or poll() on RTC device files fail to receive alarm notifications.
The ACPI interrupt is also triggered multiple times. In loongson_rtc_handler, we need to clear TOY_MATCH0_REG to resolve this issue.
--- drivers/rtc/rtc-loongson.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/rtc/rtc-loongson.c +8 -0
@@ -129,6 +129,14 @@ static u32 loongson_rtc_handler(void *id) {struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id; +rtc_update_irq (priv->rtcdev,1 ,RTC_AF |RTC_IRQF ); + +/* +* The TOY_MATCH0_REG should be cleared 0 here, +* otherwise the interrupt cannot be cleared. +*/ +regmap_write (priv->regmap,TOY_MATCH0_REG ,0 ); +spin_lock (&priv->lock);/* Disable RTC alarm wakeup and interrupt */ writel(readl(priv->pm_base + PM1_EN_REG) & ~RTC_EN,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 320/512 PCI: endpoint: Retain fixed-size BAR size as well as aligned size
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit 793908d60b8745c386b9f4e29eb702f74ceb0886 ]
When allocating space for an endpoint function on a BAR with a fixed size, the size saved in 'struct pci_epf_bar.size' should be the fixed size as expected by pci_epc_set_bar().
However, if pci_epf_alloc_space() increased the allocation size to accommodate iATU alignment requirements, it previously saved the larger aligned size in .size, which broke pci_epc_set_bar().
To solve this, keep the fixed BAR size in .size and save the aligned size in a new .aligned_size for use when deallocating it.
--- drivers/pci/endpoint/pci-epf-core.c | 22 +++++++++++++++------- include/linux/pci-epf.h | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-)
drivers/pci/endpoint/pci-epf-core.c +15 -7
@@ -236,12 +236,13 @@ void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar, } dev = epc->dev.parent; -dma_free_coherent (dev, epf_bar[bar].size, addr, +dma_free_coherent (dev, epf_bar[bar].aligned_size, addr, epf_bar[bar].phys_addr); epf_bar[bar].phys_addr =0 ; epf_bar[bar].addr =NULL ; epf_bar[bar].size =0 ; + epf_bar[bar].aligned_size =0 ; epf_bar[bar].barno =0 ; epf_bar[bar].flags =0 ; }
@@ -264,7 +265,7 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, enum pci_epc_interface_type type) {u64 bar_fixed_size = epc_features->bar[bar].fixed_size; -size_t align = epc_features->align; +size_t aligned_size, align = epc_features->align;struct pci_epf_bar *epf_bar;dma_addr_t phys_addr;struct pci_epc *epc;
@@ -281,12 +282,18 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar,return NULL ; } size = bar_fixed_size; + }else { +/* BAR size must be power of two */ + size =roundup_pow_of_two (size); } -if (align) - size =ALIGN (size, align); -else - size =roundup_pow_of_two (size); +/* +* Allocate enough memory to accommodate the iATU alignment +* requirement. In most cases, this will be the same as .size but +* it might be different if, for example, the fixed size of a BAR +* is smaller than align. +*/ + aligned_size = align ?ALIGN (size, align) : size;if (type ==PRIMARY_INTERFACE ) { epc = epf->epc;
@@ -297,7 +304,7 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, } dev = epc->dev.parent; - space =dma_alloc_coherent (dev, size, &phys_addr,GFP_KERNEL ); + space =dma_alloc_coherent (dev, aligned_size, &phys_addr,GFP_KERNEL );if (!space) {dev_err (dev,"failed to allocate mem space\n" );return NULL ;
@@ -306,6 +313,7 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, epf_bar[bar].phys_addr = phys_addr; epf_bar[bar].addr = space; epf_bar[bar].size = size; + epf_bar[bar].aligned_size = aligned_size; epf_bar[bar].barno = bar;if (upper_32_bits (size) || epc_features->bar[bar].only_64bit) epf_bar[bar].flags |=PCI_BASE_ADDRESS_MEM_TYPE_64 ;
include/linux/pci-epf.h +3 -0
@@ -114,6 +114,8 @@ struct pci_epf_driver {* @phys_addr: physical address that should be mapped to the BAR * @addr: virtual address corresponding to the @phys_addr * @size: the size of the address space present in BAR +* @aligned_size: the size actually allocated to accommodate the iATU alignment +* requirement * @barno: BAR number * @flags: flags that are set for the BAR */
@@ -121,6 +123,7 @@ struct pci_epf_bar {dma_addr_t phys_addr;void *addr;size_t size; +size_t aligned_size;enum pci_barno barno;int flags; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 321/512 usb: renesas_usbhs: Reorder clock handling and power management in probe
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit ffb34a60ce86656ba12d46e91f1ccc71dd221251 ]
Reorder the initialization sequence in usbhs_probe() to enable runtime PM before accessing registers, preventing potential crashes due to uninitialized clocks.
Currently, in the probe path, registers are accessed before enabling the clocks, leading to a synchronous external abort on the RZ/V2H SoC. The problematic call flow is as follows:
usbhs_probe()
usbhs_sys_clock_ctrl()
usbhs_bset()
usbhs_write()
iowrite16() <-- Register access before enabling clocks
Since iowrite16() is performed without ensuring the required clocks are enabled, this can lead to access errors. To fix this, enable PM runtime early in the probe function and ensure clocks are acquired before register access, preventing crashes like the following on RZ/V2H:
[13.272640] Internal error: synchronous external abort: 0000000096000010 [#1] PREEMPT SMP [13.280814] Modules linked in: cec renesas_usbhs(+) drm_kms_helper fuse drm backlight ipv6 [13.289088] CPU: 1 UID: 0 PID: 195 Comm: (udev-worker) Not tainted 6.14.0-rc7+ #98 [13.296640] Hardware name: Renesas RZ/V2H EVK Board based on r9a09g057h44 (DT) [13.303834] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [13.310770] pc : usbhs_bset+0x14/0x4c [renesas_usbhs] [13.315831] lr : usbhs_probe+0x2e4/0x5ac [renesas_usbhs] [13.321138] sp : ffff8000827e3850 [13.324438] x29: ffff8000827e3860 x28: 0000000000000000 x27: ffff8000827e3ca0 [13.331554] x26: ffff8000827e3ba0 x25: ffff800081729668 x24: 0000000000000025 [13.338670] x23: ffff0000c0f08000 x22: 0000000000000000 x21: ffff0000c0f08010 [13.345783] x20: 0000000000000000 x19: ffff0000c3b52080 x18: 00000000ffffffff [13.352895] x17: 0000000000000000 x16: 0000000000000000 x15: ffff8000827e36ce [13.360009] x14: 00000000000003d7 x13: 00000000000003d7 x12: 0000000000000000 [13.367122] x11: 0000000000000000 x10: 0000000000000aa0 x9 : ffff8000827e3750 [13.374235] x8 : ffff0000c1850b00 x7 : 0000000003826060 x6 : 000000000000001c [13.381347] x5 : 000000030d5fcc00 x4 : ffff8000825c0000 x3 : 0000000000000000 [13.388459] x2 : 0000000000000400 x1 : 0000000000000000 x0 : ffff0000c3b52080 [13.395574] Call trace: [13.398013] usbhs_bset+0x14/0x4c [renesas_usbhs] (P) [13.403076] platform_probe+0x68/0xdc [13.406738] really_probe+0xbc/0x2c0 [13.410306] __driver_probe_device+0x78/0x120 [13.414653] driver_probe_device+0x3c/0x154 [13.418825] __driver_attach+0x90/0x1a0 [13.422647] bus_for_each_dev+0x7c/0xe0 [13.426470] driver_attach+0x24/0x30 [13.430032] bus_add_driver+0xe4/0x208 [13.433766] driver_register+0x68/0x130 [13.437587] __platform_driver_register+0x24/0x30 [13.442273] renesas_usbhs_driver_init+0x20/0x1000 [renesas_usbhs] [13.448450] do_one_initcall+0x60/0x1d4 [13.452276] do_init_module+0x54/0x1f8 [13.456014] load_module+0x1754/0x1c98 [13.459750] init_module_from_file+0x88/0xcc [13.464004] __arm64_sys_finit_module+0x1c4/0x328 [13.468689] invoke_syscall+0x48/0x104 [13.472426] el0_svc_common.constprop.0+0xc0/0xe0 [13.477113] do_el0_svc+0x1c/0x28 [13.480415] el0_svc+0x30/0xcc [13.483460] el0t_64_sync_handler+0x10c/0x138 [13.487800] el0t_64_sync+0x198/0x19c [13.491453] Code: 2a0103e1 12003c42 12003c63 8b010084 (79400084) [13.497522] ---[ end trace 0000000000000000 ]---
--- drivers/usb/renesas_usbhs/common.c | 50 +++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 12 deletions(-)
drivers/usb/renesas_usbhs/common.c +38 -12
@@ -685,10 +685,29 @@ static int usbhs_probe(struct platform_device *pdev)INIT_DELAYED_WORK (&priv->notify_hotplug_work, usbhsc_notify_hotplug);spin_lock_init (usbhs_priv_to_lock (priv)); +/* +* Acquire clocks and enable power management (PM) early in the +* probe process, as the driver accesses registers during +* initialization. Ensure the device is active before proceeding. +*/ +pm_runtime_enable (dev); + + ret =usbhsc_clk_get (dev, priv); +if (ret) + goto probe_pm_disable; + + ret =pm_runtime_resume_and_get (dev); +if (ret) + goto probe_clk_put; + + ret =usbhsc_clk_prepare_enable (priv); +if (ret) + goto probe_pm_put; +/* call pipe and module init */ ret =usbhs_pipe_probe (priv);if (ret <0 ) -return ret; + goto probe_clk_dis_unprepare; ret =usbhs_fifo_probe (priv);if (ret <0 )
@@ -705,10 +724,6 @@ static int usbhs_probe(struct platform_device *pdev)if (ret) goto probe_fail_rst; - ret =usbhsc_clk_get (dev, priv); -if (ret) - goto probe_fail_clks; -/* * deviece reset here because * USB device might be used in boot loader.
@@ -721,7 +736,7 @@ static int usbhs_probe(struct platform_device *pdev)if (ret) {dev_warn (dev,"USB function not selected (GPIO)\n" ); ret = -ENOTSUPP ; - goto probe_end_mod_exit; + goto probe_assert_rest; } }
@@ -735,14 +750,19 @@ static int usbhs_probe(struct platform_device *pdev) ret =usbhs_platform_call (priv, hardware_init, pdev);if (ret <0 ) {dev_err (dev,"platform init failed.\n" ); - goto probe_end_mod_exit; + goto probe_assert_rest; }/* reset phy for connection */ usbhs_platform_call (priv, phy_reset, pdev); -/* power control */ -pm_runtime_enable (dev); +/* +* Disable the clocks that were enabled earlier in the probe path, +* and let the driver handle the clocks beyond this point. +*/ +usbhsc_clk_disable_unprepare (priv); +pm_runtime_put (dev); +if (!usbhs_get_dparam (priv, runtime_pwctrl)) {usbhsc_power_ctrl (priv,1 );usbhs_mod_autonomy_mode (priv);
@@ -759,9 +779,7 @@ static int usbhs_probe(struct platform_device *pdev)return ret; -probe_end_mod_exit: -usbhsc_clk_put (priv); -probe_fail_clks: +probe_assert_rest:reset_control_assert (priv->rsts); probe_fail_rst:usbhs_mod_remove (priv);
@@ -769,6 +787,14 @@ static int usbhs_probe(struct platform_device *pdev)usbhs_fifo_remove (priv); probe_end_pipe_exit:usbhs_pipe_remove (priv); +probe_clk_dis_unprepare: +usbhsc_clk_disable_unprepare (priv); +probe_pm_put: +pm_runtime_put (dev); +probe_clk_put: +usbhsc_clk_put (priv); +probe_pm_disable: +pm_runtime_disable (dev);dev_info (dev,"probe failed (%d)\n" , ret);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 322/512 serial: Fix potential null-ptr-deref in mlb_usio_probe()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Martin <[email protected]>
[ Upstream commit 86bcae88c9209e334b2f8c252f4cc66beb261886 ]
devm_ioremap() can return NULL on error. Currently, mlb_usio_probe() does not check for this case, which could result in a NULL pointer dereference.
Add NULL check after devm_ioremap() to prevent this issue.
--- drivers/tty/serial/milbeaut_usio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/milbeaut_usio.c +4 -1
@@ -523,7 +523,10 @@ static int mlb_usio_probe(struct platform_device *pdev) } port->membase =devm_ioremap (&pdev->dev, res->start,resource_size (res)); - +if (!port->membase) { + ret = -ENOMEM ; + goto failed; + } ret =platform_get_irq_byname (pdev,"rx" ); mlb_usio_irq[index][RX ] = ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 323/512 thunderbolt: Fix a logic error in wake on connect
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 1a760d10ded372d113a0410c42be246315bbc2ff ]
commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports") introduced a sysfs file to control wake up policy for a given USB4 port that defaulted to disabled.
However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake on connect and disconnect over suspend") I found that it was working even without making changes to the power/wakeup file (which defaults to disabled). This is because of a logic error doing a bitwise or of the wake-on-connect flag with device_may_wakeup() which should have been a logical AND.
Adjust the logic so that policy is only applied when wakeup is actually enabled.
--- drivers/thunderbolt/usb4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thunderbolt/usb4.c +2 -2
@@ -440,10 +440,10 @@ int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)bool configured = val &PORT_CS_19_PC ; usb4 = port->usb4; -if (((flags &TB_WAKE_ON_CONNECT ) | +if (((flags &TB_WAKE_ON_CONNECT ) &&device_may_wakeup (&usb4->dev)) && !configured) val |=PORT_CS_19_WOC ; -if (((flags &TB_WAKE_ON_DISCONNECT ) | +if (((flags &TB_WAKE_ON_DISCONNECT ) &&device_may_wakeup (&usb4->dev)) && configured) val |=PORT_CS_19_WOD ;if ((flags &TB_WAKE_ON_USB4 ) && configured)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 324/512 iio: filter: admv8818: fix band 4, state 15
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Winchenbach <[email protected]>
[ Upstream commit ef0ce24f590ac075d5eda11f2d6434b303333ed6 ]
Corrects the upper range of LPF Band 4 from 18.5 GHz to 18.85 GHz per the ADMV8818 datasheet
--- drivers/iio/filter/admv8818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/filter/admv8818.c +1 -1
@@ -103,7 +103,7 @@ static const unsigned long long freq_range_lpf[4][2] = { {2050000000ULL, 3850000000ULL}, {3350000000ULL, 7250000000ULL}, {7000000000, 13000000000}, - {12550000000, 18500000000} + {12550000000, 18850000000} };static const struct regmap_config admv8818_regmap_config = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 325/512 iio: filter: admv8818: fix integer overflow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Winchenbach <[email protected]>
[ Upstream commit fb6009a28d77edec4eb548b5875dae8c79b88467 ]
HZ_PER_MHZ is only unsigned long. This math overflows, leading to incorrect results.
--- drivers/iio/filter/admv8818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/filter/admv8818.c +1 -1
@@ -154,7 +154,7 @@ static int __admv8818_hpf_select(struct admv8818_state *st, u64 freq) }/* Close HPF frequency gap between 12 and 12.5 GHz */ -if (freq >=12000 *HZ_PER_MHZ && freq <=12500 *HZ_PER_MHZ ) { +if (freq >=12000ULL *HZ_PER_MHZ && freq <12500ULL *HZ_PER_MHZ ) { hpf_band =3 ; hpf_step =15 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 326/512 iio: filter: admv8818: fix range calculation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Winchenbach <[email protected]>
[ Upstream commit d542db7095d322bfcdc8e306db6f8c48358c9619 ]
Search for the minimum error while ensuring that the LPF corner frequency is greater than the target, and the HPF corner frequency is lower than the target
This fixes issues where the range calculations were suboptimal.
Add two new DTS properties to set the margin between the input frequency and the calculated corner frequency
Below is a generated table of the differences between the old algorithm and the new. This is a sweep from 0 to 20 GHz in 10 MHz steps. === HPF ===
freq = 1750 MHz, 3db: bypass => 1750 MHz
freq = 3400 MHz, 3db: 3310 => 3400 MHz
freq = 3410 MHz, 3db: 3310 => 3400 MHz
freq = 3420 MHz, 3db: 3310 => 3400 MHz
freq = 3660 MHz, 3db: 3550 => 3656 MHz
freq = 6600 MHz, 3db: 6479 => 6600 MHz
freq = 6610 MHz, 3db: 6479 => 6600 MHz
freq = 6620 MHz, 3db: 6479 => 6600 MHz
freq = 6630 MHz, 3db: 6479 => 6600 MHz
freq = 6640 MHz, 3db: 6479 => 6600 MHz
freq = 6650 MHz, 3db: 6479 => 6600 MHz
freq = 6660 MHz, 3db: 6479 => 6600 MHz
freq = 6670 MHz, 3db: 6479 => 6600 MHz
freq = 6680 MHz, 3db: 6479 => 6600 MHz
freq = 6690 MHz, 3db: 6479 => 6600 MHz
freq = 6700 MHz, 3db: 6479 => 6600 MHz
freq = 6710 MHz, 3db: 6479 => 6600 MHz
freq = 6720 MHz, 3db: 6479 => 6600 MHz
freq = 6730 MHz, 3db: 6479 => 6600 MHz
freq = 6960 MHz, 3db: 6736 => 6960 MHz
freq = 6970 MHz, 3db: 6736 => 6960 MHz
freq = 6980 MHz, 3db: 6736 => 6960 MHz
freq = 6990 MHz, 3db: 6736 => 6960 MHz
freq = 7320 MHz, 3db: 7249 => 7320 MHz
freq = 7330 MHz, 3db: 7249 => 7320 MHz
freq = 7340 MHz, 3db: 7249 => 7320 MHz
freq = 7350 MHz, 3db: 7249 => 7320 MHz
freq = 7360 MHz, 3db: 7249 => 7320 MHz
freq = 7370 MHz, 3db: 7249 => 7320 MHz
freq = 7380 MHz, 3db: 7249 => 7320 MHz
freq = 7390 MHz, 3db: 7249 => 7320 MHz
freq = 7400 MHz, 3db: 7249 => 7320 MHz
freq = 7410 MHz, 3db: 7249 => 7320 MHz
freq = 7420 MHz, 3db: 7249 => 7320 MHz
freq = 7430 MHz, 3db: 7249 => 7320 MHz
freq = 7440 MHz, 3db: 7249 => 7320 MHz
freq = 7450 MHz, 3db: 7249 => 7320 MHz
freq = 7460 MHz, 3db: 7249 => 7320 MHz
freq = 7470 MHz, 3db: 7249 => 7320 MHz
freq = 7480 MHz, 3db: 7249 => 7320 MHz
freq = 7490 MHz, 3db: 7249 => 7320 MHz
freq = 7500 MHz, 3db: 7249 => 7320 MHz
freq = 12500 MHz, 3db: 12000 => 12500 MHz
=== LPF ===
freq = 2050 MHz, 3db: bypass => 2050 MHz freq = 2170 MHz, 3db: 2290 => 2170 MHz freq = 2290 MHz, 3db: 2410 => 2290 MHz freq = 2410 MHz, 3db: 2530 => 2410 MHz freq = 2530 MHz, 3db: 2650 => 2530 MHz freq = 2650 MHz, 3db: 2770 => 2650 MHz freq = 2770 MHz, 3db: 2890 => 2770 MHz freq = 2890 MHz, 3db: 3010 => 2890 MHz freq = 3010 MHz, 3db: 3130 => 3010 MHz freq = 3130 MHz, 3db: 3250 => 3130 MHz freq = 3250 MHz, 3db: 3370 => 3250 MHz freq = 3260 MHz, 3db: 3370 => 3350 MHz freq = 3270 MHz, 3db: 3370 => 3350 MHz freq = 3280 MHz, 3db: 3370 => 3350 MHz freq = 3290 MHz, 3db: 3370 => 3350 MHz freq = 3300 MHz, 3db: 3370 => 3350 MHz freq = 3310 MHz, 3db: 3370 => 3350 MHz freq = 3320 MHz, 3db: 3370 => 3350 MHz freq = 3330 MHz, 3db: 3370 => 3350 MHz freq = 3340 MHz, 3db: 3370 => 3350 MHz freq = 3350 MHz, 3db: 3370 => 3350 MHz freq = 3370 MHz, 3db: 3490 => 3370 MHz freq = 3490 MHz, 3db: 3610 => 3490 MHz freq = 3610 MHz, 3db: 3730 => 3610 MHz freq = 3730 MHz, 3db: 3850 => 3730 MHz freq = 3850 MHz, 3db: 3870 => 3850 MHz freq = 3870 MHz, 3db: 4130 => 3870 MHz freq = 4130 MHz, 3db: 4390 => 4130 MHz freq = 4390 MHz, 3db: 4650 => 4390 MHz freq = 4650 MHz, 3db: 4910 => 4650 MHz freq = 4910 MHz, 3db: 5170 => 4910 MHz freq = 5170 MHz, 3db: 5430 => 5170 MHz freq = 5430 MHz, 3db: 5690 => 5430 MHz freq = 5690 MHz, 3db: 5950 => 5690 MHz freq = 5950 MHz, 3db: 6210 => 5950 MHz freq = 6210 MHz, 3db: 6470 => 6210 MHz freq = 6470 MHz, 3db: 6730 => 6470 MHz freq = 6730 MHz, 3db: 6990 => 6730 MHz freq = 6990 MHz, 3db: 7250 => 6990 MHz freq = 7000 MHz, 3db: 7250 => 7000 MHz freq = 7250 MHz, 3db: 7400 => 7250 MHz freq = 7400 MHz, 3db: 7800 => 7400 MHz freq = 7800 MHz, 3db: 8200 => 7800 MHz freq = 8200 MHz, 3db: 8600 => 8200 MHz freq = 8600 MHz, 3db: 9000 => 8600 MHz freq = 9000 MHz, 3db: 9400 => 9000 MHz freq = 9400 MHz, 3db: 9800 => 9400 MHz freq = 9800 MHz, 3db: 10200 => 9800 MHz freq = 10200 MHz, 3db: 10600 => 10200 MHz freq = 10600 MHz, 3db: 11000 => 10600 MHz freq = 11000 MHz, 3db: 11400 => 11000 MHz freq = 11400 MHz, 3db: 11800 => 11400 MHz freq = 11800 MHz, 3db: 12200 => 11800 MHz freq = 12200 MHz, 3db: 12600 => 12200 MHz freq = 12210 MHz, 3db: 12600 => 12550 MHz freq = 12220 MHz, 3db: 12600 => 12550 MHz freq = 12230 MHz, 3db: 12600 => 12550 MHz freq = 12240 MHz, 3db: 12600 => 12550 MHz freq = 12250 MHz, 3db: 12600 => 12550 MHz freq = 12260 MHz, 3db: 12600 => 12550 MHz freq = 12270 MHz, 3db: 12600 => 12550 MHz freq = 12280 MHz, 3db: 12600 => 12550 MHz freq = 12290 MHz, 3db: 12600 => 12550 MHz freq = 12300 MHz, 3db: 12600 => 12550 MHz freq = 12310 MHz, 3db: 12600 => 12550 MHz freq = 12320 MHz, 3db: 12600 => 12550 MHz freq = 12330 MHz, 3db: 12600 => 12550 MHz freq = 12340 MHz, 3db: 12600 => 12550 MHz freq = 12350 MHz, 3db: 12600 => 12550 MHz freq = 12360 MHz, 3db: 12600 => 12550 MHz freq = 12370 MHz, 3db: 12600 => 12550 MHz freq = 12380 MHz, 3db: 12600 => 12550 MHz freq = 12390 MHz, 3db: 12600 => 12550 MHz freq = 12400 MHz, 3db: 12600 => 12550 MHz freq = 12410 MHz, 3db: 12600 => 12550 MHz freq = 12420 MHz, 3db: 12600 => 12550 MHz freq = 12430 MHz, 3db: 12600 => 12550 MHz freq = 12440 MHz, 3db: 12600 => 12550 MHz freq = 12450 MHz, 3db: 12600 => 12550 MHz freq = 12460 MHz, 3db: 12600 => 12550 MHz freq = 12470 MHz, 3db: 12600 => 12550 MHz freq = 12480 MHz, 3db: 12600 => 12550 MHz freq = 12490 MHz, 3db: 12600 => 12550 MHz freq = 12500 MHz, 3db: 12600 => 12550 MHz freq = 12510 MHz, 3db: 12600 => 12550 MHz freq = 12520 MHz, 3db: 12600 => 12550 MHz freq = 12530 MHz, 3db: 12600 => 12550 MHz freq = 12540 MHz, 3db: 12600 => 12550 MHz freq = 12550 MHz, 3db: 12600 => 12550 MHz freq = 12600 MHz, 3db: 13000 => 12600 MHz freq = 12610 MHz, 3db: 13000 => 12970 MHz freq = 12620 MHz, 3db: 13000 => 12970 MHz freq = 12630 MHz, 3db: 13000 => 12970 MHz freq = 12640 MHz, 3db: 13000 => 12970 MHz freq = 12650 MHz, 3db: 13000 => 12970 MHz freq = 12660 MHz, 3db: 13000 => 12970 MHz freq = 12670 MHz, 3db: 13000 => 12970 MHz freq = 12680 MHz, 3db: 13000 => 12970 MHz freq = 12690 MHz, 3db: 13000 => 12970 MHz freq = 12700 MHz, 3db: 13000 => 12970 MHz freq = 12710 MHz, 3db: 13000 => 12970 MHz freq = 12720 MHz, 3db: 13000 => 12970 MHz freq = 12730 MHz, 3db: 13000 => 12970 MHz freq = 12740 MHz, 3db: 13000 => 12970 MHz freq = 12750 MHz, 3db: 13000 => 12970 MHz freq = 12760 MHz, 3db: 13000 => 12970 MHz freq = 12770 MHz, 3db: 13000 => 12970 MHz freq = 12780 MHz, 3db: 13000 => 12970 MHz freq = 12790 MHz, 3db: 13000 => 12970 MHz freq = 12800 MHz, 3db: 13000 => 12970 MHz freq = 12810 MHz, 3db: 13000 => 12970 MHz freq = 12820 MHz, 3db: 13000 => 12970 MHz freq = 12830 MHz, 3db: 13000 => 12970 MHz freq = 12840 MHz, 3db: 13000 => 12970 MHz freq = 12850 MHz, 3db: 13000 => 12970 MHz freq = 12860 MHz, 3db: 13000 => 12970 MHz freq = 12870 MHz, 3db: 13000 => 12970 MHz freq = 12880 MHz, 3db: 13000 => 12970 MHz freq = 12890 MHz, 3db: 13000 => 12970 MHz freq = 12900 MHz, 3db: 13000 => 12970 MHz freq = 12910 MHz, 3db: 13000 => 12970 MHz freq = 12920 MHz, 3db: 13000 => 12970 MHz freq = 12930 MHz, 3db: 13000 => 12970 MHz freq = 12940 MHz, 3db: 13000 => 12970 MHz freq = 12950 MHz, 3db: 13000 => 12970 MHz freq = 12960 MHz, 3db: 13000 => 12970 MHz freq = 12970 MHz, 3db: 13000 => 12970 MHz freq = 13000 MHz, 3db: 13390 => 13000 MHz freq = 13390 MHz, 3db: 13810 => 13390 MHz freq = 13810 MHz, 3db: 14230 => 13810 MHz freq = 14230 MHz, 3db: 14650 => 14230 MHz freq = 14650 MHz, 3db: 15070 => 14650 MHz freq = 15070 MHz, 3db: 15490 => 15070 MHz freq = 15490 MHz, 3db: 15910 => 15490 MHz freq = 15910 MHz, 3db: 16330 => 15910 MHz freq = 16330 MHz, 3db: 16750 => 16330 MHz freq = 16750 MHz, 3db: 17170 => 16750 MHz freq = 17170 MHz, 3db: 17590 => 17170 MHz freq = 17590 MHz, 3db: 18010 => 17590 MHz freq = 18010 MHz, 3db: 18430 => 18010 MHz freq = 18430 MHz, 3db: 18850 => 18430 MHz freq = 18850 MHz, 3db: bypass => 18850 MHz
--- drivers/iio/filter/admv8818.c | 205 +++++++++++++++++++++++++--------- 1 file changed, 152 insertions(+), 53 deletions(-)
drivers/iio/filter/admv8818.c +152 -53
@@ -14,6 +14,7 @@#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/notifier.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/spi/spi.h> #include <linux/units.h>
@@ -70,6 +71,16 @@#define ADMV8818_HPF_WR0_MSK GENMASK(7, 4)#define ADMV8818_LPF_WR0_MSK GENMASK(3, 0) +#define ADMV8818_BAND_BYPASS 0 +#define ADMV8818_BAND_MIN 1 +#define ADMV8818_BAND_MAX 4 +#define ADMV8818_BAND_CORNER_LOW 0 +#define ADMV8818_BAND_CORNER_HIGH 1 + +#define ADMV8818_STATE_MIN 0 +#define ADMV8818_STATE_MAX 15 +#define ADMV8818_NUM_STATES 16 +enum {ADMV8818_BW_FREQ ,ADMV8818_CENTER_FREQ
@@ -90,16 +101,20 @@ struct admv8818_state {struct mutex lock;unsigned int filter_mode;u64 cf_hz; +u64 lpf_margin_hz; +u64 hpf_margin_hz; }; -static const unsigned long long freq_range_hpf[4 ][2 ] = { +static const unsigned long long freq_range_hpf[5 ][2 ] = { + {0ULL ,0ULL },/* bypass */ {1750000000ULL ,3550000000ULL }, {3400000000ULL ,7250000000ULL }, {6600000000 ,12000000000 }, {12500000000 ,19900000000 } }; -static const unsigned long long freq_range_lpf[4 ][2 ] = { +static const unsigned long long freq_range_lpf[5 ][2 ] = { + {U64_MAX ,U64_MAX },/* bypass */ {2050000000ULL ,3850000000ULL }, {3350000000ULL ,7250000000ULL }, {7000000000 ,13000000000 },
@@ -121,44 +136,59 @@ static const char * const admv8818_modes[] = {static int __admv8818_hpf_select (struct admv8818_state *st,u64 freq) { -unsigned int hpf_step =0 , hpf_band =0 , i, j; -u64 freq_step; -int ret; +int band, state, ret; +unsigned int hpf_state =ADMV8818_STATE_MIN , hpf_band =ADMV8818_BAND_BYPASS ; +u64 freq_error, min_freq_error, freq_corner, freq_step; -if (freq < freq_range_hpf[0 ][0 ]) +if (freq < freq_range_hpf[ADMV8818_BAND_MIN ][ADMV8818_BAND_CORNER_LOW ]) goto hpf_write; -if (freq > freq_range_hpf[3 ][1 ]) { - hpf_step =15 ; - hpf_band =4 ; - +if (freq >= freq_range_hpf[ADMV8818_BAND_MAX ][ADMV8818_BAND_CORNER_HIGH ]) { + hpf_state =ADMV8818_STATE_MAX ; + hpf_band =ADMV8818_BAND_MAX ; goto hpf_write; } -for (i =0 ; i <4 ; i++) { - freq_step =div_u64 ((freq_range_hpf[i][1 ] - - freq_range_hpf[i][0 ]),15 ); +/* Close HPF frequency gap between 12 and 12.5 GHz */ +if (freq >=12000ULL *HZ_PER_MHZ && freq <12500ULL *HZ_PER_MHZ ) { + hpf_state =ADMV8818_STATE_MAX ; + hpf_band =3 ; + goto hpf_write; + } -if (freq > freq_range_hpf[i][0 ] && - (freq < freq_range_hpf[i][1 ] + freq_step)) { - hpf_band = i +1 ; + min_freq_error =U64_MAX ; +for (band =ADMV8818_BAND_MIN ; band <=ADMV8818_BAND_MAX ; band++) { +/* +* This (and therefore all other ranges) have a corner +* frequency higher than the target frequency. +*/ +if (freq_range_hpf[band][ADMV8818_BAND_CORNER_LOW ] > freq) +break ; -for (j =1 ; j <=16 ; j++) { -if (freq < (freq_range_hpf[i][0 ] + (freq_step * j))) { - hpf_step = j -1 ; -break ; - } + freq_step = freq_range_hpf[band][ADMV8818_BAND_CORNER_HIGH ] - + freq_range_hpf[band][ADMV8818_BAND_CORNER_LOW ]; + freq_step =div_u64 (freq_step,ADMV8818_NUM_STATES -1 ); + +for (state =ADMV8818_STATE_MIN ; state <=ADMV8818_STATE_MAX ; state++) { + freq_corner = freq_range_hpf[band][ADMV8818_BAND_CORNER_LOW ] + + freq_step * state; + +/* +* This (and therefore all other states) have a corner +* frequency higher than the target frequency. +*/ +if (freq_corner > freq) +break ; + + freq_error = freq - freq_corner; +if (freq_error < min_freq_error) { + min_freq_error = freq_error; + hpf_state = state; + hpf_band = band; } -break ; } } -/* Close HPF frequency gap between 12 and 12.5 GHz */ -if (freq >=12000ULL *HZ_PER_MHZ && freq <12500ULL *HZ_PER_MHZ ) { - hpf_band =3 ; - hpf_step =15 ; - } - hpf_write: ret = regmap_update_bits(st->regmap, ADMV8818_REG_WR0_SW, ADMV8818_SW_IN_SET_WR0_MSK |
@@ -170,7 +200,7 @@ static int __admv8818_hpf_select(struct admv8818_state *st, u64 freq)return regmap_update_bits (st->regmap,ADMV8818_REG_WR0_FILTER ,ADMV8818_HPF_WR0_MSK , -FIELD_PREP (ADMV8818_HPF_WR0_MSK , hpf_step)); +FIELD_PREP (ADMV8818_HPF_WR0_MSK , hpf_state)); }static int admv8818_hpf_select (struct admv8818_state *st,u64 freq)
@@ -186,31 +216,52 @@ static int admv8818_hpf_select(struct admv8818_state *st, u64 freq)static int __admv8818_lpf_select (struct admv8818_state *st,u64 freq) { -unsigned int lpf_step =0 , lpf_band =0 , i, j; -u64 freq_step; -int ret; +int band, state, ret; +unsigned int lpf_state =ADMV8818_STATE_MIN , lpf_band =ADMV8818_BAND_BYPASS ; +u64 freq_error, min_freq_error, freq_corner, freq_step; -if (freq > freq_range_lpf[3 ][1 ]) +if (freq > freq_range_lpf[ADMV8818_BAND_MAX ][ADMV8818_BAND_CORNER_HIGH ]) goto lpf_write; -if (freq < freq_range_lpf[0 ][0 ]) { - lpf_band =1 ; - +if (freq < freq_range_lpf[ADMV8818_BAND_MIN ][ADMV8818_BAND_CORNER_LOW ]) { + lpf_state =ADMV8818_STATE_MIN ; + lpf_band =ADMV8818_BAND_MIN ; goto lpf_write; } -for (i =0 ; i <4 ; i++) { -if (freq > freq_range_lpf[i][0 ] && freq < freq_range_lpf[i][1 ]) { - lpf_band = i +1 ; - freq_step =div_u64 ((freq_range_lpf[i][1 ] - freq_range_lpf[i][0 ]),15 ); + min_freq_error =U64_MAX ; +for (band =ADMV8818_BAND_MAX ; band >=ADMV8818_BAND_MIN ; --band) { +/* +* At this point the highest corner frequency of +* all remaining ranges is below the target. +* LPF corner should be >= the target. +*/ +if (freq > freq_range_lpf[band][ADMV8818_BAND_CORNER_HIGH ]) +break ; + + freq_step = freq_range_lpf[band][ADMV8818_BAND_CORNER_HIGH ] - + freq_range_lpf[band][ADMV8818_BAND_CORNER_LOW ]; + freq_step =div_u64 (freq_step,ADMV8818_NUM_STATES -1 ); + +for (state =ADMV8818_STATE_MAX ; state >=ADMV8818_STATE_MIN ; --state) { -for (j =0 ; j <=15 ; j++) { -if (freq < (freq_range_lpf[i][0 ] + (freq_step * j))) { - lpf_step = j; -break ; - } + freq_corner = freq_range_lpf[band][ADMV8818_BAND_CORNER_LOW ] + + state * freq_step; + +/* +* At this point all other states in range will +* place the corner frequency below the target +* LPF corner should >= the target. +*/ +if (freq > freq_corner) +break ; + + freq_error = freq_corner - freq; +if (freq_error < min_freq_error) { + min_freq_error = freq_error; + lpf_state = state; + lpf_band = band; } -break ; } }
@@ -225,7 +276,7 @@ static int __admv8818_lpf_select(struct admv8818_state *st, u64 freq)return regmap_update_bits (st->regmap,ADMV8818_REG_WR0_FILTER ,ADMV8818_LPF_WR0_MSK , -FIELD_PREP (ADMV8818_LPF_WR0_MSK , lpf_step)); +FIELD_PREP (ADMV8818_LPF_WR0_MSK , lpf_state)); }static int admv8818_lpf_select (struct admv8818_state *st,u64 freq)
@@ -242,16 +293,28 @@ static int admv8818_lpf_select(struct admv8818_state *st, u64 freq)static int admv8818_rfin_band_select (struct admv8818_state *st) {int ret; +u64 hpf_corner_target, lpf_corner_target; st->cf_hz =clk_get_rate (st->clkin); +/* Check for underflow */ +if (st->cf_hz > st->hpf_margin_hz) + hpf_corner_target = st->cf_hz - st->hpf_margin_hz; +else + hpf_corner_target =0 ; + +/* Check for overflow */ + lpf_corner_target = st->cf_hz + st->lpf_margin_hz; +if (lpf_corner_target < st->cf_hz) + lpf_corner_target =U64_MAX ; +mutex_lock (&st->lock); - ret =__admv8818_hpf_select (st, st->cf_hz); + ret =__admv8818_hpf_select (st, hpf_corner_target);if (ret) goto exit; - ret =__admv8818_lpf_select (st, st->cf_hz); + ret =__admv8818_lpf_select (st, lpf_corner_target); exit:mutex_unlock (&st->lock);return ret;
@@ -278,8 +341,11 @@ static int __admv8818_read_hpf_freq(struct admv8818_state *st, u64 *hpf_freq) hpf_state =FIELD_GET (ADMV8818_HPF_WR0_MSK , data); - *hpf_freq =div_u64 (freq_range_hpf[hpf_band -1 ][1 ] - freq_range_hpf[hpf_band -1 ][0 ],15 ); - *hpf_freq = freq_range_hpf[hpf_band -1 ][0 ] + (*hpf_freq * hpf_state); + *hpf_freq = freq_range_hpf[hpf_band][ADMV8818_BAND_CORNER_HIGH ] - + freq_range_hpf[hpf_band][ADMV8818_BAND_CORNER_LOW ]; + *hpf_freq =div_u64 (*hpf_freq,ADMV8818_NUM_STATES -1 ); + *hpf_freq = freq_range_hpf[hpf_band][ADMV8818_BAND_CORNER_LOW ] + + (*hpf_freq * hpf_state);return ret; }
@@ -316,8 +382,11 @@ static int __admv8818_read_lpf_freq(struct admv8818_state *st, u64 *lpf_freq) lpf_state =FIELD_GET (ADMV8818_LPF_WR0_MSK , data); - *lpf_freq =div_u64 (freq_range_lpf[lpf_band -1 ][1 ] - freq_range_lpf[lpf_band -1 ][0 ],15 ); - *lpf_freq = freq_range_lpf[lpf_band -1 ][0 ] + (*lpf_freq * lpf_state); + *lpf_freq = freq_range_lpf[lpf_band][ADMV8818_BAND_CORNER_HIGH ] - + freq_range_lpf[lpf_band][ADMV8818_BAND_CORNER_LOW ]; + *lpf_freq =div_u64 (*lpf_freq,ADMV8818_NUM_STATES -1 ); + *lpf_freq = freq_range_lpf[lpf_band][ADMV8818_BAND_CORNER_LOW ] + + (*lpf_freq * lpf_state);return ret; }
@@ -641,6 +710,32 @@ static int admv8818_clk_setup(struct admv8818_state *st)return devm_add_action_or_reset (&spi->dev, admv8818_clk_notifier_unreg, st); } +static int admv8818_read_properties (struct admv8818_state *st) +{ +struct spi_device *spi = st->spi; +u32 mhz; +int ret; + + ret =device_property_read_u32 (&spi->dev,"adi,lpf-margin-mhz" , &mhz); +if (ret ==0 ) + st->lpf_margin_hz = (u64 )mhz *HZ_PER_MHZ ; +else if (ret == -EINVAL ) + st->lpf_margin_hz =0 ; +else +return ret; + + + ret =device_property_read_u32 (&spi->dev,"adi,hpf-margin-mhz" , &mhz); +if (ret ==0 ) + st->hpf_margin_hz = (u64 )mhz *HZ_PER_MHZ ; +else if (ret == -EINVAL ) + st->hpf_margin_hz =0 ; +else if (ret <0 ) +return ret; + +return 0 ; +} +static int admv8818_probe (struct spi_device *spi) {struct iio_dev *indio_dev;
@@ -672,6 +767,10 @@ static int admv8818_probe(struct spi_device *spi)mutex_init (&st->lock); + ret =admv8818_read_properties (st); +if (ret) +return ret; + ret =admv8818_init (st);if (ret)return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 327/512 iio: filter: admv8818: Support frequencies >= 2^32
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Pellegrino <[email protected]>
[ Upstream commit 9016776f1301627de78a633bda7c898425a56572 ]
This patch allows writing u64 values to the ADMV8818's high and low-pass filter frequencies. It includes the following changes:
- Rejects negative frequencies in admv8818_write_raw.
- Adds a write_raw_get_fmt function to admv8818's iio_info, returning IIO_VAL_INT_64 for the high and low-pass filter 3dB frequency channels.
--- drivers/iio/filter/admv8818.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/iio/filter/admv8818.c +17 -0
@@ -402,6 +402,19 @@ static int admv8818_read_lpf_freq(struct admv8818_state *st, u64 *lpf_freq)return ret; } +static int admv8818_write_raw_get_fmt (struct iio_dev *indio_dev, +struct iio_chan_spec const *chan, +long mask) +{ +switch (mask) { +case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY : +case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY : +return IIO_VAL_INT_64 ; +default : +return -EINVAL ; + } +} +static int admv8818_write_raw (struct iio_dev *indio_dev,struct iio_chan_spec const *chan,int val,int val2,long info)
@@ -410,6 +423,9 @@ static int admv8818_write_raw(struct iio_dev *indio_dev,u64 freq = ((u64 )val2 <<32 | (u32 )val); +if ((s64 )freq <0 ) +return -EINVAL ; +switch (info) {case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY :return admv8818_lpf_select (st, freq);
@@ -571,6 +587,7 @@ static int admv8818_set_mode(struct iio_dev *indio_dev,static const struct iio_info admv8818_info = { .write_raw = admv8818_write_raw, + .write_raw_get_fmt = admv8818_write_raw_get_fmt, .read_raw = admv8818_read_raw, .debugfs_reg_access = &admv8818_reg_access, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 328/512 iio: adc: ad7124: Fix 3dB filter frequency reading
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 8712e4986e7ce42a14c762c4c350f290989986a5 ]
The sinc4 filter has a factor 0.23 between Output Data Rate and f_{3dB} and for sinc3 the factor is 0.272 according to the data sheets for ad7124-4 (Rev. E.) and ad7124-8 (Rev. F).
--- drivers/iio/adc/ad7124.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ad7124.c +2 -2
@@ -300,9 +300,9 @@ static int ad7124_get_3db_filter_freq(struct ad7124_state *st,switch (st->channels[channel].cfg.filter_type) {case AD7124_SINC3_FILTER : -return DIV_ROUND_CLOSEST (fadc *230 ,1000 ); +return DIV_ROUND_CLOSEST (fadc *272 ,1000 );case AD7124_SINC4_FILTER : -return DIV_ROUND_CLOSEST (fadc *262 ,1000 ); +return DIV_ROUND_CLOSEST (fadc *230 ,1000 );default :return -EINVAL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 329/512 usb: acpi: Prevent null pointer dereference in usb_acpi_add_usb4_devlink()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenyuan Yang <[email protected]>
[ Upstream commit 73fb0ec9436ae87bcae067ce35d6cdd72bade86c ]
As demonstrated by the fix for update_port_device_state,
commit 12783c0b9e2c ("usb: core: Prevent null pointer dereference in update_port_device_state"), usb_hub_to_struct_hub() can return NULL in certain scenarios,
such as during hub driver unbind or teardown race conditions,
even if the underlying usb_device structure exists.
Plus, all other places that call usb_hub_to_struct_hub() in the same file do check for NULL return values.
If usb_hub_to_struct_hub() returns NULL, the subsequent access to hub->ports[udev->portnum - 1] will cause a null pointer dereference.
--- drivers/usb/core/usb-acpi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/core/usb-acpi.c +2 -0
@@ -165,6 +165,8 @@ static int usb_acpi_add_usb4_devlink(struct usb_device *udev)return 0 ; hub =usb_hub_to_struct_hub (udev->parent); +if (!hub) +return 0 ; port_dev = hub->ports[udev->portnum -1 ]; struct fwnode_handle *nhi_fwnode __free(fwnode_handle) =
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 330/512 MIPS: Loongson64: Add missing #interrupt-cells for loongson64c_ls7a
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
[ Upstream commit 6d223b8ffcd1593d032b71875def2daa71c53111 ]
Similar to commit 98a9e2ac3755 ("MIPS: Loongson64: DTS: Fix msi node for ls7a").
Fix follow warnings:
arch/mips/boot/dts/loongson/loongson64c_4core_ls7a.dts:28.31-36.4: Warning (interrupt_provider): /bus@10000000/msi-controller@2ff00000: Missing '#interrupt-cells' in interrupt provider arch/mips/boot/dts/loongson/loongson64c_4core_ls7a.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'
--- arch/mips/boot/dts/loongson/loongson64c_4core_ls7a.dts | 1 + 1 file changed, 1 insertion(+)
arch/mips/boot/dts/loongson/loongson64c_4core_ls7a.dts +1 -0
@@ -29,6 +29,7 @@ compatible = "loongson,pch-msi-1.0"; reg = <0 0x2ff00000 0 0x8>; interrupt-controller; + #interrupt-cells = <1>; msi-controller; loongson,msi-base-vec = <64>; loongson,msi-num-vecs = <64>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 331/512 coresight: Fixes devices owner field for registered using coresight_init_driver()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junhao He <[email protected]>
[ Upstream commit 9f52aecc952ddf307571517d5c91136c8c4e87c9 ]
The coresight_init_driver() of the coresight-core module is called from the sub coresgiht device (such as tmc/stm/funnle/...) module. It calls amba_driver_register() and Platform_driver_register(), which are macro functions that use the coresight-core's module to initialize the caller's owner field. Therefore, when the sub coresight device calls coresight_init_driver(), an incorrect THIS_MODULE value is captured.
The sub coesgiht modules can be removed while their callbacks are running, resulting in a general protection failure.
Add module parameter to coresight_init_driver() so can be called with the module of the callback.
--- drivers/hwtracing/coresight/coresight-catu.c | 2 +- drivers/hwtracing/coresight/coresight-core.c | 6 +++--- drivers/hwtracing/coresight/coresight-cpu-debug.c | 3 ++- drivers/hwtracing/coresight/coresight-funnel.c | 3 ++- drivers/hwtracing/coresight/coresight-replicator.c | 3 ++- drivers/hwtracing/coresight/coresight-stm.c | 2 +- drivers/hwtracing/coresight/coresight-tmc-core.c | 2 +- drivers/hwtracing/coresight/coresight-tpiu.c | 2 +- include/linux/coresight.h | 2 +- 9 files changed, 14 insertions(+), 11 deletions(-)
drivers/hwtracing/coresight/coresight-catu.c +1 -1
@@ -702,7 +702,7 @@ static int __init catu_init(void) {int ret; - ret =coresight_init_driver ("catu" , &catu_driver, &catu_platform_driver); + ret =coresight_init_driver ("catu" , &catu_driver, &catu_platform_driver,THIS_MODULE );tmc_etr_set_catu_ops (&etr_catu_buf_ops);return ret; }
drivers/hwtracing/coresight/coresight-core.c +3 -3
@@ -1422,17 +1422,17 @@ module_init(coresight_init);module_exit (coresight_exit);int coresight_init_driver (const char *drv,struct amba_driver *amba_drv, -struct platform_driver *pdev_drv) +struct platform_driver *pdev_drv,struct module *owner) {int ret; - ret =amba_driver_register (amba_drv); + ret =__amba_driver_register (amba_drv, owner);if (ret) {pr_err ("%s: error registering AMBA driver\n" , drv);return ret; } - ret =platform_driver_register (pdev_drv); + ret =__platform_driver_register (pdev_drv, owner);if (!ret)return 0 ;
drivers/hwtracing/coresight/coresight-cpu-debug.c +2 -1
@@ -774,7 +774,8 @@ static struct platform_driver debug_platform_driver = {static int __init debug_init (void ) { -return coresight_init_driver ("debug" , &debug_driver, &debug_platform_driver); +return coresight_init_driver ("debug" , &debug_driver, &debug_platform_driver, +THIS_MODULE ); } static void __exit debug_exit(void)
drivers/hwtracing/coresight/coresight-funnel.c +2 -1
@@ -433,7 +433,8 @@ static struct amba_driver dynamic_funnel_driver = {static int __init funnel_init (void ) { -return coresight_init_driver ("funnel" , &dynamic_funnel_driver, &funnel_driver); +return coresight_init_driver ("funnel" , &dynamic_funnel_driver, &funnel_driver, +THIS_MODULE ); } static void __exit funnel_exit(void)
drivers/hwtracing/coresight/coresight-replicator.c +2 -1
@@ -438,7 +438,8 @@ static struct amba_driver dynamic_replicator_driver = {static int __init replicator_init (void ) { -return coresight_init_driver ("replicator" , &dynamic_replicator_driver, &replicator_driver); +return coresight_init_driver ("replicator" , &dynamic_replicator_driver, &replicator_driver, +THIS_MODULE ); } static void __exit replicator_exit(void)
drivers/hwtracing/coresight/coresight-stm.c +1 -1
@@ -1047,7 +1047,7 @@ static struct platform_driver stm_platform_driver = {static int __init stm_init (void ) { -return coresight_init_driver ("stm" , &stm_driver, &stm_platform_driver); +return coresight_init_driver ("stm" , &stm_driver, &stm_platform_driver,THIS_MODULE ); } static void __exit stm_exit(void)
drivers/hwtracing/coresight/coresight-tmc-core.c +1 -1
@@ -741,7 +741,7 @@ static struct platform_driver tmc_platform_driver = {static int __init tmc_init (void ) { -return coresight_init_driver ("tmc" , &tmc_driver, &tmc_platform_driver); +return coresight_init_driver ("tmc" , &tmc_driver, &tmc_platform_driver,THIS_MODULE ); } static void __exit tmc_exit(void)
drivers/hwtracing/coresight/coresight-tpiu.c +1 -1
@@ -318,7 +318,7 @@ static struct platform_driver tpiu_platform_driver = {static int __init tpiu_init (void ) { -return coresight_init_driver ("tpiu" , &tpiu_driver, &tpiu_platform_driver); +return coresight_init_driver ("tpiu" , &tpiu_driver, &tpiu_platform_driver,THIS_MODULE ); } static void __exit tpiu_exit(void)
include/linux/coresight.h +1 -1
@@ -683,7 +683,7 @@ coresight_find_output_type(struct coresight_platform_data *pdata, union coresight_dev_subtype subtype);int coresight_init_driver (const char *drv,struct amba_driver *amba_drv, -struct platform_driver *pdev_drv); +struct platform_driver *pdev_drv,struct module *owner);void coresight_remove_driver (struct amba_driver *amba_drv,struct platform_driver *pdev_drv);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 332/512 coresight: catu: Introduce refcount and spinlock for enabling/disabling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yabin Cui <[email protected]>
[ Upstream commit a03a0a08c6fe5e50c1b12ea41b9e228e7f649c22 ]
When tracing ETM data on multiple CPUs concurrently via the perf interface, the CATU device is shared across different CPU paths. This can lead to race conditions when multiple CPUs attempt to enable or disable the CATU device simultaneously.
To address these race conditions, this patch introduces the following changes:
1. The enable and disable operations for the CATU device are not reentrant. Therefore, a spinlock is added to ensure that only one CPU can enable or disable a given CATU device at any point in time.
2. A reference counter is used to manage the enable/disable state of the CATU device. The device is enabled when the first CPU requires it and is only disabled when the last CPU finishes using it. This ensures the device remains active as long as at least one CPU needs it.
--- drivers/hwtracing/coresight/coresight-catu.c | 25 +++++++++++++------- drivers/hwtracing/coresight/coresight-catu.h | 1 + 2 files changed, 18 insertions(+), 8 deletions(-)
drivers/hwtracing/coresight/coresight-catu.c +17 -8
@@ -458,12 +458,17 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, enum cs_mode cs_mode,static int catu_enable (struct coresight_device *csdev,enum cs_mode mode,void *data) { -int rc; +int rc =0 ;struct catu_drvdata *catu_drvdata =csdev_to_catu_drvdata (csdev); -CS_UNLOCK (catu_drvdata->base); - rc =catu_enable_hw (catu_drvdata, mode, data); -CS_LOCK (catu_drvdata->base); +guard (raw_spinlock_irqsave)(&catu_drvdata->spinlock); +if (csdev->refcnt ==0 ) { +CS_UNLOCK (catu_drvdata->base); + rc =catu_enable_hw (catu_drvdata, mode, data); +CS_LOCK (catu_drvdata->base); + } +if (!rc) + csdev->refcnt++;return rc; }
@@ -486,12 +491,15 @@ static int catu_disable_hw(struct catu_drvdata *drvdata)static int catu_disable (struct coresight_device *csdev,void *__unused) { -int rc; +int rc =0 ;struct catu_drvdata *catu_drvdata =csdev_to_catu_drvdata (csdev); -CS_UNLOCK (catu_drvdata->base); - rc =catu_disable_hw (catu_drvdata); -CS_LOCK (catu_drvdata->base); +guard (raw_spinlock_irqsave)(&catu_drvdata->spinlock); +if (--csdev->refcnt ==0 ) { +CS_UNLOCK (catu_drvdata->base); + rc =catu_disable_hw (catu_drvdata); +CS_LOCK (catu_drvdata->base); + }return rc; }
@@ -550,6 +558,7 @@ static int __catu_probe(struct device *dev, struct resource *res) dev->platform_data = pdata; drvdata->base = base; +raw_spin_lock_init (&drvdata->spinlock); catu_desc.access =CSDEV_ACCESS_IOMEM (base); catu_desc.pdata = pdata; catu_desc.dev = dev;
drivers/hwtracing/coresight/coresight-catu.h +1 -0
@@ -65,6 +65,7 @@ struct catu_drvdata {void __iomem *base;struct coresight_device *csdev;int irq; +raw_spinlock_t spinlock; };#define CATU_REG32 (name, offset) \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 333/512 counter: interrupt-cnt: Protect enable/disable OPs with mutex
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
[ Upstream commit 7351312632e831e51383f48957d47712fae791ef ]
Enable/disable seems to be racy on SMP, consider the following scenario:
CPU0 CPU1
interrupt_cnt_enable_write(true)
{
if (priv->enabled == enable)
return 0;
if (enable) {
priv->enabled = true;
interrupt_cnt_enable_write(false)
{
if (priv->enabled == enable)
return 0;
if (enable) {
priv->enabled = true;
enable_irq(priv->irq);
} else {
disable_irq(priv->irq)
priv->enabled = false;
}
enable_irq(priv->irq);
} else {
disable_irq(priv->irq);
priv->enabled = false;
}The above would result in priv->enabled == false, but IRQ left enabled. Protect both write (above race) and read (to propagate the value on SMP) callbacks with a mutex.
--- drivers/counter/interrupt-cnt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/counter/interrupt-cnt.c +9 -0
@@ -3,12 +3,14 @@* Copyright (c) 2021 Pengutronix, Oleksij Rempel <[email protected]> */ +#include <linux/cleanup.h> #include <linux/counter.h> #include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/mod_devicetable.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/platform_device.h> #include <linux/types.h>
@@ -19,6 +21,7 @@ struct interrupt_cnt_priv {struct gpio_desc *gpio;int irq;bool enabled; +struct mutex lock;struct counter_signal signals;struct counter_synapse synapses;struct counter_count cnts;
@@ -41,6 +44,8 @@ static int interrupt_cnt_enable_read(struct counter_device *counter, {struct interrupt_cnt_priv *priv =counter_priv (counter); +guard (mutex)(&priv->lock); + *enable = priv->enabled;return 0 ;
@@ -51,6 +56,8 @@ static int interrupt_cnt_enable_write(struct counter_device *counter, {struct interrupt_cnt_priv *priv =counter_priv (counter); +guard (mutex)(&priv->lock); +if (priv->enabled == enable)return 0 ;
@@ -227,6 +234,8 @@ static int interrupt_cnt_probe(struct platform_device *pdev)if (ret)return ret; +mutex_init (&priv->lock); + ret =devm_counter_add (dev, counter);if (ret <0 )return dev_err_probe (dev, ret,"Failed to add counter\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 334/512 fpga: fix potential null pointer deref in fpga_mgr_test_img_load_sgt()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
[ Upstream commit 6ebf1982038af12f3588417e4fd0417d2551da28 ]
fpga_mgr_test_img_load_sgt() allocates memory for sgt using kunit_kzalloc() however it does not check if the allocation failed. It then passes sgt to sg_alloc_table(), which passes it to __sg_alloc_table(). This function calls memset() on sgt in an attempt to zero it out. If the allocation fails then sgt will be NULL and the memset will trigger a NULL pointer dereference.
Fix this by checking the allocation with KUNIT_ASSERT_NOT_ERR_OR_NULL().
--- drivers/fpga/tests/fpga-mgr-test.c | 1 + 1 file changed, 1 insertion(+)
drivers/fpga/tests/fpga-mgr-test.c +1 -0
@@ -263,6 +263,7 @@ static void fpga_mgr_test_img_load_sgt(struct kunit *test) img_buf =init_test_buffer (test,IMAGE_SIZE ); sgt =kunit_kzalloc (test,sizeof (*sgt),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sgt); ret =sg_alloc_table (sgt,1 ,GFP_KERNEL );KUNIT_ASSERT_EQ (test, ret,0 );sg_init_one (sgt->sgl, img_buf,IMAGE_SIZE );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 335/512 coresight: prevent deactivate active config while enabling the config
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yeoreum Yun <[email protected]>
[ Upstream commit 408c97c4a5e0b634dcd15bf8b8808b382e888164 ]
While enable active config via cscfg_csdev_enable_active_config(), active config could be deactivated via configfs' sysfs interface. This could make UAF issue in below scenario:
CPU0 CPU1
(sysfs enable) load module
cscfg_load_config_sets() activate config. // sysfs (sys_active_cnt == 1)
...cscfg_csdev_enable_active_config() lock(csdev->cscfg_csdev_lock)
// here load config activate by CPU1 unlock(csdev->cscfg_csdev_lock)
deactivate config // sysfs (sys_activec_cnt == 0) cscfg_unload_config_sets() unload module
// access to config_desc which freed
// while unloading module.cscfg_csdev_enable_config
To address this, use cscfg_config_desc's active_cnt as a reference count
which will be holded when
- activate the config.
- enable the activated config.
and put the module reference when config_active_cnt == 0.
--- .../hwtracing/coresight/coresight-config.h | 2 +- .../hwtracing/coresight/coresight-syscfg.c | 49 +++++++++++++------ 2 files changed, 35 insertions(+), 16 deletions(-)
drivers/hwtracing/coresight/coresight-config.h +1 -1
@@ -228,7 +228,7 @@ struct cscfg_feature_csdev {* @feats_csdev:references to the device features to enable. */ struct cscfg_config_csdev { -const struct cscfg_config_desc *config_desc; +struct cscfg_config_desc *config_desc;struct coresight_device *csdev;bool enabled;struct list_head node;
drivers/hwtracing/coresight/coresight-syscfg.c +34 -15
101 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 336/512 vt: remove VT_RESIZE and VT_RESIZEX from vt_compat_ioctl()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
[ Upstream commit c4c7ead7b86c1e7f11c64915b7e5bb6d2e242691 ]
They are listed amon those cmd values that "treat 'arg' as an integer" which is wrong. They should instead fall into the default case. Probably nobody ever relied on that code since 2009 but still.
--- drivers/tty/vt/vt_ioctl.c | 2 -- 1 file changed, 2 deletions(-)
drivers/tty/vt/vt_ioctl.c +0 -2
@@ -1103,8 +1103,6 @@ long vt_compat_ioctl(struct tty_struct *tty,case VT_WAITACTIVE :case VT_RELDISP :case VT_DISALLOCATE : -case VT_RESIZE : -case VT_RESIZEX :return vt_ioctl (tty, cmd, arg);/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 337/512 mei: vsc: Cast tx_buf to (__be32 *) when passed to cpu_to_be32_array()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 97ce0fe2b7240d47d9124daa92217e478c21a3ba ]
Commit f88c0c72ffb0 ("mei: vsc: Use struct vsc_tp_packet as vsc-tp tx_buf and rx_buf type") changed the type of tx_buf from "void *" to "struct vsc_tp_packet *" and added a cast to (u32 *) when passing it to cpu_to_be32_array() and the same change was made for rx_buf.
This triggers the type-check warning in sparse:
vsc-tp.c:327:28: sparse: expected restricted __be32 [usertype] *dst vsc-tp.c:327:28: sparse: got unsigned int [usertype] *
vsc-tp.c:343:42: sparse: expected restricted __be32 const [usertype] *src vsc-tp.c:343:42: sparse: got unsigned int [usertype] *
Fix this by casting to (__be32 *) instead.
Note actually changing the type of the buffers to "be32 *" is not an option this buffer does actually contain a "struct vsc_tp_packet" and is used as such most of the time. vsc_tp_rom_xfer() re-uses the buffers as just dumb arrays of 32 bit words to talk to the device before the firmware has booted, to avoid needing to allocate a separate buffer.
--- drivers/misc/mei/vsc-tp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/vsc-tp.c +2 -2
@@ -324,7 +324,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)guard (mutex)(&tp->mutex);/* rom xfer is big endian */ -cpu_to_be32_array ((u32 *)tp->tx_buf, obuf, words); +cpu_to_be32_array ((__be32 *)tp->tx_buf, obuf, words); ret = read_poll_timeout(gpiod_get_value_cansleep, ret, !ret, VSC_TP_ROM_XFER_POLL_DELAY_US,
@@ -340,7 +340,7 @@ int vsc_tp_rom_xfer(struct vsc_tp *tp, const void *obuf, void *ibuf, size_t len)return ret;if (ibuf) -be32_to_cpu_array (ibuf, (u32 *)tp->rx_buf, words); +be32_to_cpu_array (ibuf, (__be32 *)tp->rx_buf, words);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 338/512 iio: adc: PAC1934: fix typo in documentation link
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marius Cristea <[email protected]>
[ Upstream commit 52c43d80fa8370eb877fc63b1fc1eec67e1b1410 ]
Fix a typo,(PAC1934 -> PAC193X), into the link from an application note related to the ACPI device definition.
--- drivers/iio/adc/pac1934.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/pac1934.c +1 -1
@@ -1081,7 +1081,7 @@ static int pac1934_chip_identify(struct pac1934_chip_info *info)/* * documentation related to the ACPI device definition -* https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ApplicationNotes/ApplicationNotes/PAC1934-Integration-Notes-for-Microsoft-Windows-10-and-Windows-11-Driver-Support-DS00002534.pdf +* https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ApplicationNotes/ApplicationNotes/PAC193X-Integration-Notes-for-Microsoft-Windows-10-and-Windows-11-Driver-Support-DS00002534.pdf */ static int pac1934_acpi_parse_channel_config (struct i2c_client *client,struct pac1934_chip_info *info)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 339/512 iio: adc: mcp3911: fix device dependent mappings for conversion result registers
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcus Folkesson <[email protected]>
[ Upstream commit f62c49d8f32d6ce8871b01795498352775aa61db ]
The conversion result registers differs between devices. Make sure the mapping is correct by using a device dependent .get_raw() callback function.
--- drivers/iio/adc/mcp3911.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-)
drivers/iio/adc/mcp3911.c +34 -5
@@ -6,7 +6,7 @@* Copyright (C) 2018 Kent Gustavsson <[email protected]> */ #include <linux/bitfield.h> -#include <linux/bits.h> +#include <linux/bitops.h> #include <linux/cleanup.h> #include <linux/clk.h> #include <linux/delay.h>
@@ -79,6 +79,8 @@#define MCP3910_CONFIG1_CLKEXT BIT(6)#define MCP3910_CONFIG1_VREFEXT BIT(7) +#define MCP3910_CHANNEL (ch) (MCP3911_REG_CHANNEL0 + (ch)) +#define MCP3910_REG_OFFCAL_CH0 0x0f#define MCP3910_OFFCAL (ch) (MCP3910_REG_OFFCAL_CH0 + (ch) * 6)
@@ -110,6 +112,7 @@ struct mcp3911_chip_info {int (*get_offset)(struct mcp3911 *adc,int channel,int *val);int (*set_offset)(struct mcp3911 *adc,int channel,int val);int (*set_scale)(struct mcp3911 *adc,int channel,u32 val); +int (*get_raw)(struct mcp3911 *adc,int channel,int *val); };struct mcp3911 {
@@ -170,6 +173,18 @@ static int mcp3911_update(struct mcp3911 *adc, u8 reg, u32 mask, u32 val, u8 lenreturn mcp3911_write (adc, reg, val, len); } +static int mcp3911_read_s24 (struct mcp3911 *const adc,u8 const reg,s32 *const val) +{ +u32 uval; +int const ret =mcp3911_read (adc, reg, &uval,3 ); + +if (ret) +return ret; + + *val =sign_extend32 (uval,23 ); +return ret; +} +static int mcp3910_enable_offset (struct mcp3911 *adc,bool enable) {unsigned int mask =MCP3910_CONFIG0_EN_OFFCAL ;
@@ -194,6 +209,11 @@ static int mcp3910_set_offset(struct mcp3911 *adc, int channel, int val)return adc->chip->enable_offset (adc,1 ); } +static int mcp3910_get_raw (struct mcp3911 *adc,int channel,s32 *val) +{ +return mcp3911_read_s24 (adc,MCP3910_CHANNEL (channel), val); +} +static int mcp3911_enable_offset (struct mcp3911 *adc,bool enable) {unsigned int mask =MCP3911_STATUSCOM_EN_OFFCAL ;
@@ -218,6 +238,11 @@ static int mcp3911_set_offset(struct mcp3911 *adc, int channel, int val)return adc->chip->enable_offset (adc,1 ); } +static int mcp3911_get_raw (struct mcp3911 *adc,int channel,s32 *val) +{ +return mcp3911_read_s24 (adc,MCP3911_CHANNEL (channel), val); +} +static int mcp3910_get_osr (struct mcp3911 *adc,u32 *val) {int ret;
@@ -321,12 +346,9 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev,guard (mutex)(&adc->lock);switch (mask) {case IIO_CHAN_INFO_RAW : - ret =mcp3911_read (adc, -MCP3911_CHANNEL (channel->channel), val,3 ); + ret = adc->chip->get_raw (adc, channel->channel, val);if (ret)return ret; - - *val =sign_extend32 (*val,23 );return IIO_VAL_INT ;case IIO_CHAN_INFO_OFFSET : ret = adc->chip->get_offset (adc, channel->channel, val);
@@ -799,6 +821,7 @@ static const struct mcp3911_chip_info mcp3911_chip_info[] = { .get_offset = mcp3910_get_offset, .set_offset = mcp3910_set_offset, .set_scale = mcp3910_set_scale, + .get_raw = mcp3910_get_raw, }, [MCP3911] = { .channels = mcp3911_channels,
@@ -810,6 +833,7 @@ static const struct mcp3911_chip_info mcp3911_chip_info[] = { .get_offset = mcp3911_get_offset, .set_offset = mcp3911_set_offset, .set_scale = mcp3911_set_scale, + .get_raw = mcp3911_get_raw, }, [MCP3912] = { .channels = mcp3912_channels,
@@ -821,6 +845,7 @@ static const struct mcp3911_chip_info mcp3911_chip_info[] = { .get_offset = mcp3910_get_offset, .set_offset = mcp3910_set_offset, .set_scale = mcp3910_set_scale, + .get_raw = mcp3910_get_raw, }, [MCP3913] = { .channels = mcp3913_channels,
@@ -832,6 +857,7 @@ static const struct mcp3911_chip_info mcp3911_chip_info[] = { .get_offset = mcp3910_get_offset, .set_offset = mcp3910_set_offset, .set_scale = mcp3910_set_scale, + .get_raw = mcp3910_get_raw, }, [MCP3914] = { .channels = mcp3914_channels,
@@ -843,6 +869,7 @@ static const struct mcp3911_chip_info mcp3911_chip_info[] = { .get_offset = mcp3910_get_offset, .set_offset = mcp3910_set_offset, .set_scale = mcp3910_set_scale, + .get_raw = mcp3910_get_raw, }, [MCP3918] = { .channels = mcp3918_channels,
@@ -854,6 +881,7 @@ static const struct mcp3911_chip_info mcp3911_chip_info[] = { .get_offset = mcp3910_get_offset, .set_offset = mcp3910_set_offset, .set_scale = mcp3910_set_scale, + .get_raw = mcp3910_get_raw, }, [MCP3919] = { .channels = mcp3919_channels,
@@ -865,6 +893,7 @@ static const struct mcp3911_chip_info mcp3911_chip_info[] = { .get_offset = mcp3910_get_offset, .set_offset = mcp3910_set_offset, .set_scale = mcp3910_set_scale, + .get_raw = mcp3910_get_raw, }, }; static const struct of_device_id mcp3911_dt_ids[] = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 340/512 USB: serial: bus: fix const issue in usb_serial_device_match()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit 92cd405b648605db4da866f3b9818b271ae84ef0 ]
usb_serial_device_match() takes a const pointer, and then decides to cast it away into a non-const one, which is not a good thing to do overall. Fix this up by properly setting the pointers to be const to preserve that attribute.
--- drivers/usb/serial/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/bus.c +1 -1
@@ -17,7 +17,7 @@ static int usb_serial_device_match(struct device *dev, const struct device_driver *drv) {const struct usb_serial_port *port =to_usb_serial_port (dev); -struct usb_serial_driver *driver =to_usb_serial_driver (drv); +const struct usb_serial_driver *driver =to_usb_serial_driver (drv);/* * drivers are already assigned to ports in serial_probe so it's
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 341/512 USB: gadget: udc: fix const issue in gadget_match_driver()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit 5f5cc794fac605afd3bef8065e33096aeacf6257 ]
gadget_match_driver() takes a const pointer, and then decides to cast it away into a non-const one, which is not a good thing to do overall. Fix this up by properly setting the pointers to be const to preserve that attribute.
--- drivers/usb/gadget/udc/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/core.c +1 -1
@@ -1570,7 +1570,7 @@ static int gadget_match_driver(struct device *dev, const struct device_driver *d {struct usb_gadget *gadget =dev_to_usb_gadget (dev);struct usb_udc *udc = gadget->udc; -struct usb_gadget_driver *driver =container_of (drv, +const struct usb_gadget_driver *driver =container_of (drv, struct usb_gadget_driver, driver);/* If the driver specifies a udc_name, it must match the UDC's name */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 342/512 USB: typec: fix const issue in typec_match()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit ae4432e01dd967a64f6670a152d91d5328032726 ]
typec_match() takes a const pointer, and then decides to cast it away into a non-const one, which is not a good thing to do overall. Fix this up by properly setting the pointers to be const to preserve that attribute.
--- drivers/usb/typec/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/bus.c +1 -1
@@ -449,7 +449,7 @@ ATTRIBUTE_GROUPS(typec);static int typec_match (struct device *dev,const struct device_driver *driver) { -struct typec_altmode_driver *drv =to_altmode_driver (driver); +const struct typec_altmode_driver *drv =to_altmode_driver (driver);struct typec_altmode *altmode =to_typec_altmode (dev);const struct typec_device_id *id;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 343/512 loop: add file_start_write() and file_end_write()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 39d86db34e41b96bd86f1955cd0ce6cd9c5fca4c ]
file_start_write() and file_end_write() should be added around ->write_iter().
Recently we switch to ->write_iter() from vfs_iter_write(), and the implied file_start_write() and file_end_write() are lost.
Also we never add them for dio code path, so add them back for covering both.
--- drivers/block/loop.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/block/loop.c +6 -2
@@ -323,11 +323,14 @@ static void lo_complete_rq(struct request *rq)static void lo_rw_aio_do_completion (struct loop_cmd *cmd) {struct request *rq =blk_mq_rq_from_pdu (cmd); +struct loop_device *lo = rq->q->queuedata;if (!atomic_dec_and_test (&cmd->ref))return ;kfree (cmd->bvec); cmd->bvec =NULL ; +if (req_op (rq) ==REQ_OP_WRITE ) +file_end_write (lo->lo_backing_file);if (likely (!blk_should_fake_timeout (rq->q)))blk_mq_complete_request (rq); }
@@ -402,9 +405,10 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd, cmd->iocb.ki_flags =0 ; } -if (rw ==ITER_SOURCE ) +if (rw ==ITER_SOURCE ) { +file_start_write (lo->lo_backing_file); ret = file->f_op->write_iter (&cmd->iocb, &iter); -else + }else ret = file->f_op->read_iter (&cmd->iocb, &iter);lo_rw_aio_do_completion (cmd);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 344/512 drm/xe: Make xe_gt_freq part of the Documentation
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Vivi <[email protected]>
[ Upstream commit 55f8aa083604ce098c9d6a0911c6bcde15d03a80 ]
The documentation was created with the creation of the component, however it has never been actually shown in the actual Documentation.
While doing this, fixes the identation style, to avoid new warnings while building htmldocs.
--- Documentation/gpu/xe/index.rst | 1 + Documentation/gpu/xe/xe_gt_freq.rst | 14 ++++++++++++++ drivers/gpu/drm/xe/xe_gt_freq.c | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 Documentation/gpu/xe/xe_gt_freq.rst
Documentation/gpu/xe/index.rst +1 -0
@@ -16,6 +16,7 @@ DG2, etc is provided to prototype the driver. xe_migrate xe_cs xe_pm + xe_gt_freq xe_pcode xe_gt_mcr xe_wa
Documentation/gpu/xe/xe_gt_freq.rst new file +14 -0
@@ -0,0 +1,14 @@ +.. SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +========================== +Xe GT Frequency Management +========================== + +.. kernel-doc:: drivers/gpu/drm/xe/xe_gt_freq.c + :doc: Xe GT Frequency Management + +Internal API +============ + +.. kernel-doc:: drivers/gpu/drm/xe/xe_gt_freq.c + :internal:
drivers/gpu/drm/xe/xe_gt_freq.c +2 -0
@@ -32,6 +32,7 @@* Xe's Freq provides a sysfs API for frequency management: * * device/tile#/gt#/freq0/<item>_freq *read-only* files: +* * - act_freq: The actual resolved frequency decided by PCODE. * - cur_freq: The current one requested by GuC PC to the PCODE. * - rpn_freq: The Render Performance (RP) N level, which is the minimal one.
@@ -39,6 +40,7 @@* - rp0_freq: The Render Performance (RP) 0 level, which is the maximum one. * * device/tile#/gt#/freq0/<item>_freq *read-write* files: +* * - min_freq: Min frequency request. * - max_freq: Max frequency request. * If max <= min, then freq_min becomes a fixed frequency request.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 345/512 Fix sock_exceed_buf_limit not being triggered in __sk_mem_raise_allocated
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tengteng Yang <[email protected]>
[ Upstream commit 8542d6fac25c03b4bf36b2d762cfe60fda8491bb ]
When a process under memory pressure is not part of any cgroup and the charged flag is false, trace_sock_exceed_buf_limit was not called as expected.
This regression was introduced by commit 2def8ff3fdb6 ("sock:
Code cleanup on __sk_mem_raise_allocated()"). The fix changes the default value of charged to true while preserving existing logic.
--- net/core/sock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/core/sock.c +4 -4
@@ -3157,16 +3157,16 @@ int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind) {struct mem_cgroup *memcg = mem_cgroup_sockets_enabled ? sk->sk_memcg :NULL ;struct proto *prot = sk->sk_prot; -bool charged = false; +bool charged = true;long allocated;sk_memory_allocated_add (sk, amt); allocated =sk_memory_allocated (sk);if (memcg) { -if (!mem_cgroup_charge_skmem (memcg, amt,gfp_memcg_charge ())) + charged =mem_cgroup_charge_skmem (memcg, amt,gfp_memcg_charge ()); +if (!charged) goto suppress_allocation; - charged = true; }/* Under limit. */
@@ -3251,7 +3251,7 @@ int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind)sk_memory_allocated_sub (sk, amt); -if (charged) +if (memcg && charged)mem_cgroup_uncharge_skmem (memcg, amt);return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 346/512 page_pool: Fix use-after-free in page_pool_recycle_in_ring
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dong Chenchen <[email protected]>
[ Upstream commit 271683bb2cf32e5126c592b5d5e6a756fa374fd9 ]
syzbot reported a uaf in page_pool_recycle_in_ring:
BUG: KASAN: slab-use-after-free in lock_release+0x151/0xa30 kernel/locking/lockdep.c:5862 Read of size 8 at addr ffff8880286045a0 by task syz.0.284/6943 CPU: 0 UID: 0 PID: 6943 Comm: syz.0.284 Not tainted 6.13.0-rc3-syzkaller-gdfa94ce54f41 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 lock_release+0x151/0xa30 kernel/locking/lockdep.c:5862 __raw_spin_unlock_bh include/linux/spinlock_api_smp.h:165 [inline] _raw_spin_unlock_bh+0x1b/0x40 kernel/locking/spinlock.c:210 spin_unlock_bh include/linux/spinlock.h:396 [inline] ptr_ring_produce_bh include/linux/ptr_ring.h:164 [inline] page_pool_recycle_in_ring net/core/page_pool.c:707 [inline] page_pool_put_unrefed_netmem+0x748/0xb00 net/core/page_pool.c:826 page_pool_put_netmem include/net/page_pool/helpers.h:323 [inline] page_pool_put_full_netmem include/net/page_pool/helpers.h:353 [inline] napi_pp_put_page+0x149/0x2b0 net/core/skbuff.c:1036 skb_pp_recycle net/core/skbuff.c:1047 [inline] skb_free_head net/core/skbuff.c:1094 [inline] skb_release_data+0x6c4/0x8a0 net/core/skbuff.c:1125 skb_release_all net/core/skbuff.c:1190 [inline] __kfree_skb net/core/skbuff.c:1204 [inline] sk_skb_reason_drop+0x1c9/0x380 net/core/skbuff.c:1242 kfree_skb_reason include/linux/skbuff.h:1263 [inline] __skb_queue_purge_reason include/linux/skbuff.h:3343 [inline]
root cause is:
page_pool_recycle_in_ring
ptr_ring_produce
spin_lock(&r->producer_lock);
WRITE_ONCE(r->queue[r->producer++], ptr)
//recycle last page to pool
page_pool_release
page_pool_scrub
page_pool_empty_ring
ptr_ring_consume
page_pool_return_page //release all page
__page_pool_destroy
free_percpu(pool->recycle_stats);
free(pool) //free
spin_unlock(&r->producer_lock); //pool->ring uaf read recycle_stat_inc(pool, ring);
page_pool can be free while page pool recycle the last page in ring. Add producer-lock barrier to page_pool_release to prevent the page pool from being free before all pages have been recycled.
recycle_stat_inc() is empty when CONFIG_PAGE_POOL_STATS is not enabled, which will trigger Wempty-body build warning. Add definition for pool stat macro to fix warning.
--- net/core/page_pool.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
net/core/page_pool.c +14 -13
@@ -151,9 +151,9 @@ u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats)EXPORT_SYMBOL (page_pool_ethtool_stats_get);#else -#define alloc_stat_inc (pool, __stat) -#define recycle_stat_inc (pool, __stat) -#define recycle_stat_add (pool, __stat, val) +#define alloc_stat_inc (...) do { } while (0) +#define recycle_stat_inc (...) do { } while (0) +#define recycle_stat_add (...) do { } while (0)#endif static bool page_pool_producer_lock (struct page_pool *pool)
@@ -734,19 +734,16 @@ void page_pool_return_page(struct page_pool *pool, netmem_ref netmem)static bool page_pool_recycle_in_ring (struct page_pool *pool,netmem_ref netmem) { -int ret; -/* BH protection not needed if current is softirq */ -if (in_softirq ()) - ret =ptr_ring_produce (&pool->ring, (__force void *)netmem); -else - ret =ptr_ring_produce_bh (&pool->ring, (__force void *)netmem); +bool in_softirq, ret; -if (!ret) { +/* BH protection not needed if current is softirq */ + in_softirq =page_pool_producer_lock (pool); + ret = !__ptr_ring_produce (&pool->ring, (__force void *)netmem); +if (ret)recycle_stat_inc (pool, ring); -return true; - } +page_pool_producer_unlock (pool, in_softirq); -return false; +return ret; }/* Only allow direct recycling in special circumstances, into the
@@ -1104,10 +1101,14 @@ static void page_pool_scrub(struct page_pool *pool)static int page_pool_release (struct page_pool *pool) { +bool in_softirq;int inflight;page_pool_scrub (pool); inflight =page_pool_inflight (pool, true); +/* Acquire producer lock to make sure producers have exited. */ + in_softirq =page_pool_producer_lock (pool); +page_pool_producer_unlock (pool, in_softirq);if (!inflight)__page_pool_destroy (pool);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 347/512 net: stmmac: platform: guarantee uniqueness of bus_id
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quentin Schulz <[email protected]>
[ Upstream commit eb7fd7aa35bfcc1e1fda4ecc42ccfcb526cdc780 ]
bus_id is currently derived from the ethernetX alias. If one is missing for the device, 0 is used. If ethernet0 points to another stmmac device or if there are 2+ stmmac devices without an ethernet alias, then bus_id will be 0 for all of those.
This is an issue because the bus_id is used to generate the mdio bus id (new_bus->id in drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c stmmac_mdio_register) and this needs to be unique.
This allows to avoid needing to define ethernet aliases for devices with multiple stmmac controllers (such as the Rockchip RK3588) for multiple stmmac devices to probe properly.
Obviously, the bus_id isn't guaranteed to be stable across reboots if no alias is set for the device but that is easily fixed by simply adding an alias if this is desired.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +9 -2
@@ -419,6 +419,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)struct device_node *np = pdev->dev.of_node;struct plat_stmmacenet_data *plat;struct stmmac_dma_cfg *dma_cfg; +static int bus_id = -ENODEV ;int phy_mode;void *ret;int rc;
@@ -454,8 +455,14 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)of_property_read_u32 (np,"max-speed" , &plat->max_speed); plat->bus_id =of_alias_get_id (np,"ethernet" ); -if (plat->bus_id <0 ) - plat->bus_id =0 ; +if (plat->bus_id <0 ) { +if (bus_id <0 ) + bus_id =of_alias_get_highest_id ("ethernet" ); +/* No ethernet alias found, init at -1 so first bus_id is 0 */ +if (bus_id <0 ) + bus_id =-1 ; + plat->bus_id = ++bus_id; + }/* Default to phy auto-detection */ plat->phy_addr =-1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 348/512 gve: Fix RX_BUFFERS_POSTED stat to report per-queue fill_cnt
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit f41a94aade120dc60322865f363cee7865f2df01 ]
Previously, the RX_BUFFERS_POSTED stat incorrectly reported the fill_cnt from RX queue 0 for all queues, resulting in inaccurate per-queue statistics.
Fix this by correctly indexing priv->rx[idx].fill_cnt for each RX queue.
--- drivers/net/ethernet/google/gve/gve_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_main.c +1 -1
@@ -2207,7 +2207,7 @@ void gve_handle_report_stats(struct gve_priv *priv) }; stats[stats_idx++] = (struct stats ) { .stat_name =cpu_to_be32 (RX_BUFFERS_POSTED ), - .value =cpu_to_be64 (priv->rx[0 ].fill_cnt), + .value =cpu_to_be64 (priv->rx[idx].fill_cnt), .queue_id =cpu_to_be32 (idx), }; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 349/512 net: tipc: fix refcount warning in tipc_aead_encrypt
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charalampos Mitrodimas <[email protected]>
[ Upstream commit f29ccaa07cf3d35990f4d25028cc55470d29372b ]
syzbot reported a refcount warning [1] caused by calling get_net() on a network namespace that is being destroyed (refcount=0). This happens when a TIPC discovery timer fires during network namespace cleanup.
The recently added get_net() call in commit e279024617134 ("net/tipc:
fix slab-use-after-free Read in tipc_aead_encrypt_done") attempts to hold a reference to the network namespace. However, if the namespace is already being destroyed, its refcount might be zero, leading to the use-after-free warning.
Replace get_net() with maybe_get_net(), which safely checks if the refcount is non-zero before incrementing it. If the namespace is being destroyed, return -ENODEV early, after releasing the bearer reference.
[1]: https://lore.kernel.org/all/[email protected]/T/#m12019cf9ae77e1954f666914640efa36d52704a2
--- net/tipc/crypto.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/tipc/crypto.c +5 -1
@@ -818,7 +818,11 @@ static int tipc_aead_encrypt(struct tipc_aead *aead, struct sk_buff *skb, }/* Get net to avoid freed tipc_crypto when delete namespace */ -get_net (aead->crypto->net); +if (!maybe_get_net (aead->crypto->net)) { +tipc_bearer_put (b); + rc = -ENODEV ; + goto exit; + }/* Now, do encrypt */ rc =crypto_aead_encrypt (req);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 350/512 driver: net: ethernet: mtk_star_emac: fix suspend/resume issue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yanqing Wang <[email protected]>
[ Upstream commit ba99c627aac85bc746fb4a6e2d79edb3ad100326 ]
Identify the cause of the suspend/resume hang: netif_carrier_off() is called during link state changes and becomes stuck while executing linkwatch_work().
To resolve this issue, call netif_device_detach() during the Ethernet suspend process to temporarily detach the network device from the kernel and prevent the suspend/resume hang.
--- drivers/net/ethernet/mediatek/mtk_star_emac.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mediatek/mtk_star_emac.c +4 -0
@@ -1468,6 +1468,8 @@ static __maybe_unused int mtk_star_suspend(struct device *dev)if (netif_running (ndev))mtk_star_disable (ndev); +netif_device_detach (ndev); +clk_bulk_disable_unprepare (MTK_STAR_NCLKS , priv->clks);return 0 ;
@@ -1492,6 +1494,8 @@ static __maybe_unused int mtk_star_resume(struct device *dev)clk_bulk_disable_unprepare (MTK_STAR_NCLKS , priv->clks); } +netif_device_attach (ndev); +return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 351/512 net/mlx4_en: Prevent potential integer overflow calculating Hz
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 54d34165b4f786d7fea8412a18fb4a54c1eab623 ]
The "freq" variable is in terms of MHz and "max_val_cycles" is in terms of Hz. The fact that "max_val_cycles" is a u64 suggests that support for high frequency is intended but the "freq_khz * 1000" would overflow the u32 type if we went above 4GHz. Use unsigned long long type for the mutliplication to prevent that.
--- drivers/net/ethernet/mellanox/mlx4/en_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_clock.c +1 -1
@@ -249,7 +249,7 @@ static const struct ptp_clock_info mlx4_en_ptp_clock_info = {static u32 freq_to_shift (u16 freq) {u32 freq_khz = freq *1000 ; -u64 max_val_cycles = freq_khz *1000 *MLX4_EN_WRAP_AROUND_SEC ; +u64 max_val_cycles = freq_khz *1000ULL *MLX4_EN_WRAP_AROUND_SEC ;u64 max_val_cycles_rounded =1ULL <<fls64 (max_val_cycles -1 );/* calculate max possible multiplier in order to fit in 64bit */ u64 max_mul =div64_u64 (ULLONG_MAX , max_val_cycles_rounded);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 352/512 net: lan966x: Make sure to insert the vlan tags also in host mode
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 27eab4c644236a9324084a70fe79e511cbd07393 ]
When running these commands on DUT (and similar at the other end) ip link set dev eth0 up
ip link add link eth0 name eth0.10 type vlan id 10
ip addr add 10.0.0.1/24 dev eth0.10
ip link set dev eth0.10 up
ping 10.0.0.2
The ping will fail.
The reason why is failing is because, the network interfaces for lan966x have a flag saying that the HW can insert the vlan tags into the frames(NETIF_F_HW_VLAN_CTAG_TX). Meaning that the frames that are transmitted don't have the vlan tag inside the skb data, but they have it inside the skb. We already get that vlan tag and put it in the IFH but the problem is that we don't configure the HW to rewrite the frame when the interface is in host mode.
The fix consists in actually configuring the HW to insert the vlan tag if it is different than 0.
--- .../ethernet/microchip/lan966x/lan966x_main.c | 1 + .../ethernet/microchip/lan966x/lan966x_main.h | 1 + .../microchip/lan966x/lan966x_switchdev.c | 1 + .../ethernet/microchip/lan966x/lan966x_vlan.c | 21 +++++++++++++++++++ 4 files changed, 24 insertions(+)
drivers/net/ethernet/microchip/lan966x/lan966x_main.c +1 -0
@@ -880,6 +880,7 @@ static int lan966x_probe_port(struct lan966x *lan966x, u32 p,lan966x_vlan_port_set_vlan_aware (port,0 );lan966x_vlan_port_set_vid (port,HOST_PVID , false, false);lan966x_vlan_port_apply (port); +lan966x_vlan_port_rew_host (port);return 0 ; }
drivers/net/ethernet/microchip/lan966x/lan966x_main.h +1 -0
@@ -497,6 +497,7 @@ void lan966x_vlan_port_apply(struct lan966x_port *port);bool lan966x_vlan_cpu_member_cpu_vlan_mask (struct lan966x *lan966x,u16 vid);void lan966x_vlan_port_set_vlan_aware (struct lan966x_port *port,bool vlan_aware); +void lan966x_vlan_port_rew_host (struct lan966x_port *port); int lan966x_vlan_port_set_vid(struct lan966x_port *port, u16 vid, bool pvid,
drivers/net/ethernet/microchip/lan966x/lan966x_switchdev.c +1 -0
@@ -297,6 +297,7 @@ static void lan966x_port_bridge_leave(struct lan966x_port *port,lan966x_vlan_port_set_vlan_aware (port, false);lan966x_vlan_port_set_vid (port,HOST_PVID , false, false);lan966x_vlan_port_apply (port); +lan966x_vlan_port_rew_host (port); } int lan966x_port_changeupper(struct net_device *dev,
drivers/net/ethernet/microchip/lan966x/lan966x_vlan.c +21 -0
@@ -149,6 +149,27 @@ void lan966x_vlan_port_set_vlan_aware(struct lan966x_port *port, port->vlan_aware = vlan_aware; } +/* When the interface is in host mode, the interface should not be vlan aware +* but it should insert all the tags that it gets from the network stack. +* The tags are not in the data of the frame but actually in the skb and the ifh +* is configured already to get this tag. So what we need to do is to update the +* rewriter to insert the vlan tag for all frames which have a vlan tag +* different than 0. +*/ +void lan966x_vlan_port_rew_host (struct lan966x_port *port) +{ +struct lan966x *lan966x = port->lan966x; +u32 val; + +/* Tag all frames except when VID=0*/ + val =REW_TAG_CFG_TAG_CFG_SET (2 ); + +/* Update only some bits in the register */ +lan_rmw (val, +REW_TAG_CFG_TAG_CFG , + lan966x,REW_TAG_CFG (port->chip_port)); +} +void lan966x_vlan_port_apply (struct lan966x_port *port) {struct lan966x *lan966x = port->lan966x;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 353/512 spi: bcm63xx-spi: fix shared reset
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 5ad20e3d8cfe3b2e42bbddc7e0ebaa74479bb589 ]
Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI and HSSPI controllers, so reset shouldn't be exclusive.
--- drivers/spi/spi-bcm63xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-bcm63xx.c +1 -1
@@ -523,7 +523,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)return PTR_ERR (clk); } - reset =devm_reset_control_get_optional_exclusive (dev,NULL ); + reset =devm_reset_control_get_optional_shared (dev,NULL );if (IS_ERR (reset))return PTR_ERR (reset);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 354/512 spi: bcm63xx-hsspi: fix shared reset
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit 3d6d84c8f2f66d3fd6a43a1e2ce8e6b54c573960 ]
Some bmips SoCs (bcm6362, bcm63268) share the same SPI reset for both SPI and HSSPI controllers, so reset shouldn't be exclusive.
--- drivers/spi/spi-bcm63xx-hsspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-bcm63xx-hsspi.c +1 -1
@@ -745,7 +745,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)if (IS_ERR (clk))return PTR_ERR (clk); - reset =devm_reset_control_get_optional_exclusive (dev,NULL ); + reset =devm_reset_control_get_optional_shared (dev,NULL );if (IS_ERR (reset))return PTR_ERR (reset);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 355/512 Bluetooth: L2CAP: Fix not responding with L2CAP_CR_LE_ENCRYPTION
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 03dba9cea72f977e873e4e60e220fa596959dd8f ]
Depending on the security set the response to L2CAP_LE_CONN_REQ shall be just L2CAP_CR_LE_ENCRYPTION if only encryption when BT_SECURITY_MEDIUM is selected since that means security mode 2 which doesn't require authentication which is something that is covered in the qualification test L2CAP/LE/CFC/BV-25-C.
--- net/bluetooth/l2cap_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +2 -1
@@ -4835,7 +4835,8 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,if (!smp_sufficient_security (conn->hcon, pchan->sec_level,SMP_ALLOW_STK )) { - result =L2CAP_CR_LE_AUTHENTICATION ; + result = pchan->sec_level ==BT_SECURITY_MEDIUM ? +L2CAP_CR_LE_ENCRYPTION :L2CAP_CR_LE_AUTHENTICATION ; chan =NULL ; goto response_unlock; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 356/512 ice: fix Tx scheduler error handling in XDP callback
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kubiak <[email protected]>
[ Upstream commit 0153f36041b8e52019ebfa8629c13bf8f9b0a951 ]
When the XDP program is loaded, the XDP callback adds new Tx queues. This means that the callback must update the Tx scheduler with the new queue number. In the event of a Tx scheduler failure, the XDP callback should also fail and roll back any changes previously made for XDP preparation.
The previous implementation had a bug that not all changes made by the XDP callback were rolled back. This caused the crash with the following call trace:
[ +9.549584] ice 0000:ca:00.0: Failed VSI LAN queue config for XDP, error: -5 [ +0.382335] Oops: general protection fault, probably for non-canonical address 0x50a2250a90495525: 0000 [#1] SMP NOPTI [ +0.010710] CPU: 103 UID: 0 PID: 0 Comm: swapper/103 Not tainted 6.14.0-net-next-mar-31+ #14 PREEMPT(voluntary) [ +0.010175] Hardware name: Intel Corporation M50CYP2SBSTD/M50CYP2SBSTD, BIOS SE5C620.86B.01.01.0005.2202160810 02/16/2022 [ +0.010946] RIP: 0010:__ice_update_sample+0x39/0xe0 [ice]
[...]
[ +0.002715] Call Trace: [ +0.002452] <IRQ> [ +0.002021] ? __die_body.cold+0x19/0x29 [ +0.003922] ? die_addr+0x3c/0x60 [ +0.003319] ? exc_general_protection+0x17c/0x400 [ +0.004707] ? asm_exc_general_protection+0x26/0x30 [ +0.004879] ? __ice_update_sample+0x39/0xe0 [ice] [ +0.004835] ice_napi_poll+0x665/0x680 [ice] [ +0.004320] __napi_poll+0x28/0x190 [ +0.003500] net_rx_action+0x198/0x360 [ +0.003752] ? update_rq_clock+0x39/0x220 [ +0.004013] handle_softirqs+0xf1/0x340 [ +0.003840] ? sched_clock_cpu+0xf/0x1f0 [ +0.003925] __irq_exit_rcu+0xc2/0xe0 [ +0.003665] common_interrupt+0x85/0xa0 [ +0.003839] </IRQ> [ +0.002098] <TASK> [ +0.002106] asm_common_interrupt+0x26/0x40 [ +0.004184] RIP: 0010:cpuidle_enter_state+0xd3/0x690
Fix this by performing the missing unmapping of XDP queues from q_vectors and setting the XDP rings pointer back to NULL after all those queues are released.
Also, add an immediate exit from the XDP callback in case of ring preparation failure.
--- drivers/net/ethernet/intel/ice/ice_main.c | 47 ++++++++++++++++------- 1 file changed, 33 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +33 -14
@@ -2761,6 +2761,27 @@ void ice_map_xdp_rings(struct ice_vsi *vsi) } } +/** +* ice_unmap_xdp_rings - Unmap XDP rings from interrupt vectors +* @vsi: the VSI with XDP rings being unmapped +*/ +static void ice_unmap_xdp_rings (struct ice_vsi *vsi) +{ +int v_idx; + +ice_for_each_q_vector (vsi, v_idx) { +struct ice_q_vector *q_vector = vsi->q_vectors[v_idx]; +struct ice_tx_ring *ring; + +ice_for_each_tx_ring (ring, q_vector->tx) +if (!ring->tx_buf || !ice_ring_is_xdp (ring)) +break ; + +/* restore the value of last node prior to XDP setup */ + q_vector->tx.tx_ring = ring; + } +} +/** * ice_prepare_xdp_rings - Allocate, configure and setup Tx rings for XDP * @vsi: VSI to bring up Tx rings used by XDP
@@ -2824,7 +2845,7 @@ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog,if (status) {dev_err (dev,"Failed VSI LAN queue config for XDP, error: %d\n" , status); - goto clear_xdp_rings; + goto unmap_xdp_rings; }/* assign the prog only when it's not already present on VSI;
@@ -2840,6 +2861,8 @@ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog,ice_vsi_assign_bpf_prog (vsi, prog);return 0 ; +unmap_xdp_rings: +ice_unmap_xdp_rings (vsi); clear_xdp_rings:ice_for_each_xdp_txq (vsi, i)if (vsi->xdp_rings[i]) {
@@ -2856,6 +2879,8 @@ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog,mutex_unlock (&pf->avail_q_mutex);devm_kfree (dev, vsi->xdp_rings); + vsi->xdp_rings =NULL ; +return -ENOMEM ; }
@@ -2871,7 +2896,7 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type) {u16 max_txqs[ICE_MAX_TRAFFIC_CLASS ] = {0 };struct ice_pf *pf = vsi->back; -int i, v_idx; +int i;/* q_vectors are freed in reset path so there's no point in detaching * rings
@@ -2879,17 +2904,7 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type)if (cfg_type ==ICE_XDP_CFG_PART ) goto free_qmap; -ice_for_each_q_vector (vsi, v_idx) { -struct ice_q_vector *q_vector = vsi->q_vectors[v_idx]; -struct ice_tx_ring *ring; - -ice_for_each_tx_ring (ring, q_vector->tx) -if (!ring->tx_buf || !ice_ring_is_xdp (ring)) -break ; - -/* restore the value of last node prior to XDP setup */ - q_vector->tx.tx_ring = ring; - } +ice_unmap_xdp_rings (vsi); free_qmap:mutex_lock (&pf->avail_q_mutex);
@@ -3034,11 +3049,14 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, xdp_ring_err =ice_vsi_determine_xdp_res (vsi);if (xdp_ring_err) {NL_SET_ERR_MSG_MOD (extack,"Not enough Tx resources for XDP" ); + goto resume_if; }else { xdp_ring_err =ice_prepare_xdp_rings (vsi, prog,ICE_XDP_CFG_FULL ); -if (xdp_ring_err) +if (xdp_ring_err) {NL_SET_ERR_MSG_MOD (extack,"Setting up XDP Tx resources failed" ); + goto resume_if; + } }xdp_features_set_redirect_target (vsi->netdev, true);/* reallocate Rx queues that are used for zero-copy */
@@ -3056,6 +3074,7 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,NL_SET_ERR_MSG_MOD (extack,"Freeing XDP Rx resources failed" ); } +resume_if:if (if_running) ret =ice_up (vsi);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 357/512 ice: create new Tx scheduler nodes for new queues only
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kubiak <[email protected]>
[ Upstream commit 6fa2942578472c9cab13a8fc1dae0d830193e0a1 ]
The current implementation of the Tx scheduler tree attempts to create nodes for all Tx queues, ignoring the fact that some queues may already exist in the tree. For example, if the VSI already has 128 Tx queues and the user requests for 16 new queues, the Tx scheduler will compute the tree for 272 queues (128 existing queues + 144 new queues), instead of 144 queues (128 existing queues and 16 new queues).
Fix that by modifying the node count calculation algorithm to skip the queues that already exist in the tree.
--- drivers/net/ethernet/intel/ice/ice_sched.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ice/ice_sched.c +6 -5
@@ -1604,16 +1604,16 @@ ice_sched_get_agg_node(struct ice_port_info *pi, struct ice_sched_node *tc_node,/** * ice_sched_calc_vsi_child_nodes - calculate number of VSI child nodes * @hw: pointer to the HW struct -* @num_qs: number of queues +* @num_new_qs: number of new queues that will be added to the tree * @num_nodes: num nodes array * * This function calculates the number of VSI child nodes based on the * number of queues. */ static void -ice_sched_calc_vsi_child_nodes (struct ice_hw *hw,u16 num_qs,u16 *num_nodes) +ice_sched_calc_vsi_child_nodes (struct ice_hw *hw,u16 num_new_qs,u16 *num_nodes) { -u16 num = num_qs; +u16 num = num_new_qs;u8 i, qgl, vsil; qgl =ice_sched_get_qgrp_layer (hw);
@@ -1863,8 +1863,9 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,return status; } -if (new_numqs) -ice_sched_calc_vsi_child_nodes (hw, new_numqs, new_num_nodes); +ice_sched_calc_vsi_child_nodes (hw, new_numqs - prev_numqs, + new_num_nodes); +/* Keep the max number of queue configuration all the time. Update the * tree only if number of queues > previous number of queues. This may * leave some extra nodes in the tree if number of queues < previous
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 358/512 ice: fix rebuilding the Tx scheduler tree for large queue counts
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kubiak <[email protected]>
[ Upstream commit 73145e6d81070d34a21431c9e0d7aaf2f29ca048 ]
The current implementation of the Tx scheduler allows the tree to be rebuilt as the user adds more Tx queues to the VSI. In such a case, additional child nodes are added to the tree to support the new number of queues.
Unfortunately, this algorithm does not take into account that the limit of the VSI support node may be exceeded, so an additional node in the VSI layer may be required to handle all the requested queues.
Such a scenario occurs when adding XDP Tx queues on machines with many CPUs. Although the driver still respects the queue limit returned by the FW, the Tx scheduler was unable to add those queues to its tree and returned one of the errors below.
Such a scenario occurs when adding XDP Tx queues on machines with many CPUs (e.g. at least 321 CPUs, if there is already 128 Tx/Rx queue pairs). Although the driver still respects the queue limit returned by the FW, the Tx scheduler was unable to add those queues to its tree and returned the following errors:
Failed VSI LAN queue config for XDP, error: -5
or:
Failed to set LAN Tx queue context, error: -22
Fix this problem by extending the tree rebuild algorithm to check if the current VSI node can support the requested number of queues. If it cannot, create as many additional VSI support nodes as necessary to handle all the required Tx queues. Symmetrically, adjust the VSI node removal algorithm to remove all nodes associated with the given VSI. Also, make the search for the next free VSI node more restrictive. That is, add queue group nodes only to the VSI support nodes that have a matching VSI handle.
Finally, fix the comment describing the tree update algorithm to better reflect the current scenario.
--- drivers/net/ethernet/intel/ice/ice_sched.c | 170 +++++++++++++++++---- 1 file changed, 142 insertions(+), 28 deletions(-)
drivers/net/ethernet/intel/ice/ice_sched.c +142 -28
@@ -84,6 +84,27 @@ ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid)return NULL ; } +/** +* ice_sched_find_next_vsi_node - find the next node for a given VSI +* @vsi_node: VSI support node to start search with +* +* Return: Next VSI support node, or NULL. +* +* The function returns a pointer to the next node from the VSI layer +* assigned to the given VSI, or NULL if there is no such a node. +*/ +static struct ice_sched_node * +ice_sched_find_next_vsi_node (struct ice_sched_node *vsi_node) +{ +unsigned int vsi_handle = vsi_node->vsi_handle; + +while ((vsi_node = vsi_node->sibling) !=NULL ) +if (vsi_node->vsi_handle == vsi_handle) +break ; + +return vsi_node; +} +/** * ice_aqc_send_sched_elem_cmd - send scheduling elements cmd * @hw: pointer to the HW struct
@@ -1084,8 +1105,10 @@ ice_sched_add_nodes_to_layer(struct ice_port_info *pi,if (parent->num_children < max_child_nodes) { new_num_nodes = max_child_nodes - parent->num_children; }else { -/* This parent is full, try the next sibling */ - parent = parent->sibling; +/* This parent is full, +* try the next available sibling. +*/ + parent =ice_sched_find_next_vsi_node (parent);/* Don't modify the first node TEID memory if the * first node was added already in the above call. * Instead send some temp memory for all other
@@ -1528,12 +1551,23 @@ ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,/* get the first queue group node from VSI sub-tree */ qgrp_node =ice_sched_get_first_node (pi, vsi_node, qgrp_layer);while (qgrp_node) { +struct ice_sched_node *next_vsi_node; +/* make sure the qgroup node is part of the VSI subtree */ if (ice_sched_find_node_in_subtree (pi->hw, vsi_node, qgrp_node))if (qgrp_node->num_children < max_children && qgrp_node->owner == owner)break ; qgrp_node = qgrp_node->sibling; +if (qgrp_node) +continue ; + + next_vsi_node =ice_sched_find_next_vsi_node (vsi_node); +if (!next_vsi_node) +break ; + + vsi_node = next_vsi_node; + qgrp_node =ice_sched_get_first_node (pi, vsi_node, qgrp_layer); }/* Select the best queue group */
@@ -1779,7 +1813,11 @@ ice_sched_add_vsi_support_nodes(struct ice_port_info *pi, u16 vsi_handle,if (!parent)return -EIO ; -if (i == vsil) +/* Do not modify the VSI handle for already existing VSI nodes, +* (if no new VSI node was added to the tree). +* Assign the VSI handle only to newly added VSI nodes. +*/ +if (i == vsil && num_added) parent->vsi_handle = vsi_handle; }
@@ -1812,6 +1850,41 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc) num_nodes); } +/** +* ice_sched_recalc_vsi_support_nodes - recalculate VSI support nodes count +* @hw: pointer to the HW struct +* @vsi_node: pointer to the leftmost VSI node that needs to be extended +* @new_numqs: new number of queues that has to be handled by the VSI +* @new_num_nodes: pointer to nodes count table to modify the VSI layer entry +* +* This function recalculates the number of supported nodes that need to +* be added after adding more Tx queues for a given VSI. +* The number of new VSI support nodes that shall be added will be saved +* to the @new_num_nodes table for the VSI layer. +*/ +static void +ice_sched_recalc_vsi_support_nodes (struct ice_hw *hw, +struct ice_sched_node *vsi_node, +unsigned int new_numqs,u16 *new_num_nodes) +{ +u32 vsi_nodes_cnt =1 ; +u32 max_queue_cnt =1 ; +u32 qgl, vsil; + + qgl =ice_sched_get_qgrp_layer (hw); + vsil =ice_sched_get_vsi_layer (hw); + +for (u32 i = vsil; i <= qgl; i++) + max_queue_cnt *= hw->max_children[i]; + +while ((vsi_node =ice_sched_find_next_vsi_node (vsi_node)) !=NULL ) + vsi_nodes_cnt++; + +if (new_numqs > (max_queue_cnt * vsi_nodes_cnt)) + new_num_nodes[vsil] =DIV_ROUND_UP (new_numqs, max_queue_cnt) - + vsi_nodes_cnt; +} +/** * ice_sched_update_vsi_child_nodes - update VSI child nodes * @pi: port information structure
@@ -1863,16 +1936,25 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,return status; } +ice_sched_recalc_vsi_support_nodes (hw, vsi_node, + new_numqs, new_num_nodes);ice_sched_calc_vsi_child_nodes (hw, new_numqs - prev_numqs, new_num_nodes); -/* Keep the max number of queue configuration all the time. Update the -* tree only if number of queues > previous number of queues. This may +/* Never decrease the number of queues in the tree. Update the tree +* only if number of queues > previous number of queues. This may * leave some extra nodes in the tree if number of queues < previous * number but that wouldn't harm anything. Removing those extra nodes * may complicate the code if those nodes are part of SRL or * individually rate limited. +* Also, add the required VSI support nodes if the existing ones cannot +* handle the requested new number of queues. */ + status =ice_sched_add_vsi_support_nodes (pi, vsi_handle, tc_node, + new_num_nodes); +if (status) +return status; + status =ice_sched_add_vsi_child_nodes (pi, vsi_handle, tc_node, new_num_nodes, owner);if (status)
@@ -2013,6 +2095,58 @@ static bool ice_sched_is_leaf_node_present(struct ice_sched_node *node)return (node->info.data.elem_type ==ICE_AQC_ELEM_TYPE_LEAF ); } +/** +* ice_sched_rm_vsi_subtree - remove all nodes assigned to a given VSI +* @pi: port information structure +* @vsi_node: pointer to the leftmost node of the VSI to be removed +* @owner: LAN or RDMA +* @tc: TC number +* +* Return: Zero in case of success, or -EBUSY if the VSI has leaf nodes in TC. +* +* This function removes all the VSI support nodes associated with a given VSI +* and its LAN or RDMA children nodes from the scheduler tree. +*/ +static int +ice_sched_rm_vsi_subtree (struct ice_port_info *pi, +struct ice_sched_node *vsi_node,u8 owner,u8 tc) +{ +u16 vsi_handle = vsi_node->vsi_handle; +bool all_vsi_nodes_removed = true; +int j =0 ; + +while (vsi_node) { +struct ice_sched_node *next_vsi_node; + +if (ice_sched_is_leaf_node_present (vsi_node)) { +ice_debug (pi->hw,ICE_DBG_SCHED ,"VSI has leaf nodes in TC %d\n" , tc); +return -EBUSY ; + } +while (j < vsi_node->num_children) { +if (vsi_node->children[j]->owner == owner) +ice_free_sched_node (pi, vsi_node->children[j]); +else + j++; + } + + next_vsi_node =ice_sched_find_next_vsi_node (vsi_node); + +/* remove the VSI if it has no children */ +if (!vsi_node->num_children) +ice_free_sched_node (pi, vsi_node); +else + all_vsi_nodes_removed = false; + + vsi_node = next_vsi_node; + } + +/* clean up aggregator related VSI info if any */ +if (all_vsi_nodes_removed) +ice_sched_rm_agg_vsi_info (pi, vsi_handle); + +return 0 ; +} +/** * ice_sched_rm_vsi_cfg - remove the VSI and its children nodes * @pi: port information structure
@@ -2039,7 +2173,6 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)ice_for_each_traffic_class (i) {struct ice_sched_node *vsi_node, *tc_node; -u8 j =0 ; tc_node =ice_sched_get_tc_node (pi, i);if (!tc_node)
@@ -2049,31 +2182,12 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)if (!vsi_node)continue ; -if (ice_sched_is_leaf_node_present (vsi_node)) { -ice_debug (pi->hw,ICE_DBG_SCHED ,"VSI has leaf nodes in TC %d\n" , i); - status = -EBUSY ; + status =ice_sched_rm_vsi_subtree (pi, vsi_node, owner, i); +if (status) goto exit_sched_rm_vsi_cfg; - } -while (j < vsi_node->num_children) { -if (vsi_node->children[j]->owner == owner) { -ice_free_sched_node (pi, vsi_node->children[j]); -/* reset the counter again since the num -* children will be updated after node removal -*/ - j =0 ; - }else { - j++; - } - } -/* remove the VSI if it has no children */ -if (!vsi_node->num_children) { -ice_free_sched_node (pi, vsi_node); - vsi_ctx->sched.vsi_node[i] =NULL ; + vsi_ctx->sched.vsi_node[i] =NULL ; -/* clean up aggregator related VSI info if any */ -ice_sched_rm_agg_vsi_info (pi, vsi_handle); - }if (owner ==ICE_SCHED_NODE_OWNER_LAN ) vsi_ctx->sched.max_lanq[i] =0 ;else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 359/512 idpf: fix a race in txq wakeup
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Vazquez <[email protected]>
[ Upstream commit 7292af042bcf22e2c18b96ed250f78498a5b28ab ]
Add a helper function to correctly handle the lockless synchronization when the sender needs to block. The paradigm is
if (no_resources()) {
stop_queue();
barrier();
if (!no_resources())
restart_queue();
}netif_subqueue_maybe_stop already handles the paradigm correctly, but the code split the check for resources in three parts, the first one (descriptors) followed the protocol, but the other two (completions and tx_buf) were only doing the first part and so race prone.
Luckily netif_subqueue_maybe_stop macro already allows you to use a function to evaluate the start/stop conditions so the fix only requires the right helper function to evaluate all the conditions at once.
The patch removes idpf_tx_maybe_stop_common since it's no longer needed and instead adjusts separately the conditions for singleq and splitq.
Note that idpf_tx_buf_hw_update doesn't need to check for resources since that will be covered in idpf_tx_splitq_frame.
To reproduce:
Reduce the threshold for pending completions to increase the chances of hitting this pause by changing your kernel:
drivers/net/ethernet/intel/idpf/idpf_txrx.h
-#define IDPF_TX_COMPLQ_OVERFLOW_THRESH(txcq) ((txcq)->desc_count >> 1)
+#define IDPF_TX_COMPLQ_OVERFLOW_THRESH(txcq) ((txcq)->desc_count >> 4)
Use pktgen to force the host to push small pkts very aggressively:
./pktgen_sample02_multiqueue.sh -i eth1 -s 100 -6 -d $IP -m $MAC \
-p 10000-10000 -t 16 -n 0 -v -x -c 64
--- .../ethernet/intel/idpf/idpf_singleq_txrx.c | 9 ++-- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 45 +++++++------------ drivers/net/ethernet/intel/idpf/idpf_txrx.h | 8 ---- 3 files changed, 22 insertions(+), 40 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c +5 -4
@@ -362,17 +362,18 @@ netdev_tx_t idpf_tx_singleq_frame(struct sk_buff *skb, {struct idpf_tx_offload_params offload = { };struct idpf_tx_buf *first; +int csum, tso, needed;unsigned int count;__be16 protocol; -int csum, tso; count =idpf_tx_desc_count_required (tx_q, skb);if (unlikely (!count))return idpf_tx_drop_skb (tx_q, skb); -if (idpf_tx_maybe_stop_common (tx_q, - count +IDPF_TX_DESCS_PER_CACHE_LINE + -IDPF_TX_DESCS_FOR_CTX )) { + needed = count +IDPF_TX_DESCS_PER_CACHE_LINE +IDPF_TX_DESCS_FOR_CTX ; +if (!netif_subqueue_maybe_stop (tx_q->netdev, tx_q->idx, +IDPF_DESC_UNUSED (tx_q), + needed, needed)) {idpf_tx_buf_hw_update (tx_q, tx_q->next_to_use, false);u64_stats_update_begin (&tx_q->stats_sync);
drivers/net/ethernet/intel/idpf/idpf_txrx.c +17 -28
64 lines not on this page · raw message
drivers/net/ethernet/intel/idpf/idpf_txrx.h +0 -8
@@ -1052,12 +1052,4 @@ bool idpf_rx_singleq_buf_hw_alloc_all(struct idpf_rx_queue *rxq, u16 cleaned_count);int idpf_tso (struct sk_buff *skb,struct idpf_tx_offload_params *off); -static inline bool idpf_tx_maybe_stop_common (struct idpf_tx_queue *tx_q, -u32 needed) -{ -return !netif_subqueue_maybe_stop (tx_q->netdev, tx_q->idx, -IDPF_DESC_UNUSED (tx_q), - needed, needed); -} -#endif /* !_IDPF_TXRX_H_ */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 360/512 idpf: avoid mailbox timeout delays during reset
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Tantilov <[email protected]>
[ Upstream commit 9dc63d8ff182150d7d7b318ab9389702a2c0a292 ]
Mailbox operations are not possible while the driver is in reset. Operations that require MBX exchange with the control plane will result in long delays if executed while a reset is in progress:
ethtool -L <inf> combined 8& echo 1 > /sys/class/net/<inf>/device/reset
idpf 0000:83:00.0: HW reset detected
idpf 0000:83:00.0: Device HW Reset initiated
idpf 0000:83:00.0: Transaction timed-out (op:504 cookie:be00 vc_op:504 salt:be timeout:2000ms) idpf 0000:83:00.0: Transaction timed-out (op:508 cookie:bf00 vc_op:508 salt:bf timeout:2000ms) idpf 0000:83:00.0: Transaction timed-out (op:512 cookie:c000 vc_op:512 salt:c0 timeout:2000ms) idpf 0000:83:00.0: Transaction timed-out (op:510 cookie:c100 vc_op:510 salt:c1 timeout:2000ms) idpf 0000:83:00.0: Transaction timed-out (op:509 cookie:c200 vc_op:509 salt:c2 timeout:60000ms) idpf 0000:83:00.0: Transaction timed-out (op:509 cookie:c300 vc_op:509 salt:c3 timeout:60000ms) idpf 0000:83:00.0: Transaction timed-out (op:505 cookie:c400 vc_op:505 salt:c4 timeout:60000ms) idpf 0000:83:00.0: Failed to configure queues for vport 0, -62
Disable mailbox communication in case of a reset, unless it's done during a driver load, where the virtchnl operations are needed to configure the device.
--- drivers/net/ethernet/intel/idpf/idpf_lib.c | 18 +++++++++++++----- .../net/ethernet/intel/idpf/idpf_virtchnl.c | 2 +- .../net/ethernet/intel/idpf/idpf_virtchnl.h | 1 + 3 files changed, 15 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_lib.c +13 -5
@@ -1802,11 +1802,19 @@ void idpf_vc_event_task(struct work_struct *work)if (test_bit (IDPF_REMOVE_IN_PROG , adapter->flags))return ; -if (test_bit (IDPF_HR_FUNC_RESET , adapter->flags) || -test_bit (IDPF_HR_DRV_LOAD , adapter->flags)) { -set_bit (IDPF_HR_RESET_IN_PROG , adapter->flags); -idpf_init_hard_reset (adapter); - } +if (test_bit (IDPF_HR_FUNC_RESET , adapter->flags)) + goto func_reset; + +if (test_bit (IDPF_HR_DRV_LOAD , adapter->flags)) + goto drv_load; + +return ; + +func_reset: +idpf_vc_xn_shutdown (adapter->vcxn_mngr); +drv_load: +set_bit (IDPF_HR_RESET_IN_PROG , adapter->flags); +idpf_init_hard_reset (adapter); }/**
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +1 -1
@@ -376,7 +376,7 @@ static void idpf_vc_xn_init(struct idpf_vc_xn_manager *vcxn_mngr)* All waiting threads will be woken-up and their transaction aborted. Further * operations on that object will fail. */ -static void idpf_vc_xn_shutdown (struct idpf_vc_xn_manager *vcxn_mngr) +void idpf_vc_xn_shutdown (struct idpf_vc_xn_manager *vcxn_mngr) {int i;
drivers/net/ethernet/intel/idpf/idpf_virtchnl.h +1 -0
@@ -66,5 +66,6 @@ int idpf_send_get_stats_msg(struct idpf_vport *vport);int idpf_send_set_sriov_vfs_msg (struct idpf_adapter *adapter,u16 num_vfs);int idpf_send_get_set_rss_key_msg (struct idpf_vport *vport,bool get);int idpf_send_get_set_rss_lut_msg (struct idpf_vport *vport,bool get); +void idpf_vc_xn_shutdown (struct idpf_vc_xn_manager *vcxn_mngr);#endif /* _IDPF_VIRTCHNL_H_ */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 361/512 net: dsa: tag_brcm: legacy: fix pskb_may_pull length
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit efdddc4484859082da6c7877ed144c8121c8ea55 ]
BRCM_LEG_PORT_ID was incorrectly used for pskb_may_pull length. The correct check is BRCM_LEG_TAG_LEN + VLAN_HLEN, or 10 bytes.
--- net/dsa/tag_brcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/dsa/tag_brcm.c +1 -1
@@ -257,7 +257,7 @@ static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb,int source_port;u8 *brcm_tag; -if (unlikely (!pskb_may_pull (skb,BRCM_LEG_PORT_ID ))) +if (unlikely (!pskb_may_pull (skb,BRCM_LEG_TAG_LEN +VLAN_HLEN )))return NULL ; brcm_tag =dsa_etype_header_pos_rx (skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 362/512 net: stmmac: make sure that ptp_rate is not 0 before configuring timestamping
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré <[email protected]>
[ Upstream commit 030ce919e114a111e83b7976ecb3597cefd33f26 ]
The stmmac platform drivers that do not open-code the clk_ptp_rate value after having retrieved the default one from the device-tree can end up with 0 in clk_ptp_rate (as clk_get_rate can return 0). It will eventually propagate up to PTP initialization when bringing up the interface, leading to a divide by 0:
Division by zero in kernel.
CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.30-00001-g48313bd5768a #22 Hardware name: STM32 (Device Tree Support) Call trace: unwind_backtrace from show_stack+0x18/0x1c show_stack from dump_stack_lvl+0x6c/0x8c dump_stack_lvl from Ldiv0_64+0x8/0x18 Ldiv0_64 from stmmac_init_tstamp_counter+0x190/0x1a4 stmmac_init_tstamp_counter from stmmac_hw_setup+0xc1c/0x111c stmmac_hw_setup from __stmmac_open+0x18c/0x434 __stmmac_open from stmmac_open+0x3c/0xbc stmmac_open from __dev_open+0xf4/0x1ac __dev_open from __dev_change_flags+0x1cc/0x224 __dev_change_flags from dev_change_flags+0x24/0x60 dev_change_flags from ip_auto_config+0x2e8/0x11a0 ip_auto_config from do_one_initcall+0x84/0x33c do_one_initcall from kernel_init_freeable+0x1b8/0x214 kernel_init_freeable from kernel_init+0x24/0x140 kernel_init from ret_from_fork+0x14/0x28 Exception stack(0xe0815fb0 to 0xe0815ff8)
Prevent this division by 0 by adding an explicit check and error log about the actual issue. While at it, remove the same check from stmmac_ptp_register, which then becomes duplicate
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++++ drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -0
@@ -835,6 +835,11 @@ int stmmac_init_tstamp_counter(struct stmmac_priv *priv, u32 systime_flags)if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp))return -EOPNOTSUPP ; +if (!priv->plat->clk_ptp_rate) { +netdev_err (priv->dev,"Invalid PTP clock rate" ); +return -EINVAL ; + } +stmmac_config_hw_tstamping (priv, priv->ptpaddr, systime_flags); priv->systime_flags = systime_flags;
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +1 -1
@@ -303,7 +303,7 @@ void stmmac_ptp_register(struct stmmac_priv *priv)/* Calculate the clock domain crossing (CDC) error if necessary */ priv->plat->cdc_error_adj =0 ; -if (priv->plat->has_gmac4 && priv->plat->clk_ptp_rate) +if (priv->plat->has_gmac4) priv->plat->cdc_error_adj = (2 *NSEC_PER_SEC ) / priv->plat->clk_ptp_rate; stmmac_ptp_clock_ops.n_per_out = priv->dma_cap.pps_out_num;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 363/512 net: stmmac: make sure that ptp_rate is not 0 before configuring EST
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré <[email protected]>
[ Upstream commit cbefe2ffa7784525ec5d008ba87c7add19ec631a ]
If the ptp_rate recorded earlier in the driver happens to be 0, this bogus value will propagate up to EST configuration, where it will trigger a division by 0.
Prevent this division by 0 by adding the corresponding check and error code.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_est.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_est.c +5 -0
@@ -32,6 +32,11 @@ static int est_configure(struct stmmac_priv *priv, struct stmmac_est *cfg,int i, ret =0 ;u32 ctrl; +if (!ptp_rate) { +netdev_warn (priv->dev,"Invalid PTP rate" ); +return -EINVAL ; + } + ret |=est_write (est_addr,EST_BTR_LOW , cfg->btr[0 ], false); ret |=est_write (est_addr,EST_BTR_HIGH , cfg->btr[1 ], false); ret |=est_write (est_addr,EST_TER , cfg->ter, false);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 364/512 net: Fix checksum update for ILA adj-transport
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
[ Upstream commit 6043b794c7668c19dabc4a93c75b924a19474d59 ]
During ILA address translations, the L4 checksums can be handled in different ways. One of them, adj-transport, consist in parsing the transport layer and updating any found checksum. This logic relies on inet_proto_csum_replace_by_diff and produces an incorrect skb->csum when in state CHECKSUM_COMPLETE.
This bug can be reproduced with a simple ILA to SIR mapping, assuming packets are received with CHECKSUM_COMPLETE:
$ ip a show dev eth0
14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 62:ae:35:9e:0f:8d brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 3333:0:0:1::c078/64 scope global
valid_lft forever preferred_lft forever
inet6 fd00:10:244:1::c078/128 scope global nodad
valid_lft forever preferred_lft forever
inet6 fe80::60ae:35ff:fe9e:f8d/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
$ ip ila add loc_match fd00:10:244:1 loc 3333:0:0:1 \
csum-mode adj-transport ident-type luid dev eth0Then I hit [fd00:10:244:1::c078]:8000 with a server listening only on [3333:0:0:1::c078]:8000. With the bug, the SYN packet is dropped with SKB_DROP_REASON_TCP_CSUM after inet_proto_csum_replace_by_diff changed skb->csum. The translation and drop are visible on pwru [1] traces:
IFACE TUPLE FUNC eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) ipv6_rcv eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) ip6_rcv_core eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) nf_hook_slow eth0:9 [fd00:10:244:3::3d8]:51420->[fd00:10:244:1::c078]:8000(tcp) inet_proto_csum_replace_by_diff eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) tcp_v6_early_demux eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_route_input eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_input eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_input_finish eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ip6_protocol_deliver_rcu eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) raw6_local_deliver eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) ipv6_raw_deliver eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) tcp_v6_rcv eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) __skb_checksum_complete eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) kfree_skb_reason(SKB_DROP_REASON_TCP_CSUM) eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_release_head_state eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_release_data eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) skb_free_head eth0:9 [fd00:10:244:3::3d8]:51420->[3333:0:0:1::c078]:8000(tcp) kfree_skbmem
This is happening because inet_proto_csum_replace_by_diff is updating skb->csum when it shouldn't. The L4 checksum is updated such that it "cancels" the IPv6 address change in terms of checksum computation, so the impact on skb->csum is null.
Note this would be different for an IPv4 packet since three fields would be updated: the IPv4 address, the IP checksum, and the L4 checksum. Two would cancel each other and skb->csum would still need to be updated to take the L4 checksum change into account.
This patch fixes it by passing an ipv6 flag to inet_proto_csum_replace_by_diff, to skip the skb->csum update if we're in the IPv6 case. Note the behavior of the only other user of inet_proto_csum_replace_by_diff, the BPF subsystem, is left as is in this patch and fixed in the subsequent patch.
With the fix, using the reproduction from above, I can confirm skb->csum is not touched by inet_proto_csum_replace_by_diff and the TCP SYN proceeds to the application after the ILA translation.
--- include/net/checksum.h | 2 +- net/core/filter.c | 2 +- net/core/utils.c | 4 ++-- net/ipv6/ila/ila_common.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-)
include/net/checksum.h +1 -1
@@ -158,7 +158,7 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, const __be32 *from, const __be32 *to, bool pseudohdr);void inet_proto_csum_replace_by_diff (__sum16 *sum,struct sk_buff *skb, -__wsum diff,bool pseudohdr); +__wsum diff,bool pseudohdr,bool ipv6); static __always_inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
net/core/filter.c +1 -1
@@ -1999,7 +1999,7 @@ BPF_CALL_5(bpf_l4_csum_replace, struct sk_buff *, skb, u32, offset,if (unlikely (from !=0 ))return -EINVAL ; -inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo); +inet_proto_csum_replace_by_diff (ptr, skb, to, is_pseudo, false);break ;case 2 :inet_proto_csum_replace2 (ptr, skb, from, to, is_pseudo);
net/core/utils.c +2 -2
@@ -473,11 +473,11 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,EXPORT_SYMBOL (inet_proto_csum_replace16);void inet_proto_csum_replace_by_diff (__sum16 *sum,struct sk_buff *skb, -__wsum diff,bool pseudohdr) +__wsum diff,bool pseudohdr,bool ipv6) {if (skb->ip_summed !=CHECKSUM_PARTIAL ) {csum_replace_by_diff (sum, diff); -if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr) +if (skb->ip_summed ==CHECKSUM_COMPLETE && pseudohdr && !ipv6) skb->csum = ~csum_sub (diff, skb->csum); }else if (pseudohdr) { *sum = ~csum_fold (csum_add (diff,csum_unfold (*sum)));
net/ipv6/ila/ila_common.c +3 -3
@@ -86,7 +86,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&th->check, skb, - diff, true); + diff, true, true); }break ;case NEXTHDR_UDP :
@@ -97,7 +97,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb,if (uh->check || skb->ip_summed ==CHECKSUM_PARTIAL ) { diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&uh->check, skb, - diff, true); + diff, true, true);if (!uh->check) uh->check =CSUM_MANGLED_0 ; }
@@ -111,7 +111,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb, diff =get_csum_diff (ip6h, p);inet_proto_csum_replace_by_diff (&ih->icmp6_cksum, skb, - diff, true); + diff, true, true); }break ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 365/512 drm/i915/guc: Check if expecting reply before decrementing outstanding_submission_g2h
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesus Narvaez <[email protected]>
[ Upstream commit c557fd1050f6691dde36818dfc1a4c415c42901b ]
When sending a H2G message where a reply is expected in guc_submission_send_busy_loop(), outstanding_submission_g2h is incremented before the send. However, if there is an error sending the message, outstanding_submission_g2h is decremented without checking if a reply is expected.
Therefore, check if reply is expected when there is a failure before decrementing outstanding_submission_g2h.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -1
@@ -633,7 +633,7 @@ static int guc_submission_send_busy_loop(struct intel_guc *guc,atomic_inc (&guc->outstanding_submission_g2h); ret =intel_guc_send_busy_loop (guc, action, len, g2h_len_dw, loop); -if (ret) +if (ret && g2h_len_dw)atomic_dec (&guc->outstanding_submission_g2h);return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 366/512 drm/i915/psr: Fix using wrong mask in REG_FIELD_PREP
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jouni Högander <[email protected]>
[ Upstream commit 57d63c6cd0851d3af612a556ec61b0f2a9bd522f ]
Wrong mask is used in PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION and PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION.
--- drivers/gpu/drm/i915/display/intel_psr_regs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_psr_regs.h +2 -2
@@ -314,8 +314,8 @@#define PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION_MASK REG_GENMASK(20, 16)#define PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION (val) REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION_MASK, val)#define PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION_MASK REG_GENMASK(12, 8) -#define PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION (val) REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION_MASK, val) +#define PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION (val) REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_FIRST_LFPS_HALF_CYCLE_DURATION_MASK, val)#define PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION_MASK REG_GENMASK(4, 0) -#define PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION (val) REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_LFPS_HALF_CYCLE_DURATION_MASK, val) +#define PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION (val) REG_FIELD_PREP(PORT_ALPM_LFPS_CTL_LAST_LFPS_HALF_CYCLE_DURATION_MASK, val)#endif /* __INTEL_PSR_REGS_H__ */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 367/512 drm/i915/guc: Handle race condition where wakeref count drops below 0
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesus Narvaez <[email protected]>
[ Upstream commit 0323a5127e7c534cfc88efe0f850a0cb777e938b ]
There is a rare race condition when preparing for a reset where guc_lrc_desc_unpin() could be in the process of deregistering a context while a different thread is scrubbing outstanding contexts and it alters the context state and does a wakeref put. Then, if there is a failure with deregister_context(), a second wakeref put could occur. As a result the wakeref count could drop below 0 and fail an INTEL_WAKEREF_BUG_ON() check.
Therefore if there is a failure with deregister_context(), undo the context state changes and do a wakeref put only if the context was set to be destroyed earlier.
v2: Expand comment to better explain change. (Daniele)
v3: Removed addition to the original comment. (Daniele)
--- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +14 -3
@@ -3422,18 +3422,29 @@ static inline int guc_lrc_desc_unpin(struct intel_context *ce)* GuC is active, lets destroy this context, but at this point we can still be racing * with suspend, so we undo everything if the H2G fails in deregister_context so * that GuC reset will find this context during clean up. +* +* There is a race condition where the reset code could have altered +* this context's state and done a wakeref put before we try to +* deregister it here. So check if the context is still set to be +* destroyed before undoing earlier changes, to avoid two wakeref puts +* on the same context. */ ret =deregister_context (ce, ce->guc_id.id);if (ret) { +bool pending_destroyed;spin_lock_irqsave (&ce->guc_state.lock, flags); -set_context_registered (ce); -clr_context_destroyed (ce); + pending_destroyed =context_destroyed (ce); +if (pending_destroyed) { +set_context_registered (ce); +clr_context_destroyed (ce); + }spin_unlock_irqrestore (&ce->guc_state.lock, flags);/* * As gt-pm is awake at function entry, intel_wakeref_put_async merely decrements * the wakeref immediately but per function spec usage call this after unlock. */ -intel_wakeref_put_async (>->wakeref); +if (pending_destroyed) +intel_wakeref_put_async (>->wakeref); }return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 368/512 net: fix udp gso skb_segment after pull from frag_list
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiming Cheng <[email protected]>
[ Upstream commit 3382a1ed7f778db841063f5d7e317ac55f9e7f72 ]
Commit a1e40ac5b5e9 ("net: gso: fix udp gso fraglist segmentation after pull from frag_list") detected invalid geometry in frag_list skbs and redirects them from skb_segment_list to more robust skb_segment. But some packets with modified geometry can also hit bugs in that code. We don't know how many such cases exist. Addressing each one by one also requires touching the complex skb_segment code, which risks introducing bugs for other types of skbs. Instead, linearize all these packets that fail the basic invariants on gso fraglist skbs. That is more robust.
If only part of the fraglist payload is pulled into head_skb, it will always cause exception when splitting skbs by skb_segment. For detailed call stack information, see below.
Valid SKB_GSO_FRAGLIST skbs
- consist of two or more segments
- the head_skb holds the protocol headers plus first gso_size
- one or more frag_list skbs hold exactly one segment
- all but the last must be gso_size
Optional datapath hooks such as NAT and BPF (bpf_skb_pull_data) can modify fraglist skbs, breaking these invariants.
In extreme cases they pull one part of data into skb linear. For UDP, this causes three payloads with lengths of (11,11,10) bytes were pulled tail to become (12,10,10) bytes.
The skbs no longer meets the above SKB_GSO_FRAGLIST conditions because payload was pulled into head_skb, it needs to be linearized before pass to regular skb_segment.
skb_segment+0xcd0/0xd14
__udp_gso_segment+0x334/0x5f4
udp4_ufo_fragment+0x118/0x15c
inet_gso_segment+0x164/0x338
skb_mac_gso_segment+0xc4/0x13c
__skb_gso_segment+0xc4/0x124
validate_xmit_skb+0x9c/0x2c0
validate_xmit_skb_list+0x4c/0x80
sch_direct_xmit+0x70/0x404
__dev_queue_xmit+0x64c/0xe5c
neigh_resolve_output+0x178/0x1c4
ip_finish_output2+0x37c/0x47c
__ip_finish_output+0x194/0x240
ip_finish_output+0x20/0xf4
ip_output+0x100/0x1a0
NF_HOOK+0xc4/0x16c
ip_forward+0x314/0x32c
ip_rcv+0x90/0x118
__netif_receive_skb+0x74/0x124
process_backlog+0xe8/0x1a4
__napi_poll+0x5c/0x1f8
net_rx_action+0x154/0x314
handle_softirqs+0x154/0x4b8 [118.376811] [C201134] rxq0_pus: [name:bug&]kernel BUG at net/core/skbuff.c:4278!
[118.376829] [C201134] rxq0_pus: [name:traps&]Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
[118.470774] [C201134] rxq0_pus: [name:mrdump&]Kernel Offset: 0x178cc00000 from 0xffffffc008000000
[118.470810] [C201134] rxq0_pus: [name:mrdump&]PHYS_OFFSET: 0x40000000
[118.470827] [C201134] rxq0_pus: [name:mrdump&]pstate: 60400005 (nZCv daif +PAN -UAO)
[118.470848] [C201134] rxq0_pus: [name:mrdump&]pc : [0xffffffd79598aefc] skb_segment+0xcd0/0xd14
[118.470900] [C201134] rxq0_pus: [name:mrdump&]lr : [0xffffffd79598a5e8] skb_segment+0x3bc/0xd14
[118.470928] [C201134] rxq0_pus: [name:mrdump&]sp : ffffffc008013770--- net/ipv4/udp_offload.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv4/udp_offload.c +5 -0
@@ -332,6 +332,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,bool copy_dtor;__sum16 check;__be16 newlen; +int ret =0 ; mss =skb_shinfo (gso_skb)->gso_size;if (gso_skb->len <=sizeof (*uh) + mss)
@@ -360,6 +361,10 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,if (skb_pagelen (gso_skb) -sizeof (*uh) ==skb_shinfo (gso_skb)->gso_size)return __udp_gso_segment_list (gso_skb, features, is_ipv6); + ret =__skb_linearize (gso_skb); +if (ret) +return ERR_PTR (ret); +/* Setup csum, as fraglist skips this in udp4_gro_receive. */ gso_skb->csum_start =skb_transport_header (gso_skb) - gso_skb->head; gso_skb->csum_offset = offsetof(struct udphdr , check);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 369/512 net: wwan: t7xx: Fix napi rx poll issue
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjian Song <[email protected]>
[ Upstream commit 905fe0845bb27e4eed2ca27ea06e6c4847f1b2b1 ]
When driver handles the napi rx polling requests, the netdev might have been released by the dellink logic triggered by the disconnect operation on user plane. However, in the logic of processing skb in polling, an invalid netdev is still being used, which causes a panic.
BUG: kernel NULL pointer dereference, address: 00000000000000f1 Oops: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:dev_gro_receive+0x3a/0x620 [...] Call Trace: <IRQ> ? __die_body+0x68/0xb0 ? page_fault_oops+0x379/0x3e0 ? exc_page_fault+0x4f/0xa0 ? asm_exc_page_fault+0x22/0x30 ? __pfx_t7xx_ccmni_recv_skb+0x10/0x10 [mtk_t7xx (HASH:1400 7)] ? dev_gro_receive+0x3a/0x620 napi_gro_receive+0xad/0x170 t7xx_ccmni_recv_skb+0x48/0x70 [mtk_t7xx (HASH:1400 7)] t7xx_dpmaif_napi_rx_poll+0x590/0x800 [mtk_t7xx (HASH:1400 7)] net_rx_action+0x103/0x470 irq_exit_rcu+0x13a/0x310 sysvec_apic_timer_interrupt+0x56/0x90 </IRQ>
--- drivers/net/wwan/t7xx/t7xx_netdev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/wwan/t7xx/t7xx_netdev.c +6 -5
@@ -302,7 +302,7 @@ static int t7xx_ccmni_wwan_newlink(void *ctxt, struct net_device *dev, u32 if_id ccmni->ctlb = ctlb; ccmni->dev = dev;atomic_set (&ccmni->usage,0 ); - ctlb->ccmni_inst[if_id] = ccmni; +WRITE_ONCE (ctlb->ccmni_inst[if_id], ccmni); ret =register_netdevice (dev);if (ret)
@@ -324,6 +324,7 @@ static void t7xx_ccmni_wwan_dellink(void *ctxt, struct net_device *dev, struct lif (WARN_ON (ctlb->ccmni_inst[if_id] != ccmni))return ; +WRITE_ONCE (ctlb->ccmni_inst[if_id],NULL );unregister_netdevice (dev); }
@@ -419,7 +420,7 @@ static void t7xx_ccmni_recv_skb(struct t7xx_ccmni_ctrl *ccmni_ctlb, struct sk_bu skb_cb =T7XX_SKB_CB (skb); netif_id = skb_cb->netif_idx; - ccmni = ccmni_ctlb->ccmni_inst[netif_id]; + ccmni =READ_ONCE (ccmni_ctlb->ccmni_inst[netif_id]);if (!ccmni) {dev_kfree_skb (skb);return ;
@@ -441,7 +442,7 @@ static void t7xx_ccmni_recv_skb(struct t7xx_ccmni_ctrl *ccmni_ctlb, struct sk_bustatic void t7xx_ccmni_queue_tx_irq_notify (struct t7xx_ccmni_ctrl *ctlb,int qno) { -struct t7xx_ccmni *ccmni = ctlb->ccmni_inst[0 ]; +struct t7xx_ccmni *ccmni =READ_ONCE (ctlb->ccmni_inst[0 ]);struct netdev_queue *net_queue;if (netif_running (ccmni->dev) &&atomic_read (&ccmni->usage) >0 ) {
@@ -453,7 +454,7 @@ static void t7xx_ccmni_queue_tx_irq_notify(struct t7xx_ccmni_ctrl *ctlb, int qnostatic void t7xx_ccmni_queue_tx_full_notify (struct t7xx_ccmni_ctrl *ctlb,int qno) { -struct t7xx_ccmni *ccmni = ctlb->ccmni_inst[0 ]; +struct t7xx_ccmni *ccmni =READ_ONCE (ctlb->ccmni_inst[0 ]);struct netdev_queue *net_queue;if (atomic_read (&ccmni->usage) >0 ) {
@@ -471,7 +472,7 @@ static void t7xx_ccmni_queue_state_notify(struct t7xx_pci_dev *t7xx_dev,if (ctlb->md_sta !=MD_STATE_READY )return ; -if (!ctlb->ccmni_inst[0 ]) { +if (!READ_ONCE (ctlb->ccmni_inst[0 ])) {dev_warn (&t7xx_dev->pdev->dev,"No netdev registered yet\n" );return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 370/512 vmxnet3: correctly report gso type for UDP tunnels
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronak Doshi <[email protected]>
[ Upstream commit 982d30c30eaa2ec723df42e3bf526c014c1dbb88 ]
Commit 3d010c8031e3 ("udp: do not accept non-tunnel GSO skbs landing in a tunnel") added checks in linux stack to not accept non-tunnel GRO packets landing in a tunnel. This exposed an issue in vmxnet3 which was not correctly reporting GRO packets for tunnel packets.
This patch fixes this issue by setting correct GSO type for the tunnel packets.
Currently, vmxnet3 does not support reporting inner fields for LRO tunnel packets. The issue is not seen for egress drivers that do not use skb inner fields. The workaround is to enable tnl-segmentation offload on the egress interfaces if the driver supports it. This problem pre-exists this patch fix and can be addressed as a separate future patch.
--- drivers/net/vmxnet3/vmxnet3_drv.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/net/vmxnet3/vmxnet3_drv.c +26 -0
@@ -1560,6 +1560,30 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb,return (hlen + (hdr.tcp->doff <<2 )); } +static void +vmxnet3_lro_tunnel (struct sk_buff *skb,__be16 ip_proto) +{ +struct udphdr *uh =NULL ; + +if (ip_proto ==htons (ETH_P_IP )) { +struct iphdr *iph = (struct iphdr *)skb->data; + +if (iph->protocol ==IPPROTO_UDP ) + uh = (struct udphdr *)(iph +1 ); + }else { +struct ipv6hdr *iph = (struct ipv6hdr *)skb->data; + +if (iph->nexthdr ==IPPROTO_UDP ) + uh = (struct udphdr *)(iph +1 ); + } +if (uh) { +if (uh->check) +skb_shinfo (skb)->gso_type |=SKB_GSO_UDP_TUNNEL_CSUM ; +else +skb_shinfo (skb)->gso_type |=SKB_GSO_UDP_TUNNEL ; + } +} +static int vmxnet3_rq_rx_complete (struct vmxnet3_rx_queue *rq,struct vmxnet3_adapter *adapter,int quota)
@@ -1873,6 +1897,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,if (segCnt !=0 && mss !=0 ) {skb_shinfo (skb)->gso_type = rcd->v4 ?SKB_GSO_TCPV4 :SKB_GSO_TCPV6 ; +if (encap_lro) +vmxnet3_lro_tunnel (skb, skb->protocol);skb_shinfo (skb)->gso_size = mss;skb_shinfo (skb)->gso_segs = segCnt; }else if ((segCnt !=0 || skb->len > mtu) && !encap_lro) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 371/512 selftests: net: build net/lib dependency in all target
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bui Quang Minh <[email protected]>
[ Upstream commit d3f2a9587ebe68f5067f9ff624f9a83dfb911f60 ]
We have the logic to include net/lib automatically for net related selftests. However, currently, this logic is only in install target which means only make install will have net/lib included. This commit adds the logic to all target so that all make, make run_tests and make install will have net/lib included in net related selftests.
--- tools/testing/selftests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/Makefile +1 -1
@@ -196,7 +196,7 @@ export KHDR_INCLUDES all: @ret=1; \ - for TARGET in $(TARGETS); do \ + for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ mkdir $$BUILD_TARGET -p; \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 372/512 PM: sleep: Fix power.is_suspended cleanup for direct-complete devices
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit d46c4c839c20a599a0eb8d73708ce401f9c7d06d ]
Commit 03f1444016b7 ("PM: sleep: Fix handling devices with direct_complete set on errors") caused power.is_suspended to be set for devices with power.direct_complete set, but it forgot to ensure the clearing of that flag for them in device_resume(), so power.is_suspended is still set for them during the next system suspend-resume cycle.
If that cycle is aborted in dpm_suspend(), the subsequent invocation of dpm_resume() will trigger a device_resume() call for every device and because power.is_suspended is set for the devices in question, they will not be skipped by device_resume() as expected which causes scary error messages to be logged (as appropriate).
To address this issue, move the clearing of power.is_suspended in device_resume() immediately after the power.is_suspended check so it will be always cleared for all devices processed by that function.
--- drivers/base/power/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/power/main.c +2 -1
@@ -916,6 +916,8 @@ static void device_resume(struct device *dev, pm_message_t state, bool async)if (!dev->power.is_suspended) goto Complete; + dev->power.is_suspended = false; +if (dev->power.direct_complete) {/* Match the pm_runtime_disable() in __device_suspend(). */ pm_runtime_enable (dev);
@@ -971,7 +973,6 @@ static void device_resume(struct device *dev, pm_message_t state, bool async) End: error =dpm_run_callback (callback, dev, state, info); - dev->power.is_suspended = false;device_unlock (dev);dpm_watchdog_clear (&wd);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 373/512 nvme: fix command limits status code
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 10f4a7cd724e34b7a6ff96e57ac49dc0cadececc ]
The command specific status code, 0x183, was introduced in the NVMe 2.0 specification defined to "Command Size Limits Exceeded" and only ever applied to DSM and Copy commands. Fix the name and, remove the incorrect translation to error codes and special treatment in the target code for it.
--- drivers/nvme/host/constants.c | 2 +- drivers/nvme/host/core.c | 1 - drivers/nvme/host/pr.c | 2 -- drivers/nvme/target/core.c | 9 +-------- drivers/nvme/target/io-cmd-bdev.c | 9 +-------- include/linux/nvme.h | 2 +- 6 files changed, 4 insertions(+), 21 deletions(-)
drivers/nvme/host/constants.c +1 -1
@@ -145,7 +145,7 @@ static const char * const nvme_statuses[] = { [NVME_SC_BAD_ATTRIBUTES] = "Conflicting Attributes", [NVME_SC_INVALID_PI] = "Invalid Protection Information", [NVME_SC_READ_ONLY] = "Attempted Write to Read Only Range", - [NVME_SC_ONCS_NOT_SUPPORTED] = "ONCS Not Supported", + [NVME_SC_CMD_SIZE_LIM_EXCEEDED ] = "Command Size Limits Exceeded", [NVME_SC_ZONE_BOUNDARY_ERROR] = "Zoned Boundary Error", [NVME_SC_ZONE_FULL] = "Zone Is Full", [NVME_SC_ZONE_READ_ONLY] = "Zone Is Read Only",
drivers/nvme/host/core.c +0 -1
@@ -284,7 +284,6 @@ static blk_status_t nvme_error_status(u16 status)case NVME_SC_NS_NOT_READY :return BLK_STS_TARGET ;case NVME_SC_BAD_ATTRIBUTES : -case NVME_SC_ONCS_NOT_SUPPORTED :case NVME_SC_INVALID_OPCODE :case NVME_SC_INVALID_FIELD :case NVME_SC_INVALID_NS :
drivers/nvme/host/pr.c +0 -2
@@ -82,8 +82,6 @@ static int nvme_status_to_pr_err(int status)return PR_STS_SUCCESS ;case NVME_SC_RESERVATION_CONFLICT :return PR_STS_RESERVATION_CONFLICT ; -case NVME_SC_ONCS_NOT_SUPPORTED : -return -EOPNOTSUPP ;case NVME_SC_BAD_ATTRIBUTES :case NVME_SC_INVALID_OPCODE :case NVME_SC_INVALID_FIELD :
drivers/nvme/target/core.c +1 -8
@@ -62,14 +62,7 @@ inline u16 errno_to_nvme_status(struct nvmet_req *req, int errno)return NVME_SC_LBA_RANGE |NVME_STATUS_DNR ;case -EOPNOTSUPP : req->error_loc = offsetof(struct nvme_common_command , opcode); -switch (req->cmd->common.opcode) { -case nvme_cmd_dsm: -case nvme_cmd_write_zeroes: -return NVME_SC_ONCS_NOT_SUPPORTED |NVME_STATUS_DNR ; -default : -return NVME_SC_INVALID_OPCODE |NVME_STATUS_DNR ; - } -break ; +return NVME_SC_INVALID_OPCODE |NVME_STATUS_DNR ;case -ENODATA : req->error_loc = offsetof(struct nvme_rw_command , nsid);return NVME_SC_ACCESS_DENIED ;
drivers/nvme/target/io-cmd-bdev.c +1 -8
@@ -145,15 +145,8 @@ u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts) req->error_loc = offsetof(struct nvme_rw_command , slba);break ;case BLK_STS_NOTSUPP : + status =NVME_SC_INVALID_OPCODE |NVME_STATUS_DNR ; req->error_loc = offsetof(struct nvme_common_command , opcode); -switch (req->cmd->common.opcode) { -case nvme_cmd_dsm: -case nvme_cmd_write_zeroes: - status =NVME_SC_ONCS_NOT_SUPPORTED |NVME_STATUS_DNR ; -break ; -default : - status =NVME_SC_INVALID_OPCODE |NVME_STATUS_DNR ; - }break ;case BLK_STS_MEDIUM : status =NVME_SC_ACCESS_DENIED ;
include/linux/nvme.h +1 -1
@@ -1954,7 +1954,7 @@ enum {NVME_SC_BAD_ATTRIBUTES =0x180 ,NVME_SC_INVALID_PI =0x181 ,NVME_SC_READ_ONLY =0x182 , - NVME_SC_ONCS_NOT_SUPPORTED = 0x183, + NVME_SC_CMD_SIZE_LIM_EXCEEDED = 0x183,/* * I/O Command Set Specific - Fabrics commands:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 374/512 gve: add missing NULL check for gve_alloc_pending_packet() in TX DQO
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit 12c331b29c7397ac3b03584e12902990693bc248 ]
gve_alloc_pending_packet() can return NULL, but gve_tx_add_skb_dqo() did not check for this case before dereferencing the returned pointer.
Add a missing NULL check to prevent a potential NULL pointer dereference when allocation fails.
This improves robustness in low-memory scenarios.
--- drivers/net/ethernet/google/gve/gve_tx_dqo.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/google/gve/gve_tx_dqo.c +3 -0
@@ -770,6 +770,9 @@ static int gve_tx_add_skb_dqo(struct gve_tx_ring *tx,s16 completion_tag; pkt =gve_alloc_pending_packet (tx); +if (!pkt) +return -ENOMEM ; + pkt->skb = skb; completion_tag = pkt - tx->dqo.pending_packets;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 375/512 drm/panel-simple: fix the warnings for the Evervision VGG644804
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Walle <[email protected]>
[ Upstream commit 5dc1ea903588a73fb03b3a3e5a041a7c63a4bccd ]
The panel lacked the connector type which causes a warning. Adding the connector type reveals wrong bus_flags and bits per pixel. Fix all of it.
--- drivers/gpu/drm/panel/panel-simple.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-simple.c +3 -2
@@ -2141,13 +2141,14 @@ static const struct display_timing evervision_vgg644804_timing = {static const struct panel_desc evervision_vgg644804 = { .timings = &evervision_vgg644804_timing, .num_timings =1 , - .bpc =8 , + .bpc =6 , .size = { .width =115 , .height =86 , }, .bus_format =MEDIA_BUS_FMT_RGB666_1X7X3_SPWG , - .bus_flags =DRM_BUS_FLAG_DE_HIGH |DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE , + .bus_flags =DRM_BUS_FLAG_DE_HIGH , + .connector_type =DRM_MODE_CONNECTOR_LVDS , };static const struct display_timing evervision_vgg804821_timing = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 376/512 netfilter: nf_set_pipapo_avx2: fix initial map fill
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit ea77c397bff8b6d59f6d83dae1425b08f465e8b5 ]
If the first field doesn't cover the entire start map, then we must zero out the remainder, else we leak those bits into the next match round map.
The early fix was incomplete and did only fix up the generic C implementation.
A followup patch adds a test case to nft_concat_range.sh.
--- net/netfilter/nft_set_pipapo_avx2.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
net/netfilter/nft_set_pipapo_avx2.c +20 -1
@@ -1113,6 +1113,25 @@ bool nft_pipapo_avx2_estimate(const struct nft_set_desc *desc, u32 features,return true; } +/** +* pipapo_resmap_init_avx2() - Initialise result map before first use +* @m: Matching data, including mapping table +* @res_map: Result map +* +* Like pipapo_resmap_init() but do not set start map bits covered by the first field. +*/ +static inline void pipapo_resmap_init_avx2 (const struct nft_pipapo_match *m,unsigned long *res_map) +{ +const struct nft_pipapo_field *f = m->f; +int i; + +/* Starting map doesn't need to be set to all-ones for this implementation, +* but we do need to zero the remaining bits, if any. +*/ +for (i = f->bsize; i < m->bsize_max; i++) + res_map[i] =0ul ; +} +/** * nft_pipapo_avx2_lookup() - Lookup function for AVX2 implementation * @net: Network namespace
@@ -1171,7 +1190,7 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, res = scratch->map + (map_index ? m->bsize_max :0 ); fill = scratch->map + (map_index ?0 : m->bsize_max); -/* Starting map doesn't need to be set for this implementation */ +pipapo_resmap_init_avx2 (m, res);nft_pipapo_avx2_prepare ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 377/512 netfilter: nf_nat: also check reverse tuple to obtain clashing entry
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 50d9ce9679dd50df2dc51ada717fa875bc248fad ]
The logic added in the blamed commit was supposed to only omit nat source port allocation if neither the existing nor the new entry are subject to NAT.
However, its not enough to lookup the conntrack based on the proposed tuple, we must also check the reverse direction.
Otherwise there are esoteric cases where the collision is in the reverse direction because that colliding connection has a port rewrite, but the new entry doesn't. In this case, we only check the new entry and then erronously conclude that no clash exists anymore.
The existing (udp) tuple is:
a:p -> b:P, with nat translation to s:P, i.e. pure daddr rewrite, reverse tuple in conntrack table is s:P -> a:p.
When another UDP packet is sent directly to s, i.e. a:p->s:P, this is correctly detected as a colliding entry: tuple is taken by existing reply tuple in reverse direction.
But the colliding conntrack is only searched for with unreversed direction, and we can't find such entry matching a:p->s:P.
The incorrect conclusion is that the clashing entry has timed out and that no port address translation is required.
Such conntrack will then be discarded at nf_confirm time because the proposed reverse direction clashes with an existing mapping in the conntrack table.
Search for the reverse tuple too, this will then check the NAT bits of the colliding entry and triggers port reallocation.
Followp patch extends nft_nat.sh selftest to cover this scenario.
The IPS_SEQ_ADJUST change is also a bug fix:
Instead of checking for SEQ_ADJ this tested for SEEN_REPLY and ASSURED by accident -- _BIT is only for use with the test_bit() API.
This bug has little consequence in practice, because the sequence number adjustments are only useful for TCP which doesn't support clash resolution.
The existing test case (conntrack_reverse_clash.sh) exercise a race condition path (parallel conntrack creation on different CPUs), so the colliding entries have neither SEEN_REPLY nor ASSURED set.
Thanks to Yafang Shao and Shaun Brady for an initial investigation of this bug.
--- net/netfilter/nf_nat_core.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/netfilter/nf_nat_core.c +9 -3
@@ -248,7 +248,7 @@ static noinline bool nf_nat_used_tuple_new(const struct nf_conntrack_tuple *tuple, const struct nf_conn *ignored_ct) { -static const unsigned long uses_nat =IPS_NAT_MASK |IPS_SEQ_ADJUST_BIT ; +static const unsigned long uses_nat =IPS_NAT_MASK |IPS_SEQ_ADJUST ;const struct nf_conntrack_tuple_hash *thash;const struct nf_conntrack_zone *zone;struct nf_conn *ct;
@@ -287,8 +287,14 @@ nf_nat_used_tuple_new(const struct nf_conntrack_tuple *tuple, zone =nf_ct_zone (ignored_ct); thash =nf_conntrack_find_get (net, zone, tuple); -if (unlikely (!thash))/* clashing entry went away */ -return false; +if (unlikely (!thash)) { +struct nf_conntrack_tuple reply; + +nf_ct_invert_tuple (&reply, tuple); + thash =nf_conntrack_find_get (net, zone, &reply); +if (!thash)/* clashing entry went away */ +return false; + } ct =nf_ct_tuplehash_to_ctrack (thash);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 378/512 net: ti: icssg-prueth: Fix swapped TX stats for MII interfaces.
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meghana Malladi <[email protected]>
[ Upstream commit 919d763d609428c2680ec8159257d9655f002f89 ]
In MII mode, Tx lines are swapped for port0 and port1, which means Tx port0 receives data from PRU1 and the Tx port1 receives data from PRU0. This is an expected hardware behavior and reading the Tx stats needs to be handled accordingly in the driver. Update the driver to read Tx stats from the PRU1 for port0 and PRU0 for port1.
--- drivers/net/ethernet/ti/icssg/icssg_stats.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/ti/icssg/icssg_stats.c +8 -0
@@ -29,6 +29,14 @@ void emac_update_hardware_stats(struct prueth_emac *emac)spin_lock (&prueth->stats_lock);for (i =0 ; i <ARRAY_SIZE (icssg_all_miig_stats); i++) { +/* In MII mode TX lines are swapped inside ICSSG, so read Tx stats +* from slice1 for port0 and slice0 for port1 to get accurate Tx +* stats for a given port +*/ +if (emac->phy_if ==PHY_INTERFACE_MODE_MII && + icssg_all_miig_stats[i].offset >=ICSSG_TX_PACKET_OFFSET && + icssg_all_miig_stats[i].offset <=ICSSG_TX_BYTE_OFFSET ) + base = stats_base[slice ^1 ];regmap_read (prueth->miig_rt, base + icssg_all_miig_stats[i].offset, &val);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 379/512 net: dsa: b53: do not enable RGMII delay on bcm63xx
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 4af523551d876ab8b8057d1e5303a860fd736fcb ]
bcm63xx's RGMII ports are always in MAC mode, never in PHY mode, so we shouldn't enable any delays and let the PHY handle any delays as necessary.
This fixes using RGMII ports with normal PHYs like BCM54612E, which will handle the delay in the PHY.
--- drivers/net/dsa/b53/b53_common.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
drivers/net/dsa/b53/b53_common.c +1 -18
@@ -1326,24 +1326,7 @@ static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port, off =B53_RGMII_CTRL_P (port);b53_read8 (dev,B53_CTRL_PAGE , off, &rgmii_ctrl); - -switch (interface) { -case PHY_INTERFACE_MODE_RGMII_ID : - rgmii_ctrl |= (RGMII_CTRL_DLL_RXC |RGMII_CTRL_DLL_TXC ); -break ; -case PHY_INTERFACE_MODE_RGMII_RXID : - rgmii_ctrl &= ~(RGMII_CTRL_DLL_TXC ); - rgmii_ctrl |=RGMII_CTRL_DLL_RXC ; -break ; -case PHY_INTERFACE_MODE_RGMII_TXID : - rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC ); - rgmii_ctrl |=RGMII_CTRL_DLL_TXC ; -break ; -case PHY_INTERFACE_MODE_RGMII : -default : - rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC |RGMII_CTRL_DLL_TXC ); -break ; - } + rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC |RGMII_CTRL_DLL_TXC );if (port != dev->imp_port) {if (is63268 (dev))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 380/512 net: dsa: b53: allow RGMII for bcm63xx RGMII ports
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 5ea0d42c1980e6d10e5cb56a78021db5bfcebaaf ]
Add RGMII to supported interfaces for BCM63xx RGMII ports so they can be actually used in RGMII mode.
Without this, phylink will fail to configure them:
[ 3.580000] b53-switch 10700000.switch GbE3 (uninitialized): validation of rgmii with support 0000000,00000000,00000000,000062ff and advertisement 0000000,00000000,00000000,000062ff failed: -EINVAL [ 3.600000] b53-switch 10700000.switch GbE3 (uninitialized): failed to connect to PHY: -EINVAL [ 3.610000] b53-switch 10700000.switch GbE3 (uninitialized): error -22 setting up PHY for tree 0, switch 0, port 4
--- drivers/net/dsa/b53/b53_common.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/dsa/b53/b53_common.c +4 -0
@@ -1441,6 +1441,10 @@ static void b53_phylink_get_caps(struct dsa_switch *ds, int port,__set_bit (PHY_INTERFACE_MODE_MII , config->supported_interfaces);__set_bit (PHY_INTERFACE_MODE_REVMII , config->supported_interfaces); +/* BCM63xx RGMII ports support RGMII */ +if (is63xx (dev) &&in_range (port,B53_63XX_RGMII0 ,4 )) +phy_interface_set_rgmii (config->supported_interfaces); + config->mac_capabilities =MAC_ASYM_PAUSE |MAC_SYM_PAUSE |MAC_10 |MAC_100 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 381/512 net: dsa: b53: do not touch DLL_IQQD on bcm53115
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit bc1a65eb81a21e2aa3c3dca058ee8adf687b6ef5 ]
According to OpenMDK, bit 2 of the RGMII register has a different meaning for BCM53115 [1]:
"DLL_IQQD 1: In the IDDQ mode, power is down0: Normal function
mode"
Configuring RGMII delay works without setting this bit, so let's keep it at the default. For other chips, we always set it, so not clearing it is not an issue.
One would assume BCM53118 works the same, but OpenMDK is not quite sure what this bit actually means [2]:
"BYPASS_IMP_2NS_DEL #1: In the IDDQ mode, power is down#0: Normal
function mode1: Bypass dll65_2ns_del IP0: Use dll65_2ns_del IP"
So lets keep setting it for now.
[1] https://github.com/Broadcom-Network-Switching-Software/OpenMDK/blob/master/cdk/PKG/chip/bcm53115/bcm53115_a0_defs.h#L19871
[2] https://github.com/Broadcom-Network-Switching-Software/OpenMDK/blob/master/cdk/PKG/chip/bcm53118/bcm53118_a0_defs.h#L14392
--- drivers/net/dsa/b53/b53_common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/dsa/b53/b53_common.c +5 -3
@@ -1356,8 +1356,7 @@ static void b53_adjust_531x5_rgmii(struct dsa_switch *ds, int port,* tx_clk aligned timing (restoring to reset defaults) */ b53_read8 (dev,B53_CTRL_PAGE , off, &rgmii_ctrl); - rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC |RGMII_CTRL_DLL_TXC | -RGMII_CTRL_TIMING_SEL ); + rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC |RGMII_CTRL_DLL_TXC );/* PHY_INTERFACE_MODE_RGMII_TXID means TX internal delay, make * sure that we enable the port TX clock internal delay to
@@ -1377,7 +1376,10 @@ static void b53_adjust_531x5_rgmii(struct dsa_switch *ds, int port, rgmii_ctrl |=RGMII_CTRL_DLL_TXC ;if (interface ==PHY_INTERFACE_MODE_RGMII ) rgmii_ctrl |=RGMII_CTRL_DLL_TXC |RGMII_CTRL_DLL_RXC ; - rgmii_ctrl |=RGMII_CTRL_TIMING_SEL ; + +if (dev->chip_id !=BCM53115_DEVICE_ID ) + rgmii_ctrl |=RGMII_CTRL_TIMING_SEL ; +b53_write8 (dev,B53_CTRL_PAGE , off, rgmii_ctrl); dev_info(ds->dev, "Configured port %d for %s\n", port,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 382/512 wifi: cfg80211/mac80211: correctly parse S1G beacon optional elements
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lachlan Hodges <[email protected]>
[ Upstream commit 1e1f706fc2ce90eaaf3480b3d5f27885960d751c ]
S1G beacons are not traditional beacons but a type of extension frame. Extension frames contain the frame control and duration fields, followed by zero or more optional fields before the frame body. These optional fields are distinct from the variable length elements.
The presence of optional fields is indicated in the frame control field. To correctly locate the elements offset, the frame control must be parsed to identify which optional fields are present. Currently, mac80211 parses S1G beacons based on fixed assumptions about the frame layout, without inspecting the frame control field. This can result in incorrect offsets to the "variable" portion of the frame.
Properly parse S1G beacon frames by using the field lengths defined in IEEE 802.11-2024, section 9.3.4.3, ensuring that the elements offset is calculated accurately.
--- include/linux/ieee80211.h | 79 ++++++++++++++++++++++++++++++++++----- net/mac80211/mlme.c | 7 +--- net/mac80211/scan.c | 11 +++--- net/wireless/scan.c | 18 ++++----- 4 files changed, 83 insertions(+), 32 deletions(-)
include/linux/ieee80211.h +69 -10
@@ -111,6 +111,8 @@/* bits unique to S1G beacon */ #define IEEE80211_S1G_BCN_NEXT_TBTT 0x100 +#define IEEE80211_S1G_BCN_CSSID 0x200 +#define IEEE80211_S1G_BCN_ANO 0x400/* see 802.11ah-2016 9.9 NDP CMAC frames */ #define IEEE80211_S1G_1MHZ_NDP_BITS 25
@@ -153,9 +155,6 @@#define IEEE80211_ANO_NETTYPE_WILD 15 -/* bits unique to S1G beacon */ -#define IEEE80211_S1G_BCN_NEXT_TBTT 0x100 -/* control extension - for IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTL_EXT */ #define IEEE80211_CTL_EXT_POLL 0x2000#define IEEE80211_CTL_EXT_SPR 0x3000
@@ -627,6 +626,42 @@ static inline bool ieee80211_is_s1g_beacon(__le16 fc)cpu_to_le16 (IEEE80211_FTYPE_EXT |IEEE80211_STYPE_S1G_BEACON ); } +/** +* ieee80211_s1g_has_next_tbtt - check if IEEE80211_S1G_BCN_NEXT_TBTT +* @fc: frame control bytes in little-endian byteorder +* Return: whether or not the frame contains the variable-length +* next TBTT field +*/ +static inline bool ieee80211_s1g_has_next_tbtt (__le16 fc) +{ +return ieee80211_is_s1g_beacon (fc) && + (fc &cpu_to_le16 (IEEE80211_S1G_BCN_NEXT_TBTT )); +} + +/** +* ieee80211_s1g_has_ano - check if IEEE80211_S1G_BCN_ANO +* @fc: frame control bytes in little-endian byteorder +* Return: whether or not the frame contains the variable-length +* ANO field +*/ +static inline bool ieee80211_s1g_has_ano (__le16 fc) +{ +return ieee80211_is_s1g_beacon (fc) && + (fc &cpu_to_le16 (IEEE80211_S1G_BCN_ANO )); +} + +/** +* ieee80211_s1g_has_cssid - check if IEEE80211_S1G_BCN_CSSID +* @fc: frame control bytes in little-endian byteorder +* Return: whether or not the frame contains the variable-length +* compressed SSID field +*/ +static inline bool ieee80211_s1g_has_cssid (__le16 fc) +{ +return ieee80211_is_s1g_beacon (fc) && + (fc &cpu_to_le16 (IEEE80211_S1G_BCN_CSSID )); +} +/** * ieee80211_is_s1g_short_beacon - check if frame is an S1G short beacon * @fc: frame control bytes in little-endian byteorder
@@ -1245,16 +1280,40 @@ struct ieee80211_ext {u8 change_seq;u8 variable[0 ]; }__packed s1g_beacon; -struct { -u8 sa[ETH_ALEN ]; -__le32 timestamp; -u8 change_seq; -u8 next_tbtt[3 ]; -u8 variable[0 ]; - } __packed s1g_short_beacon; } u; } __packed__aligned(2) ; +/** +* ieee80211_s1g_optional_len - determine length of optional S1G beacon fields +* @fc: frame control bytes in little-endian byteorder +* Return: total length in bytes of the optional fixed-length fields +* +* S1G beacons may contain up to three optional fixed-length fields that +* precede the variable-length elements. Whether these fields are present +* is indicated by flags in the frame control field. +* +* From IEEE 802.11-2024 section 9.3.4.3: +* - Next TBTT field may be 0 or 3 bytes +* - Short SSID field may be 0 or 4 bytes +* - Access Network Options (ANO) field may be 0 or 1 byte +*/ +static inline size_t +ieee80211_s1g_optional_len (__le16 fc) +{ +size_t len =0 ; + +if (ieee80211_s1g_has_next_tbtt (fc)) + len +=3 ; + +if (ieee80211_s1g_has_cssid (fc)) + len +=4 ; + +if (ieee80211_s1g_has_ano (fc)) + len +=1 ; + +return len; +} +#define IEEE80211_TWT_CONTROL_NDP BIT(0)#define IEEE80211_TWT_CONTROL_RESP_MODE BIT(1)#define IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST BIT(3)
net/mac80211/mlme.c +2 -5
@@ -6728,11 +6728,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, bssid =ieee80211_get_bssid (hdr, len, sdata->vif.type);if (ieee80211_is_s1g_beacon (mgmt->frame_control)) {struct ieee80211_ext *ext = (void *) mgmt; - -if (ieee80211_is_s1g_short_beacon (ext->frame_control)) - variable = ext->u.s1g_short_beacon.variable; -else - variable = ext->u.s1g_beacon.variable; + variable = ext->u.s1g_beacon.variable + +ieee80211_s1g_optional_len (ext->frame_control); } baselen = (u8 *) variable - (u8 *) mgmt;
net/mac80211/scan.c +5 -6
@@ -260,6 +260,7 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)struct ieee80211_mgmt *mgmt = (void *)skb->data;struct ieee80211_bss *bss;struct ieee80211_channel *channel; +struct ieee80211_ext *ext;size_t min_hdr_len = offsetof(struct ieee80211_mgmt , u.probe_resp.variable);
@@ -269,12 +270,10 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)return ;if (ieee80211_is_s1g_beacon (mgmt->frame_control)) { -if (ieee80211_is_s1g_short_beacon (mgmt->frame_control)) - min_hdr_len = offsetof(struct ieee80211_ext , - u.s1g_short_beacon.variable); -else - min_hdr_len = offsetof(struct ieee80211_ext , - u.s1g_beacon); + ext = (struct ieee80211_ext *)mgmt; + min_hdr_len = + offsetof(struct ieee80211_ext, u.s1g_beacon.variable) + +ieee80211_s1g_optional_len (ext->frame_control); }if (skb->len < min_hdr_len)
net/wireless/scan.c +7 -11
@@ -3213,6 +3213,7 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,const u8 *ie;size_t ielen;u64 tsf; +size_t s1g_optional_len;if (WARN_ON (!mgmt))return NULL ;
@@ -3227,12 +3228,11 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,if (ieee80211_is_s1g_beacon (mgmt->frame_control)) { ext = (void *) mgmt; -if (ieee80211_is_s1g_short_beacon (mgmt->frame_control)) - min_hdr_len = offsetof(struct ieee80211_ext , - u.s1g_short_beacon.variable); -else - min_hdr_len = offsetof(struct ieee80211_ext , - u.s1g_beacon.variable); + s1g_optional_len = +ieee80211_s1g_optional_len (ext->frame_control); + min_hdr_len = + offsetof(struct ieee80211_ext, u.s1g_beacon.variable) + + s1g_optional_len; }else {/* same for beacons */ min_hdr_len = offsetof(struct ieee80211_mgmt,
@@ -3248,11 +3248,7 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy,const struct ieee80211_s1g_bcn_compat_ie *compat;const struct element *elem; -if (ieee80211_is_s1g_short_beacon (mgmt->frame_control)) - ie = ext->u.s1g_short_beacon.variable; -else - ie = ext->u.s1g_beacon.variable; - + ie = ext->u.s1g_beacon.variable + s1g_optional_len; elem =cfg80211_find_elem (WLAN_EID_S1G_BCN_COMPAT , ie, ielen);if (!elem)return NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 383/512 net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Palmas <[email protected]>
[ Upstream commit 501fe52aa908c96f2c9b8d54767938a1a5960354 ]
Recent Qualcomm chipsets like SDX72/75 require MBIM sessionId mapping to muxId in the range (0x70-0x8F) for the PCIe tethered use.
This has been partially addressed by the referenced commit, mapping the default data call to muxId = 112, but the multiplexed data calls scenario was not properly considered, mapping sessionId = 1 to muxId 1, while it should have been 113.
Fix this by moving the session_id assignment logic to mhi_mbim_newlink, in order to map sessionId = n to muxId = n + WDS_BIND_MUX_DATA_PORT_MUX_ID.
--- drivers/net/wwan/mhi_wwan_mbim.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/wwan/mhi_wwan_mbim.c +3 -6
@@ -550,8 +550,8 @@ static int mhi_mbim_newlink(void *ctxt, struct net_device *ndev, u32 if_id,struct mhi_mbim_link *link =wwan_netdev_drvpriv (ndev);struct mhi_mbim_context *mbim = ctxt; - link->session = if_id; link->mbim = mbim; + link->session =mhi_mbim_get_link_mux_id (link->mbim->mdev->mhi_cntrl) + if_id; link->ndev = ndev;u64_stats_init (&link->rx_syncp);u64_stats_init (&link->tx_syncp);
@@ -607,7 +607,7 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id {struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;struct mhi_mbim_context *mbim; -int err, link_id; +int err; mbim =devm_kzalloc (&mhi_dev->dev,sizeof (*mbim),GFP_KERNEL );if (!mbim)
@@ -628,11 +628,8 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id/* Number of transfer descriptors determines size of the queue */ mbim->rx_queue_sz =mhi_get_free_desc_count (mhi_dev,DMA_FROM_DEVICE ); -/* Get the corresponding mux_id from mhi */ - link_id =mhi_mbim_get_link_mux_id (cntrl); -/* Register wwan link ops with MHI controller representing WWAN instance */ -return wwan_register_ops (&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim, link_id); +return wwan_register_ops (&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim,0 ); }static void mhi_mbim_remove (struct mhi_device *mhi_dev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 384/512 wireguard: device: enable threaded NAPI
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mirco Barone <[email protected]>
[ Upstream commit db9ae3b6b43c79b1ba87eea849fd65efa05b4b2e ]
Enable threaded NAPI by default for WireGuard devices in response to low performance behavior that we observed when multiple tunnels (and thus multiple wg devices) are deployed on a single host. This affects any kind of multi-tunnel deployment, regardless of whether the tunnels share the same endpoints or not (i.e., a VPN concentrator type of gateway would also be affected).
The problem is caused by the fact that, in case of a traffic surge that involves multiple tunnels at the same time, the polling of the NAPI instance of all these wg devices tends to converge onto the same core, causing underutilization of the CPU and bottlenecking performance.
This happens because NAPI polling is hosted by default in softirq context, but the WireGuard driver only raises this softirq after the rx peer queue has been drained, which doesn't happen during high traffic. In this case, the softirq already active on a core is reused instead of raising a new one.
As a result, once two or more tunnel softirqs have been scheduled on the same core, they remain pinned there until the surge ends.
In our experiments, this almost always leads to all tunnel NAPIs being handled on a single core shortly after a surge begins, limiting scalability to less than 3× the performance of a single tunnel, despite plenty of unused CPU cores being available.
The proposed mitigation is to enable threaded NAPI for all WireGuard devices. This moves the NAPI polling context to a dedicated per-device kernel thread, allowing the scheduler to balance the load across all available cores.
On our 32-core gateways, enabling threaded NAPI yields a ~4× performance improvement with 16 tunnels, increasing throughput from ~13 Gbps to ~48 Gbps. Meanwhile, CPU usage on the receiver (which is the bottleneck) jumps from 20% to 100%.
We have found no performance regressions in any scenario we tested. Single-tunnel throughput remains unchanged.
More details are available in our Netdev paper.
--- drivers/net/wireguard/device.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireguard/device.c +1 -0
@@ -364,6 +364,7 @@ static int wg_newlink(struct net *src_net, struct net_device *dev,if (ret <0 ) goto err_free_handshake_queue; +dev_set_threaded (dev, true); ret =register_netdevice (dev);if (ret <0 ) goto err_uninit_ratelimiter;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 385/512 seg6: Fix validation of nexthop addresses
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 7632fedb266d93ed0ed9f487133e6c6314a9b2d1 ]
The kernel currently validates that the length of the provided nexthop address does not exceed the specified length. This can lead to the kernel reading uninitialized memory if user space provided a shorter length than the specified one.
Fix by validating that the provided length exactly matches the specified one.
--- net/ipv6/seg6_local.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/ipv6/seg6_local.c +2 -4
@@ -1644,10 +1644,8 @@ static const struct nla_policy seg6_local_policy[SEG6_LOCAL_MAX + 1] = { [SEG6_LOCAL_SRH] = { .type = NLA_BINARY }, [SEG6_LOCAL_TABLE] = { .type = NLA_U32 }, [SEG6_LOCAL_VRFTABLE] = { .type = NLA_U32 }, - [SEG6_LOCAL_NH4] = { .type = NLA_BINARY, - .len = sizeof(struct in_addr) }, - [SEG6_LOCAL_NH6] = { .type = NLA_BINARY, - .len = sizeof(struct in6_addr) }, + [SEG6_LOCAL_NH4] = NLA_POLICY_EXACT_LEN(sizeof(struct in_addr)), + [SEG6_LOCAL_NH6] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)), [SEG6_LOCAL_IIF] = { .type = NLA_U32 }, [SEG6_LOCAL_OIF] = { .type = NLA_U32 }, [SEG6_LOCAL_BPF] = { .type = NLA_NESTED },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 386/512 riscv: misaligned: fix sleeping function called during misaligned access handling
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nylon Chen <[email protected]>
[ Upstream commit 61a74ad254628ccd9e88838c3c622885dfb6c588 ]
Use copy_from_user_nofault() and copy_to_user_nofault() instead of copy_from/to_user functions in the misaligned access trap handlers.
The following bug report was found when executing misaligned memory accesses:
BUG: sleeping function called from invalid context at ./include/linux/uaccess.h:162 in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 115, name: two preempt_count: 0, expected: 0 CPU: 0 UID: 0 PID: 115 Comm: two Not tainted 6.14.0-rc5 #24 Hardware name: riscv-virtio,qemu (DT) Call Trace: [<ffffffff800160ea>] dump_backtrace+0x1c/0x24 [<ffffffff80002304>] show_stack+0x28/0x34 [<ffffffff80010fae>] dump_stack_lvl+0x4a/0x68 [<ffffffff80010fe0>] dump_stack+0x14/0x1c [<ffffffff8004e44e>] __might_resched+0xfa/0x104 [<ffffffff8004e496>] __might_sleep+0x3e/0x62 [<ffffffff801963c4>] __might_fault+0x1c/0x24 [<ffffffff80425352>] _copy_from_user+0x28/0xaa [<ffffffff8000296c>] handle_misaligned_store+0x204/0x254 [<ffffffff809eae82>] do_trap_store_misaligned+0x24/0xee [<ffffffff809f4f1a>] handle_exception+0x146/0x152
--- arch/riscv/kernel/traps_misaligned.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/traps_misaligned.c +2 -2
@@ -429,7 +429,7 @@ int handle_misaligned_load(struct pt_regs *regs) val.data_u64 =0 ;if (user_mode (regs)) { -if (copy_from_user (&val, (u8 __user *)addr, len)) +if (copy_from_user_nofault (&val, (u8 __user *)addr, len))return -1 ; }else {memcpy (&val, (u8 *)addr, len);
@@ -530,7 +530,7 @@ int handle_misaligned_store(struct pt_regs *regs)return -EOPNOTSUPP ;if (user_mode (regs)) { -if (copy_to_user ((u8 __user *)addr, &val, len)) +if (copy_to_user_nofault ((u8 __user *)addr, &val, len))return -1 ; }else {memcpy ((u8 *)addr, &val, len);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 387/512 scsi: ufs: qcom: Prevent calling phy_exit() before phy_init()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nitin Rawat <[email protected]>
[ Upstream commit 7831003165d37ecb7b33843fcee05cada0359a82 ]
Prevent calling phy_exit() before phy_init() to avoid abnormal power count and the following warning during boot up.
[5.146763] phy phy-1d80000.phy.0: phy_power_on was called before phy_init
--- drivers/ufs/host/ufs-qcom.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ufs/host/ufs-qcom.c +2 -3
@@ -366,10 +366,9 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)if (ret)return ret; -if (phy->power_count) { +if (phy->power_count)phy_power_off (phy); -phy_exit (phy); - } +/* phy initialization - calibrate the phy */ ret =phy_init (phy);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 388/512 ASoC: codecs: hda: Fix RPM usage count underflow
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit ff0045de4ee0288dec683690f66f2f369b7d3466 ]
RPM manipulation in hda_codec_probe_complete()'s error path is superfluous and leads to RPM usage count underflow if the build-controls operation fails.
hda_codec_probe_complete() is called in:
1) hda_codec_probe() for all non-HDMI codecs
2) in card->late_probe() for HDMI codecs
Error path for hda_codec_probe() takes care of bus' RPM already. For 2) if late_probe() fails, ASoC performs card cleanup what triggers hda_codec_remote() - same treatment is in 1).
--- sound/soc/codecs/hda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/hda.c +2 -2
@@ -152,7 +152,7 @@ int hda_codec_probe_complete(struct hda_codec *codec) ret =snd_hda_codec_build_controls (codec);if (ret <0 ) {dev_err (&hdev->dev,"unable to create controls %d\n" , ret); - goto out; +return ret; }/* Bus suspended codecs as it does not manage their pm */
@@ -160,7 +160,7 @@ int hda_codec_probe_complete(struct hda_codec *codec)/* rpm was forbidden in snd_hda_codec_device_new() */ snd_hda_codec_set_power_save (codec,2000 );snd_hda_codec_register (codec); -out: +/* Complement pm_runtime_get_sync(bus) in probe */ pm_runtime_mark_last_busy (bus->dev);pm_runtime_put_autosuspend (bus->dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 389/512 ASoC: Intel: avs: Fix deadlock when the failing IPC is SET_D0IX
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 9ad1f3cd0d60444c69948854c7e50d2a61b63755 ]
The procedure handling IPC timeouts and EXCEPTION_CAUGHT notification shall cancel any D0IX work before proceeding with DSP recovery. If SET_D0IX called from delayed_work is the failing IPC the procedure will deadlock. Conditionally skip cancelling the work to fix that.
--- sound/soc/intel/avs/ipc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/intel/avs/ipc.c +3 -1
@@ -169,7 +169,9 @@ static void avs_dsp_exception_caught(struct avs_dev *adev, union avs_notify_msgdev_crit (adev->dev,"communication severed, rebooting dsp..\n" ); -cancel_delayed_work_sync (&ipc->d0ix_work); +/* Avoid deadlock as the exception may be the response to SET_D0IX. */ +if (current_work () != &ipc->d0ix_work.work) +cancel_delayed_work_sync (&ipc->d0ix_work); ipc->in_d0ix = false;/* Re-enabled on recovery completion. */ pm_runtime_disable (adev->dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 390/512 ASoC: Intel: avs: Verify content returned by parse_int_array()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 93e246b6769bdacb09cfff4ea0f00fe5ab4f0d7a ]
The first element of the returned array stores its length. If it is 0, any manipulation beyond the element at index 0 ends with null-ptr-deref.
--- sound/soc/intel/avs/debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/intel/avs/debugfs.c +5 -1
@@ -372,7 +372,10 @@ static ssize_t trace_control_write(struct file *file, const char __user *from, sreturn ret; num_elems = *array; - resource_mask = array[1 ]; +if (!num_elems) { + ret = -EINVAL ; + goto free_array; + }/* * Disable if just resource mask is provided - no log priority flags.
@@ -380,6 +383,7 @@ static ssize_t trace_control_write(struct file *file, const char __user *from, s* Enable input format: mask, prio1, .., prioN * Where 'N' equals number of bits set in the 'mask'. */ + resource_mask = array[1 ];if (num_elems ==1 ) { ret =disable_logs (adev, resource_mask); }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 391/512 ASoC: ti: omap-hdmi: Re-add dai_link->platform to fix card init
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuuki NAGAO <[email protected]>
[ Upstream commit bae071aa7bcd034054cec91666c80f812adeccd9 ]
The removed dai_link->platform component cause a fail which is exposed at runtime. (ex: when a sound tool is used) This patch re-adds the dai_link->platform component to have a full card registered.
Before this patch:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 1: HDMI [HDMI], device 0: HDMI snd-soc-dummy-dai-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
$ speaker-test -D plughw:1,0 -t sine speaker-test 1.2.8 Playback device is plughw:1,0 Stream parameters are 48000Hz, S16_LE, 1 channels Sine wave rate is 440.0000Hz Playback open error: -22,Invalid argument
After this patch which restores the platform component:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: HDMI [HDMI], device 0: HDMI snd-soc-dummy-dai-0 [HDMI snd-soc-dummy-dai-0] Subdevices: 0/1 Subdevice #0: subdevice #0
-> Resolve the playback error.
--- sound/soc/ti/omap-hdmi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/ti/omap-hdmi.c +5 -2
@@ -361,17 +361,20 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)if (!card->dai_link)return -ENOMEM ; - compnent =devm_kzalloc (dev,sizeof (*compnent),GFP_KERNEL ); + compnent =devm_kzalloc (dev,2 *sizeof (*compnent),GFP_KERNEL );if (!compnent)return -ENOMEM ; - card->dai_link->cpus = compnent; + card->dai_link->cpus = &compnent[0 ]; card->dai_link->num_cpus =1 ; card->dai_link->codecs = &snd_soc_dummy_dlc; card->dai_link->num_codecs =1 ; + card->dai_link->platforms = &compnent[1 ]; + card->dai_link->num_platforms =1 ; card->dai_link->name = card->name; card->dai_link->stream_name = card->name; card->dai_link->cpus->dai_name =dev_name (ad->dssdev); + card->dai_link->platforms->name =dev_name (ad->dssdev); card->num_links =1 ; card->dev = dev;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 392/512 iov_iter: use iov_offset for length calculation in iov_iter_aligned_bvec
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nitesh Shetty <[email protected]>
[ Upstream commit 334d7c4fb60cf21e0abac134d92fe49e9b04377e ]
If iov_offset is non-zero, then we need to consider iov_offset in length calculation, otherwise we might pass smaller IOs such as 512 bytes, in below scenario [1].
This issue is reproducible using lib-uring test/fixed-seg.c application with fixed buffer on a 512 LBA formatted device.
[1]
At present we pass the alignment check, for 512 LBA formatted devices, len_mask = 511 when IO is smaller, i->count = 512 has an offset, i->io_offset = 3584 with bvec values, bvec->bv_offset = 256, bvec->bv_len = 3840. In short, the first 256 bytes are in the current page, next 256 bytes are in the another page. Ideally we expect to fail the IO.
I can think of 2 userspace scenarios where we experience this.
a: From userspace, we observe a different behaviour when device LBA
size is 512 vs 4096 bytes. For 4096 LBA formatted device, I see the same liburing test [2] failing, whereas 512 the test passes without this. This is reproducible everytime.
[2] https://github.com/axboe/liburing/
b: Although I was not able to reproduce the below condition, but I
suspect below case should be possible from user space for devices with 512 LBA formatted device. Lets say from userspace while allocating a virtually single chunk of memory, if we get 2 physical chunk of memory, and IO happens to be at the boundary of first physical chunk with length crossing first chunk, then we allow IOs to proceed and hence we might map wrong physical address length and proceed with IO rather than failing.
: --- a/test/fixed-seg.c
: +++ b/test/fixed-seg.c
: @@ -64,7 +64,7 @@ static int test(struct io_uring *ring, int fd, int : vec_off)
: return T_EXIT_FAIL;
: }
:
: - ret = read_it(ring, fd, 4096, vec_off);
: + ret = read_it(ring, fd, 4096, 7*512 + 256);
: if (ret) {
: fprintf(stderr, "4096 0 failed\n");
: return T_EXIT_FAIL;
Effectively this is a write crossing the page boundary.
--- lib/iov_iter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/iov_iter.c +1 -1
@@ -820,7 +820,7 @@ static bool iov_iter_aligned_bvec(const struct iov_iter *i, unsigned addr_mask,size_t size = i->count; do { - size_t len = bvec->bv_len; + size_t len = bvec->bv_len - skip; if (len > size) len = size;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 393/512 path_overmount(): avoid false negatives
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 5f31c549382bcddbbd754c72c5433b19420d485d ]
Holding namespace_sem is enough to make sure that result remains valid. It is *not* enough to avoid false negatives from __lookup_mnt(). Mounts can be unhashed outside of namespace_sem (stuck children getting detached on final mntput() of lazy-umounted mount) and having an unrelated mount removed from the hash chain while we traverse it may end up with false negative from __lookup_mnt(). We need to sample and recheck the seqlock component of mount_lock...
Bug predates the introduction of path_overmount() - it had come from the code in finish_automount() that got abstracted into that helper.
--- fs/namespace.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
fs/namespace.c +13 -6
@@ -3176,18 +3176,25 @@ static int do_set_group(struct path *from_path, struct path *to_path)* Check if path is overmounted, i.e., if there's a mount on top of * @path->mnt with @path->dentry as mountpoint. * -* Context: This function expects namespace_lock() to be held. +* Context: namespace_sem must be held at least shared. +* MUST NOT be called under lock_mount_hash() (there one should just +* call __lookup_mnt() and check if it returns NULL). * Return: If path is overmounted true is returned, false if not. */ static inline bool path_overmounted (const struct path *path) { +unsigned seq =read_seqbegin (&mount_lock); +bool no_child; +rcu_read_lock (); -if (unlikely (__lookup_mnt (path->mnt, path->dentry))) { -rcu_read_unlock (); -return true; - } + no_child = !__lookup_mnt (path->mnt, path->dentry);rcu_read_unlock (); -return false; +if (need_seqretry (&mount_lock, seq)) { +read_seqlock_excl (&mount_lock); + no_child = !__lookup_mnt (path->mnt, path->dentry); +read_sequnlock_excl (&mount_lock); + } +return unlikely (!no_child); }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 394/512 fix propagation graph breakage by MOVE_MOUNT_SET_GROUP move_mount(2)
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit d8cc0362f918d020ca1340d7694f07062dc30f36 ]
9ffb14ef61ba "move_mount: allow to add a mount into an existing group" breaks assertions on ->mnt_share/->mnt_slave. For once, the data structures in question are actually documented.
Documentation/filesystem/sharedsubtree.rst:
All vfsmounts in a peer group have the same ->mnt_master. If it is non-NULL, they form a contiguous (ordered) segment of slave list.
do_set_group() puts a mount into the same place in propagation graph as the old one. As the result, if old mount gets events from somewhere and is not a pure event sink, new one needs to be placed next to the old one in the slave list the old one's on. If it is a pure event sink, we only need to make sure the new one doesn't end up in the middle of some peer group.
"move_mount: allow to add a mount into an existing group" ends up putting the new one in the beginning of list; that's definitely not going to be in the middle of anything, so that's fine for case when old is not marked shared. In case when old one _is_ marked shared (i.e. is not a pure event sink), that breaks the assumptions of propagation graph iterators.
Put the new mount next to the old one on the list - that does the right thing in "old is marked shared" case and is just as correct as the current behaviour if old is not marked shared (kudos to Pavel for pointing that out - my original suggested fix changed behaviour in the "nor marked" case, which complicated things for no good reason).
--- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
@@ -3151,7 +3151,7 @@ static int do_set_group(struct path *from_path, struct path *to_path)if (IS_MNT_SLAVE (from)) {struct mount *m = from->mnt_master; -list_add (&to->mnt_slave, &m->mnt_slave_list); +list_add (&to->mnt_slave, &from->mnt_slave); to->mnt_master = m; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 395/512 do_change_type(): refuse to operate on unmounted/not ours mounts
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 12f147ddd6de7382dad54812e65f3f08d05809fc ]
Ensure that propagation settings can only be changed for mounts located in the caller's mount namespace. This change aligns permission checking with the rest of mount(2).
--- fs/namespace.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/namespace.c +4 -0
@@ -2714,6 +2714,10 @@ static int do_change_type(struct path *path, int ms_flags)return -EINVAL ;namespace_lock (); +if (!check_mnt (mnt)) { + err = -EINVAL ; + goto out_unlock; + }if (type ==MS_SHARED ) { err =invent_group_ids (mnt, recurse);if (err)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 396/512 tools/power turbostat: Fix AMD package-energy reporting
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautham R. Shenoy <[email protected]>
[ Upstream commit adb49732c8c63665dd3476e8e6b7c67a0f851245 ]
commit 05a2f07db888 ("tools/power turbostat: read RAPL counters via perf") that adds support to read RAPL counters via perf defines the notion of a RAPL domain_id which is set to physical_core_id on platforms which support per_core_rapl counters (Eg: AMD processors Family 17h onwards) and is set to the physical_package_id on all the other platforms.
However, the physical_core_id is only unique within a package and on platforms with multiple packages more than one core can have the same physical_core_id and thus the same domain_id. (For eg, the first cores of each package have the physical_core_id = 0). This results in all these cores with the same physical_core_id using the same entry in the rapl_counter_info_perdomain[]. Since rapl_perf_init() skips the perf-initialization for cores whose domain_ids have already been visited, cores that have the same physical_core_id always read the perf file corresponding to the physical_core_id of the first package and thus the package-energy is incorrectly reported to be the same value for different packages.
Note: This issue only arises when RAPL counters are read via perf and not when they are read via MSRs since in the latter case the MSRs are read separately on each core.
Fix this issue by associating each CPU with rapl_core_id which is unique across all the packages in the system.
--- tools/power/x86/turbostat/turbostat.c | 41 +++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 5 deletions(-)
tools/power/x86/turbostat/turbostat.c +36 -5
@@ -4491,6 +4491,38 @@ unsigned long pmt_read_counter(struct pmt_counter *ppmt, unsigned int domain_id)return (value & value_mask) >> value_shift; } + +/* Rapl domain enumeration helpers */ +static inline int get_rapl_num_domains (void ) +{ +int num_packages = topo.max_package_id +1 ; +int num_cores_per_package; +int num_cores; + +if (!platform->has_per_core_rapl) +return num_packages; + + num_cores_per_package = topo.max_core_id +1 ; + num_cores = num_cores_per_package * num_packages; + +return num_cores; +} + +static inline int get_rapl_domain_id (int cpu) +{ +int nr_cores_per_package = topo.max_core_id +1 ; +int rapl_core_id; + +if (!platform->has_per_core_rapl) +return cpus[cpu].physical_package_id; + +/* Compute the system-wide unique core-id for @cpu */ + rapl_core_id = cpus[cpu].physical_core_id; + rapl_core_id += cpus[cpu].physical_package_id * nr_cores_per_package; + +return rapl_core_id; +} +/* * get_counters(...) * migrate to cpu
@@ -4544,7 +4576,7 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) goto done;if (platform->has_per_core_rapl) { - status =get_rapl_counters (cpu, c->core_id, c, p); + status =get_rapl_counters (cpu,get_rapl_domain_id (cpu), c, p);if (status !=0 )return status; }
@@ -4610,7 +4642,7 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) p->sys_lpi = cpuidle_cur_sys_lpi_us;if (!platform->has_per_core_rapl) { - status =get_rapl_counters (cpu, p->package_id, c, p); + status =get_rapl_counters (cpu,get_rapl_domain_id (cpu), c, p);if (status !=0 )return status; }
@@ -7570,7 +7602,7 @@ void linux_perf_init(void)void rapl_perf_init (void ) { -const unsigned int num_domains = (platform->has_per_core_rapl ? topo.max_core_id : topo.max_package_id) +1 ; +const unsigned int num_domains =get_rapl_num_domains ();bool *domain_visited =calloc (num_domains,sizeof (bool )); rapl_counter_info_perdomain =calloc (num_domains,sizeof (*rapl_counter_info_perdomain));
@@ -7611,8 +7643,7 @@ void rapl_perf_init(void)continue ;/* Skip already seen and handled RAPL domains */ - next_domain = - platform->has_per_core_rapl ? cpus[cpu].physical_core_id : cpus[cpu].physical_package_id; + next_domain =get_rapl_domain_id (cpu);assert (next_domain < num_domains);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 397/512 drm/amd/pm: add inst to dpm_set_vcn_enable
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boyuan Zhang <[email protected]>
[ Upstream commit 8b7f3529cd7bca239404d7279056e566639ac055 ]
Add an instance parameter to the existing function dpm_set_vcn_enable() for future implementation. Re-write all pptable functions accordingly.
v2: Remove duplicated dpm_set_vcn_enable() functions in v1. Instead, adding instance parameter to existing functions.
Stable-dep-of: ee7360fc27d6 ("drm/amdgpu: read back register after written for VCN v4.0.5")
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 2 +- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 3 ++- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v14_0.h | 3 ++- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 4 +++- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 4 +++- drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 4 +++- drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 4 +++- drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 4 +++- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 3 ++- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c | 4 +++- drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 4 +++- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 3 ++- 13 files changed, 31 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -1
@@ -255,7 +255,7 @@ static int smu_dpm_set_vcn_enable(struct smu_context *smu,if (atomic_read (&power_gate->vcn_gated) ^ enable)return 0 ; - ret = smu->ppt_funcs->dpm_set_vcn_enable (smu, enable); + ret = smu->ppt_funcs->dpm_set_vcn_enable (smu, enable,0xff );if (!ret)atomic_set (&power_gate->vcn_gated, !enable);
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +1 -1
@@ -744,7 +744,7 @@ struct pptable_funcs {* @dpm_set_vcn_enable: Enable/disable VCN engine dynamic power * management. */ -int (*dpm_set_vcn_enable)(struct smu_context *smu,bool enable); +int (*dpm_set_vcn_enable)(struct smu_context *smu,bool enable,int inst);/** * @dpm_set_jpeg_enable: Enable/disable JPEG engine dynamic power
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +2 -1
@@ -255,7 +255,8 @@ int smu_v13_0_wait_for_event(struct smu_context *smu, enum smu_event_type event, uint64_t event_arg);int smu_v13_0_set_vcn_enable (struct smu_context *smu, -bool enable); +bool enable, +int inst);int smu_v13_0_set_jpeg_enable (struct smu_context *smu,bool enable);
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v14_0.h +2 -1
@@ -210,7 +210,8 @@ int smu_v14_0_wait_for_event(struct smu_context *smu, enum smu_event_type event, uint64_t event_arg);int smu_v14_0_set_vcn_enable (struct smu_context *smu, -bool enable); +bool enable, +int inst);int smu_v14_0_set_jpeg_enable (struct smu_context *smu,bool enable);
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +3 -1
@@ -2031,7 +2031,9 @@ static bool arcturus_is_dpm_running(struct smu_context *smu)return !!(feature_enabled &SMC_DPM_FEATURE ); } -static int arcturus_dpm_set_vcn_enable (struct smu_context *smu,bool enable) +static int arcturus_dpm_set_vcn_enable (struct smu_context *smu, +bool enable, +int inst) {int ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +3 -1
@@ -1135,7 +1135,9 @@ static int navi10_set_default_dpm_table(struct smu_context *smu)return 0 ; } -static int navi10_dpm_set_vcn_enable (struct smu_context *smu,bool enable) +static int navi10_dpm_set_vcn_enable (struct smu_context *smu, +bool enable, +int inst) {int ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +3 -1
@@ -1152,7 +1152,9 @@ static int sienna_cichlid_set_default_dpm_table(struct smu_context *smu)return 0 ; } -static int sienna_cichlid_dpm_set_vcn_enable (struct smu_context *smu,bool enable) +static int sienna_cichlid_dpm_set_vcn_enable (struct smu_context *smu, +bool enable, +int inst) {struct amdgpu_device *adev = smu->adev;int i, ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -1
@@ -461,7 +461,9 @@ static int vangogh_init_smc_tables(struct smu_context *smu)return smu_v11_0_init_smc_tables (smu); } -static int vangogh_dpm_set_vcn_enable (struct smu_context *smu,bool enable) +static int vangogh_dpm_set_vcn_enable (struct smu_context *smu, +bool enable, +int inst) {int ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +3 -1
@@ -645,7 +645,9 @@ static enum amd_pm_state_type renoir_get_current_power_state(struct smu_contextreturn pm_type; } -static int renoir_dpm_set_vcn_enable (struct smu_context *smu,bool enable) +static int renoir_dpm_set_vcn_enable (struct smu_context *smu, +bool enable, +int inst) {int ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -1
@@ -2088,7 +2088,8 @@ int smu_v13_0_get_current_pcie_link_speed(struct smu_context *smu) }int smu_v13_0_set_vcn_enable (struct smu_context *smu, -bool enable) +bool enable, +int inst) {struct amdgpu_device *adev = smu->adev;int i, ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c +3 -1
@@ -193,7 +193,9 @@ static int smu_v13_0_5_system_features_control(struct smu_context *smu, bool en)return ret; } -static int smu_v13_0_5_dpm_set_vcn_enable (struct smu_context *smu,bool enable) +static int smu_v13_0_5_dpm_set_vcn_enable (struct smu_context *smu, +bool enable, +int inst) {int ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +3 -1
@@ -220,7 +220,9 @@ static int yellow_carp_system_features_control(struct smu_context *smu, bool en)return ret; } -static int yellow_carp_dpm_set_vcn_enable (struct smu_context *smu,bool enable) +static int yellow_carp_dpm_set_vcn_enable (struct smu_context *smu, +bool enable, +int inst) {int ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +2 -1
@@ -1492,7 +1492,8 @@ int smu_v14_0_set_single_dpm_table(struct smu_context *smu, }int smu_v14_0_set_vcn_enable (struct smu_context *smu, -bool enable) +bool enable, +int inst) {struct amdgpu_device *adev = smu->adev;int i, ret =0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 398/512 drm/amd/pm: power up or down vcn by instance
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boyuan Zhang <[email protected]>
[ Upstream commit 8aaf166703751ffd9a9fbc4d8b996f538b278983 ]
For smu ip with multiple vcn instances (smu 11/13/14), remove all the for loop in dpm_set_vcn_enable() functions. And use the instance argument to power up/down vcn for the given instance only, instead of powering up/down for all vcn instances.
v2: remove all duplicated functions in v1.
remove for-loop from each ip, and temporarily move to dpm_set_vcn_enable, in order to keep the exact same logic as before, until further separation in the next patch.
Stable-dep-of: ee7360fc27d6 ("drm/amdgpu: read back register after written for VCN v4.0.5")
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 9 +++-- .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 20 +++++------ .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 16 ++++----- .../gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 35 ++++++++----------- 4 files changed, 35 insertions(+), 45 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -3
@@ -241,6 +241,7 @@ static int smu_dpm_set_vcn_enable(struct smu_context *smu, {struct smu_power_context *smu_power = &smu->smu_power;struct smu_power_gate *power_gate = &smu_power->power_gate; +struct amdgpu_device *adev = smu->adev;int ret =0 ;/*
@@ -255,9 +256,11 @@ static int smu_dpm_set_vcn_enable(struct smu_context *smu,if (atomic_read (&power_gate->vcn_gated) ^ enable)return 0 ; - ret = smu->ppt_funcs->dpm_set_vcn_enable (smu, enable,0xff ); -if (!ret) -atomic_set (&power_gate->vcn_gated, !enable); +for (int i =0 ; i < adev->vcn.num_vcn_inst; i++) { + ret = smu->ppt_funcs->dpm_set_vcn_enable (smu, enable, i); +if (ret) +return ret; + }return ret; }
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +8 -12
@@ -1157,19 +1157,15 @@ static int sienna_cichlid_dpm_set_vcn_enable(struct smu_context *smu, int inst) {struct amdgpu_device *adev = smu->adev; -int i, ret =0 ; +int ret =0 ; -for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { -if (adev->vcn.harvest_config & (1 << i)) -continue ; -/* vcn dpm on is a prerequisite for vcn power gate messages */ -if (smu_cmn_feature_is_enabled (smu,SMU_FEATURE_MM_DPM_PG_BIT )) { - ret =smu_cmn_send_smc_msg_with_param (smu, enable ? - SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, -0x10000 * i,NULL ); -if (ret) -return ret; - } +if (adev->vcn.harvest_config & (1 << inst)) +return ret; +/* vcn dpm on is a prerequisite for vcn power gate messages */ +if (smu_cmn_feature_is_enabled (smu,SMU_FEATURE_MM_DPM_PG_BIT )) { + ret =smu_cmn_send_smc_msg_with_param (smu, enable ? + SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, +0x10000 * inst,NULL ); }return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +6 -10
@@ -2092,18 +2092,14 @@ int smu_v13_0_set_vcn_enable(struct smu_context *smu, int inst) {struct amdgpu_device *adev = smu->adev; -int i, ret =0 ; +int ret =0 ; -for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { -if (adev->vcn.harvest_config & (1 << i)) -continue ; +if (adev->vcn.harvest_config & (1 << inst)) +return ret; - ret =smu_cmn_send_smc_msg_with_param (smu, enable ? - SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, - i <<16U ,NULL ); -if (ret) -return ret; - } + ret =smu_cmn_send_smc_msg_with_param (smu, enable ? + SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, + inst <<16U ,NULL );return ret; }
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +15 -20
@@ -1496,29 +1496,24 @@ int smu_v14_0_set_vcn_enable(struct smu_context *smu, int inst) {struct amdgpu_device *adev = smu->adev; -int i, ret =0 ; +int ret =0 ; -for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { -if (adev->vcn.harvest_config & (1 << i)) -continue ; +if (adev->vcn.harvest_config & (1 << inst)) +return ret; -if (smu->is_apu) { -if (i ==0 ) - ret =smu_cmn_send_smc_msg_with_param (smu, enable ? - SMU_MSG_PowerUpVcn0 : SMU_MSG_PowerDownVcn0, - i <<16U ,NULL ); -else if (i ==1 ) - ret =smu_cmn_send_smc_msg_with_param (smu, enable ? - SMU_MSG_PowerUpVcn1 : SMU_MSG_PowerDownVcn1, - i <<16U ,NULL ); - }else { +if (smu->is_apu) { +if (inst ==0 ) ret =smu_cmn_send_smc_msg_with_param (smu, enable ? - SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, - i <<16U ,NULL ); - } - -if (ret) -return ret; + SMU_MSG_PowerUpVcn0 : SMU_MSG_PowerDownVcn0, + inst <<16U ,NULL ); +else if (inst ==1 ) + ret =smu_cmn_send_smc_msg_with_param (smu, enable ? + SMU_MSG_PowerUpVcn1 : SMU_MSG_PowerDownVcn1, + inst <<16U ,NULL ); + }else { + ret =smu_cmn_send_smc_msg_with_param (smu, enable ? + SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn, + inst <<16U ,NULL ); }return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 399/512 drm/amdgpu: read back register after written for VCN v4.0.5
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David (Ming Qiang) Wu <[email protected]>
[ Upstream commit 07c9db090b86e5211188e1b351303fbc673378cf ]
On VCN v4.0.5 there is a race condition where the WPTR is not updated after starting from idle when doorbell is used. Adding register read-back after written at function end is to ensure all register writes are done before they can be used.
Stable-dep-of: ee7360fc27d6 ("drm/amdgpu: read back register after written for VCN v4.0.5")
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +8 -0
@@ -985,6 +985,10 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, b ring->doorbell_index <<VCN_RB1_DB_CTRL__OFFSET__SHIFT | VCN_RB1_DB_CTRL__EN_MASK); +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , inst_idx, regVCN_RB1_DB_CTRL); +return 0 ; }
@@ -1169,6 +1173,10 @@ static int vcn_v4_0_5_start(struct amdgpu_device *adev) fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET |FW_QUEUE_DPG_HOLD_OFF ); } +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , i, regVCN_RB_ENABLE); +return 0 ; }
Signature · 1 line
2.39.5
Re: [PATCH 6.12 399/512] drm/amdgpu: read back register after written for VCN v4.0.5
Quoted 42 lines · Greg Kroah-Hartman
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David (Ming Qiang) Wu <[email protected]>
[ Upstream commit
07c9db090b86e5211188e1b351303fbc673378cf]On VCN v4.0.5 there is a race condition where the WPTR is not updated after starting from idle when doorbell is used. Adding register read-back after written at function end is to ensure all register writes are done before they can be used.
Signed-off-by David (Ming Qiang) Wu <[email protected]>Reviewed-by Mario Limonciello <[email protected]>Tested-by Mario Limonciello <[email protected]>Reviewed-by Alex Deucher <[email protected]>Reviewed-by Ruijing Dong <[email protected]>Signed-off-by Alex Deucher <[email protected]>Stable-dep-of:
ee7360fc27d6("drm/amdgpu: read back register after written for VCN v4.0.5")Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +4
-0@@ -985,6 +985,10 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, b ring->doorbell_index <<VCN_RB1_DB_CTRL__OFFSET__SHIFT | VCN_RB1_DB_CTRL__EN_MASK); +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , inst_idx, regVCN_RB1_DB_CTRL); +return 0 ; }
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c static int vcn_v4_0_5_start(struct amdgpu_device *adev) · line 1179
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +4
-0@@ -1169,6 +1173,10 @@ static int vcn_v4_0_5_start(struct amdgpu_device *adev) fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET |FW_QUEUE_DPG_HOLD_OFF ); } +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , i, regVCN_RB_ENABLE); +
The scope of this change is incorrect. It should be in the for loop above.
IE here:
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
} return 0;
Quoted 3 lines
return 0; }
Greg Kroah-Hartman
maintainerRe: [PATCH 6.12 399/512] drm/amdgpu: read back register after written for VCN v4.0.5
Quoted 53 lines · Mario
Quoted 42 lines · Greg Kroah-Hartman
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David (Ming Qiang) Wu <[email protected]>
[ Upstream commit
07c9db090b86e5211188e1b351303fbc673378cf]On VCN v4.0.5 there is a race condition where the WPTR is not updated after starting from idle when doorbell is used. Adding register read-back after written at function end is to ensure all register writes are done before they can be used.
Signed-off-by David (Ming Qiang) Wu <[email protected]>Reviewed-by Mario Limonciello <[email protected]>Tested-by Mario Limonciello <[email protected]>Reviewed-by Alex Deucher <[email protected]>Reviewed-by Ruijing Dong <[email protected]>Signed-off-by Alex Deucher <[email protected]>Stable-dep-of:
ee7360fc27d6("drm/amdgpu: read back register after written for VCN v4.0.5")Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +4
-0@@ -985,6 +985,10 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, b ring->doorbell_index <<VCN_RB1_DB_CTRL__OFFSET__SHIFT | VCN_RB1_DB_CTRL__EN_MASK); +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , inst_idx, regVCN_RB1_DB_CTRL); +return 0 ; }drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c static int vcn_v4_0_5_start(struct amdgpu_device *adev) · line 1179
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +4
-0@@ -1169,6 +1173,10 @@ static int vcn_v4_0_5_start(struct amdgpu_device *adev) fw_shared->sq.queue_mode &= ~(FW_QUEUE_RING_RESET |FW_QUEUE_DPG_HOLD_OFF ); } +/* Keeping one read-back to ensure all register writes are done, otherwise +* it may introduce race conditions */ +RREG32_SOC15 (VCN , i, regVCN_RB_ENABLE); +The scope of this change is incorrect. It should be in the for loop above.
Quoted 5 lines
IE here:
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Yeah, something went really wrong here, these were 3 "dep-of" patches without the actual commit in the tree. And I think it's just referring to itself due to the broken DRM tree way of having duplicate git ids for the same change.
I've dropped this, and the 2 previous patches in the series now, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 400/512 ALSA: hda/realtek: fix micmute LEDs on HP Laptops with ALC3315
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Chiu <[email protected]>
[ Upstream commit 0b1b5161648f35fb96967fb9d80965614657a84e ]
More HP laptops with Realtek HDA codec ALC3315 with combined CS35L56 Amplifiers need quirk ALC285_FIXUP_HP_GPIO_LED to fix the micmute LED.
Stable-dep-of: f709b78aecab ("ALSA: hda/realtek - Add new HP ZBook laptop with micmute led fixup")
--- sound/pci/hda/patch_realtek.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/pci/hda/patch_realtek.c +14 -0
@@ -10770,11 +10770,25 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8cf5 ,"HP ZBook Studio 16" ,ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8d01 ,"HP ZBook Power 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8d84 ,"HP EliteBook X G1i" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8d85 ,"HP EliteBook 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8d86 ,"HP Elite X360 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8d8c ,"HP EliteBook 13 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8d8d ,"HP Elite X360 13 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8d8e ,"HP EliteBook 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8d8f ,"HP EliteBook 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8d90 ,"HP EliteBook 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8d91 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8d92 ,"HP ZBook Firefly 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e14 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e15 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e16 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e17 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e18 ,"HP ZBook Firefly 14 G12A" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e19 ,"HP ZBook Firefly 14 G12A" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e1a ,"HP ZBook Firefly 14 G12A" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e1b ,"HP EliteBook G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e1c ,"HP EliteBook G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e2c ,"HP EliteBook 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
Greg Kroah-Hartman
maintainerPATCH 401/512 ALSA: hda/realtek: fix micmute LEDs on HP Laptops with ALC3247
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Chiu <[email protected]>
[ Upstream commit 78f4ca3c6f6fd305b9af8c51470643617df85e11 ]
More HP EliteBook with Realtek HDA codec ALC3247 with combined CS35L56 Amplifiers need quirk ALC236_FIXUP_HP_GPIO_LED to fix the micmute LED.
Stable-dep-of: f709b78aecab ("ALSA: hda/realtek - Add new HP ZBook laptop with micmute led fixup")
--- sound/pci/hda/patch_realtek.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/pci/hda/patch_realtek.c +5 -0
@@ -10779,6 +10779,11 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8d90 ,"HP EliteBook 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8d91 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8d92 ,"HP ZBook Firefly 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8dec ,"HP EliteBook 640 G12" ,ALC236_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8dee ,"HP EliteBook 660 G12" ,ALC236_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8df0 ,"HP EliteBook 630 G12" ,ALC236_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8dfc ,"HP EliteBook 645 G12" ,ALC236_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8dfe ,"HP EliteBook 665 G12" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e14 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e15 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x8e16, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
Greg Kroah-Hartman
maintainerPATCH 402/512 ALSA: hda/realtek: Add support for various HP Laptops using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit 29951021367f3a6f10e5b7a11c666fc914746f0c ]
Add support for HP Cadet, Clipper OmniBook, Turbine OmniBook, Trekker, Enstrom Onmibook, Piston Omnibook
Laptops use 2 CS35L41 Amps with HDA, using Internal boost, with I2C
Stable-dep-of: f709b78aecab ("ALSA: hda/realtek - Add new HP ZBook laptop with micmute led fixup")
--- sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
sound/pci/hda/patch_realtek.c +17 -0
@@ -10779,11 +10779,23 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8d90 ,"HP EliteBook 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8d91 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8d92 ,"HP ZBook Firefly 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8d9b ,"HP 17 Turbine OmniBook 7 UMA" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8d9c ,"HP 17 Turbine OmniBook 7 DIS" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8d9d ,"HP 17 Turbine OmniBook X UMA" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8d9e ,"HP 17 Turbine OmniBook X DIS" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8d9f ,"HP 14 Cadet (x360)" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8da0 ,"HP 16 Clipper OmniBook 7(X360)" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8da1 ,"HP 16 Clipper OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8da7 ,"HP 14 Enstrom OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8da8 ,"HP 16 Piston OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8dec ,"HP EliteBook 640 G12" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8dee ,"HP EliteBook 660 G12" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8df0 ,"HP EliteBook 630 G12" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8dfc ,"HP EliteBook 645 G12" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8dfe ,"HP EliteBook 665 G12" ,ALC236_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e11 ,"HP Trekker" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8e12 ,"HP Trekker" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8e13 ,"HP Trekker" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8e14 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e15 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x8e16, "HP ZBook Firefly 14 G12", ALC285_FIXUP_HP_GPIO_LED),
@@ -10794,6 +10806,11 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8e1b ,"HP EliteBook G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e1c ,"HP EliteBook G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e2c ,"HP EliteBook 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e36 ,"HP 14 Enstrom OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8e37 ,"HP 16 Piston OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8e60 ,"HP Trekker " ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8e61 ,"HP Trekker " ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8e62 ,"HP Trekker " ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2),
Greg Kroah-Hartman
maintainerPATCH 403/512 ALSA: hda/realtek - Support mute led function for HP platform
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
[ Upstream commit 22c7f77247a84d27b785ec5b706f673421ab269d ]
This patch was integrated CS Amp and support mute led function for HP platform.
Stable-dep-of: f709b78aecab ("ALSA: hda/realtek - Add new HP ZBook laptop with micmute led fixup")
--- sound/pci/hda/patch_realtek.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-)
sound/pci/hda/patch_realtek.c +32 -9
@@ -7616,6 +7616,24 @@ static void alc245_fixup_hp_spectre_x360alc245_fixup_hp_gpio_led (codec, fix, action); } +static void alc245_fixup_hp_zbook_firefly_g12a (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; +static const hda_nid_t conn[] = {0x02 }; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : + spec->gen.auto_mute_via_amp =1 ; +snd_hda_override_conn_list (codec,0x17 ,ARRAY_SIZE (conn), conn); +break ; + } + +cs35l41_fixup_i2c_two (codec, fix, action); +alc245_fixup_hp_mute_led_coefbit (codec, fix, action); +alc285_fixup_hp_coef_micmute_led (codec, fix, action); +} +/* * ALC287 PCM hooks */
@@ -7963,6 +7981,7 @@ enum {ALC256_FIXUP_HEADPHONE_AMP_VOL ,ALC245_FIXUP_HP_SPECTRE_X360_EU0XXX ,ALC245_FIXUP_HP_SPECTRE_X360_16_AA0XXX , +ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ,ALC285_FIXUP_ASUS_GA403U ,ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC , ALC285_FIXUP_ASUS_GA403U_I2C_SPEAKER2_TO_DAC1,
@@ -10251,6 +10270,10 @@ static const struct hda_fixup alc269_fix .type = HDA_FIXUP_FUNC, .v.func = alc245_fixup_hp_spectre_x360_16_aa0xxx, }, + [ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc245_fixup_hp_zbook_firefly_g12a, + }, [ALC285_FIXUP_ASUS_GA403U] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_asus_ga403u,
@@ -10796,15 +10819,15 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8e11 ,"HP Trekker" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8e12 ,"HP Trekker" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8e13 ,"HP Trekker" ,ALC287_FIXUP_CS35L41_I2C_2 ), -SND_PCI_QUIRK (0x103c ,0x8e14 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8e15 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8e16 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8e17 ,"HP ZBook Firefly 14 G12" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8e18 ,"HP ZBook Firefly 14 G12A" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8e19 ,"HP ZBook Firefly 14 G12A" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8e1a ,"HP ZBook Firefly 14 G12A" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8e1b ,"HP EliteBook G12" ,ALC285_FIXUP_HP_GPIO_LED ), -SND_PCI_QUIRK (0x103c ,0x8e1c ,"HP EliteBook G12" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8e14 ,"HP ZBook Firefly 14 G12" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e15 ,"HP ZBook Firefly 14 G12" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e16 ,"HP ZBook Firefly 14 G12" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e17 ,"HP ZBook Firefly 14 G12" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e18 ,"HP ZBook Firefly 14 G12A" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e19 ,"HP ZBook Firefly 14 G12A" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e1a ,"HP ZBook Firefly 14 G12A" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e1b ,"HP EliteBook G12" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e1c ,"HP EliteBook G12" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ),SND_PCI_QUIRK (0x103c ,0x8e2c ,"HP EliteBook 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e36 ,"HP 14 Enstrom OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x103c, 0x8e37, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
Greg Kroah-Hartman
maintainerPATCH 404/512 ALSA: hda/realtek - Add new HP ZBook laptop with micmute led fixup
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Chiu <[email protected]>
[ Upstream commit f709b78aecab519dbcefa9a6603b94ad18c553e3 ]
New HP ZBook with Realtek HDA codec ALC3247 needs the quirk ALC236_FIXUP_HP_GPIO_LED to fix the micmute LED.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10828,6 +10828,7 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8e1a ,"HP ZBook Firefly 14 G12A" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ),SND_PCI_QUIRK (0x103c ,0x8e1b ,"HP EliteBook G12" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ),SND_PCI_QUIRK (0x103c ,0x8e1c ,"HP EliteBook G12" ,ALC245_FIXUP_HP_ZBOOK_FIREFLY_G12A ), +SND_PCI_QUIRK (0x103c ,0x8e1d ,"HP ZBook X Gli 16 G12" ,ALC236_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e2c ,"HP EliteBook 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e36 ,"HP 14 Enstrom OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x103c, 0x8e37, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
Greg Kroah-Hartman
maintainerPATCH 405/512 ALSA: hda/realtek: Add support for HP Agusta using CS35L41 HDA
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit 7150d57c370f9e61b7d0e82c58002f1c5a205ac4 ]
Add support for HP Agusta.
Laptops use 2 CS35L41 Amps with HDA, using Internal boost, with I2C
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -10832,6 +10832,8 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8e2c ,"HP EliteBook 16 G12" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x8e36 ,"HP 14 Enstrom OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8e37 ,"HP 16 Piston OmniBook X" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8e3a ,"HP Agusta" ,ALC287_FIXUP_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x103c ,0x8e3b ,"HP Agusta" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8e60 ,"HP Trekker " ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x103c ,0x8e61 ,"HP Trekker " ,ALC287_FIXUP_CS35L41_I2C_2 ), SND_PCI_QUIRK(0x103c, 0x8e62, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2),
Greg Kroah-Hartman
maintainerPATCH 406/512 Input: synaptics-rmi - fix crash with unsupported versions of F34
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
[ Upstream commit ca39500f6af9cfe6823dc5aa8fbaed788d6e35b2 ]
Sysfs interface for updating firmware for RMI devices is available even when F34 probe fails. The code checks for presence of F34 "container" pointer and then tries to use the function data attached to the sub-device. F34 assigns the function data early, before it knows if probe will succeed, leaving behind a stale pointer.
Fix this by expanding checks to not only test for presence of F34 "container" but also check if there is driver data assigned to the sub-device, and call dev_set_drvdata() only after we are certain that probe is successful.
This is not a complete fix, since F34 will be freed during firmware update, so there is still a race when fetching and accessing this pointer. This race will be addressed in follow-up changes.
--- drivers/input/rmi4/rmi_f34.c | 135 ++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 59 deletions(-)
drivers/input/rmi4/rmi_f34.c +76 -59
@@ -4,6 +4,7 @@* Copyright (C) 2016 Zodiac Inflight Innovations */ +#include "linux/device.h" #include <linux/kernel.h> #include <linux/rmi.h> #include <linux/firmware.h>
@@ -298,39 +299,30 @@ static int rmi_f34_update_firmware(struct f34_data *f34,return ret; } -static int rmi_f34_status (struct rmi_function *fn) -{ -struct f34_data *f34 =dev_get_drvdata (&fn->dev); - -/* -* The status is the percentage complete, or once complete, -* zero for success or a negative return code. -*/ -return f34->update_status; -} -static ssize_t rmi_driver_bootloader_id_show (struct device *dev,struct device_attribute *dattr,char *buf) {struct rmi_driver_data *data =dev_get_drvdata (dev); -struct rmi_function *fn = data->f34_container; +struct rmi_function *fn;struct f34_data *f34; -if (fn) { - f34 =dev_get_drvdata (&fn->dev); - -if (f34->bl_version ==5 ) -return sysfs_emit (buf,"%c%c\n" , - f34->bootloader_id[0 ], - f34->bootloader_id[1 ]); -else -return sysfs_emit (buf,"V%d.%d\n" , - f34->bootloader_id[1 ], - f34->bootloader_id[0 ]); - } + fn = data->f34_container; +if (!fn) +return -ENODEV ; -return 0 ; + f34 =dev_get_drvdata (&fn->dev); +if (!f34) +return -ENODEV ; + +if (f34->bl_version ==5 ) +return sysfs_emit (buf,"%c%c\n" , + f34->bootloader_id[0 ], + f34->bootloader_id[1 ]); +else +return sysfs_emit (buf,"V%d.%d\n" , + f34->bootloader_id[1 ], + f34->bootloader_id[0 ]); } static DEVICE_ATTR(bootloader_id, 0444, rmi_driver_bootloader_id_show, NULL);
@@ -343,13 +335,16 @@ static ssize_t rmi_driver_configuration_id_show(struct device *dev,struct rmi_function *fn = data->f34_container;struct f34_data *f34; -if (fn) { - f34 =dev_get_drvdata (&fn->dev); + fn = data->f34_container; +if (!fn) +return -ENODEV ; -return sysfs_emit (buf,"%s\n" , f34->configuration_id); - } + f34 =dev_get_drvdata (&fn->dev); +if (!f34) +return -ENODEV ; -return 0 ; + +return sysfs_emit (buf,"%s\n" , f34->configuration_id); } static DEVICE_ATTR(configuration_id, 0444,
@@ -365,10 +360,14 @@ static int rmi_firmware_update(struct rmi_driver_data *data,if (!data->f34_container) {dev_warn (dev,"%s: No F34 present!\n" , __func__); -return -EINVAL ; +return -ENODEV ; } f34 =dev_get_drvdata (&data->f34_container->dev); +if (!f34) { +dev_warn (dev,"%s: No valid F34 present!\n" , __func__); +return -ENODEV ; + }if (f34->bl_version >=7 ) {if (data->pdt_props &HAS_BSR ) {
@@ -494,10 +493,18 @@ static ssize_t rmi_driver_update_fw_status_show(struct device *dev, char *buf) {struct rmi_driver_data *data =dev_get_drvdata (dev); -int update_status =0 ; +struct f34_data *f34; +int update_status = -ENODEV ; -if (data->f34_container) - update_status =rmi_f34_status (data->f34_container); +/* +* The status is the percentage complete, or once complete, +* zero for success or a negative return code. +*/ +if (data->f34_container) { + f34 =dev_get_drvdata (&data->f34_container->dev); +if (f34) + update_status = f34->update_status; + }return sysfs_emit (buf,"%d\n" , update_status); }
@@ -517,33 +524,21 @@ static const struct attribute_group rmi_firmware_attr_group = { .attrs = rmi_firmware_attrs, }; -static int rmi_f34_probe (struct rmi_function *fn) +static int rmi_f34v5_probe (struct f34_data *f34) { -struct f34_data *f34; -unsigned char f34_queries[9 ]; +struct rmi_function *fn = f34->fn; +u8 f34_queries[9 ];bool has_config_id; -u8 version = fn->fd.function_version; -int ret; - - f34 =devm_kzalloc (&fn->dev,sizeof (struct f34_data ),GFP_KERNEL ); -if (!f34) -return -ENOMEM ; - - f34->fn = fn; -dev_set_drvdata (&fn->dev, f34); - -/* v5 code only supported version 0, try V7 probe */ -if (version >0 ) -return rmi_f34v7_probe (f34); +int error; f34->bl_version =5 ; - ret =rmi_read_block (fn->rmi_dev, fn->fd.query_base_addr, - f34_queries,sizeof (f34_queries)); -if (ret) { + error =rmi_read_block (fn->rmi_dev, fn->fd.query_base_addr, + f34_queries,sizeof (f34_queries)); +if (error) {dev_err (&fn->dev,"%s: Failed to query properties\n" , __func__); -return ret; +return error; } snprintf(f34->bootloader_id, sizeof(f34->bootloader_id),
@@ -569,11 +564,11 @@ static int rmi_f34_probe(struct rmi_function *fn) f34->v5.config_blocks);if (has_config_id) { - ret =rmi_read_block (fn->rmi_dev, fn->fd.control_base_addr, - f34_queries,sizeof (f34_queries)); -if (ret) { + error =rmi_read_block (fn->rmi_dev, fn->fd.control_base_addr, + f34_queries,sizeof (f34_queries)); +if (error) {dev_err (&fn->dev,"Failed to read F34 config ID\n" ); -return ret; +return error; } snprintf(f34->configuration_id, sizeof(f34->configuration_id),
@@ -582,12 +577,34 @@ static int rmi_f34_probe(struct rmi_function *fn) f34_queries[2], f34_queries[3]);rmi_dbg (RMI_DEBUG_FN , &fn->dev,"Configuration ID: %s\n" , - f34->configuration_id); + f34->configuration_id); }return 0 ; } +static int rmi_f34_probe (struct rmi_function *fn) +{ +struct f34_data *f34; +u8 version = fn->fd.function_version; +int error; + + f34 =devm_kzalloc (&fn->dev,sizeof (struct f34_data ),GFP_KERNEL ); +if (!f34) +return -ENOMEM ; + + f34->fn = fn; + +/* v5 code only supported version 0 */ + error = version ==0 ?rmi_f34v5_probe (f34) :rmi_f34v7_probe (f34); +if (error) +return error; + +dev_set_drvdata (&fn->dev, f34); + +return 0 ; +} +int rmi_f34_create_sysfs (struct rmi_device *rmi_dev) {return sysfs_create_group (&rmi_dev->dev.kobj, &rmi_firmware_attr_group);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 407/512 pmdomain: core: Introduce dev_pm_genpd_rpm_always_on()
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
[ Upstream commit cd3fa304ba5c93ce57b9b55b3cd893af2be96527 ]
For some usecases a consumer driver requires its device to remain power-on from the PM domain perspective during runtime. Using dev PM qos along with the genpd governors, doesn't work for this case as would potentially prevent the device from being runtime suspended too.
To support these usecases, let's introduce dev_pm_genpd_rpm_always_on() to allow consumers drivers to dynamically control the behaviour in genpd for a device that is attached to it.
Stable-dep-of: 08f959759e1e ("mmc: sdhci-of-dwcmshc: add PD workaround on RK3576")
--- drivers/pmdomain/core.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 7 +++++++ 2 files changed, 42 insertions(+)
drivers/pmdomain/core.c +35 -0
@@ -697,6 +697,37 @@ bool dev_pm_genpd_get_hwmode(struct device *dev) }EXPORT_SYMBOL_GPL (dev_pm_genpd_get_hwmode); +/** +* dev_pm_genpd_rpm_always_on() - Control if the PM domain can be powered off. +* +* @dev: Device for which the PM domain may need to stay on for. +* @on: Value to set or unset for the condition. +* +* For some usecases a consumer driver requires its device to remain power-on +* from the PM domain perspective during runtime. This function allows the +* behaviour to be dynamically controlled for a device attached to a genpd. +* +* It is assumed that the users guarantee that the genpd wouldn't be detached +* while this routine is getting called. +* +* Return: Returns 0 on success and negative error values on failures. +*/ +int dev_pm_genpd_rpm_always_on (struct device *dev,bool on) +{ +struct generic_pm_domain *genpd; + + genpd =dev_to_genpd_safe (dev); +if (!genpd) +return -ENODEV ; + +genpd_lock (genpd); +dev_gpd_data (dev)->rpm_always_on = on; +genpd_unlock (genpd); + +return 0 ; +} +EXPORT_SYMBOL_GPL (dev_pm_genpd_rpm_always_on); +static int _genpd_power_on (struct generic_pm_domain *genpd,bool timed) {unsigned int state_idx = genpd->state_idx;
@@ -868,6 +899,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,if (!pm_runtime_suspended (pdd->dev) ||irq_safe_dev_in_sleep_domain (pdd->dev, genpd)) not_suspended++; + +/* The device may need its PM domain to stay powered on. */ +if (to_gpd_data (pdd)->rpm_always_on) +return -EBUSY ; }if (not_suspended >1 || (not_suspended ==1 && !one_dev_on))
include/linux/pm_domain.h +7 -0
@@ -251,6 +251,7 @@ struct generic_pm_domain_data {unsigned int default_pstate;unsigned int rpm_pstate;bool hw_mode; +bool rpm_always_on;void *data; };
@@ -283,6 +284,7 @@ ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev);void dev_pm_genpd_synced_poweroff (struct device *dev);int dev_pm_genpd_set_hwmode (struct device *dev,bool enable);bool dev_pm_genpd_get_hwmode (struct device *dev); +int dev_pm_genpd_rpm_always_on (struct device *dev,bool on);extern struct dev_power_governor simple_qos_governor;extern struct dev_power_governor pm_domain_always_on_gov;
@@ -366,6 +368,11 @@ static inline bool dev_pm_genpd_get_hwmode(struct device *dev) return false; } +static inline int dev_pm_genpd_rpm_always_on (struct device *dev,bool on) +{ +return -EOPNOTSUPP ; +} +#define simple_qos_governor (*(struct dev_power_governor *)(NULL))#define pm_domain_always_on_gov (*(struct dev_power_governor *)(NULL))#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 408/512 mmc: sdhci-of-dwcmshc: add PD workaround on RK3576
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Frattaroli <[email protected]>
[ Upstream commit 08f959759e1e6e9c4b898c51a7d387ac3480630b ]
RK3576's power domains have a peculiar design where the PD_NVM power domain, of which the sdhci controller is a part, seemingly does not have idempotent runtime disable/enable. The end effect is that if PD_NVM gets turned off by the generic power domain logic because all the devices depending on it are suspended, then the next time the sdhci device is unsuspended, it'll hang the SoC as soon as it tries accessing the CQHCI registers.
RK3576's UFS support needed a new dev_pm_genpd_rpm_always_on function added to the generic power domains API to handle what appears to be a similar hardware design.
Use this new function to ask for the same treatment in the sdhci controller by giving rk3576 its own platform data with its own postinit function. The benefit of doing this instead of marking the power domains always on in the power domain core is that we only do this if we know the platform we're running on actually uses the sdhci controller. For others, keeping PD_NVM always on would be a waste, as they won't run into this specific issue. The only other IP in PD_NVM that could be affected is FSPI0. If it gets a mainline driver, it will probably want to do the same thing.
--- drivers/mmc/host/sdhci-of-dwcmshc.c | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/mmc/host/sdhci-of-dwcmshc.c +40 -0
@@ -17,6 +17,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/pm_domain.h> #include <linux/pm_runtime.h> #include <linux/reset.h> #include <linux/sizes.h>
@@ -787,6 +788,29 @@ static void dwcmshc_rk35xx_postinit(struct sdhci_host *host, struct dwcmshc_priv } } +static void dwcmshc_rk3576_postinit (struct sdhci_host *host,struct dwcmshc_priv *dwc_priv) +{ +struct device *dev =mmc_dev (host->mmc); +int ret; + +/* +* This works around the design of the RK3576's power domains, which +* makes the PD_NVM power domain, which the sdhci controller on the +* RK3576 is in, never come back the same way once it's run-time +* suspended once. This can happen during early kernel boot if no driver +* is using either PD_NVM or its child power domain PD_SDGMAC for a +* short moment, leading to it being turned off to save power. By +* keeping it on, sdhci suspending won't lead to PD_NVM becoming a +* candidate for getting turned off. +*/ + ret =dev_pm_genpd_rpm_always_on (dev, true); +if (ret && ret != -EOPNOTSUPP ) +dev_warn (dev,"failed to set PD rpm always on, SoC may hang later: %pe\n" , +ERR_PTR (ret)); + +dwcmshc_rk35xx_postinit (host, dwc_priv); +} +static int th1520_execute_tuning (struct sdhci_host *host,u32 opcode) {struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);
@@ -1218,6 +1242,18 @@ static const struct dwcmshc_pltfm_data sdhci_dwcmshc_rk35xx_pdata = { .postinit = dwcmshc_rk35xx_postinit, }; +static const struct dwcmshc_pltfm_data sdhci_dwcmshc_rk3576_pdata = { + .pdata = { + .ops = &sdhci_dwcmshc_rk35xx_ops, + .quirks =SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN | +SDHCI_QUIRK_BROKEN_TIMEOUT_VAL , + .quirks2 =SDHCI_QUIRK2_PRESET_VALUE_BROKEN | +SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN , + }, + .init = dwcmshc_rk35xx_init, + .postinit = dwcmshc_rk3576_postinit, +}; +static const struct dwcmshc_pltfm_data sdhci_dwcmshc_th1520_pdata = { .pdata = { .ops = &sdhci_dwcmshc_th1520_ops,
@@ -1316,6 +1352,10 @@ static const struct of_device_id sdhci_dwcmshc_dt_ids[] = { .compatible = "rockchip,rk3588-dwcmshc", .data = &sdhci_dwcmshc_rk35xx_pdata, }, + { + .compatible = "rockchip,rk3576-dwcmshc", + .data = &sdhci_dwcmshc_rk3576_pdata, + }, { .compatible = "rockchip,rk3568-dwcmshc", .data = &sdhci_dwcmshc_rk35xx_pdata,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 409/512 arm64: dts: qcom: x1e80100: Apply consistent critical thermal shutdown
In reply to Greg Kroah-Hartman6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
[ Upstream commit 03f2b8eed73418269a158ccebad5d8d8f2f6daa1 ]
The firmware configures the TSENS controller with a maximum temperature of 120°C. When reaching that temperature, the hardware automatically triggers a reset of the entire platform. Some of the thermal zones in x1e80100.dtsi use a critical trip point of 125°C. It's impossible to reach those.
It's preferable to shut down the system cleanly before reaching the hardware trip point. Make the critical temperature trip points consistent by setting all of them to 115°C and apply a consistent hysteresis. The ACPI tables also specify 115°C as critical shutdown temperature.
--- arch/arm64/boot/dts/qcom/x1e80100.dtsi | 128 ++++++++++++------------- 1 file changed, 64 insertions(+), 64 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100.dtsi +64 -64
@@ -6414,8 +6414,8 @@ trip-point0 { }; aoss0-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -6440,7 +6440,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6466,7 +6466,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6492,7 +6492,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6518,7 +6518,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6544,7 +6544,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6570,7 +6570,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6596,7 +6596,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6622,7 +6622,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6640,8 +6640,8 @@ trip-point0 { }; cpuss2-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -6658,8 +6658,8 @@ trip-point0 { }; cpuss2-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -6676,7 +6676,7 @@ trip-point0 { }; mem-critical { - temperature = <125000>; + temperature = <115000>; hysteresis = <0>; type = "critical"; };
@@ -6694,7 +6694,7 @@ trip-point0 { }; video-critical { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6712,8 +6712,8 @@ trip-point0 { }; aoss0-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -6738,7 +6738,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6764,7 +6764,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6790,7 +6790,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6816,7 +6816,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6842,7 +6842,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6868,7 +6868,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6894,7 +6894,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6920,7 +6920,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -6938,8 +6938,8 @@ trip-point0 { }; cpuss2-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -6956,8 +6956,8 @@ trip-point0 { }; cpuss2-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -6974,8 +6974,8 @@ trip-point0 { }; aoss0-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7000,7 +7000,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7026,7 +7026,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7052,7 +7052,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7078,7 +7078,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7104,7 +7104,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7130,7 +7130,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7156,7 +7156,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7182,7 +7182,7 @@ trip-point1 { }; cpu-critical { - temperature = <110000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7200,8 +7200,8 @@ trip-point0 { }; cpuss2-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7218,8 +7218,8 @@ trip-point0 { }; cpuss2-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7236,8 +7236,8 @@ trip-point0 { }; aoss0-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7254,8 +7254,8 @@ trip-point0 { }; nsp0-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7272,8 +7272,8 @@ trip-point0 { }; nsp1-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7290,8 +7290,8 @@ trip-point0 { }; nsp2-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7308,8 +7308,8 @@ trip-point0 { }; nsp3-critical { - temperature = <125000>; - hysteresis = <0>; + temperature = <115000>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7334,7 +7334,7 @@ trip-point1 { }; trip-point2 { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7360,7 +7360,7 @@ trip-point1 { }; trip-point2 { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7386,7 +7386,7 @@ trip-point1 { }; trip-point2 { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7412,7 +7412,7 @@ trip-point1 { }; trip-point2 { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7438,7 +7438,7 @@ trip-point1 { }; trip-point2 { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7464,7 +7464,7 @@ trip-point1 { }; trip-point2 { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7490,7 +7490,7 @@ trip-point1 { }; trip-point2 { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7516,7 +7516,7 @@ trip-point1 { }; trip-point2 { - temperature = <125000>; + temperature = <115000>; hysteresis = <1000>; type = "critical"; };
@@ -7535,7 +7535,7 @@ trip-point0 { camera0-critical { temperature = <115000>; - hysteresis = <0>; + hysteresis = <1000>; type = "critical"; }; };
@@ -7553,7 +7553,7 @@ trip-point0 { camera0-critical { temperature = <115000>; - hysteresis = <0>; + hysteresis = <1000>; type = "critical"; }; };
Signature · 1 line
2.39.5