6.17.8-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 130/849 bpf: Use tnums for JEQ/JNE is_branch_taken logic
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Chaignon <[email protected]>
[ Upstream commit f41345f47fb267a9c95ca710c33448f8d0d81d83 ]
In the following toy program (reg states minimized for readability), R0 and R1 always have different values at instruction 6. This is obvious when reading the program but cannot be guessed from ranges alone as they overlap (R0 in [0; 0xc0000000], R1 in [1024; 0xc0000400]).
0: call bpf_get_prandom_u32#7 ; R0_w=scalar() 1: w0 = w0 ; R0_w=scalar(var_off=(0x0; 0xffffffff)) 2: r0 >>= 30 ; R0_w=scalar(var_off=(0x0; 0x3)) 3: r0 <<= 30 ; R0_w=scalar(var_off=(0x0; 0xc0000000)) 4: r1 = r0 ; R1_w=scalar(var_off=(0x0; 0xc0000000)) 5: r1 += 1024 ; R1_w=scalar(var_off=(0x400; 0xc0000000))
6: if r1 != r0 goto pc+1
Looking at tnums however, we can deduce that R1 is always different from R0 because their tnums don't agree on known bits. This patch uses this logic to improve is_scalar_branch_taken in case of BPF_JEQ and BPF_JNE.
This change has a tiny impact on complexity, which was measured with the Cilium complexity CI test. That test covers 72 programs with various build and load time configurations for a total of 970 test cases. For 80% of test cases, the patch has no impact. On the other test cases, the patch decreases complexity by only 0.08% on average. In the best case, the verifier needs to walk 3% less instructions and, in the worst case, 1.5% more. Overall, the patch has a small positive impact, especially for our largest programs.
--- include/linux/tnum.h | 3 +++ kernel/bpf/tnum.c | 8 ++++++++ kernel/bpf/verifier.c | 4 ++++ 3 files changed, 15 insertions(+)
include/linux/tnum.h +3 -0
@@ -51,6 +51,9 @@ struct tnum tnum_xor(struct tnum a, struct tnum b);/* Multiply two tnums, return @a * @b */ struct tnum tnum_mul (struct tnum a,struct tnum b); +/* Return true if the known bits of both tnums have the same value */ +bool tnum_overlap (struct tnum a,struct tnum b); +/* Return a tnum representing numbers satisfying both @a and @b */ struct tnum tnum_intersect (struct tnum a,struct tnum b);
kernel/bpf/tnum.c +8 -0
@@ -143,6 +143,14 @@ struct tnum tnum_mul(struct tnum a, struct tnum b)return tnum_add (TNUM (acc_v,0 ), acc_m); } +bool tnum_overlap (struct tnum a,struct tnum b) +{ +u64 mu; + + mu = ~a.mask & ~b.mask; +return (a.value & mu) == (b.value & mu); +} +/* Note that if a and b disagree - i.e. one has a 'known 1' where the other has * a 'known 0' - this will return a 'known 1' for that bit. */
kernel/bpf/verifier.c +4 -0
@@ -15906,6 +15906,8 @@ static int is_scalar_branch_taken(struct bpf_reg_state *reg1, struct bpf_reg_sta*/ if (tnum_is_const (t1) &&tnum_is_const (t2))return t1.value == t2.value; +if (!tnum_overlap (t1, t2)) +return 0 ;/* non-overlapping ranges */ if (umin1 > umax2 || umax1 < umin2)return 0 ;
@@ -15930,6 +15932,8 @@ static int is_scalar_branch_taken(struct bpf_reg_state *reg1, struct bpf_reg_sta*/ if (tnum_is_const (t1) &&tnum_is_const (t2))return t1.value != t2.value; +if (!tnum_overlap (t1, t2)) +return 1 ;/* non-overlapping ranges */ if (umin1 > umax2 || umax1 < umin2)return 1 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 131/849 firmware: ti_sci: Enable abort handling of entry to LPM
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kendall Willis <[email protected]>
[ Upstream commit 0fdd3240fe5a9bf4785e40506bf86b7e16546b83 ]
The PM co-processor (device manager or DM) adds the ability to abort entry to a low power mode by clearing the mode selection in the latest version of its firmware (11.01.09) [1].
Enable the ti_sci driver to support the LPM abort call which clears the low power mode selection of the DM. This fixes an issue where failed system suspend attempts would cause subsequent suspends to fail.
After system suspend completes, regardless of if system suspend succeeds or fails, the ->complete() hook in TI SCI will be called. In the ->complete() hook, a message will be sent to the DM to clear the current low power mode selection. Clearing the low power mode selection unconditionally will not cause any error in the DM.
[1] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/lpm.html
--- drivers/firmware/ti_sci.c | 57 +++++++++++++++++++++++++++++++++++++-- drivers/firmware/ti_sci.h | 3 +++ 2 files changed, 58 insertions(+), 2 deletions(-)
drivers/firmware/ti_sci.c +55 -2
@@ -2015,6 +2015,47 @@ static int ti_sci_cmd_set_latency_constraint(const struct ti_sci_handle *handle,return ret; } +/** +* ti_sci_cmd_lpm_abort() - Abort entry to LPM by clearing selection of LPM to enter +* @dev: Device pointer corresponding to the SCI entity +* +* Return: 0 if all went well, else returns appropriate error value. +*/ +static int ti_sci_cmd_lpm_abort (struct device *dev) +{ +struct ti_sci_info *info =dev_get_drvdata (dev); +struct ti_sci_msg_hdr *req; +struct ti_sci_msg_hdr *resp; +struct ti_sci_xfer *xfer; +int ret =0 ; + + xfer =ti_sci_get_one_xfer (info,TI_SCI_MSG_LPM_ABORT , +TI_SCI_FLAG_REQ_ACK_ON_PROCESSED , +sizeof (*req),sizeof (*resp)); +if (IS_ERR (xfer)) { + ret =PTR_ERR (xfer); +dev_err (dev,"Message alloc failed(%d)\n" , ret); +return ret; + } + req = (struct ti_sci_msg_hdr *)xfer->xfer_buf; + + ret =ti_sci_do_xfer (info, xfer); +if (ret) { +dev_err (dev,"Mbox send fail %d\n" , ret); + goto fail; + } + + resp = (struct ti_sci_msg_hdr *)xfer->xfer_buf; + +if (!ti_sci_is_response_ack (resp)) + ret = -ENODEV ; + +fail: +ti_sci_put_one_xfer (&info->minfo, xfer); + +return ret; +} +static int ti_sci_cmd_core_reboot (const struct ti_sci_handle *handle) {struct ti_sci_info *info;
@@ -3739,11 +3780,22 @@ static int __maybe_unused ti_sci_resume_noirq(struct device *dev)return 0 ; } +static void __maybe_unused ti_sci_pm_complete (struct device *dev) +{ +struct ti_sci_info *info =dev_get_drvdata (dev); + +if (info->fw_caps &MSG_FLAG_CAPS_LPM_ABORT ) { +if (ti_sci_cmd_lpm_abort (dev)) +dev_err (dev,"LPM clear selection failed.\n" ); + } +} +static const struct dev_pm_ops ti_sci_pm_ops = { #ifdef CONFIG_PM_SLEEP .suspend = ti_sci_suspend, .suspend_noirq = ti_sci_suspend_noirq, .resume_noirq = ti_sci_resume_noirq, + .complete = ti_sci_pm_complete, #endif };
@@ -3876,10 +3928,11 @@ static int ti_sci_probe(struct platform_device *pdev) }ti_sci_msg_cmd_query_fw_caps (&info->handle, &info->fw_caps); -dev_dbg (dev,"Detected firmware capabilities: %s%s%s\n" , +dev_dbg (dev,"Detected firmware capabilities: %s%s%s%s\n" , info->fw_caps &MSG_FLAG_CAPS_GENERIC ?"Generic" :"" , info->fw_caps &MSG_FLAG_CAPS_LPM_PARTIAL_IO ?" Partial-IO" :"" , - info->fw_caps &MSG_FLAG_CAPS_LPM_DM_MANAGED ?" DM-Managed" :"" + info->fw_caps &MSG_FLAG_CAPS_LPM_DM_MANAGED ?" DM-Managed" :"" , + info->fw_caps &MSG_FLAG_CAPS_LPM_ABORT ?" LPM-Abort" :"" );ti_sci_setup_ops (info);
drivers/firmware/ti_sci.h +3 -0
@@ -42,6 +42,7 @@#define TI_SCI_MSG_SET_IO_ISOLATION 0x0307#define TI_SCI_MSG_LPM_SET_DEVICE_CONSTRAINT 0x0309#define TI_SCI_MSG_LPM_SET_LATENCY_CONSTRAINT 0x030A +#define TI_SCI_MSG_LPM_ABORT 0x0311/* Resource Management Requests */ #define TI_SCI_MSG_GET_RESOURCE_RANGE 0x1500
@@ -147,6 +148,7 @@ struct ti_sci_msg_req_reboot {* MSG_FLAG_CAPS_GENERIC: Generic capability (LPM not supported) * MSG_FLAG_CAPS_LPM_PARTIAL_IO: Partial IO in LPM * MSG_FLAG_CAPS_LPM_DM_MANAGED: LPM can be managed by DM +* MSG_FLAG_CAPS_LPM_ABORT: Abort entry to LPM * * Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS * providing currently available SOC/firmware capabilities. SoC that don't
@@ -157,6 +159,7 @@ struct ti_sci_msg_resp_query_fw_caps {#define MSG_FLAG_CAPS_GENERIC TI_SCI_MSG_FLAG(0)#define MSG_FLAG_CAPS_LPM_PARTIAL_IO TI_SCI_MSG_FLAG(4)#define MSG_FLAG_CAPS_LPM_DM_MANAGED TI_SCI_MSG_FLAG(5) +#define MSG_FLAG_CAPS_LPM_ABORT TI_SCI_MSG_FLAG(9)#define MSG_MASK_CAPS_LPM GENMASK_ULL(4, 1)u64 fw_caps; } __packed;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 132/849 firewire: ohci: move self_id_complete tracepoint after validating register
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
[ Upstream commit 696968262aeee51e1c0529c3c060ddd180702e02 ]
The value of OHCI1394_SelfIDCount register includes an error-indicating bit. It is safer to place the tracepoint probe after validating the register value.
--- drivers/firewire/ohci.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/firewire/ohci.c +4 -8
@@ -2063,6 +2063,9 @@ static void bus_reset_work(struct work_struct *work)ohci_notice (ohci,"self ID receive error\n" );return ; } + +trace_self_id_complete (ohci->card.index, reg, ohci->self_id,has_be_header_quirk (ohci)); +/* * The count in the SelfIDCount register is the number of * bytes in the self ID receive buffer. Since we also receive
@@ -2231,15 +2234,8 @@ static irqreturn_t irq_handler(int irq, void *data)if (event & OHCI1394_busReset)reg_write (ohci, OHCI1394_IntMaskClear, OHCI1394_busReset); -if (event & OHCI1394_selfIDComplete) { -if (trace_self_id_complete_enabled ()) { -u32 reg =reg_read (ohci, OHCI1394_SelfIDCount); - -trace_self_id_complete (ohci->card.index, reg, ohci->self_id, -has_be_header_quirk (ohci)); - } +if (event & OHCI1394_selfIDComplete)queue_work (selfid_workqueue, &ohci->bus_reset_work); - }if (event & OHCI1394_RQPkt)queue_work (ohci->card.async_wq, &ohci->ar_request_ctx.work);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 133/849 irqchip/sifive-plic: Respect mask state when setting affinity
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Inochi Amaoto <[email protected]>
[ Upstream commit adecf78df945f4c7a1d29111b0002827f487df51 ]
plic_set_affinity() always calls plic_irq_enable(), which clears up the priority setting even the interrupt is only masked. This unmasks the interrupt unexpectly.
Replace the plic_irq_enable/disable() with plic_irq_toggle() to avoid changing the priority setting.
--- drivers/irqchip/irq-sifive-plic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/irqchip/irq-sifive-plic.c +4 -2
@@ -179,12 +179,14 @@ static int plic_set_affinity(struct irq_data *d,if (cpu >= nr_cpu_ids)return -EINVAL ; -plic_irq_disable (d); +/* Invalidate the original routing entry */ +plic_irq_toggle (irq_data_get_effective_affinity_mask (d), d,0 );irq_data_update_effective_affinity (d,cpumask_of (cpu)); +/* Setting the new routing entry if irq is enabled */ if (!irqd_irq_disabled (d)) -plic_irq_enable (d); +plic_irq_toggle (irq_data_get_effective_affinity_mask (d), d,1 );return IRQ_SET_MASK_OK_DONE ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 134/849 irqchip/loongson-eiointc: Route interrupt parsed from bios table
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bibo Mao <[email protected]>
[ Upstream commit 7fb83eb664e9b3a0438dd28859e9f0fd49d4c165 ]
Interrupt controller eiointc routes interrupts to CPU interface IP0 - IP7.
It is currently hard-coded that eiointc routes interrupts to the CPU starting from IP1, but it should base that decision on the parent interrupt, which is provided by ACPI or DTS.
Retrieve the parent's hardware interrupt number and store it in the descriptor of the eointc instance, so that the routing function can utilize it for the correct route settings.
[ tglx: Massaged change log ]
--- drivers/irqchip/irq-loongson-eiointc.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/irqchip/irq-loongson-eiointc.c +17 -4
@@ -68,6 +68,7 @@ struct eiointc_priv {struct fwnode_handle *domain_handle;struct irq_domain *eiointc_domain;int flags; +irq_hw_number_t parent_hwirq; };static struct eiointc_priv *eiointc_priv[MAX_IO_PICS ];
@@ -211,7 +212,12 @@ static int eiointc_router_init(unsigned int cpu) }for (i =0 ; i < eiointc_priv[0 ]->vec_count /32 /4 ; i++) { - bit =BIT (1 + index);/* Route to IP[1 + index] */ +/* +* Route to interrupt pin, relative offset used here +* Offset 0 means routing to IP0 and so on +* Every 32 vector routing to one interrupt pin +*/ + bit =BIT (eiointc_priv[index]->parent_hwirq -INT_HWI0 ); data = bit | (bit <<8 ) | (bit <<16 ) | (bit <<24 );iocsr_write32 (data,EIOINTC_REG_IPMAP + i *4 ); }
@@ -495,7 +501,7 @@ int __init eiointc_acpi_init(struct irq_domain *parent, priv->vec_count =VEC_COUNT ; priv->node = acpi_eiointc->node; - + priv->parent_hwirq = acpi_eiointc->cascade; parent_irq =irq_create_mapping (parent, acpi_eiointc->cascade); ret =eiointc_init (priv, parent_irq, acpi_eiointc->node_map);
@@ -527,8 +533,9 @@ int __init eiointc_acpi_init(struct irq_domain *parent,static int __init eiointc_of_init (struct device_node *of_node,struct device_node *parent) { -int parent_irq, ret;struct eiointc_priv *priv; +struct irq_data *irq_data; +int parent_irq, ret; priv =kzalloc (sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -544,6 +551,12 @@ static int __init eiointc_of_init(struct device_node *of_node,if (ret <0 ) goto out_free_priv; + irq_data =irq_get_irq_data (parent_irq); +if (!irq_data) { + ret = -ENODEV ; + goto out_free_priv; + } +/* * In particular, the number of devices supported by the LS2K0500 * extended I/O interrupt vector is 128.
@@ -552,7 +565,7 @@ static int __init eiointc_of_init(struct device_node *of_node, priv->vec_count =128 ; else priv->vec_count = VEC_COUNT; - + priv->parent_hwirq =irqd_to_hwirq (irq_data); priv->node =0 ; priv->domain_handle =of_fwnode_handle (of_node);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 135/849 io_uring/zctx: check chained notif contexts
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit ab3ea6eac5f45669b091309f592c4ea324003053 ]
Send zc only links ubuf_info for requests coming from the same context. There are some ambiguous syz reports, so let's check the assumption on notification completion.
--- io_uring/notif.c | 5 +++++ 1 file changed, 5 insertions(+)
io_uring/notif.c +5 -0
@@ -14,10 +14,15 @@ static const struct ubuf_info_ops io_ubuf_ops;static void io_notif_tw_complete (struct io_kiocb *notif,io_tw_token_t tw) {struct io_notif_data *nd =io_notif_to_data (notif); +struct io_ring_ctx *ctx = notif->ctx; + +lockdep_assert_held (&ctx->uring_lock); do { notif = cmd_to_io_kiocb(nd); + if (WARN_ON_ONCE(ctx != notif->ctx)) + return; lockdep_assert(refcount_read(&nd->uarg.refcnt) == 0); if (unlikely(nd->zc_report) && (nd->zc_copied || !nd->zc_used))
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 136/849 ACPI: sysfs: Use ACPI_FREE() for freeing an ACPI object
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaushlendra Kumar <[email protected]>
[ Upstream commit 149139ddcb99583fdec8d1eaf7dada41e5896101 ]
Since str_obj is allocated by ACPICA in acpi_evaluate_object_typed(), it should be free with ACPI_FREE() rather than with kfree(), so use the former instead of the latter for freeing it.
--- drivers/acpi/device_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/device_sysfs.c +1 -1
@@ -464,7 +464,7 @@ static ssize_t description_show(struct device *dev, buf[result++] ='\n' ; -kfree (str_obj); +ACPI_FREE (str_obj);return result; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 137/849 ACPI: video: force native for Lenovo 82K8
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello (AMD) <[email protected]>
[ Upstream commit f144bc21befdcf8e54d2f19b23b4e84f13be01f9 ]
Lenovo 82K8 has a broken brightness control provided by nvidia_wmi_ec. Add a quirk to prevent using it.
--- drivers/acpi/video_detect.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/video_detect.c +8 -0
@@ -948,6 +948,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"), }, }, +/* https://gitlab.freedesktop.org/drm/amd/-/issues/4512 */ + { + .callback = video_detect_force_native, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "82K8"), + }, + }, { }, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 138/849 libbpf: Fix USDT SIB argument handling causing unrecognized register error
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiawei Zhao <[email protected]>
[ Upstream commit 758acb9ccfdbf854b55abaceaf1f3f229cde3d19 ]
On x86-64, USDT arguments can be specified using Scale-Index-Base (SIB) addressing, e.g. "1@-96(%rbp,%rax,8)". The current USDT implementation in libbpf cannot parse this format, causing bpf_program__attach_usdt() to fail with -ENOENT (unrecognized register).
This patch fixes this by implementing the necessary changes:
- add correct handling for SIB-addressed arguments in bpf_usdt_arg.
- add adaptive support to __bpf_usdt_arg_type and __bpf_usdt_arg_spec to represent SIB addressing parameters.
--- tools/lib/bpf/usdt.bpf.h | 44 ++++++++++++++++++++++++++-- tools/lib/bpf/usdt.c | 62 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 99 insertions(+), 7 deletions(-)
tools/lib/bpf/usdt.bpf.h +42 -2
@@ -34,13 +34,32 @@ enum __bpf_usdt_arg_type {BPF_USDT_ARG_CONST ,BPF_USDT_ARG_REG ,BPF_USDT_ARG_REG_DEREF , + BPF_USDT_ARG_SIB, }; +/* +* This struct layout is designed specifically to be backwards/forward +* compatible between libbpf versions for ARG_CONST, ARG_REG, and +* ARG_REG_DEREF modes. ARG_SIB requires libbpf v1.7+. +*/ struct __bpf_usdt_arg_spec {/* u64 scalar interpreted depending on arg_type, see below */ __u64 val_off; +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__/* arg location case, see bpf_usdt_arg() for details */ -enum __bpf_usdt_arg_type arg_type; +enum __bpf_usdt_arg_type arg_type:8 ; +/* index register offset within struct pt_regs */ +__u16 idx_reg_off:12 ; +/* scale factor for index register (1, 2, 4, or 8) */ +__u16 scale_bitshift:4 ; +/* reserved for future use, keeps reg_off offset stable */ +__u8 __reserved:8 ; +#else +__u8 __reserved:8 ; +__u16 idx_reg_off:12 ; +__u16 scale_bitshift:4 ; +enum __bpf_usdt_arg_type arg_type:8 ; +#endif /* offset of referenced register within struct pt_regs */ short reg_off;/* whether arg should be interpreted as signed value */
@@ -149,7 +168,7 @@ int bpf_usdt_arg(struct pt_regs *ctx, __u64 arg_num, long *res) {struct __bpf_usdt_spec *spec;struct __bpf_usdt_arg_spec *arg_spec; -unsigned long val; +unsigned long val, idx;int err, spec_id; *res =0 ;
@@ -202,6 +221,27 @@ int bpf_usdt_arg(struct pt_regs *ctx, __u64 arg_num, long *res)return err;#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ val >>= arg_spec->arg_bitshift; +#endif +break ; +case BPF_USDT_ARG_SIB : +/* Arg is in memory addressed by SIB (Scale-Index-Base) mode +* (e.g., "-1@-96(%rbp,%rax,8)" in USDT arg spec). We first +* fetch the base register contents and the index register +* contents from pt_regs. Then we calculate the final address +* as base + (index * scale) + offset, and do a user-space +* probe read to fetch the argument value. +*/ + err =bpf_probe_read_kernel (&val,sizeof (val), (void *)ctx + arg_spec->reg_off); +if (err) +return err; + err =bpf_probe_read_kernel (&idx,sizeof (idx), (void *)ctx + arg_spec->idx_reg_off); +if (err) +return err; + err =bpf_probe_read_user (&val,sizeof (val), (void *)(val + (idx << arg_spec->scale_bitshift) + arg_spec->val_off)); +if (err) +return err; +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + val >>= arg_spec->arg_bitshift;#endif break ;default :
tools/lib/bpf/usdt.c +57 -5
86 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 139/849 selftests/bpf: Fix bpf_prog_detach2 usage in test_lirc_mode2
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo B. Marlière <[email protected]>
[ Upstream commit 98857d111c53954aa038fcbc4cf48873e4240f7c ]
Commit e9fc3ce99b34 ("libbpf: Streamline error reporting for high-level APIs") redefined the way that bpf_prog_detach2() returns. Therefore, adapt the usage in test_lirc_mode2_user.c.
--- tools/testing/selftests/bpf/test_lirc_mode2_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_lirc_mode2_user.c +1 -1
@@ -74,7 +74,7 @@ int main(int argc, char **argv)/* Let's try detach it before it was ever attached */ ret =bpf_prog_detach2 (progfd, lircfd,BPF_LIRC_MODE2 ); -if (ret !=-1 || errno !=ENOENT ) { +if (ret != -ENOENT ) {printf ("bpf_prog_detach2 not attached should fail: %m\n" );return 1 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 140/849 arm64: versal-net: Update rtc calibration value
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harini T <[email protected]>
[ Upstream commit b60b74f82e3ed4910a5f96a412e89bdd44875842 ]
As per the design specification
"The 16-bit Seconds Calibration Value represents the number of Oscillator Ticks that are required to measure the largest time period that is less than or equal to 1 second.
For an oscillator that is 32.768kHz, this value will be 0x7FFF."
--- arch/arm64/boot/dts/xilinx/versal-net.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/xilinx/versal-net.dtsi +1 -1
@@ -556,7 +556,7 @@ reg = <0 0xf12a0000 0 0x100>; interrupts = <0 200 4>, <0 201 4>; interrupt-names = "alarm", "sec"; - calibration = <0x8000>; + calibration = <0x7FFF>; }; sdhci0: mmc@f1040000 {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 141/849 cpufreq/longhaul: handle NULL policy in longhaul_exit
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dennis Beier <[email protected]>
[ Upstream commit 592532a77b736b5153e0c2e4c74aa50af0a352ab ]
longhaul_exit() was calling cpufreq_cpu_get(0) without checking for a NULL policy pointer. On some systems, this could lead to a NULL dereference and a kernel warning or panic.
This patch adds a check using unlikely() and returns early if the policy is NULL.
Bugzilla: #219962
--- drivers/cpufreq/longhaul.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/cpufreq/longhaul.c +3 -0
@@ -953,6 +953,9 @@ static void __exit longhaul_exit(void)struct cpufreq_policy *policy =cpufreq_cpu_get (0 );int i; +if (unlikely (!policy)) +return ; +for (i =0 ; i < numscales; i++) {if (mults[i] == maxmult) {struct cpufreq_freqs freqs;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 142/849 firmware: qcom: scm: Allow QSEECOM on Dell Inspiron 7441 / Latitude 7455
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 30ee285f1e3cdc88ec7010abeaba0cbed800bdcd ]
Allow these machines to access efivars through qseecom/uefisecapp.
--- drivers/firmware/qcom/qcom_scm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/firmware/qcom/qcom_scm.c +2 -0
@@ -1994,6 +1994,8 @@ static const struct of_device_id qcom_scm_qseecom_allowlist[] __maybe_unused = { { .compatible = "asus,vivobook-s15" }, { .compatible = "asus,zenbook-a14-ux3407qa" }, { .compatible = "asus,zenbook-a14-ux3407ra" }, + { .compatible = "dell,inspiron-14-plus-7441" }, + { .compatible = "dell,latitude-7455" }, { .compatible = "dell,xps13-9345" }, { .compatible = "hp,elitebook-ultra-g1q" }, { .compatible = "hp,omnibook-x14" },
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 143/849 kselftest/arm64: tpidr2: Switch to waitpid() over wait4()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 61a3cf7934b6da3c926cd9961860dd94eb7192ba ]
wait4() is deprecated, non-standard and about to be removed from nolibc.
Switch to the equivalent waitpid() call.
--- tools/testing/selftests/arm64/abi/tpidr2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/arm64/abi/tpidr2.c +3 -3
@@ -182,16 +182,16 @@ static int write_clone_read(void) }for (;;) { - waiting =wait4 (ret, &status, __WCLONE,NULL ); + waiting =waitpid (ret, &status, __WCLONE);if (waiting <0 ) {if (errno ==EINTR )continue ; -ksft_print_msg ("wait4() failed: %d\n" , errno); +ksft_print_msg ("waitpid() failed: %d\n" , errno);return 0 ; }if (waiting != ret) { -ksft_print_msg ("wait4() returned wrong PID %d\n" , +ksft_print_msg ("waitpid() returned wrong PID %d\n" , waiting);return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 144/849 arc: Fix __fls() const-foldability via __builtin_clzl()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit a3fecb9160482367365cc384c59dd220b162b066 ]
While tracking down a problem where constant expressions used by BUILD_BUG_ON() suddenly stopped working[1], we found that an added static initializer was convincing the compiler that it couldn't track the state of the prior statically initialized value. Tracing this down found that ffs() was used in the initializer macro, but since it wasn't marked with __attribute__const__, the compiler had to assume the function might change variable states as a side-effect (which is not true for ffs(), which provides deterministic math results).
For arc architecture with CONFIG_ISA_ARCV2=y, the __fls() function uses __builtin_arc_fls() which lacks GCC's const attribute, preventing compile-time constant folding, and KUnit testing of ffs/fls fails on arc[3]. A patch[2] to GCC to solve this has been sent.
Add a fix for this by handling compile-time constants with the standard __builtin_clzl() builtin (which has const attribute) while preserving the optimized arc-specific builtin for runtime cases. This has the added benefit of skipping runtime calculation of compile-time constant values. Even with the GCC bug fixed (which is about "attribute const") this is a good change to avoid needless runtime costs, and should be done regardless of the state of GCC's bug.
Build tested ARCH=arc allyesconfig with GCC arc-linux 15.2.0.
--- arch/arc/include/asm/bitops.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arc/include/asm/bitops.h +2 -0
@@ -133,6 +133,8 @@ static inline __attribute__ ((const)) int fls(unsigned int x)*/ static inline __attribute__ ((const))unsigned long __fls (unsigned long x) { +if (__builtin_constant_p (x)) +return x ?BITS_PER_LONG -1 -__builtin_clzl (x) :0 ;/* FLS insn has exactly same semantics as the API */ return __builtin_arc_fls (x); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 145/849 bpftool: Add CET-aware symbol matching for x86_64 architectures
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit 6417ca85305ecaffef13cf9063ac35da8fba8500 ]
Adjust symbol matching logic to account for Control-flow Enforcement Technology (CET) on x86_64 systems. CET prefixes functions with a 4-byte 'endbr' instruction, shifting the actual hook entry point to symbol + 4.
--- tools/bpf/bpftool/link.c | 54 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-)
tools/bpf/bpftool/link.c +50 -4
@@ -282,11 +282,52 @@ get_addr_cookie_array(__u64 *addrs, __u64 *cookies, __u32 count)return data; } +static bool is_x86_ibt_enabled (void ) +{ +#if defined(__x86_64__) +struct kernel_config_option options[] = { + {"CONFIG_X86_KERNEL_IBT" , }, + }; +char *values[ARRAY_SIZE (options)] = { }; +bool ret; + +if (read_kernel_config (options,ARRAY_SIZE (options), values,NULL )) +return false; + + ret = !!values[0 ]; +free (values[0 ]); +return ret; +#else +return false; +#endif +} + +static bool +symbol_matches_target (__u64 sym_addr,__u64 target_addr,bool is_ibt_enabled) +{ +if (sym_addr == target_addr) +return true; + +/* +* On x86_64 architectures with CET (Control-flow Enforcement Technology), +* function entry points have a 4-byte 'endbr' instruction prefix. +* This causes kprobe hooks to target the address *after* 'endbr' +* (symbol address + 4), preserving the CET instruction. +* Here we check if the symbol address matches the hook target address +* minus 4, indicating a CET-enabled function entry point. +*/ +if (is_ibt_enabled && sym_addr == target_addr -4 ) +return true; + +return false; +} +static void show_kprobe_multi_json (struct bpf_link_info *info,json_writer_t *wtr) {struct addr_cookie *data;__u32 i, j =0 ; +bool is_ibt_enabled;jsonw_bool_field (json_wtr,"retprobe" , info->kprobe_multi.flags &BPF_F_KPROBE_MULTI_RETURN );
@@ -306,11 +347,13 @@ show_kprobe_multi_json(struct bpf_link_info *info, json_writer_t *wtr)if (!dd.sym_count) goto error; + is_ibt_enabled =is_x86_ibt_enabled ();for (i =0 ; i < dd.sym_count; i++) { -if (dd.sym_mapping[i].address != data[j].addr) +if (!symbol_matches_target (dd.sym_mapping[i].address, + data[j].addr, is_ibt_enabled))continue ;jsonw_start_object (json_wtr); -jsonw_uint_field (json_wtr,"addr" , dd.sym_mapping[i].address); +jsonw_uint_field (json_wtr,"addr" , (unsigned long )data[j].addr);jsonw_string_field (json_wtr,"func" , dd.sym_mapping[i].name);/* Print null if it is vmlinux */ if (dd.sym_mapping[i].module[0 ] =='\0' ) {
@@ -719,6 +762,7 @@ static void show_kprobe_multi_plain(struct bpf_link_info *info) {struct addr_cookie *data;__u32 i, j =0 ; +bool is_ibt_enabled;if (!info->kprobe_multi.count)return ;
@@ -742,12 +786,14 @@ static void show_kprobe_multi_plain(struct bpf_link_info *info)if (!dd.sym_count) goto error; + is_ibt_enabled =is_x86_ibt_enabled ();printf ("\n\t%-16s %-16s %s" ,"addr" ,"cookie" ,"func [module]" );for (i =0 ; i < dd.sym_count; i++) { -if (dd.sym_mapping[i].address != data[j].addr) +if (!symbol_matches_target (dd.sym_mapping[i].address, + data[j].addr, is_ibt_enabled))continue ;printf ("\n\t%016lx %-16llx %s" , - dd.sym_mapping[i].address, data[j].cookie, dd.sym_mapping[i].name); + (unsigned long )data[j].addr, data[j].cookie, dd.sym_mapping[i].name);if (dd.sym_mapping[i].module[0 ] !='\0' )printf (" [%s] " , dd.sym_mapping[i].module);else
Signature · 1 line
2.51.0
Re: [PATCH 6.17 145/849] bpftool: Add CET-aware symbol matching for x86_64 architectures
Below patch broke by rpm build for Fedora (based on Fedora's official srpms) for me when building bpftool:
"""link.c: In function ‘is_x86_ibt_enabled’:
link.c:288:37: error: array type has incomplete element type ‘struct kernel_config_option’
288 | struct kernel_config_option options[] = {
| ^~~~~~~
[...]
cc1: all warnings being treated as errors
make[2]: *** [Makefile:259: /builddir/build/BUILD/kernel-6.17.8-build/kernel-6.17.8-rc1/linux-6.17.8-0.rc1.300.vanilla.fc43.x86_64/tools/testing/selftests/bpf/tools/build/bpftool/link.o] Error 1 """
Reverting below change fixed things for me.
Haven't tried yet, but according from a quick search on lore as well as what Sasha's AI says in
https://lore.kernel.org/all/[email protected]/
it might also be possible to fix this by backporting 70f32a10ad423 ("bpftool: Refactor kernel config reading into common helper")
Ciao, Thorsten
Quoted 122 lines · Greg Kroah-Hartman
6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit
6417ca85305ecaffef13cf9063ac35da8fba8500]Adjust symbol matching logic to account for Control-flow Enforcement Technology (CET) on
x86_64systems. CET prefixes functions with a 4-byte 'endbr' instruction, shifting the actual hook entry point to symbol + 4.Signed-off-by Yuan Chen <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>Acked-by Quentin Monnet <[email protected]>Acked-by Yonghong Song <[email protected]>Acked-by Jiri Olsa <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- tools/bpf/bpftool/link.c | 54 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-)tools/bpf/bpftool/link.c +50
-4@@ -282,11 +282,52 @@ get_addr_cookie_array(__u64 *addrs, __u64 *cookies, __u32 count)return data; } +static bool is_x86_ibt_enabled (void ) +{ +#if defined(__x86_64__) +struct kernel_config_option options[] = { + {"CONFIG_X86_KERNEL_IBT" , }, + }; +char *values[ARRAY_SIZE (options)] = { }; +bool ret; + +if (read_kernel_config (options,ARRAY_SIZE (options), values,NULL )) +return false; + + ret = !!values[0 ]; +free (values[0 ]); +return ret; +#else +return false; +#endif +} + +static bool +symbol_matches_target (__u64 sym_addr,__u64 target_addr,bool is_ibt_enabled) +{ +if (sym_addr == target_addr) +return true; + +/* +* On x86_64 architectures with CET (Control-flow Enforcement Technology), +* function entry points have a 4-byte 'endbr' instruction prefix. +* This causes kprobe hooks to target the address *after* 'endbr' +* (symbol address + 4), preserving the CET instruction. +* Here we check if the symbol address matches the hook target address +* minus 4, indicating a CET-enabled function entry point. +*/ +if (is_ibt_enabled && sym_addr == target_addr -4 ) +return true; + +return false; +} +static void show_kprobe_multi_json (struct bpf_link_info *info,json_writer_t *wtr) {struct addr_cookie *data;__u32 i, j =0 ; +bool is_ibt_enabled;jsonw_bool_field (json_wtr,"retprobe" , info->kprobe_multi.flags &BPF_F_KPROBE_MULTI_RETURN );@@ -306,11 +347,13 @@ show_kprobe_multi_json(struct bpf_link_info *info, json_writer_t *wtr)if (!dd.sym_count) goto error; + is_ibt_enabled =is_x86_ibt_enabled ();for (i =0 ; i < dd.sym_count; i++) { -if (dd.sym_mapping[i].address != data[j].addr) +if (!symbol_matches_target (dd.sym_mapping[i].address, + data[j].addr, is_ibt_enabled))continue ;jsonw_start_object (json_wtr); -jsonw_uint_field (json_wtr,"addr" , dd.sym_mapping[i].address); +jsonw_uint_field (json_wtr,"addr" , (unsigned long )data[j].addr);jsonw_string_field (json_wtr,"func" , dd.sym_mapping[i].name);/* Print null if it is vmlinux */ if (dd.sym_mapping[i].module[0 ] =='\0' ) {@@ -719,6 +762,7 @@ static void show_kprobe_multi_plain(struct bpf_link_info *info) {struct addr_cookie *data;__u32 i, j =0 ; +bool is_ibt_enabled;if (!info->kprobe_multi.count)return ;@@ -742,12 +786,14 @@ static void show_kprobe_multi_plain(struct bpf_link_info *info)if (!dd.sym_count) goto error; + is_ibt_enabled =is_x86_ibt_enabled ();printf ("\n\t%-16s %-16s %s" ,"addr" ,"cookie" ,"func [module]" );for (i =0 ; i < dd.sym_count; i++) { -if (dd.sym_mapping[i].address != data[j].addr) +if (!symbol_matches_target (dd.sym_mapping[i].address, + data[j].addr, is_ibt_enabled))continue ;printf ("\n\t%016lx %-16llx %s" , - dd.sym_mapping[i].address, data[j].cookie, dd.sym_mapping[i].name); + (unsigned long )data[j].addr, data[j].cookie, dd.sym_mapping[i].name);if (dd.sym_mapping[i].module[0 ] !='\0' )printf (" [%s] " , dd.sym_mapping[i].module);else
Greg Kroah-Hartman
maintainerRe: [PATCH 6.17 145/849] bpftool: Add CET-aware symbol matching for x86_64 architectures
Quoted 16 lines · Thorsten Leemhuis
Below patch broke by rpm build for Fedora (based on Fedora's official srpms) for me when building bpftool:
"""
link.c: In function ‘is_x86_ibt_enabled’:
link.c:288:37: error: array type has incomplete element type ‘struct kernel_config_option’
288 | structkernel_config_optionoptions[] = {
| ^~~~~~~
[...]
cc1: all warnings being treated as errors
make[2]: *** [Makefile:259: /builddir/build/BUILD/kernel-6.17.8-build/kernel-6.17.8-rc1/linux-6.17.8-0.rc1.300.vanilla.fc43.x86_64/tools/testing/selftests/bpf/tools/build/bpftool/link.o] Error 1 """
Quoted 7 lines
Reverting below change fixed things for me.
Haven't tried yet, but according from a quick search on lore as well as what Sasha's AI says in
https://lore.kernel.org/all/[email protected]/
it might also be possible to fix this by backporting70f32a10ad423("bpftool: Refactor kernel config reading into common helper")
I've just now dropped the offending commit, thanks for testing!
greg k-h
Re: [PATCH 6.17 145/849] bpftool: Add CET-aware symbol matching for x86_64 architectures
In reply to Greg Kroah-HartmanQuoted 13 lines · Greg Kroah-Hartman
6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit
6417ca85305ecaffef13cf9063ac35da8fba8500]Adjust symbol matching logic to account for Control-flow Enforcement Technology (CET) on
x86_64systems. CET prefixes functions with a 4-byte 'endbr' instruction, shifting the actual hook entry point to symbol + 4.
Quoted 7 lines
Signed-off-by Yuan Chen <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>Acked-by Quentin Monnet <[email protected]>Acked-by Yonghong Song <[email protected]>Acked-by Jiri Olsa <[email protected]>Signed-off-by Sasha Levin <[email protected]>
I am guessing this is missing the other patch that went with this upstream 70f32a10ad423fd19e22e71d05d0968e61316278. Without it, this patch breaks the build.
Justin
Greg Kroah-Hartman
maintainerRe: [PATCH 6.17 145/849] bpftool: Add CET-aware symbol matching for x86_64 architectures
Quoted 22 lines · Justin Forbes
Quoted 13 lines · Greg Kroah-Hartman
6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit
6417ca85305ecaffef13cf9063ac35da8fba8500]Adjust symbol matching logic to account for Control-flow Enforcement Technology (CET) on
x86_64systems. CET prefixes functions with a 4-byte 'endbr' instruction, shifting the actual hook entry point to symbol + 4.Quoted 7 lines
Signed-off-by Yuan Chen <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>Acked-by Quentin Monnet <[email protected]>Acked-by Yonghong Song <[email protected]>Acked-by Jiri Olsa <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 3 lines
I am guessing this is missing the other patch that went with this upstream
70f32a10ad423fd19e22e71d05d0968e61316278. Without it, this patch breaks the build.
Ah, thanks, I'll just drop this entirely from the trees as if people really want this they can use the tool from the latest release instead.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 146/849 selftests/bpf: Upon failures, exit with code 1 in test_xsk.sh
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo B. Marlière <[email protected]>
[ Upstream commit 2a912258c90e895363c0ffc0be8a47f112ab67b7 ]
Currently, even if some subtests fails, the end result will still yield "ok 1 selftests: bpf: test_xsk.sh". Fix it by exiting with 1 if there are any failures.
--- tools/testing/selftests/bpf/test_xsk.sh | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/test_xsk.sh +2 -0
@@ -241,4 +241,6 @@ done if [ $failures -eq 0 ]; then echo "All tests successful!" +else + exit 1 fi
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 147/849 irqchip/gic-v2m: Handle Multiple MSI base IRQ Alignment
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Bruel <[email protected]>
[ Upstream commit 2ef3886ce626dcdab0cbc452dbbebc19f57133d8 ]
The PCI Local Bus Specification 3.0 (section 6.8.1.6) allows modifying the low-order bits of the MSI Message DATA register to encode nr_irqs interrupt numbers in the log2(nr_irqs) bits for the domain.
The problem arises if the base vector (GICV2m base spi) is not aligned with nr_irqs; in this case, the low-order log2(nr_irqs) bits from the base vector conflict with the nr_irqs masking, causing the wrong MSI interrupt to be identified.
To fix this, use bitmap_find_next_zero_area_off() instead of bitmap_find_free_region() to align the initial base vector with nr_irqs.
--- drivers/irqchip/irq-gic-v2m.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/irqchip/irq-gic-v2m.c +9 -4
@@ -153,14 +153,19 @@ static int gicv2m_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, {msi_alloc_info_t *info = args;struct v2m_data *v2m =NULL , *tmp; -int hwirq, offset, i, err =0 ; +int hwirq, i, err =0 ; +unsigned long offset; +unsigned long align_mask = nr_irqs -1 ;spin_lock (&v2m_lock);list_for_each_entry (tmp, &v2m_nodes, entry) { - offset =bitmap_find_free_region (tmp->bm, tmp->nr_spis, -get_count_order (nr_irqs)); -if (offset >=0 ) { +unsigned long align_off = tmp->spi_start - (tmp->spi_start & ~align_mask); + + offset =bitmap_find_next_zero_area_off (tmp->bm, tmp->nr_spis,0 , + nr_irqs, align_mask, align_off); +if (offset < tmp->nr_spis) { v2m = tmp; +bitmap_set (v2m->bm, offset, nr_irqs);break ; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 148/849 ACPI: PRM: Skip handlers with NULL handler_address or NULL VA
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shang song (Lenovo) <[email protected]>
[ Upstream commit 311942ce763e21dacef7e53996d5a1e19b8adab1 ]
If handler_address or mapped VA is NULL, the related buffer address and VA can be ignored, so make acpi_parse_prmt() skip the current handler in those cases.
--- drivers/acpi/prmt.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/acpi/prmt.c +16 -3
@@ -150,15 +150,28 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end) th = &tm->handlers[cur_handler];guid_copy (&th->guid, (guid_t *)handler_info->handler_guid); + +/* +* Print an error message if handler_address is NULL, the parse of VA also +* can be skipped. +*/ +if (unlikely (!handler_info->handler_address)) { +pr_info ("Skipping handler with NULL address for GUID: %pUL" , + (guid_t *)handler_info->handler_guid); +continue ; + } + th->handler_addr = (void *)efi_pa_va_lookup (&th->guid, handler_info->handler_address);/* -* Print a warning message if handler_addr is zero which is not expected to -* ever happen. +* Print a warning message and skip the parse of VA if handler_addr is zero +* which is not expected to ever happen. */ -if (unlikely (!th->handler_addr)) +if (unlikely (!th->handler_addr)) {pr_warn ("Failed to find VA of handler for GUID: %pUL, PA: 0x%llx" , &th->guid, handler_info->handler_address); +continue ; + } th->static_data_buffer_addr =efi_pa_va_lookup (&th->guid, handler_info->static_data_buffer_address);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 149/849 ACPI: resource: Skip IRQ override on ASUS Vivobook Pro N6506CU
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam van Kampen <[email protected]>
[ Upstream commit 3a351de0d9c86e23b9eca25838b19468aab02f38 ]
Just like the other Vivobooks here, the N6506CU has its keyboard IRQ described as ActiveLow in the DSDT, which the kernel overrides to EdgeHigh, causing the internal keyboard not to work.
Add the N6506CU to the irq1_level_low_skip_override[] quirk table to fix this.
--- drivers/acpi/resource.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/resource.c +7 -0
@@ -510,6 +510,13 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = { DMI_MATCH(DMI_BOARD_NAME, "N6506M"), }, }, + { +/* Asus Vivobook Pro N6506CU* */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), + DMI_MATCH(DMI_BOARD_NAME, "N6506CU"), + }, + }, {/* LG Electronics 17U70P */ .matches = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 150/849 ACPI: scan: Add Intel CVS ACPI HIDs to acpi_ignore_dep_ids[]
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 4405a214df146775338a1e6232701a29024b82e1 ]
Some x86/ACPI laptops with MIPI cameras have a INTC10DE or INTC10E0 ACPI device in the _DEP dependency list of the ACPI devices for the camera- sensors (which have flags.honor_deps set).
These devices are for an Intel Vision CVS chip for which an out of tree driver is available [1].
The camera sensor works fine without a driver being loaded for this ACPI device on the 2 laptops this was tested on:
ThinkPad X1 Carbon Gen 12 (Meteor Lake)
ThinkPad X1 2-in-1 Gen 10 (Arrow Lake)
For now add these HIDs to acpi_ignore_dep_ids[] so that acpi_dev_ready_for_enumeration() will return true once the other _DEP dependencies are met and an i2c_client for the camera sensor will get instantiated.
--- drivers/acpi/scan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/scan.c +2 -0
@@ -845,6 +845,8 @@ static bool acpi_info_matches_ids(struct acpi_device_info *info,static const char *const acpi_ignore_dep_ids[] = {"PNP0D80" ,/* Windows-compatible System Power Management Controller */ "INT33BD" ,/* Intel Baytrail Mailbox Device */ +"INTC10DE" ,/* Intel CVS LNL */ +"INTC10E0" ,/* Intel CVS ARL */ "LATT2021" ,/* Lattice FW Update Client Driver */ NULL };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 151/849 thermal: gov_step_wise: Allow cooling level to be reduced earlier
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 2e82368359f63567862a0d438710ddffcb1ace83 ]
The current behavior of the Step-wise thermal governor is to increase the cooling level one step at a time after trip point threshold passing by thermal zone temperature until the temperature stops to rise. Then, nothing is done until the temperature decreases below the (possibly updated) trip point threshold, at which point the cooling level is reduced straight to the applicable minimum.
While this generally works, it is not in agreement with the throttling logic description comment in step_wise_manage() any more after some relatively recent changes, and in the case of passive cooling, it may lead to undesirable performance oscillations between high and low levels.
For this reason, modify the governor's cooling device state selection function, get_target_state(), to reduce cooling by one level even if the temperature is still above the thermal zone threshold, but the temperature has started to fall down. However, ensure that the cooling level will remain above the applicable minimum in that case to pull the zone temperature further down, possibly until it falls below the trip threshold (which may now be equal to the low temperature of the trip).
Doing so should help higher performance to be restored earlier in some cases which is desirable especially for passive trip points with relatively high hysteresis values.
--- drivers/thermal/gov_step_wise.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/thermal/gov_step_wise.c +14 -1
@@ -20,7 +20,9 @@* If the temperature is higher than a trip point, * a. if the trend is THERMAL_TREND_RAISING, use higher cooling * state for this trip point -* b. if the trend is THERMAL_TREND_DROPPING, do nothing +* b. if the trend is THERMAL_TREND_DROPPING, use a lower cooling state +* for this trip point, but keep the cooling state above the applicable +* minimum * If the temperature is lower than a trip point, * a. if the trend is THERMAL_TREND_RAISING, do nothing * b. if the trend is THERMAL_TREND_DROPPING, use lower cooling
@@ -51,6 +53,17 @@ static unsigned long get_target_state(struct thermal_instance *instance,if (throttle) {if (trend ==THERMAL_TREND_RAISING )return clamp (cur_state +1 , instance->lower, instance->upper); + +/* +* If the zone temperature is falling, the cooling level can +* be reduced, but it should still be above the lower state of +* the given thermal instance to pull the temperature further +* down. +*/ +if (trend ==THERMAL_TREND_DROPPING ) +return clamp (cur_state -1 , +min (instance->lower +1 , instance->upper), + instance->upper); }else if (trend ==THERMAL_TREND_DROPPING ) {if (cur_state <= instance->lower)return THERMAL_NO_TARGET ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 152/849 thermal: intel: selftests: workload_hint: Mask unsupported types
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <[email protected]>
[ Upstream commit 0115d063559fa6d25e41751cf455dda40aa2c856 ]
The workload hint may contain some other hints which are not defined. So mask out unsupported types. Currently only lower 4 bits of workload type hints are defined.
--- .../selftests/thermal/intel/workload_hint/workload_hint_test.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c +2 -0
@@ -144,6 +144,8 @@ int main(int argc, char **argv) ret =sscanf (index_str,"%d" , &index);if (ret <0 )break ; + + index &=0x0f ;if (index >WORKLOAD_TYPE_MAX_INDEX )printf ("Invalid workload type index\n" );else
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 153/849 power: supply: qcom_battmgr: add OOI chemistry
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Ruehl <[email protected]>
[ Upstream commit fee0904441325d83e7578ca457ec65a9d3f21264 ]
The ASUS S15 xElite model report the Li-ion battery with an OOI, hence this update the detection and return the appropriate type.
--- drivers/power/supply/qcom_battmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/supply/qcom_battmgr.c +2 -1
@@ -982,7 +982,8 @@ static void qcom_battmgr_sc8280xp_strcpy(char *dest, const char *src)static unsigned int qcom_battmgr_sc8280xp_parse_technology (const char *chemistry) { -if (!strncmp (chemistry,"LIO" ,BATTMGR_CHEMISTRY_LEN )) +if ((!strncmp (chemistry,"LIO" ,BATTMGR_CHEMISTRY_LEN )) || + (!strncmp (chemistry,"OOI" ,BATTMGR_CHEMISTRY_LEN )))return POWER_SUPPLY_TECHNOLOGY_LION ;if (!strncmp (chemistry,"LIP" ,BATTMGR_CHEMISTRY_LEN ))return POWER_SUPPLY_TECHNOLOGY_LIPO ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 154/849 hwmon: (k10temp) Add thermal support for AMD Family 1Ah-based models
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avadhut Naik <[email protected]>
[ Upstream commit f116af2eb51ed9df24911537fda32a033f1c58da ]
Add thermal info support for newer AMD Family 1Ah-based models.
--- drivers/hwmon/k10temp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hwmon/k10temp.c +9 -0
@@ -84,6 +84,13 @@ static DEFINE_MUTEX(nb_smu_ind_mutex);*/ #define AMD_I3255_STR "3255" +/* +* PCI Device IDs for AMD's Family 1Ah-based SOCs. +* Defining locally as IDs are not shared. +*/ +#define PCI_DEVICE_ID_AMD_1AH_M50H_DF_F3 0x12cb +#define PCI_DEVICE_ID_AMD_1AH_M90H_DF_F3 0x127b +struct k10temp_data {struct pci_dev *pdev;void (*read_htcreg)(struct pci_dev *pdev,u32 *regval);
@@ -556,7 +563,9 @@ static const struct pci_device_id k10temp_id_table[] = { { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_19H_M78H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M00H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M20H_DF_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M50H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M60H_DF_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M90H_DF_F3) }, { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_AMD_17H_DF_F3) }, {} };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 155/849 hwmon: (k10temp) Add device ID for Strix Halo
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rong Zhang <[email protected]>
[ Upstream commit e5d1e313d7b6272d6dfda983906d99f97ad9062b ]
The device ID of Strix Halo Data Fabric Function 3 has been in the tree since commit 0e640f0a47d8 ("x86/amd_nb: Add new PCI IDs for AMD family 0x1a"), but is somehow missing from k10temp_id_table.
Add it so that it works out of the box.
Tested on Beelink GTR9 Pro Mini PC.
--- drivers/hwmon/k10temp.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/k10temp.c +1 -0
@@ -565,6 +565,7 @@ static const struct pci_device_id k10temp_id_table[] = { { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M20H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M50H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M60H_DF_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M70H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_1AH_M90H_DF_F3) }, { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_AMD_17H_DF_F3) }, {}
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 156/849 hwmon: (lenovo-ec-sensors) Update P8 supprt
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ober <[email protected]>
[ Upstream commit 43c056ac85b60232861005765153707f1b0354b6 ]
This fixes differences for the P8 system that was initially set to the same thermal values as the P7, also adds in the PSU sensor for all of the supported systems
--- drivers/hwmon/lenovo-ec-sensors.c | 34 +++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
drivers/hwmon/lenovo-ec-sensors.c +30 -4
@@ -66,7 +66,7 @@ enum systems { LENOVO_P8, }; -static int px_temp_map[] = {0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 }; +static int px_temp_map[] = {0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,31 ,32 };static const char *const lenovo_px_ec_temp_label[] = {"CPU1" ,
@@ -84,9 +84,29 @@ static const char * const lenovo_px_ec_temp_label[] = {"PCI_Z3" ,"PCI_Z4" ,"AMB" , +"PSU1" , + "PSU2", }; -static int gen_temp_map[] = {0 ,2 ,3 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 }; +static int p8_temp_map[] = {0 ,1 ,2 ,8 ,9 ,13 ,14 ,15 ,16 ,17 ,19 ,20 ,33 }; + +static const char *const lenovo_p8_ec_temp_label[] = { +"CPU1" , +"CPU_DIMM_BANK1" , +"CPU_DIMM_BANK2" , +"M2_Z2R" , +"M2_Z3R" , +"DIMM_RIGHT" , +"DIMM_LEFT" , +"PCI_Z1" , +"PCI_Z2" , +"PCI_Z3" , +"AMB" , +"REAR_VR" , +"PSU" , +}; + +static int gen_temp_map[] = {0 ,2 ,3 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,31 };static const char *const lenovo_gen_ec_temp_label[] = { "CPU1",
@@ -101,6 +121,7 @@ static const char * const lenovo_gen_ec_temp_label[] = {"PCI_Z3" ,"PCI_Z4" ,"AMB" , + "PSU", };static int px_fan_map[] = {0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 };
@@ -293,6 +314,8 @@ static const struct hwmon_channel_info *lenovo_ec_hwmon_info_px[] = { HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL), HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MAX,
@@ -327,6 +350,7 @@ static const struct hwmon_channel_info *lenovo_ec_hwmon_info_p8[] = { HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL), HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MAX,
@@ -359,6 +383,7 @@ static const struct hwmon_channel_info *lenovo_ec_hwmon_info_p7[] = { HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL), HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MAX,
@@ -388,6 +413,7 @@ static const struct hwmon_channel_info *lenovo_ec_hwmon_info_p5[] = { HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, + HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL), HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MAX,
@@ -545,9 +571,9 @@ static int lenovo_ec_probe(struct platform_device *pdev)break ;case 3 : ec_data->fan_labels = p8_ec_fan_label; - ec_data->temp_labels = lenovo_gen_ec_temp_label; + ec_data->temp_labels = lenovo_p8_ec_temp_label; ec_data->fan_map = p8_fan_map; - ec_data->temp_map = gen_temp_map; + ec_data->temp_map = p8_temp_map; lenovo_ec_chip_info.info = lenovo_ec_hwmon_info_p8;break ;default :
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 157/849 hwmon: (sbtsi_temp) AMD CPU extended temperature range support
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuande Chen <[email protected]>
[ Upstream commit d9d61f1da35038793156c04bb13f0a1350709121 ]
Many AMD CPUs can support this feature now. We would get a wrong CPU DIE temperature if don't consider this. In low-temperature environments, the CPU die temperature can drop below zero. So many platforms would like to make extended temperature range as their default configuration. Default temperature range (0C to 255.875C).
Extended temperature range (-49C to +206.875C).
Ref Doc: AMD V3000 PPR (Doc ID #56558).
--- drivers/hwmon/sbtsi_temp.c | 46 +++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 15 deletions(-)
drivers/hwmon/sbtsi_temp.c +31 -15
@@ -14,6 +14,7 @@#include <linux/module.h> #include <linux/mutex.h> #include <linux/of.h> +#include <linux/bitfield.h> /* * SB-TSI registers only support SMBus byte data access. "_INT" registers are
@@ -29,8 +30,22 @@#define SBTSI_REG_TEMP_HIGH_DEC 0x13/* RW */ #define SBTSI_REG_TEMP_LOW_DEC 0x14/* RW */ +/* +* Bit for reporting value with temperature measurement range. +* bit == 0: Use default temperature range (0C to 255.875C). +* bit == 1: Use extended temperature range (-49C to +206.875C). +*/ +#define SBTSI_CONFIG_EXT_RANGE_SHIFT 2 +/* +* ReadOrder bit specifies the reading order of integer and decimal part of +* CPU temperature for atomic reads. If bit == 0, reading integer part triggers +* latching of the decimal part, so integer part should be read first. +* If bit == 1, read order should be reversed. +*/ #define SBTSI_CONFIG_READ_ORDER_SHIFT 5 +#define SBTSI_TEMP_EXT_RANGE_ADJ 49000 +#define SBTSI_TEMP_MIN 0#define SBTSI_TEMP_MAX 255875
@@ -38,6 +53,8 @@struct sbtsi_data {struct i2c_client *client;struct mutex lock; +bool ext_range_mode; +bool read_order; };/*
@@ -74,23 +91,11 @@ static int sbtsi_read(struct device *dev, enum hwmon_sensor_types type, {struct sbtsi_data *data =dev_get_drvdata (dev);s32 temp_int, temp_dec; -int err;switch (attr) {case hwmon_temp_input: -/* -* ReadOrder bit specifies the reading order of integer and -* decimal part of CPU temp for atomic reads. If bit == 0, -* reading integer part triggers latching of the decimal part, -* so integer part should be read first. If bit == 1, read -* order should be reversed. -*/ - err =i2c_smbus_read_byte_data (data->client,SBTSI_REG_CONFIG ); -if (err <0 ) -return err; -mutex_lock (&data->lock); -if (err &BIT (SBTSI_CONFIG_READ_ORDER_SHIFT )) { +if (data->read_order) { temp_dec =i2c_smbus_read_byte_data (data->client,SBTSI_REG_TEMP_DEC ); temp_int =i2c_smbus_read_byte_data (data->client,SBTSI_REG_TEMP_INT ); }else {
@@ -122,6 +127,8 @@ static int sbtsi_read(struct device *dev, enum hwmon_sensor_types type,return temp_dec; *val =sbtsi_reg_to_mc (temp_int, temp_dec); +if (data->ext_range_mode) + *val -=SBTSI_TEMP_EXT_RANGE_ADJ ;return 0 ; }
@@ -146,6 +153,8 @@ static int sbtsi_write(struct device *dev, enum hwmon_sensor_types type,return -EINVAL ; } +if (data->ext_range_mode) + val +=SBTSI_TEMP_EXT_RANGE_ADJ ; val =clamp_val (val,SBTSI_TEMP_MIN ,SBTSI_TEMP_MAX );sbtsi_mc_to_reg (val, &temp_int, &temp_dec);
@@ -203,6 +212,7 @@ static int sbtsi_probe(struct i2c_client *client)struct device *dev = &client->dev;struct device *hwmon_dev;struct sbtsi_data *data; +int err; data =devm_kzalloc (dev,sizeof (struct sbtsi_data ),GFP_KERNEL );if (!data)
@@ -211,8 +221,14 @@ static int sbtsi_probe(struct i2c_client *client) data->client = client;mutex_init (&data->lock); - hwmon_dev =devm_hwmon_device_register_with_info (dev, client->name, data, &sbtsi_chip_info, -NULL ); + err =i2c_smbus_read_byte_data (data->client,SBTSI_REG_CONFIG ); +if (err <0 ) +return err; + data->ext_range_mode =FIELD_GET (BIT (SBTSI_CONFIG_EXT_RANGE_SHIFT ), err); + data->read_order =FIELD_GET (BIT (SBTSI_CONFIG_READ_ORDER_SHIFT ), err); + + hwmon_dev =devm_hwmon_device_register_with_info (dev, client->name, data, + &sbtsi_chip_info,NULL );return PTR_ERR_OR_ZERO (hwmon_dev); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 158/849 pinctrl: renesas: rzg2l: Add suspend/resume support for Schmitt control registers
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biju Das <[email protected]>
[ Upstream commit 837afa592c6234be82acb5d23e0a39e9befdaa85 ]
Renesas RZ/G3E supports a power-saving mode where power to most of the SoC components is lost, including the PIN controller. Save and restore the Schmitt control register contents to ensure the functionality is preserved after a suspend/resume cycle.
--- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/pinctrl/renesas/pinctrl-rzg2l.c +11 -1
@@ -320,6 +320,7 @@ struct rzg2l_pinctrl_pin_settings {* @iolh: IOLH registers cache * @pupd: PUPD registers cache * @ien: IEN registers cache +* @smt: SMT registers cache * @sd_ch: SD_CH registers cache * @eth_poc: ET_POC registers cache * @eth_mode: ETH_MODE register cache
@@ -333,6 +334,7 @@ struct rzg2l_pinctrl_reg_cache {u32 *iolh[2 ];u32 *ien[2 ];u32 *pupd[2 ]; +u32 *smt;u8 sd_ch[2 ];u8 eth_poc[2 ];u8 eth_mode;
@@ -2719,6 +2721,10 @@ static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl)if (!cache->pfc)return -ENOMEM ; + cache->smt =devm_kcalloc (pctrl->dev, nports,sizeof (*cache->smt),GFP_KERNEL ); +if (!cache->smt) +return -ENOMEM ; +for (u8 i =0 ; i <2 ; i++) {u32 n_dedicated_pins = pctrl->data->n_dedicated_pins;
@@ -2980,7 +2986,7 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspenstruct rzg2l_pinctrl_reg_cache *cache = pctrl->cache;for (u32 port =0 ; port < nports; port++) { -bool has_iolh, has_ien, has_pupd; +bool has_iolh, has_ien, has_pupd, has_smt;u32 off, caps;u8 pincnt;u64 cfg;
@@ -2993,6 +2999,7 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen has_iolh = !!(caps & (PIN_CFG_IOLH_A |PIN_CFG_IOLH_B |PIN_CFG_IOLH_C )); has_ien = !!(caps &PIN_CFG_IEN ); has_pupd = !!(caps &PIN_CFG_PUPD ); + has_smt = !!(caps &PIN_CFG_SMT );if (suspend)RZG2L_PCTRL_REG_ACCESS32 (suspend, pctrl->base +PFC (off), cache->pfc[port]);
@@ -3031,6 +3038,9 @@ static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspen cache->ien[1][port]); } } + +if (has_smt) +RZG2L_PCTRL_REG_ACCESS32 (suspend, pctrl->base +SMT (off), cache->smt[port]); } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 159/849 pinctrl: keembay: release allocated memory in detach path
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
[ Upstream commit aae7a2876c3b39d07aa7655ea082af8e7862f3a5 ]
Unlike all the other allocations in this driver, the memory for storing the pin function descriptions allocated with kcalloc() and later resized with krealloc() is never freed. Use devres like elsewhere to handle that. While at it - replace krealloc() with more suitable devm_krealloc_array().
Note: the logic in this module is pretty convoluted and could probably use some revisiting, we should probably be able to calculate the exact amount of memory needed in advance or even skip the allocation altogether and just add each function to the radix tree separately.
--- drivers/pinctrl/pinctrl-keembay.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-keembay.c +5 -2
@@ -1603,7 +1603,8 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc)* being part of 8 (hw maximum) globally unique muxes. */ kpc->nfuncs =0 ; - keembay_funcs =kcalloc (kpc->npins *8 ,sizeof (*keembay_funcs),GFP_KERNEL ); + keembay_funcs =devm_kcalloc (kpc->dev, kpc->npins *8 , +sizeof (*keembay_funcs),GFP_KERNEL );if (!keembay_funcs)return -ENOMEM ;
@@ -1634,7 +1635,9 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc) }/* Reallocate memory based on actual number of functions */ - new_funcs =krealloc (keembay_funcs, kpc->nfuncs *sizeof (*new_funcs),GFP_KERNEL ); + new_funcs =devm_krealloc_array (kpc->dev, keembay_funcs, + kpc->nfuncs,sizeof (*new_funcs), +GFP_KERNEL );if (!new_funcs) {kfree (keembay_funcs);return -ENOMEM ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 160/849 power: supply: sbs-charger: Support multiple devices
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabien Proriol <[email protected]>
[ Upstream commit 3ec600210849cf122606e24caab85f0b936cf63c ]
If we have 2 instances of sbs-charger in the DTS, the driver probe for the second instance will fail:
[ 8.012874] sbs-battery 18-000b: sbs-battery: battery gas gauge device registered [ 8.039094] sbs-charger 18-0009: ltc4100: smart charger device registered [ 8.112911] sbs-battery 20-000b: sbs-battery: battery gas gauge device registered [ 8.134533] sysfs: cannot create duplicate filename '/class/power_supply/sbs-charger' [ 8.143871] CPU: 3 PID: 295 Comm: systemd-udevd Tainted: G O 5.10.147 #22 [ 8.151974] Hardware name: ALE AMB (DT) [ 8.155828] Call trace: [ 8.158292] dump_backtrace+0x0/0x1d4 [ 8.161960] show_stack+0x18/0x6c [ 8.165280] dump_stack+0xcc/0x128 [ 8.168687] sysfs_warn_dup+0x60/0x7c [ 8.172353] sysfs_do_create_link_sd+0xf0/0x100 [ 8.176886] sysfs_create_link+0x20/0x40 [ 8.180816] device_add+0x270/0x7a4 [ 8.184311] __power_supply_register+0x304/0x560 [ 8.188930] devm_power_supply_register+0x54/0xa0 [ 8.193644] sbs_probe+0xc0/0x214 [sbs_charger] [ 8.198183] i2c_device_probe+0x2dc/0x2f4 [ 8.202196] really_probe+0xf0/0x510 [ 8.205774] driver_probe_device+0xfc/0x160 [ 8.209960] device_driver_attach+0xc0/0xcc [ 8.214146] __driver_attach+0xc0/0x170 [ 8.218002] bus_for_each_dev+0x74/0xd4 [ 8.221862] driver_attach+0x24/0x30 [ 8.225444] bus_add_driver+0x148/0x250 [ 8.229283] driver_register+0x78/0x130 [ 8.233140] i2c_register_driver+0x4c/0xe0 [ 8.237250] sbs_driver_init+0x20/0x1000 [sbs_charger] [ 8.242424] do_one_initcall+0x50/0x1b0 [ 8.242434] do_init_module+0x44/0x230 [ 8.242438] load_module+0x2200/0x27c0 [ 8.242442] __do_sys_finit_module+0xa8/0x11c [ 8.242447] __arm64_sys_finit_module+0x20/0x30 [ 8.242457] el0_svc_common.constprop.0+0x64/0x154 [ 8.242464] do_el0_svc+0x24/0x8c [ 8.242474] el0_svc+0x10/0x20 [ 8.242481] el0_sync_handler+0x108/0x114 [ 8.242485] el0_sync+0x180/0x1c0 [ 8.243847] sbs-charger 20-0009: Failed to register power supply [ 8.287934] sbs-charger: probe of 20-0009 failed with error -17
This is mainly because the "name" field of power_supply_desc is a constant. This patch fixes the issue by reusing the same approach as sbs-battery. With this patch, the result is:
[ 7.819532] sbs-charger 18-0009: ltc4100: smart charger device registered [ 7.825305] sbs-battery 18-000b: sbs-battery: battery gas gauge device registered [ 7.887423] sbs-battery 20-000b: sbs-battery: battery gas gauge device registered [ 7.893501] sbs-charger 20-0009: ltc4100: smart charger device registered
--- drivers/power/supply/sbs-charger.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/power/supply/sbs-charger.c +13 -3
@@ -154,8 +154,7 @@ static const struct regmap_config sbs_regmap = { .val_format_endian = REGMAP_ENDIAN_LITTLE, /* since based on SMBus */ }; -static const struct power_supply_desc sbs_desc = { - .name ="sbs-charger" , +static const struct power_supply_desc sbs_default_desc = { .type =POWER_SUPPLY_TYPE_MAINS , .properties = sbs_properties, .num_properties =ARRAY_SIZE (sbs_properties),
@@ -165,9 +164,20 @@ static const struct power_supply_desc sbs_desc = {static int sbs_probe (struct i2c_client *client) {struct power_supply_config psy_cfg = {}; +struct power_supply_desc *sbs_desc;struct sbs_info *chip;int ret, val; + sbs_desc =devm_kmemdup (&client->dev, &sbs_default_desc, +sizeof (*sbs_desc),GFP_KERNEL ); +if (!sbs_desc) +return -ENOMEM ; + + sbs_desc->name =devm_kasprintf (&client->dev,GFP_KERNEL ,"sbs-%s" , +dev_name (&client->dev)); +if (!sbs_desc->name) +return -ENOMEM ; + chip =devm_kzalloc (&client->dev,sizeof (struct sbs_info ),GFP_KERNEL );if (!chip)return -ENOMEM ;
@@ -191,7 +201,7 @@ static int sbs_probe(struct i2c_client *client)return dev_err_probe (&client->dev, ret,"Failed to get device status\n" ); chip->last_state = val; - chip->power_supply =devm_power_supply_register (&client->dev, &sbs_desc, &psy_cfg); + chip->power_supply =devm_power_supply_register (&client->dev, sbs_desc, &psy_cfg);if (IS_ERR (chip->power_supply))return dev_err_probe (&client->dev,PTR_ERR (chip->power_supply),"Failed to register power supply\n" );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 161/849 io_uring/rsrc: respect submitter_task in io_register_clone_buffers()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Caleb Sander Mateos <[email protected]>
[ Upstream commit 2f076a453f75de691a081c89bce31b530153d53b ]
io_ring_ctx's enabled with IORING_SETUP_SINGLE_ISSUER are only allowed a single task submitting to the ctx. Although the documentation only mentions this restriction applying to io_uring_enter() syscalls, commit d7cce96c449e ("io_uring: limit registration w/ SINGLE_ISSUER") extends it to io_uring_register(). Ensuring only one task interacts with the io_ring_ctx will be important to allow this task to avoid taking the uring_lock.
There is, however, one gap in these checks: io_register_clone_buffers() may take the uring_lock on a second (source) io_ring_ctx, but __io_uring_register() only checks the current thread against the *destination* io_ring_ctx's submitter_task. Fail the IORING_REGISTER_CLONE_BUFFERS with -EEXIST if the source io_ring_ctx has a registered submitter_task other than the current task.
--- io_uring/rsrc.c | 7 +++++++ 1 file changed, 7 insertions(+)
io_uring/rsrc.c +7 -0
@@ -1299,10 +1299,17 @@ int io_register_clone_buffers(struct io_ring_ctx *ctx, void __user *arg)if (src_ctx != ctx) {mutex_unlock (&ctx->uring_lock);lock_two_rings (ctx, src_ctx); + +if (src_ctx->submitter_task && + src_ctx->submitter_task != current) { + ret = -EEXIST ; + goto out; + } } ret =io_clone_buffers (ctx, src_ctx, &buf); +out:if (src_ctx != ctx)mutex_unlock (&src_ctx->uring_lock);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 162/849 hwmon: sy7636a: add alias
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
[ Upstream commit 80038a758b7fc0cdb6987532cbbf3f75b13e0826 ]
Add module alias to have it autoloaded.
--- drivers/hwmon/sy7636a-hwmon.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/sy7636a-hwmon.c +1 -0
@@ -104,3 +104,4 @@ module_platform_driver(sy7636a_sensor_driver);MODULE_DESCRIPTION ("SY7636A sensor driver" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:sy7636a-temperature" );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 163/849 selftests/bpf: Fix incorrect array size calculation
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit f85981327a90c51e76f60e073cb6648b2f167226 ]
The loop in bench_sockmap_prog_destroy() has two issues:
1. Using 'sizeof(ctx.fds)' as the loop bound results in the number of bytes, not the number of file descriptors, causing the loop to iterate far more times than intended.
2. The condition 'ctx.fds[0] > 0' incorrectly checks only the first fd for all iterations, potentially leaving file descriptors unclosed. Change it to 'ctx.fds[i] > 0' to check each fd properly.
These fixes ensure correct cleanup of all file descriptors when the benchmark exits.
--- tools/testing/selftests/bpf/benchs/bench_sockmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/benchs/bench_sockmap.c +3 -2
@@ -10,6 +10,7 @@#include <argp.h> #include "bench.h" #include "bench_sockmap_prog.skel.h" +#include "bpf_util.h" #define FILE_SIZE (128 * 1024)#define DATA_REPEAT_SIZE 10
@@ -124,8 +125,8 @@ static void bench_sockmap_prog_destroy(void) {int i; -for (i =0 ; i <sizeof (ctx.fds); i++) { -if (ctx.fds[0 ] >0 ) +for (i =0 ; i <ARRAY_SIZE (ctx.fds); i++) { +if (ctx.fds[i] >0 )close (ctx.fds[i]); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 164/849 block: check for valid bio while splitting
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit fec2e705729dc93de5399d8b139e4746805c3d81 ]
We're already iterating every segment, so check these for a valid IO lengths at the same time. Individual segment lengths will not be checked on passthrough commands. The read/write command segments must be sized to the dma alignment.
--- block/blk-map.c | 2 +- block/blk-merge.c | 21 +++++++++++++++++---- include/linux/bio.h | 4 ++-- include/linux/blkdev.h | 7 +++++++ 4 files changed, 27 insertions(+), 7 deletions(-)
block/blk-map.c +1 -1
@@ -443,7 +443,7 @@ int blk_rq_append_bio(struct request *rq, struct bio *bio)int ret;/* check that the data layout matches the hardware restrictions */ - ret =bio_split_rw_at (bio, lim, &nr_segs, max_bytes); + ret =bio_split_io_at (bio, lim, &nr_segs, max_bytes,0 );if (ret) {/* if we would have to split the bio, copy instead */ if (ret >0 )
block/blk-merge.c +17 -4
@@ -303,25 +303,30 @@ static unsigned int bio_split_alignment(struct bio *bio, }/** -* bio_split_rw_at - check if and where to split a read/write bio +* bio_split_io_at - check if and where to split a bio * @bio: [in] bio to be split * @lim: [in] queue limits to split based on * @segs: [out] number of segments in the bio with the first half of the sectors * @max_bytes: [in] maximum number of bytes per bio +* @len_align_mask: [in] length alignment mask for each vector * * Find out if @bio needs to be split to fit the queue limits in @lim and a * maximum size of @max_bytes. Returns a negative error number if @bio can't be * split, 0 if the bio doesn't have to be split, or a positive sector offset if * @bio needs to be split. */ -int bio_split_rw_at (struct bio *bio,const struct queue_limits *lim, -unsigned *segs,unsigned max_bytes) +int bio_split_io_at (struct bio *bio,const struct queue_limits *lim, +unsigned *segs,unsigned max_bytes,unsigned len_align_mask) {struct bio_vec bv, bvprv, *bvprvp =NULL ;struct bvec_iter iter;unsigned nsegs =0 , bytes =0 ;bio_for_each_bvec (bv, bio, iter) { +if (bv.bv_offset & lim->dma_alignment || + bv.bv_len & len_align_mask) +return -EINVAL ; +/* * If the queue doesn't support SG gaps and adding this * offset would create a gap, disallow it.
@@ -363,8 +368,16 @@ int bio_split_rw_at(struct bio *bio, const struct queue_limits *lim,* Individual bvecs might not be logical block aligned. Round down the * split size so that each bio is properly block size aligned, even if * we do not use the full hardware limits. +* +* It is possible to submit a bio that can't be split into a valid io: +* there may either be too many discontiguous vectors for the max +* segments limit, or contain virtual boundary gaps without having a +* valid block sized split. A zero byte result means one of those +* conditions occured. */ bytes =ALIGN_DOWN (bytes,bio_split_alignment (bio, lim)); +if (!bytes) +return -EINVAL ;/* * Bio splitting may cause subtle trouble such as hang when doing sync
@@ -374,7 +387,7 @@ int bio_split_rw_at(struct bio *bio, const struct queue_limits *lim,bio_clear_polled (bio);return bytes >>SECTOR_SHIFT ; } -EXPORT_SYMBOL_GPL (bio_split_rw_at); +EXPORT_SYMBOL_GPL (bio_split_io_at);struct bio *bio_split_rw (struct bio *bio,const struct queue_limits *lim,unsigned *nr_segs)
include/linux/bio.h +2 -2
@@ -322,8 +322,8 @@ static inline void bio_next_folio(struct folio_iter *fi, struct bio *bio)void bio_trim (struct bio *bio,sector_t offset,sector_t size);extern struct bio *bio_split (struct bio *bio,int sectors,gfp_t gfp,struct bio_set *bs); -int bio_split_rw_at (struct bio *bio,const struct queue_limits *lim, -unsigned *segs,unsigned max_bytes); +int bio_split_io_at (struct bio *bio,const struct queue_limits *lim, +unsigned *segs,unsigned max_bytes,unsigned len_align);/** * bio_next_split - get next @sectors from a bio, splitting if necessary
include/linux/blkdev.h +7 -0
@@ -1872,6 +1872,13 @@ bdev_atomic_write_unit_max_bytes(struct block_device *bdev) return queue_atomic_write_unit_max_bytes(bdev_get_queue(bdev)); } +static inline int bio_split_rw_at (struct bio *bio, +const struct queue_limits *lim, +unsigned *segs,unsigned max_bytes) +{ +return bio_split_io_at (bio, lim, segs, max_bytes, lim->dma_alignment); +} +#define DEFINE_IO_COMP_BATCH (name) struct io_comp_batch name = { }#endif /* _LINUX_BLKDEV_H */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 165/849 irqchip/loongson-pch-lpc: Use legacy domain for PCH-LPC IRQ controller
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Wang <[email protected]>
[ Upstream commit c33c43f71bda362b292a6e57ac41b64342dc87b3 ]
On certain Loongson platforms, drivers attempting to request a legacy ISA IRQ directly via request_irq() (e.g., IRQ 4) may fail. The virtual IRQ descriptor is not fully initialized and lacks a valid irqchip.
This issue does not affect ACPI-enumerated devices described in DSDT, as their interrupts are properly mapped via the GSI translation path. This indicates the LPC irqdomain itself is functional but is not correctly handling direct VIRQ-to-HWIRQ mappings.
The root cause is the use of irq_domain_create_linear(). This API sets up a domain for dynamic, on-demand mapping, typically triggered by a GSI request. It does not pre-populate the mappings for the legacy VIRQ range (0-15). Consequently, if no ACPI device claims a specific GSI (e.g., GSI 4), the corresponding VIRQ (e.g., VIRQ 4) is never mapped to the LPC domain. A direct call to request_irq(4, ...) then fails because the kernel cannot resolve this VIRQ to a hardware interrupt managed by the LPC controller.
The PCH-LPC interrupt controller is an i8259-compatible legacy device that requires a deterministic, static 1-to-1 mapping for IRQs 0-15 to support legacy drivers.
Fix this by replacing irq_domain_create_linear() with irq_domain_create_legacy(). This API is specifically designed for such controllers. It establishes the required static 1-to-1 VIRQ-to-HWIRQ mapping for the entire legacy range (0-15) immediately upon domain creation. This ensures that any VIRQ in this range is always resolvable, making direct calls to request_irq() for legacy IRQs function correctly.
--- drivers/irqchip/irq-loongson-pch-lpc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/irqchip/irq-loongson-pch-lpc.c +7 -2
@@ -200,8 +200,13 @@ int __init pch_lpc_acpi_init(struct irq_domain *parent, goto iounmap_base; } - priv->lpc_domain =irq_domain_create_linear (irq_handle,LPC_COUNT , - &pch_lpc_domain_ops, priv); +/* +* The LPC interrupt controller is a legacy i8259-compatible device, +* which requires a static 1:1 mapping for IRQs 0-15. +* Use irq_domain_create_legacy to establish this static mapping early. +*/ + priv->lpc_domain =irq_domain_create_legacy (irq_handle,LPC_COUNT ,0 ,0 , + &pch_lpc_domain_ops, priv);if (!priv->lpc_domain) {pr_err ("Failed to create IRQ domain\n" ); goto free_irq_handle;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 166/849 cpufreq: ondemand: Update the efficient idle check for Intel extended Families
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sohil Mehta <[email protected]>
[ Upstream commit 7f3cfb7943d27a7b61bdac8db739cf0bdc28e87d ]
IO time is considered busy by default for modern Intel processors. The current check covers recent Family 6 models but excludes the brand new Families 18 and 19.
According to Arjan van de Ven, the model check was mainly due to a lack of testing on systems before INTEL_CORE2_MEROM. He suggests considering all Intel processors as having an efficient idle.
Extend the IO busy classification to all Intel processors starting with Family 6, including Family 15 (Pentium 4s) and upcoming Families 18/19.
Use an x86 VFM check and move the function to the header file to avoid using arch-specific #ifdefs in the C file.
--- drivers/cpufreq/cpufreq_ondemand.c | 25 +------------------------ drivers/cpufreq/cpufreq_ondemand.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-)
drivers/cpufreq/cpufreq_ondemand.c +1 -24
@@ -29,29 +29,6 @@ static struct od_ops od_ops;static unsigned int default_powersave_bias; -/* -* Not all CPUs want IO time to be accounted as busy; this depends on how -* efficient idling at a higher frequency/voltage is. -* Pavel Machek says this is not so for various generations of AMD and old -* Intel systems. -* Mike Chan (android.com) claims this is also not true for ARM. -* Because of this, whitelist specific known (series) of CPUs by default, and -* leave all others up to the user. -*/ -static int should_io_be_busy (void ) -{ -#if defined(CONFIG_X86 ) -/* -* For Intel, Core 2 (model 15) and later have an efficient idle. -*/ -if (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL && - boot_cpu_data.x86 ==6 && - boot_cpu_data.x86_model >=15 ) -return 1 ; -#endif -return 0 ; -} -/* * Find right freq to be set now with powersave_bias on. * Returns the freq_hi to be used right now and will set freq_hi_delay_us,
@@ -377,7 +354,7 @@ static int od_init(struct dbs_data *dbs_data) dbs_data->sampling_down_factor =DEF_SAMPLING_DOWN_FACTOR ; dbs_data->ignore_nice_load =0 ; tuners->powersave_bias = default_powersave_bias; - dbs_data->io_is_busy =should_io_be_busy (); + dbs_data->io_is_busy =od_should_io_be_busy (); dbs_data->tuners = tuners;return 0 ;
drivers/cpufreq/cpufreq_ondemand.h +23 -0
@@ -24,3 +24,26 @@ static inline struct od_policy_dbs_info *to_dbs_info(struct policy_dbs_info *polstruct od_dbs_tuners {unsigned int powersave_bias; }; + +#ifdef CONFIG_X86 +#include <asm/cpu_device_id.h> + +/* +* Not all CPUs want IO time to be accounted as busy; this depends on +* how efficient idling at a higher frequency/voltage is. +* +* Pavel Machek says this is not so for various generations of AMD and +* old Intel systems. Mike Chan (android.com) claims this is also not +* true for ARM. +* +* Because of this, select a known series of Intel CPUs (Family 6 and +* later) by default, and leave all others up to the user. +*/ +static inline bool od_should_io_be_busy (void ) +{ +return (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL && + boot_cpu_data.x86_vfm >=INTEL_PENTIUM_PRO ); +} +#else +static inline bool od_should_io_be_busy (void ) {return false; } +#endif
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 167/849 arm64: zynqmp: Disable coresight by default
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quanyang Wang <[email protected]>
[ Upstream commit 0e3f9140ad04dca9a6a93dd6a6decdc53fd665ca ]
When secure-boot mode of bootloader is enabled, the registers of coresight are not permitted to access that's why disable it by default.
--- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +4 -0
@@ -550,6 +550,7 @@ reg = <0x0 0xfec10000 0x0 0x1000>; clock-names = "apb_pclk"; cpu = <&cpu0>; + status = "disabled"; }; cpu1_debug: debug@fed10000 {
@@ -557,6 +558,7 @@ reg = <0x0 0xfed10000 0x0 0x1000>; clock-names = "apb_pclk"; cpu = <&cpu1>; + status = "disabled"; }; cpu2_debug: debug@fee10000 {
@@ -564,6 +566,7 @@ reg = <0x0 0xfee10000 0x0 0x1000>; clock-names = "apb_pclk"; cpu = <&cpu2>; + status = "disabled"; }; cpu3_debug: debug@fef10000 {
@@ -571,6 +574,7 @@ reg = <0x0 0xfef10000 0x0 0x1000>; clock-names = "apb_pclk"; cpu = <&cpu3>; + status = "disabled"; }; /* GDMA */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 168/849 arm64: zynqmp: Revert usb node drive strength and slew rate for zcu106
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <[email protected]>
[ Upstream commit 767ecf9da7b31e5c0c22c273001cb2784705fe8c ]
On a few zcu106 boards USB devices (Dell MS116 USB Optical Mouse, Dell USB Entry Keyboard) are not enumerated on linux boot due to commit 'b8745e7eb488 ("arm64: zynqmp: Fix usb node drive strength and slew rate")'.
To fix it as a workaround revert to working version and then investigate at board level why drive strength from 12mA to 4mA and slew from fast to slow is not working.
--- arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts +2 -2
@@ -808,8 +808,8 @@ pins = "MIO54", "MIO56", "MIO57", "MIO58", "MIO59", "MIO60", "MIO61", "MIO62", "MIO63"; bias-disable; - drive-strength = <4>; - slew-rate = <SLEW_RATE_SLOW>; + drive-strength = <12>; + slew-rate = <SLEW_RATE_FAST>; }; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 169/849 soc/tegra: fuse: Add Tegra114 nvmem cells and fuse lookups
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Svyatoslav Ryhel <[email protected]>
[ Upstream commit b9c01adedf38c69abb725a60a05305ef70dbce03 ]
Add missing Tegra114 nvmem cells and fuse lookups which were added for Tegra124+ but omitted for Tegra114.
--- drivers/soc/tegra/fuse/fuse-tegra30.c | 122 ++++++++++++++++++++++++++ 1 file changed, 122 insertions(+)
drivers/soc/tegra/fuse/fuse-tegra30.c +122 -0
@@ -117,6 +117,124 @@ const struct tegra_fuse_soc tegra30_fuse_soc = {#endif #ifdef CONFIG_ARCH_TEGRA_114_SOC +static const struct nvmem_cell_info tegra114_fuse_cells[] = { + { + .name ="tsensor-cpu1" , + .offset =0x084 , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="tsensor-cpu2" , + .offset =0x088 , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="tsensor-common" , + .offset =0x08c , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="tsensor-cpu0" , + .offset =0x098 , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="xusb-pad-calibration" , + .offset =0x0f0 , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="tsensor-cpu3" , + .offset =0x12c , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="tsensor-gpu" , + .offset =0x154 , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="tsensor-mem0" , + .offset =0x158 , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="tsensor-mem1" , + .offset =0x15c , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, { + .name ="tsensor-pllx" , + .offset =0x160 , + .bytes =4 , + .bit_offset =0 , + .nbits =32 , + }, +}; + +static const struct nvmem_cell_lookup tegra114_fuse_lookups[] = { + { + .nvmem_name ="fuse" , + .cell_name ="xusb-pad-calibration" , + .dev_id ="7009f000.padctl" , + .con_id ="calibration" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-common" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="common" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-cpu0" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="cpu0" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-cpu1" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="cpu1" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-cpu2" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="cpu2" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-cpu3" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="cpu3" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-mem0" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="mem0" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-mem1" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="mem1" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-gpu" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="gpu" , + }, { + .nvmem_name ="fuse" , + .cell_name ="tsensor-pllx" , + .dev_id ="700e2000.thermal-sensor" , + .con_id ="pllx" , + }, +}; +static const struct tegra_fuse_info tegra114_fuse_info = { .read = tegra30_fuse_read, .size = 0x2a0,
@@ -127,6 +245,10 @@ const struct tegra_fuse_soc tegra114_fuse_soc = { .init = tegra30_fuse_init, .speedo_init = tegra114_init_speedo_data, .info = &tegra114_fuse_info, + .lookups = tegra114_fuse_lookups, + .num_lookups = ARRAY_SIZE(tegra114_fuse_lookups), + .cells = tegra114_fuse_cells, + .num_cells = ARRAY_SIZE(tegra114_fuse_cells), .soc_attr_group = &tegra_soc_attr_group, .clk_suspend_on = false, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 170/849 ARM: tegra: p880: set correct touchscreen clipping
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Schwöbel <[email protected]>
[ Upstream commit b49a73a08100ab139e07cfa7ca36e9b15787d0ab ]
Existing touchscreen clipping is too small and causes problems with touchscreen accuracy.
--- arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/nvidia/tegra30-lg-p880.dts +2 -2
@@ -108,8 +108,8 @@ i2c@7000c400 { touchscreen@20 { rmi4-f11@11 { - syna,clip-x-high = <1110>; - syna,clip-y-high = <1973>; + syna,clip-x-high = <1440>; + syna,clip-y-high = <2560>; touchscreen-inverted-y; };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 171/849 ARM: tegra: transformer-20: add missing magnetometer interrupt
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Svyatoslav Ryhel <[email protected]>
[ Upstream commit cca41614d15ce2bbc2c661362d3eafe53c9990af ]
Add missing interrupt to magnetometer node.
--- arch/arm/boot/dts/nvidia/tegra20-asus-tf101.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/nvidia/tegra20-asus-tf101.dts +3 -0
@@ -502,6 +502,9 @@ compatible = "asahi-kasei,ak8974"; reg = <0xe>; + interrupt-parent = <&gpio>; + interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_EDGE_RISING>; + avdd-supply = <&vdd_3v3_sys>; dvdd-supply = <&vdd_1v8_sys>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 172/849 ARM: tegra: transformer-20: fix audio-codec interrupt
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Svyatoslav Ryhel <[email protected]>
[ Upstream commit 3f973d78d176768fa7456def97f0b9824235024f ]
Correct audio-codec interrupt should be PX3 while PX1 is used for external microphone detection.
--- arch/arm/boot/dts/nvidia/tegra20-asus-tf101.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/nvidia/tegra20-asus-tf101.dts +1 -1
@@ -518,7 +518,7 @@ reg = <0x1a>; interrupt-parent = <&gpio>; - interrupts = <TEGRA_GPIO(X, 1) IRQ_TYPE_EDGE_BOTH>; + interrupts = <TEGRA_GPIO(X, 3) IRQ_TYPE_EDGE_BOTH>; gpio-controller; #gpio-cells = <2>;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 173/849 firmware: qcom: tzmem: disable sc7180 platform
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Travkin <[email protected]>
[ Upstream commit 3cc9a8cadaf66e1a53e5fee48f8bcdb0a3fd5075 ]
When SHM bridge is enabled, assigning RMTFS memory causes the calling core to hang if the system is running in EL1.
Disable SHM bridge on sc7180 devices to avoid that hang.
--- drivers/firmware/qcom/qcom_tzmem.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/qcom/qcom_tzmem.c +1 -0
@@ -77,6 +77,7 @@ static bool qcom_tzmem_using_shm_bridge;/* List of machines that are known to not support SHM bridge correctly. */ static const char *const qcom_tzmem_blacklist[] = { +"qcom,sc7180" ,/* hang in rmtfs memory assignment */ "qcom,sc8180x" ,"qcom,sdm670" ,/* failure in GPU firmware loading */ "qcom,sdm845" ,/* reset in rmtfs memory assignment */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 174/849 soc: ti: k3-socinfo: Add information for AM62L SR1.1
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryan Brattlof <[email protected]>
[ Upstream commit 037e496038f6e4cfb3642a0ffc2db19838d564dd ]
The second silicon revision for the AM62L was mainly a ROM revision and therefore this silicon revision is labeled SR1.1
Add a new decode array to properly identify this revision as SR1.1
--- drivers/soc/ti/k3-socinfo.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/soc/ti/k3-socinfo.c +10 -0
@@ -66,6 +66,10 @@ static const char * const j721e_rev_string_map[] = { "1.0", "1.1", "2.0", }; +static const char *const am62lx_rev_string_map[] = { +"1.0" ,"1.1" , +}; +static int k3_chipinfo_partno_to_names (unsigned int partno,struct soc_device_attribute *soc_dev_attr)
@@ -92,6 +96,12 @@ k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant, soc_dev_attr->revision =kasprintf (GFP_KERNEL ,"SR%s" , j721e_rev_string_map[variant]);break ; +case JTAG_ID_PARTNO_AM62LX : +if (variant >=ARRAY_SIZE (am62lx_rev_string_map)) + goto err_unknown_variant; + soc_dev_attr->revision =kasprintf (GFP_KERNEL ,"SR%s" , + am62lx_rev_string_map[variant]); +break ;default : variant++; soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%x.0",
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 175/849 mmc: sdhci-msm: Enable tuning for SDR50 mode for SD card
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarthak Garg <[email protected]>
[ Upstream commit 08b68ca543ee9d5a8d2dc406165e4887dd8f170b ]
For Qualcomm SoCs which needs level shifter for SD card, extra delay is seen on receiver data path.
To compensate this delay enable tuning for SDR50 mode for targets which has level shifter. SDHCI_SDR50_NEEDS_TUNING caps will be set for targets with level shifter on Qualcomm SOC's.
--- drivers/mmc/host/sdhci-msm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/mmc/host/sdhci-msm.c +15 -0
@@ -81,6 +81,7 @@#define CORE_IO_PAD_PWR_SWITCH_EN BIT(15)#define CORE_IO_PAD_PWR_SWITCH BIT(16)#define CORE_HC_SELECT_IN_EN BIT(18) +#define CORE_HC_SELECT_IN_SDR50 (4 << 19)#define CORE_HC_SELECT_IN_HS400 (6 << 19)#define CORE_HC_SELECT_IN_MASK (7 << 19)
@@ -1133,6 +1134,10 @@ static bool sdhci_msm_is_tuning_needed(struct sdhci_host *host) {struct mmc_ios *ios = &host->mmc->ios; +if (ios->timing ==MMC_TIMING_UHS_SDR50 && + host->flags &SDHCI_SDR50_NEEDS_TUNING ) +return true; +/* * Tuning is required for SDR104, HS200 and HS400 cards and * if clock frequency is greater than 100MHz in these modes.
@@ -1201,6 +1206,8 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)struct mmc_ios ios = host->mmc->ios;struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);struct sdhci_msm_host *msm_host =sdhci_pltfm_priv (pltfm_host); +const struct sdhci_msm_offset *msm_offset = msm_host->offset; +u32 config;if (!sdhci_msm_is_tuning_needed (host)) { msm_host->use_cdr = false;
@@ -1217,6 +1224,14 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)*/ msm_host->tuning_done =0 ; +if (ios.timing ==MMC_TIMING_UHS_SDR50 && + host->flags &SDHCI_SDR50_NEEDS_TUNING ) { + config =readl_relaxed (host->ioaddr + msm_offset->core_vendor_spec); + config &= ~CORE_HC_SELECT_IN_MASK ; + config |=CORE_HC_SELECT_IN_EN |CORE_HC_SELECT_IN_SDR50 ; +writel_relaxed (config, host->ioaddr + msm_offset->core_vendor_spec); + } +/* * For HS400 tuning in HS200 timing requires: * - select MCLK/2 in VENDOR_SPEC
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 176/849 pwm: pca9685: Use bulk write to atomicially update registers
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit de5855613263b426ee697dd30224322f2e634dec ]
The output of a PWM channel is configured by four register values. Write them in a single i2c transaction to ensure glitch free updates.
--- drivers/pwm/pwm-pca9685.c | 46 ++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-)
drivers/pwm/pwm-pca9685.c +29 -17
@@ -61,6 +61,8 @@#define MODE1_SUB2 BIT(2)#define MODE1_SUB1 BIT(3)#define MODE1_SLEEP BIT(4) +#define MODE1_AI BIT(5) +#define MODE2_INVRT BIT(4)#define MODE2_OUTDRV BIT(2)
@@ -131,6 +133,19 @@ static int pca9685_write_reg(struct pwm_chip *chip, unsigned int reg, unsigned ireturn err; } +static int pca9685_write_4reg (struct pwm_chip *chip,unsigned int reg,u8 val[4 ]) +{ +struct pca9685 *pca =to_pca (chip); +struct device *dev =pwmchip_parent (chip); +int err; + + err =regmap_bulk_write (pca->regmap, reg, val,4 ); +if (err) +dev_err (dev,"regmap_write to register 0x%x failed: %pe\n" , reg,ERR_PTR (err)); + +return err; +} +/* Helper function to set the duty cycle ratio to duty/4096 (e.g. duty=2048 -> 50%) */ static void pca9685_pwm_set_duty (struct pwm_chip *chip,int channel,unsigned int duty) {
@@ -143,12 +158,10 @@ static void pca9685_pwm_set_duty(struct pwm_chip *chip, int channel, unsigned inreturn ; }else if (duty >=PCA9685_COUNTER_RANGE ) {/* Set the full ON bit and clear the full OFF bit */ -pca9685_write_reg (chip,REG_ON_H (channel),LED_FULL ); -pca9685_write_reg (chip,REG_OFF_H (channel),0 ); +pca9685_write_4reg (chip,REG_ON_L (channel), (u8 [4 ]){0 ,LED_FULL ,0 ,0 });return ; } -if (pwm->state.usage_power && channel <PCA9685_MAXCHAN ) {/* * If usage_power is set, the pca9685 driver will phase shift
@@ -163,12 +176,9 @@ static void pca9685_pwm_set_duty(struct pwm_chip *chip, int channel, unsigned in off = (on + duty) %PCA9685_COUNTER_RANGE ; -/* Set ON time (clears full ON bit) */ -pca9685_write_reg (chip,REG_ON_L (channel), on &0xff ); -pca9685_write_reg (chip,REG_ON_H (channel), (on >>8 ) &0xf ); -/* Set OFF time (clears full OFF bit) */ -pca9685_write_reg (chip,REG_OFF_L (channel), off &0xff ); -pca9685_write_reg (chip,REG_OFF_H (channel), (off >>8 ) &0xf ); +/* implicitly clear full ON and full OFF bit */ +pca9685_write_4reg (chip,REG_ON_L (channel), + (u8 [4 ]){ on &0xff , (on >>8 ) &0xf , off &0xff , (off >>8 ) &0xf }); }static unsigned int pca9685_pwm_get_duty (struct pwm_chip *chip,int channel)
@@ -544,9 +554,8 @@ static int pca9685_pwm_probe(struct i2c_client *client)mutex_init (&pca->lock); - ret =pca9685_read_reg (chip,PCA9685_MODE2 , ®); -if (ret) -return ret; +/* clear MODE2_OCH */ + reg =0 ;if (device_property_read_bool (&client->dev,"invert" )) reg |=MODE2_INVRT ;
@@ -562,16 +571,19 @@ static int pca9685_pwm_probe(struct i2c_client *client)if (ret)return ret; -/* Disable all LED ALLCALL and SUBx addresses to avoid bus collisions */ +/* +* Disable all LED ALLCALL and SUBx addresses to avoid bus collisions, +* enable Auto-Increment. +*/ pca9685_read_reg (chip,PCA9685_MODE1 , ®); reg &= ~(MODE1_ALLCALL |MODE1_SUB1 |MODE1_SUB2 |MODE1_SUB3 ); + reg |=MODE1_AI ;pca9685_write_reg (chip,PCA9685_MODE1 , reg);/* Reset OFF/ON registers to POR default */ -pca9685_write_reg (chip,PCA9685_ALL_LED_OFF_L ,0 ); -pca9685_write_reg (chip,PCA9685_ALL_LED_OFF_H ,LED_FULL ); -pca9685_write_reg (chip,PCA9685_ALL_LED_ON_L ,0 ); -pca9685_write_reg (chip,PCA9685_ALL_LED_ON_H ,LED_FULL ); + ret =pca9685_write_4reg (chip,PCA9685_ALL_LED_ON_L , (u8 []){0 ,LED_FULL ,0 ,LED_FULL }); +if (ret <0 ) +return dev_err_probe (&client->dev, ret,"Failed to reset ON/OFF registers\n" ); chip->ops = &pca9685_pwm_ops;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 177/849 ACPICA: dispatcher: Use acpi_ds_clear_operands() in acpi_ds_call_control_method()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit e9dff11a7a50fcef23fe3e8314fafae6d5641826 ]
When deleting the previous walkstate operand stack acpi_ds_call_control_method() was deleting obj_desc->Method.param_count operands. But Method.param_count does not necessarily match this_walk_state->num_operands, it may be either less or more.
After correcting the for loop to check i < this_walk_state->num_operands the code is identical to acpi_ds_clear_operands(), so just outright replace the code with acpi_ds_clear_operands() to fix this.
--- drivers/acpi/acpica/dsmethod.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/acpi/acpica/dsmethod.c +1 -8
@@ -546,14 +546,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,* Delete the operands on the previous walkstate operand stack * (they were copied to new objects) */ -for (i =0 ; i < obj_desc->method.param_count; i++) { -acpi_ut_remove_reference (this_walk_state->operands[i]); - this_walk_state->operands[i] =NULL ; - } - -/* Clear the operand stack */ - - this_walk_state->num_operands =0 ; +acpi_ds_clear_operands (this_walk_state); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "**** Begin nested execution of [%4.4s] **** WalkState=%p\n",
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 178/849 tee: allow a driver to allocate a tee_device without a pool
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amirreza Zarrabi <[email protected]>
[ Upstream commit 6dbcd5a9ab6cb6644e7d728521da1c9035ec7235 ]
A TEE driver doesn't always need to provide a pool if it doesn't support memory sharing ioctls and can allocate memory for TEE messages in another way. Although this is mentioned in the documentation for tee_device_alloc(), it is not handled correctly.
--- drivers/tee/tee_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tee/tee_core.c +1 -1
@@ -889,7 +889,7 @@ struct tee_device *tee_device_alloc(const struct tee_desc *teedesc,if (!teedesc || !teedesc->name || !teedesc->ops || !teedesc->ops->get_version || !teedesc->ops->open || - !teedesc->ops->release || !pool) + !teedesc->ops->release)return ERR_PTR (-EINVAL ); teedev =kzalloc (sizeof (*teedev),GFP_KERNEL );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 179/849 nvmet-fc: avoid scheduling association deletion twice
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit f2537be4f8421f6495edfa0bc284d722f253841d ]
When forcefully shutting down a port via the configfs interface, nvmet_port_subsys_drop_link() first calls nvmet_port_del_ctrls() and then nvmet_disable_port(). Both functions will eventually schedule all remaining associations for deletion.
The current implementation checks whether an association is about to be removed, but only after the work item has already been scheduled. As a result, it is possible for the first scheduled work item to free all resources, and then for the same work item to be scheduled again for deletion.
Because the association list is an RCU list, it is not possible to take a lock and remove the list entry directly, so it cannot be looked up again. Instead, a flag (terminating) must be used to determine whether the association is already in the process of being deleted.
--- drivers/nvme/target/fc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/nvme/target/fc.c +9 -7
@@ -1075,6 +1075,14 @@ nvmet_fc_delete_assoc_work(struct work_struct *work)static void nvmet_fc_schedule_delete_assoc (struct nvmet_fc_tgt_assoc *assoc) { +int terminating; + + terminating =atomic_xchg (&assoc->terminating,1 ); + +/* if already terminating, do nothing */ +if (terminating) +return ; +nvmet_fc_tgtport_get (assoc->tgtport);if (!queue_work (nvmet_wq, &assoc->del_work))nvmet_fc_tgtport_put (assoc->tgtport);
@@ -1202,13 +1210,7 @@ nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc) {struct nvmet_fc_tgtport *tgtport = assoc->tgtport;unsigned long flags; -int i, terminating; - - terminating =atomic_xchg (&assoc->terminating,1 ); - -/* if already terminating, do nothing */ -if (terminating) -return ; +int i;spin_lock_irqsave (&tgtport->lock, flags);list_del_rcu (&assoc->a_list);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 180/849 nvme-fc: use lock accessing port_state and rport state
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Wagner <[email protected]>
[ Upstream commit 891cdbb162ccdb079cd5228ae43bdeebce8597ad ]
nvme_fc_unregister_remote removes the remote port on a lport object at any point in time when there is no active association. This races with with the reconnect logic, because nvme_fc_create_association is not taking a lock to check the port_state and atomically increase the active count on the rport.
--- drivers/nvme/host/fc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +8 -2
@@ -3032,11 +3032,17 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) ++ctrl->ctrl.nr_reconnects; -if (ctrl->rport->remoteport.port_state !=FC_OBJSTATE_ONLINE ) +spin_lock_irqsave (&ctrl->rport->lock, flags); +if (ctrl->rport->remoteport.port_state !=FC_OBJSTATE_ONLINE ) { +spin_unlock_irqrestore (&ctrl->rport->lock, flags);return -ENODEV ; + } -if (nvme_fc_ctlr_active_on_rport (ctrl)) +if (nvme_fc_ctlr_active_on_rport (ctrl)) { +spin_unlock_irqrestore (&ctrl->rport->lock, flags);return -ENOTUNIQ ; + } +spin_unlock_irqrestore (&ctrl->rport->lock, flags);dev_info (ctrl->ctrl.device, "NVME-FC{%d}: create association : host wwpn 0x%016llx "
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 181/849 kunit: Enable PCI on UML without triggering WARN()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 031cdd3bc3f369553933c1b0f4cb18000162c8ff ]
Various KUnit tests require PCI infrastructure to work. All normal platforms enable PCI by default, but UML does not. Enabling PCI from .kunitconfig files is problematic as it would not be portable. So in commit 6fc3a8636a7b ("kunit: tool: Enable virtio/PCI by default on UML") PCI was enabled by way of CONFIG_UML_PCI_OVER_VIRTIO=y. However CONFIG_UML_PCI_OVER_VIRTIO requires additional configuration of CONFIG_UML_PCI_OVER_VIRTIO_DEVICE_ID or will otherwise trigger a WARN() in virtio_pcidev_init(). However there is no one correct value for UML_PCI_OVER_VIRTIO_DEVICE_ID which could be used by default.
This warning is confusing when debugging test failures.
On the other hand, the functionality of CONFIG_UML_PCI_OVER_VIRTIO is not used at all, given that it is completely non-functional as indicated by the WARN() in question. Instead it is only used as a way to enable CONFIG_UML_PCI which itself is not directly configurable.
Instead of going through CONFIG_UML_PCI_OVER_VIRTIO, introduce a custom configuration option which enables CONFIG_UML_PCI without triggering warnings or building dead code.
--- lib/kunit/Kconfig | 7 +++++++ tools/testing/kunit/configs/arch_uml.config | 5 ++--- 2 files changed, 9 insertions(+), 3 deletions(-)
lib/kunit/Kconfig +7 -0
@@ -106,4 +106,11 @@ config KUNIT_DEFAULT_TIMEOUT If unsure, the default timeout of 300 seconds is suitable for most cases. +config KUNIT_UML_PCI + bool "KUnit UML PCI Support" + depends on UML + select UML_PCI + help + Enables the PCI subsystem on UML for use by KUnit tests. + endif # KUNIT
tools/testing/kunit/configs/arch_uml.config +2 -3
@@ -1,8 +1,7 @@ # Config options which are added to UML builds by default -# Enable virtio/pci, as a lot of tests require it. -CONFIG_VIRTIO_UML=y -CONFIG_UML_PCI_OVER_VIRTIO=y +# Enable pci, as a lot of tests require it. +CONFIG_KUNIT_UML_PCI=y # Enable FORTIFY_SOURCE for wider checking. CONFIG_FORTIFY_SOURCE=y
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 182/849 selftests/bpf: Fix arena_spin_lock selftest failure
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saket Kumar Bhaskar <[email protected]>
[ Upstream commit a9d4e9f0e871352a48a82da11a50df7196fe567a ]
For systems having CONFIG_NR_CPUS set to > 1024 in kernel config the selftest fails as arena_spin_lock_irqsave() returns EOPNOTSUPP. (eg - incase of powerpc default value for CONFIG_NR_CPUS is 8192)
The selftest is skipped incase bpf program returns EOPNOTSUPP, with a descriptive message logged.
--- .../selftests/bpf/prog_tests/arena_spin_lock.c | 13 +++++++++++++ tools/testing/selftests/bpf/progs/arena_spin_lock.c | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/arena_spin_lock.c +13 -0
@@ -40,8 +40,13 @@ static void *spin_lock_thread(void *arg) err =bpf_prog_test_run_opts (prog_fd, &topts);ASSERT_OK (err,"test_run err" ); + +if (topts.retval == -EOPNOTSUPP ) + goto end; +ASSERT_EQ ((int )topts.retval,0 ,"test_run retval" ); +end:pthread_exit (arg); }
@@ -63,6 +68,7 @@ static void test_arena_spin_lock_size(int size) skel =arena_spin_lock__open_and_load ();if (!ASSERT_OK_PTR (skel,"arena_spin_lock__open_and_load" ))return ; +if (skel->data->test_skip ==2 ) {test__skip (); goto end;
@@ -86,6 +92,13 @@ static void test_arena_spin_lock_size(int size) goto end_barrier; } +if (skel->data->test_skip ==3 ) { +printf ("%s:SKIP: CONFIG_NR_CPUS exceed the maximum supported by arena spinlock\n" , + __func__); +test__skip (); + goto end_barrier; + } +ASSERT_EQ (skel->bss->counter, repeat * nthreads,"check counter value" ); end_barrier:
tools/testing/selftests/bpf/progs/arena_spin_lock.c +4 -1
@@ -37,8 +37,11 @@ int prog(void *ctx)#if defined(ENABLE_ATOMICS_TESTS ) && defined(__BPF_FEATURE_ADDR_SPACE_CAST)unsigned long flags; -if ((ret =arena_spin_lock_irqsave (&lock, flags))) +if ((ret =arena_spin_lock_irqsave (&lock, flags))) { +if (ret == -EOPNOTSUPP ) + test_skip =3 ;return ret; + }if (counter != limit) counter++;bpf_repeat (cs_count);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 183/849 bpf: Do not limit bpf_cgroup_from_id to currents namespace
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit 2c895133950646f45e5cf3900b168c952c8dbee8 ]
The bpf_cgroup_from_id kfunc relies on cgroup_get_from_id to obtain the cgroup corresponding to a given cgroup ID. This helper can be called in a lot of contexts where the current thread can be random. A recent example was its use in sched_ext's ops.tick(), to obtain the root cgroup pointer. Since the current task can be whatever random user space task preempted by the timer tick, this makes the behavior of the helper unreliable.
Refactor out __cgroup_get_from_id as the non-namespace aware version of cgroup_get_from_id, and change bpf_cgroup_from_id to make use of it.
There is no compatibility breakage here, since changing the namespace against which the lookup is being done to the root cgroup namespace only permits a wider set of lookups to succeed now. The cgroup IDs across namespaces are globally unique, and thus don't need to be retranslated.
--- include/linux/cgroup.h | 1 + kernel/bpf/helpers.c | 2 +- kernel/cgroup/cgroup.c | 24 ++++++++++++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-)
include/linux/cgroup.h +1 -0
@@ -650,6 +650,7 @@ static inline void cgroup_kthread_ready(void) }void cgroup_path_from_kernfs_id (u64 id,char *buf,size_t buflen); +struct cgroup *__cgroup_get_from_id (u64 id);struct cgroup *cgroup_get_from_id (u64 id);#else /* !CONFIG_CGROUPS */
kernel/bpf/helpers.c +1 -1
@@ -2537,7 +2537,7 @@ __bpf_kfunc struct cgroup *bpf_cgroup_from_id(u64 cgid) {struct cgroup *cgrp; - cgrp =cgroup_get_from_id (cgid); + cgrp =__cgroup_get_from_id (cgid);if (IS_ERR (cgrp))return NULL ;return cgrp;
kernel/cgroup/cgroup.c +20 -4
@@ -6373,15 +6373,15 @@ void cgroup_path_from_kernfs_id(u64 id, char *buf, size_t buflen) }/* -* cgroup_get_from_id : get the cgroup associated with cgroup id +* __cgroup_get_from_id : get the cgroup associated with cgroup id * @id: cgroup id * On success return the cgrp or ERR_PTR on failure -* Only cgroups within current task's cgroup NS are valid. +* There are no cgroup NS restrictions. */ -struct cgroup *cgroup_get_from_id (u64 id) +struct cgroup *__cgroup_get_from_id (u64 id) {struct kernfs_node *kn; -struct cgroup *cgrp, *root_cgrp; +struct cgroup *cgrp; kn =kernfs_find_and_get_node_by_id (cgrp_dfl_root.kf_root, id);if (!kn)
@@ -6403,6 +6403,22 @@ struct cgroup *cgroup_get_from_id(u64 id)if (!cgrp)return ERR_PTR (-ENOENT ); +return cgrp; +} + +/* +* cgroup_get_from_id : get the cgroup associated with cgroup id +* @id: cgroup id +* On success return the cgrp or ERR_PTR on failure +* Only cgroups within current task's cgroup NS are valid. +*/ +struct cgroup *cgroup_get_from_id (u64 id) +{ +struct cgroup *cgrp, *root_cgrp; + + cgrp =__cgroup_get_from_id (id); +if (IS_ERR (cgrp)) +return cgrp; root_cgrp =current_cgns_cgroup_dfl ();if (!cgroup_is_descendant (cgrp, root_cgrp)) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 184/849 i3c: mipi-i3c-hci-pci: Add support for Intel Wildcat Lake-U I3C
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Nikula <[email protected]>
[ Upstream commit d515503f3c8a8475b2f78782534aad09722904e1 ]
Add I3C controller PCI IDs on Intel Wildcat Lake-U.
--- drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c +3 -0
@@ -124,6 +124,9 @@ static void mipi_i3c_hci_pci_remove(struct pci_dev *pci) }static const struct pci_device_id mipi_i3c_hci_pci_devices[] = { +/* Wildcat Lake-U */ + {PCI_VDEVICE (INTEL ,0x4d7c ), (kernel_ulong_t)&intel_info}, + {PCI_VDEVICE (INTEL ,0x4d6f ), (kernel_ulong_t)&intel_info},/* Panther Lake-H */ {PCI_VDEVICE (INTEL ,0xe37c ), (kernel_ulong_t)&intel_info}, {PCI_VDEVICE (INTEL ,0xe36f ), (kernel_ulong_t)&intel_info},
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 185/849 rust: kunit: allow `cfg` on `test`s
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaibo Ma <[email protected]>
[ Upstream commit c652dc44192d96820d73a7ecd89d275ca7e4355d ]
The kunit_test proc macro only checks for the test attribute immediately preceding a fn. If the function is disabled via a cfg, the generated code would result in a compile error referencing a non-existent function [1].
This collects attributes and specifically cherry-picks cfg attributes to be duplicated inside KUnit wrapper functions such that a test function disabled via cfg compiles and is marked as skipped in KUnit correctly.
--- rust/kernel/kunit.rs | 7 +++++++ rust/macros/kunit.rs | 48 +++++++++++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 12 deletions(-)
rust/kernel/kunit.rs +7 -0
@@ -357,4 +357,11 @@ mod tests {fn rust_test_kunit_in_kunit_test () {assert! (in_kunit_test ()); } + +#[test] +#[cfg(not(all()))] +fn rust_test_kunit_always_disabled_test () { +// This test should never run because of the `cfg`. +assert! (false ); + } }
rust/macros/kunit.rs +36 -12
80 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 186/849 video: backlight: lp855x_bl: Set correct EPROM start for LP8556
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Svyatoslav Ryhel <[email protected]>
[ Upstream commit 07c7efda24453e05951fb2879f5452b720b91169 ]
According to LP8556 datasheet EPROM region starts at 0x98 so adjust value in the driver accordingly.
--- drivers/video/backlight/lp855x_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/lp855x_bl.c +1 -1
@@ -22,7 +22,7 @@#define LP855X_DEVICE_CTRL 0x01#define LP855X_EEPROM_START 0xA0#define LP855X_EEPROM_END 0xA7 -#define LP8556_EPROM_START 0xA0 +#define LP8556_EPROM_START 0x98#define LP8556_EPROM_END 0xAF/* LP8555/7 Registers */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 187/849 i3c: dw: Add shutdown support to dw_i3c_master driver
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manikanta Guntupalli <[email protected]>
[ Upstream commit 17e163f3d7a5449fe9065030048e28c4087b24ce ]
Add shutdown handler to the Synopsys DesignWare I3C master driver, ensuring the device is gracefully disabled during system shutdown.
The shutdown handler cancels any pending hot-join work and disables interrupts.
--- drivers/i3c/master/dw-i3c-master.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/i3c/master/dw-i3c-master.c +23 -0
@@ -1737,6 +1737,28 @@ static const struct dev_pm_ops dw_i3c_pm_ops = {SET_RUNTIME_PM_OPS (dw_i3c_master_runtime_suspend, dw_i3c_master_runtime_resume,NULL ) }; +static void dw_i3c_shutdown (struct platform_device *pdev) +{ +struct dw_i3c_master *master =platform_get_drvdata (pdev); +int ret; + + ret =pm_runtime_resume_and_get (master->dev); +if (ret <0 ) { +dev_err (master->dev, +"<%s> cannot resume i3c bus master, err: %d\n" , + __func__, ret); +return ; + } + +cancel_work_sync (&master->hj_work); + +/* Disable interrupts */ +writel ((u32 )~INTR_ALL , master->regs +INTR_STATUS_EN ); +writel ((u32 )~INTR_ALL , master->regs +INTR_SIGNAL_EN ); + +pm_runtime_put_autosuspend (master->dev); +} +static const struct of_device_id dw_i3c_master_of_match[] = { { .compatible ="snps,dw-i3c-master-1.00a" , }, {},
@@ -1752,6 +1774,7 @@ MODULE_DEVICE_TABLE(acpi, amd_i3c_device_match);static struct platform_driver dw_i3c_driver = { .probe = dw_i3c_probe, .remove = dw_i3c_remove, + .shutdown = dw_i3c_shutdown, .driver = { .name ="dw-i3c-master" , .of_match_table = dw_i3c_master_of_match,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 188/849 io_uring/zcrx: check all niovs filled with dma addresses
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit d7ae46b454eb05e3df0d46c2ac9c61416a4d9057 ]
Add a warning if io_populate_area_dma() can't fill in all net_iovs, it should never happen.
--- io_uring/zcrx.c | 3 +++ 1 file changed, 3 insertions(+)
io_uring/zcrx.c +3 -0
@@ -75,6 +75,9 @@ static int io_populate_area_dma(struct io_zcrx_ifq *ifq, niov_idx++; } } + +if (WARN_ON_ONCE (niov_idx != area->nia.num_niovs)) +return -EFAULT ;return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 189/849 tools/cpupower: fix error return value in cpupower_write_sysfs()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaushlendra Kumar <[email protected]>
[ Upstream commit 57b100d4cf14276e0340eecb561005c07c129eb8 ]
The cpupower_write_sysfs() function currently returns -1 on write failure, but the function signature indicates it should return an unsigned int. Returning -1 from an unsigned function results in a large positive value rather than indicating an error condition.
Fix this by returning 0 on failure, which is more appropriate for an unsigned return type and maintains consistency with typical success/failure semantics where 0 indicates failure and non-zero indicates success (bytes written).
--- tools/power/cpupower/lib/cpupower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/lib/cpupower.c +1 -1
@@ -56,7 +56,7 @@ unsigned int cpupower_write_sysfs(const char *path, char *buf, size_t buflen)if (numwritten <1 ) {perror (path);close (fd); -return -1 ; +return 0 ; }close (fd);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 190/849 io_uring/zcrx: account niov arrays to cgroup
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit 31bf77dcc3810e08bcc7d15470e92cdfffb7f7f1 ]
net_iov / freelist / etc. arrays can be quite long, make sure they're accounted.
--- io_uring/zcrx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
io_uring/zcrx.c +3 -3
@@ -426,17 +426,17 @@ static int io_zcrx_create_area(struct io_zcrx_ifq *ifq, ret = -ENOMEM ; area->nia.niovs =kvmalloc_array (nr_iovs,sizeof (area->nia.niovs[0 ]), -GFP_KERNEL | __GFP_ZERO); +GFP_KERNEL_ACCOUNT | __GFP_ZERO);if (!area->nia.niovs) goto err; area->freelist =kvmalloc_array (nr_iovs,sizeof (area->freelist[0 ]), -GFP_KERNEL | __GFP_ZERO); +GFP_KERNEL_ACCOUNT | __GFP_ZERO);if (!area->freelist) goto err; area->user_refs =kvmalloc_array (nr_iovs,sizeof (area->user_refs[0 ]), -GFP_KERNEL | __GFP_ZERO); +GFP_KERNEL_ACCOUNT | __GFP_ZERO);if (!area->user_refs) goto err;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 191/849 pmdomain: apple: Add "apple,t8103-pmgr-pwrstate"
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janne Grunau <[email protected]>
[ Upstream commit 442816f97a4f84cb321d3359177a3b9b0ce48a60 ]
After discussion with the devicetree maintainers we agreed to not extend lists with the generic compatible "apple,pmgr-pwrstate" anymore [1]. Use "apple,t8103-pmgr-pwrstate" as base compatible as it is the SoC the driver and bindings were written for.
[1]: https://lore.kernel.org/asahi/[email protected]/
--- drivers/pmdomain/apple/pmgr-pwrstate.c | 1 + 1 file changed, 1 insertion(+)
drivers/pmdomain/apple/pmgr-pwrstate.c +1 -0
@@ -306,6 +306,7 @@ static int apple_pmgr_ps_probe(struct platform_device *pdev) }static const struct of_device_id apple_pmgr_ps_of_match[] = { + { .compatible ="apple,t8103-pmgr-pwrstate" }, { .compatible ="apple,pmgr-pwrstate" }, {} };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 192/849 power: supply: qcom_battmgr: handle charging state change notifications
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenglin Wu <[email protected]>
[ Upstream commit 41307ec7df057239aae3d0f089cc35a0d735cdf8 ]
The X1E80100 battery management firmware sends a notification with code 0x83 when the battery charging state changes, such as switching between fast charge, taper charge, end of charge, or any other error charging states.
The same notification code is used with bit[8] set when charging stops because the charge control end threshold is reached. Additionally, a 2-bit value is included in bit[10:9] with the same code to indicate the charging source capability, which is determined by the calculated power from voltage and current readings from PDOs: 2 means a strong charger over 60W, 1 indicates a weak charger, and 0 means there is no charging source.
These 3-MSB [10:8] in the notification code is not much useful for now, hence just ignore them and trigger a power supply change event whenever 0x83 notification code is received. This helps to eliminate the unknown notification error messages.
--- drivers/power/supply/qcom_battmgr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/power/supply/qcom_battmgr.c +4 -1
@@ -30,8 +30,9 @@ enum qcom_battmgr_variant {#define NOTIF_BAT_PROPERTY 0x30#define NOTIF_USB_PROPERTY 0x32#define NOTIF_WLS_PROPERTY 0x34 -#define NOTIF_BAT_INFO 0x81#define NOTIF_BAT_STATUS 0x80 +#define NOTIF_BAT_INFO 0x81 +#define NOTIF_BAT_CHARGING_STATE 0x83#define BATTMGR_BAT_INFO 0x9
@@ -947,12 +948,14 @@ static void qcom_battmgr_notification(struct qcom_battmgr *battmgr, } notification =le32_to_cpu (msg->notification); + notification &=0xff ;switch (notification) {case NOTIF_BAT_INFO : battmgr->info.valid = false; fallthrough;case NOTIF_BAT_STATUS :case NOTIF_BAT_PROPERTY : +case NOTIF_BAT_CHARGING_STATE :power_supply_changed (battmgr->bat_psy);break ;case NOTIF_USB_PROPERTY :
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 193/849 bpftool: Fix -Wuninitialized-const-pointer warnings with clang >= 21
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Stellard <[email protected]>
[ Upstream commit 5612ea8b554375d45c14cbb0f8ea93ec5d172891 ]
This fixes the build with -Werror -Wall.
btf_dumper.c:71:31: error: variable 'finfo' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
71 | info.func_info = ptr_to_u64(&finfo);
| ^~~~~
prog.c:2294:31: error: variable 'func_info' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
2294 | info.func_info = ptr_to_u64(&func_info);
|v2:
- Initialize instead of using memset.
--- tools/bpf/bpftool/btf_dumper.c | 2 +- tools/bpf/bpftool/prog.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/bpf/bpftool/btf_dumper.c +1 -1
@@ -38,7 +38,7 @@ static int dump_prog_id_as_func_ptr(const struct btf_dumper *d,__u32 info_len =sizeof (info);const char *prog_name =NULL ;struct btf *prog_btf =NULL ; -struct bpf_func_info finfo; +struct bpf_func_info finfo = {};__u32 finfo_rec_size;char prog_str[1024 ];int err;
tools/bpf/bpftool/prog.c +1 -1
@@ -2262,7 +2262,7 @@ static void profile_print_readings(void)static char *profile_target_name (int tgt_fd) { -struct bpf_func_info func_info; +struct bpf_func_info func_info = {};struct bpf_prog_info info = {};__u32 info_len =sizeof (info);const struct btf_type *t;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 194/849 cpuidle: Fail cpuidle device registration if there is one already
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 7b1b7961170e4fcad488755e5ffaaaf9bd527e8f ]
Refuse to register a cpuidle device if the given CPU has a cpuidle device already and print a message regarding it.
Without this, an attempt to register a new cpuidle device without unregistering the existing one leads to the removal of the existing cpuidle device without removing its sysfs interface.
--- drivers/cpuidle/cpuidle.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/cpuidle/cpuidle.c +7 -1
@@ -635,8 +635,14 @@ static void __cpuidle_device_init(struct cpuidle_device *dev)static int __cpuidle_register_device (struct cpuidle_device *dev) {struct cpuidle_driver *drv =cpuidle_get_cpu_driver (dev); +unsigned int cpu = dev->cpu;int i, ret; +if (per_cpu (cpuidle_devices, cpu)) { +pr_info ("CPU%d: cpuidle device already registered\n" , cpu); +return -EEXIST ; + } +if (!try_module_get (drv->owner))return -EINVAL ;
@@ -648,7 +654,7 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) dev->states_usage[i].disable |=CPUIDLE_STATE_DISABLED_BY_USER ; } -per_cpu (cpuidle_devices, dev->cpu) = dev; +per_cpu (cpuidle_devices, cpu) = dev;list_add (&dev->device_list, &cpuidle_detected_devices); ret =cpuidle_coupled_register_device (dev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 195/849 futex: Dont leak robust_list pointer on exec race
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pranav Tyagi <[email protected]>
[ Upstream commit 6b54082c3ed4dc9821cdf0edb17302355cc5bb45 ]
sys_get_robust_list() and compat_get_robust_list() use ptrace_may_access() to check if the calling task is allowed to access another task's robust_list pointer. This check is racy against a concurrent exec() in the target process.
During exec(), a task may transition from a non-privileged binary to a privileged one (e.g., setuid binary) and its credentials/memory mappings may change. If get_robust_list() performs ptrace_may_access() before this transition, it may erroneously allow access to sensitive information after the target becomes privileged.
A racy access allows an attacker to exploit a window during which ptrace_may_access() passes before a target process transitions to a privileged state via exec().
For example, consider a non-privileged task T that is about to execute a setuid-root binary. An attacker task A calls get_robust_list(T) while T is still unprivileged. Since ptrace_may_access() checks permissions based on current credentials, it succeeds. However, if T begins exec immediately afterwards, it becomes privileged and may change its memory mappings. Because get_robust_list() proceeds to access T->robust_list without synchronizing with exec() it may read user-space pointers from a now-privileged process.
This violates the intended post-exec access restrictions and could expose sensitive memory addresses or be used as a primitive in a larger exploit chain. Consequently, the race can lead to unauthorized disclosure of information across privilege boundaries and poses a potential security risk.
Take a read lock on signal->exec_update_lock prior to invoking ptrace_may_access() and accessing the robust_list/compat_robust_list. This ensures that the target task's exec state remains stable during the check, allowing for consistent and synchronized validation of credentials.
--- kernel/futex/syscalls.c | 106 +++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 50 deletions(-)
kernel/futex/syscalls.c +56 -50
@@ -39,6 +39,56 @@ SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,return 0 ; } +static inline void __user *futex_task_robust_list (struct task_struct *p,bool compat) +{ +#ifdef CONFIG_COMPAT +if (compat) +return p->compat_robust_list; +#endif +return p->robust_list; +} + +static void __user *futex_get_robust_list_common (int pid,bool compat) +{ +struct task_struct *p = current; +void __user *head; +int ret; + +scoped_guard (rcu) { +if (pid) { + p =find_task_by_vpid (pid); +if (!p) +return (void __user *)ERR_PTR (-ESRCH ); + } +get_task_struct (p); + } + +/* +* Hold exec_update_lock to serialize with concurrent exec() +* so ptrace_may_access() is checked against stable credentials +*/ + ret =down_read_killable (&p->signal->exec_update_lock); +if (ret) + goto err_put; + + ret = -EPERM ; +if (!ptrace_may_access (p,PTRACE_MODE_READ_REALCREDS )) + goto err_unlock; + + head =futex_task_robust_list (p, compat); + +up_read (&p->signal->exec_update_lock); +put_task_struct (p); + +return head; + +err_unlock: +up_read (&p->signal->exec_update_lock); +err_put: +put_task_struct (p); +return (void __user *)ERR_PTR (ret); +} +/** * sys_get_robust_list() - Get the robust-futex list head of a task * @pid: pid of the process [zero for current task]
@@ -49,36 +99,14 @@ SYSCALL_DEFINE3(get_robust_list, int, pid, struct robust_list_head __user * __user *, head_ptr, size_t __user *, len_ptr) { - struct robust_list_head __user *head; -unsigned long ret; -struct task_struct *p; - -rcu_read_lock (); - - ret = -ESRCH ; -if (!pid) - p = current; -else { - p =find_task_by_vpid (pid); -if (!p) - goto err_unlock; - } - - ret = -EPERM ; -if (!ptrace_may_access (p,PTRACE_MODE_READ_REALCREDS )) - goto err_unlock; + struct robust_list_head __user *head = futex_get_robust_list_common(pid, false); - head = p->robust_list; -rcu_read_unlock (); +if (IS_ERR (head)) +return PTR_ERR (head);if (put_user (sizeof (*head), len_ptr))return -EFAULT ;return put_user (head, head_ptr); - -err_unlock: -rcu_read_unlock (); - -return ret; } long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
@@ -455,36 +483,14 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid, compat_uptr_t __user *, head_ptr, compat_size_t __user *, len_ptr) { -struct compat_robust_list_head __user *head; -unsigned long ret; -struct task_struct *p; - -rcu_read_lock (); - - ret = -ESRCH ; -if (!pid) - p = current; -else { - p =find_task_by_vpid (pid); -if (!p) - goto err_unlock; - } - - ret = -EPERM ; -if (!ptrace_may_access (p,PTRACE_MODE_READ_REALCREDS )) - goto err_unlock; +struct compat_robust_list_head __user *head =futex_get_robust_list_common (pid, true); - head = p->compat_robust_list; -rcu_read_unlock (); +if (IS_ERR (head)) +return PTR_ERR (head);if (put_user (sizeof (*head), len_ptr))return -EFAULT ;return put_user (ptr_to_compat (head), head_ptr); - -err_unlock: -rcu_read_unlock (); - -return ret; }#endif /* CONFIG_COMPAT */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 196/849 selftests/bpf: Fix selftest verifier_arena_large failure
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit 5a427fddec5e76360725a0f03df3a2a003efbe2e ]
With latest llvm22, I got the following verification failure:
... ; int big_alloc2(void *ctx) @ verifier_arena_large.c:207 0: (b4) w6 = 1 ; R6_w=1 ... ; if (err) @ verifier_arena_large.c:233 53: (56) if w6 != 0x0 goto pc+62 ; R6=0 54: (b7) r7 = -4 ; R7_w=-4 55: (18) r8 = 0x7f4000000000 ; R8_w=scalar() 57: (bf) r9 = addr_space_cast(r8, 0, 1) ; R8_w=scalar() R9_w=arena 58: (b4) w6 = 5 ; R6_w=5 ; pg = page[i]; @ verifier_arena_large.c:238 59: (bf) r1 = r7 ; R1_w=-4 R7_w=-4 60: (07) r1 += 4 ; R1_w=0 61: (79) r2 = *(u64 *)(r9 +0) ; R2_w=scalar() R9_w=arena ; if (*pg != i) @ verifier_arena_large.c:239 62: (bf) r3 = addr_space_cast(r2, 0, 1) ; R2_w=scalar() R3_w=arena 63: (71) r3 = *(u8 *)(r3 +0) ; R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff)) 64: (5d) if r1 != r3 goto pc+51 ; R1_w=0 R3_w=0 ; bpf_arena_free_pages(&arena, (void __arena *)pg, 2); @ verifier_arena_large.c:241 65: (18) r1 = 0xff11000114548000 ; R1_w=map_ptr(map=arena,ks=0,vs=0) 67: (b4) w3 = 2 ; R3_w=2 68: (85) call bpf_arena_free_pages#72675 ; 69: (b7) r1 = 0 ; R1_w=0 ; page[i + 1] = NULL; @ verifier_arena_large.c:243 70: (7b) *(u64 *)(r8 +8) = r1 R8 invalid mem access 'scalar' processed 61 insns (limit 1000000) max_states_per_insn 0 total_states 6 peak_states 6 mark_read 2 ============= #489/5 verifier_arena_large/big_alloc2:FAIL
The main reason is that 'r8' in insn '70' is not an arena pointer. Further debugging at llvm side shows that llvm commit ([1]) caused the failure. For the original code:
page[i] = NULL;
page[i + 1] = NULL;
the llvm transformed it to something like below at source level:
__builtin_memset(&page[i], 0, 16)
Such transformation prevents llvm BPFCheckAndAdjustIR pass from generating proper addr_space_cast insns ([2]).
Adding support in llvm BPFCheckAndAdjustIR pass should work, but not sure that such a pattern exists or not in real applications. At the same time, simply adding a memory barrier between two 'page' assignment can fix the issue.
[1] https://github.com/llvm/llvm-project/pull/155415
[2] https://github.com/llvm/llvm-project/pull/84410
--- tools/testing/selftests/bpf/progs/verifier_arena_large.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/progs/verifier_arena_large.c +1 -0
@@ -240,6 +240,7 @@ int big_alloc2(void *ctx)return 5 ; bpf_arena_free_pages(&arena, (void __arena *)pg, 2); page[i] =NULL ; +barrier (); page[i +1 ] =NULL ; cond_break; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 197/849 selftests: ublk: fix behavior when fio is not installed
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uday Shankar <[email protected]>
[ Upstream commit a3835a44107fcbf05f183b5e8b60a8e4605b15ea ]
Some ublk selftests have strange behavior when fio is not installed. While most tests behave correctly (run if they don't need fio, or skip if they need fio), the following tests have different behavior:
- test_null_01, test_null_02, test_generic_01, test_generic_02, and test_generic_12 try to run fio without checking if it exists first, and fail on any failure of the fio command (including "fio command not found"). So these tests fail when they should skip.
- test_stress_05 runs fio without checking if it exists first, but doesn't fail on fio command failure. This test passes, but that pass is misleading as the test doesn't do anything useful without fio installed. So this test passes when it should skip.
Fix these issues by adding _have_program fio checks to the top of all of these tests.
--- tools/testing/selftests/ublk/test_generic_01.sh | 4 ++++ tools/testing/selftests/ublk/test_generic_02.sh | 4 ++++ tools/testing/selftests/ublk/test_generic_12.sh | 4 ++++ tools/testing/selftests/ublk/test_null_01.sh | 4 ++++ tools/testing/selftests/ublk/test_null_02.sh | 4 ++++ tools/testing/selftests/ublk/test_stress_05.sh | 4 ++++ 6 files changed, 24 insertions(+)
tools/testing/selftests/ublk/test_generic_01.sh +4 -0
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then exit "$UBLK_SKIP_CODE" fi +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + _prep_test "null" "sequential io order" dev_id=$(_add_ublk_dev -t null)
tools/testing/selftests/ublk/test_generic_02.sh +4 -0
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then exit "$UBLK_SKIP_CODE" fi +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + _prep_test "null" "sequential io order for MQ" dev_id=$(_add_ublk_dev -t null -q 2)
tools/testing/selftests/ublk/test_generic_12.sh +4 -0
@@ -10,6 +10,10 @@ if ! _have_program bpftrace; then exit "$UBLK_SKIP_CODE" fi +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + _prep_test "null" "do imbalanced load, it should be balanced over I/O threads" NTHREADS=6
tools/testing/selftests/ublk/test_null_01.sh +4 -0
@@ -6,6 +6,10 @@ TID="null_01" ERR_CODE=0 +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + _prep_test "null" "basic IO test" dev_id=$(_add_ublk_dev -t null)
tools/testing/selftests/ublk/test_null_02.sh +4 -0
@@ -6,6 +6,10 @@ TID="null_02" ERR_CODE=0 +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + _prep_test "null" "basic IO test with zero copy" dev_id=$(_add_ublk_dev -t null -z)
tools/testing/selftests/ublk/test_stress_05.sh +4 -0
@@ -5,6 +5,10 @@ TID="stress_05" ERR_CODE=0 +if ! _have_program fio; then + exit "$UBLK_SKIP_CODE" +fi + run_io_and_remove() { local size=$1
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 198/849 spi: rpc-if: Add resume support for RZ/G3E
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biju Das <[email protected]>
[ Upstream commit ad4728740bd68d74365a43acc25a65339a9b2173 ]
On RZ/G3E using PSCI, s2ram powers down the SoC. After resume, reinitialize the hardware for SPI operations.
--- drivers/spi/spi-rpc-if.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-rpc-if.c +2 -0
@@ -207,6 +207,8 @@ static int __maybe_unused rpcif_spi_resume(struct device *dev) {struct spi_controller *ctlr =dev_get_drvdata (dev); +rpcif_hw_init (dev, false); +return spi_controller_resume (ctlr); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 199/849 ACPI: SPCR: Support Precise Baud Rate field
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Pei <[email protected]>
[ Upstream commit 4d330fe54145ecfbb657ac01a554fdedf3c1927e ]
The Microsoft Serial Port Console Redirection (SPCR) specification revision 1.09 comprises additional field: Precise Baud Rate [1].
It is used to describe non-traditional baud rates (such as those used by high-speed UARTs).
It contains a specific non-zero baud rate which overrides the value of the Configured Baud Rate field. If this field is zero or not present, Configured Baud Rate is used.
--- drivers/acpi/spcr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/acpi/spcr.c +9 -1
@@ -146,7 +146,15 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) goto done; } -switch (table->baud_rate) { +/* +* SPCR 1.09 defines Precise Baud Rate Filed contains a specific +* non-zero baud rate which overrides the value of the Configured +* Baud Rate field. If this field is zero or not present, Configured +* Baud Rate is used. +*/ +if (table->precise_baudrate) + baud_rate = table->precise_baudrate; +else switch (table->baud_rate) {case 0 :/* * SPCR 1.04 defines 0 as a preconfigured state of UART.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 200/849 clocksource/drivers/vf-pit: Replace raw_readl/writel to readl/writel
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
[ Upstream commit 0b781f527d6f99e68e5b3780ae03cd69a7cb5c0c ]
The driver uses the raw_readl() and raw_writel() functions. Those are not for MMIO devices. Replace them with readl() and writel()
[ dlezcano: Fixed typo in the subject s/reald/readl/ ]
--- drivers/clocksource/timer-vf-pit.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/clocksource/timer-vf-pit.c +11 -11
@@ -35,30 +35,30 @@ static unsigned long cycle_per_jiffy;static inline void pit_timer_enable (void ) { -__raw_writel (PITTCTRL_TEN |PITTCTRL_TIE , clkevt_base +PITTCTRL ); +writel (PITTCTRL_TEN |PITTCTRL_TIE , clkevt_base +PITTCTRL ); }static inline void pit_timer_disable (void ) { -__raw_writel (0 , clkevt_base +PITTCTRL ); +writel (0 , clkevt_base +PITTCTRL ); }static inline void pit_irq_acknowledge (void ) { -__raw_writel (PITTFLG_TIF , clkevt_base +PITTFLG ); +writel (PITTFLG_TIF , clkevt_base +PITTFLG ); } static u64 notrace pit_read_sched_clock(void) { -return ~__raw_readl (clksrc_base +PITCVAL ); +return ~readl (clksrc_base +PITCVAL ); }static int __init pit_clocksource_init (unsigned long rate) {/* set the max load value and start the clock source counter */ -__raw_writel (0 , clksrc_base +PITTCTRL ); -__raw_writel (~0UL , clksrc_base +PITLDVAL ); -__raw_writel (PITTCTRL_TEN , clksrc_base +PITTCTRL ); +writel (0 , clksrc_base +PITTCTRL ); +writel (~0UL , clksrc_base +PITLDVAL ); +writel (PITTCTRL_TEN , clksrc_base +PITTCTRL );sched_clock_register (pit_read_sched_clock,32 , rate); return clocksource_mmio_init(clksrc_base + PITCVAL, "vf-pit", rate,
@@ -76,7 +76,7 @@ static int pit_set_next_event(unsigned long delta,* hardware requirement. */ pit_timer_disable (); -__raw_writel (delta -1 , clkevt_base +PITLDVAL ); +writel (delta -1 , clkevt_base +PITLDVAL );pit_timer_enable ();return 0 ;
@@ -125,8 +125,8 @@ static struct clock_event_device clockevent_pit = {static int __init pit_clockevent_init (unsigned long rate,int irq) { -__raw_writel (0 , clkevt_base +PITTCTRL ); -__raw_writel (PITTFLG_TIF , clkevt_base +PITTFLG ); +writel (0 , clkevt_base +PITTCTRL ); +writel (PITTFLG_TIF , clkevt_base +PITTFLG );BUG_ON (request_irq (irq, pit_timer_interrupt,IRQF_TIMER |IRQF_IRQPOLL ,"VF pit timer" , &clockevent_pit));
@@ -183,7 +183,7 @@ static int __init pit_timer_init(struct device_node *np) cycle_per_jiffy = clk_rate / (HZ );/* enable the pit module */ -__raw_writel (~PITMCR_MDIS , timer_base +PITMCR ); +writel (~PITMCR_MDIS , timer_base +PITMCR ); ret =pit_clocksource_init (clk_rate);if (ret)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 201/849 clocksource/drivers/timer-rtl-otto: Work around dying timers
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Stockhausen <[email protected]>
[ Upstream commit e7a25106335041aeca4fdf50a84804c90142c886 ]
The OpenWrt distribution has switched from kernel longterm 6.6 to 6.12. Reports show that devices with the Realtek Otto switch platform die during operation and are rebooted by the watchdog. Sorting out other possible reasons the Otto timer is to blame. The platform currently consists of 4 targets with different hardware revisions. It is not 100% clear which devices and revisions are affected.
Analysis shows:
A more aggressive sched/deadline handling leads to more timer starts with small intervals. This increases the bug chances. See
https://marc.info/?l=linux-kernel&m=175276556023276&w=2
Focusing on the real issue a hardware limitation on some devices was found. There is a minimal chance that a timer ends without firing an interrupt if it is reprogrammed within the 5us before its expiration time. Work around this issue by introducing a bounce() function. It restarts the timer directly before the normal restart functions as follows:
- Stop timer
- Restart timer with a slow frequency.
- Target time will be >5us
- The subsequent normal restart is outside the critical window
Downstream has already tested and confirmed a patch. See
https://github.com/openwrt/openwrt/pull/19468
https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/3788
--- drivers/clocksource/timer-rtl-otto.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/clocksource/timer-rtl-otto.c +20 -0
@@ -38,6 +38,7 @@#define RTTM_BIT_COUNT 28#define RTTM_MIN_DELTA 8#define RTTM_MAX_DELTA CLOCKSOURCE_MASK(28) +#define RTTM_MAX_DIVISOR GENMASK(15, 0)/* * Timers are derived from the LXB clock frequency. Usually this is a fixed
@@ -112,6 +113,22 @@ static irqreturn_t rttm_timer_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } +static void rttm_bounce_timer (void __iomem *base,u32 mode) +{ +/* +* When a running timer has less than ~5us left, a stop/start sequence +* might fail. While the details are unknown the most evident effect is +* that the subsequent interrupt will not be fired. +* +* As a workaround issue an intermediate restart with a very slow +* frequency of ~3kHz keeping the target counter (>=8). So the follow +* up restart will always be issued outside the critical window. +*/ + +rttm_disable_timer (base); +rttm_enable_timer (base, mode,RTTM_MAX_DIVISOR ); +} +static void rttm_stop_timer (void __iomem *base) {rttm_disable_timer (base);
@@ -129,6 +146,7 @@ static int rttm_next_event(unsigned long delta, struct clock_event_device *clkevstruct timer_of *to =to_timer_of (clkevt);RTTM_DEBUG (to->of_base.base); +rttm_bounce_timer (to->of_base.base,RTTM_CTRL_COUNTER );rttm_stop_timer (to->of_base.base);rttm_set_period (to->of_base.base, delta);rttm_start_timer (to,RTTM_CTRL_COUNTER );
@@ -141,6 +159,7 @@ static int rttm_state_oneshot(struct clock_event_device *clkevt)struct timer_of *to =to_timer_of (clkevt);RTTM_DEBUG (to->of_base.base); +rttm_bounce_timer (to->of_base.base,RTTM_CTRL_COUNTER );rttm_stop_timer (to->of_base.base);rttm_set_period (to->of_base.base,RTTM_TICKS_PER_SEC /HZ );rttm_start_timer (to,RTTM_CTRL_COUNTER );
@@ -153,6 +172,7 @@ static int rttm_state_periodic(struct clock_event_device *clkevt)struct timer_of *to =to_timer_of (clkevt);RTTM_DEBUG (to->of_base.base); +rttm_bounce_timer (to->of_base.base,RTTM_CTRL_TIMER );rttm_stop_timer (to->of_base.base);rttm_set_period (to->of_base.base,RTTM_TICKS_PER_SEC /HZ );rttm_start_timer (to,RTTM_CTRL_TIMER );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 202/849 clocksource/drivers/timer-rtl-otto: Do not interfere with interrupts
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Stockhausen <[email protected]>
[ Upstream commit c445bffbf28f721e05d0ce06895045fc62aaff7c ]
During normal operation the timers are reprogrammed including an interrupt acknowledgement. This has no effect as the whole timer is setup from scratch afterwards. Especially in an interrupt this has already been done by rttm_timer_interrupt().
Change the behaviour as follows:
- Use rttm_disable_timer() during reprogramming
- Keep rttm_stop_timer() for all other use cases.
Downstream has already tested and confirmed a patch. See
https://github.com/openwrt/openwrt/pull/19468
https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875/3788
--- drivers/clocksource/timer-rtl-otto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clocksource/timer-rtl-otto.c +3 -3
@@ -147,7 +147,7 @@ static int rttm_next_event(unsigned long delta, struct clock_event_device *clkevRTTM_DEBUG (to->of_base.base);rttm_bounce_timer (to->of_base.base,RTTM_CTRL_COUNTER ); -rttm_stop_timer (to->of_base.base); +rttm_disable_timer (to->of_base.base);rttm_set_period (to->of_base.base, delta);rttm_start_timer (to,RTTM_CTRL_COUNTER );
@@ -160,7 +160,7 @@ static int rttm_state_oneshot(struct clock_event_device *clkevt)RTTM_DEBUG (to->of_base.base);rttm_bounce_timer (to->of_base.base,RTTM_CTRL_COUNTER ); -rttm_stop_timer (to->of_base.base); +rttm_disable_timer (to->of_base.base);rttm_set_period (to->of_base.base,RTTM_TICKS_PER_SEC /HZ );rttm_start_timer (to,RTTM_CTRL_COUNTER );
@@ -173,7 +173,7 @@ static int rttm_state_periodic(struct clock_event_device *clkevt)RTTM_DEBUG (to->of_base.base);rttm_bounce_timer (to->of_base.base,RTTM_CTRL_TIMER ); -rttm_stop_timer (to->of_base.base); +rttm_disable_timer (to->of_base.base);rttm_set_period (to->of_base.base,RTTM_TICKS_PER_SEC /HZ );rttm_start_timer (to,RTTM_CTRL_TIMER );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 203/849 blk-cgroup: fix possible deadlock while configuring policy
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 5d726c4dbeeddef612e6bed27edd29733f4d13af ]
Following deadlock can be triggered easily by lockdep:
WARNING: possible circular locking dependency detected 6.17.0-rc3-00124-ga12c2658ced0 #1665 Not tainted
------------------------------------------------------
check/1334 is trying to acquire lock:ff1100011d9d0678 (&q->sysfs_lock){+.+.}-{4:4}, at: blk_unregister_queue+0x53/0x180
but task is already holding lock:ff1100011d9d00e0 (&q->q_usage_counter(queue)#3){++++}-{0:0}, at: del_gendisk+0xba/0x110
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&q->q_usage_counter(queue)#3){++++}-{0:0}:
blk_queue_enter+0x40b/0x470
blkg_conf_prep+0x7b/0x3c0
tg_set_limit+0x10a/0x3e0
cgroup_file_write+0xc6/0x420
kernfs_fop_write_iter+0x189/0x280
vfs_write+0x256/0x490
ksys_write+0x83/0x190
__x64_sys_write+0x21/0x30
x64_sys_call+0x4608/0x4630
do_syscall_64+0xdb/0x6b0
entry_SYSCALL_64_after_hwframe+0x76/0x7e-> #1 (&q->rq_qos_mutex){+.+.}-{4:4}:
__mutex_lock+0xd8/0xf50
mutex_lock_nested+0x2b/0x40
wbt_init+0x17e/0x280
wbt_enable_default+0xe9/0x140
blk_register_queue+0x1da/0x2e0
__add_disk+0x38c/0x5d0
add_disk_fwnode+0x89/0x250
device_add_disk+0x18/0x30
virtblk_probe+0x13a3/0x1800
virtio_dev_probe+0x389/0x610
really_probe+0x136/0x620
__driver_probe_device+0xb3/0x230
driver_probe_device+0x2f/0xe0
__driver_attach+0x158/0x250
bus_for_each_dev+0xa9/0x130
driver_attach+0x26/0x40
bus_add_driver+0x178/0x3d0
driver_register+0x7d/0x1c0
__register_virtio_driver+0x2c/0x60
virtio_blk_init+0x6f/0xe0
do_one_initcall+0x94/0x540
kernel_init_freeable+0x56a/0x7b0
kernel_init+0x2b/0x270
ret_from_fork+0x268/0x4c0
ret_from_fork_asm+0x1a/0x30-> #0 (&q->sysfs_lock){+.+.}-{4:4}:
__lock_acquire+0x1835/0x2940
lock_acquire+0xf9/0x450
__mutex_lock+0xd8/0xf50
mutex_lock_nested+0x2b/0x40
blk_unregister_queue+0x53/0x180
__del_gendisk+0x226/0x690
del_gendisk+0xba/0x110
sd_remove+0x49/0xb0 [sd_mod]
device_remove+0x87/0xb0
device_release_driver_internal+0x11e/0x230
device_release_driver+0x1a/0x30
bus_remove_device+0x14d/0x220
device_del+0x1e1/0x5a0
__scsi_remove_device+0x1ff/0x2f0
scsi_remove_device+0x37/0x60
sdev_store_delete+0x77/0x100
dev_attr_store+0x1f/0x40
sysfs_kf_write+0x65/0x90
kernfs_fop_write_iter+0x189/0x280
vfs_write+0x256/0x490
ksys_write+0x83/0x190
__x64_sys_write+0x21/0x30
x64_sys_call+0x4608/0x4630
do_syscall_64+0xdb/0x6b0
entry_SYSCALL_64_after_hwframe+0x76/0x7eother info that might help us debug this:
Chain exists of: &q->sysfs_lock --> &q->rq_qos_mutex --> &q->q_usage_counter(queue)#3 Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&q->q_usage_counter(queue)#3);
lock(&q->rq_qos_mutex);
lock(&q->q_usage_counter(queue)#3); lock(&q->sysfs_lock);
Root cause is that queue_usage_counter is grabbed with rq_qos_mutex held in blkg_conf_prep(), while queue should be freezed before rq_qos_mutex from other context.
The blk_queue_enter() from blkg_conf_prep() is used to protect against policy deactivation, which is already protected with blkcg_mutex, hence convert blk_queue_enter() to blkcg_mutex to fix this problem. Meanwhile, consider that blkcg_mutex is held after queue is freezed from policy deactivation, also convert blkg_alloc() to use GFP_NOIO.
--- block/blk-cgroup.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
block/blk-cgroup.c +8 -15
@@ -874,14 +874,8 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, disk = ctx->bdev->bd_disk; q = disk->queue; -/* -* blkcg_deactivate_policy() requires queue to be frozen, we can grab -* q_usage_counter to prevent concurrent with blkcg_deactivate_policy(). -*/ - ret =blk_queue_enter (q,0 ); -if (ret) - goto fail; - +/* Prevent concurrent with blkcg_deactivate_policy() */ +mutex_lock (&q->blkcg_mutex);spin_lock_irq (&q->queue_lock);if (!blkcg_policy_enabled (q, pol)) {
@@ -911,16 +905,16 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,/* Drop locks to do new blkg allocation with GFP_KERNEL. */ spin_unlock_irq (&q->queue_lock); - new_blkg =blkg_alloc (pos, disk,GFP_KERNEL ); + new_blkg =blkg_alloc (pos, disk,GFP_NOIO );if (unlikely (!new_blkg)) { ret = -ENOMEM ; - goto fail_exit_queue; + goto fail_exit; }if (radix_tree_preload (GFP_KERNEL )) {blkg_free (new_blkg); ret = -ENOMEM ; - goto fail_exit_queue; + goto fail_exit; }spin_lock_irq (&q->queue_lock);
@@ -948,7 +942,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, goto success; } success: -blk_queue_exit (q); +mutex_unlock (&q->blkcg_mutex); ctx->blkg = blkg;return 0 ;
@@ -956,9 +950,8 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,radix_tree_preload_end (); fail_unlock:spin_unlock_irq (&q->queue_lock); -fail_exit_queue: -blk_queue_exit (q); -fail: +fail_exit: +mutex_unlock (&q->blkcg_mutex);/* * If queue was bypassing, we should retry. Do so after a * short msleep(). It isn't strictly necessary but queue
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 204/849 riscv: bpf: Fix uninitialized symbol retval_off
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chenghao Duan <[email protected]>
[ Upstream commit d0bf7cd5df18466d969bb60e8890b74cf96081ca ]
In the __arch_prepare_bpf_trampoline() function, retval_off is only meaningful when save_ret is true, so the current logic is correct. However, in the original logic, retval_off is only initialized under certain conditions; for example, in the fmod_ret logic, the compiler is not aware that the flags of the fmod_ret program (prog) have set BPF_TRAMP_F_CALL_ORIG, which results in an uninitialized symbol compilation warning.
So initialize retval_off unconditionally to fix it.
--- arch/riscv/net/bpf_jit_comp64.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/riscv/net/bpf_jit_comp64.c +2 -3
@@ -1112,10 +1112,9 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, stack_size +=16 ; save_ret = flags & (BPF_TRAMP_F_CALL_ORIG |BPF_TRAMP_F_RET_FENTRY_RET ); -if (save_ret) { +if (save_ret) stack_size +=16 ;/* Save both A5 (BPF R0) and A0 */ - retval_off = stack_size; - } + retval_off = stack_size; stack_size += nr_arg_slots *8 ; args_off = stack_size;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 205/849 bpf: Clear pfmemalloc flag when freeing all fragments
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amery Hung <[email protected]>
[ Upstream commit 8f12d1137c2382c80aada8e05d7cc650cd4e403c ]
It is possible for bpf_xdp_adjust_tail() to free all fragments. The kfunc currently clears the XDP_FLAGS_HAS_FRAGS bit, but not XDP_FLAGS_FRAGS_PF_MEMALLOC. So far, this has not caused a issue when building sk_buff from xdp_buff since all readers of xdp_buff->flags use the flag only when there are fragments. Clear the XDP_FLAGS_FRAGS_PF_MEMALLOC bit as well to make the flags correct.
--- include/net/xdp.h | 5 +++++ net/core/filter.c | 1 + 2 files changed, 6 insertions(+)
include/net/xdp.h +5 -0
@@ -115,6 +115,11 @@ static __always_inline void xdp_buff_set_frag_pfmemalloc(struct xdp_buff *xdp) xdp->flags |=XDP_FLAGS_FRAGS_PF_MEMALLOC ; } +static __always_inline void xdp_buff_clear_frag_pfmemalloc(struct xdp_buff *xdp) +{ + xdp->flags &= ~XDP_FLAGS_FRAGS_PF_MEMALLOC ; +} + static __always_inline voidxdp_init_buff (struct xdp_buff *xdp,u32 frame_sz,struct xdp_rxq_info *rxq) {
net/core/filter.c +1 -0
@@ -4212,6 +4212,7 @@ static int bpf_xdp_frags_shrink_tail(struct xdp_buff *xdp, int offset)if (unlikely (!sinfo->nr_frags)) {xdp_buff_clear_frags_flag (xdp); +xdp_buff_clear_frag_pfmemalloc (xdp); xdp->data_end -= offset; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 206/849 selftests: drv-net: Pull data before parsing headers
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amery Hung <[email protected]>
[ Upstream commit efec2e55bdefb889639a6e7fe1f1f2431cdddc6a ]
It is possible for drivers to generate xdp packets with data residing entirely in fragments. To keep parsing headers using direct packet access, call bpf_xdp_pull_data() to pull headers into the linear data area.
--- .../selftests/net/lib/xdp_native.bpf.c | 89 +++++++++++++++---- 1 file changed, 74 insertions(+), 15 deletions(-)
tools/testing/selftests/net/lib/xdp_native.bpf.c +74 -15
@@ -14,6 +14,8 @@#define MAX_PAYLOAD_LEN 5000#define MAX_HDR_LEN 64 +extern int bpf_xdp_pull_data(struct xdp_md *xdp, __u32 len) __ksym __weak; + enum {XDP_MODE =0 , XDP_PORT = 1,
@@ -68,30 +70,57 @@ static void record_stats(struct xdp_md *ctx, __u32 stat_type)static struct udphdr *filter_udphdr (struct xdp_md *ctx,__u16 port) { -void *data_end = (void *)(long )ctx->data_end; -void *data = (void *)(long )ctx->data;struct udphdr *udph =NULL ; -struct ethhdr *eth = data; +void *data, *data_end; +struct ethhdr *eth; +int err; + + err =bpf_xdp_pull_data (ctx,sizeof (*eth)); +if (err) +return NULL ; + + data_end = (void *)(long )ctx->data_end; + data = eth = (void *)(long )ctx->data;if (data +sizeof (*eth) > data_end)return NULL ;if (eth->h_proto ==bpf_htons (ETH_P_IP )) { -struct iphdr *iph = data +sizeof (*eth); +struct iphdr *iph; + + err =bpf_xdp_pull_data (ctx,sizeof (*eth) +sizeof (*iph) + +sizeof (*udph)); +if (err) +return NULL ; + + data_end = (void *)(long )ctx->data_end; + data = (void *)(long )ctx->data; + + iph = data +sizeof (*eth);if (iph +1 > (struct iphdr *)data_end || iph->protocol !=IPPROTO_UDP )return NULL ; - udph = (void *)eth +sizeof (*iph) +sizeof (*eth); - }else if (eth->h_proto ==bpf_htons (ETH_P_IPV6 )) { -struct ipv6hdr *ipv6h = data +sizeof (*eth); + udph = data +sizeof (*iph) +sizeof (*eth); + }else if (eth->h_proto ==bpf_htons (ETH_P_IPV6 )) { +struct ipv6hdr *ipv6h; + + err =bpf_xdp_pull_data (ctx,sizeof (*eth) +sizeof (*ipv6h) + +sizeof (*udph)); +if (err) +return NULL ; + + data_end = (void *)(long )ctx->data_end; + data = (void *)(long )ctx->data; + + ipv6h = data +sizeof (*eth);if (ipv6h +1 > (struct ipv6hdr *)data_end || ipv6h->nexthdr !=IPPROTO_UDP )return NULL ; - udph = (void *)eth +sizeof (*ipv6h) +sizeof (*eth); + udph = data +sizeof (*ipv6h) +sizeof (*eth); }else {return NULL ; }
@@ -145,17 +174,34 @@ static void swap_machdr(void *data)static int xdp_mode_tx_handler (struct xdp_md *ctx,__u16 port) { -void *data_end = (void *)(long )ctx->data_end; -void *data = (void *)(long )ctx->data;struct udphdr *udph =NULL ; -struct ethhdr *eth = data; +void *data, *data_end; +struct ethhdr *eth; +int err; + + err =bpf_xdp_pull_data (ctx,sizeof (*eth)); +if (err) +return XDP_PASS ; + + data_end = (void *)(long )ctx->data_end; + data = eth = (void *)(long )ctx->data;if (data +sizeof (*eth) > data_end)return XDP_PASS ;if (eth->h_proto ==bpf_htons (ETH_P_IP )) { -struct iphdr *iph = data +sizeof (*eth); -__be32 tmp_ip = iph->saddr; +struct iphdr *iph; +__be32 tmp_ip; + + err =bpf_xdp_pull_data (ctx,sizeof (*eth) +sizeof (*iph) + +sizeof (*udph)); +if (err) +return XDP_PASS ; + + data_end = (void *)(long )ctx->data_end; + data = (void *)(long )ctx->data; + + iph = data +sizeof (*eth);if (iph +1 > (struct iphdr *)data_end || iph->protocol !=IPPROTO_UDP )
@@ -169,8 +215,10 @@ static int xdp_mode_tx_handler(struct xdp_md *ctx, __u16 port)return XDP_PASS ;record_stats (ctx,STATS_RX ); + eth = data;swap_machdr ((void *)eth); + tmp_ip = iph->saddr; iph->saddr = iph->daddr; iph->daddr = tmp_ip;
@@ -178,9 +226,19 @@ static int xdp_mode_tx_handler(struct xdp_md *ctx, __u16 port)return XDP_TX ; - }else if (eth->h_proto ==bpf_htons (ETH_P_IPV6 )) { -struct ipv6hdr *ipv6h = data +sizeof (*eth); + }else if (eth->h_proto ==bpf_htons (ETH_P_IPV6 )) {struct in6_addr tmp_ipv6; +struct ipv6hdr *ipv6h; + + err =bpf_xdp_pull_data (ctx,sizeof (*eth) +sizeof (*ipv6h) + +sizeof (*udph)); +if (err) +return XDP_PASS ; + + data_end = (void *)(long )ctx->data_end; + data = (void *)(long )ctx->data; + + ipv6h = data +sizeof (*eth);if (ipv6h +1 > (struct ipv6hdr *)data_end || ipv6h->nexthdr !=IPPROTO_UDP )
@@ -194,6 +252,7 @@ static int xdp_mode_tx_handler(struct xdp_md *ctx, __u16 port)return XDP_PASS ;record_stats (ctx,STATS_RX ); + eth = data;swap_machdr ((void *)eth);__builtin_memcpy (&tmp_ipv6, &ipv6h->saddr,sizeof (tmp_ipv6));
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 207/849 nvme: Use non zero KATO for persistent discovery connections
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alistair Francis <[email protected]>
[ Upstream commit 2e482655019ab6fcfe8865b62432c6d03f0b5f80 ]
The NVMe Base Specification 2.1 states that:
"""
A host requests an explicit persistent connection ... by specifying a non-zero Keep Alive Timer value in the Connect command. """
As such if we are starting a persistent connection to a discovery controller and the KATO is currently 0 we need to update KATO to a non zero value to avoid continuous timeouts on the target.
--- drivers/nvme/host/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +7 -1
@@ -4990,8 +4990,14 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)* checking that they started once before, hence are reconnecting back. */ if (test_bit (NVME_CTRL_STARTED_ONCE , &ctrl->flags) && -nvme_discovery_ctrl (ctrl)) +nvme_discovery_ctrl (ctrl)) { +if (!ctrl->kato) { +nvme_stop_keep_alive (ctrl); + ctrl->kato =NVME_DEFAULT_KATO ; +nvme_start_keep_alive (ctrl); + }nvme_change_uevent (ctrl,"NVME_EVENT=rediscover" ); + }if (ctrl->queue_count >1 ) {nvme_queue_scan (ctrl);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 208/849 uprobe: Do not emulate/sstep original instruction when ip is changed
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit 4363264111e1297fa37aa39b0598faa19298ecca ]
If uprobe handler changes instruction pointer we still execute single step) or emulate the original instruction and increment the (new) ip with its length.
This makes the new instruction pointer bogus and application will likely crash on illegal instruction execution.
If user decided to take execution elsewhere, it makes little sense to execute the original instruction, so let's skip it.
--- kernel/events/uprobes.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/events/uprobes.c +7 -0
@@ -2741,6 +2741,13 @@ static void handle_swbp(struct pt_regs *regs)handler_chain (uprobe, regs); +/* +* If user decided to take execution elsewhere, it makes little sense +* to execute the original instruction, so let's skip it. +*/ +if (instruction_pointer (regs) != bp_vaddr) + goto out; +if (arch_uprobe_skip_sstep (&uprobe->arch, regs)) goto out;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 209/849 hwmon: (asus-ec-sensors) increase timeout for locking ACPI mutex
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Copeland <[email protected]>
[ Upstream commit 584d55be66ef151e6ef9ccb3dcbc0a2155559be1 ]
Some motherboards require more time to acquire the ACPI mutex, causing "Failed to acquire mutex" messages to appear in the kernel log. Increase the timeout from 500ms to 800ms to accommodate these cases.
--- drivers/hwmon/asus-ec-sensors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/asus-ec-sensors.c +1 -1
@@ -49,7 +49,7 @@ static char *mutex_path_override;*/ #define ASUS_EC_MAX_BANK 3 -#define ACPI_LOCK_DELAY_MS 500 +#define ACPI_LOCK_DELAY_MS 800/* ACPI mutex for locking access to the EC for the firmware */ #define ASUS_HW_ACCESS_MUTEX_ASMX "\\AMW0.ASMX"
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 210/849 hwmon: (dell-smm) Remove Dell Precision 490 custom config data
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit ddb61e737f04e3c6c8299c1e00bf17a42a7f05cf ]
It turns out the second fan on the Dell Precision 490 does not really support I8K_FAN_TURBO. Setting the fan state to 3 enables automatic fan control, just like on the other two fans. The reason why this was misinterpreted as turbo mode was that the second fan normally spins faster in automatic mode than in the previous fan states. Yet when in state 3, the fan speed reacts to heat exposure, exposing the automatic mode setting.
--- drivers/hwmon/dell-smm-hwmon.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/hwmon/dell-smm-hwmon.c +0 -14
@@ -1331,7 +1331,6 @@ struct i8k_config_data {enum i8k_configs {DELL_LATITUDE_D520 , -DELL_PRECISION_490 ,DELL_STUDIO ,DELL_XPS , };
@@ -1341,10 +1340,6 @@ static const struct i8k_config_data i8k_config_data[] __initconst = { .fan_mult = 1, .fan_max = I8K_FAN_TURBO, }, - [DELL_PRECISION_490] = { - .fan_mult = 1, - .fan_max = I8K_FAN_TURBO, - }, [DELL_STUDIO] = { .fan_mult = 1, .fan_max = I8K_FAN_HIGH,
@@ -1364,15 +1359,6 @@ static const struct dmi_system_id i8k_config_dmi_table[] __initconst = { }, .driver_data = (void *)&i8k_config_data[DELL_LATITUDE_D520], }, - { - .ident = "Dell Precision 490", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), -DMI_MATCH (DMI_PRODUCT_NAME , - "Precision WorkStation 490"), - }, - .driver_data = (void *)&i8k_config_data[DELL_PRECISION_490], - }, { .ident = "Dell Studio", .matches = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 211/849 hwmon: (dell-smm) Add support for Dell OptiPlex 7040
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 53d3bd48ef6ff1567a75ca77728968f5ab493cb4 ]
The Dell OptiPlex 7040 supports the legacy SMM interface for reading sensors and performing fan control. Whitelist this machine so that this driver loads automatically.
--- drivers/hwmon/dell-smm-hwmon.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/hwmon/dell-smm-hwmon.c +7 -0
@@ -1280,6 +1280,13 @@ static const struct dmi_system_id i8k_dmi_table[] __initconst = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "OptiPlex 7050"), }, }, + { + .ident = "Dell OptiPlex 7040", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "OptiPlex 7040"), + }, + }, { .ident ="Dell Precision" , .matches = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 212/849 tools/cpupower: Fix incorrect size in cpuidle_state_disable()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaushlendra Kumar <[email protected]>
[ Upstream commit 23199d2aa6dcaf6dd2da772f93d2c94317d71459 ]
Fix incorrect size parameter passed to cpuidle_state_write_file() in cpuidle_state_disable().
The function was incorrectly using sizeof(disable) which returns the size of the unsigned int variable (4 bytes) instead of the actual length of the string stored in the 'value' buffer.
Since 'value' is populated with snprintf() to contain the string representation of the disable value, we should use the length returned by snprintf() to get the correct string length for writing to the sysfs file.
This ensures the correct number of bytes is written to the cpuidle state disable file in sysfs.
--- tools/power/cpupower/lib/cpuidle.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/power/cpupower/lib/cpuidle.c +3 -2
@@ -233,6 +233,7 @@ int cpuidle_state_disable(unsigned int cpu, {char value[SYSFS_PATH_MAX ];int bytes_written; +int len;if (cpuidle_state_count (cpu) <= idlestate)return -1 ;
@@ -241,10 +242,10 @@ int cpuidle_state_disable(unsigned int cpu, idlestate_value_files[IDLESTATE_DISABLE]))return -2 ; -snprintf (value,SYSFS_PATH_MAX ,"%u" , disable); + len =snprintf (value,SYSFS_PATH_MAX ,"%u" , disable); bytes_written =cpuidle_state_write_file (cpu, idlestate,"disable" , - value,sizeof (disable)); + value, len);if (bytes_written)return 0 ;return -3 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 213/849 selftests/bpf: Fix flaky bpf_cookie selftest
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mykyta Yatsenko <[email protected]>
[ Upstream commit 105eb5dc74109a9f53c2f26c9a918d9347a73595 ]
bpf_cookie can fail on perf_event_open(), when it runs after the task_work selftest. The task_work test causes perf to lower sysctl_perf_event_sample_rate, and bpf_cookie uses sample_freq, which is validated against that sysctl. As a result, perf_event_open() rejects the attr if the (now tighter) limit is exceeded.
Quoted 1 line
From
perf_event_open():
if (attr.freq) {
if (attr.sample_freq > sysctl_perf_event_sample_rate)
return -EINVAL;
} else {
if (attr.sample_period & (1ULL << 63))
return -EINVAL;
}Switch bpf_cookie to use sample_period, which is not checked against sysctl_perf_event_sample_rate.
--- tools/testing/selftests/bpf/prog_tests/bpf_cookie.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/bpf_cookie.c +1 -2
@@ -450,8 +450,7 @@ static void pe_subtest(struct test_bpf_cookie *skel) attr.size =sizeof (attr); attr.type =PERF_TYPE_SOFTWARE ; attr.config =PERF_COUNT_SW_CPU_CLOCK ; - attr.freq =1 ; - attr.sample_freq =10000 ; + attr.sample_period =100000 ; pfd =syscall (__NR_perf_event_open, &attr,-1 ,0 ,-1 ,PERF_FLAG_FD_CLOEXEC );if (!ASSERT_GE (pfd,0 ,"perf_fd" )) goto cleanup;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 214/849 tools/power turbostat: Fix incorrect sorting of PMT telemetry
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaushlendra Kumar <[email protected]>
[ Upstream commit cafb47be3f38ad81306bf894e743bebc2ccf66ab ]
The pmt_telemdir_sort() comparison function was returning a boolean value (0 or 1) instead of the required negative, zero, or positive value for proper sorting. This caused unpredictable and incorrect ordering of telemetry directories named telem0, telem1, ..., telemN. Update the comparison logic to return -1, 0, or 1 based on the numerical value extracted from the directory name, ensuring correct numerical ordering when using scandir.
This change improves stability and correctness when iterating PMT telemetry directories.
--- tools/power/x86/turbostat/turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +1 -1
@@ -1890,7 +1890,7 @@ int pmt_telemdir_sort(const struct dirent **a, const struct dirent **b)sscanf ((*a)->d_name,"telem%u" , &aidx);sscanf ((*b)->d_name,"telem%u" , &bidx); -return aidx >= bidx; +return (aidx > bidx) ?1 : (aidx < bidx) ?-1 :0 ; }const struct dirent *pmt_diriter_next (struct pmt_diriter_t *iter)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 215/849 tools/power x86_energy_perf_policy: Fix incorrect fopen mode usage
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kaushlendra Kumar <[email protected]>
[ Upstream commit 62127655b7ab7b8c2997041aca48a81bf5c6da0c ]
The fopen_or_die() function was previously hardcoded to open files in read-only mode ("r"), ignoring the mode parameter passed to it. This patch corrects fopen_or_die() to use the provided mode argument, allowing for flexible file access as intended.
Additionally, the call to fopen_or_die() inerr_on_hypervisor() incorrectly used the mode
"ro", which is not a valid fopen mode. This is
fixed to use the correct "r" mode.
--- .../power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c +2 -2
@@ -630,7 +630,7 @@ void cmdline(int argc, char **argv)*/ FILE *fopen_or_die (const char *path,const char *mode) { -FILE *filep =fopen (path,"r" ); +FILE *filep =fopen (path, mode);if (!filep)err (1 ,"%s: open failed" , path);
@@ -644,7 +644,7 @@ void err_on_hypervisor(void)char *buffer;/* On VMs /proc/cpuinfo contains a "flags" entry for hypervisor */ - cpuinfo =fopen_or_die ("/proc/cpuinfo" ,"ro" ); + cpuinfo =fopen_or_die ("/proc/cpuinfo" ,"r" ); buffer =malloc (4096 );if (!buffer) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 216/849 tools/power x86_energy_perf_policy: Enhance HWP enable
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Len Brown <[email protected]>
[ Upstream commit c97c057d357c4b39b153e9e430bbf8976e05bd4e ]
On enabling HWP, preserve the reserved bits in MSR_PM_ENABLE.
Also, skip writing the MSR_PM_ENABLE if HWP is already enabled.
--- .../x86_energy_perf_policy/x86_energy_perf_policy.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c +9 -4
@@ -1166,13 +1166,18 @@ int update_hwp_request_pkg(int pkg)int enable_hwp_on_cpu (int cpu) { -unsigned long long msr; +unsigned long long old_msr, new_msr; + +get_msr (cpu,MSR_PM_ENABLE , &old_msr); + +if (old_msr &1 ) +return 0 ;/* already enabled */ -get_msr (cpu,MSR_PM_ENABLE , &msr); -put_msr (cpu,MSR_PM_ENABLE ,1 ); + new_msr = old_msr |1 ; +put_msr (cpu,MSR_PM_ENABLE , new_msr);if (verbose) -printf ("cpu%d: MSR_PM_ENABLE old: %d new: %d\n" , cpu, (unsigned int ) msr,1 ); +printf ("cpu%d: MSR_PM_ENABLE old: %llX new: %llX\n" , cpu, old_msr, new_msr);return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 217/849 tools/power x86_energy_perf_policy: Prefer driver HWP limits
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Len Brown <[email protected]>
[ Upstream commit 2734fdbc9bb8a3aeb309ba0d62212d7f53f30bc7 ]
When we are successful in using cpufreq min/max limits, skip setting the raw MSR limits entirely.
This is necessary to avoid undoing any modification that the cpufreq driver makes to our sysfs request.
eg. intel_pstate may take our request for a limit that is valid according to HWP.CAP.MIN/MAX and clip it to be within the range available in PLATFORM_INFO.
--- .../x86_energy_perf_policy/x86_energy_perf_policy.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c +9 -4
@@ -62,6 +62,7 @@ unsigned char turbo_update_value;unsigned char update_hwp_epp;unsigned char update_hwp_min;unsigned char update_hwp_max; +unsigned char hwp_limits_done_via_sysfs;unsigned char update_hwp_desired;unsigned char update_hwp_window;unsigned char update_hwp_use_pkg;
@@ -951,8 +952,10 @@ int ratio_2_sysfs_khz(int ratio) }/* * If HWP is enabled and cpufreq sysfs attribtes are present, -* then update sysfs, so that it will not become -* stale when we write to MSRs. +* then update via sysfs. The intel_pstate driver may modify (clip) +* this request, say, when HWP_CAP is outside of PLATFORM_INFO limits, +* and the driver-chosen value takes precidence. +* * (intel_pstate's max_perf_pct and min_perf_pct will follow cpufreq, * so we don't have to touch that.) */
@@ -1007,6 +1010,8 @@ int update_sysfs(int cpu)if (update_hwp_max)update_cpufreq_scaling_freq (1 , cpu, req_update.hwp_max); + hwp_limits_done_via_sysfs =1 ; +return 0 ; }
@@ -1085,10 +1090,10 @@ int update_hwp_request(int cpu)if (debug)print_hwp_request (cpu, &req,"old: " ); -if (update_hwp_min) +if (update_hwp_min && !hwp_limits_done_via_sysfs) req.hwp_min = req_update.hwp_min; -if (update_hwp_max) +if (update_hwp_max && !hwp_limits_done_via_sysfs) req.hwp_max = req_update.hwp_max;if (update_hwp_desired)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 218/849 mfd: simple-mfd-i2c: Add compatible strings for Layerscape QIXIS FPGA
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit 81a2c31257411296862487aaade98b7d9e25dc72 ]
The QIXIS FPGA found on Layerscape boards such as LX2160AQDS, LS1028AQDS etc deals with power-on-reset timing, muxing etc. Use the simple-mfd-i2c as its core driver by adding its compatible string (already found in some dt files). By using the simple-mfd-i2c driver, any child device will have access to the i2c regmap created by it.
--- drivers/mfd/simple-mfd-i2c.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mfd/simple-mfd-i2c.c +2 -0
@@ -99,6 +99,8 @@ static const struct of_device_id simple_mfd_i2c_of_match[] = { { .compatible = "maxim,max5970", .data = &maxim_max5970}, { .compatible = "maxim,max5978", .data = &maxim_max5970}, { .compatible = "maxim,max77705-battery", .data = &maxim_mon_max77705}, + { .compatible = "fsl,lx2160aqds-fpga" }, + { .compatible = "fsl,ls1028aqds-fpga" }, {} };MODULE_DEVICE_TABLE (of, simple_mfd_i2c_of_match);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 219/849 mfd: stmpe: Remove IRQ domain upon removal
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 57bf2a312ab2d0bc8ee0f4e8a447fa94a2fc877d ]
The IRQ domain is (optionally) added during stmpe_probe, but never removed. Add the call to stmpe_remove.
--- drivers/mfd/stmpe.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mfd/stmpe.c +3 -0
@@ -1485,6 +1485,9 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)void stmpe_remove (struct stmpe *stmpe) { +if (stmpe->domain) +irq_domain_remove (stmpe->domain); +if (!IS_ERR (stmpe->vio) &®ulator_is_enabled (stmpe->vio))regulator_disable (stmpe->vio);if (!IS_ERR (stmpe->vcc) &®ulator_is_enabled (stmpe->vcc))
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 220/849 mfd: stmpe-i2c: Add missing MODULE_LICENSE
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
[ Upstream commit 00ea54f058cd4cb082302fe598cfe148e0aadf94 ]
This driver is licensed GPL-2.0-only, so add the corresponding module flag.
--- drivers/mfd/stmpe-i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/stmpe-i2c.c +1 -0
@@ -137,3 +137,4 @@ module_exit(stmpe_exit);MODULE_DESCRIPTION ("STMPE MFD I2C Interface Driver" );MODULE_AUTHOR ("Rabin Vincent <[email protected]>" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 221/849 mfd: qnap-mcu: Handle errors returned from qnap_mcu_write
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit bf2de43060d528e52e372c63182a94b95c80d305 ]
qnap_mcu_write can return errors and those were not checked before. So do that now.
--- drivers/mfd/qnap-mcu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mfd/qnap-mcu.c +5 -1
@@ -163,7 +163,11 @@ int qnap_mcu_exec(struct qnap_mcu *mcu, reply->received =0 ;reinit_completion (&reply->done); -qnap_mcu_write (mcu, cmd_data, cmd_data_size); + ret =qnap_mcu_write (mcu, cmd_data, cmd_data_size); +if (ret <0 ) { +mutex_unlock (&mcu->bus_lock); +return ret; + }serdev_device_wait_until_sent (mcu->serdev,msecs_to_jiffies (QNAP_MCU_TIMEOUT_MS ));
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 222/849 mfd: qnap-mcu: Include linux/types.h in qnap-mcu.h shared header
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 5e1c88679174e4bfe5d152060b06d370bd85de80 ]
Relying on other components to include those basic types is unreliable and may cause compile errors like:
../include/linux/mfd/qnap-mcu.h:13:9: error: unknown type name ‘u32’
13 | u32 baud_rate;
| ^~~
../include/linux/mfd/qnap-mcu.h:17:9: error: unknown type name ‘bool’
17 | bool usb_led;
| ^~~~So make sure, the types used in the header are available.
--- include/linux/mfd/qnap-mcu.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/mfd/qnap-mcu.h +2 -0
@@ -7,6 +7,8 @@#ifndef _LINUX_QNAP_MCU_H_#define _LINUX_QNAP_MCU_H_ +#include <linux/types.h> +struct qnap_mcu ; struct qnap_mcu_variant {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 223/849 mfd: madera: Work around false-positive -Wininitialized warning
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 364752aa0c6ab0a06a2d5bfdb362c1ca407f1a30 ]
clang-21 warns about one uninitialized variable getting dereferenced in madera_dev_init:
drivers/mfd/madera-core.c:739:10: error: variable 'mfd_devs' is uninitialized when used here [-Werror,-Wuninitialized]
739 | mfd_devs, n_devs,
| ^~~~~~~~
drivers/mfd/madera-core.c:459:33: note: initialize the variable 'mfd_devs' to silence this warning
459 | const struct mfd_cell *mfd_devs;
| ^
| = NULLThe code is actually correct here because n_devs is only nonzero when mfd_devs is a valid pointer, but this is impossible for the compiler to see reliably.
Change the logic to check for the pointer as well, to make this easier for the compiler to follow.
--- drivers/mfd/madera-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/madera-core.c +2 -2
@@ -456,7 +456,7 @@ int madera_dev_init(struct madera *madera)struct device *dev = madera->dev;unsigned int hwid;int (*patch_fn)(struct madera *) =NULL ; -const struct mfd_cell *mfd_devs; +const struct mfd_cell *mfd_devs =NULL ;int n_devs =0 ;int i, ret;
@@ -670,7 +670,7 @@ int madera_dev_init(struct madera *madera) goto err_reset; } -if (!n_devs) { +if (!n_devs || !mfd_devs) {dev_err (madera->dev,"Device ID 0x%x not a %s\n" , hwid, madera->type_name); ret = -ENODEV ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 224/849 mfd: da9063: Split chip variant reading in two bus transactions
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Kehne <[email protected]>
[ Upstream commit 9ac4890ac39352ccea132109e32911495574c3ec ]
We observed the initial probe of the da9063 failing in da9063_get_device_type in about 30% of boots on a Xilinx ZynqMP based board. The problem originates in da9063_i2c_blockreg_read, which uses a single bus transaction to turn the register page and then read a register. On the bus, this should translate to a write to register 0, followed by a read to the target register, separated by a repeated start. However, we found that after the write to register 0, the controller sometimes continues directly with the register address of the read request, without sending the chip address or a repeated start in between, which makes the read request invalid.
To fix this, separate turning the page and reading the register into two separate transactions. This brings the initialization code in line with the rest of the driver, which uses register maps (which to my knowledge do not use repeated starts after turning the page). This has been included in our kernel for several months and was recently included in a shipped product. For us, it reliably fixes the issue, and we have not observed any new issues.
While the underlying problem is probably with the i2c controller or its driver, I still propose a change here in the interest of
robustness: First, I'm not sure this issue can be fixed on the controller side, since there are other issues related to repeated start which can't (AR# 60695, AR# 61664). Second, similar problems might exist with other controllers.
--- drivers/mfd/da9063-i2c.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/mfd/da9063-i2c.c +21 -6
@@ -37,9 +37,13 @@ enum da9063_page_sel_buf_fmt { DA9063_PAGE_SEL_BUF_SIZE, }; +enum da9063_page_sel_msgs { +DA9063_PAGE_SEL_MSG =0 , +DA9063_PAGE_SEL_CNT , +}; +enum da9063_paged_read_msgs { -DA9063_PAGED_READ_MSG_PAGE_SEL =0 , -DA9063_PAGED_READ_MSG_REG_SEL , +DA9063_PAGED_READ_MSG_REG_SEL =0 ,DA9063_PAGED_READ_MSG_DATA ,DA9063_PAGED_READ_MSG_CNT , };
@@ -65,10 +69,21 @@ static int da9063_i2c_blockreg_read(struct i2c_client *client, u16 addr, (page_num <<DA9063_I2C_PAGE_SEL_SHIFT ) &DA9063_REG_PAGE_MASK ;/* Write reg address, page selection */ - xfer[DA9063_PAGED_READ_MSG_PAGE_SEL ].addr = client->addr; - xfer[DA9063_PAGED_READ_MSG_PAGE_SEL ].flags =0 ; - xfer[DA9063_PAGED_READ_MSG_PAGE_SEL ].len =DA9063_PAGE_SEL_BUF_SIZE ; - xfer[DA9063_PAGED_READ_MSG_PAGE_SEL ].buf = page_sel_buf; + xfer[DA9063_PAGE_SEL_MSG ].addr = client->addr; + xfer[DA9063_PAGE_SEL_MSG ].flags =0 ; + xfer[DA9063_PAGE_SEL_MSG ].len =DA9063_PAGE_SEL_BUF_SIZE ; + xfer[DA9063_PAGE_SEL_MSG ].buf = page_sel_buf; + + ret =i2c_transfer (client->adapter, xfer,DA9063_PAGE_SEL_CNT ); +if (ret <0 ) { +dev_err (&client->dev,"Page switch failed: %d\n" , ret); +return ret; + } + +if (ret !=DA9063_PAGE_SEL_CNT ) { +dev_err (&client->dev,"Page switch failed to complete\n" ); +return -EIO ; + }/* Select register address */ xfer[DA9063_PAGED_READ_MSG_REG_SEL ].addr = client->addr;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 225/849 mfd: macsmc: Add "apple,t8103-smc" compatible
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janne Grunau <[email protected]>
[ Upstream commit 9b959e525fa7e8518e57554b6e17849942938dfc ]
After discussion with the devicetree maintainers we agreed to not extend lists with the generic compatible "apple,smc" anymore [1]. Use "apple,t8103-smc" as base compatible as it is the SoC the driver and bindings were written for.
[1]: https://lore.kernel.org/asahi/[email protected]/
--- drivers/mfd/macsmc.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/macsmc.c +1 -0
@@ -478,6 +478,7 @@ static int apple_smc_probe(struct platform_device *pdev) }static const struct of_device_id apple_smc_of_match[] = { + { .compatible ="apple,t8103-smc" }, { .compatible ="apple,smc" }, {}, };
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 226/849 mfd: core: Increment of_nodes refcount before linking it to the platform device
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bastien Curutchet <[email protected]>
[ Upstream commit 5f4bbee069836e51ed0b6d7e565a292f070ababc ]
When an MFD device is added, a platform_device is allocated. If this device is linked to a DT description, the corresponding OF node is linked to the new platform device but the OF node's refcount isn't incremented. As of_node_put() is called during the platform device release, it leads to a refcount underflow.
Call of_node_get() to increment the OF node's refcount when the node is linked to the newly created platform device.
--- drivers/mfd/mfd-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/mfd-core.c +1 -0
@@ -131,6 +131,7 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev, of_entry->np = np;list_add_tail (&of_entry->list, &mfd_of_node_list); +of_node_get (np);device_set_node (&pdev->dev,of_fwnode_handle (np));#endif return 0 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 227/849 mfd: cs42l43: Move IRQ enable/disable to encompass force suspend
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit 62aec8a0a5b61f149bbe518c636e38e484812499 ]
As pm_runtime_force_suspend() will force the device state to suspend, the driver needs to ensure no IRQ handlers are currently running. If not those handlers may find they are now running on suspended hardware despite holding a PM runtime reference. disable_irq() will sync any currently running handlers, so move the IRQ disabling to cover the whole of the forced suspend state to avoid such race conditions.
--- drivers/mfd/cs42l43.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/cs42l43.c +4 -4
@@ -1151,6 +1151,8 @@ static int cs42l43_suspend(struct device *dev)return ret; } +disable_irq (cs42l43->irq); + ret =pm_runtime_force_suspend (dev);if (ret) {dev_err (cs42l43->dev,"Failed to force suspend: %d\n" , ret);
@@ -1164,8 +1166,6 @@ static int cs42l43_suspend(struct device *dev)if (ret)return ret; -disable_irq (cs42l43->irq); -return 0 ; }
@@ -1196,14 +1196,14 @@ static int cs42l43_resume(struct device *dev)if (ret)return ret; -enable_irq (cs42l43->irq); - ret =pm_runtime_force_resume (dev);if (ret) {dev_err (cs42l43->dev,"Failed to force resume: %d\n" , ret);return ret; } +enable_irq (cs42l43->irq); +return 0 ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 228/849 mfd: intel-lpss: Add Intel Wildcat Lake LPSS PCI IDs
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
[ Upstream commit c91a0e4e549d0457c61f2199fcd84d699400bee1 ]
Add Intel Wildcat Lake PCI IDs.
--- drivers/mfd/intel-lpss-pci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mfd/intel-lpss-pci.c +13 -0
@@ -367,6 +367,19 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { { PCI_VDEVICE(INTEL, 0x4b79), (kernel_ulong_t)&ehl_i2c_info }, { PCI_VDEVICE(INTEL, 0x4b7a), (kernel_ulong_t)&ehl_i2c_info }, { PCI_VDEVICE(INTEL, 0x4b7b), (kernel_ulong_t)&ehl_i2c_info }, +/* WCL */ + { PCI_VDEVICE(INTEL, 0x4d25), (kernel_ulong_t)&bxt_uart_info }, + { PCI_VDEVICE(INTEL, 0x4d26), (kernel_ulong_t)&bxt_uart_info }, + { PCI_VDEVICE(INTEL, 0x4d27), (kernel_ulong_t)&tgl_spi_info }, + { PCI_VDEVICE(INTEL, 0x4d30), (kernel_ulong_t)&tgl_spi_info }, + { PCI_VDEVICE(INTEL, 0x4d46), (kernel_ulong_t)&tgl_spi_info }, + { PCI_VDEVICE(INTEL, 0x4d50), (kernel_ulong_t)&ehl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x4d51), (kernel_ulong_t)&ehl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x4d52), (kernel_ulong_t)&bxt_uart_info }, + { PCI_VDEVICE(INTEL, 0x4d78), (kernel_ulong_t)&ehl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x4d79), (kernel_ulong_t)&ehl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x4d7a), (kernel_ulong_t)&ehl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x4d7b), (kernel_ulong_t)&ehl_i2c_info },/* JSL */ { PCI_VDEVICE(INTEL, 0x4da8), (kernel_ulong_t)&spt_uart_info }, { PCI_VDEVICE(INTEL, 0x4da9), (kernel_ulong_t)&spt_uart_info },
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 229/849 drm/xe/ptl: Apply Wa_16026007364
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sk Anirban <[email protected]>
[ Upstream commit d72779c29d82c6e371cea8b427550bd6923c2577 ]
As part of this WA GuC will save and restore value of two XE3_Media control registers that were not included in the HW power context.
--- drivers/gpu/drm/xe/abi/guc_klvs_abi.h | 1 + drivers/gpu/drm/xe/xe_guc_ads.c | 35 +++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_wa_oob.rules | 1 + 3 files changed, 37 insertions(+)
drivers/gpu/drm/xe/abi/guc_klvs_abi.h +1 -0
@@ -421,6 +421,7 @@ enum xe_guc_klv_ids {GUC_WORKAROUND_KLV_ID_BACK_TO_BACK_RCS_ENGINE_RESET =0x9009 ,GUC_WA_KLV_WAKE_POWER_DOMAINS_FOR_OUTBOUND_MMIO =0x900a ,GUC_WA_KLV_RESET_BB_STACK_PTR_ON_VF_SWITCH =0x900b , + GUC_WA_KLV_RESTORE_UNSAVED_MEDIA_CONTROL_REG = 0x900c, };#endif
drivers/gpu/drm/xe/xe_guc_ads.c +35 -0
@@ -284,6 +284,35 @@ static size_t calculate_golden_lrc_size(struct xe_guc_ads *ads)return total_size; } +static void guc_waklv_enable_two_word (struct xe_guc_ads *ads, +enum xe_guc_klv_ids klv_id, +u32 value1, +u32 value2, +u32 *offset,u32 *remain) +{ +u32 size; +u32 klv_entry[] = { +/* 16:16 key/length */ +FIELD_PREP (GUC_KLV_0_KEY , klv_id) | +FIELD_PREP (GUC_KLV_0_LEN ,2 ), + value1, + value2, +/* 2 dword data */ + }; + + size =sizeof (klv_entry); + +if (*remain < size) { +drm_warn (&ads_to_xe (ads)->drm, +"w/a klv buffer too small to add klv id %d\n" , klv_id); + }else { +xe_map_memcpy_to (ads_to_xe (ads),ads_to_map (ads), *offset, + klv_entry, size); + *offset += size; + *remain -= size; + } +} + static void guc_waklv_enable_one_word(struct xe_guc_ads *ads, enum xe_guc_klv_ids klv_id, u32 value,
@@ -381,6 +410,12 @@ static void guc_waklv_init(struct xe_guc_ads *ads)guc_waklv_enable_simple (ads,GUC_WA_KLV_RESET_BB_STACK_PTR_ON_VF_SWITCH , &offset, &remain); +if (GUC_FIRMWARE_VER (>->uc.guc) >=MAKE_GUC_VER (70 ,47 ,0 ) &&XE_WA (gt,16026007364 )) +guc_waklv_enable_two_word (ads, +GUC_WA_KLV_RESTORE_UNSAVED_MEDIA_CONTROL_REG , +0x0 , +0xF , + &offset, &remain); size =guc_ads_waklv_size (ads) - remain;if (!size)
drivers/gpu/drm/xe/xe_wa_oob.rules +1 -0
@@ -73,3 +73,4 @@ no_media_l3 MEDIA_VERSION(3000) 14022085890 GRAPHICS_VERSION(2001) 15015404425_disable PLATFORM(PANTHERLAKE), MEDIA_STEP(B0, FOREVER) +16026007364 MEDIA_VERSION(3000)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 230/849 drm/xe/configfs: Enforce canonical device names
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wajdeczko <[email protected]>
[ Upstream commit 400a6da1e967c4f117e4757412df06dcfaea0e6a ]
While we expect config directory names to match PCI device name, currently we are only scanning provided names for domain, bus, device and function numbers, without checking their format. This would pass slightly broken entries like:
/sys/kernel/config/xe/
├── 0000:00:02.0000000000000
│ └── ...
├── 0000:00:02.0x
│ └── ...
├── 0: 0: 2. 0
│ └── ...
└── 0:0:2.0
└── ...To avoid such mistakes, check if the name provided exactly matches the canonical PCI device address format, which we recreated from the parsed BDF data. Also simplify scanf format as it can't really catch all formatting errors.
--- drivers/gpu/drm/xe/xe_configfs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_configfs.c +8 -1
@@ -259,12 +259,19 @@ static struct config_group *xe_config_make_device_group(struct config_group *grounsigned int domain, bus, slot, function;struct xe_config_device *dev;struct pci_dev *pdev; +char canonical[16 ];int ret; - ret =sscanf (name,"%04x:%02x:%02x.%x" , &domain, &bus, &slot, &function); + ret =sscanf (name,"%x:%x:%x.%x" , &domain, &bus, &slot, &function);if (ret !=4 )return ERR_PTR (-EINVAL ); + ret =scnprintf (canonical,sizeof (canonical),"%04x:%02x:%02x.%d" , domain, bus, +PCI_SLOT (PCI_DEVFN (slot, function)), +PCI_FUNC (PCI_DEVFN (slot, function))); +if (ret !=12 ||strcmp (name, canonical)) +return ERR_PTR (-EINVAL ); + pdev =pci_get_domain_bus_and_slot (domain, bus,PCI_DEVFN (slot, function));if (!pdev)return ERR_PTR (-ENODEV );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 231/849 drm/amd/display: Update tiled to tiled copy command
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ostrowski Rafal <[email protected]>
[ Upstream commit 19f76f2390be5abe8d5ed986780b73564ba2baca ]
[Why & How]
Tiled command rect dimensions is 1 based, do rect_x/y - 1 internally
--- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +2 -2
@@ -2072,8 +2072,8 @@ bool dmub_lsdma_send_tiled_to_tiled_copy_command( lsdma_data->u.tiled_copy_data.dst_swizzle_mode = params.swizzle_mode; lsdma_data->u.tiled_copy_data.src_element_size = params.element_size; lsdma_data->u.tiled_copy_data.dst_element_size = params.element_size; - lsdma_data->u.tiled_copy_data.rect_x = params.rect_x; - lsdma_data->u.tiled_copy_data.rect_y = params.rect_y; + lsdma_data->u.tiled_copy_data.rect_x = params.rect_x -1 ; + lsdma_data->u.tiled_copy_data.rect_y = params.rect_y -1 ; lsdma_data->u.tiled_copy_data.dcc = params.dcc; lsdma_data->u.tiled_copy_data.tmz = params.tmz; lsdma_data->u.tiled_copy_data.read_compress = params.read_compress;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 232/849 drm/amd/display: fix condition for setting timing_adjust_pending
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurabindo Pillai <[email protected]>
[ Upstream commit 1a6a3374ecb9899ccf0d209b5783a796bdba8cec ]
timing_adjust_pending is used to defer certain programming sequences when OTG timing is about to be changed, like with VRR. Insufficient checking for timing change in this case caused a regression which reduces PSR Replay residency.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -1
@@ -459,7 +459,9 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,* avoid conflicting with firmware updates. */ if (dc->ctx->dce_version >DCE_VERSION_MAX ) { -if (dc->optimized_required || dc->wm_optimized_required) { +if ((dc->optimized_required || dc->wm_optimized_required) && + (stream->adjust.v_total_max != adjust->v_total_max || + stream->adjust.v_total_min != adjust->v_total_min)) { stream->adjust.timing_adjust_pending = true;return false; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 233/849 drm/amd/display: ensure committing streams is seamless
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clay King <[email protected]>
[ Upstream commit ca74cc428f2b9d0170c56b473dbcfd7fa01daf2d ]
[Why]
When transitioning between topologies such as multi-display to single display ODM 2:1, pipes might not be freed before use.
[How]
In dc_commit_streams, commit an additional, minimal transition if original transition is not seamless to ensure pipes are freed.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +12 -0
@@ -2413,6 +2413,18 @@ enum dc_status dc_commit_streams(struct dc *dc, struct dc_commit_streams_params goto fail; } +/* +* If not already seamless, make transition seamless by inserting intermediate minimal transition +*/ +if (dc->hwss.is_pipe_topology_transition_seamless && + !dc->hwss.is_pipe_topology_transition_seamless (dc, dc->current_state, context)) { + res =commit_minimal_transition_state (dc, context); +if (res !=DC_OK ) { +BREAK_TO_DEBUGGER (); + goto fail; + } + } + res =dc_commit_state_no_check (dc, context);for (i =0 ; i < params->stream_count; i++) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 234/849 drm/amdgpu: add range check for RAS bad page address
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Zhou <[email protected]>
[ Upstream commit 2b17c240e8cd9ac61d3c82277fbed27edad7f002 ]
Exclude invalid bad pages.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 58 ++++++++++++------------- 1 file changed, 28 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +28 -30
@@ -136,9 +136,9 @@ enum amdgpu_ras_retire_page_reservation {atomic_t amdgpu_ras_in_intr =ATOMIC_INIT (0 ); -static bool amdgpu_ras_check_bad_page_unlock (struct amdgpu_ras *con, +static int amdgpu_ras_check_bad_page_unlock (struct amdgpu_ras *con,uint64_t addr); -static bool amdgpu_ras_check_bad_page (struct amdgpu_device *adev, +static int amdgpu_ras_check_bad_page (struct amdgpu_device *adev,uint64_t addr);#ifdef CONFIG_X86_MCE_AMD static void amdgpu_register_bad_pages_mca_notifier (struct amdgpu_device *adev);
@@ -169,18 +169,16 @@ static int amdgpu_reserve_page_direct(struct amdgpu_device *adev, uint64_t addrestruct eeprom_table_record err_rec;int ret; -if ((address >= adev->gmc.mc_vram_size) || - (address >=RAS_UMC_INJECT_ADDR_LIMIT )) { + ret =amdgpu_ras_check_bad_page (adev, address); +if (ret == -EINVAL ) {dev_warn (adev->dev, -"RAS WARN: input address 0x%llx is invalid.\n" , - address); +"RAS WARN: input address 0x%llx is invalid.\n" , + address);return -EINVAL ; - } - -if (amdgpu_ras_check_bad_page (adev, address)) { + }else if (ret ==1 ) {dev_warn (adev->dev, -"RAS WARN: 0x%llx has already been marked as bad page!\n" , - address); +"RAS WARN: 0x%llx has already been marked as bad page!\n" , + address);return 0 ; }
@@ -513,22 +511,16 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, ret =amdgpu_ras_feature_enable (adev, &data.head,1 );break ;case 2 : -if ((data.inject.address >= adev->gmc.mc_vram_size && - adev->gmc.mc_vram_size) || - (data.inject.address >=RAS_UMC_INJECT_ADDR_LIMIT )) { -dev_warn (adev->dev,"RAS WARN: input address " -"0x%llx is invalid." , +/* umc ce/ue error injection for a bad page is not allowed */ +if (data.head.block ==AMDGPU_RAS_BLOCK__UMC ) + ret =amdgpu_ras_check_bad_page (adev, data.inject.address); +if (ret == -EINVAL ) { +dev_warn (adev->dev,"RAS WARN: input address 0x%llx is invalid." , data.inject.address); - ret = -EINVAL ;break ; - } - -/* umc ce/ue error injection for a bad page is not allowed */ -if ((data.head.block ==AMDGPU_RAS_BLOCK__UMC ) && -amdgpu_ras_check_bad_page (adev, data.inject.address)) { -dev_warn (adev->dev,"RAS WARN: inject: 0x%llx has " -"already been marked as bad!\n" , - data.inject.address); + }else if (ret ==1 ) { +dev_warn (adev->dev,"RAS WARN: inject: 0x%llx has already been marked as bad!\n" , + data.inject.address);break ; }
@@ -3134,18 +3126,24 @@ static int amdgpu_ras_load_bad_pages(struct amdgpu_device *adev)return ret; } -static bool amdgpu_ras_check_bad_page_unlock (struct amdgpu_ras *con, +static int amdgpu_ras_check_bad_page_unlock (struct amdgpu_ras *con,uint64_t addr) {struct ras_err_handler_data *data = con->eh_data; +struct amdgpu_device *adev = con->adev;int i; +if ((addr >= adev->gmc.mc_vram_size && + adev->gmc.mc_vram_size) || + (addr >=RAS_UMC_INJECT_ADDR_LIMIT )) +return -EINVAL ; + addr >>=AMDGPU_GPU_PAGE_SHIFT ;for (i =0 ; i < data->count; i++)if (addr == data->bps[i].retired_page) -return true; +return 1 ; -return false; +return 0 ; }/*
@@ -3153,11 +3151,11 @@ static bool amdgpu_ras_check_bad_page_unlock(struct amdgpu_ras *con,* * Note: this check is only for umc block */ -static bool amdgpu_ras_check_bad_page (struct amdgpu_device *adev, +static int amdgpu_ras_check_bad_page (struct amdgpu_device *adev,uint64_t addr) {struct amdgpu_ras *con =amdgpu_ras_get_context (adev); -bool ret = false; +int ret =0 ;if (!con || !con->eh_data)return ret;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 235/849 drm/amdgpu: Check vcn sram load return value
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sathishkumar S <[email protected]>
[ Upstream commit faab5ea0836733ef1c8e83cf6b05690a5c9066be ]
Log an error when vcn sram load fails in indirect mode and return the same error value.
--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 10 ++++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 10 ++++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 10 ++++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 10 ++++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 11 ++++++++--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 10 ++++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 9 +++++++-- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c | 11 ++++++++--- 8 files changed, 63 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +8 -2
@@ -865,6 +865,7 @@ static int vcn_v2_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)volatile struct amdgpu_fw_shared *fw_shared = adev->vcn.inst->fw_shared.cpu_addr;struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;uint32_t rb_bufsz, tmp; +int ret;vcn_v2_0_enable_static_power_gating (vinst);
@@ -948,8 +949,13 @@ static int vcn_v2_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect) UVD, 0, mmUVD_MASTINT_EN), UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect); -if (indirect) -amdgpu_vcn_psp_update_sram (adev,0 ,0 ); +if (indirect) { + ret =amdgpu_vcn_psp_update_sram (adev,0 ,0 ); +if (ret) { +dev_err (adev->dev,"vcn sram load failed %d\n" , ret); +return ret; + } + }/* force RBC into idle state */ rb_bufsz =order_base_2 (ring->ring_size);
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +8 -2
@@ -1012,6 +1012,7 @@ static int vcn_v2_5_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)volatile struct amdgpu_fw_shared *fw_shared = adev->vcn.inst[inst_idx].fw_shared.cpu_addr;struct amdgpu_ring *ring;uint32_t rb_bufsz, tmp; +int ret;/* disable register anti-hang mechanism */ WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS), 1,
@@ -1102,8 +1103,13 @@ static int vcn_v2_5_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect) VCN, 0, mmUVD_MASTINT_EN), UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect); -if (indirect) -amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (indirect) { + ret =amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (ret) { +dev_err (adev->dev,"vcn sram load failed %d\n" , ret); +return ret; + } + } ring = &adev->vcn.inst[inst_idx].ring_dec;/* force RBC into idle state */
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +8 -2
@@ -1041,6 +1041,7 @@ static int vcn_v3_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)volatile struct amdgpu_fw_shared *fw_shared = adev->vcn.inst[inst_idx].fw_shared.cpu_addr;struct amdgpu_ring *ring;uint32_t rb_bufsz, tmp; +int ret;/* disable register anti-hang mechanism */ WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, mmUVD_POWER_STATUS), 1,
@@ -1133,8 +1134,13 @@ static int vcn_v3_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)WREG32_SOC15_DPG_MODE (inst_idx,SOC15_DPG_MODE_OFFSET (VCN , inst_idx, mmUVD_VCPU_CNTL), tmp,0 , indirect); -if (indirect) -amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (indirect) { + ret =amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (ret) { +dev_err (adev->dev,"vcn sram load failed %d\n" , ret); +return ret; + } + } ring = &adev->vcn.inst[inst_idx].ring_dec;/* force RBC into idle state */
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +8 -2
@@ -1012,6 +1012,7 @@ static int vcn_v4_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect)volatile struct amdgpu_vcn4_fw_shared *fw_shared = adev->vcn.inst[inst_idx].fw_shared.cpu_addr;struct amdgpu_ring *ring;uint32_t tmp; +int ret;/* disable register anti-hang mechanism */ WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, regUVD_POWER_STATUS), 1,
@@ -1094,8 +1095,13 @@ static int vcn_v4_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, bool indirect) UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect); -if (indirect) -amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (indirect) { + ret =amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (ret) { +dev_err (adev->dev,"vcn sram load failed %d\n" , ret); +return ret; + } + } ring = &adev->vcn.inst[inst_idx].ring_enc[0 ];
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +8 -3
@@ -849,7 +849,7 @@ static int vcn_v4_0_3_start_dpg_mode(struct amdgpu_vcn_inst *vinst,volatile struct amdgpu_vcn4_fw_shared *fw_shared = adev->vcn.inst[inst_idx].fw_shared.cpu_addr;struct amdgpu_ring *ring; -int vcn_inst; +int vcn_inst, ret;uint32_t tmp; vcn_inst =GET_INST (VCN , inst_idx);
@@ -942,8 +942,13 @@ static int vcn_v4_0_3_start_dpg_mode(struct amdgpu_vcn_inst *vinst, VCN, 0, regUVD_MASTINT_EN), UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect); -if (indirect) -amdgpu_vcn_psp_update_sram (adev, inst_idx,AMDGPU_UCODE_ID_VCN0_RAM ); +if (indirect) { + ret =amdgpu_vcn_psp_update_sram (adev, inst_idx,AMDGPU_UCODE_ID_VCN0_RAM ); +if (ret) { +dev_err (adev->dev,"vcn sram load failed %d\n" , ret); +return ret; + } + } ring = &adev->vcn.inst[inst_idx].ring_enc[0 ];
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +8 -2
@@ -924,6 +924,7 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_vcn_inst *vinst,volatile struct amdgpu_vcn4_fw_shared *fw_shared = adev->vcn.inst[inst_idx].fw_shared.cpu_addr;struct amdgpu_ring *ring;uint32_t tmp; +int ret;/* disable register anti-hang mechanism */ WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, regUVD_POWER_STATUS), 1,
@@ -1004,8 +1005,13 @@ static int vcn_v4_0_5_start_dpg_mode(struct amdgpu_vcn_inst *vinst, VCN, inst_idx, regUVD_MASTINT_EN), UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect); -if (indirect) -amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (indirect) { + ret =amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (ret) { +dev_err (adev->dev,"vcn sram load failed %d\n" , ret); +return ret; + } + } ring = &adev->vcn.inst[inst_idx].ring_enc[0 ];
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +7 -2
@@ -713,6 +713,7 @@ static int vcn_v5_0_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst,volatile struct amdgpu_vcn5_fw_shared *fw_shared = adev->vcn.inst[inst_idx].fw_shared.cpu_addr;struct amdgpu_ring *ring;uint32_t tmp; +int ret;/* disable register anti-hang mechanism */ WREG32_P(SOC15_REG_OFFSET(VCN, inst_idx, regUVD_POWER_STATUS), 1,
@@ -766,8 +767,12 @@ static int vcn_v5_0_0_start_dpg_mode(struct amdgpu_vcn_inst *vinst, VCN, inst_idx, regUVD_MASTINT_EN), UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect); -if (indirect) -amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +if (indirect) { + ret =amdgpu_vcn_psp_update_sram (adev, inst_idx,0 ); +dev_err (adev->dev,"%s: vcn sram load failed %d\n" , __func__, ret); +if (ret) +return ret; + } ring = &adev->vcn.inst[inst_idx].ring_enc[0 ];
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c +8 -3
@@ -605,7 +605,7 @@ static int vcn_v5_0_1_start_dpg_mode(struct amdgpu_vcn_inst *vinst, adev->vcn.inst[inst_idx].fw_shared.cpu_addr;struct amdgpu_ring *ring;struct dpg_pause_state state = {.fw_based =VCN_DPG_STATE__PAUSE }; -int vcn_inst; +int vcn_inst, ret;uint32_t tmp; vcn_inst =GET_INST (VCN , inst_idx);
@@ -666,8 +666,13 @@ static int vcn_v5_0_1_start_dpg_mode(struct amdgpu_vcn_inst *vinst, VCN, 0, regUVD_MASTINT_EN), UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect); -if (indirect) -amdgpu_vcn_psp_update_sram (adev, inst_idx,AMDGPU_UCODE_ID_VCN0_RAM ); +if (indirect) { + ret =amdgpu_vcn_psp_update_sram (adev, inst_idx,AMDGPU_UCODE_ID_VCN0_RAM ); +if (ret) { +dev_err (adev->dev,"vcn sram load failed %d\n" , ret); +return ret; + } + }/* resetting ring, fw should not check RB ring */ fw_shared->sq.queue_mode |=FW_QUEUE_RING_RESET ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 236/849 drm/amd/display: Remove check DPIA HPD status for BW Allocation
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cruise Hung <[email protected]>
[ Upstream commit d0e164f72e6a16e64f660023dc7ad25b31b8b08d ]
[Why & How]
Link hpd_status is for embedded DPIA only.
Do not check hpd_status for BW allocation logic.
--- .../drm/amd/display/dc/link/link_validation.c | 6 +- .../dc/link/protocols/link_dp_dpia_bw.c | 60 +++++++++---------- 2 files changed, 32 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_validation.c +4 -2
@@ -408,8 +408,10 @@ enum dc_status link_validate_dp_tunnel_bandwidth(const struct dc *dc, const stru link = stream->link;if (!(link && (stream->signal ==SIGNAL_TYPE_DISPLAY_PORT - || stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST ) - && link->hpd_status)) + || stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST ))) +continue ; + +if ((link->ep_type ==DISPLAY_ENDPOINT_USB4_DPIA ) && (link->hpd_status == false))continue ; dp_tunnel_settings =get_dp_tunnel_settings (new_ctx, stream);
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +28 -32
86 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 237/849 drm/amd/display: Move setup_stream_attribute
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Strauss <[email protected]>
[ Upstream commit 2681bf4ae8d24df950138b8c9ea9c271cd62e414 ]
[WHY]
If symclk RCO is enabled, stream encoder may not be receiving an ungated clock by the time we attempt to set stream attributes when setting dpms on. Since the clock is gated, register writes to the stream encoder fail.
[HOW]
Move set_stream_attribute call into enable_stream, just after the point where symclk32_se is ungated.
Logically there is no need to set stream attributes as early as is currently done in link_set_dpms_on, so this should have no impact beyond the RCO fix.
--- drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 1 + drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 2 ++ drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 3 --- .../drm/amd/display/dc/virtual/virtual_stream_encoder.c | 7 +++++++ 5 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +1 -0
@@ -671,6 +671,7 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx)uint32_t early_control =0 ;struct timing_generator *tg = pipe_ctx->stream_res.tg; + link_hwss->setup_stream_attribute (pipe_ctx); link_hwss->setup_stream_encoder (pipe_ctx); dc->hwss.update_info_frame (pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +2 -0
@@ -3052,6 +3052,8 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) link_enc->transmitter - TRANSMITTER_UNIPHY_A); } + link_hwss->setup_stream_attribute (pipe_ctx); +if (dc->res_pool->dccg->funcs->set_pixel_rate_div) dc->res_pool->dccg->funcs->set_pixel_rate_div( dc->res_pool->dccg,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +2 -0
@@ -968,6 +968,8 @@ void dcn401_enable_stream(struct pipe_ctx *pipe_ctx) } } + link_hwss->setup_stream_attribute (pipe_ctx); +if (dc->res_pool->dccg->funcs->set_pixel_rate_div) { dc->res_pool->dccg->funcs->set_pixel_rate_div( dc->res_pool->dccg,
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +0 -3
@@ -2458,7 +2458,6 @@ void link_set_dpms_on(struct link_encoder *link_enc = pipe_ctx->link_res.dio_link_enc;enum otg_out_mux_dest otg_out_dest =OUT_MUX_DIO ;struct vpg *vpg = pipe_ctx->stream_res.stream_enc->vpg; -const struct link_hwss *link_hwss =get_link_hwss (link, &pipe_ctx->link_res);bool apply_edp_fast_boot_optimization = pipe_ctx->stream->apply_edp_fast_boot_optimization;
@@ -2502,8 +2501,6 @@ void link_set_dpms_on( pipe_ctx->stream_res.tg->funcs->set_out_mux (pipe_ctx->stream_res.tg, otg_out_dest); } - link_hwss->setup_stream_attribute (pipe_ctx); - pipe_ctx->stream->apply_edp_fast_boot_optimization = false;// Enable VPG before building infoframe
drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c +7 -0
@@ -44,6 +44,11 @@ static void virtual_stream_encoder_dvi_set_stream_attribute( struct dc_crtc_timing *crtc_timing, bool is_dual_link) {} +static void virtual_stream_encoder_lvds_set_stream_attribute ( +struct stream_encoder *enc, +struct dc_crtc_timing *crtc_timing) +{} +static void virtual_stream_encoder_set_throttled_vcp_size (struct stream_encoder *enc,struct fixed31_32 avg_time_slots_per_mtp)
@@ -115,6 +120,8 @@ static const struct stream_encoder_funcs virtual_str_enc_funcs = { virtual_stream_encoder_hdmi_set_stream_attribute, .dvi_set_stream_attribute = virtual_stream_encoder_dvi_set_stream_attribute, + .lvds_set_stream_attribute = + virtual_stream_encoder_lvds_set_stream_attribute, .set_throttled_vcp_size = virtual_stream_encoder_set_throttled_vcp_size, .update_hdmi_info_packets =
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 238/849 drm/amd/display: Increase AUX Intra-Hop Done Max Wait Duration
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Strauss <[email protected]>
[ Upstream commit e3419e1e44b87d4176fb98679a77301b1ca40f63 ]
[WHY]
In the worst case, AUX intra-hop done can take hundreds of milliseconds as each retimer in a link might have to wait a full AUX_RD_INTERVAL to send LT abort downstream.
[HOW]
Wait 300ms for each retimer in a link to allow time to propagate a LT abort without infinitely waiting on intra-hop done.
For no-retimer case, keep the max duration at 10ms.
--- .../drm/amd/display/dc/link/protocols/link_dp_training.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c +7 -2
@@ -1018,7 +1018,12 @@ static enum link_training_result dpcd_exit_training_mode(struct dc_link *link, e {enum dc_status status;uint8_t sink_status =0 ; -uint8_t i; +uint32_t i; +uint8_t lttpr_count =dp_parse_lttpr_repeater_count (link->dpcd_caps.lttpr_caps.phy_repeater_cnt); +uint32_t intra_hop_disable_time_ms = (lttpr_count >0 ? lttpr_count *300 :10 ); + +// Each hop could theoretically take over 256ms (max 128b/132b AUX RD INTERVAL) +// To be safe, allow 300ms per LTTPR and 10ms for no LTTPR case /* clear training pattern set */ status =dpcd_set_training_pattern (link,DP_TRAINING_PATTERN_VIDEOIDLE );
@@ -1028,7 +1033,7 @@ static enum link_training_result dpcd_exit_training_mode(struct dc_link *link, eif (encoding == DP_128b_132b_ENCODING) {/* poll for intra-hop disable */ -for (i =0 ; i <10 ; i++) { +for (i =0 ; i < intra_hop_disable_time_ms; i++) {if ((core_link_read_dpcd (link,DP_SINK_STATUS , &sink_status,1 ) ==DC_OK ) && (sink_status &DP_INTRA_HOP_AUX_REPLY_INDICATION ) ==0 )break ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 239/849 drm/amd/display: Fix dmub_cmd header alignment
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ovidiu Bunea <[email protected]>
[ Upstream commit 327aba7f558187e451636c77a1662a2858438dc9 ]
[why & how]
Header misalignment in struct dmub_cmd_replay_copy_settings_data and struct dmub_alpm_auxless_data causes incorrect data read between driver and dmub.
Fix the misalignment and ensure that everything is aligned to 4-byte boundaries.
--- drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +12 -0
@@ -4015,6 +4015,10 @@ struct dmub_alpm_auxless_data {uint16_t lfps_t1_t2_override_us;short lfps_t1_t2_offset_us;uint8_t lttpr_count; +/* +* Padding to align structure to 4 byte boundary. +*/ +uint8_t pad[1 ]; };/**
@@ -4092,6 +4096,14 @@ struct dmub_cmd_replay_copy_settings_data {*/ struct dmub_alpm_auxless_data auxless_alpm_data; +/** +* @hpo_stream_enc_inst: HPO stream encoder instance +*/ +uint8_t hpo_stream_enc_inst; +/** +* @hpo_link_enc_inst: HPO link encoder instance +*/ +uint8_t hpo_link_enc_inst;/** * @pad: Align structure to 4 byte boundary. */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 240/849 drm/amd/display: Cache streams targeting link when performing LT automation
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Strauss <[email protected]>
[ Upstream commit f5b69101f956f5b89605a13cb15f093a7906f2a1 ]
[WHY]
Last LT automation update can cause crash by referencing current_state and calling into dc_update_planes_and_stream which may clobber current_state.
[HOW]
Cache relevant stream pointers and iterate through them instead of relying on the current_state.
--- .../display/dc/link/accessories/link_dp_cts.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c +14 -4
@@ -76,6 +76,9 @@ static void dp_retrain_link_dp_test(struct dc_link *link,uint8_t count;int i; +struct dc_stream_state *streams_on_link[MAX_PIPES ]; +int num_streams_on_link =0 ; + needs_divider_update = (link->dc->link_srv->dp_get_encoding_format (link_setting) != link->dc->link_srv->dp_get_encoding_format ((const struct dc_link_settings *) &link->cur_link_settings));
@@ -138,12 +141,19 @@ static void dp_retrain_link_dp_test(struct dc_link *link, pipes[i]->stream_res.tg->funcs->enable_crtc (pipes[i]->stream_res.tg);// Set DPMS on with stream update -for (i =0 ; i < state->stream_count; i++) -if (state->streams[i] && state->streams[i]->link && state->streams[i]->link == link) { - stream_update.stream = state->streams[i]; +// Cache all streams on current link since dc_update_planes_and_stream might kill current_state +for (i =0 ; i <MAX_PIPES ; i++) { +if (state->streams[i] && state->streams[i]->link && state->streams[i]->link == link) + streams_on_link[num_streams_on_link++] = state->streams[i]; + } + +for (i =0 ; i < num_streams_on_link; i++) { +if (streams_on_link[i] && streams_on_link[i]->link && streams_on_link[i]->link == link) { + stream_update.stream = streams_on_link[i]; stream_update.dpms_off = &dpms_off; -dc_update_planes_and_stream (state->clk_mgr->ctx->dc,NULL ,0 , state->streams[i], &stream_update); +dc_update_planes_and_stream (state->clk_mgr->ctx->dc,NULL ,0 , streams_on_link[i], &stream_update); } + } }static void dp_test_send_link_training (struct dc_link *link)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 241/849 drm/xe/guc: Add more GuC load error status codes
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Harrison <[email protected]>
[ Upstream commit 45fbb51050e72723c2bdcedc1ce32305256c70ed ]
The GuC load process will abort if certain status codes (which are indicative of a fatal error) are reported. Otherwise, it keeps waiting until the 'success' code is returned. New error codes have been added in recent GuC releases, so add support for aborting on those as well.
v2: Shuffle HWCONFIG_START to the front of the switch to keep the ordering as per the enum define for clarity (review feedback by Jonathan). Also add a description for the basic 'invalid init data' code which was missing.
--- drivers/gpu/drm/xe/abi/guc_errors_abi.h | 3 +++ drivers/gpu/drm/xe/xe_guc.c | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/abi/guc_errors_abi.h +3 -0
@@ -63,6 +63,7 @@ enum xe_guc_load_status {XE_GUC_LOAD_STATUS_HWCONFIG_START =0x05 ,XE_GUC_LOAD_STATUS_HWCONFIG_DONE =0x06 ,XE_GUC_LOAD_STATUS_HWCONFIG_ERROR =0x07 , +XE_GUC_LOAD_STATUS_BOOTROM_VERSION_MISMATCH =0x08 ,XE_GUC_LOAD_STATUS_GDT_DONE =0x10 ,XE_GUC_LOAD_STATUS_IDT_DONE =0x20 , XE_GUC_LOAD_STATUS_LAPIC_DONE = 0x30,
@@ -75,6 +76,8 @@ enum xe_guc_load_status {XE_GUC_LOAD_STATUS_INVALID_INIT_DATA_RANGE_START ,XE_GUC_LOAD_STATUS_MPU_DATA_INVALID =0x73 ,XE_GUC_LOAD_STATUS_INIT_MMIO_SAVE_RESTORE_INVALID =0x74 , +XE_GUC_LOAD_STATUS_KLV_WORKAROUND_INIT_ERROR =0x75 , +XE_GUC_LOAD_STATUS_INVALID_FTR_FLAG =0x76 ,XE_GUC_LOAD_STATUS_INVALID_INIT_DATA_RANGE_END , XE_GUC_LOAD_STATUS_READY = 0xF0,
drivers/gpu/drm/xe/xe_guc.c +17 -2
@@ -990,11 +990,14 @@ static int guc_load_done(u32 status)case XE_GUC_LOAD_STATUS_GUC_PREPROD_BUILD_MISMATCH :case XE_GUC_LOAD_STATUS_ERROR_DEVID_INVALID_GUCTYPE :case XE_GUC_LOAD_STATUS_HWCONFIG_ERROR : +case XE_GUC_LOAD_STATUS_BOOTROM_VERSION_MISMATCH :case XE_GUC_LOAD_STATUS_DPC_ERROR :case XE_GUC_LOAD_STATUS_EXCEPTION :case XE_GUC_LOAD_STATUS_INIT_DATA_INVALID :case XE_GUC_LOAD_STATUS_MPU_DATA_INVALID :case XE_GUC_LOAD_STATUS_INIT_MMIO_SAVE_RESTORE_INVALID : +case XE_GUC_LOAD_STATUS_KLV_WORKAROUND_INIT_ERROR : +case XE_GUC_LOAD_STATUS_INVALID_FTR_FLAG :return -1 ; }
@@ -1134,17 +1137,29 @@ static void guc_wait_ucode(struct xe_guc *guc) }switch (ukernel) { +case XE_GUC_LOAD_STATUS_HWCONFIG_START : +xe_gt_err (gt,"still extracting hwconfig table.\n" ); +break ; +case XE_GUC_LOAD_STATUS_EXCEPTION :xe_gt_err (gt,"firmware exception. EIP: %#x\n" ,xe_mmio_read32 (mmio,SOFT_SCRATCH (13 )));break ; +case XE_GUC_LOAD_STATUS_INIT_DATA_INVALID : +xe_gt_err (gt,"illegal init/ADS data\n" ); +break ; +case XE_GUC_LOAD_STATUS_INIT_MMIO_SAVE_RESTORE_INVALID :xe_gt_err (gt,"illegal register in save/restore workaround list\n" );break ; -case XE_GUC_LOAD_STATUS_HWCONFIG_START : -xe_gt_err (gt,"still extracting hwconfig table.\n" ); +case XE_GUC_LOAD_STATUS_KLV_WORKAROUND_INIT_ERROR : +xe_gt_err (gt,"illegal workaround KLV data\n" ); +break ; + +case XE_GUC_LOAD_STATUS_INVALID_FTR_FLAG : +xe_gt_err (gt,"illegal feature flag specified\n" );break ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 242/849 drm/xe: Fix oops in xe_gem_fault when running core_hotunplug test.
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
[ Upstream commit 1cda3c755bb7770be07d75949bb0f45fb88651f6 ]
I saw an oops in xe_gem_fault when running the xe-fast-feedback testlist against the realtime kernel without debug options enabled.
The panic happens after core_hotunplug unbind-rebind finishes. Presumably what happens is that a process mmaps, unlocks because of the FAULT_FLAG_RETRY_NOWAIT logic, has no process memory left, causing ttm_bo_vm_dummy_page() to return VM_FAULT_NOPAGE, since there was nothing left to populate, and then oopses in "mem_type_is_vram(tbo->resource->mem_type)" because tbo->resource is NULL.
It's convoluted, but fits the data and explains the oops after the test exits.
--- drivers/gpu/drm/xe/xe_bo.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/gpu/drm/xe/xe_bo.c +16 -12
@@ -1711,22 +1711,26 @@ static vm_fault_t xe_gem_fault(struct vm_fault *vmf) ret =ttm_bo_vm_fault_reserved (vmf, vmf->vma->vm_page_prot,TTM_BO_VM_NUM_PREFAULT );drm_dev_exit (idx); + +if (ret ==VM_FAULT_RETRY && + !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) + goto out; + +/* +* ttm_bo_vm_reserve() already has dma_resv_lock. +*/ +if (ret ==VM_FAULT_NOPAGE && +mem_type_is_vram (tbo->resource->mem_type)) { +mutex_lock (&xe->mem_access.vram_userfault.lock); +if (list_empty (&bo->vram_userfault_link)) +list_add (&bo->vram_userfault_link, + &xe->mem_access.vram_userfault.list); +mutex_unlock (&xe->mem_access.vram_userfault.lock); + } }else { ret =ttm_bo_vm_dummy_page (vmf, vmf->vma->vm_page_prot); } -if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) - goto out; -/* -* ttm_bo_vm_reserve() already has dma_resv_lock. -*/ -if (ret ==VM_FAULT_NOPAGE &&mem_type_is_vram (tbo->resource->mem_type)) { -mutex_lock (&xe->mem_access.vram_userfault.lock); -if (list_empty (&bo->vram_userfault_link)) -list_add (&bo->vram_userfault_link, &xe->mem_access.vram_userfault.list); -mutex_unlock (&xe->mem_access.vram_userfault.lock); - } -dma_resv_unlock (tbo->base.resv); out:if (needs_rpm)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 243/849 drm/xe/pf: Dont resume device from restart worker
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wajdeczko <[email protected]>
[ Upstream commit 9fd9f221440024b7451678898facfb34af054310 ]
The PF's restart worker shouldn't attempt to resume the device on its own, since its goal is to finish PF and VFs reprovisioning on the recently reset GuC. Take extra RPM reference while scheduling a work and release it from the worker or when we cancel a work.
--- drivers/gpu/drm/xe/xe_gt_sriov_pf.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_gt_sriov_pf.c +20 -4
@@ -55,7 +55,12 @@ static void pf_init_workers(struct xe_gt *gt)static void pf_fini_workers (struct xe_gt *gt) {xe_gt_assert (gt,IS_SRIOV_PF (gt_to_xe (gt))); -disable_work_sync (>->sriov.pf.workers.restart); + +if (disable_work_sync (>->sriov.pf.workers.restart)) { +xe_gt_sriov_dbg_verbose (gt,"pending restart disabled!\n" ); +/* release an rpm reference taken on the worker's behalf */ +xe_pm_runtime_put (gt_to_xe (gt)); + } }/**
@@ -207,8 +212,11 @@ static void pf_cancel_restart(struct xe_gt *gt) {xe_gt_assert (gt,IS_SRIOV_PF (gt_to_xe (gt))); -if (cancel_work_sync (>->sriov.pf.workers.restart)) +if (cancel_work_sync (>->sriov.pf.workers.restart)) {xe_gt_sriov_dbg_verbose (gt,"pending restart canceled!\n" ); +/* release an rpm reference taken on the worker's behalf */ +xe_pm_runtime_put (gt_to_xe (gt)); + } }/**
@@ -226,9 +234,12 @@ static void pf_restart(struct xe_gt *gt) {struct xe_device *xe =gt_to_xe (gt); -xe_pm_runtime_get (xe); +xe_gt_assert (gt, !xe_pm_runtime_suspended (xe)); +xe_gt_sriov_pf_config_restart (gt);xe_gt_sriov_pf_control_restart (gt); + +/* release an rpm reference taken on our behalf */ xe_pm_runtime_put (xe);xe_gt_sriov_dbg (gt,"restart completed\n" );
@@ -247,8 +258,13 @@ static void pf_queue_restart(struct xe_gt *gt)xe_gt_assert (gt,IS_SRIOV_PF (xe)); -if (!queue_work (xe->sriov.wq, >->sriov.pf.workers.restart)) +/* take an rpm reference on behalf of the worker */ +xe_pm_runtime_get_noresume (xe); + +if (!queue_work (xe->sriov.wq, >->sriov.pf.workers.restart)) {xe_gt_sriov_dbg (gt,"restart already in queue!\n" ); +xe_pm_runtime_put (xe); + } }/**
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 244/849 drm/amdgpu: Fix build error when CONFIG_SUSPEND is disabled
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Perry Yuan <[email protected]>
[ Upstream commit 8e3967a71e6fca9c871f98b9289b59c82b88b729 ]
The variable pm_suspend_target_state is conditionally defined only when CONFIG_SUSPEND is enabled (see include/linux/suspend.h). Directly referencing it without guarding by #ifdef CONFIG_SUSPEND causes build failures when suspend functionality is disabled (e.g., CONFIG_SUSPEND=n).
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
@@ -2597,6 +2597,7 @@ static int amdgpu_pmops_suspend(struct device *dev)else if (amdgpu_acpi_is_s3_active (adev)) adev->in_s3 = true;if (!adev->in_s0ix && !adev->in_s3) { +#if IS_ENABLED (CONFIG_SUSPEND )/* don't allow going deep first time followed by s2idle the next time */ if (adev->last_suspend_state !=PM_SUSPEND_ON && adev->last_suspend_state != pm_suspend_target_state) {
@@ -2604,11 +2605,14 @@ static int amdgpu_pmops_suspend(struct device *dev) pm_suspend_target_state); return -EINVAL; } +#endif return 0 ; } +#if IS_ENABLED (CONFIG_SUSPEND )/* cache the state last used for suspend */ adev->last_suspend_state = pm_suspend_target_state; +#endif return amdgpu_device_suspend (drm_dev, true); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 245/849 drm/amdgpu: Update IPID value for bad page threshold CPER
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Liu <[email protected]>
[ Upstream commit 8f0245ee95c5ba65a2fe03f60386868353c6a3a0 ]
Update the IPID register value for bad page threshold CPER according to the latest definition.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c +6 -2
@@ -206,6 +206,7 @@ int amdgpu_cper_entry_fill_bad_page_threshold_section(struct amdgpu_device *adev {struct cper_sec_desc *section_desc;struct cper_sec_nonstd_err *section; +uint32_t socket_id; section_desc = (struct cper_sec_desc *)((uint8_t *)hdr +SEC_DESC_OFFSET (idx)); section = (struct cper_sec_nonstd_err *)((uint8_t *)hdr +
@@ -224,6 +225,9 @@ int amdgpu_cper_entry_fill_bad_page_threshold_section(struct amdgpu_device *adev section->ctx.reg_arr_size =sizeof (section->ctx.reg_dump);/* Hardcoded Reg dump for bad page threshold CPER */ + socket_id = (adev->smuio.funcs && adev->smuio.funcs->get_socket_id) ? + adev->smuio.funcs->get_socket_id (adev) : +0 ; section->ctx.reg_dump[CPER_ACA_REG_CTL_LO ] =0x1 ; section->ctx.reg_dump[CPER_ACA_REG_CTL_HI ] =0x0 ; section->ctx.reg_dump[CPER_ACA_REG_STATUS_LO ] =0x137 ;
@@ -234,8 +238,8 @@ int amdgpu_cper_entry_fill_bad_page_threshold_section(struct amdgpu_device *adev section->ctx.reg_dump[CPER_ACA_REG_MISC0_HI ] =0x0 ; section->ctx.reg_dump[CPER_ACA_REG_CONFIG_LO ] =0x2 ; section->ctx.reg_dump[CPER_ACA_REG_CONFIG_HI ] =0x1ff ; - section->ctx.reg_dump[CPER_ACA_REG_IPID_LO ] =0x0 ; - section->ctx.reg_dump[CPER_ACA_REG_IPID_HI ] =0x96 ; + section->ctx.reg_dump[CPER_ACA_REG_IPID_LO ] = (socket_id /4 ) &0x01 ; + section->ctx.reg_dump[CPER_ACA_REG_IPID_HI ] =0x096 | (((socket_id %4 ) &0x3 ) <<12 ); section->ctx.reg_dump[CPER_ACA_REG_SYND_LO ] =0x0 ; section->ctx.reg_dump[CPER_ACA_REG_SYND_HI ] =0x0 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 246/849 drm/amdgpu: Avoid rma causes GPU duplicate reset
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ce Sun <[email protected]>
[ Upstream commit 21c0ffa612c98bcc6dab5bd9d977a18d565ee28e ]
Try to ensure poison creation handle is completed in time to set device rma value.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 17 ++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 1 + 2 files changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +10 -7
@@ -3285,7 +3285,6 @@ static void amdgpu_ras_do_page_retirement(struct work_struct *work) page_retirement_dwork.work);struct amdgpu_device *adev = con->adev;struct ras_err_data err_data; -unsigned long err_cnt;/* If gpu reset is ongoing, delay retiring the bad pages */ if (amdgpu_in_reset (adev) ||amdgpu_ras_in_recovery (adev)) {
@@ -3297,13 +3296,9 @@ static void amdgpu_ras_do_page_retirement(struct work_struct *work)amdgpu_ras_error_data_init (&err_data);amdgpu_umc_handle_bad_pages (adev, &err_data); - err_cnt = err_data.err_addr_cnt;amdgpu_ras_error_data_fini (&err_data); -if (err_cnt &&amdgpu_ras_is_rma (adev)) -amdgpu_ras_reset_gpu (adev); -amdgpu_ras_schedule_retirement_dwork (con,AMDGPU_RAS_RETIRE_PAGE_INTERVAL ); }
@@ -3357,6 +3352,9 @@ static int amdgpu_ras_poison_creation_handler(struct amdgpu_device *adev,if (total_detect_count)schedule_delayed_work (&ras->page_retirement_dwork,0 ); +if (amdgpu_ras_is_rma (adev) &&atomic_cmpxchg (&ras->rma_in_recovery,0 ,1 ) ==0 ) +amdgpu_ras_reset_gpu (adev); +return 0 ; }
@@ -3392,6 +3390,12 @@ static int amdgpu_ras_poison_consumption_handler(struct amdgpu_device *adev, reset_flags |= msg.reset; } +/* +* Try to ensure poison creation handler is completed first +* to set rma if bad page exceed threshold. +*/ +flush_delayed_work (&con->page_retirement_dwork); +/* for RMA, amdgpu_ras_poison_creation_handler will trigger gpu reset */ if (reset_flags && !amdgpu_ras_is_rma (adev)) {if (reset_flags &AMDGPU_RAS_GPU_RESET_MODE1_RESET )
@@ -3401,8 +3405,6 @@ static int amdgpu_ras_poison_consumption_handler(struct amdgpu_device *adev,else reset = reset_flags; -flush_delayed_work (&con->page_retirement_dwork); - con->gpu_reset_flags |= reset;amdgpu_ras_reset_gpu (adev);
@@ -3570,6 +3572,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev, bool init_bp_info)mutex_init (&con->recovery_lock);INIT_WORK (&con->recovery_work, amdgpu_ras_do_recovery);atomic_set (&con->in_recovery,0 ); +atomic_set (&con->rma_in_recovery,0 ); con->eeprom_control.bad_channel_bitmap =0 ; max_eeprom_records_count =amdgpu_ras_eeprom_max_record_count (&con->eeprom_control);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +1 -0
@@ -515,6 +515,7 @@ struct amdgpu_ras {/* gpu recovery */ struct work_struct recovery_work;atomic_t in_recovery; +atomic_t rma_in_recovery;struct amdgpu_device *adev;/* error handler data */ struct ras_err_handler_data *eh_data;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 247/849 drm/amdgpu: Effective health check before reset
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ce Sun <[email protected]>
[ Upstream commit da467352296f8e50c7ab7057ead44a1df1c81496 ]
Move amdgpu_device_health_check into amdgpu_device_gpu_recover to ensure that if the device is present can be checked before reset
The reason is:
1.During the dpc event, the device where the dpc event occurs is not present on the bus
2.When both dpc event and ATHUB event occur simultaneously,the dpc thread holds the reset domain lock when detecting error,and the gpu recover thread acquires the hive lock.The device is simultaneously in the states of amdgpu_ras_in_recovery and occurs_dpc,so gpu recover thread will not go to amdgpu_device_health_check.It waits for the reset domain lock held by the dpc thread, but dpc thread has not released the reset domain lock.In the dpc callback slot_reset,to obtain the hive lock, the hive lock is held by the gpu recover thread at this time.So a deadlock occurred
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 26 +++++++--------------- 1 file changed, 8 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -18
@@ -6132,12 +6132,11 @@ static int amdgpu_device_health_check(struct list_head *device_list_handle)return ret; } -static int amdgpu_device_recovery_prepare (struct amdgpu_device *adev, +static void amdgpu_device_recovery_prepare (struct amdgpu_device *adev,struct list_head *device_list,struct amdgpu_hive_info *hive) {struct amdgpu_device *tmp_adev =NULL ; -int r;/* * Build list of devices to reset.
@@ -6157,14 +6156,6 @@ static int amdgpu_device_recovery_prepare(struct amdgpu_device *adev, }else {list_add_tail (&adev->reset_list, device_list); } - -if (!amdgpu_sriov_vf (adev) && (!adev->pcie_reset_ctx.occurs_dpc)) { - r =amdgpu_device_health_check (device_list); -if (r) -return r; - } - -return 0 ; } static void amdgpu_device_recovery_get_reset_lock(struct amdgpu_device *adev,
@@ -6457,8 +6448,13 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, reset_context->hive = hive;INIT_LIST_HEAD (&device_list); -if (amdgpu_device_recovery_prepare (adev, &device_list, hive)) - goto end_reset; +amdgpu_device_recovery_prepare (adev, &device_list, hive); + +if (!amdgpu_sriov_vf (adev)) { + r =amdgpu_device_health_check (&device_list); +if (r) + goto end_reset; + }/* We need to lock reset domain only once both for XGMI and single device */ amdgpu_device_recovery_get_reset_lock (adev, &device_list);
@@ -6965,12 +6961,6 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev)int r =0 , i;u32 memsize; -/* PCI error slot reset should be skipped During RAS recovery */ -if ((amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,3 ) || -amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,4 )) && -amdgpu_ras_in_recovery (adev)) -return PCI_ERS_RESULT_RECOVERED ; -dev_info (adev->dev,"PCI error: slot reset callback!!\n" );memset (&reset_context,0 ,sizeof (reset_context));
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 248/849 drm/amd/amdgpu: Release xcp drm memory after unplug
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meng Li <[email protected]>
[ Upstream commit e6c2b0f23221ed43c4cc6f636e9ab7862954d562 ]
Add a new API amdgpu_xcp_drm_dev_free().
After unplug xcp device, need to release xcp drm memory etc.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 1 + drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 56 +++++++++++++++++---- drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h | 1 + 3 files changed, 49 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +1 -0
@@ -406,6 +406,7 @@ void amdgpu_xcp_dev_unplug(struct amdgpu_device *adev) p_ddev->primary->dev = adev->xcp_mgr->xcp[i].pdev; p_ddev->driver = adev->xcp_mgr->xcp[i].driver; p_ddev->vma_offset_manager = adev->xcp_mgr->xcp[i].vma_offset_manager; +amdgpu_xcp_drm_dev_free (p_ddev); } }
drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c +47 -9
89 lines not on this page · raw message
drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h +1 -0
@@ -25,5 +25,6 @@#define _AMDGPU_XCP_DRV_H_int amdgpu_xcp_drm_dev_alloc (struct drm_device **ddev); +void amdgpu_xcp_drm_dev_free (struct drm_device *ddev);void amdgpu_xcp_drv_release (void );#endif /* _AMDGPU_XCP_DRV_H_ */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 249/849 drm/amdgpu: Fix vcn v5.0.1 poison irq call trace
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanley.Yang <[email protected]>
[ Upstream commit b1b29aa88f5367d0367c8eeef643635bc6009a9a ]
Why:
[13014.890792] Call Trace:
[13014.890793] <TASK>
[13014.890795] ? show_trace_log_lvl+0x1d6/0x2ea
[13014.890799] ? show_trace_log_lvl+0x1d6/0x2ea
[13014.890800] ? vcn_v5_0_1_hw_fini+0xe9/0x110 [amdgpu]
[13014.890872] ? show_regs.part.0+0x23/0x29
[13014.890873] ? show_regs.cold+0x8/0xd
[13014.890874] ? amdgpu_irq_put+0xc6/0xe0 [amdgpu]
[13014.890934] ? __warn+0x8c/0x100
[13014.890936] ? amdgpu_irq_put+0xc6/0xe0 [amdgpu]
[13014.890995] ? report_bug+0xa4/0xd0
[13014.890999] ? handle_bug+0x39/0x90
[13014.891001] ? exc_invalid_op+0x19/0x70
[13014.891003] ? asm_exc_invalid_op+0x1b/0x20
[13014.891005] ? amdgpu_irq_put+0xc6/0xe0 [amdgpu]
[13014.891065] ? amdgpu_irq_put+0x63/0xe0 [amdgpu]
[13014.891124] vcn_v5_0_1_hw_fini+0xe9/0x110 [amdgpu]
[13014.891189] amdgpu_ip_block_hw_fini+0x3b/0x78 [amdgpu]
[13014.891309] amdgpu_device_fini_hw+0x3c1/0x479 [amdgpu]How:
Add omitted vcn poison irq get call.
--- drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c | 10 +++++----- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c +5 -5
@@ -1058,6 +1058,11 @@ static int jpeg_v5_0_1_ras_late_init(struct amdgpu_device *adev, struct ras_commif (r)return r; + r =amdgpu_ras_bind_aca (adev,AMDGPU_RAS_BLOCK__JPEG , + &jpeg_v5_0_1_aca_info,NULL ); +if (r) + goto late_fini; +if (amdgpu_ras_is_supported (adev, ras_block->block) && adev->jpeg.inst->ras_poison_irq.funcs) { r =amdgpu_irq_get (adev, &adev->jpeg.inst->ras_poison_irq,0 );
@@ -1065,11 +1070,6 @@ static int jpeg_v5_0_1_ras_late_init(struct amdgpu_device *adev, struct ras_comm goto late_fini; } - r =amdgpu_ras_bind_aca (adev,AMDGPU_RAS_BLOCK__JPEG , - &jpeg_v5_0_1_aca_info,NULL ); -if (r) - goto late_fini; -return 0 ; late_fini:
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c +7 -0
@@ -1608,6 +1608,13 @@ static int vcn_v5_0_1_ras_late_init(struct amdgpu_device *adev, struct ras_commoif (r) goto late_fini; +if (amdgpu_ras_is_supported (adev, ras_block->block) && + adev->vcn.inst->ras_poison_irq.funcs) { + r =amdgpu_irq_get (adev, &adev->vcn.inst->ras_poison_irq,0 ); +if (r) + goto late_fini; + } +return 0 ; late_fini:
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 250/849 drm/xe: Extend wa_13012615864 to additional Xe2 and Xe3 platforms
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tangudu Tilak Tirumalesh <[email protected]>
[ Upstream commit bcddb12c027434fdf0491c1a05a3fe4fd2263d71 ]
Extend WA 13012615864 to Graphics Versions 20.01,20.02,20.04 and 30.03.
--- drivers/gpu/drm/xe/xe_wa.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_wa.c +12 -1
@@ -538,6 +538,11 @@ static const struct xe_rtp_entry_sr engine_was[] = {XE_RTP_RULES (GRAPHICS_VERSION (2004 ),ENGINE_CLASS (RENDER )),XE_RTP_ACTIONS (SET (HALF_SLICE_CHICKEN7 ,CLEAR_OPTIMIZATION_DISABLE )) }, + { XE_RTP_NAME("13012615864"), +XE_RTP_RULES (GRAPHICS_VERSION (2004 ), +FUNC (xe_rtp_match_first_render_or_compute)), +XE_RTP_ACTIONS (SET (TDL_TSL_CHICKEN ,RES_CHK_SPR_DIS )) + },/* Xe2_HPG */
@@ -602,6 +607,11 @@ static const struct xe_rtp_entry_sr engine_was[] = { FUNC(xe_rtp_match_first_render_or_compute)),XE_RTP_ACTIONS (SET (TDL_TSL_CHICKEN ,STK_ID_RESTRICT )) }, + { XE_RTP_NAME("13012615864"), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (2001 ,2002 ), +FUNC (xe_rtp_match_first_render_or_compute)), +XE_RTP_ACTIONS (SET (TDL_TSL_CHICKEN ,RES_CHK_SPR_DIS )) + },/* Xe2_LPM */
@@ -647,7 +657,8 @@ static const struct xe_rtp_entry_sr engine_was[] = {XE_RTP_ACTIONS (SET (TDL_CHICKEN ,QID_WAIT_FOR_THREAD_NOT_RUN_DISABLE )) }, { XE_RTP_NAME("13012615864"), -XE_RTP_RULES (GRAPHICS_VERSION_RANGE (3000 ,3001 ), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (3000 ,3001 ),OR , +GRAPHICS_VERSION (3003 ),FUNC (xe_rtp_match_first_render_or_compute)),XE_RTP_ACTIONS (SET (TDL_TSL_CHICKEN ,RES_CHK_SPR_DIS )) },
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 251/849 drm/amdgpu: Skip poison aca bank from UE channel
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Liu <[email protected]>
[ Upstream commit 8e8e08c831f088ed581444c58a635c49ea1222ab ]
Avoid GFX poison consumption errors logged when fatal error occurs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 51 +++++++++++++++---------- 1 file changed, 30 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +30 -21
@@ -130,6 +130,27 @@ static void aca_smu_bank_dump(struct amdgpu_device *adev, int idx, int total, stRAS_EVENT_LOG (adev, event_id,HW_ERR "hardware error logged by the scrubber\n" ); } +static bool aca_bank_hwip_is_matched (struct aca_bank *bank,enum aca_hwip_type type) +{ + +struct aca_hwip *hwip; +int hwid, mcatype; +u64 ipid; + +if (!bank || type ==ACA_HWIP_TYPE_UNKNOW ) +return false; + + hwip = &aca_hwid_mcatypes[type]; +if (!hwip->hwid) +return false; + + ipid = bank->regs[ACA_REG_IDX_IPID ]; + hwid =ACA_REG__IPID__HARDWAREID (ipid); + mcatype =ACA_REG__IPID__MCATYPE (ipid); + +return hwip->hwid == hwid && hwip->mcatype == mcatype; +} +static int aca_smu_get_valid_aca_banks (struct amdgpu_device *adev,enum aca_smu_type type,int start,int count,struct aca_banks *banks,struct ras_query_context *qctx)
@@ -168,6 +189,15 @@ static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_smu_ bank.smu_err_type = type; +/* +* Poison being consumed when injecting a UE while running background workloads, +* which are unexpected. +*/ +if (type ==ACA_SMU_TYPE_UE && +ACA_REG__STATUS__POISON (bank.regs[ACA_REG_IDX_STATUS ]) && + !aca_bank_hwip_is_matched (&bank,ACA_HWIP_TYPE_UMC )) +continue ; +aca_smu_bank_dump (adev, i, count, &bank, qctx); ret =aca_banks_add_bank (banks, &bank);
@@ -178,27 +208,6 @@ static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_smu_return 0 ; } -static bool aca_bank_hwip_is_matched (struct aca_bank *bank,enum aca_hwip_type type) -{ - -struct aca_hwip *hwip; -int hwid, mcatype; -u64 ipid; - -if (!bank || type ==ACA_HWIP_TYPE_UNKNOW ) -return false; - - hwip = &aca_hwid_mcatypes[type]; -if (!hwip->hwid) -return false; - - ipid = bank->regs[ACA_REG_IDX_IPID ]; - hwid =ACA_REG__IPID__HARDWAREID (ipid); - mcatype =ACA_REG__IPID__MCATYPE (ipid); - -return hwip->hwid == hwid && hwip->mcatype == mcatype; -} -static bool aca_bank_is_valid (struct aca_handle *handle,struct aca_bank *bank,enum aca_smu_type type) {const struct aca_bank_ops *bank_ops = handle->bank_ops;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 252/849 drm/amd/display: add more cyan skillfish devices
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 3cf06bd4cf2512d564fdb451b07de0cebe7b138d ]
Add PCI IDs to support display probe for cyan skillfish family of SOCs.
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 8 +++++++- drivers/gpu/drm/amd/display/include/dal_asic_id.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +7 -1
@@ -165,7 +165,13 @@ enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id)case FAMILY_NV : dc_version =DCN_VERSION_2_0 ; -if (asic_id.chip_id ==DEVICE_ID_NV_13FE || asic_id.chip_id ==DEVICE_ID_NV_143F ) { +if (asic_id.chip_id ==DEVICE_ID_NV_13FE || + asic_id.chip_id ==DEVICE_ID_NV_143F || + asic_id.chip_id ==DEVICE_ID_NV_13F9 || + asic_id.chip_id ==DEVICE_ID_NV_13FA || + asic_id.chip_id ==DEVICE_ID_NV_13FB || + asic_id.chip_id ==DEVICE_ID_NV_13FC || + asic_id.chip_id ==DEVICE_ID_NV_13DB ) { dc_version =DCN_VERSION_2_01 ;break ; }
drivers/gpu/drm/amd/display/include/dal_asic_id.h +5 -0
@@ -213,6 +213,11 @@ enum {#endif #define DEVICE_ID_NV_13FE 0x13FE // CYAN_SKILLFISH#define DEVICE_ID_NV_143F 0x143F +#define DEVICE_ID_NV_13F9 0x13F9 +#define DEVICE_ID_NV_13FA 0x13FA +#define DEVICE_ID_NV_13FB 0x13FB +#define DEVICE_ID_NV_13FC 0x13FC +#define DEVICE_ID_NV_13DB 0x13DB#define FAMILY_VGH 144#define DEVICE_ID_VGH_163F 0x163F#define DEVICE_ID_VGH_1435 0x1435
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 253/849 drm/amdgpu: Initialize jpeg v5_0_1 ras function
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mangesh Gadre <[email protected]>
[ Upstream commit 01fa9758c8498d8930df56eca36c88ba3e9493d4 ]
Initialize jpeg v5_0_1 ras function
--- drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c +8 -0
@@ -196,6 +196,14 @@ static int jpeg_v5_0_1_sw_init(struct amdgpu_ip_block *ip_block) } } +if (amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__JPEG )) { + r =amdgpu_jpeg_ras_sw_init (adev); +if (r) { +dev_err (adev->dev,"Failed to initialize jpeg ras block!\n" ); +return r; + } + } + r =amdgpu_jpeg_reg_dump_init (adev, jpeg_reg_list_5_0_1,ARRAY_SIZE (jpeg_reg_list_5_0_1));if (r)return r;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 254/849 drm/amdgpu: skip mgpu fan boost for multi-vf
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yunxiang Li <[email protected]>
[ Upstream commit ba5e322b2617157edb757055252a33587b6729e0 ]
On multi-vf setup if the VM have two vf assigned, perhaps from two different gpus, mgpu fan boost will fail.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -3389,7 +3389,7 @@ static int amdgpu_device_enable_mgpu_fan_boost(void)for (i =0 ; i < mgpu_info.num_dgpu; i++) { gpu_ins = &(mgpu_info.gpu_ins[i]); adev = gpu_ins->adev; -if (!(adev->flags &AMD_IS_APU ) && +if (!(adev->flags &AMD_IS_APU ||amdgpu_sriov_multi_vf_mode (adev)) && !gpu_ins->mgpu_fan_enabled) { ret =amdgpu_dpm_enable_mgpu_fan_boost (adev);if (ret)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 255/849 drm/amd/display: fix dmub access race condition
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurabindo Pillai <[email protected]>
[ Upstream commit c210b757b400959577a5a17b783b5959b82baed8 ]
Accessing DC from amdgpu_dm is usually preceded by acquisition of dc_lock mutex. Most of the DC API that DM calls are under a DC lock. However, there are a few that are not. Some DC API called from interrupt context end up sending DMUB commands via a DC API, while other threads were using DMUB. This was apparent from a race between calls for setting idle optimization enable/disable and the DC API to set vmin/vmax.
Offload the call to dc_stream_adjust_vmin_vmax() to a thread instead of directly calling them from the interrupt handler such that it waits for dc_lock.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 55 +++++++++++++++++-- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 14 +++++ 2 files changed, 63 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +49 -6
@@ -541,6 +541,50 @@ static void dm_pflip_high_irq(void *interrupt_params) amdgpu_crtc->crtc_id, amdgpu_crtc, vrr_active, (int)!e); } +static void dm_handle_vmin_vmax_update (struct work_struct *offload_work) +{ + struct vupdate_offload_work *work = container_of(offload_work, struct vupdate_offload_work, work); +struct amdgpu_device *adev = work->adev; +struct dc_stream_state *stream = work->stream; +struct dc_crtc_timing_adjust *adjust = work->adjust; + +mutex_lock (&adev->dm.dc_lock); +dc_stream_adjust_vmin_vmax (adev->dm.dc, stream, adjust); +mutex_unlock (&adev->dm.dc_lock); + +dc_stream_release (stream); +kfree (work->adjust); +kfree (work); +} + +static void schedule_dc_vmin_vmax (struct amdgpu_device *adev, +struct dc_stream_state *stream, +struct dc_crtc_timing_adjust *adjust) +{ +struct vupdate_offload_work *offload_work =kzalloc (sizeof (*offload_work),GFP_KERNEL ); +if (!offload_work) { +drm_dbg_driver (adev_to_drm (adev),"Failed to allocate vupdate_offload_work\n" ); +return ; + } + +struct dc_crtc_timing_adjust *adjust_copy =kzalloc (sizeof (*adjust_copy),GFP_KERNEL ); +if (!adjust_copy) { +drm_dbg_driver (adev_to_drm (adev),"Failed to allocate adjust_copy\n" ); +kfree (offload_work); +return ; + } + +dc_stream_retain (stream); +memcpy (adjust_copy, adjust,sizeof (*adjust_copy)); + +INIT_WORK (&offload_work->work, dm_handle_vmin_vmax_update); + offload_work->adev = adev; + offload_work->stream = stream; + offload_work->adjust = adjust_copy; + +queue_work (system_wq, &offload_work->work); +} +static void dm_vupdate_high_irq (void *interrupt_params) {struct common_irq_params *irq_params = interrupt_params;
@@ -590,10 +634,9 @@ static void dm_vupdate_high_irq(void *interrupt_params) acrtc->dm_irq_params.stream, &acrtc->dm_irq_params.vrr_params); -dc_stream_adjust_vmin_vmax ( - adev->dm.dc, - acrtc->dm_irq_params.stream, - &acrtc->dm_irq_params.vrr_params.adjust); +schedule_dc_vmin_vmax (adev, + acrtc->dm_irq_params.stream, + &acrtc->dm_irq_params.vrr_params.adjust);spin_unlock_irqrestore (&adev_to_drm (adev)->event_lock, flags); } }
@@ -683,8 +726,8 @@ static void dm_crtc_high_irq(void *interrupt_params) acrtc->dm_irq_params.stream, &acrtc->dm_irq_params.vrr_params); -dc_stream_adjust_vmin_vmax (adev->dm.dc, acrtc->dm_irq_params.stream, - &acrtc->dm_irq_params.vrr_params.adjust); +schedule_dc_vmin_vmax (adev, acrtc->dm_irq_params.stream, + &acrtc->dm_irq_params.vrr_params.adjust); }/*
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +14 -0
@@ -152,6 +152,20 @@ struct idle_workqueue {bool running; }; +/** +* struct dm_vupdate_work - Work data for periodic action in idle +* @work: Kernel work data for the work event +* @adev: amdgpu_device back pointer +* @stream: DC stream associated with the crtc +* @adjust: DC CRTC timing adjust to be applied to the crtc +*/ +struct vupdate_offload_work { +struct work_struct work; +struct amdgpu_device *adev; +struct dc_stream_state *stream; +struct dc_crtc_timing_adjust *adjust; +}; +#define MAX_LUMINANCE_DATA_POINTS 99/**
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 256/849 drm/amd/display: update dpp/disp clock from smu clock table
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Hsieh <[email protected]>
[ Upstream commit 2e72fdba8a32ce062a86571edff4592710c26215 ]
[Why]
The reason some high-resolution monitors fail to display properly is that this platform does not support sufficiently high DPP and DISP clock frequencies
[How]
Update DISP and DPP clocks from the smu clock table then DML can filter these mode if not support.
--- .../display/dc/clk_mgr/dcn301/vg_clk_mgr.c | 16 +++++++++++++++ .../amd/display/dc/dml/dcn301/dcn301_fpu.c | 20 ++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c +16 -0
@@ -563,6 +563,7 @@ static void vg_clk_mgr_helper_populate_bw_params( {int i, j;struct clk_bw_params *bw_params = clk_mgr->base.bw_params; +uint32_t max_dispclk =0 , max_dppclk =0 ; j =-1 ;
@@ -584,6 +585,15 @@ static void vg_clk_mgr_helper_populate_bw_params(return ; } +/* dispclk and dppclk can be max at any voltage, same number of levels for both */ +if (clock_table->NumDispClkLevelsEnabled <=VG_NUM_DISPCLK_DPM_LEVELS && + clock_table->NumDispClkLevelsEnabled <=VG_NUM_DPPCLK_DPM_LEVELS ) { + max_dispclk =find_max_clk_value (clock_table->DispClocks, clock_table->NumDispClkLevelsEnabled); + max_dppclk =find_max_clk_value (clock_table->DppClocks, clock_table->NumDispClkLevelsEnabled); + }else { +ASSERT (0 ); + } + bw_params->clk_table.num_entries = j +1 ;for (i =0 ; i < bw_params->clk_table.num_entries -1 ; i++, j--) {
@@ -591,11 +601,17 @@ static void vg_clk_mgr_helper_populate_bw_params( bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].memclk; bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].voltage; bw_params->clk_table.entries[i].dcfclk_mhz =find_dcfclk_for_voltage (clock_table, clock_table->DfPstateTable[j].voltage); + +/* Now update clocks we do read */ + bw_params->clk_table.entries[i].dispclk_mhz = max_dispclk; + bw_params->clk_table.entries[i].dppclk_mhz = max_dppclk; } bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].fclk; bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].memclk; bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].voltage; bw_params->clk_table.entries[i].dcfclk_mhz =find_max_clk_value (clock_table->DcfClocks,VG_NUM_DCFCLK_DPM_LEVELS ); + bw_params->clk_table.entries[i].dispclk_mhz =find_max_clk_value (clock_table->DispClocks,VG_NUM_DISPCLK_DPM_LEVELS ); + bw_params->clk_table.entries[i].dppclk_mhz =find_max_clk_value (clock_table->DppClocks,VG_NUM_DPPCLK_DPM_LEVELS ); bw_params->vram_type = bios_info->memory_type; bw_params->num_channels = bios_info->ma_channel_number;
drivers/gpu/drm/amd/display/dc/dml/dcn301/dcn301_fpu.c +17 -3
@@ -326,7 +326,7 @@ void dcn301_fpu_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_pstruct dcn301_resource_pool *pool =TO_DCN301_RES_POOL (dc->res_pool);struct clk_limit_table *clk_table = &bw_params->clk_table;unsigned int i, closest_clk_lvl; -int j; +int j =0 , max_dispclk_mhz =0 , max_dppclk_mhz =0 ;dc_assert_fp_enabled ();
@@ -338,6 +338,15 @@ void dcn301_fpu_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_p dcn3_01_soc.num_chans = bw_params->num_channels;ASSERT (clk_table->num_entries); + +/* Prepass to find max clocks independent of voltage level. */ +for (i =0 ; i < clk_table->num_entries; ++i) { +if (clk_table->entries[i].dispclk_mhz > max_dispclk_mhz) + max_dispclk_mhz = clk_table->entries[i].dispclk_mhz; +if (clk_table->entries[i].dppclk_mhz > max_dppclk_mhz) + max_dppclk_mhz = clk_table->entries[i].dppclk_mhz; + } +for (i =0 ; i < clk_table->num_entries; i++) {/* loop backwards*/ for (closest_clk_lvl =0 , j = dcn3_01_soc.num_states -1 ; j >=0 ; j--) {
@@ -353,8 +362,13 @@ void dcn301_fpu_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_p s[i].socclk_mhz = clk_table->entries[i].socclk_mhz; s[i].dram_speed_mts = clk_table->entries[i].memclk_mhz *2 ; - s[i].dispclk_mhz = dcn3_01_soc.clock_limits[closest_clk_lvl].dispclk_mhz; - s[i].dppclk_mhz = dcn3_01_soc.clock_limits[closest_clk_lvl].dppclk_mhz; +/* Clocks independent of voltage level. */ + s[i].dispclk_mhz = max_dispclk_mhz ? max_dispclk_mhz : + dcn3_01_soc.clock_limits[closest_clk_lvl].dispclk_mhz; + + s[i].dppclk_mhz = max_dppclk_mhz ? max_dppclk_mhz : + dcn3_01_soc.clock_limits[closest_clk_lvl].dppclk_mhz; + s[i].dram_bw_per_chan_gbps = dcn3_01_soc.clock_limits[closest_clk_lvl].dram_bw_per_chan_gbps; s[i].dscclk_mhz = dcn3_01_soc.clock_limits[closest_clk_lvl].dscclk_mhz;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 257/849 drm/amd/pm: Use cached metrics data on aldebaran
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit e87577ef6daa0cfb10ca139c720f0c57bd894174 ]
Cached metrics data validity is 1ms on aldebaran. It's not reasonable for any client to query gpu_metrics at a faster rate and constantly interrupt PMFW.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +1 -1
@@ -1781,7 +1781,7 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, ret =smu_cmn_get_metrics_table (smu, &metrics, - true); + false);if (ret)return ret;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 258/849 drm/amd/pm: Use cached metrics data on arcturus
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit 2f3b1ccf83be83a3330e38194ddfd1a91fec69be ]
Cached metrics data validity is 1ms on arcturus. It's not reasonable for any client to query gpu_metrics at a faster rate and constantly interrupt PMFW.
--- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +1 -1
@@ -1897,7 +1897,7 @@ static ssize_t arcturus_get_gpu_metrics(struct smu_context *smu, ret =smu_cmn_get_metrics_table (smu, &metrics, - true); + false);if (ret)return ret;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 259/849 accel/amdxdna: Unify pm and rpm suspend and resume callbacks
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lizhi Hou <[email protected]>
[ Upstream commit d2b48f2b30f25997a1ae1ad0cefac68c25f8c330 ]
The suspend and resume callbacks for pm and runtime pm should be same. During suspending, it needs to stop all hardware contexts first. And the hardware contexts will be restarted after the device is resumed.
--- drivers/accel/amdxdna/aie2_ctx.c | 59 ++++++++++---------- drivers/accel/amdxdna/aie2_pci.c | 37 +++++++++++-- drivers/accel/amdxdna/aie2_pci.h | 5 +- drivers/accel/amdxdna/amdxdna_ctx.c | 26 --------- drivers/accel/amdxdna/amdxdna_ctx.h | 2 - drivers/accel/amdxdna/amdxdna_pci_drv.c | 74 +++---------------------- drivers/accel/amdxdna/amdxdna_pci_drv.h | 4 +- 7 files changed, 73 insertions(+), 134 deletions(-)
drivers/accel/amdxdna/aie2_ctx.c +30 -29
@@ -46,6 +46,17 @@ static void aie2_job_put(struct amdxdna_sched_job *job)kref_put (&job->refcnt, aie2_job_release); } +static void aie2_hwctx_status_shift_stop (struct amdxdna_hwctx *hwctx) +{ + hwctx->old_status = hwctx->status; + hwctx->status =HWCTX_STAT_STOP ; +} + +static void aie2_hwctx_status_restore (struct amdxdna_hwctx *hwctx) +{ + hwctx->status = hwctx->old_status; +} +/* The bad_job is used in aie2_sched_job_timedout, otherwise, set it to NULL */ static void aie2_hwctx_stop (struct amdxdna_dev *xdna,struct amdxdna_hwctx *hwctx,struct drm_sched_job *bad_job)
@@ -89,25 +100,6 @@ static int aie2_hwctx_restart(struct amdxdna_dev *xdna, struct amdxdna_hwctx *hwreturn ret; } -void aie2_restart_ctx (struct amdxdna_client *client) -{ -struct amdxdna_dev *xdna = client->xdna; -struct amdxdna_hwctx *hwctx; -unsigned long hwctx_id; - -drm_WARN_ON (&xdna->ddev, !mutex_is_locked (&xdna->dev_lock)); -mutex_lock (&client->hwctx_lock); -amdxdna_for_each_hwctx (client, hwctx_id, hwctx) { -if (hwctx->status !=HWCTX_STAT_STOP ) -continue ; - - hwctx->status = hwctx->old_status; -XDNA_DBG (xdna,"Resetting %s" , hwctx->name); -aie2_hwctx_restart (xdna, hwctx); - } -mutex_unlock (&client->hwctx_lock); -} -static struct dma_fence *aie2_cmd_get_out_fence (struct amdxdna_hwctx *hwctx,u64 seq) {struct dma_fence *fence, *out_fence =NULL ;
@@ -141,9 +133,11 @@ static void aie2_hwctx_wait_for_idle(struct amdxdna_hwctx *hwctx)dma_fence_put (fence); } -void aie2_hwctx_suspend (struct amdxdna_hwctx *hwctx) +void aie2_hwctx_suspend (struct amdxdna_client *client) { -struct amdxdna_dev *xdna = hwctx->client->xdna; +struct amdxdna_dev *xdna = client->xdna; +struct amdxdna_hwctx *hwctx; +unsigned long hwctx_id;/* * Command timeout is unlikely. But if it happens, it doesn't
@@ -151,15 +145,19 @@ void aie2_hwctx_suspend(struct amdxdna_hwctx *hwctx)* and abort all commands. */ drm_WARN_ON (&xdna->ddev, !mutex_is_locked (&xdna->dev_lock)); -aie2_hwctx_wait_for_idle (hwctx); -aie2_hwctx_stop (xdna, hwctx,NULL ); - hwctx->old_status = hwctx->status; - hwctx->status =HWCTX_STAT_STOP ; +guard (mutex)(&client->hwctx_lock); +amdxdna_for_each_hwctx (client, hwctx_id, hwctx) { +aie2_hwctx_wait_for_idle (hwctx); +aie2_hwctx_stop (xdna, hwctx,NULL ); +aie2_hwctx_status_shift_stop (hwctx); + } } -void aie2_hwctx_resume (struct amdxdna_hwctx *hwctx) +void aie2_hwctx_resume (struct amdxdna_client *client) { -struct amdxdna_dev *xdna = hwctx->client->xdna; +struct amdxdna_dev *xdna = client->xdna; +struct amdxdna_hwctx *hwctx; +unsigned long hwctx_id;/* * The resume path cannot guarantee that mailbox channel can be
@@ -167,8 +165,11 @@ void aie2_hwctx_resume(struct amdxdna_hwctx *hwctx)* mailbox channel, error will return. */ drm_WARN_ON (&xdna->ddev, !mutex_is_locked (&xdna->dev_lock)); - hwctx->status = hwctx->old_status; -aie2_hwctx_restart (xdna, hwctx); +guard (mutex)(&client->hwctx_lock); +amdxdna_for_each_hwctx (client, hwctx_id, hwctx) { +aie2_hwctx_status_restore (hwctx); +aie2_hwctx_restart (xdna, hwctx); + } } static void
drivers/accel/amdxdna/aie2_pci.c +33 -4
@@ -440,6 +440,37 @@ static int aie2_hw_start(struct amdxdna_dev *xdna)return ret; } +static int aie2_hw_suspend (struct amdxdna_dev *xdna) +{ +struct amdxdna_client *client; + +guard (mutex)(&xdna->dev_lock); +list_for_each_entry (client, &xdna->client_list, node) +aie2_hwctx_suspend (client); + +aie2_hw_stop (xdna); + +return 0 ; +} + +static int aie2_hw_resume (struct amdxdna_dev *xdna) +{ +struct amdxdna_client *client; +int ret; + +guard (mutex)(&xdna->dev_lock); + ret =aie2_hw_start (xdna); +if (ret) { +XDNA_ERR (xdna,"Start hardware failed, %d" , ret); +return ret; + } + +list_for_each_entry (client, &xdna->client_list, node) +aie2_hwctx_resume (client); + +return ret; +} +static int aie2_init (struct amdxdna_dev *xdna) {struct pci_dev *pdev =to_pci_dev (xdna->ddev.dev);
@@ -905,8 +936,8 @@ static int aie2_set_state(struct amdxdna_client *client,const struct amdxdna_dev_ops aie2_ops = { .init = aie2_init, .fini = aie2_fini, - .resume = aie2_hw_start, - .suspend = aie2_hw_stop, + .resume = aie2_hw_resume, + .suspend = aie2_hw_suspend, .get_aie_info = aie2_get_info, .set_aie_state = aie2_set_state, .hwctx_init = aie2_hwctx_init,
@@ -914,6 +945,4 @@ const struct amdxdna_dev_ops aie2_ops = { .hwctx_config = aie2_hwctx_config, .cmd_submit = aie2_cmd_submit, .hmm_invalidate = aie2_hmm_invalidate, - .hwctx_suspend = aie2_hwctx_suspend, - .hwctx_resume = aie2_hwctx_resume, };
drivers/accel/amdxdna/aie2_pci.h +2 -3
@@ -288,10 +288,9 @@ int aie2_sync_bo(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job,int aie2_hwctx_init (struct amdxdna_hwctx *hwctx);void aie2_hwctx_fini (struct amdxdna_hwctx *hwctx);int aie2_hwctx_config (struct amdxdna_hwctx *hwctx,u32 type,u64 value,void *buf,u32 size); -void aie2_hwctx_suspend (struct amdxdna_hwctx *hwctx); -void aie2_hwctx_resume (struct amdxdna_hwctx *hwctx); +void aie2_hwctx_suspend (struct amdxdna_client *client); +void aie2_hwctx_resume (struct amdxdna_client *client);int aie2_cmd_submit (struct amdxdna_hwctx *hwctx,struct amdxdna_sched_job *job,u64 *seq);void aie2_hmm_invalidate (struct amdxdna_gem_obj *abo,unsigned long cur_seq); -void aie2_restart_ctx (struct amdxdna_client *client);#endif /* _AIE2_PCI_H_ */
drivers/accel/amdxdna/amdxdna_ctx.c +0 -26
@@ -60,32 +60,6 @@ static struct dma_fence *amdxdna_fence_create(struct amdxdna_hwctx *hwctx)return &fence->base; } -void amdxdna_hwctx_suspend (struct amdxdna_client *client) -{ -struct amdxdna_dev *xdna = client->xdna; -struct amdxdna_hwctx *hwctx; -unsigned long hwctx_id; - -drm_WARN_ON (&xdna->ddev, !mutex_is_locked (&xdna->dev_lock)); -mutex_lock (&client->hwctx_lock); -amdxdna_for_each_hwctx (client, hwctx_id, hwctx) - xdna->dev_info->ops->hwctx_suspend (hwctx); -mutex_unlock (&client->hwctx_lock); -} - -void amdxdna_hwctx_resume (struct amdxdna_client *client) -{ -struct amdxdna_dev *xdna = client->xdna; -struct amdxdna_hwctx *hwctx; -unsigned long hwctx_id; - -drm_WARN_ON (&xdna->ddev, !mutex_is_locked (&xdna->dev_lock)); -mutex_lock (&client->hwctx_lock); -amdxdna_for_each_hwctx (client, hwctx_id, hwctx) - xdna->dev_info->ops->hwctx_resume (hwctx); -mutex_unlock (&client->hwctx_lock); -} -static void amdxdna_hwctx_destroy_rcu (struct amdxdna_hwctx *hwctx,struct srcu_struct *ss) {
drivers/accel/amdxdna/amdxdna_ctx.h +0 -2
@@ -147,8 +147,6 @@ static inline u32 amdxdna_hwctx_col_map(struct amdxdna_hwctx *hwctx)void amdxdna_sched_job_cleanup (struct amdxdna_sched_job *job);void amdxdna_hwctx_remove_all (struct amdxdna_client *client); -void amdxdna_hwctx_suspend (struct amdxdna_client *client); -void amdxdna_hwctx_resume (struct amdxdna_client *client); int amdxdna_cmd_submit(struct amdxdna_client *client, u32 cmd_bo_hdls, u32 *arg_bo_hdls, u32 arg_bo_cnt,
drivers/accel/amdxdna/amdxdna_pci_drv.c +7 -67
96 lines not on this page · raw message
drivers/accel/amdxdna/amdxdna_pci_drv.h +1 -3
@@ -50,13 +50,11 @@ struct amdxdna_dev_ops {int (*init)(struct amdxdna_dev *xdna);void (*fini)(struct amdxdna_dev *xdna);int (*resume)(struct amdxdna_dev *xdna); -void (*suspend)(struct amdxdna_dev *xdna); +int (*suspend)(struct amdxdna_dev *xdna);int (*hwctx_init)(struct amdxdna_hwctx *hwctx);void (*hwctx_fini)(struct amdxdna_hwctx *hwctx);int (*hwctx_config)(struct amdxdna_hwctx *hwctx,u32 type,u64 value,void *buf,u32 size);void (*hmm_invalidate)(struct amdxdna_gem_obj *abo,unsigned long cur_seq); -void (*hwctx_suspend)(struct amdxdna_hwctx *hwctx); -void (*hwctx_resume)(struct amdxdna_hwctx *hwctx);int (*cmd_submit)(struct amdxdna_hwctx *hwctx,struct amdxdna_sched_job *job,u64 *seq);int (*get_aie_info)(struct amdxdna_client *client,struct amdxdna_drm_get_info *args);int (*set_aie_state)(struct amdxdna_client *client,struct amdxdna_drm_set_state *args);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 260/849 drm/amdgpu/jpeg: Hold pg_lock before jpeg poweroff
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sathishkumar S <[email protected]>
[ Upstream commit 0e7581eda8c76d1ca4cf519631a4d4eb9f82b94c ]
Acquire jpeg_pg_lock before changes to jpeg power state and release it after power off from idle work handler.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +4 -2
@@ -121,10 +121,12 @@ static void amdgpu_jpeg_idle_work_handler(struct work_struct *work) fences +=amdgpu_fence_count_emitted (&adev->jpeg.inst[i].ring_dec[j]); } -if (!fences && !atomic_read (&adev->jpeg.total_submission_cnt)) +if (!fences && !atomic_read (&adev->jpeg.total_submission_cnt)) { +mutex_lock (&adev->jpeg.jpeg_pg_lock);amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_JPEG ,AMD_PG_STATE_GATE ); -else +mutex_unlock (&adev->jpeg.jpeg_pg_lock); + }else schedule_delayed_work (&adev->jpeg.idle_work,JPEG_IDLE_TIMEOUT ); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 261/849 drm/xe/pf: Program LMTT directory pointer on all GTs within a tile
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Piotr Piórkowski <[email protected]>
[ Upstream commit ad69d62588cd6bf8cddaff5e3e2eb1b8dd876d35 ]
Previously, the LMTT directory pointer was only programmed for primary GT within a tile. However, to ensure correct Local Memory access by VFs, the LMTT configuration must be programmed on all GTs within the tile. Lets program the LMTT directory pointer on every GT of the tile to guarantee proper LMEM access across all GTs on VFs.
HSD: 18042797646
Bspec: 67468
--- drivers/gpu/drm/xe/xe_lmtt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_lmtt.c +6 -3
@@ -195,14 +195,17 @@ static void lmtt_setup_dir_ptr(struct xe_lmtt *lmtt)struct xe_tile *tile =lmtt_to_tile (lmtt);struct xe_device *xe =tile_to_xe (tile);dma_addr_t offset =xe_bo_main_addr (lmtt->pd->bo,XE_PAGE_SIZE ); +struct xe_gt *gt; +u8 id;lmtt_debug (lmtt,"DIR offset %pad\n" , &offset);lmtt_assert (lmtt,xe_bo_is_vram (lmtt->pd->bo));lmtt_assert (lmtt,IS_ALIGNED (offset,SZ_64K )); -xe_mmio_write32 (&tile->mmio, -GRAPHICS_VER (xe) >=20 ?XE2_LMEM_CFG :LMEM_CFG , -LMEM_EN |REG_FIELD_PREP (LMTT_DIR_PTR , offset /SZ_64K )); +for_each_gt_on_tile (gt, tile, id) +xe_mmio_write32 (>->mmio, +GRAPHICS_VER (xe) >=20 ?XE2_LMEM_CFG :LMEM_CFG , +LMEM_EN |REG_FIELD_PREP (LMTT_DIR_PTR , offset /SZ_64K )); }/**
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 262/849 drm/nouveau: replace snprintf() with scnprintf() in nvkm_snprintbf()
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seyediman Seyedarab <[email protected]>
[ Upstream commit 6510b62fe9303aaf48ff136ff69186bcfc32172d ]
snprintf() returns the number of characters that *would* have been written, which can overestimate how much you actually wrote to the buffer in case of truncation. That leads to 'data += this' advancing the pointer past the end of the buffer and size going negative.
Switching to scnprintf() prevents potential buffer overflows and ensures consistent behavior when building the output string.
--- drivers/gpu/drm/nouveau/nvkm/core/enum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/core/enum.c +1 -1
@@ -44,7 +44,7 @@ nvkm_snprintbf(char *data, int size, const struct nvkm_bitfield *bf, u32 value)bool space = false;while (size >=1 && bf->name) {if (value & bf->mask) { -int this =snprintf (data, size,"%s%s" , +int this =scnprintf (data, size,"%s%s" , space ?" " :"" , bf->name); size -= this; data += this;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 263/849 ASoC: tas2781: Add keyword "init" in profile section
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shenghao Ding <[email protected]>
[ Upstream commit e83dcd139e776ebb86d5e88e13282580407278e4 ]
Since version 0x105, the keyword 'init' was introduced into the profile, which is used for chip initialization, particularly to store common settings for other non-initialization profiles.
--- include/sound/tas2781-dsp.h | 8 ++++++++ sound/soc/codecs/tas2781-fmwlib.c | 12 ++++++++++++ sound/soc/codecs/tas2781-i2c.c | 6 ++++++ 3 files changed, 26 insertions(+)
include/sound/tas2781-dsp.h +8 -0
@@ -198,6 +198,14 @@ struct tasdevice_rca {int ncfgs;struct tasdevice_config_info **cfg_info;int profile_cfg_id; +/* +* Since version 0x105, the keyword 'init' was introduced into the +* profile, which is used for chip initialization, particularly to +* store common settings for other non-initialization profiles. +* if (init_profile_id < 0) +* No init profile inside the RCA firmware. +*/ +int init_profile_id; }; void tasdevice_select_cfg_blk(void *context, int conf_no,
sound/soc/codecs/tas2781-fmwlib.c +12 -0
@@ -180,6 +180,16 @@ static struct tasdevice_config_info *tasdevice_add_config(dev_err (tas_priv->dev,"add conf: Out of boundary\n" ); goto out; } +/* If in the RCA bin file are several profiles with the +* keyword "init", init_profile_id only store the last +* init profile id. +*/ +if (strnstr (&config_data[config_offset],"init" ,64 )) { + tas_priv->rcabin.init_profile_id = + tas_priv->rcabin.ncfgs -1 ; +dev_dbg (tas_priv->dev,"%s: init profile id = %d\n" , + __func__, tas_priv->rcabin.init_profile_id); + } config_offset +=64 ; }
@@ -283,6 +293,8 @@ int tasdevice_rca_parser(void *context, const struct firmware *fmw)int i; rca = &(tas_priv->rcabin); +/* Initialize to none */ + rca->init_profile_id =-1 ; fw_hdr = &(rca->fw_hdr);if (!fmw || !fmw->data) { dev_err(tas_priv->dev, "Failed to read %s\n",
sound/soc/codecs/tas2781-i2c.c +6 -0
@@ -1641,6 +1641,12 @@ static void tasdevice_fw_ready(const struct firmware *fmw,tasdevice_prmg_load (tas_priv,0 ); tas_priv->cur_prog =0 ; +/* Init common setting for different audio profiles */ +if (tas_priv->rcabin.init_profile_id >=0 ) +tasdevice_select_cfg_blk (tas_priv, + tas_priv->rcabin.init_profile_id, +TASDEVICE_BIN_BLK_PRE_POWER_UP ); +#ifdef CONFIG_SND_SOC_TAS2781_ACOUST_I2C if (tas_priv->name_prefix) acoustic_debugfs_node = devm_kasprintf(tas_priv->dev,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 264/849 ASoC: mediatek: Use SND_JACK_AVOUT for HDMI/DP jacks
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Terry Cheong <[email protected]>
[ Upstream commit 8ed2dca4df2297177e0edcb7e0c72ef87f3fd81a ]
The SND_JACK_AVOUT is a more specific jack type for HDMI and DisplayPort. Updatae the MediaTek drivers to use such jack type, allowing system to determine the device type based on jack event.
--- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 2 +- sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 2 +- .../soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 2 +- sound/soc/mediatek/mt8186/mt8186-mt6366.c | 2 +- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 8 ++++---- sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 2 +- sound/soc/mediatek/mt8195/mt8195-mt6359.c | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-)
sound/soc/mediatek/mt8173/mt8173-rt5650.c +1 -1
@@ -159,7 +159,7 @@ static int mt8173_rt5650_hdmi_init(struct snd_soc_pcm_runtime *rtd) {int ret; - ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_LINEOUT , + ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_AVOUT , &mt8173_rt5650_hdmi_jack);if (ret)return ret;
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +1 -1
@@ -378,7 +378,7 @@ static int mt8183_da7219_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd)snd_soc_card_get_drvdata (rtd->card);int ret; - ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_LINEOUT , + ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_AVOUT , &priv->hdmi_jack);if (ret)return ret;
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +1 -1
@@ -383,7 +383,7 @@ mt8183_mt6358_ts3a227_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd)snd_soc_card_get_drvdata (rtd->card);int ret; - ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_LINEOUT , + ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_AVOUT , &priv->hdmi_jack);if (ret)return ret;
sound/soc/mediatek/mt8186/mt8186-mt6366.c +1 -1
@@ -362,7 +362,7 @@ static int mt8186_mt6366_rt1019_rt5682s_hdmi_init(struct snd_soc_pcm_runtime *rtreturn ret; } - ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_LINEOUT , jack); + ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_AVOUT , jack);if (ret) {dev_err (rtd->dev,"HDMI Jack creation failed: %d\n" , ret);return ret;
sound/soc/mediatek/mt8188/mt8188-mt6359.c +4 -4
@@ -250,14 +250,14 @@ enum mt8188_jacks {static struct snd_soc_jack_pin mt8188_hdmi_jack_pins[] = { { .pin ="HDMI" , - .mask =SND_JACK_LINEOUT , + .mask =SND_JACK_AVOUT , }, };static struct snd_soc_jack_pin mt8188_dp_jack_pins[] = { { .pin ="DP" , - .mask =SND_JACK_LINEOUT , + .mask =SND_JACK_AVOUT , }, };
@@ -638,7 +638,7 @@ static int mt8188_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd)int ret =0 ; ret =snd_soc_card_jack_new_pins (rtd->card,"HDMI Jack" , -SND_JACK_LINEOUT , jack, +SND_JACK_AVOUT , jack, mt8188_hdmi_jack_pins,ARRAY_SIZE (mt8188_hdmi_jack_pins));if (ret) {
@@ -663,7 +663,7 @@ static int mt8188_dptx_codec_init(struct snd_soc_pcm_runtime *rtd)struct snd_soc_component *component =snd_soc_rtd_to_codec (rtd,0 )->component;int ret =0 ; - ret =snd_soc_card_jack_new_pins (rtd->card,"DP Jack" ,SND_JACK_LINEOUT , + ret =snd_soc_card_jack_new_pins (rtd->card,"DP Jack" ,SND_JACK_AVOUT , jack, mt8188_dp_jack_pins,ARRAY_SIZE (mt8188_dp_jack_pins));if (ret) {
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +1 -1
@@ -368,7 +368,7 @@ static int mt8192_mt6359_hdmi_init(struct snd_soc_pcm_runtime *rtd)snd_soc_rtd_to_codec (rtd,0 )->component;int ret; - ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_LINEOUT , jack); + ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_AVOUT , jack);if (ret) {dev_err (rtd->dev,"HDMI Jack creation failed: %d\n" , ret);return ret;
sound/soc/mediatek/mt8195/mt8195-mt6359.c +2 -2
@@ -360,7 +360,7 @@ static int mt8195_dptx_codec_init(struct snd_soc_pcm_runtime *rtd)snd_soc_rtd_to_codec (rtd,0 )->component;int ret; - ret =snd_soc_card_jack_new (rtd->card,"DP Jack" ,SND_JACK_LINEOUT , jack); + ret =snd_soc_card_jack_new (rtd->card,"DP Jack" ,SND_JACK_AVOUT , jack);if (ret)return ret;
@@ -375,7 +375,7 @@ static int mt8195_hdmi_codec_init(struct snd_soc_pcm_runtime *rtd)snd_soc_rtd_to_codec (rtd,0 )->component;int ret; - ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_LINEOUT , jack); + ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_AVOUT , jack);if (ret)return ret;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 265/849 drm/amd/display: Reset apply_eamless_boot_optimization when dpms_off
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danny Wang <[email protected]>
[ Upstream commit ad335b5fc9ed1cdeb33fbe97d2969b3a2eedaf3e ]
[WHY&HOW]
The user closed the lid while the system was powering on and opened it again before the “apply_seamless_boot_optimization” was set to false, resulting in the eDP remaining blank.
Reset the “apply_seamless_boot_optimization” to false when dpms off.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
@@ -3404,7 +3404,7 @@ static void update_seamless_boot_flags(struct dc *dc, int surface_count, struct dc_stream_state *stream) { - if (get_seamless_boot_stream_count(context) > 0 && surface_count > 0) { + if (get_seamless_boot_stream_count(context) > 0 && (surface_count > 0 || stream->dpms_off)) {/* Optimize seamless boot flag keeps clocks and watermarks high until * first flip. After first flip, optimization is required to lower * bandwidth. Important to note that it is expected UEFI will
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 266/849 drm/amdgpu: add to custom amdgpu_drm_release drm_dev_enter/exit
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Prosyak <[email protected]>
[ Upstream commit c31f486bc8dd6f481adcb9cca4a6e1837b8cf127 ]
User queues are disabled before GEM objects are released (protecting against user app crashes).
No races with PCI hot-unplug (because drm_dev_enter prevents cleanup if iewdevice is being removed).
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -1
@@ -2937,11 +2937,14 @@ static int amdgpu_drm_release(struct inode *inode, struct file *filp) {struct drm_file *file_priv = filp->private_data;struct amdgpu_fpriv *fpriv = file_priv->driver_priv; +struct drm_device *dev = file_priv->minor->dev; +int idx; -if (fpriv) { +if (fpriv &&drm_dev_enter (dev, &idx)) { fpriv->evf_mgr.fd_closing = true;amdgpu_eviction_fence_destroy (&fpriv->evf_mgr);amdgpu_userq_mgr_fini (&fpriv->userq_mgr); +drm_dev_exit (idx); }return drm_release (inode, filp);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 267/849 drm/amd/display: Wait until OTG enable state is cleared
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: TungYu Lu <[email protected]>
[ Upstream commit e7496c15d830689cc4fc666b976c845ed2c5ed28 ]
[Why]
Customer reported an issue that OS starts and stops device multiple times during driver installation. Frequently disabling and enabling OTG may prevent OTG from being safely disabled and cause incorrect configuration upon the next enablement.
[How]
Add a wait until OTG_CURRENT_MASTER_EN_STATE is cleared as a short term solution.
--- drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c +5 -0
@@ -226,6 +226,11 @@ bool optc401_disable_crtc(struct timing_generator *optc)REG_UPDATE (CONTROL ,VTG0_ENABLE ,0 ); +// wait until CRTC_CURRENT_MASTER_EN_STATE == 0 +REG_WAIT (OTG_CONTROL , +OTG_CURRENT_MASTER_EN_STATE , +0 ,10 ,15000 ); +/* CRTC disabled, so disable clock. */ REG_WAIT(OTG_CLOCK_CONTROL, OTG_BUSY, 0,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 268/849 drm/xe: rework PDE PAT index selection
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Auld <[email protected]>
[ Upstream commit 17593a69b75f098280ad88b625f2d8c5bfe4c6a1 ]
For non-leaf paging structures we end up selecting a random index between [0, 3], depending on the first user if the page-table is shared, since non-leaf structures only have two bits in the HW for encoding the PAT index, and here we are just passing along the full user provided index, which can be an index as large as ~31 on xe2+. The user provided index is meant for the leaf node, which maps the actual BO pages where we have more PAT bits, and not the non-leaf nodes which are only mapping other paging structures, and so only needs a minimal PAT index range. Also the chosen index might need to consider how the driver mapped the paging structures on the host side, like wc vs wb, which is separate from the user provided index.
With that move the PDE PAT index selection under driver control. For now just use a coherent index on platforms with page-tables that are cached on host side, and incoherent otherwise. Using a coherent index could potentially be expensive, and would be overkill if we know the page-table is always uncached on host side.
v2 (Stuart):
- Add some documentation and split into separate helper.
BSpec: 59510
--- drivers/gpu/drm/xe/xe_migrate.c | 10 ++++------ drivers/gpu/drm/xe/xe_pt.c | 4 ++-- drivers/gpu/drm/xe/xe_pt_types.h | 3 +-- drivers/gpu/drm/xe/xe_vm.c | 34 +++++++++++++++++++++++++++----- 4 files changed, 36 insertions(+), 15 deletions(-)
drivers/gpu/drm/xe/xe_migrate.c +4 -6
@@ -163,8 +163,7 @@ static void xe_migrate_program_identity(struct xe_device *xe, struct xe_vm *vm,for (pos = dpa_base; pos < vram_limit; pos +=SZ_1G , ofs +=8 ) {if (pos +SZ_1G >= vram_limit) { - entry = vm->pt_ops->pde_encode_bo (bo, pt_2m_ofs, - pat_index); + entry = vm->pt_ops->pde_encode_bo (bo, pt_2m_ofs);xe_map_wr (xe, &bo->vmap, ofs, u64, entry); flags = vm->pt_ops->pte_encode_addr(xe, 0,
@@ -218,7 +217,7 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,/* PT30 & PT31 reserved for 2M identity map */ pt29_ofs =xe_bo_size (bo) -3 *XE_PAGE_SIZE ; - entry = vm->pt_ops->pde_encode_bo (bo, pt29_ofs, pat_index); + entry = vm->pt_ops->pde_encode_bo (bo, pt29_ofs);xe_pt_write (xe, &vm->pt_root[id]->bo->vmap,0 , entry); map_ofs = (num_entries - num_setup) *XE_PAGE_SIZE ;
@@ -286,15 +285,14 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m, flags =XE_PDE_64K ; entry = vm->pt_ops->pde_encode_bo (bo, map_ofs + (u64)(level -1 ) * -XE_PAGE_SIZE , pat_index); +XE_PAGE_SIZE );xe_map_wr (xe, &bo->vmap, map_ofs +XE_PAGE_SIZE * level, u64, entry | flags); }/* Write PDE's that point to our BO. */ for (i =0 ; i < map_ofs /PAGE_SIZE ; i++) { - entry = vm->pt_ops->pde_encode_bo (bo, (u64 )i *XE_PAGE_SIZE , - pat_index); + entry = vm->pt_ops->pde_encode_bo (bo, (u64 )i *XE_PAGE_SIZE );xe_map_wr (xe, &bo->vmap, map_ofs +XE_PAGE_SIZE + (i +1 ) *8 , u64, entry);
drivers/gpu/drm/xe/xe_pt.c +2 -2
@@ -69,7 +69,7 @@ static u64 __xe_pt_empty_pte(struct xe_tile *tile, struct xe_vm *vm,if (level >MAX_HUGEPTE_LEVEL )return vm->pt_ops->pde_encode_bo (vm->scratch_pt[id][level -1 ]->bo, -0 , pat_index); +0 );return vm->pt_ops->pte_encode_addr (xe,0 , pat_index, level,IS_DGFX (xe),0 ) |XE_PTE_NULL ;
@@ -616,7 +616,7 @@ xe_pt_stage_bind_entry(struct xe_ptw *parent, pgoff_t offset, xe_child->is_compact = true; } - pte = vm->pt_ops->pde_encode_bo (xe_child->bo,0 , pat_index) | flags; + pte = vm->pt_ops->pde_encode_bo (xe_child->bo,0 ) | flags; ret =xe_pt_insert_entry (xe_walk, xe_parent, offset, xe_child, pte); }
drivers/gpu/drm/xe/xe_pt_types.h +1 -2
@@ -45,8 +45,7 @@ struct xe_pt_ops {u64 (*pte_encode_addr)(struct xe_device *xe,u64 addr,u16 pat_index,u32 pt_level,bool devmem,u64 flags); -u64 (*pde_encode_bo)(struct xe_bo *bo,u64 bo_offset, -u16 pat_index); +u64 (*pde_encode_bo)(struct xe_bo *bo,u64 bo_offset); };struct xe_pt_entry {
drivers/gpu/drm/xe/xe_vm.c +29 -5
@@ -1547,14 +1547,39 @@ static u64 pte_encode_ps(u32 pt_level)return 0 ; } -static u64 xelp_pde_encode_bo (struct xe_bo *bo,u64 bo_offset, -const u16 pat_index) +static u16 pde_pat_index (struct xe_bo *bo) +{ +struct xe_device *xe =xe_bo_device (bo); +u16 pat_index; + +/* +* We only have two bits to encode the PAT index in non-leaf nodes, but +* these only point to other paging structures so we only need a minimal +* selection of options. The user PAT index is only for encoding leaf +* nodes, where we have use of more bits to do the encoding. The +* non-leaf nodes are instead under driver control so the chosen index +* here should be distict from the user PAT index. Also the +* corresponding coherency of the PAT index should be tied to the +* allocation type of the page table (or at least we should pick +* something which is always safe). +*/ +if (!xe_bo_is_vram (bo) && bo->ttm.ttm->caching == ttm_cached) + pat_index = xe->pat.idx[XE_CACHE_WB ]; +else + pat_index = xe->pat.idx[XE_CACHE_NONE ]; + +xe_assert (xe, pat_index <=3 ); + +return pat_index; +} + +static u64 xelp_pde_encode_bo (struct xe_bo *bo,u64 bo_offset) {u64 pde; pde =xe_bo_addr (bo, bo_offset,XE_PAGE_SIZE ); pde |=XE_PAGE_PRESENT |XE_PAGE_RW ; - pde |=pde_encode_pat_index (pat_index); + pde |=pde_encode_pat_index (pde_pat_index (bo));return pde; }
@@ -2085,8 +2110,7 @@ struct xe_vm *xe_vm_lookup(struct xe_file *xef, u32 id)u64 xe_vm_pdp4_descriptor (struct xe_vm *vm,struct xe_tile *tile) { -return vm->pt_ops->pde_encode_bo (vm->pt_root[tile->id]->bo,0 , -tile_to_xe (tile)->pat.idx[XE_CACHE_WB ]); +return vm->pt_ops->pde_encode_bo (vm->pt_root[tile->id]->bo,0 ); } static struct xe_exec_queue *
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 269/849 docs: kernel-doc: avoid script crash on ancient Python
In reply to Greg Kroah-Hartman6.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit fc973dcd73f242480c61eccb1aa7306adafd2907 ]
While we do need at least 3.6 for kernel-doc to work, and at least 3.7 for it to output functions and structs with parameters at the right order, let the python binary be compatible with legacy versions.
The rationale is that the Kernel build nowadays calls kernel-doc with -none on some places. Better not to bail out when older versions are found.
With that, potentially this will run with python 2.7 and 3.2+, according with vermin:
$ vermin --no-tips -v ./scripts/kernel-doc Detecting python files.. Analyzing using 24 processes.. 2.7, 3.2 /new_devel/v4l/docs/scripts/kernel-doc Minimum required versions: 2.7, 3.2
3.2 minimal requirement is due to argparse.
The minimal version I could check was version 3.4 (using anaconda). Anaconda doesn't support 3.2 or 3.3 anymore, and 3.2 doesn't even compile (I tested compiling Python 3.2 on Fedora 42 and on Fedora 32 - no show).
With 3.4, the script didn't crash and emitted the right warning:
$ conda create -n py34 python=3.4
$ conda activate py34
python --version
Python 3.4.5
$ python ./scripts/kernel-doc --none include/media
Error: Python 3.6 or later is required by kernel-doc
$ conda deactivate $ python --version
Python 3.13.5
$ python ./scripts/kernel-doc --none include/media
(no warnings and script ran properly)Supporting 2.7 is out of scope, as it is EOL for 5 years, and changing shebang to point to "python" instead of "python3" would have a wider impact.
I did some extra checks about the differences from 3.2 and 3.4, and didn't find anything that would cause troubles:
grep -rE "yield from|asyncio|pathlib|async|await|enum" scripts/kernel-doc
Also, it doesn't use "@" operator. So, I'm confident that it should run (producing the exit warning) since Python 3.2.
--- scripts/kernel-doc.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-)
scripts/kernel-doc.py +24 -10
@@ -2,8 +2,17 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright(c) 2025: Mauro Carvalho Chehab <[email protected]>. # -# pylint: disable=C0103,R0915 -# +# pylint: disable=C0103,R0912,R0914,R0915 + +# NOTE: While kernel-doc requires at least version 3.6 to run, the +# command line should work with Python 3.2+ (tested with 3.4). +# The rationale is that it shall fail gracefully during Kernel +# compilation with older Kernel versions. Due to that: +# - encoding line is needed here; +# - no f-strings can be used on this file. +# - the libraries that require newer versions can only be included +# after Python version is checked. + # Converted from the kernel-doc script originally written in Perl # under GPLv2, copyrighted since 1998 by the following authors: #
@@ -107,9 +116,6 @@ SRC_DIR = os.path.dirname(os.path.realpath(__file__)) sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) -from kdoc_files import KernelFiles # pylint: disable=C0413 -from kdoc_output import RestFormat, ManFormat # pylint: disable=C0413 - DESC = """ Read C language source or header FILEs, extract embedded documentation comments, and print formatted documentation to standard output.
@@ -273,14 +279,22 @@ def main(): python_ver = sys.version_info[:2] if python_ver < (3,6): - logger.warning("Python 3.6 or later is required by kernel-doc") + # Depending on Kernel configuration, kernel-doc --none is called at + # build time. As we don't want to break compilation due to the + # usage of an old Python version, return 0 here. + if args.none: + logger.error("Python 3.6 or later is required by kernel-doc. skipping checks") + sys.exit(0) - # Return 0 here to avoid breaking compilation - sys.exit(0) + sys.exit("Python 3.6 or later is required by kernel-doc. Aborting.") if python_ver < (3,7): logger.warning("Python 3.7 or later is required for correct results") + # Import kernel-doc libraries only after checking Python version + from kdoc_files import KernelFiles # pylint: disable=C0415 + from kdoc_output import RestFormat, ManFormat # pylint: disable=C0415 + if args.man: out_style = ManFormat(modulename=args.modulename) elif args.none:
@@ -308,11 +322,11 @@ def main(): sys.exit(0) if args.werror: - print(f"{error_count} warnings as errors") + print("%s warnings as errors" % error_count) # pylint: disable=C0209 sys.exit(error_count) if args.verbose: - print(f"{error_count} errors") + print("%s errors" % error_count) # pylint: disable=C0209 if args.none: sys.exit(0)
Signature · 1 line
2.51.0