6.15.4-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 138/592 ipc: fix to protect IPCS lookups using RCU
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <[email protected]>
commit d66adabe91803ef34a8b90613c81267b5ded1472 upstream.
syzbot reported that it discovered a use-after-free vulnerability, [0]
[0]: https://lore.kernel.org/all/[email protected]/
idr_for_each() is protected by rwsem, but this is not enough. If it is not protected by RCU read-critical region, when idr_for_each() calls radix_tree_node_free() through call_rcu() to free the radix_tree_node structure, the node will be freed immediately, and when reading the next node in radix_tree_for_each_slot(), the already freed memory may be read.
Therefore, we need to add code to make sure that idr_for_each() is protected within the RCU read-critical region when we call it in shm_destroy_orphaned().
--- ipc/shm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
ipc/shm.c +4 -1
@@ -431,8 +431,11 @@ static int shm_try_destroy_orphaned(intvoid shm_destroy_orphaned (struct ipc_namespace *ns) {down_write (&shm_ids (ns).rwsem); -if (shm_ids (ns).in_use) +if (shm_ids (ns).in_use) { +rcu_read_lock ();idr_for_each (&shm_ids (ns).ipcs_idr, &shm_try_destroy_orphaned, ns); +rcu_read_unlock (); + }up_write (&shm_ids (ns).rwsem); }
Greg Kroah-Hartman
maintainerPATCH 139/592 watchdog: fix watchdog may detect false positive of softlockup
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luo Gengkun <[email protected]>
commit 7123dbbef88cfd9f09e8a7899b0911834600cfa3 upstream.
When updating watchdog_thresh, there is a race condition between writing the new watchdog_thresh value and stopping the old watchdog timer. If the old timer triggers during this window, it may falsely detect a softlockup due to the old interval and the new watchdog_thresh value being used. The problem can be described as follow:
# We asuume previous watchdog_thresh is 60, so the watchdog timer is
# coming every 24s. echo 10 > /proc/sys/kernel/watchdog_thresh (User space) | +------>+ update watchdog_thresh (We are in kernel now) | | # using old interval and new `watchdog_thresh` +------>+ watchdog hrtimer (irq context: detect softlockup) | | +-------+ | | + softlockup_stop_all
To fix this problem, introduce a shadow variable for watchdog_thresh. The update to the actual watchdog_thresh is delayed until after the old timer is stopped, preventing false positives.
The following testcase may help to understand this problem.
---------------------------------------------
echo RT_RUNTIME_SHARE > /sys/kernel/debug/sched/features echo -1 > /proc/sys/kernel/sched_rt_runtime_us
echo 0 > /sys/kernel/debug/sched/fair_server/cpu3/runtime echo 60 > /proc/sys/kernel/watchdog_thresh
taskset -c 3 chrt -r 99 /bin/bash -c "while true;do true; done" & echo 10 > /proc/sys/kernel/watchdog_thresh &
---------------------------------------------
The test case above first removes the throttling restrictions for real-time tasks. It then sets watchdog_thresh to 60 and executes a real-time task ,a simple while(1) loop, on cpu3. Consequently, the final command gets blocked because the presence of this real-time thread prevents kworker:3 from being selected by the scheduler. This eventually triggers a softlockup detection on cpu3 due to watchdog_timer_fn operating with inconsistent variable - using both the old interval and the updated watchdog_thresh simultaneously.
--- kernel/watchdog.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-)
kernel/watchdog.c +27 -14
@@ -47,6 +47,7 @@ int __read_mostly watchdog_user_enabledstatic int __read_mostly watchdog_hardlockup_user_enabled =WATCHDOG_HARDLOCKUP_DEFAULT ;static int __read_mostly watchdog_softlockup_user_enabled =1 ;int __read_mostly watchdog_thresh =10 ; +static int __read_mostly watchdog_thresh_next;static int __read_mostly watchdog_hardlockup_available;struct cpumask watchdog_cpumask__read_mostly ;
@@ -870,12 +871,20 @@ int lockup_detector_offline_cpu(unsignedreturn 0 ; } -static void __lockup_detector_reconfigure (void ) +static void __lockup_detector_reconfigure (bool thresh_changed) {cpus_read_lock ();watchdog_hardlockup_stop ();softlockup_stop_all (); +/* +* To prevent watchdog_timer_fn from using the old interval and +* the new watchdog_thresh at the same time, which could lead to +* false softlockup reports, it is necessary to update the +* watchdog_thresh after the softlockup is completed. +*/ +if (thresh_changed) + watchdog_thresh =READ_ONCE (watchdog_thresh_next);set_sample_period ();lockup_detector_update_enable ();if (watchdog_enabled && watchdog_thresh)
@@ -888,7 +897,7 @@ static void __lockup_detector_reconfigurvoid lockup_detector_reconfigure (void ) {mutex_lock (&watchdog_mutex); -__lockup_detector_reconfigure (); +__lockup_detector_reconfigure (false);mutex_unlock (&watchdog_mutex); }
@@ -908,27 +917,29 @@ static __init void lockup_detector_setupreturn ;mutex_lock (&watchdog_mutex); -__lockup_detector_reconfigure (); +__lockup_detector_reconfigure (false); softlockup_initialized = true; mutex_unlock(&watchdog_mutex); }#else /* CONFIG_SOFTLOCKUP_DETECTOR */ -static void __lockup_detector_reconfigure (void ) +static void __lockup_detector_reconfigure (bool thresh_changed) {cpus_read_lock ();watchdog_hardlockup_stop (); +if (thresh_changed) + watchdog_thresh =READ_ONCE (watchdog_thresh_next);lockup_detector_update_enable ();watchdog_hardlockup_start ();cpus_read_unlock (); }void lockup_detector_reconfigure (void ) { -__lockup_detector_reconfigure (); +__lockup_detector_reconfigure (false); }static inline void lockup_detector_setup (void ) { -__lockup_detector_reconfigure (); +__lockup_detector_reconfigure (false); }#endif /* !CONFIG_SOFTLOCKUP_DETECTOR */
@@ -946,11 +957,11 @@ void lockup_detector_soft_poweroff(void)#ifdef CONFIG_SYSCTL /* Propagate any changes to the watchdog infrastructure */ -static void proc_watchdog_update (void ) +static void proc_watchdog_update (bool thresh_changed) {/* Remove impossible cpus to keep sysctl output clean. */ cpumask_and (&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); -__lockup_detector_reconfigure (); +__lockup_detector_reconfigure (thresh_changed); }/*
@@ -984,7 +995,7 @@ static int proc_watchdog_common(int whic }else { err =proc_dointvec_minmax (table, write, buffer, lenp, ppos);if (!err && old !=READ_ONCE (*param)) -proc_watchdog_update (); +proc_watchdog_update (false); }mutex_unlock (&watchdog_mutex);return err;
@@ -1035,11 +1046,13 @@ static int proc_watchdog_thresh(const stmutex_lock (&watchdog_mutex); - old =READ_ONCE (watchdog_thresh); + watchdog_thresh_next =READ_ONCE (watchdog_thresh); + + old = watchdog_thresh_next; err =proc_dointvec_minmax (table, write, buffer, lenp, ppos); -if (!err && write && old !=READ_ONCE (watchdog_thresh)) -proc_watchdog_update (); +if (!err && write && old !=READ_ONCE (watchdog_thresh_next)) +proc_watchdog_update (true);mutex_unlock (&watchdog_mutex);return err;
@@ -1060,7 +1073,7 @@ static int proc_watchdog_cpumask(const s err =proc_do_large_bitmap (table, write, buffer, lenp, ppos);if (!err && write) -proc_watchdog_update (); +proc_watchdog_update (false);mutex_unlock (&watchdog_mutex);return err;
@@ -1080,7 +1093,7 @@ static const struct ctl_table watchdog_s }, { .procname = "watchdog_thresh", - .data = &watchdog_thresh, + .data = &watchdog_thresh_next, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_watchdog_thresh,
Greg Kroah-Hartman
maintainerPATCH 140/592 RDMA/iwcm: Fix use-after-free of work objects after cm_id destruction
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shin'ichiro Kawasaki <[email protected]>
commit 6883b680e703c6b2efddb4e7a8d891ce1803d06b upstream.
The commit 59c68ac31e15 ("iw_cm: free cm_id resources on the last deref") simplified cm_id resource management by freeing cm_id once all references to the cm_id were removed. The references are removed either upon completion of iw_cm event handlers or when the application destroys the cm_id. This commit introduced the use-after-free condition where cm_id_private object could still be in use by event handler works during the destruction of cm_id. The commit aee2424246f9 ("RDMA/iwcm: Fix a use-after-free related to destroying CM IDs") addressed this use-after- free by flushing all pending works at the cm_id destruction.
However, still another use-after-free possibility remained. It happens with the work objects allocated for each cm_id_priv within alloc_work_entries() during cm_id creation, and subsequently freed in dealloc_work_entries() once all references to the cm_id are removed. If the cm_id's last reference is decremented in the event handler work, the work object for the work itself gets removed, and causes the use- after-free BUG below:
BUG: KASAN: slab-use-after-free in __pwq_activate_work+0x1ff/0x250 Read of size 8 at addr ffff88811f9cf800 by task kworker/u16:1/147091 CPU: 2 UID: 0 PID: 147091 Comm: kworker/u16:1 Not tainted 6.15.0-rc2+ #27 PREEMPT(voluntary) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014 Workqueue: 0x0 (iw_cm_wq) Call Trace: <TASK> dump_stack_lvl+0x6a/0x90 print_report+0x174/0x554 ? __virt_addr_valid+0x208/0x430 ? __pwq_activate_work+0x1ff/0x250 kasan_report+0xae/0x170 ? __pwq_activate_work+0x1ff/0x250 __pwq_activate_work+0x1ff/0x250 pwq_dec_nr_in_flight+0x8c5/0xfb0 process_one_work+0xc11/0x1460 ? __pfx_process_one_work+0x10/0x10 ? assign_work+0x16c/0x240 worker_thread+0x5ef/0xfd0 ? __pfx_worker_thread+0x10/0x10 kthread+0x3b0/0x770 ? __pfx_kthread+0x10/0x10 ? rcu_is_watching+0x11/0xb0 ? _raw_spin_unlock_irq+0x24/0x50 ? rcu_is_watching+0x11/0xb0 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x30/0x70 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> Allocated by task 147416: kasan_save_stack+0x2c/0x50 kasan_save_track+0x10/0x30 __kasan_kmalloc+0xa6/0xb0 alloc_work_entries+0xa9/0x260 [iw_cm] iw_cm_connect+0x23/0x4a0 [iw_cm] rdma_connect_locked+0xbfd/0x1920 [rdma_cm] nvme_rdma_cm_handler+0x8e5/0x1b60 [nvme_rdma] cma_cm_event_handler+0xae/0x320 [rdma_cm] cma_work_handler+0x106/0x1b0 [rdma_cm] process_one_work+0x84f/0x1460 worker_thread+0x5ef/0xfd0 kthread+0x3b0/0x770 ret_from_fork+0x30/0x70 ret_from_fork_asm+0x1a/0x30 Freed by task 147091: kasan_save_stack+0x2c/0x50 kasan_save_track+0x10/0x30 kasan_save_free_info+0x37/0x60 __kasan_slab_free+0x4b/0x70 kfree+0x13a/0x4b0 dealloc_work_entries+0x125/0x1f0 [iw_cm] iwcm_deref_id+0x6f/0xa0 [iw_cm] cm_work_handler+0x136/0x1ba0 [iw_cm] process_one_work+0x84f/0x1460 worker_thread+0x5ef/0xfd0 kthread+0x3b0/0x770 ret_from_fork+0x30/0x70 ret_from_fork_asm+0x1a/0x30 Last potentially related work creation: kasan_save_stack+0x2c/0x50 kasan_record_aux_stack+0xa3/0xb0 __queue_work+0x2ff/0x1390 queue_work_on+0x67/0xc0 cm_event_handler+0x46a/0x820 [iw_cm] siw_cm_upcall+0x330/0x650 [siw] siw_cm_work_handler+0x6b9/0x2b20 [siw] process_one_work+0x84f/0x1460 worker_thread+0x5ef/0xfd0 kthread+0x3b0/0x770 ret_from_fork+0x30/0x70 ret_from_fork_asm+0x1a/0x30
This BUG is reproducible by repeating the blktests test case nvme/061 for the rdma transport and the siw driver.
To avoid the use-after-free of cm_id_private work objects, ensure that the last reference to the cm_id is decremented not in the event handler works, but in the cm_id destruction context. For that purpose, move iwcm_deref_id() call from destroy_cm_id() to the callers of destroy_cm_id(). In iw_destroy_cm_id(), call iwcm_deref_id() after flushing the pending works.
During the fix work, I noticed that iw_destroy_cm_id() is called from cm_work_handler() and process_event() context. However, the comment of iw_destroy_cm_id() notes that the function "cannot be called by the event thread". Drop the false comment.
--- drivers/infiniband/core/iwcm.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/infiniband/core/iwcm.c +15 -14
@@ -368,12 +368,9 @@ EXPORT_SYMBOL(iw_cm_disconnect);/* * CM_ID <-- DESTROYING * -* Clean up all resources associated with the connection and release -* the initial reference taken by iw_create_cm_id. -* -* Returns true if and only if the last cm_id_priv reference has been dropped. +* Clean up all resources associated with the connection. */ -static bool destroy_cm_id (struct iw_cm_id *cm_id) +static void destroy_cm_id (struct iw_cm_id *cm_id) {struct iwcm_id_private *cm_id_priv;struct ib_qp *qp;
@@ -442,20 +439,22 @@ static bool destroy_cm_id(struct iw_cm_iiwpm_remove_mapinfo (&cm_id->local_addr, &cm_id->m_local_addr);iwpm_remove_mapping (&cm_id->local_addr,RDMA_NL_IWCM ); } - -return iwcm_deref_id (cm_id_priv); }/* -* This function is only called by the application thread and cannot -* be called by the event thread. The function will wait for all -* references to be released on the cm_id and then kfree the cm_id -* object. +* Destroy cm_id. If the cm_id still has other references, wait for all +* references to be released on the cm_id and then release the initial +* reference taken by iw_create_cm_id. */ void iw_destroy_cm_id (struct iw_cm_id *cm_id) { -if (!destroy_cm_id (cm_id)) +struct iwcm_id_private *cm_id_priv; + + cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); +destroy_cm_id (cm_id); +if (refcount_read (&cm_id_priv->refcount) >1 )flush_workqueue (iwcm_wq); +iwcm_deref_id (cm_id_priv); }EXPORT_SYMBOL (iw_destroy_cm_id);
@@ -1035,8 +1034,10 @@ static void cm_work_handler(struct work_if (!test_bit (IWCM_F_DROP_EVENTS , &cm_id_priv->flags)) { ret =process_event (cm_id_priv, &levent); -if (ret) -WARN_ON_ONCE (destroy_cm_id (&cm_id_priv->id)); +if (ret) { +destroy_cm_id (&cm_id_priv->id); +WARN_ON_ONCE (iwcm_deref_id (cm_id_priv)); + } }else pr_debug ("dropping event %d\n" , levent.event);if (iwcm_deref_id (cm_id_priv))
Greg Kroah-Hartman
maintainerPATCH 141/592 mm: fix ratelimit_pages update error in dirty_ratio_handler()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinliang Zheng <[email protected]>
commit f83f362d40ccceb647f7d80eb92206733d76a36b upstream.
In dirty_ratio_handler(), vm_dirty_bytes must be set to zero before calling writeback_set_ratelimit(), as global_dirty_limits() always prioritizes the value of vm_dirty_bytes.
It's domain_dirty_limits() that's relevant here, not node_dirty_ok:
dirty_ratio_handler
writeback_set_ratelimit
global_dirty_limits(&dirty_thresh) <- ratelimit_pages based on dirty_thresh
domain_dirty_limits
if (bytes) <- bytes = vm_dirty_bytes <--------+
thresh = f1(bytes) <- prioritizes vm_dirty_bytes |
else |
thresh = f2(ratio) |
ratelimit_pages = f3(dirty_thresh) |
vm_dirty_bytes = 0 <- it's late! ---------------------+
This causes ratelimit_pages to still use the value calculated based on vm_dirty_bytes, which is wrong now.
The impact visible to userspace is difficult to capture directly because there is no procfs/sysfs interface exported to user space. However, it will have a real impact on the balance of dirty pages.
For example:
1. On default, we have vm_dirty_ratio=40, vm_dirty_bytes=0
2. echo 8192 > dirty_bytes, then vm_dirty_bytes=8192, vm_dirty_ratio=0, and ratelimit_pages is calculated based on vm_dirty_bytes now.
3. echo 20 > dirty_ratio, then since vm_dirty_bytes is not reset to zero when writeback_set_ratelimit() -> global_dirty_limits() -> domain_dirty_limits() is called, reallimit_pages is still calculated based on vm_dirty_bytes instead of vm_dirty_ratio. This does not conform to the actual intent of the user.
--- mm/page-writeback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page-writeback.c +1 -1
@@ -520,8 +520,8 @@ static int dirty_ratio_handler(const str ret =proc_dointvec_minmax (table, write, buffer, lenp, ppos);if (ret ==0 && write && vm_dirty_ratio != old_ratio) { -writeback_set_ratelimit (); vm_dirty_bytes =0 ; +writeback_set_ratelimit (); }return ret; }
Greg Kroah-Hartman
maintainerPATCH 142/592 soc: qcom: pmic_glink_altmode: fix spurious DP hotplug events
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 5090ac9191a19c61beeade60d3d839e509fab640 upstream.
The PMIC GLINK driver is currently generating DisplayPort hotplug notifications whenever something is connected to (or disconnected from) a port regardless of the type of notification sent by the firmware.
These notifications are forwarded to user space by the DRM subsystem as connector "change" uevents:
KERNEL[1556.223776] change /devices/platform/soc@0/ae00000.display-subsystem/ae01000.display-controller/drm/card0 (drm)
ACTION=change
DEVPATH=/devices/platform/soc@0/ae00000.display-subsystem/ae01000.display-controller/drm/card0
SUBSYSTEM=drm
HOTPLUG=1
CONNECTOR=36
DEVNAME=/dev/dri/card0
DEVTYPE=drm_minor
SEQNUM=4176
MAJOR=226
MINOR=0On the Lenovo ThinkPad X13s and T14s, the PMIC GLINK firmware sends two identical notifications with orientation information when connecting a charger, each generating a bogus DRM hotplug event. On the X13s, two such notification are also sent every 90 seconds while a charger remains connected, which again are forwarded to user space:
port = 1, svid = ff00, mode = 255, hpd_state = 0
payload = 01 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00Note that the firmware only sends on of these when connecting an ethernet adapter.
Fix the spurious hotplug events by only forwarding hotplug notifications for the Type-C DisplayPort service id. This also reduces the number of uevents from four to two when an actual DisplayPort altmode device is connected:
port = 0, svid = ff01, mode = 2, hpd_state = 0
payload = 00 01 02 00 f2 0c 01 ff 03 00 00 00 00 00 00 00
port = 0, svid = ff01, mode = 2, hpd_state = 1
payload = 00 01 02 00 f2 0c 01 ff 43 00 00 00 00 00 00 00--- drivers/soc/qcom/pmic_glink_altmode.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/soc/qcom/pmic_glink_altmode.c +19 -11
@@ -218,21 +218,29 @@ static void pmic_glink_altmode_worker(st {struct pmic_glink_altmode_port *alt_port =work_to_altmode_port (work);struct pmic_glink_altmode *altmode = alt_port->altmode; +enum drm_connector_status conn_status;typec_switch_set (alt_port->typec_switch, alt_port->orientation); -if (alt_port->svid ==USB_TYPEC_DP_SID && alt_port->mode ==0xff ) -pmic_glink_altmode_safe (altmode, alt_port); -else if (alt_port->svid ==USB_TYPEC_DP_SID ) -pmic_glink_altmode_enable_dp (altmode, alt_port, alt_port->mode, - alt_port->hpd_state, alt_port->hpd_irq); -else -pmic_glink_altmode_enable_usb (altmode, alt_port); +if (alt_port->svid ==USB_TYPEC_DP_SID ) { +if (alt_port->mode ==0xff ) { +pmic_glink_altmode_safe (altmode, alt_port); + }else { +pmic_glink_altmode_enable_dp (altmode, alt_port, + alt_port->mode, + alt_port->hpd_state, + alt_port->hpd_irq); + } + +if (alt_port->hpd_state) + conn_status = connector_status_connected; +else + conn_status = connector_status_disconnected; -drm_aux_hpd_bridge_notify (&alt_port->bridge->dev, - alt_port->hpd_state ? - connector_status_connected : - connector_status_disconnected); +drm_aux_hpd_bridge_notify (&alt_port->bridge->dev, conn_status); + }else { +pmic_glink_altmode_enable_usb (altmode, alt_port); + }pmic_glink_altmode_request (altmode,ALTMODE_PAN_ACK , alt_port->index); }
Greg Kroah-Hartman
maintainerPATCH 143/592 configfs-tsm-report: Fix NULL dereference of tsm_ops
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit fba4ceaa242d2bdf4c04b77bda41d32d02d3925d upstream.
Unlike sysfs, the lifetime of configfs objects is controlled by userspace. There is no mechanism for the kernel to find and delete all created config-items. Instead, the configfs-tsm-report mechanism has an expectation that tsm_unregister() can happen at any time and cause established config-item access to start failing.
That expectation is not fully satisfied. While tsm_report_read(), tsm_report_{is,is_bin}_visible(), and tsm_report_make_item() safely fail if tsm_ops have been unregistered, tsm_report_privlevel_store() tsm_report_provider_show() fail to check for ops registration. Add the missing checks for tsm_ops having been removed.
Now, in supporting the ability for tsm_unregister() to always succeed, it leaves the problem of what to do with lingering config-items. The expectation is that the admin that arranges for the ->remove() (unbind) of the ${tsm_arch}-guest driver is also responsible for deletion of all open config-items. Until that deletion happens, ->probe() (reload / bind) of the ${tsm_arch}-guest driver fails.
This allows for emergency shutdown / revocation of attestation interfaces, and requires coordinated restart.
--- drivers/virt/coco/tsm.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
drivers/virt/coco/tsm.c +29 -2
@@ -15,6 +15,7 @@static struct tsm_provider {const struct tsm_ops *ops;void *data; +atomic_t count; } provider;static DECLARE_RWSEM (tsm_rwsem);
@@ -92,6 +93,10 @@ static ssize_t tsm_report_privlevel_storif (rc)return rc; +guard (rwsem_write)(&tsm_rwsem); +if (!provider.ops) +return -ENXIO ; +/* * The valid privilege levels that a TSM might accept, if it accepts a * privilege level setting at all, are a max of TSM_PRIVLEVEL_MAX (see
@@ -101,7 +106,6 @@ static ssize_t tsm_report_privlevel_storif (provider.ops->privlevel_floor > val || val >TSM_PRIVLEVEL_MAX )return -EINVAL ; -guard (rwsem_write)(&tsm_rwsem); rc =try_advance_write_generation (report);if (rc)return rc;
@@ -115,6 +119,10 @@ static ssize_t tsm_report_privlevel_floo char *buf) {guard (rwsem_read)(&tsm_rwsem); + +if (!provider.ops) +return -ENXIO ; +return sysfs_emit (buf,"%u\n" , provider.ops->privlevel_floor); }CONFIGFS_ATTR_RO (tsm_report_, privlevel_floor);
@@ -217,6 +225,9 @@ CONFIGFS_ATTR_RO(tsm_report_, generationstatic ssize_t tsm_report_provider_show (struct config_item *cfg,char *buf) {guard (rwsem_read)(&tsm_rwsem); +if (!provider.ops) +return -ENXIO ; +return sysfs_emit (buf,"%s\n" , provider.ops->name); }CONFIGFS_ATTR_RO (tsm_report_, provider);
@@ -284,7 +295,7 @@ static ssize_t tsm_report_read(struct tsguard (rwsem_write)(&tsm_rwsem); ops = provider.ops;if (!ops) -return -ENOTTY ; +return -ENXIO ;if (!report->desc.inblob_len)return -EINVAL ;
@@ -421,12 +432,20 @@ static struct config_item *tsm_report_maif (!state)return ERR_PTR (-ENOMEM ); +atomic_inc (&provider.count);config_item_init_type_name (&state->cfg, name, &tsm_report_type);return &state->cfg; } +static void tsm_report_drop_item (struct config_group *group,struct config_item *item) +{ +config_item_put (item); +atomic_dec (&provider.count); +} +static struct configfs_group_operations tsm_report_group_ops = { .make_item = tsm_report_make_item, + .drop_item = tsm_report_drop_item, };static const struct config_item_type tsm_reports_type = {
@@ -459,6 +478,11 @@ int tsm_register(const struct tsm_ops *oreturn -EBUSY ; } +if (atomic_read (&provider.count)) { +pr_err ("configfs/tsm/report not empty\n" ); +return -EBUSY ; + } + provider.ops = ops; provider.data = priv;return 0 ;
@@ -470,6 +494,9 @@ int tsm_unregister(const struct tsm_opsguard (rwsem_write)(&tsm_rwsem);if (ops != provider.ops)return -EBUSY ; +if (atomic_read (&provider.count)) +pr_warn ("\"%s\" unregistered with items present in configfs/tsm/report\n" , + provider.ops->name); provider.ops =NULL ; provider.data =NULL ;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 144/592 firmware: ti_sci: Convert CPU latency constraint from us to ms
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kendall Willis <[email protected]>
commit 9b808f7f395ae375a26e32046b680cf898dacc21 upstream.
Fix CPU resume latency constraint units sent to device manager through the TI SCI API. The device manager expects CPU resume latency to be in msecs which is passed in with the TI SCI API [1]. CPU latency constraints are set in userspace using the PM QoS framework which uses usecs as the unit. Since PM QoS uses usecs for units and the device manager expects msecs as the unit, TI SCI needs to convert from usecs to msecs before passing to device manager.
--- drivers/firmware/ti_sci.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/firmware/ti_sci.c +11 -3
@@ -2,7 +2,7 @@/* * Texas Instruments System Control Interface Protocol Driver * -* Copyright (C) 2015-2024 Texas Instruments Incorporated - https://www.ti.com/ +* Copyright (C) 2015-2025 Texas Instruments Incorporated - https://www.ti.com/ * Nishanth Menon */
@@ -3670,6 +3670,7 @@ static int __maybe_unused ti_sci_suspendstruct ti_sci_info *info =dev_get_drvdata (dev);struct device *cpu_dev, *cpu_dev_max =NULL ;s32 val, cpu_lat =0 ; +u16 cpu_lat_ms;int i, ret;if (info->fw_caps &MSG_FLAG_CAPS_LPM_DM_MANAGED ) {
@@ -3682,9 +3683,16 @@ static int __maybe_unused ti_sci_suspend } }if (cpu_dev_max) { -dev_dbg (cpu_dev_max,"%s: sending max CPU latency=%u\n" , __func__, cpu_lat); +/* +* PM QoS latency unit is usecs, device manager uses msecs. +* Convert to msecs and round down for device manager. +*/ + cpu_lat_ms = cpu_lat /USEC_PER_MSEC ; +dev_dbg (cpu_dev_max,"%s: sending max CPU latency=%u ms\n" , __func__, + cpu_lat_ms); ret =ti_sci_cmd_set_latency_constraint (&info->handle, - cpu_lat,TISCI_MSG_CONSTRAINT_SET ); + cpu_lat_ms, +TISCI_MSG_CONSTRAINT_SET );if (ret)return ret; }
Greg Kroah-Hartman
maintainerPATCH 145/592 firmware: arm_scmi: Ensure that the message-id supports fastchannel
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sibi Sankar <[email protected]>
commit 94a263f981a3fa3d93f65c31e0fed0756736be43 upstream.
Currently the perf and powercap protocol relies on the protocol domain attributes, which just ensures that one fastchannel per domain, before instantiating fastchannels for all possible message-ids. Fix this by ensuring that each message-id supports fastchannel before initialization.
Logs:
| scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:0] - ret:-95. Using regular messaging | scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:1] - ret:-95. Using regular messaging | scmi: Failed to get FC for protocol 13 [MSG_ID:6 / RES_ID:2] - ret:-95. Using regular messaging
Message-Id: <[email protected]>
--- drivers/firmware/arm_scmi/driver.c | 76 +++++++++++++++++++--------------- drivers/firmware/arm_scmi/protocols.h | 2 2 files changed, 45 insertions(+), 33 deletions(-)
drivers/firmware/arm_scmi/driver.c +43 -33
@@ -1738,6 +1738,39 @@ static int scmi_common_get_max_msg_size( }/** +* scmi_protocol_msg_check - Check protocol message attributes +* +* @ph: A reference to the protocol handle. +* @message_id: The ID of the message to check. +* @attributes: A parameter to optionally return the retrieved message +* attributes, in case of Success. +* +* An helper to check protocol message attributes for a specific protocol +* and message pair. +* +* Return: 0 on SUCCESS +*/ +static int scmi_protocol_msg_check (const struct scmi_protocol_handle *ph, +u32 message_id,u32 *attributes) +{ +int ret; +struct scmi_xfer *t; + + ret =xfer_get_init (ph,PROTOCOL_MESSAGE_ATTRIBUTES , +sizeof (__le32),0 , &t); +if (ret) +return ret; + +put_unaligned_le32 (message_id, t->tx.buf); + ret =do_xfer (ph, t); +if (!ret && attributes) + *attributes =get_unaligned_le32 (t->rx.buf); +xfer_put (ph, t); + +return ret; +} + +/** * struct scmi_iterator - Iterator descriptor * @msg: A reference to the message TX buffer; filled by @prepare_message with * a proper custom command payload for each multi-part command request.
@@ -1878,6 +1911,7 @@ scmi_common_fastchannel_init(const strucint ret;u32 flags;u64 phys_addr; +u32 attributes;u8 size;void __iomem *addr;struct scmi_xfer *t;
@@ -1886,6 +1920,15 @@ scmi_common_fastchannel_init(const strucstruct scmi_msg_resp_desc_fc *resp;const struct scmi_protocol_instance *pi =ph_to_pi (ph); +/* Check if the MSG_ID supports fastchannel */ + ret =scmi_protocol_msg_check (ph, message_id, &attributes); +if (ret || !MSG_SUPPORTS_FASTCHANNEL (attributes)) { +dev_dbg (ph->dev, +"Skip FC init for 0x%02X/%d domain:%d - ret:%d\n" , + pi->proto->id, message_id, domain, ret); +return ; + } +if (!p_addr) { ret = -EINVAL ; goto err_out;
@@ -2003,39 +2046,6 @@ static void scmi_common_fastchannel_db_rSCMI_PROTO_FC_RING_DB (64 ); } -/** -* scmi_protocol_msg_check - Check protocol message attributes -* -* @ph: A reference to the protocol handle. -* @message_id: The ID of the message to check. -* @attributes: A parameter to optionally return the retrieved message -* attributes, in case of Success. -* -* An helper to check protocol message attributes for a specific protocol -* and message pair. -* -* Return: 0 on SUCCESS -*/ -static int scmi_protocol_msg_check (const struct scmi_protocol_handle *ph, -u32 message_id,u32 *attributes) -{ -int ret; -struct scmi_xfer *t; - - ret =xfer_get_init (ph,PROTOCOL_MESSAGE_ATTRIBUTES , -sizeof (__le32),0 , &t); -if (ret) -return ret; - -put_unaligned_le32 (message_id, t->tx.buf); - ret =do_xfer (ph, t); -if (!ret && attributes) - *attributes =get_unaligned_le32 (t->rx.buf); -xfer_put (ph, t); - -return ret; -} -static const struct scmi_proto_helpers_ops helpers_ops = { .extended_name_get = scmi_common_extended_name_get, .get_max_msg_size = scmi_common_get_max_msg_size,
drivers/firmware/arm_scmi/protocols.h +2 -0
@@ -31,6 +31,8 @@#define SCMI_PROTOCOL_VENDOR_BASE 0x80 +#define MSG_SUPPORTS_FASTCHANNEL (x) ((x) & BIT(0)) +enum scmi_common_cmd {PROTOCOL_VERSION =0x0 ,PROTOCOL_ATTRIBUTES =0x1 ,
Greg Kroah-Hartman
maintainerPATCH 146/592 iommu: Allow attaching static domains in iommu_attach_device_pasid()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 6f7340120a0aa8b2eb29c826a4434e8b5c4e11d3 upstream.
The idxd driver attaches the default domain to a PASID of the device to perform kernel DMA using that PASID. The domain is attached to the device's PASID through iommu_attach_device_pasid(), which checks if the domain->owner matches the iommu_ops retrieved from the device. If they do not match, it returns a failure.
if (ops != domain->owner || pasid == IOMMU_NO_PASID)
return -EINVAL;The static identity domain implemented by the intel iommu driver doesn't specify the domain owner. Therefore, kernel DMA with PASID doesn't work for the idxd driver if the device translation mode is set to passthrough.
Generally the owner field of static domains are not set because they are already part of iommu ops. Add a helper domain_iommu_ops_compatible() that checks if a domain is compatible with the device's iommu ops. This helper explicitly allows the static blocked and identity domains associated with the device's iommu_ops to be considered compatible.
--- drivers/iommu/iommu.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/iommu/iommu.c +18 -3
@@ -2208,6 +2208,19 @@ static void *iommu_make_pasid_array_entrreturn xa_tag_pointer (domain,IOMMU_PASID_ARRAY_DOMAIN ); } +static bool domain_iommu_ops_compatible (const struct iommu_ops *ops, +struct iommu_domain *domain) +{ +if (domain->owner == ops) +return true; + +/* For static domains, owner isn't set. */ +if (domain == ops->blocked_domain || domain == ops->identity_domain) +return true; + +return false; +} +static int __iommu_attach_group (struct iommu_domain *domain,struct iommu_group *group) {
@@ -2218,7 +2231,8 @@ static int __iommu_attach_group(struct ireturn -EBUSY ; dev =iommu_group_first_dev (group); -if (!dev_has_iommu (dev) ||dev_iommu_ops (dev) != domain->owner) +if (!dev_has_iommu (dev) || + !domain_iommu_ops_compatible (dev_iommu_ops (dev), domain))return -EINVAL ;return __iommu_group_set_domain (group, domain);
@@ -3456,7 +3470,8 @@ int iommu_attach_device_pasid(struct iom !ops->blocked_domain->ops->set_dev_pasid)return -EOPNOTSUPP ; -if (ops != domain->owner || pasid ==IOMMU_NO_PASID ) +if (!domain_iommu_ops_compatible (ops, domain) || + pasid ==IOMMU_NO_PASID )return -EINVAL ;mutex_lock (&group->mutex);
@@ -3538,7 +3553,7 @@ int iommu_replace_device_pasid(struct ioif (!domain->ops->set_dev_pasid)return -EOPNOTSUPP ; -if (dev_iommu_ops (dev) != domain->owner || +if (!domain_iommu_ops_compatible (dev_iommu_ops (dev), domain) || pasid ==IOMMU_NO_PASID || !handle)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 147/592 mtd: rawnand: sunxi: Add randomizer configuration in sunxi_nfc_hw_ecc_write_chunk
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit 44ed1f5ff73e9e115b6f5411744d5a22ea1c855b upstream.
The function sunxi_nfc_hw_ecc_write_chunk() calls the sunxi_nfc_hw_ecc_write_chunk(), but does not call the configuration function sunxi_nfc_randomizer_config(). Consequently, the randomization might not conduct correctly, which will affect the lifespan of NAND flash. A proper implementation can be found in sunxi_nfc_hw_ecc_write_page_dma().
Add the sunxi_nfc_randomizer_config() to config randomizer.
--- drivers/mtd/nand/raw/sunxi_nand.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/sunxi_nand.c +1 -0
@@ -1049,6 +1049,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(if (ret)return ret; +sunxi_nfc_randomizer_config (nand, page, false);sunxi_nfc_randomizer_enable (nand);sunxi_nfc_hw_ecc_set_prot_oob_bytes (nand, oob,0 , bbm, page);
Greg Kroah-Hartman
maintainerPATCH 148/592 mtd: nand: sunxi: Add randomizer configuration before randomizer enable
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit 4a5a99bc79cdc4be63933653682b0261a67a0c9f upstream.
In sunxi_nfc_hw_ecc_read_chunk(), the sunxi_nfc_randomizer_enable() is called without the config of randomizer. A proper implementation can be found in sunxi_nfc_hw_ecc_read_chunks_dma().
Add sunxi_nfc_randomizer_config() before the start of randomization.
--- drivers/mtd/nand/raw/sunxi_nand.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/sunxi_nand.c +1 -0
@@ -817,6 +817,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(sif (ret)return ret; +sunxi_nfc_randomizer_config (nand, page, false);sunxi_nfc_randomizer_enable (nand);writel (NFC_DATA_TRANS |NFC_DATA_SWAP_METHOD |NFC_ECC_OP , nfc->regs +NFC_REG_CMD );
Greg Kroah-Hartman
maintainerPATCH 149/592 KVM: SVM: Clear current_vmcb during vCPU free for all *possible* CPUs
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit 1bee4838eb3a2c689f23c7170ea66ae87ea7d93a upstream.
When freeing a vCPU and thus its VMCB, clear current_vmcb for all possible CPUs, not just online CPUs, as it's theoretically possible a CPU could go offline and come back online in conjunction with KVM reusing the page for a new VMCB.
--- arch/x86/kvm/svm/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/svm.c +1 -1
@@ -1488,7 +1488,7 @@ static void svm_clear_current_vmcb(struc {int i; -for_each_online_cpu (i) +for_each_possible_cpu (i)cmpxchg (per_cpu_ptr (&svm_data.current_vmcb, i), vmcb,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 150/592 KVM: VMX: Flush shadow VMCS on emergency reboot
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Gao <[email protected]>
commit a0ee1d5faff135e28810f29e0f06328c66f89852 upstream.
Ensure the shadow VMCS cache is evicted during an emergency reboot to prevent potential memory corruption if the cache is evicted after reboot.
This issue was identified through code inspection, as __loaded_vmcs_clear() flushes both the normal VMCS and the shadow VMCS.
Avoid checking the "launched" state during an emergency reboot, unlike the behavior in __loaded_vmcs_clear(). This is important because reboot NMIs can interfere with operations like copy_shadow_to_vmcs12(), where shadow VMCSes are loaded directly using VMPTRLD. In such cases, if NMIs occur right after the VMCS load, the shadow VMCSes will be active but the "launched" state may not be set.
--- arch/x86/kvm/vmx/vmx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kvm/vmx/vmx.c +4 -1
@@ -769,8 +769,11 @@ void vmx_emergency_disable_virtualizatioreturn ;list_for_each_entry (v, &per_cpu (loaded_vmcss_on_cpu, cpu), - loaded_vmcss_on_cpu_link) + loaded_vmcss_on_cpu_link) {vmcs_clear (v->vmcs); +if (v->shadow_vmcs) +vmcs_clear (v->shadow_vmcs); + }kvm_cpu_vmxoff (); }
Greg Kroah-Hartman
maintainerPATCH 151/592 dm-mirror: fix a tiny race condition
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 829451beaed6165eb11d7a9fb4e28eb17f489980 upstream.
There's a tiny race condition in dm-mirror. The functions queue_bio and write_callback grab a spinlock, add a bio to the list, drop the spinlock and wake up the mirrord thread that processes bios in the list.
It may be possible that the mirrord thread processes the bio just after spin_unlock_irqrestore is called, before wakeup_mirrord. This spurious wake-up is normally harmless, however if the device mapper device is unloaded just after the bio was processed, it may be possible that wakeup_mirrord(ms) uses invalid "ms" pointer.
Fix this bug by moving wakeup_mirrord inside the spinlock.
--- drivers/md/dm-raid1.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/md/dm-raid1.c +2 -3
@@ -133,10 +133,9 @@ static void queue_bio(struct mirror_setspin_lock_irqsave (&ms->lock, flags); should_wake = !(bl->head);bio_list_add (bl, bio); -spin_unlock_irqrestore (&ms->lock, flags); -if (should_wake)wakeup_mirrord (ms); +spin_unlock_irqrestore (&ms->lock, flags); }static void dispatch_bios (void *context,struct bio_list *bio_list)
@@ -646,9 +645,9 @@ static void write_callback(unsigned longif (!ms->failures.head) should_wake =1 ;bio_list_add (&ms->failures, bio); -spin_unlock_irqrestore (&ms->lock, flags);if (should_wake)wakeup_mirrord (ms); +spin_unlock_irqrestore (&ms->lock, flags); }static void do_write (struct mirror_set *ms,struct bio *bio)
Greg Kroah-Hartman
maintainerPATCH 152/592 dm-verity: fix a memory leak if some arguments are specified multiple times
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 66be40a14e496689e1f0add50118408e22c96169 upstream.
If some of the arguments "check_at_most_once", "ignore_zero_blocks", "use_fec_from_device", "root_hash_sig_key_desc" were specified more than once on the target line, a memory leak would happen.
This commit fixes the memory leak. It also fixes error handling in verity_verify_sig_parse_opt_args.
--- drivers/md/dm-verity-fec.c | 4 ++++ drivers/md/dm-verity-target.c | 8 +++++++- drivers/md/dm-verity-verify-sig.c | 17 +++++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-)
drivers/md/dm-verity-fec.c +4 -0
@@ -593,6 +593,10 @@ int verity_fec_parse_opt_args(struct dm_ (*argc)--;if (!strcasecmp (arg_name,DM_VERITY_OPT_FEC_DEV )) { +if (v->fec->dev) { + ti->error ="FEC device already specified" ; +return -EINVAL ; + } r =dm_get_device (ti, arg_value,BLK_OPEN_READ , &v->fec->dev);if (r) { ti->error ="FEC device lookup failed" ;
drivers/md/dm-verity-target.c +7 -1
@@ -1120,6 +1120,9 @@ static int verity_alloc_most_once(struct {struct dm_target *ti = v->ti; +if (v->validated_blocks) +return 0 ; +/* the bitset can only handle INT_MAX blocks */ if (v->data_blocks >INT_MAX ) { ti->error ="device too large to use check_at_most_once" ;
@@ -1143,6 +1146,9 @@ static int verity_alloc_zero_digest(strustruct dm_verity_io *io;u8 *zero_data; +if (v->zero_digest) +return 0 ; + v->zero_digest =kmalloc (v->digest_size,GFP_KERNEL );if (!v->zero_digest)
@@ -1577,7 +1583,7 @@ static int verity_ctr(struct dm_target * goto bad; } -/* Root hash signature is a optional parameter*/ +/* Root hash signature is an optional parameter */ r = verity_verify_root_hash(root_hash_digest_to_validate, strlen(root_hash_digest_to_validate), verify_args.sig,
drivers/md/dm-verity-verify-sig.c +13 -4
@@ -71,9 +71,14 @@ int verity_verify_sig_parse_opt_args(str const char *arg_name) {struct dm_target *ti = v->ti; -int ret =0 ; +int ret;const char *sig_key =NULL ; +if (v->signature_key_desc) { + ti->error =DM_VERITY_VERIFY_ERR ("root_hash_sig_key_desc already specified" ); +return -EINVAL ; + } +if (!*argc) { ti->error =DM_VERITY_VERIFY_ERR ("Signature key not specified" );return -EINVAL ;
@@ -83,14 +88,18 @@ int verity_verify_sig_parse_opt_args(str (*argc)--; ret =verity_verify_get_sig_from_key (sig_key, sig_opts); -if (ret <0 ) +if (ret <0 ) { ti->error =DM_VERITY_VERIFY_ERR ("Invalid key specified" ); +return ret; + } v->signature_key_desc =kstrdup (sig_key,GFP_KERNEL ); -if (!v->signature_key_desc) +if (!v->signature_key_desc) { + ti->error =DM_VERITY_VERIFY_ERR ("Could not allocate memory for signature key" );return -ENOMEM ; + } -return ret; +return 0 ; }/*
Greg Kroah-Hartman
maintainerPATCH 153/592 mtd: rawnand: qcom: Pass 18 bit offset from NANDc base to BAM base
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Md Sadre Alam <[email protected]>
commit ee000969f28bf579d3772bf7c0ae8aff86586e20 upstream.
The BAM command descriptor provides only 18 bits to specify the BAM register offset. Additionally, in the BAM command descriptor, the BAM register offset is supposed to be specified as "(NANDc base - BAM base)
+ reg_off". Since, the BAM controller expecting the value in the form of "NANDc base - BAM base", so that added a new field 'bam_offset' in the NAND properties structure and use it while preparing the command descriptor.
Previously, the driver was specifying the NANDc base address in the BAM command descriptor.
--- drivers/mtd/nand/qpic_common.c | 8 ++++---- drivers/mtd/nand/raw/qcom_nandc.c | 4 ++++ drivers/spi/spi-qpic-snand.c | 1 + include/linux/mtd/nand-qpic-common.h | 4 +--- 4 files changed, 10 insertions(+), 7 deletions(-)
drivers/mtd/nand/qpic_common.c +4 -4
@@ -236,21 +236,21 @@ int qcom_prep_bam_dma_desc_cmd(struct qcint i, ret;struct bam_cmd_element *bam_ce_buffer;struct bam_transaction *bam_txn = nandc->bam_txn; +u32 offset; bam_ce_buffer = &bam_txn->bam_ce[bam_txn->bam_ce_pos];/* fill the command desc */ for (i =0 ; i < size; i++) { + offset = nandc->props->bam_offset + reg_off +4 * i;if (read)bam_prep_ce (&bam_ce_buffer[i], -nandc_reg_phys (nandc, reg_off +4 * i), -BAM_READ_COMMAND , + offset,BAM_READ_COMMAND ,reg_buf_dma_addr (nandc, (__le32 *)vaddr + i));else bam_prep_ce_le32 (&bam_ce_buffer[i], -nandc_reg_phys (nandc, reg_off +4 * i), -BAM_WRITE_COMMAND , + offset,BAM_WRITE_COMMAND , *((__le32 *)vaddr + i)); }
drivers/mtd/nand/raw/qcom_nandc.c +4 -0
@@ -2360,6 +2360,7 @@ static const struct qcom_nandc_props ipq .supports_bam = false, .use_codeword_fixup = true, .dev_cmd_reg_start = 0x0, + .bam_offset = 0x30000, };static const struct qcom_nandc_props ipq4019_nandc_props = {
@@ -2367,6 +2368,7 @@ static const struct qcom_nandc_props ipq .supports_bam = true, .nandc_part_of_qpic = true, .dev_cmd_reg_start = 0x0, + .bam_offset = 0x30000, };static const struct qcom_nandc_props ipq8074_nandc_props = {
@@ -2374,6 +2376,7 @@ static const struct qcom_nandc_props ipq .supports_bam = true, .nandc_part_of_qpic = true, .dev_cmd_reg_start = 0x7000, + .bam_offset = 0x30000, };static const struct qcom_nandc_props sdx55_nandc_props = {
@@ -2382,6 +2385,7 @@ static const struct qcom_nandc_props sdx .nandc_part_of_qpic = true, .qpic_version2 = true, .dev_cmd_reg_start = 0x7000, + .bam_offset = 0x30000, };/*
drivers/spi/spi-qpic-snand.c +1 -0
@@ -1636,6 +1636,7 @@ static void qcom_spi_remove(struct platfstatic const struct qcom_nandc_props ipq9574_snandc_props = { .dev_cmd_reg_start =0x7000 , + .bam_offset =0x30000 , .supports_bam = true, };
include/linux/mtd/nand-qpic-common.h +1 -3
@@ -199,9 +199,6 @@*/ #define dev_cmd_reg_addr (nandc, reg) ((nandc)->props->dev_cmd_reg_start + (reg)) -/* Returns the NAND register physical address */ -#define nandc_reg_phys (chip, offset) ((chip)->base_phys + (offset)) -/* Returns the dma address for reg read buffer */ #define reg_buf_dma_addr (chip, vaddr) \ ((chip)->reg_read_dma + \
@@ -454,6 +451,7 @@ struct qcom_nand_controller {struct qcom_nandc_props {u32 ecc_modes;u32 dev_cmd_reg_start; +u32 bam_offset;bool supports_bam;bool nandc_part_of_qpic;bool qpic_version2;
Greg Kroah-Hartman
maintainerPATCH 154/592 mtd: rawnand: qcom: Fix last codeword read in qcom_param_page_type_exec()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Md Sadre Alam <[email protected]>
commit 47bddabbf69da50999ec68be92b58356c687e1d6 upstream.
For QPIC V2 onwards there is a separate register to read last code word "QPIC_NAND_READ_LOCATION_LAST_CW_n".
qcom_param_page_type_exec() is used to read only one code word If it configures the number of code words to 1 in QPIC_NAND_DEV0_CFG0 register then QPIC controller thinks its reading the last code word, since we are having separate register to read the last code word, we have to configure "QPIC_NAND_READ_LOCATION_LAST_CW_n" register to fetch data from QPIC buffer to system memory.
Without this change page read was failing with timeout error
/ # hexdump -C /dev/mtd1
[ 129.206113] qcom-nandc 1cc8000.nand-controller: failure to read page/oob
hexdump: /dev/mtd1: Connection timed out
This issue only seen on SDX targets since SDX target used QPICv2. But same working on IPQ targets since IPQ used QPICv1.
--- drivers/mtd/nand/raw/qcom_nandc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/qcom_nandc.c +10 -2
@@ -1863,7 +1863,12 @@ static int qcom_param_page_type_exec(strconst struct nand_op_instr *instr =NULL ;unsigned int op_id =0 ;unsigned int len =0 ; -int ret; +int ret, reg_base; + + reg_base =NAND_READ_LOCATION_0 ; + +if (nandc->props->qpic_version2) + reg_base =NAND_READ_LOCATION_LAST_CW_0 ; ret =qcom_parse_instructions (chip, subop, &q_op);if (ret)
@@ -1915,7 +1920,10 @@ static int qcom_param_page_type_exec(str op_id = q_op.data_instr_idx; len =nand_subop_get_data_len (subop, op_id); -nandc_set_read_loc (chip,0 ,0 ,0 , len,1 ); +if (nandc->props->qpic_version2) +nandc_set_read_loc_last (chip, reg_base,0 , len,1 ); +else +nandc_set_read_loc_first (chip, reg_base,0 , len,1 );if (!nandc->props->qpic_version2) {qcom_write_reg_dma (nandc, &nandc->regs->vld,NAND_DEV_CMD_VLD ,1 ,0 );
Greg Kroah-Hartman
maintainerPATCH 155/592 mtd: rawnand: qcom: Fix read len for onfi param page
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Md Sadre Alam <[email protected]>
commit e6031b11544b44966ba020c867fe438bccd3bdfa upstream.
The minimum size to fetch the data from device to QPIC buffer is 512-bytes. If size is less than 512-bytes the data will not be protected by ECC as per QPIC standard. So while reading onfi parameter page from NAND device set nandc->buf_count = 512.
--- drivers/mtd/nand/raw/qcom_nandc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/qcom_nandc.c +1 -1
@@ -1930,7 +1930,7 @@ static int qcom_param_page_type_exec(strqcom_write_reg_dma (nandc, &nandc->regs->cmd1,NAND_DEV_CMD1 ,1 ,NAND_BAM_NEXT_SGL ); } - nandc->buf_count = len; + nandc->buf_count =512 ;memset (nandc->data_buffer,0xff , nandc->buf_count);config_nand_single_cw_page_read (chip, false,0 );
Greg Kroah-Hartman
maintainerPATCH 156/592 ftrace: Fix UAF when lookup kallsym after ftrace disabled
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ye Bin <[email protected]>
commit f914b52c379c12288b7623bb814d0508dbe7481d upstream.
The following issue happens with a buggy module:
BUG: unable to handle page fault for address: ffffffffc05d0218 PGD 1bd66f067 P4D 1bd66f067 PUD 1bd671067 PMD 101808067 PTE 0 Oops: Oops: 0000 [#1] SMP KASAN PTI Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS RIP: 0010:sized_strscpy+0x81/0x2f0 RSP: 0018:ffff88812d76fa08 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffffffffc0601010 RCX: dffffc0000000000 RDX: 0000000000000038 RSI: dffffc0000000000 RDI: ffff88812608da2d RBP: 8080808080808080 R08: ffff88812608da2d R09: ffff88812608da68 R10: ffff88812608d82d R11: ffff88812608d810 R12: 0000000000000038 R13: ffff88812608da2d R14: ffffffffc05d0218 R15: fefefefefefefeff FS: 00007fef552de740(0000) GS:ffff8884251c7000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffc05d0218 CR3: 00000001146f0000 CR4: 00000000000006f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ftrace_mod_get_kallsym+0x1ac/0x590 update_iter_mod+0x239/0x5b0 s_next+0x5b/0xa0 seq_read_iter+0x8c9/0x1070 seq_read+0x249/0x3b0 proc_reg_read+0x1b0/0x280 vfs_read+0x17f/0x920 ksys_read+0xf3/0x1c0 do_syscall_64+0x5f/0x2e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
The above issue may happen as follows:
(1) Add kprobe tracepoint;
(2) insmod test.ko;
(3) Module triggers ftrace disabled;
(4) rmmod test.ko;
(5) cat /proc/kallsyms; --> Will trigger UAF as test.ko already removed; ftrace_mod_get_kallsym()
...strscpy(module_name, mod_map->mod->name, MODULE_NAME_LEN);
...
The problem is when a module triggers an issue with ftrace and sets ftrace_disable. The ftrace_disable is set when an anomaly is discovered and to prevent any more damage, ftrace stops all text modification. The issue that happened was that the ftrace_disable stops more than just the text modification.
When a module is loaded, its init functions can also be traced. Because kallsyms deletes the init functions after a module has loaded, ftrace saves them when the module is loaded and function tracing is enabled. This allows the output of the function trace to show the init function names instead of just their raw memory addresses.
When a module is removed, ftrace_release_mod() is called, and if ftrace_disable is set, it just returns without doing anything more. The problem here is that it leaves the mod_list still around and if kallsyms is called, it will call into this code and access the module memory that has already been freed as it will return:
strscpy(module_name, mod_map->mod->name, MODULE_NAME_LEN);
Where the "mod" no longer exists and triggers a UAF bug.
--- kernel/trace/ftrace.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/trace/ftrace.c +7 -3
@@ -7395,9 +7395,10 @@ void ftrace_release_mod(struct module *mmutex_lock (&ftrace_lock); -if (ftrace_disabled) - goto out_unlock; - +/* +* To avoid the UAF problem after the module is unloaded, the +* 'mod_map' resource needs to be released unconditionally. +*/ list_for_each_entry_safe (mod_map, n, &ftrace_mod_maps, list) {if (mod_map->mod == mod) {list_del_rcu (&mod_map->list);
@@ -7406,6 +7407,9 @@ void ftrace_release_mod(struct module *m } } +if (ftrace_disabled) + goto out_unlock; +/* * Each module has its own ftrace_pages, remove * them from the list.
Greg Kroah-Hartman
maintainerPATCH 157/592 dm: lock limits when reading them
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit abb4cf2f4c1c1b637cad04d726f2e13fd3051e03 upstream.
Lock queue limits when reading them, so that we don't read halfway modified values.
--- drivers/md/dm-table.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/md/dm-table.c +7 -1
@@ -431,6 +431,7 @@ static int dm_set_device_limits(struct dreturn 0 ; } +mutex_lock (&q->limits_lock);if (blk_stack_limits (limits, &q->limits,get_start_sect (bdev) + start) <0 ) DMWARN("%s: adding target device %pg caused an alignment inconsistency: "
@@ -448,6 +449,7 @@ static int dm_set_device_limits(struct d*/ if (!dm_target_has_integrity (ti->type))queue_limits_stack_integrity_bdev (limits, bdev); +mutex_unlock (&q->limits_lock);return 0 ; }
@@ -1733,8 +1735,12 @@ static int device_not_write_zeroes_capab sector_t start, sector_t len, void *data) { struct request_queue *q = bdev_get_queue(dev->bdev); +int b; -return !q->limits.max_write_zeroes_sectors; +mutex_lock (&q->limits_lock); + b = !q->limits.max_write_zeroes_sectors; +mutex_unlock (&q->limits_lock); +return b; }static bool dm_table_supports_write_zeroes (struct dm_table *t)
Greg Kroah-Hartman
maintainerPATCH 158/592 dm-table: Set BLK_FEAT_ATOMIC_WRITES for target queue limits
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Garry <[email protected]>
commit b7c18b17a173087ce97e809cefd55e581121f19e upstream.
Feature flag BLK_FEAT_ATOMIC_WRITES is not being properly set for the target queue limits, and this means that atomic writes are not being enabled for any dm personalities.
When calling dm_set_device_limits() -> blk_stack_limits() -> ... -> blk_stack_atomic_writes_limits(), the bottom device limits (which corresponds to intermediate target queue limits) does not have BLK_FEAT_ATOMIC_WRITES set, and so atomic writes can never be enabled.
Typically such a flag would be inherited from the stacked device in dm_set_device_limits() -> blk_stack_limits() via BLK_FEAT_INHERIT_MASK, but BLK_FEAT_ATOMIC_WRITES is not inherited as it's preferred to manually enable on a per-personality basis.
Set BLK_FEAT_ATOMIC_WRITES manually for the intermediate target queue limits from the stacked device to get atomic writes working.
--- drivers/md/dm-table.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/md/dm-table.c +6 -0
@@ -431,6 +431,12 @@ static int dm_set_device_limits(struct dreturn 0 ; } +/* +* BLK_FEAT_ATOMIC_WRITES is not inherited from the bottom device in +* blk_stack_limits(), so do it manually. +*/ + limits->features |= (q->limits.features &BLK_FEAT_ATOMIC_WRITES ); +mutex_lock (&q->limits_lock);if (blk_stack_limits (limits, &q->limits,get_start_sect (bdev) + start) <0 )
Greg Kroah-Hartman
maintainerPATCH 159/592 phy: fsl-imx8mq-usb: fix phy_tx_vboost_level_from_property()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit b15ee09ddb987a122e74fb0fdf1bd6e864959fd3 upstream.
The description of TX_VBOOST_LVL is wrong in register PHY_CTRL3 bit[31:29].
The updated description as below:
011: Corresponds to a launch amplitude of 0.844 V. 100: Corresponds to a launch amplitude of 1.008 V. 101: Corresponds to a launch amplitude of 1.156 V.
This will fix the parsing function phy_tx_vboost_level_from_property() to return correct value.
--- drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/phy/freescale/phy-fsl-imx8mq-usb.c +5 -5
@@ -317,12 +317,12 @@ static u32 phy_tx_preemp_amp_tune_from_pstatic u32 phy_tx_vboost_level_from_property (u32 microvolt) {switch (microvolt) { - case 0 ... 960: -return 0 ; - case 961 ... 1160: -return 2 ; -default : +case 1156 : +return 5 ; +case 844 :return 3 ; +default : +return 4 ; } }
Greg Kroah-Hartman
maintainerPATCH 160/592 net: ch9200: fix uninitialised access during mii_nway_restart
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
commit 9ad0452c0277b816a435433cca601304cfac7c21 upstream.
In mii_nway_restart() the code attempts to call mii->mdio_read which is ch9200_mdio_read(). ch9200_mdio_read() utilises a local buffer called "buff", which is initialised with control_read(). However "buff" is conditionally initialised inside control_read():
if (err == size) {
memcpy(data, buf, size);
}If the condition of "err == size" is not met, then "buff" remains uninitialised. Once this happens the uninitialised "buff" is accessed and returned during ch9200_mdio_read():
return (buff[0] | buff[1] << 8);
The problem stems from the fact that ch9200_mdio_read() ignores the return value of control_read(), leading to uinit-access of "buff".
To fix this we should check the return value ofcontrol_read() and return early on error.
--- drivers/net/usb/ch9200.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/usb/ch9200.c +5 -2
@@ -178,6 +178,7 @@ static int ch9200_mdio_read(struct net_d {struct usbnet *dev =netdev_priv (netdev);unsigned char buff[2 ]; +int ret;netdev_dbg (netdev,"%s phy_id:%02x loc:%02x\n" , __func__, phy_id, loc);
@@ -185,8 +186,10 @@ static int ch9200_mdio_read(struct net_dif (phy_id !=0 )return -ENODEV ; -control_read (dev,REQUEST_READ ,0 , loc *2 , buff,0x02 , -CONTROL_TIMEOUT_MS ); + ret =control_read (dev,REQUEST_READ ,0 , loc *2 , buff,0x02 , +CONTROL_TIMEOUT_MS ); +if (ret <0 ) +return ret;return (buff[0 ] | buff[1 ] <<8 ); }
Greg Kroah-Hartman
maintainerPATCH 161/592 KVM: s390: rename PROT_NONE to PROT_TYPE_DUMMY
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Stoakes <[email protected]>
commit 15ac613f124e51a6623975efad9657b1f3ee47e7 upstream.
The enum type prot_type declared in arch/s390/kvm/gaccess.c declares an unfortunate identifier within it - PROT_NONE.
This clashes with the protection bit define from the uapi for mmap() declared in include/uapi/asm-generic/mman-common.h, which is indeed what those casually reading this code would assume this to refer to.
This means that any changes which subsequently alter headers in any way which results in the uapi header being imported here will cause build errors.
Resolve the issue by renaming PROT_NONE to PROT_TYPE_DUMMY.
--- arch/s390/kvm/gaccess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/kvm/gaccess.c +4 -4
@@ -318,7 +318,7 @@ enum prot_type {PROT_TYPE_DAT =3 ,PROT_TYPE_IEP =4 ,/* Dummy value for passing an initialized value when code != PGM_PROTECTION */ - PROT_NONE, + PROT_TYPE_DUMMY, }; static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar,
@@ -334,7 +334,7 @@ static int trans_exc_ending(struct kvm_vswitch (code) {case PGM_PROTECTION :switch (prot) { -case PROT_NONE : +case PROT_TYPE_DUMMY :/* We should never get here, acts like termination */ WARN_ON_ONCE (1 );break ;
@@ -804,7 +804,7 @@ static int guest_range_to_gpas(struct kv gpa =kvm_s390_real_to_abs (vcpu, ga);if (!kvm_is_gpa_in_memslot (vcpu->kvm, gpa)) { rc =PGM_ADDRESSING ; - prot =PROT_NONE ; + prot =PROT_TYPE_DUMMY ; } }if (rc)
@@ -962,7 +962,7 @@ int access_guest_with_key(struct kvm_vcpif (rc ==PGM_PROTECTION ) prot =PROT_TYPE_KEYC ;else - prot =PROT_NONE ; + prot =PROT_TYPE_DUMMY ; rc =trans_exc_ending (vcpu, rc, ga, ar, mode, prot, terminate); } out_unlock:
Greg Kroah-Hartman
maintainerPATCH 162/592 sysfb: Fix screen_info type check for VGA
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit f670b50ef5e4a69bf4d2ec5ac6a9228d93b13a7a upstream.
Use the helper screen_info_video_type() to get the framebuffer type from struct screen_info. Handle supported values in sorted switch statement.
Reading orig_video_isVGA is unreliable. On most systems it is a VIDEO_TYPE_ constant. On some systems with VGA it is simply set to 1 to signal the presence of a VGA output. See vga_probe() for an example. Retrieving the screen_info type with the helper screen_info_video_type() detects these cases and returns the appropriate VIDEO_TYPE_ constant. For VGA, sysfb creates a device named "vga-framebuffer".
The sysfb code has been taken from vga16fb, where it likely didn't work correctly either. With this bugfix applied, vga16fb loads for compatible vga-framebuffer devices.
--- drivers/firmware/sysfb.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/firmware/sysfb.c +18 -8
@@ -143,6 +143,7 @@ static __init int sysfb_init(void) {struct screen_info *si = &screen_info;struct device *parent; +unsigned int type;struct simplefb_platform_data mode;const char *name;bool compatible;
@@ -170,17 +171,26 @@ static __init int sysfb_init(void) goto put_device; } + type =screen_info_video_type (si); +/* if the FB is incompatible, create a legacy framebuffer device */ -if (si->orig_video_isVGA ==VIDEO_TYPE_EFI ) - name ="efi-framebuffer" ; -else if (si->orig_video_isVGA ==VIDEO_TYPE_VLFB ) - name ="vesa-framebuffer" ; -else if (si->orig_video_isVGA ==VIDEO_TYPE_VGAC ) - name ="vga-framebuffer" ; -else if (si->orig_video_isVGA ==VIDEO_TYPE_EGAC ) +switch (type) { +case VIDEO_TYPE_EGAC : name ="ega-framebuffer" ; -else +break ; +case VIDEO_TYPE_VGAC : + name ="vga-framebuffer" ; +break ; +case VIDEO_TYPE_VLFB : + name ="vesa-framebuffer" ; +break ; +case VIDEO_TYPE_EFI : + name ="efi-framebuffer" ; +break ; +default : name ="platform-framebuffer" ; +break ; + } pd =platform_device_alloc (name,0 );if (!pd) {
Greg Kroah-Hartman
maintainerPATCH 163/592 video: screen_info: Relocate framebuffers behind PCI bridges
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 2f29b5c231011b94007d2c8a6d793992f2275db1 upstream.
Apply PCI host-bridge window offsets to screen_info framebuffers. Fixes invalid access to I/O memory.
Resources behind a PCI host bridge can be relocated by a certain offset in the kernel's CPU address range used for I/O. The framebuffer memory range stored in screen_info refers to the CPU addresses as seen during boot (where the offset is 0). During boot up, firmware may assign a different memory offset to the PCI host bridge and thereby relocating the framebuffer address of the PCI graphics device as seen by the kernel. The information in screen_info must be updated as well.
The helper pcibios_bus_to_resource() performs the relocation of the screen_info's framebuffer resource (given in PCI bus addresses). The result matches the I/O-memory resource of the PCI graphics device (given in CPU addresses). As before, we store away the information necessary to later update the information in screen_info itself.
Commit 78aa89d1dfba ("firmware/sysfb: Update screen_info for relocated EFI framebuffers") added the code for updating screen_info. It is based on similar functionality that pre-existed in efifb. Efifb uses a pointer to the PCI resource, while the newer code does a memcpy of the region. Hence efifb sees any updates to the PCI resource and avoids the issue.
v3:
- Only use struct pci_bus_region for PCI bus addresses (Bjorn)
- Clarify address semantics in commit messages and comments (Bjorn) v2:
- Fixed tags (Takashi, Ivan)
- Updated information on efifb
--- drivers/video/screen_info_pci.c | 79 +++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 29 deletions(-)
drivers/video/screen_info_pci.c +50 -29
@@ -7,8 +7,8 @@static struct pci_dev *screen_info_lfb_pdev;static size_t screen_info_lfb_bar; -static resource_size_t screen_info_lfb_offset; -static struct resource screen_info_lfb_res =DEFINE_RES_MEM (0 ,0 ); +static resource_size_t screen_info_lfb_res_start;// original start of resource +static resource_size_t screen_info_lfb_offset;// framebuffer offset within resource static bool __screen_info_relocation_is_valid (const struct screen_info *si,struct resource *pr) {
@@ -31,7 +31,7 @@ void screen_info_apply_fixups(void)if (screen_info_lfb_pdev) {struct resource *pr = &screen_info_lfb_pdev->resource[screen_info_lfb_bar]; -if (pr->start != screen_info_lfb_res.start) { +if (pr->start != screen_info_lfb_res_start) {if (__screen_info_relocation_is_valid (si, pr)) {/* * Only update base if we have an actual
@@ -47,46 +47,67 @@ void screen_info_apply_fixups(void) } } +static int __screen_info_lfb_pci_bus_region (const struct screen_info *si,unsigned int type, +struct pci_bus_region *r) +{ +u64 base, size; + + base =__screen_info_lfb_base (si); +if (!base) +return -EINVAL ; + + size =__screen_info_lfb_size (si, type); +if (!size) +return -EINVAL ; + + r->start = base; + r->end = base + size -1 ; + +return 0 ; +} +static void screen_info_fixup_lfb (struct pci_dev *pdev) {unsigned int type; -struct resource res[SCREEN_INFO_MAX_RESOURCES ]; -size_t i, numres; +struct pci_bus_region bus_region;int ret; +struct resource r = { + .flags =IORESOURCE_MEM , + }; +const struct resource *pr;const struct screen_info *si = &screen_info;if (screen_info_lfb_pdev)return ;// already found type =screen_info_video_type (si); -if (type !=VIDEO_TYPE_EFI ) -return ;// only applies to EFI +if (!__screen_info_has_lfb (type)) +return ;// only applies to EFI; maybe VESA - ret =screen_info_resources (si, res,ARRAY_SIZE (res)); + ret =__screen_info_lfb_pci_bus_region (si, type, &bus_region);if (ret <0 )return ; - numres = ret; -for (i =0 ; i < numres; ++i) { -struct resource *r = &res[i]; -const struct resource *pr; - -if (!(r->flags &IORESOURCE_MEM )) -continue ; - pr =pci_find_resource (pdev, r); -if (!pr) -continue ; - -/* -* We've found a PCI device with the framebuffer -* resource. Store away the parameters to track -* relocation of the framebuffer aperture. -*/ - screen_info_lfb_pdev = pdev; - screen_info_lfb_bar = pr - pdev->resource; - screen_info_lfb_offset = r->start - pr->start; -memcpy (&screen_info_lfb_res, r,sizeof (screen_info_lfb_res)); - } +/* +* Translate the PCI bus address to resource. Account +* for an offset if the framebuffer is behind a PCI host +* bridge. +*/ +pcibios_bus_to_resource (pdev->bus, &r, &bus_region); + + pr =pci_find_resource (pdev, &r); +if (!pr) +return ; + +/* +* We've found a PCI device with the framebuffer +* resource. Store away the parameters to track +* relocation of the framebuffer aperture. +*/ + screen_info_lfb_pdev = pdev; + screen_info_lfb_bar = pr - pdev->resource; + screen_info_lfb_offset = r.start - pr->start; + screen_info_lfb_res_start = bus_region.start; }DECLARE_PCI_FIXUP_CLASS_HEADER (PCI_ANY_ID ,PCI_ANY_ID ,PCI_BASE_CLASS_DISPLAY ,16 , screen_info_fixup_lfb);
Greg Kroah-Hartman
maintainerPATCH 164/592 nvme-tcp: remove tag set when second admin queue config fails
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shin'ichiro Kawasaki <[email protected]>
commit e7143706702a209c814ed2c3fc6486c2a7decf6c upstream.
Commit 104d0e2f6222 ("nvme-fabrics: reset admin connection for secure concatenation") modified nvme_tcp_setup_ctrl() to call nvme_tcp_configure_admin_queue() twice. The first call prepares for DH-CHAP negotitation, and the second call is required for secure concatenation. However, this change triggered BUG KASAN slab-use-after- free in blk_mq_queue_tag_busy_iter(). This BUG can be recreated by repeating the blktests test case nvme/063 a few times [1].
When the BUG happens, nvme_tcp_create_ctrl() fails in the call chain below:
nvme_tcp_create_ctrl()
nvme_tcp_alloc_ctrl() new=true ... Alloc nvme_tcp_ctrl and admin_tag_set
nvme_tcp_setup_ctrl() new=true
nvme_tcp_configure_admin_queue() new=true ... Succeed
nvme_alloc_admin_tag_set() ... Alloc the tag set for admin_tag_set
nvme_stop_keep_alive() nvme_tcp_teardown_admin_queue() remove=false nvme_tcp_configure_admin_queue() new=false
nvme_tcp_alloc_admin_queue() ... Fail, but do not call nvme_remove_admin_tag_set()
nvme_uninit_ctrl()
nvme_put_ctrl() ... Free up the nvme_tcp_ctrl and admin_tag_set
The first call of nvme_tcp_configure_admin_queue() succeeds with new=true argument. The second call fails with new=false argument. This second call does not call nvme_remove_admin_tag_set() on failure, due to the new=false argument. Then the admin tag set is not removed. However, nvme_tcp_create_ctrl() assumes that nvme_tcp_setup_ctrl() would call nvme_remove_admin_tag_set(). Then it frees up struct nvme_tcp_ctrl which has admin_tag_set field. Later on, the timeout handler accesses the admin_tag_set field and causes the BUG KASAN slab-use-after-free.
To not leave the admin tag set, call nvme_remove_admin_tag_set() when the second nvme_tcp_configure_admin_queue() call fails. Do not return from nvme_tcp_setup_ctrl() on failure. Instead, jump to "destroy_admin" go-to label to call nvme_tcp_teardown_admin_queue() which calls nvme_remove_admin_tag_set().
--- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/tcp.c +1 -1
@@ -2392,7 +2392,7 @@ static int nvme_tcp_setup_ctrl(struct nvnvme_tcp_teardown_admin_queue (ctrl, false); ret =nvme_tcp_configure_admin_queue (ctrl, false);if (ret) -return ret; + goto destroy_admin; }if (ctrl->icdoff) {
Greg Kroah-Hartman
maintainerPATCH 165/592 pwm: axi-pwmgen: fix missing separate external clock
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
commit a8841dc3dfbf127a19c3612204bd336ee559b9a1 upstream.
Add proper support for external clock to the AXI PWM generator driver.
In most cases, the HDL for this IP block is compiled with the default ASYNC_CLK_EN=1. With this option, there is a separate external clock that drives the PWM output separate from the peripheral clock. So the driver should be enabling the "axi" clock to power the peripheral and the "ext" clock to drive the PWM output.
When ASYNC_CLK_EN=0, the "axi" clock is also used to drive the PWM output and there is no "ext" clock.
Previously, if there was a separate external clock, users had to specify only the external clock and (incorrectly) omit the AXI clock in order to get the correct operating frequency for the PWM output.
The devicetree bindings are updated to fix this shortcoming and this patch changes the driver to match the new bindings. To preserve compatibility with any existing dtbs that specify only one clock, we don't require the clock name on the first clock.
--- drivers/pwm/pwm-axi-pwmgen.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/pwm/pwm-axi-pwmgen.c +20 -3
@@ -257,7 +257,7 @@ static int axi_pwmgen_probe(struct platfstruct regmap *regmap;struct pwm_chip *chip;struct axi_pwmgen_ddata *ddata; -struct clk *clk; +struct clk *axi_clk, *clk;void __iomem *io_base;int ret;
@@ -280,9 +280,26 @@ static int axi_pwmgen_probe(struct platf ddata =pwmchip_get_drvdata (chip); ddata->regmap = regmap; - clk =devm_clk_get_enabled (dev,NULL ); +/* +* Using NULL here instead of "axi" for backwards compatibility. There +* are some dtbs that don't give clock-names and have the "ext" clock +* as the one and only clock (due to mistake in the original bindings). +*/ + axi_clk =devm_clk_get_enabled (dev,NULL ); +if (IS_ERR (axi_clk)) +return dev_err_probe (dev,PTR_ERR (axi_clk),"failed to get axi clock\n" ); + + clk =devm_clk_get_optional_enabled (dev,"ext" );if (IS_ERR (clk)) -return dev_err_probe (dev,PTR_ERR (clk),"failed to get clock\n" ); +return dev_err_probe (dev,PTR_ERR (clk),"failed to get ext clock\n" ); + +/* +* If there is no "ext" clock, it means the HDL was compiled with +* ASYNC_CLK_EN=0. In this case, the AXI clock is also used for the +* PWM output clock. +*/ +if (!clk) + clk = axi_clk; ret =devm_clk_rate_exclusive_get (dev, clk);if (ret)
Greg Kroah-Hartman
maintainerPATCH 166/592 staging: iio: ad5933: Correct settling cycles encoding per datasheet
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel Shahrouzi <[email protected]>
commit 60638e2a2d4bc03798f00d5ab65ce9b83cb8b03b upstream.
The AD5933 datasheet (Table 13) lists the maximum cycles to be 0x7FC (2044).
Clamp the user input to the maximum effective value of 0x7FC cycles.
--- drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/impedance-analyzer/ad5933.c +1 -1
@@ -411,7 +411,7 @@ static ssize_t ad5933_store(struct devic ret =ad5933_cmd (st,0 );break ;case AD5933_OUT_SETTLING_CYCLES : - val =clamp (val, (u16 )0 , (u16 )0x7FF ); + val =clamp (val, (u16 )0 , (u16 )0x7FC ); st->settling_cycles = val;/* 2x, 4x handling, see datasheet */
Greg Kroah-Hartman
maintainerPATCH 167/592 mips: Add -std= flag specified in KBUILD_CFLAGS to vdso CFLAGS
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Khem Raj <[email protected]>
commit 0f4ae7c6ecb89bfda026d210dcf8216fb67d2333 upstream.
GCC 15 changed the default C standard dialect from gnu17 to gnu23, which should not have impacted the kernel because it explicitly requests the gnu11 standard in the main Makefile. However, mips/vdso code uses its own CFLAGS without a '-std=' value, which break with this dialect change because of the kernel's own definitions of bool, false, and true conflicting with the C23 reserved keywords.
include/linux/stddef.h:11:9: error: cannot use keyword 'false' as enumeration constant
11 | false = 0,
| ^~~~~
include/linux/stddef.h:11:9: note: 'false' is a keyword with '-std=c23' onwards
include/linux/types.h:35:33: error: 'bool' cannot be defined via 'typedef'
35 | typedef _Bool bool;
| ^~~~ include/linux/types.h:35:33: note: 'bool' is a keyword with '-std=c23' onwards
Add -std as specified in KBUILD_CFLAGS to the decompressor and purgatory CFLAGS to eliminate these errors and make the C standard version of these areas match the rest of the kernel.
--- arch/mips/vdso/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/mips/vdso/Makefile +1 -0
@@ -27,6 +27,7 @@ endif # offsets. cflags-vdso := $(ccflags-vdso) \ $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \ + $(filter -std=%,$(KBUILD_CFLAGS)) \ -O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \ -mrelax-pic-calls $(call cc-option, -mexplicit-relocs) \ -fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
Greg Kroah-Hartman
maintainerPATCH 168/592 ovl: Fix nested backing file paths
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: André Almeida <[email protected]>
commit 924577e4f6ca473de1528953a0e13505fae61d7b upstream.
When the lowerdir of an overlayfs is a merged directory of another overlayfs, ovl_open_realfile() will fail to open the real file and point to a lower dentry copy, without the proper parent path. After this, d_path() will then display the path incorrectly as if the file is placed in the root directory.
This bug can be triggered with the following setup:
mkdir -p ovl-A/lower ovl-A/upper ovl-A/merge ovl-A/work mkdir -p ovl-B/upper ovl-B/merge ovl-B/work
cp /bin/cat ovl-A/lower/
mount -t overlay overlay -o \
lowerdir=ovl-A/lower,upperdir=ovl-A/upper,workdir=ovl-A/work \
ovl-A/merge
mount -t overlay overlay -o \
lowerdir=ovl-A/merge,upperdir=ovl-B/upper,workdir=ovl-B/work \
ovl-B/merge
ovl-A/merge/cat /proc/self/maps | grep --color cat ovl-B/merge/cat /proc/self/maps | grep --color cat
The first cat will correctly show /ovl-A/merge/cat, while the second one shows just /cat.
To fix that, uses file_user_path() inside of backing_file_open() to get the correct file path for the dentry.
--- fs/overlayfs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/overlayfs/file.c +2 -2
@@ -48,8 +48,8 @@ static struct file *ovl_open_realfile(coif (!inode_owner_or_capable (real_idmap, realinode)) flags &= ~O_NOATIME ; - realfile =backing_file_open (&file->f_path, flags, realpath, -current_cred ()); + realfile =backing_file_open (file_user_path ((struct file *) file), + flags, realpath,current_cred ()); }ovl_revert_creds (old_cred);
Greg Kroah-Hartman
maintainerPATCH 169/592 regulator: max14577: Add error check for max14577_read_reg()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit 65271f868cb1dca709ff69e45939bbef8d6d0b70 upstream.
The function max14577_reg_get_current_limit() calls the function max14577_read_reg(), but does not check its return value. A proper implementation can be found in max14577_get_online().
Add a error check for the max14577_read_reg() and return error code if the function fails.
--- drivers/regulator/max14577-regulator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/regulator/max14577-regulator.c +4 -1
@@ -40,11 +40,14 @@ static int max14577_reg_get_current_limistruct max14577 *max14577 =rdev_get_drvdata (rdev);const struct maxim_charger_current *limits = &maxim_charger_currents[max14577->dev_type]; +int ret;if (rdev_get_id (rdev) !=MAX14577_CHARGER )return -EINVAL ; -max14577_read_reg (rmap,MAX14577_CHG_REG_CHG_CTRL4 , ®_data); + ret =max14577_read_reg (rmap,MAX14577_CHG_REG_CHG_CTRL4 , ®_data); +if (ret <0 ) +return ret;if ((reg_data &CHGCTRL4_MBCICHWRCL_MASK ) ==0 )return limits->min;
Greg Kroah-Hartman
maintainerPATCH 170/592 remoteproc: core: Cleanup acquired resources when rproc_handle_resources() fails in rproc_attach()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
commit 7692c9fbedd9087dc9050903f58095915458d9b1 upstream.
When rproc->state = RPROC_DETACHED and rproc_attach() is used to attach to the remote processor, if rproc_handle_resources() returns a failure, the resources allocated by imx_rproc_prepare() should be released, otherwise the following memory leak will occur.
Since almost the same thing is done in imx_rproc_prepare() and rproc_resource_cleanup(), Function rproc_resource_cleanup() is able to deal with empty lists so it is better to fix the "goto" statements in rproc_attach(). replace the "unprepare_device" goto statement with "clean_up_resources" and get rid of the "unprepare_device" label.
unreferenced object 0xffff0000861c5d00 (size 128):
comm "kworker/u12:3", pid 59, jiffies 4294893509 (age 149.220s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 02 88 00 00 00 00 00 00 10 00 00 00 00 00 ............ backtrace:
[<00000000f949fe18>] slab_post_alloc_hook+0x98/0x37c [<00000000adbfb3e7>] __kmem_cache_alloc_node+0x138/0x2e0 [<00000000521c0345>] kmalloc_trace+0x40/0x158 [<000000004e330a49>] rproc_mem_entry_init+0x60/0xf8 [<000000002815755e>] imx_rproc_prepare+0xe0/0x180 [<0000000003f61b4e>] rproc_boot+0x2ec/0x528 [<00000000e7e994ac>] rproc_add+0x124/0x17c [<0000000048594076>] imx_rproc_probe+0x4ec/0x5d4 [<00000000efc298a1>] platform_probe+0x68/0xd8 [<00000000110be6fe>] really_probe+0x110/0x27c [<00000000e245c0ae>] __driver_probe_device+0x78/0x12c [<00000000f61f6f5e>] driver_probe_device+0x3c/0x118 [<00000000a7874938>] __device_attach_driver+0xb8/0xf8 [<0000000065319e69>] bus_for_each_drv+0x84/0xe4 [<00000000db3eb243>] __device_attach+0xfc/0x18c [<0000000072e4e1a4>] device_initial_probe+0x14/0x20
--- drivers/remoteproc/remoteproc_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/remoteproc/remoteproc_core.c +2 -3
@@ -1617,7 +1617,7 @@ static int rproc_attach(struct rproc *rp ret =rproc_set_rsc_table (rproc);if (ret) {dev_err (dev,"can't load resource table: %d\n" , ret); - goto unprepare_device; + goto clean_up_resources; }/* reset max_notifyid */
@@ -1634,7 +1634,7 @@ static int rproc_attach(struct rproc *rp ret =rproc_handle_resources (rproc, rproc_loading_handlers);if (ret) {dev_err (dev,"Failed to process resources: %d\n" , ret); - goto unprepare_device; + goto clean_up_resources; }/* Allocate carveout resources associated to rproc */
@@ -1653,7 +1653,6 @@ static int rproc_attach(struct rproc *rp clean_up_resources:rproc_resource_cleanup (rproc); -unprepare_device:/* release HW resources if needed */ rproc_unprepare_device (rproc); disable_iommu:
Greg Kroah-Hartman
maintainerPATCH 171/592 remoteproc: core: Release rproc->clean_table after rproc_attach() fails
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
commit bcd241230fdbc6005230f80a4f8646ff5a84f15b upstream.
When rproc->state = RPROC_DETACHED is attached to remote processor through rproc_attach(), if rproc_handle_resources() returns failure, then the clean table should be released, otherwise the following memory leak will occur.
unreferenced object 0xffff000086a99800 (size 1024):
comm "kworker/u12:3", pid 59, jiffies 4294893670 (age 121.140s) hex dump (first 32 bytes):
00 00 00 00 00 80 00 00 00 00 00 00 00 00 10 00 ............ 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 ............ backtrace:
[<000000008bbe4ca8>] slab_post_alloc_hook+0x98/0x3fc [<000000003b8a272b>] __kmem_cache_alloc_node+0x13c/0x230 [<000000007a507c51>] __kmalloc_node_track_caller+0x5c/0x260 [<0000000037818dae>] kmemdup+0x34/0x60 [<00000000610f7f57>] rproc_boot+0x35c/0x56c [<0000000065f8871a>] rproc_add+0x124/0x17c [<00000000497416ee>] imx_rproc_probe+0x4ec/0x5d4 [<000000003bcaa37d>] platform_probe+0x68/0xd8 [<00000000771577f9>] really_probe+0x110/0x27c [<00000000531fea59>] __driver_probe_device+0x78/0x12c [<0000000080036a04>] driver_probe_device+0x3c/0x118 [<000000007e0bddcb>] __device_attach_driver+0xb8/0xf8 [<000000000cf1fa33>] bus_for_each_drv+0x84/0xe4 [<000000001a53b53e>] __device_attach+0xfc/0x18c [<00000000d1a2a32c>] device_initial_probe+0x14/0x20 [<00000000d8f8b7ae>] bus_probe_device+0xb0/0xb4 unreferenced object 0xffff0000864c9690 (size 16):
--- drivers/remoteproc/remoteproc_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/remoteproc/remoteproc_core.c +1 -0
@@ -1655,6 +1655,7 @@ clean_up_resources:rproc_resource_cleanup (rproc);/* release HW resources if needed */ rproc_unprepare_device (rproc); +kfree (rproc->clean_table); disable_iommu:rproc_disable_iommu (rproc);return ret;
Greg Kroah-Hartman
maintainerPATCH 173/592 cifs: reset connections for all channels when reconnect requested
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Prasad N <[email protected]>
commit 1f396b9bfe39aaf55ea74a7005806164b236653d upstream.
cifs_reconnect can be called with a flag to mark the session as needing reconnect too. When this is done, we expect the connections of all channels to be reconnected too, which is not happening today.
Without doing this, we have seen bad things happen when primary and secondary channels are connected to different servers (in case of cloud services like Azure Files SMB).
This change would force all connections to reconnect as well, not just the sessions and tcons.
--- fs/smb/client/connect.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/smb/client/connect.c +7 -0
@@ -377,6 +377,13 @@ static int __cifs_reconnect(struct TCP_Sif (!cifs_tcp_ses_needs_reconnect (server,1 ))return 0 ; +/* +* if smb session has been marked for reconnect, also reconnect all +* connections. This way, the other connections do not end up bad. +*/ +if (mark_smb_session) +cifs_signal_cifsd_for_reconnect (server, mark_smb_session); +cifs_mark_tcp_ses_conns_for_reconnect (server, mark_smb_session);cifs_abort_connection (server);
Greg Kroah-Hartman
maintainerPATCH 174/592 cifs: update dstaddr whenever channel iface is updated
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Prasad N <[email protected]>
commit c1846893991f3b4ec8a0cc12219ada153f0814d6 upstream.
When the server interface info changes (more common in clustered servers like Azure Files), the per-channel iface gets updated. However, this did not update the corresponding dstaddr. As a result these channels will still connect (or try connecting) to older addresses.
--- fs/smb/client/sess.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/smb/client/sess.c +4 -0
@@ -445,6 +445,10 @@ cifs_chan_update_iface(struct cifs_ses * ses->chans[chan_index].iface = iface;spin_unlock (&ses->chan_lock); + +spin_lock (&server->srv_lock); +memcpy (&server->dstaddr, &iface->sockaddr,sizeof (server->dstaddr)); +spin_unlock (&server->srv_lock); } static int
Greg Kroah-Hartman
maintainerPATCH 175/592 cifs: dns resolution is needed only for primary channel
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shyam Prasad N <[email protected]>
commit b4f60a053a2534c3e510ba0c1f8727566adf8317 upstream.
When calling cifs_reconnect, before the connection to the server is reestablished, the code today does a DNS resolution and updates server->dstaddr.
However, this is not necessary for secondary channels. Secondary channels use the interface list returned by the server to decide which address to connect to. And that happens after tcon is reconnected and server interfaces are requested.
--- fs/smb/client/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/smb/client/connect.c +2 -1
@@ -392,7 +392,8 @@ static int __cifs_reconnect(struct TCP_Stry_to_freeze ();cifs_server_lock (server); -if (!cifs_swn_set_server_dstaddr (server)) { +if (!cifs_swn_set_server_dstaddr (server) && + !SERVER_IS_CHAN (server)) {/* resolve the hostname again to make sure that IP address is up-to-date */ rc =reconn_set_ipaddr_from_hostname (server);cifs_dbg (FYI ,"%s: reconn_set_ipaddr_from_hostname: rc=%d\n" , __func__, rc);
Greg Kroah-Hartman
maintainerPATCH 176/592 smb: client: add NULL check in automount_fullpath
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruben Devos <[email protected]>
commit f1e7a277a1736e12cc4bd6d93b8a5c439b8ca20c upstream.
page is checked for null in __build_path_from_dentry_optional_prefix when tcon->origin_fullpath is not set. However, the check is missing when it is set.
Add a check to prevent a potential NULL pointer dereference.
--- fs/smb/client/namespace.c | 3 +++ 1 file changed, 3 insertions(+)
fs/smb/client/namespace.c +3 -0
@@ -146,6 +146,9 @@ static char *automount_fullpath(struct d }spin_unlock (&tcon->tc_lock); +if (unlikely (!page)) +return ERR_PTR (-ENOMEM ); + s =dentry_path_raw (dentry, page,PATH_MAX );if (IS_ERR (s))return s;
Greg Kroah-Hartman
maintainerPATCH 177/592 Drivers: hv: Allocate interrupt and monitor pages aligned to system page boundary
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
commit 09eea7ad0b8e973dcf5ed49902838e5d68177f8e upstream.
There are use cases that interrupt and monitor pages are mapped to user-mode through UIO, so they need to be system page aligned. Some Hyper-V allocation APIs introduced earlier broke those requirements.
Fix this by using page allocation functions directly for interrupt and monitor pages.
Message-ID: <[email protected]>
--- drivers/hv/connection.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/hv/connection.c +17 -6
@@ -207,10 +207,19 @@ int vmbus_connect(void)mutex_init (&vmbus_connection.channel_mutex);/* +* The following Hyper-V interrupt and monitor pages can be used by +* UIO for mapping to user-space, so they should always be allocated on +* system page boundaries. The system page size must be >= the Hyper-V +* page size. +*/ +BUILD_BUG_ON (PAGE_SIZE <HV_HYP_PAGE_SIZE ); + +/* * Setup the vmbus event connection for channel interrupt * abstraction stuff */ - vmbus_connection.int_page =hv_alloc_hyperv_zeroed_page (); + vmbus_connection.int_page = + (void *)__get_free_page (GFP_KERNEL | __GFP_ZERO);if (vmbus_connection.int_page ==NULL ) { ret = -ENOMEM ; goto cleanup;
@@ -225,8 +234,8 @@ int vmbus_connect(void)* Setup the monitor notification facility. The 1st page for * parent->child and the 2nd page for child->parent */ - vmbus_connection.monitor_pages[0 ] =hv_alloc_hyperv_page (); - vmbus_connection.monitor_pages[1 ] =hv_alloc_hyperv_page (); + vmbus_connection.monitor_pages[0 ] = (void *)__get_free_page (GFP_KERNEL ); + vmbus_connection.monitor_pages[1 ] = (void *)__get_free_page (GFP_KERNEL );if ((vmbus_connection.monitor_pages[0 ] ==NULL ) || (vmbus_connection.monitor_pages[1 ] ==NULL )) { ret = -ENOMEM ;
@@ -342,21 +351,23 @@ void vmbus_disconnect(void)destroy_workqueue (vmbus_connection.work_queue);if (vmbus_connection.int_page) { -hv_free_hyperv_page (vmbus_connection.int_page); +free_page ((unsigned long )vmbus_connection.int_page); vmbus_connection.int_page =NULL ; }if (vmbus_connection.monitor_pages[0 ]) {if (!set_memory_encrypted ( (unsigned long )vmbus_connection.monitor_pages[0 ],1 )) -hv_free_hyperv_page (vmbus_connection.monitor_pages[0 ]); +free_page ((unsigned long ) + vmbus_connection.monitor_pages[0 ]); vmbus_connection.monitor_pages[0 ] =NULL ; }if (vmbus_connection.monitor_pages[1 ]) {if (!set_memory_encrypted ( (unsigned long )vmbus_connection.monitor_pages[1 ],1 )) -hv_free_hyperv_page (vmbus_connection.monitor_pages[1 ]); +free_page ((unsigned long ) + vmbus_connection.monitor_pages[1 ]); vmbus_connection.monitor_pages[1 ] =NULL ; } }
Greg Kroah-Hartman
maintainerPATCH 178/592 uio_hv_generic: Use correct size for interrupt and monitor pages
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
commit c951ab8fd3589cf6991ed4111d2130816f2e3ac2 upstream.
Interrupt and monitor pages should be in Hyper-V page size (4k bytes). This can be different from the system page size.
This size is read and used by the user-mode program to determine the mapped data region. An example of such user-mode program is the VMBus driver in DPDK.
Message-ID: <[email protected]>
--- drivers/uio/uio_hv_generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/uio/uio_hv_generic.c +2 -2
@@ -274,13 +274,13 @@ hv_uio_probe(struct hv_device *dev, pdata->info.mem[INT_PAGE_MAP ].name ="int_page" ; pdata->info.mem[INT_PAGE_MAP ].addr = (uintptr_t )vmbus_connection.int_page; - pdata->info.mem[INT_PAGE_MAP ].size =PAGE_SIZE ; + pdata->info.mem[INT_PAGE_MAP ].size =HV_HYP_PAGE_SIZE ; pdata->info.mem[INT_PAGE_MAP ].memtype =UIO_MEM_LOGICAL ; pdata->info.mem[MON_PAGE_MAP ].name ="monitor_page" ; pdata->info.mem[MON_PAGE_MAP ].addr = (uintptr_t )vmbus_connection.monitor_pages[1 ]; - pdata->info.mem[MON_PAGE_MAP ].size =PAGE_SIZE ; + pdata->info.mem[MON_PAGE_MAP ].size =HV_HYP_PAGE_SIZE ; pdata->info.mem[MON_PAGE_MAP ].memtype =UIO_MEM_LOGICAL ;if (channel->device_id ==HV_NIC ) {
Greg Kroah-Hartman
maintainerPATCH 179/592 uio_hv_generic: Align ring size to system page
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
commit 0315fef2aff9f251ddef8a4b53db9187429c3553 upstream.
Following the ring header, the ring data should align to system page boundary. Adjust the size if necessary.
Message-ID: <[email protected]>
--- drivers/uio/uio_hv_generic.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/uio/uio_hv_generic.c +3 -0
@@ -243,6 +243,9 @@ hv_uio_probe(struct hv_device *dev,if (!ring_size) ring_size =SZ_2M ; +/* Adjust ring size if necessary to have it page aligned */ + ring_size =VMBUS_RING_SIZE (ring_size); + pdata =devm_kzalloc (&dev->device,sizeof (*pdata),GFP_KERNEL );if (!pdata)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 180/592 PCI: cadence-ep: Correct PBA offset in .set_msix() callback
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit c8bcb01352a86bc5592403904109c22b66bd916e upstream.
While cdns_pcie_ep_set_msix() writes the Table Size field correctly (N-1), the calculation of the PBA offset is wrong because it calculates space for (N-1) entries instead of N.
This results in the following QEMU error when using PCI passthrough on a device which relies on the PCI endpoint subsystem:
failed to add PCI capability 0x11[0x50]@0xb0: table & pba overlap, or they don't fit in BARs, or don't align
Fix the calculation of PBA offset in the MSI-X capability.
[bhelgaas: more specific subject and commit log]
--- drivers/pci/controller/cadence/pcie-cadence-ep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/cadence/pcie-cadence-ep.c +3 -2
@@ -292,13 +292,14 @@ static int cdns_pcie_ep_set_msix(structstruct cdns_pcie *pcie = &ep->pcie;u32 cap =CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET ;u32 val, reg; +u16 actual_interrupts = interrupts +1 ; fn =cdns_pcie_get_fn_from_vfn (pcie, fn, vfn); reg = cap +PCI_MSIX_FLAGS ; val =cdns_pcie_ep_fn_readw (pcie, fn, reg); val &= ~PCI_MSIX_FLAGS_QSIZE ; - val |= interrupts; + val |= interrupts;/* 0's based value */ cdns_pcie_ep_fn_writew (pcie, fn, reg, val);/* Set MSI-X BAR and offset */
@@ -308,7 +309,7 @@ static int cdns_pcie_ep_set_msix(struct/* Set PBA BAR and offset. BAR must match MSI-X BAR */ reg = cap +PCI_MSIX_PBA ; - val = (offset + (interrupts *PCI_MSIX_ENTRY_SIZE )) | bir; + val = (offset + (actual_interrupts *PCI_MSIX_ENTRY_SIZE )) | bir;cdns_pcie_ep_fn_writel (pcie, fn, reg, val);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 181/592 PCI: dwc: ep: Correct PBA offset in .set_msix() callback
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 810276362bad172d063d1f6be1cc2cb425b90103 upstream.
While dw_pcie_ep_set_msix() writes the Table Size field correctly (N-1), the calculation of the PBA offset is wrong because it calculates space for (N-1) entries instead of N.
This results in the following QEMU error when using PCI passthrough on a device which relies on the PCI endpoint subsystem:
failed to add PCI capability 0x11[0x50]@0xb0: table & pba overlap, or they don't fit in BARs, or don't align
Fix the calculation of PBA offset in the MSI-X capability.
[bhelgaas: more specific subject and commit log]
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +3 -2
@@ -585,6 +585,7 @@ static int dw_pcie_ep_set_msix(struct pcstruct dw_pcie *pci =to_dw_pcie_from_ep (ep);struct dw_pcie_ep_func *ep_func;u32 val, reg; +u16 actual_interrupts = interrupts +1 ; ep_func =dw_pcie_ep_get_func_from_ep (ep, func_no);if (!ep_func || !ep_func->msix_cap)
@@ -595,7 +596,7 @@ static int dw_pcie_ep_set_msix(struct pc reg = ep_func->msix_cap +PCI_MSIX_FLAGS ; val =dw_pcie_ep_readw_dbi (ep, func_no, reg); val &= ~PCI_MSIX_FLAGS_QSIZE ; - val |= interrupts; + val |= interrupts;/* 0's based value */ dw_pcie_writew_dbi (pci, reg, val); reg = ep_func->msix_cap +PCI_MSIX_TABLE ;
@@ -603,7 +604,7 @@ static int dw_pcie_ep_set_msix(struct pcdw_pcie_ep_writel_dbi (ep, func_no, reg, val); reg = ep_func->msix_cap +PCI_MSIX_PBA ; - val = (offset + (interrupts *PCI_MSIX_ENTRY_SIZE )) | bir; + val = (offset + (actual_interrupts *PCI_MSIX_ENTRY_SIZE )) | bir;dw_pcie_ep_writel_dbi (ep, func_no, reg, val);dw_pcie_dbi_ro_wr_dis (pci);
Greg Kroah-Hartman
maintainerPATCH 182/592 PCI: Add ACS quirk for Loongson PCIe
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 1f3303aa92e15fa273779acac2d0023609de30f1 upstream.
Loongson PCIe Root Ports don't advertise an ACS capability, but they do not allow peer-to-peer transactions between Root Ports. Add an ACS quirk so each Root Port can be in a separate IOMMU group.
--- drivers/pci/quirks.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/pci/quirks.c +23 -0
@@ -4995,6 +4995,18 @@ static int pci_quirk_brcm_acs(struct pci PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); } +static int pci_quirk_loongson_acs (struct pci_dev *dev,u16 acs_flags) +{ +/* +* Loongson PCIe Root Ports don't advertise an ACS capability, but +* they do not allow peer-to-peer transactions between Root Ports. +* Allow each Root Port to be in a separate IOMMU group by masking +* SV/RR/CR/UF bits. +*/ +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); +} +/* * Wangxun 40G/25G/10G/1G NICs have no ACS capability, but on * multi-function devices, the hardware isolates the functions by
@@ -5128,6 +5140,17 @@ static const struct pci_dev_acs_enabled { PCI_VENDOR_ID_BROADCOM, 0x1762, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0x1763, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, +/* Loongson PCIe Root Ports */ + { PCI_VENDOR_ID_LOONGSON, 0x3C09, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x3C19, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x3C29, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x7A09, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x7A19, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x7A29, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x7A39, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x7A49, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x7A59, pci_quirk_loongson_acs }, + { PCI_VENDOR_ID_LOONGSON, 0x7A69, pci_quirk_loongson_acs },/* Amazon Annapurna Labs */ { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs }, /* Zhaoxin multi-function devices */
Greg Kroah-Hartman
maintainerPATCH 183/592 PCI: Fix lock symmetry in pci_slot_unlock()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilpo Järvinen <[email protected]>
commit f3efb9569b4a21354ef2caf7ab0608a3e14cc6e4 upstream.
The commit a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()") made the lock function to call depend on dev->subordinate but left pci_slot_unlock() unmodified creating locking asymmetry compared with pci_slot_lock().
Because of the asymmetric lock handling, the same bridge device is unlocked twice. First pci_bus_unlock() unlocks bus->self and then pci_slot_unlock() will unconditionally unlock the same bridge device.
Move pci_dev_unlock() inside an else branch to match the logic in pci_slot_lock().
--- drivers/pci/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/pci.c +2 -1
@@ -5538,7 +5538,8 @@ static void pci_slot_unlock(struct pci_scontinue ;if (dev->subordinate)pci_bus_unlock (dev->subordinate); -pci_dev_unlock (dev); +else +pci_dev_unlock (dev); } }
Greg Kroah-Hartman
maintainerPATCH 184/592 PCI: dw-rockchip: Remove PCIE_L0S_ENTRY check from rockchip_pcie_link_up()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
commit 7d9b5d6115532cf90a789ed6afd3f4c70ebbd827 upstream.
rockchip_pcie_link_up() currently has two issues:
1. Value 0x11 of PCIE_L0S_ENTRY corresponds to L0 state, not L0S. So the naming is wrong from the very beginning.
2. Checking for value 0x11 treats other states like L0S and L1 as link down, which is wrong.
Hence, remove the PCIE_L0S_ENTRY check and also its definition. This allows adding ASPM support in the successive commits.
--- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-dw-rockchip.c +1 -3
@@ -44,7 +44,6 @@#define PCIE_LINKUP (PCIE_SMLH_LINKUP | PCIE_RDLH_LINKUP)#define PCIE_RDLH_LINK_UP_CHGED BIT(1)#define PCIE_LINK_REQ_RST_NOT_INT BIT(2) -#define PCIE_L0S_ENTRY 0x11#define PCIE_CLIENT_GENERAL_CONTROL 0x0#define PCIE_CLIENT_INTR_STATUS_LEGACY 0x8#define PCIE_CLIENT_INTR_MASK_LEGACY 0x1c
@@ -177,8 +176,7 @@ static int rockchip_pcie_link_up(structstruct rockchip_pcie *rockchip =to_rockchip_pcie (pci);u32 val =rockchip_pcie_get_ltssm (rockchip); -if ((val &PCIE_LINKUP ) ==PCIE_LINKUP && - (val &PCIE_LTSSM_STATUS_MASK ) ==PCIE_L0S_ENTRY ) +if ((val &PCIE_LINKUP ) ==PCIE_LINKUP )return 1 ;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 185/592 PCI: apple: Set only available ports up
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janne Grunau <[email protected]>
commit 751bec089c4eed486578994abd2c5395f08d0302 upstream.
Iterating over disabled ports results in of_irq_parse_raw() parsing the wrong "interrupt-map" entries, as it takes the status of the node into account.
This became apparent after disabling unused PCIe ports in the Apple Silicon device trees instead of deleting them.
Switching from for_each_child_of_node_scoped() to for_each_available_child_of_node_scoped() solves this issue.
--- drivers/pci/controller/pcie-apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-apple.c +1 -1
@@ -754,7 +754,7 @@ static int apple_pcie_init(struct pci_coif (ret)return ret; -for_each_child_of_node_scoped (dev->of_node, of_port) { +for_each_available_child_of_node_scoped (dev->of_node, of_port) { ret =apple_pcie_setup_port (pcie, of_port);if (ret) {dev_err (pcie->dev,"Port %pOF setup fail: %d\n" , of_port, ret);
Greg Kroah-Hartman
maintainerPATCH 186/592 PCI: dw-rockchip: Fix PHY function call sequence in rockchip_pcie_phy_deinit()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diederik de Haas <[email protected]>
commit 286ed198b899739862456f451eda884558526a9d upstream.
The documentation for the phy_power_off() function explicitly says that it must be called before phy_exit().
Hence, follow the same rule in rockchip_pcie_phy_deinit().
--- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-dw-rockchip.c +1 -1
@@ -408,8 +408,8 @@ static int rockchip_pcie_phy_init(structstatic void rockchip_pcie_phy_deinit (struct rockchip_pcie *rockchip) { -phy_exit (rockchip->phy);phy_power_off (rockchip->phy); +phy_exit (rockchip->phy); }static const struct dw_pcie_ops dw_pcie_ops = {
Greg Kroah-Hartman
maintainerPATCH 187/592 hv_netvsc: fix potential deadlock in netvsc_vf_setxdp()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saurabh Sengar <[email protected]>
commit 3ec523304976648b45a3eef045e97d17122ff1b2 upstream.
The MANA driver's probe registers netdevice via the following call chain:
mana_probe()
register_netdev()
register_netdevice()
register_netdevice() calls notifier callback for netvsc driver, holding the netdev mutex via netdev_lock_ops().
Further this netvsc notifier callback end up attempting to acquire the same lock again in dev_xdp_propagate() leading to deadlock.
netvsc_netdev_event()
netvsc_vf_setxdp()
dev_xdp_propagate()
This deadlock was not observed so far because net_shaper_ops was never set, and thus the lock was effectively a no-op in this case. Fix this by using netif_xdp_propagate() instead of dev_xdp_propagate() to avoid recursive locking in this path.
And, since no deadlock is observed on the other path which is via netvsc_probe, add the lock exclusivly for that path.
Also, clean up the unregistration path by removing the unnecessary call to netvsc_vf_setxdp(), since unregister_netdevice_many_notify() already performs this cleanup via dev_xdp_uninstall().
--- drivers/net/hyperv/netvsc_bpf.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 4 ++-- net/core/dev.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/hyperv/netvsc_bpf.c +1 -1
@@ -183,7 +183,7 @@ int netvsc_vf_setxdp(struct net_device * xdp.command =XDP_SETUP_PROG ; xdp.prog = prog; - ret =dev_xdp_propagate (vf_netdev, &xdp); + ret =netif_xdp_propagate (vf_netdev, &xdp);if (ret && prog)bpf_prog_put (prog);
drivers/net/hyperv/netvsc_drv.c +2 -2
@@ -2462,8 +2462,6 @@ static int netvsc_unregister_vf(struct nnetdev_info (ndev,"VF unregistering: %s\n" , vf_netdev->name); -netvsc_vf_setxdp (vf_netdev,NULL ); -reinit_completion (&net_device_ctx->vf_add);netdev_rx_handler_unregister (vf_netdev);netdev_upper_dev_unlink (vf_netdev, ndev);
@@ -2631,7 +2629,9 @@ static int netvsc_probe(struct hv_devicecontinue ;netvsc_prepare_bonding (vf_netdev); +netdev_lock_ops (vf_netdev);netvsc_register_vf (vf_netdev,VF_REG_IN_PROBE ); +netdev_unlock_ops (vf_netdev);__netvsc_vf_setup (net, vf_netdev);break ; }
net/core/dev.c +1 -0
@@ -9863,6 +9863,7 @@ int netif_xdp_propagate(struct net_devicreturn dev->netdev_ops->ndo_bpf (dev, bpf); } +EXPORT_SYMBOL_GPL (netif_xdp_propagate);u32 dev_xdp_prog_id (struct net_device *dev,enum bpf_xdp_mode mode) {
Greg Kroah-Hartman
maintainerPATCH 188/592 iio: accel: fxls8962af: Fix temperature scan element sign
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Nyekjaer <[email protected]>
commit 9c78317b42e7c32523c91099859bc4721e9f75dd upstream.
Mark the temperature element signed, data read from the TEMP_OUT register is in two's complement format.
This will avoid the temperature being mishandled and miss displayed.
--- drivers/iio/accel/fxls8962af-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/accel/fxls8962af-core.c +1 -0
@@ -739,6 +739,7 @@ static const struct iio_event_spec fxls8BIT (IIO_CHAN_INFO_OFFSET ),\ .scan_index = -1, \ .scan_type = { \ + .sign ='s' , \ .realbits =8 , \ .storagebits =8 , \ }, \
Greg Kroah-Hartman
maintainerPATCH 189/592 iio: accel: fxls8962af: Fix temperature calculation
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Nyekjaer <[email protected]>
commit 16038474e3a0263572f36326ef85057aaf341814 upstream.
According to spec temperature should be returned in milli degrees Celsius. Add in_temp_scale to calculate from Celsius to milli Celsius.
--- drivers/iio/accel/fxls8962af-core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +12 -2
@@ -23,6 +23,7 @@#include <linux/regulator/consumer.h> #include <linux/regmap.h> #include <linux/types.h> +#include <linux/units.h> #include <linux/iio/buffer.h> #include <linux/iio/events.h>
@@ -439,8 +440,16 @@ static int fxls8962af_read_raw(struct ii *val =FXLS8962AF_TEMP_CENTER_VAL ;return IIO_VAL_INT ;case IIO_CHAN_INFO_SCALE : - *val =0 ; -return fxls8962af_read_full_scale (data, val2); +switch (chan->type) { +case IIO_TEMP : + *val =MILLIDEGREE_PER_DEGREE ; +return IIO_VAL_INT ; +case IIO_ACCEL : + *val =0 ; +return fxls8962af_read_full_scale (data, val2); +default : +return -EINVAL ; + }case IIO_CHAN_INFO_SAMP_FREQ :return fxls8962af_read_samp_freq (data, val, val2);default :
@@ -736,6 +745,7 @@ static const struct iio_event_spec fxls8 .type = IIO_TEMP, \ .address = FXLS8962AF_TEMP_OUT, \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE) | \ BIT(IIO_CHAN_INFO_OFFSET),\ .scan_index = -1, \ .scan_type = { \
Greg Kroah-Hartman
maintainerPATCH 190/592 accel/ivpu: Improve buffer object logging
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit a01e93ee44f7ed76f872d0ede82f8d31bf0a048a upstream.
- Fix missing alloc log when drm_gem_handle_create() fails in drm_vma_node_allow() and open callback is not called
- Add ivpu_bo->ctx_id that enables to log the actual context id instead of using 0 as default
- Add couple WARNs and errors so we can catch more memory corruption issues
--- drivers/accel/ivpu/ivpu_gem.c | 25 +++++++++++++++++-------- drivers/accel/ivpu/ivpu_gem.h | 1 + 2 files changed, 18 insertions(+), 8 deletions(-)
drivers/accel/ivpu/ivpu_gem.c +17 -8
@@ -28,7 +28,7 @@ static inline void ivpu_dbg_bo(struct iv {ivpu_dbg (vdev,BO ,"%6s: bo %8p vpu_addr %9llx size %8zu ctx %d has_pages %d dma_mapped %d mmu_mapped %d wc %d imported %d\n" , - action, bo, bo->vpu_addr,ivpu_bo_size (bo), bo->ctx ? bo->ctx->id :0 , + action, bo, bo->vpu_addr,ivpu_bo_size (bo), bo->ctx_id, (bool )bo->base.pages, (bool )bo->base.sgt, bo->mmu_mapped, bo->base.map_wc, (bool )bo->base.base.import_attach); }
@@ -94,8 +94,6 @@ ivpu_bo_alloc_vpu_addr(struct ivpu_bo *bivpu_err (vdev,"Failed to add BO to context %u: %d\n" , ctx->id, ret); } -ivpu_dbg_bo (vdev, bo,"alloc" ); -mutex_unlock (&bo->lock);drm_dev_exit (idx);
@@ -215,7 +213,7 @@ fail_detach:return ERR_PTR (ret); } -static struct ivpu_bo *ivpu_bo_alloc (struct ivpu_device *vdev,u64 size,u32 flags) +static struct ivpu_bo *ivpu_bo_alloc (struct ivpu_device *vdev,u64 size,u32 flags,u32 ctx_id) {struct drm_gem_shmem_object *shmem;struct ivpu_bo *bo;
@@ -233,6 +231,7 @@ static struct ivpu_bo *ivpu_bo_alloc(strreturn ERR_CAST (shmem); bo =to_ivpu_bo (&shmem->base); + bo->ctx_id = ctx_id; bo->base.map_wc = flags &DRM_IVPU_BO_WC ; bo->flags = flags;
@@ -240,6 +239,8 @@ static struct ivpu_bo *ivpu_bo_alloc(strlist_add_tail (&bo->bo_list_node, &vdev->bo_list);mutex_unlock (&vdev->bo_list_lock); +ivpu_dbg_bo (vdev, bo,"alloc" ); +return bo; }
@@ -278,8 +279,13 @@ static void ivpu_gem_bo_free(struct drm_mutex_unlock (&vdev->bo_list_lock);drm_WARN_ON (&vdev->drm, !dma_resv_test_signaled (obj->resv,DMA_RESV_USAGE_READ )); +drm_WARN_ON (&vdev->drm,ivpu_bo_size (bo) ==0 ); +drm_WARN_ON (&vdev->drm, bo->base.vaddr);ivpu_bo_unbind_locked (bo); +drm_WARN_ON (&vdev->drm, bo->mmu_mapped); +drm_WARN_ON (&vdev->drm, bo->ctx); +mutex_destroy (&bo->lock);drm_WARN_ON (obj->dev, bo->base.pages_use_count >1 );
@@ -314,7 +320,7 @@ int ivpu_bo_create_ioctl(struct drm_deviif (size ==0 )return -EINVAL ; - bo =ivpu_bo_alloc (vdev, size, args->flags); + bo =ivpu_bo_alloc (vdev, size, args->flags, file_priv->ctx.id);if (IS_ERR (bo)) {ivpu_err (vdev,"Failed to allocate BO: %pe (ctx %u size %llu flags 0x%x)" , bo, file_priv->ctx.id, args->size, args->flags);
@@ -322,7 +328,10 @@ int ivpu_bo_create_ioctl(struct drm_devi } ret =drm_gem_handle_create (file, &bo->base.base, &args->handle); -if (!ret) +if (ret) +ivpu_err (vdev,"Failed to create handle for BO: %pe (ctx %u size %llu flags 0x%x)" , + bo, file_priv->ctx.id, args->size, args->flags); +else args->vpu_addr = bo->vpu_addr;drm_gem_object_put (&bo->base.base);
@@ -345,7 +354,7 @@ ivpu_bo_create(struct ivpu_device *vdev,drm_WARN_ON (&vdev->drm, !PAGE_ALIGNED (range->end));drm_WARN_ON (&vdev->drm, !PAGE_ALIGNED (size)); - bo =ivpu_bo_alloc (vdev, size, flags); + bo =ivpu_bo_alloc (vdev, size, flags,IVPU_GLOBAL_CONTEXT_MMU_SSID );if (IS_ERR (bo)) {ivpu_err (vdev,"Failed to allocate BO: %pe (vpu_addr 0x%llx size %llu flags 0x%x)" , bo, range->start, size, flags);
@@ -452,7 +461,7 @@ static void ivpu_bo_print_info(struct ivmutex_lock (&bo->lock);drm_printf (p,"%-9p %-3u 0x%-12llx %-10lu 0x%-8x %-4u" , - bo, bo->ctx ? bo->ctx->id :0 , bo->vpu_addr, bo->base.base.size, + bo, bo->ctx_id, bo->vpu_addr, bo->base.base.size, bo->flags,kref_read (&bo->base.base.refcount));if (bo->base.pages)
drivers/accel/ivpu/ivpu_gem.h +1 -0
@@ -21,6 +21,7 @@ struct ivpu_bo {u64 vpu_addr;u32 flags;u32 job_status;/* Valid only for command buffer */ +u32 ctx_id;bool mmu_mapped; };
Greg Kroah-Hartman
maintainerPATCH 191/592 accel/ivpu: Use firmware names from upstream repo
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 1c2c0e29f24360b3130c005a3c261cb8c7b363c6 upstream.
Use FW names from linux-firmware repo instead of deprecated ones. The vpu_37xx.bin style names were never released and were only used for internal testing, so it is safe to remove them.
--- drivers/accel/ivpu/ivpu_fw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/accel/ivpu/ivpu_fw.c +6 -6
@@ -55,18 +55,18 @@ static struct {int gen;const char *name; } fw_names[] = { - { IVPU_HW_IP_37XX, "vpu_37xx.bin" }, + { IVPU_HW_IP_37XX, "intel/vpu/vpu_37xx_v1.bin" }, { IVPU_HW_IP_37XX, "intel/vpu/vpu_37xx_v0.0.bin" }, - { IVPU_HW_IP_40XX, "vpu_40xx.bin" }, + { IVPU_HW_IP_40XX, "intel/vpu/vpu_40xx_v1.bin" }, { IVPU_HW_IP_40XX, "intel/vpu/vpu_40xx_v0.0.bin" }, - { IVPU_HW_IP_50XX, "vpu_50xx.bin" }, + { IVPU_HW_IP_50XX, "intel/vpu/vpu_50xx_v1.bin" }, { IVPU_HW_IP_50XX, "intel/vpu/vpu_50xx_v0.0.bin" }, }; /* Production fw_names from the table above */ -MODULE_FIRMWARE("intel/vpu/vpu_37xx_v0.0.bin"); -MODULE_FIRMWARE("intel/vpu/vpu_40xx_v0.0.bin"); -MODULE_FIRMWARE("intel/vpu/vpu_50xx_v0.0.bin"); +MODULE_FIRMWARE("intel/vpu/vpu_37xx_v1.bin"); +MODULE_FIRMWARE("intel/vpu/vpu_40xx_v1.bin"); +MODULE_FIRMWARE("intel/vpu/vpu_50xx_v1.bin"); static int ivpu_fw_request(struct ivpu_device *vdev) {
Greg Kroah-Hartman
maintainerPATCH 192/592 accel/ivpu: Trigger device recovery on engine reset/resume failure
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Wachowski <[email protected]>
commit a47e36dc5d90dc664cac87304c17d50f1595d634 upstream.
Trigger full device recovery when the driver fails to restore device state via engine reset and resume operations. This is necessary because, even if submissions from a faulty context are blocked, the NPU may still process previously submitted faulty jobs if the engine reset fails to abort them. Such jobs can continue to generate faults and occupy device resources. When engine reset is ineffective, the only way to recover is to perform a full device recovery.
--- drivers/accel/ivpu/ivpu_job.c | 6 ++++-- drivers/accel/ivpu/ivpu_jsm_msg.c | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/accel/ivpu/ivpu_job.c +4 -2
@@ -986,7 +986,8 @@ void ivpu_context_abort_work_fn(struct wreturn ;if (vdev->fw->sched_mode ==VPU_SCHEDULING_MODE_HW ) -ivpu_jsm_reset_engine (vdev,0 ); +if (ivpu_jsm_reset_engine (vdev,0 )) +return ;mutex_lock (&vdev->context_list_lock);xa_for_each (&vdev->context_xa, ctx_id, file_priv) {
@@ -1009,7 +1010,8 @@ void ivpu_context_abort_work_fn(struct wif (vdev->fw->sched_mode !=VPU_SCHEDULING_MODE_HW ) goto runtime_put; -ivpu_jsm_hws_resume_engine (vdev,0 ); +if (ivpu_jsm_hws_resume_engine (vdev,0 )) +return ;/* * In hardware scheduling mode NPU already has stopped processing jobs * and won't send us any further notifications, thus we have to free job related resources
drivers/accel/ivpu/ivpu_jsm_msg.c +7 -2
@@ -7,6 +7,7 @@#include "ivpu_hw.h" #include "ivpu_ipc.h" #include "ivpu_jsm_msg.h" +#include "ivpu_pm.h" #include "vpu_jsm_api.h" const char *ivpu_jsm_msg_type_to_str (enum vpu_ipc_msg_type type)
@@ -163,8 +164,10 @@ int ivpu_jsm_reset_engine(struct ivpu_de ret =ivpu_ipc_send_receive (vdev, &req,VPU_JSM_MSG_ENGINE_RESET_DONE , &resp,VPU_IPC_CHAN_ASYNC_CMD , vdev->timeout.jsm); -if (ret) +if (ret) {ivpu_err_ratelimited (vdev,"Failed to reset engine %d: %d\n" , engine, ret); +ivpu_pm_trigger_recovery (vdev,"Engine reset failed" ); + }return ret; }
@@ -354,8 +357,10 @@ int ivpu_jsm_hws_resume_engine(struct iv ret =ivpu_ipc_send_receive (vdev, &req,VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE , &resp,VPU_IPC_CHAN_ASYNC_CMD , vdev->timeout.jsm); -if (ret) +if (ret) {ivpu_err_ratelimited (vdev,"Failed to resume engine %d: %d\n" , engine, ret); +ivpu_pm_trigger_recovery (vdev,"Engine resume failed" ); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 193/592 accel/ivpu: Use dma_resv_lock() instead of a custom mutex
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 98d3f772ca7d6822bdfc8c960f5f909574db97c9 upstream.
This fixes a potential race conditions in:
- ivpu_bo_unbind_locked() where we modified the shmem->sgt without holding the dma_resv_lock().
- ivpu_bo_print_info() where we read the shmem->pages without holding the dma_resv_lock().
Using dma_resv_lock() also protects against future syncronisation issues that may arise when accessing drm_gem_shmem_object or drm_gem_object members.
--- drivers/accel/ivpu/ivpu_gem.c | 63 ++++++++++++++++++++++-------------------- drivers/accel/ivpu/ivpu_gem.h | 1 2 files changed, 34 insertions(+), 30 deletions(-)
drivers/accel/ivpu/ivpu_gem.c +34 -29
@@ -33,6 +33,16 @@ static inline void ivpu_dbg_bo(struct iv (bool)bo->base.base.import_attach); } +static inline int ivpu_bo_lock (struct ivpu_bo *bo) +{ +return dma_resv_lock (bo->base.base.resv,NULL ); +} + +static inline void ivpu_bo_unlock (struct ivpu_bo *bo) +{ +dma_resv_unlock (bo->base.base.resv); +} +/* * ivpu_bo_pin() - pin the backing physical pages and map them to VPU. *
@@ -43,22 +53,22 @@ static inline void ivpu_dbg_bo(struct ivint __must_check ivpu_bo_pin (struct ivpu_bo *bo) {struct ivpu_device *vdev =ivpu_bo_to_vdev (bo); +struct sg_table *sgt;int ret =0 ; -mutex_lock (&bo->lock); -ivpu_dbg_bo (vdev, bo,"pin" ); -drm_WARN_ON (&vdev->drm, !bo->ctx); -if (!bo->mmu_mapped) { -struct sg_table *sgt =drm_gem_shmem_get_pages_sgt (&bo->base); + sgt =drm_gem_shmem_get_pages_sgt (&bo->base); +if (IS_ERR (sgt)) { + ret =PTR_ERR (sgt); +ivpu_err (vdev,"Failed to map BO in IOMMU: %d\n" , ret); +return ret; + } -if (IS_ERR (sgt)) { - ret =PTR_ERR (sgt); -ivpu_err (vdev,"Failed to map BO in IOMMU: %d\n" , ret); - goto unlock; - } +ivpu_bo_lock (bo); +if (!bo->mmu_mapped) { +drm_WARN_ON (&vdev->drm, !bo->ctx); ret =ivpu_mmu_context_map_sgt (vdev, bo->ctx, bo->vpu_addr, sgt,ivpu_bo_is_snooped (bo));if (ret) {
@@ -69,7 +79,7 @@ int __must_check ivpu_bo_pin(struct ivpu } unlock: -mutex_unlock (&bo->lock); +ivpu_bo_unlock (bo);return ret; }
@@ -84,7 +94,7 @@ ivpu_bo_alloc_vpu_addr(struct ivpu_bo *bif (!drm_dev_enter (&vdev->drm, &idx))return -ENODEV ; -mutex_lock (&bo->lock); +ivpu_bo_lock (bo); ret =ivpu_mmu_context_insert_node (ctx, range,ivpu_bo_size (bo), &bo->mm_node);if (!ret) {
@@ -94,7 +104,7 @@ ivpu_bo_alloc_vpu_addr(struct ivpu_bo *bivpu_err (vdev,"Failed to add BO to context %u: %d\n" , ctx->id, ret); } -mutex_unlock (&bo->lock); +ivpu_bo_unlock (bo);drm_dev_exit (idx);
@@ -105,7 +115,7 @@ static void ivpu_bo_unbind_locked(struct {struct ivpu_device *vdev =ivpu_bo_to_vdev (bo); -lockdep_assert (lockdep_is_held (&bo->lock) || !kref_read (&bo->base.base.refcount)); +lockdep_assert (dma_resv_held (bo->base.base.resv) || !kref_read (&bo->base.base.refcount));if (bo->mmu_mapped) {drm_WARN_ON (&vdev->drm, !bo->ctx);
@@ -123,14 +133,12 @@ static void ivpu_bo_unbind_locked(structif (bo->base.base.import_attach)return ; -dma_resv_lock (bo->base.base.resv,NULL );if (bo->base.sgt) {dma_unmap_sgtable (vdev->drm.dev, bo->base.sgt,DMA_BIDIRECTIONAL ,0 );sg_free_table (bo->base.sgt);kfree (bo->base.sgt); bo->base.sgt =NULL ; } -dma_resv_unlock (bo->base.base.resv); }void ivpu_bo_unbind_all_bos_from_context (struct ivpu_device *vdev,struct ivpu_mmu_context *ctx)
@@ -142,12 +150,12 @@ void ivpu_bo_unbind_all_bos_from_contextmutex_lock (&vdev->bo_list_lock);list_for_each_entry (bo, &vdev->bo_list, bo_list_node) { -mutex_lock (&bo->lock); +ivpu_bo_lock (bo);if (bo->ctx == ctx) {ivpu_dbg_bo (vdev, bo,"unbind" );ivpu_bo_unbind_locked (bo); } -mutex_unlock (&bo->lock); +ivpu_bo_unlock (bo); }mutex_unlock (&vdev->bo_list_lock); }
@@ -167,7 +175,6 @@ struct drm_gem_object *ivpu_gem_create_o bo->base.pages_mark_dirty_on_put = true;/* VPU can dirty a BO anytime */ INIT_LIST_HEAD (&bo->bo_list_node); -mutex_init (&bo->lock);return &bo->base.base; }
@@ -286,8 +293,6 @@ static void ivpu_gem_bo_free(struct drm_drm_WARN_ON (&vdev->drm, bo->mmu_mapped);drm_WARN_ON (&vdev->drm, bo->ctx); -mutex_destroy (&bo->lock); -drm_WARN_ON (obj->dev, bo->base.pages_use_count >1 );drm_gem_shmem_free (&bo->base); }
@@ -370,9 +375,9 @@ ivpu_bo_create(struct ivpu_device *vdev, goto err_put;if (flags &DRM_IVPU_BO_MAPPABLE ) { -dma_resv_lock (bo->base.base.resv,NULL ); +ivpu_bo_lock (bo); ret =drm_gem_shmem_vmap (&bo->base, &map); -dma_resv_unlock (bo->base.base.resv); +ivpu_bo_unlock (bo);if (ret) goto err_put;
@@ -395,9 +400,9 @@ void ivpu_bo_free(struct ivpu_bo *bo)struct iosys_map map =IOSYS_MAP_INIT_VADDR (bo->base.vaddr);if (bo->flags &DRM_IVPU_BO_MAPPABLE ) { -dma_resv_lock (bo->base.base.resv,NULL ); +ivpu_bo_lock (bo);drm_gem_shmem_vunmap (&bo->base, &map); -dma_resv_unlock (bo->base.base.resv); +ivpu_bo_unlock (bo); }drm_gem_object_put (&bo->base.base);
@@ -416,12 +421,12 @@ int ivpu_bo_info_ioctl(struct drm_device bo =to_ivpu_bo (obj); -mutex_lock (&bo->lock); +ivpu_bo_lock (bo); args->flags = bo->flags; args->mmap_offset =drm_vma_node_offset_addr (&obj->vma_node); args->vpu_addr = bo->vpu_addr; args->size = obj->size; -mutex_unlock (&bo->lock); +ivpu_bo_unlock (bo);drm_gem_object_put (obj);return ret;
@@ -458,7 +463,7 @@ int ivpu_bo_wait_ioctl(struct drm_devicestatic void ivpu_bo_print_info (struct ivpu_bo *bo,struct drm_printer *p) { -mutex_lock (&bo->lock); +ivpu_bo_lock (bo); drm_printf(p, "%-9p %-3u 0x%-12llx %-10lu 0x%-8x %-4u", bo, bo->ctx_id, bo->vpu_addr, bo->base.base.size,
@@ -475,7 +480,7 @@ static void ivpu_bo_print_info(struct ivdrm_printf (p,"\n" ); -mutex_unlock (&bo->lock); +ivpu_bo_unlock (bo); }void ivpu_bo_list (struct drm_device *dev,struct drm_printer *p)
drivers/accel/ivpu/ivpu_gem.h +0 -1
@@ -17,7 +17,6 @@ struct ivpu_bo {struct list_head bo_list_node;struct drm_mm_node mm_node; -struct mutex lock;/* Protects: ctx, mmu_mapped, vpu_addr */ u64 vpu_addr;u32 flags;u32 job_status;/* Valid only for command buffer */
Greg Kroah-Hartman
maintainerPATCH 194/592 accel/ivpu: Fix warning in ivpu_gem_bo_free()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 91274fd4ed9ba110b02c53d71d2778b7d13b49ac upstream.
Don't WARN if imported buffers are in use in ivpu_gem_bo_free() as they can be indeed used in the original context/driver.
--- drivers/accel/ivpu/ivpu_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_gem.c +2 -1
@@ -285,7 +285,8 @@ static void ivpu_gem_bo_free(struct drm_list_del (&bo->bo_list_node);mutex_unlock (&vdev->bo_list_lock); -drm_WARN_ON (&vdev->drm, !dma_resv_test_signaled (obj->resv,DMA_RESV_USAGE_READ )); +drm_WARN_ON (&vdev->drm, !drm_gem_is_imported (&bo->base.base) && + !dma_resv_test_signaled (obj->resv,DMA_RESV_USAGE_READ ));drm_WARN_ON (&vdev->drm,ivpu_bo_size (bo) ==0 );drm_WARN_ON (&vdev->drm, bo->base.vaddr);
Greg Kroah-Hartman
maintainerPATCH 195/592 io_uring/net: only consider msg_inq if larger than 1
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit 2c7f023219966777be0687e15b57689894304cd3 upstream.
Currently retry and general validity of msg_inq is gated on it being larger than zero, but it's entirely possible for this to be slightly inaccurate. In particular, if FIN is received, it'll return 1.
Just use larger than 1 as the check. This covers both the FIN case, and at the same time, it doesn't make much sense to retry a recv immediately if there's even just a single 1 byte of valid data in the socket.
Leave the SOCK_NONEMPTY flagging when larger than 0 still, as an app may use that for the final receive.
--- io_uring/net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
io_uring/net.c +2 -2
@@ -840,7 +840,7 @@ static inline bool io_recv_finish(struct* If more is available AND it was a full transfer, retry and * append to this one */ -if (!sr->retry && kmsg->msg.msg_inq >0 && this_ret >0 && +if (!sr->retry && kmsg->msg.msg_inq >1 && this_ret >0 && !iov_iter_count (&kmsg->msg.msg_iter)) { req->cqe.flags = cflags & ~CQE_F_MASK ; sr->len = kmsg->msg.msg_inq;
@@ -1077,7 +1077,7 @@ static int io_recv_buf_select(struct io_ arg.mode |=KBUF_MODE_FREE ; } -if (kmsg->msg.msg_inq >0 ) +if (kmsg->msg.msg_inq >1 ) arg.max_len =min_not_zero (sr->len, kmsg->msg.msg_inq); ret =io_buffers_peek (req, &arg);
Greg Kroah-Hartman
maintainerPATCH 196/592 dummycon: Trigger redraw when switching consoles with deferred takeover
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 03bcbbb3995ba5df43af9aba45334e35f2dfe27b upstream.
Signal vt subsystem to redraw console when switching to dummycon with deferred takeover enabled. Makes the console switch to fbcon and displays the available output.
With deferred takeover enabled, dummycon acts as the placeholder until the first output to the console happens. At that point, fbcon takes over. If the output happens while dummycon is not active, it cannot inform fbcon. This is the case if the vt subsystem runs in graphics mode.
A typical graphical boot starts plymouth, a display manager and a compositor; all while leaving out dummycon. Switching to a text-mode console leaves the console with dummycon even if a getty terminal has been started.
Returning true from dummycon's con_switch helper signals the vt subsystem to redraw the screen. If there's output available dummycon's con_putc{s} helpers trigger deferred takeover of fbcon, which sets a display mode and displays the output. If no output is available, dummycon remains active.
v2:
- make the comment slightly more verbose (Javier)
--- drivers/video/console/dummycon.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/video/console/dummycon.c +13 -5
@@ -85,6 +85,15 @@ static bool dummycon_blank(struct vc_dat/* Redraw, so that we get putc(s) for output done while blanked */ return true; } + +static bool dummycon_switch (struct vc_data *vc) +{ +/* +* Redraw, so that we get putc(s) for output done while switched +* away. Informs deferred consoles to take over the display. +*/ +return true; +}#else static void dummycon_putc (struct vc_data *vc,u16 c,unsigned int y,unsigned int x) { }
@@ -95,6 +104,10 @@ static bool dummycon_blank(struct vc_dat {return false; } +static bool dummycon_switch (struct vc_data *vc) +{ +return false; +}#endif static const char *dummycon_startup (void )
@@ -123,11 +136,6 @@ static bool dummycon_scroll(struct vc_da {return false; } - -static bool dummycon_switch (struct vc_data *vc) -{ -return false; -}/* * The console `switch' structure for the dummy console
Greg Kroah-Hartman
maintainerPATCH 197/592 mm: fix uprobe pte be overwritten when expanding vma
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pu Lehui <[email protected]>
commit 2b12d06c37fd3a394376f42f026a7478d826ed63 upstream.
Patch series "Fix uprobe pte be overwritten when expanding vma".
This patch (of 4):
We encountered a BUG alert triggered by Syzkaller as follows:
BUG: Bad rss-counter state mm:00000000b4a60fca type:MM_ANONPAGES val:1
And we can reproduce it with the following steps:
1. register uprobe on file at zero offset
2. mmap the file at zero offset:
addr1 = mmap(NULL, 2 * 4096, PROT_NONE, MAP_PRIVATE, fd, 0);
3. mremap part of vma1 to new vma2:
addr2 = mremap(addr1, 4096, 2 * 4096, MREMAP_MAYMOVE);
4. mremap back to orig addr1:
mremap(addr2, 4096, 4096, MREMAP_MAYMOVE | MREMAP_FIXED, addr1);
In step 3, the vma1 range [addr1, addr1 + 4096] will be remap to new vma2 with range [addr2, addr2 + 8192], and remap uprobe anon page from the vma1 to vma2, then unmap the vma1 range [addr1, addr1 + 4096].
In step 4, the vma2 range [addr2, addr2 + 4096] will be remap back to the addr range [addr1, addr1 + 4096]. Since the addr range [addr1 + 4096, addr1 + 8192] still maps the file, it will take vma_merge_new_range to expand the range, and then do uprobe_mmap in vma_complete. Since the merged vma pgoff is also zero offset, it will install uprobe anon page to the merged vma. However, the upcomming move_page_tables step, which use set_pte_at to remap the vma2 uprobe pte to the merged vma, will overwrite the newly uprobe pte in the merged vma, and lead that pte to be orphan.
Since the uprobe pte will be remapped to the merged vma, we can remove the unnecessary uprobe_mmap upon merged vma.
This problem was first found in linux-6.6.y and also exists in the community syzkaller:
https://lore.kernel.org/all/[email protected]/T/
--- mm/vma.c | 20 +++++++++++++++++--- mm/vma.h | 7 +++++++ 2 files changed, 24 insertions(+), 3 deletions(-)
mm/vma.c +17 -3
@@ -144,6 +144,9 @@ static void init_multi_vma_prep(struct v vp->file = vma->vm_file;if (vp->file) vp->mapping = vma->vm_file->f_mapping; + +if (vmg && vmg->skip_vma_uprobe) + vp->skip_vma_uprobe = true; }/*
@@ -333,10 +336,13 @@ static void vma_complete(struct vma_prepif (vp->file) {i_mmap_unlock_write (vp->mapping); -uprobe_mmap (vp->vma); -if (vp->adj_next) -uprobe_mmap (vp->adj_next); +if (!vp->skip_vma_uprobe) { +uprobe_mmap (vp->vma); + +if (vp->adj_next) +uprobe_mmap (vp->adj_next); + } }if (vp->remove) {
@@ -1783,6 +1789,14 @@ struct vm_area_struct *copy_vma(struct v faulted_in_anon_vma = false; } +/* +* If the VMA we are copying might contain a uprobe PTE, ensure +* that we do not establish one upon merge. Otherwise, when mremap() +* moves page tables, it will orphan the newly created PTE. +*/ +if (vma->vm_file) + vmg.skip_vma_uprobe = true; + new_vma =find_vma_prev (mm, addr, &vmg.prev);if (new_vma && new_vma->vm_start < addr + len)return NULL ;/* should never get here */
mm/vma.h +7 -0
@@ -19,6 +19,8 @@ struct vma_prepare {struct vm_area_struct *insert;struct vm_area_struct *remove;struct vm_area_struct *remove2; + + bool skip_vma_uprobe :1; };struct unlink_vma_file_batch {
@@ -120,6 +122,11 @@ struct vma_merge_struct {*/ bool give_up_on_oom :1; +/* +* If set, skip uprobe_mmap upon merged vma. +*/ + bool skip_vma_uprobe :1; +/* Internal flags set during merge process: */ /*
Greg Kroah-Hartman
maintainerPATCH 198/592 mm/hugetlb: unshare page tables during VMA split, not before
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 081056dc00a27bccb55ccc3c6f230a3d5fd3f7e0 upstream.
Currently, __split_vma() triggers hugetlb page table unsharing through vm_ops->may_split(). This happens before the VMA lock and rmap locks are taken - which is too early, it allows racing VMA-locked page faults in our process and racing rmap walks from other processes to cause page tables to be shared again before we actually perform the split.
Fix it by explicitly calling into the hugetlb unshare logic from __split_vma() in the same place where THP splitting also happens. At that point, both the VMA and the rmap(s) are write-locked.
An annoying detail is that we can now call into the helper hugetlb_unshare_pmds() from two different locking contexts:
1. from hugetlb_split(), holding:
- mmap lock (exclusively)
- VMA lock
- file rmap lock (exclusively)
2. hugetlb_unshare_all_pmds(), which I think is designed to be able to call us with only the mmap lock held (in shared mode), but currently only runs while holding mmap lock (exclusively) and VMA lock
Backporting note:
This commit fixes a racy protection that was introduced in commit b30c14cd6102 ("hugetlb: unshare some PMDs when splitting VMAs"); that commit claimed to fix an issue introduced in 5.13, but it should actually also go all the way back.
--- include/linux/hugetlb.h | 3 + mm/hugetlb.c | 60 ++++++++++++++++++++++++++++----------- mm/vma.c | 7 ++++ tools/testing/vma/vma_internal.h | 2 + 4 files changed, 56 insertions(+), 16 deletions(-)
include/linux/hugetlb.h +3 -0
@@ -276,6 +276,7 @@ bool is_hugetlb_entry_migration(pte_t ptbool is_hugetlb_entry_hwpoisoned (pte_t pte);void hugetlb_unshare_all_pmds (struct vm_area_struct *vma);void fixup_hugetlb_reservations (struct vm_area_struct *vma); +void hugetlb_split (struct vm_area_struct *vma,unsigned long addr);#else /* !CONFIG_HUGETLB_PAGE */
@@ -473,6 +474,8 @@ static inline void fixup_hugetlb_reserva { } +static inline void hugetlb_split (struct vm_area_struct *vma,unsigned long addr) {} +#endif /* !CONFIG_HUGETLB_PAGE */ #ifndef pgd_write
mm/hugetlb.c +44 -16
109 lines not on this page · raw message
mm/vma.c +7 -0
@@ -516,7 +516,14 @@ __split_vma(struct vma_iterator *vmi, stinit_vma_prep (&vp, vma); vp.insert = new;vma_prepare (&vp); + +/* +* Get rid of huge pages and shared page tables straddling the split +* boundary. +*/ vma_adjust_trans_huge (vma, vma->vm_start, addr,NULL ); +if (is_vm_hugetlb_page (vma)) +hugetlb_split (vma, addr);if (new_below) { vma->vm_start = addr;
tools/testing/vma/vma_internal.h +2 -0
@@ -793,6 +793,8 @@ static inline void vma_adjust_trans_huge (void )next; } +static inline void hugetlb_split (struct vm_area_struct *,unsigned long ) {} +static inline void vma_iter_free (struct vma_iterator *vmi) {mas_destroy (&vmi->mas);
Greg Kroah-Hartman
maintainerPATCH 199/592 mm/hugetlb: fix huge_pmd_unshare() vs GUP-fast race
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 1013af4f585fccc4d3e5c5824d174de2257f7d6d upstream.
huge_pmd_unshare() drops a reference on a page table that may have previously been shared across processes, potentially turning it into a normal page table used in another process in which unrelated VMAs can afterwards be installed.
If this happens in the middle of a concurrent gup_fast(), gup_fast() could end up walking the page tables of another process. While I don't see any way in which that immediately leads to kernel memory corruption, it is really weird and unexpected.
Fix it with an explicit broadcast IPI through tlb_remove_table_sync_one(), just like we do in khugepaged when removing page tables for a THP collapse.
--- mm/hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+)
mm/hugetlb.c +7 -0
@@ -7628,6 +7628,13 @@ int huge_pmd_unshare(struct mm_struct *mreturn 0 ;pud_clear (pud); +/* +* Once our caller drops the rmap lock, some other process might be +* using this page table as a normal, non-hugetlb page table. +* Wait for pending gup_fast() in other threads to finish before letting +* that happen. +*/ +tlb_remove_table_sync_one ();ptdesc_pmd_pts_dec (virt_to_ptdesc (ptep));mm_dec_nr_pmds (mm);return 1 ;
Greg Kroah-Hartman
maintainerPATCH 200/592 iio: imu: inv_icm42600: Fix temperature calculation
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Nyekjaer <[email protected]>
commit e2f820014239df9360064079ae93f838ff3b7f8c upstream.
Quoted 1 line
From the documentation:
"offset to be added to <type>[Y]_raw prior toscaling by <type>[Y]_scale" Offset should be applied before multiplying scale, so divide offset by scale to make this correct.
--- drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c +5 -3
@@ -67,16 +67,18 @@ int inv_icm42600_temp_read_raw(struct iireturn IIO_VAL_INT ;/* * T°C = (temp / 132.48) + 25 -* Tm°C = 1000 * ((temp * 100 / 13248) + 25) +* Tm°C = 1000 * ((temp / 132.48) + 25) +* Tm°C = 7.548309 * temp + 25000 +* Tm°C = (temp + 3312) * 7.548309 * scale: 100000 / 13248 ~= 7.548309 -* offset: 25000 +* offset: 3312 */ case IIO_CHAN_INFO_SCALE : *val =7 ; *val2 =548309 ;return IIO_VAL_INT_PLUS_MICRO ;case IIO_CHAN_INFO_OFFSET : - *val =25000 ; + *val =3312 ;return IIO_VAL_INT ;default :return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 201/592 iio: adc: ad7944: mask high bits on direct read
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
commit 7cdfbc0113d087348b8e65dd79276d0f57b89a10 upstream.
Apply a mask to the raw value received over the SPI bus for unsigned direct reads. As we found recently, SPI controllers may not set unused bits to 0 when reading with bits_per_word != {8,16,32}. The ad7944 uses bits_per_word of 14 and 18, so we need to mask the value to be sure we returning the correct value to userspace during a direct read.
--- drivers/iio/adc/ad7944.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/ad7944.c +2 -0
@@ -377,6 +377,8 @@ static int ad7944_single_conversion(struif (chan->scan_type.sign =='s' ) *val =sign_extend32 (*val, chan->scan_type.realbits -1 ); +else + *val &=GENMASK (chan->scan_type.realbits -1 ,0 );return IIO_VAL_INT ; }
Greg Kroah-Hartman
maintainerPATCH 202/592 iio: adc: ti-ads1298: Kconfig: add kfifo dependency to fix module build
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arthur-Prince <[email protected]>
commit 3c5dfea39a245b2dad869db24e2830aa299b1cf2 upstream.
Add dependency to Kconfig’s ti-ads1298 because compiling it as a module failed with an undefined kfifo symbol.
--- drivers/iio/adc/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/adc/Kconfig +1 -0
@@ -1546,6 +1546,7 @@ config TI_ADS1298 tristate "Texas Instruments ADS1298" depends on SPI select IIO_BUFFER + select IIO_KFIFO_BUF help If you say yes here you get support for Texas Instruments ADS1298 medical ADC chips
Greg Kroah-Hartman
maintainerPATCH 203/592 iio: adc: ad7606_spi: fix reg write value mask
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
commit 89944d88f8795c6c89b9514cb365998145511cd4 upstream.
Fix incorrect value mask for register write. Register values are 8-bit, not 9. If this function was called with a value > 0xFF and an even addr, it would cause writing to the next register.
--- drivers/iio/adc/ad7606_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7606_spi.c +1 -1
@@ -155,7 +155,7 @@ static int ad7606_spi_reg_write(struct astruct spi_device *spi =to_spi_device (st->dev); st->d16[0 ] =cpu_to_be16 ((st->bops->rd_wr_cmd (addr,1 ) <<8 ) | - (val &0x1FF )); + (val &0xFF ));return spi_write (spi, &st->d16[0 ],sizeof (st->d16[0 ])); }
Greg Kroah-Hartman
maintainerPATCH 204/592 iio: adc: ad7173: fix compiling without gpiolib
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
commit c553aa1b03719400a30d9387477190d4743fc1de upstream.
Fix compiling the ad7173 driver when CONFIG_GPIOLIB is not set by selecting GPIOLIB to be always enabled and remove the #if.
Commit 031bdc8aee01 ("iio: adc: ad7173: add calibration support") placed unrelated code in the middle of the #if IS_ENABLED(CONFIG_GPIOLIB) block which caused the reported compile error.
However, later commit 7530ed2aaa3f ("iio: adc: ad7173: add openwire detection support for single conversions") makes use of the gpio regmap even when we aren't providing gpio controller support. So it makes more sense to always enable GPIOLIB rather than trying to make it optional.
--- drivers/iio/adc/Kconfig | 5 +++-- drivers/iio/adc/ad7173.c | 15 +-------------- 2 files changed, 4 insertions(+), 16 deletions(-)
drivers/iio/adc/Kconfig +3 -2
@@ -129,8 +129,9 @@ config AD7173 tristate "Analog Devices AD7173 driver" depends on SPI_MASTER select AD_SIGMA_DELTA - select GPIO_REGMAP if GPIOLIB - select REGMAP_SPI if GPIOLIB + select GPIOLIB + select GPIO_REGMAP + select REGMAP_SPI help Say yes here to build support for Analog Devices AD7173 and similar ADC Currently supported models:
drivers/iio/adc/ad7173.c +1 -14
@@ -230,10 +230,8 @@ struct ad7173_state {unsigned long long *config_cnts;struct clk *ext_clk;struct clk_hw int_clk_hw; -#if IS_ENABLED (CONFIG_GPIOLIB )struct regmap *reg_gpiocon_regmap;struct gpio_regmap *gpio_regmap; -#endif };static unsigned int ad4115_sinc5_data_rates[] = {
@@ -288,8 +286,6 @@ static const char *const ad7173_clk_sel[] = { "ext-clk", "xtal" }; -#if IS_ENABLED (CONFIG_GPIOLIB ) -static const struct regmap_range ad7173_range_gpio[] = {regmap_reg_range (AD7173_REG_GPIO ,AD7173_REG_GPIO ), };
@@ -543,12 +539,6 @@ static int ad7173_gpio_init(struct ad7173_state *st)return 0 ; } -#else -static int ad7173_gpio_init (struct ad7173_state *st) -{ -return 0 ; -} -#endif /* CONFIG_GPIOLIB */ static struct ad7173_state *ad_sigma_delta_to_ad7173 (struct ad_sigma_delta *sd) {
@@ -1797,10 +1787,7 @@ static int ad7173_probe(struct spi_device *spi)if (ret)return ret; -if (IS_ENABLED (CONFIG_GPIOLIB )) -return ad7173_gpio_init (st); - -return 0 ; +return ad7173_gpio_init (st); }static const struct of_device_id ad7173_of_match[] = {
Signature · 1 line
2.50.0
Greg Kroah-Hartman
maintainerPATCH 205/592 iio: adc: ad7606: fix raw read for 18-bit chips
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
commit 3f5fd1717ae9497215f22aa748fc2c09df88b0e3 upstream.
Fix 18-bit raw read for 18-bit chips by applying a mask to the value we receive from the SPI controller.
SPI controllers either return 1, 2 or 4 bytes per word depending on the bits_per_word. For 16-bit chips, there was no problem since they raw data fit exactly in the 2 bytes received from the SPI controller. But now that we have 18-bit chips and we are using bits_per_word = 18, we cannot assume that the extra bits in the 32-bit word are always zero. In fact, with the AXI SPI Engine controller, these bits are not always zero which caused the raw values to read 10s of 1000s of volts instead of the correct value. Therefore, we need to mask the value we receive from the SPI controller to ensure that only the 18 bits of real data are used.
--- drivers/iio/adc/ad7606.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/iio/adc/ad7606.c +10 -11
@@ -727,17 +727,16 @@ static int ad7606_scan_direct(struct iio_dev *indio_dev, unsigned int ch, goto error_ret; chan = &indio_dev->channels[ch +1 ]; -if (chan->scan_type.sign =='u' ) { -if (realbits >16 ) - *val = st->data.buf32[ch]; -else - *val = st->data.buf16[ch]; - }else { -if (realbits >16 ) - *val =sign_extend32 (st->data.buf32[ch], realbits -1 ); -else - *val =sign_extend32 (st->data.buf16[ch], realbits -1 ); - } + +if (realbits >16 ) + *val = st->data.buf32[ch]; +else + *val = st->data.buf16[ch]; + + *val &=GENMASK (realbits -1 ,0 ); + +if (chan->scan_type.sign =='s' ) + *val =sign_extend32 (*val, realbits -1 ); error_ret:if (!st->gpio_convst) {
Signature · 1 line
2.50.0
Greg Kroah-Hartman
maintainerPATCH 206/592 ACPICA: fix acpi operand cache leak in dswstate.c
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seunghun Han <[email protected]>
[ Upstream commit 156fd20a41e776bbf334bd5e45c4f78dfc90ce1c ]
ACPICA commit 987a3b5cf7175916e2a4b6ea5b8e70f830dfe732
I found an ACPI cache leak in ACPI early termination and boot continuing case.
When early termination occurs due to malicious ACPI table, Linux kernel terminates ACPI function and continues to boot process. While kernel terminates ACPI function, kmem_cache_destroy() reports Acpi-Operand cache leak.
Boot log of ACPI operand cache leak is as follows:
Quoted 32 lines
[ 0.585957] ACPI: Added _OSI(Module Device) [ 0.587218] ACPI: Added _OSI(Processor Device) [ 0.588530] ACPI: Added _OSI(3.0 _SCP Extensions) [ 0.589790] ACPI: Added _OSI(Processor Aggregator Device) [ 0.591534] ACPI Error: Illegal I/O port address/length above 64K: C806E00000004002/0x2 (20170303/hwvalid-155) [ 0.594351] ACPI Exception: AE_LIMIT, Unable to initialize fixed events (20170303/evevent-88) [ 0.597858] ACPI: Unable to start the ACPI Interpreter [ 0.599162] ACPI Error: Could not remove SCI handler (20170303/evmisc-281) [ 0.601836] kmem_cache_destroy Acpi-Operand: Slab cache still has objects [ 0.603556] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc5 #26 [ 0.605159] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006 [ 0.609177] Call Trace: [ 0.610063] ? dump_stack+0x5c/0x81 [ 0.611118] ? kmem_cache_destroy+0x1aa/0x1c0 [ 0.612632] ? acpi_sleep_proc_init+0x27/0x27 [ 0.613906] ? acpi_os_delete_cache+0xa/0x10 [ 0.617986] ? acpi_ut_delete_caches+0x3f/0x7b [ 0.619293] ? acpi_terminate+0xa/0x14 [ 0.620394] ? acpi_init+0x2af/0x34f [ 0.621616] ? __class_create+0x4c/0x80 [ 0.623412] ? video_setup+0x7f/0x7f [ 0.624585] ? acpi_sleep_proc_init+0x27/0x27 [ 0.625861] ? do_one_initcall+0x4e/0x1a0 [ 0.627513] ? kernel_init_freeable+0x19e/0x21f [ 0.628972] ? rest_init+0x80/0x80 [ 0.630043] ? kernel_init+0xa/0x100 [ 0.631084] ? ret_from_fork+0x25/0x30 [ 0.633343] vgaarb: loaded [ 0.635036] EDAC MC: Ver: 3.0.0 [ 0.638601] PCI: Probing PCI hardware [ 0.639833] PCI host bridge to bus 0000:00 [ 0.641031] pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
Quoted 1 line
... Continue to boot and log is omitted ...
I analyzed this memory leak in detail and found acpi_ds_obj_stack_pop_and_ delete() function miscalculated the top of the stack. acpi_ds_obj_stack_push() function uses walk_state->operand_index for start position of the top, but acpi_ds_obj_stack_pop_and_delete() function considers index 0 for it. Therefore, this causes acpi operand memory leak.
This cache leak causes a security threat because an old kernel (<= 4.9) shows memory locations of kernel functions in stack dump. Some malicious users could use this information to neutralize kernel ASLR.
I made a patch to fix ACPI operand cache leak.
--- drivers/acpi/acpica/dsutils.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/acpi/acpica/dsutils.c +8 -1
@@ -668,6 +668,8 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,union acpi_parse_object *arguments[ACPI_OBJ_NUM_OPERANDS ];u32 arg_count =0 ;u32 index = walk_state->num_operands; +u32 prev_num_operands = walk_state->num_operands; +u32 new_num_operands;u32 i;ACPI_FUNCTION_TRACE_PTR (ds_create_operands, first_arg);
@@ -696,6 +698,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,/* Create the interpreter arguments, in reverse order */ + new_num_operands = index; index--;for (i =0 ; i < arg_count; i++) { arg = arguments[index];
@@ -720,7 +723,11 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,* pop everything off of the operand stack and delete those * objects */ -acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state); + walk_state->num_operands = i; +acpi_ds_obj_stack_pop_and_delete (new_num_operands, walk_state); + +/* Restore operand count */ + walk_state->num_operands = prev_num_operands;ACPI_EXCEPTION ((AE_INFO , status,"While creating Arg %u" , index));return_ACPI_STATUS (status);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/592 ASoC: amd: yc: Add quirk for Lenovo Yoga Pro 7 14ASP9
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Talhah Peerbhai <[email protected]>
[ Upstream commit a28206060dc5848a1a2a15b7f6ac6223d869084d ]
Similar to many other Lenovo models with AMD chips, the Lenovo Yoga Pro 7 14ASP9 (product name 83HN) requires a specific quirk to ensure internal mic detection. This patch adds a quirk fixing this.
--- sound/soc/amd/yc/acp6x-mach.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/soc/amd/yc/acp6x-mach.c +8 -1
@@ -311,6 +311,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "83AS"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83HN"), + } + }, { .driver_data = &acp6x_card, .matches = {
@@ -360,7 +367,7 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"), } }, - { + { .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/592 clocksource: Fix the CPUs choice in the watchdog per CPU verification
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guilherme G. Piccoli <[email protected]>
[ Upstream commit 08d7becc1a6b8c936e25d827becabfe3bff72a36 ]
Right now, if the clocksource watchdog detects a clocksource skew, it might perform a per CPU check, for example in the TSC case on x86. In other
words: supposing TSC is detected as unstable by the clocksource watchdog running at CPU1, as part of marking TSC unstable the kernel will also run a check of TSC readings on some CPUs to be sure it is synced between them all.
But that check happens only on some CPUs, not all of them; this choice is based on the parameter "verify_n_cpus" and in some random cpumask calculation. So, the watchdog runs such per CPU checks on up to "verify_n_cpus" random CPUs among all online CPUs, with the risk of repeating CPUs (that aren't double checked) in the cpumask random calculation.
But if "verify_n_cpus" > num_online_cpus(), it should skip the random calculation and just go ahead and check the clocksource sync between all online CPUs, without the risk of skipping some CPUs due to duplicity in the random cpumask calculation.
Tests in a 4 CPU laptop with TSC skew detected led to some cases of the per CPU verification skipping some CPU even with verify_n_cpus=8, due to the duplicity on random cpumask generation. Skipping the randomization when the number of online CPUs is smaller than verify_n_cpus, solves that.
--- kernel/time/clocksource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/clocksource.c +1 -1
@@ -310,7 +310,7 @@ static void clocksource_verify_choose_cpus(void) {int cpu, i, n = verify_n_cpus; -if (n <0 ) { +if (n <0 || n >=num_online_cpus ()) {/* Check all of the CPUs. */ cpumask_copy (&cpus_chosen, cpu_online_mask);cpumask_clear_cpu (smp_processor_id (), &cpus_chosen);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/592 power: supply: gpio-charger: Fix wakeup source leaks on device unbind
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 51212ce95354c5b51e8c3054bf80eeeed80003b6 ]
Device can be unbound, so driver must also release memory for the wakeup source.
--- drivers/power/supply/gpio-charger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/power/supply/gpio-charger.c +3 -1
@@ -366,7 +366,9 @@ static int gpio_charger_probe(struct platform_device *pdev)platform_set_drvdata (pdev, gpio_charger); -device_init_wakeup (dev,1 ); + ret =devm_device_init_wakeup (dev); +if (ret) +return dev_err_probe (dev, ret,"Failed to init wakeup\n" );return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/592 power: supply: collie: Fix wakeup source leaks on device unbind
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit c73d19f89cb03c43abbbfa3b9caa1b8fc719764c ]
Device can be unbound, so driver must also release memory for the wakeup source.
--- drivers/power/supply/collie_battery.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/collie_battery.c +1 -0
@@ -440,6 +440,7 @@ static int collie_bat_probe(struct ucb1x00_dev *dev)static void collie_bat_remove (struct ucb1x00_dev *dev) { +device_init_wakeup (&ucb->dev,0 );free_irq (gpiod_to_irq (collie_bat_main.gpio_full), &collie_bat_main);power_supply_unregister (collie_bat_bu.psy);power_supply_unregister (collie_bat_main.psy);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/592 mmc: Add quirk to disable DDR50 tuning
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erick Shepherd <[email protected]>
[ Upstream commit 9510b38dc0ba358c93cbf5ee7c28820afb85937b ]
Adds the MMC_QUIRK_NO_UHS_DDR50_TUNING quirk and updates mmc_execute_tuning() to return 0 if that quirk is set. This fixes an issue on certain Swissbit SD cards that do not support DDR50 tuning where tuning requests caused I/O errors to be thrown.
--- drivers/mmc/core/card.h | 6 ++++++ drivers/mmc/core/quirks.h | 10 ++++++++++ drivers/mmc/core/sd.c | 32 ++++++++++++++++++++++++-------- include/linux/mmc/card.h | 1 + 4 files changed, 41 insertions(+), 8 deletions(-)
drivers/mmc/core/card.h +6 -0
@@ -89,6 +89,7 @@ struct mmc_fixup {#define CID_MANFID_MICRON 0x13#define CID_MANFID_SAMSUNG 0x15#define CID_MANFID_APACER 0x27 +#define CID_MANFID_SWISSBIT 0x5D#define CID_MANFID_KINGSTON 0x70#define CID_MANFID_HYNIX 0x90#define CID_MANFID_KINGSTON_SD 0x9F
@@ -294,4 +295,9 @@ static inline int mmc_card_broken_sd_poweroff_notify(const struct mmc_card *c) return c->quirks & MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY; } +static inline int mmc_card_no_uhs_ddr50_tuning (const struct mmc_card *c) +{ +return c->quirks &MMC_QUIRK_NO_UHS_DDR50_TUNING ; +} +#endif
drivers/mmc/core/quirks.h +10 -0
@@ -34,6 +34,16 @@ static const struct mmc_fixup __maybe_unused mmc_sd_fixups[] = { MMC_QUIRK_BROKEN_SD_CACHE | MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY, EXT_CSD_REV_ANY), +/* +* Swissbit series S46-u cards throw I/O errors during tuning requests +* after the initial tuning request expectedly times out. This has +* only been observed on cards manufactured on 01/2019 that are using +* Bay Trail host controllers. +*/ +_FIXUP_EXT ("0016G" ,CID_MANFID_SWISSBIT ,0x5342 ,2019 ,1 , +0 ,-1ull ,SDIO_ANY_ID ,SDIO_ANY_ID , add_quirk_sd, +MMC_QUIRK_NO_UHS_DDR50_TUNING ,EXT_CSD_REV_ANY ), + END_FIXUP };
drivers/mmc/core/sd.c +24 -8
@@ -617,6 +617,29 @@ static int sd_set_current_limit(struct mmc_card *card, u8 *status)return 0 ; } +/* +* Determine if the card should tune or not. +*/ +static bool mmc_sd_use_tuning (struct mmc_card *card) +{ +/* +* SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and +* SDR104 mode SD-cards. Note that tuning is mandatory for SDR104. +*/ +if (mmc_host_is_spi (card->host)) +return false; + +switch (card->host->ios.timing) { +case MMC_TIMING_UHS_SDR50 : +case MMC_TIMING_UHS_SDR104 : +return true; +case MMC_TIMING_UHS_DDR50 : +return !mmc_card_no_uhs_ddr50_tuning (card); + } + +return false; +} +/* * UHS-I specific initialization procedure */
@@ -660,14 +683,7 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)if (err) goto out; -/* -* SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and -* SDR104 mode SD-cards. Note that tuning is mandatory for SDR104. -*/ -if (!mmc_host_is_spi (card->host) && - (card->host->ios.timing ==MMC_TIMING_UHS_SDR50 || - card->host->ios.timing ==MMC_TIMING_UHS_DDR50 || - card->host->ios.timing ==MMC_TIMING_UHS_SDR104 )) { +if (mmc_sd_use_tuning (card)) { err =mmc_execute_tuning (card);/*
include/linux/mmc/card.h +1 -0
@@ -329,6 +329,7 @@ struct mmc_card {#define MMC_QUIRK_BROKEN_SD_CACHE (1<<15)/* Disable broken SD cache support */ #define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16)/* Don't flush cache until the write has occurred */ #define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY (1<<17)/* Disable broken SD poweroff notify support */ +#define MMC_QUIRK_NO_UHS_DDR50_TUNING (1<<18)/* Disable DDR50 tuning */ bool written_flag;/* Indicates eMMC has been written since power on */ bool reenable_cmdq;/* Re-enable Command Queue */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/592 ACPICA: Avoid sequence overread in call to strncmp()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmed Salem <[email protected]>
[ Upstream commit 64b9dfd0776e9c38d733094859a09f13282ce6f8 ]
ACPICA commit 8b83a8d88dfec59ea147fad35fc6deea8859c58c
ap_get_table_length() checks if tables are valid by calling ap_is_valid_header(). The latter then calls ACPI_VALIDATE_RSDP_SIG(Table->Signature).
ap_is_valid_header() accepts struct acpi_table_header as an argument, so the signature size is always fixed to 4 bytes.
The problem is when the string comparison is between ACPI-defined table signature and ACPI_SIG_RSDP. Common ACPI table header specifies the Signature field to be 4 bytes long[1], with the exception of the RSDP structure whose signature is 8 bytes long "RSD PTR " (including the trailing blank character)[2]. Calling strncmp(sig, rsdp_sig, 8) would then result in a sequence overread[3] as sig would be smaller (4 bytes) than the specified bound (8 bytes).
As a workaround, pass the bound conditionally based on the size of the signature being passed.
--- include/acpi/actypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/actypes.h +1 -1
@@ -527,7 +527,7 @@ typedef u64 acpi_integer;/* Support for the special RSDP signature (8 characters) */ -#define ACPI_VALIDATE_RSDP_SIG (a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) +#define ACPI_VALIDATE_RSDP_SIG (a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, (sizeof(a) < 8) ? ACPI_NAMESEG_SIZE : 8))#define ACPI_MAKE_RSDP_SIG (dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))/* Support for OEMx signature (x can be any character) */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/592 mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luke Wang <[email protected]>
[ Upstream commit c63d25cdc59ae2891b39ba2da950910291d9bcbf ]
For SoCs like i.MX6UL(L/Z) and i.MX7D, USDHC powers off completely during system power management (PM), causing the internal tuning status to be lost. To address this, save the tuning value when system suspend and restore it for any command issued after system resume when re-tuning is held.
A typical case involves SDIO WiFi devices with the MMC_PM_KEEP_POWER and MMC_PM_WAKE_SDIO_IRQ flag, which retain power during system PM. To conserve power, WiFi switches to 1-bit mode and restores 4-bit mode upon resume. As per the specification, tuning commands are not supported in 1-bit mode. When sending CMD52 to restore 4-bit mode, re-tuning must be held. However, CMD52 still requires a correct sample point to avoid CRC errors, necessitating preservation of the previous tuning value.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 88 +++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +86 -2
@@ -81,6 +81,8 @@#define ESDHC_TUNE_CTRL_STEP 1#define ESDHC_TUNE_CTRL_MIN 0#define ESDHC_TUNE_CTRL_MAX ((1 << 7) - 1) +#define ESDHC_TUNE_CTRL_STATUS_TAP_SEL_PRE_MASK GENMASK(30, 24) +#define ESDHC_TUNE_CTRL_STATUS_DLY_CELL_SET_PRE_MASK GENMASK(14, 8)/* strobe dll register */ #define ESDHC_STROBE_DLL_CTRL 0x70
@@ -235,6 +237,7 @@ struct esdhc_platform_data {unsigned int tuning_step;/* The delay cell steps in tuning procedure */ unsigned int tuning_start_tap;/* The start delay cell point in tuning procedure */ unsigned int strobe_dll_delay_target;/* The delay cell for strobe pad (read clock) */ +unsigned int saved_tuning_delay_cell;/* save the value of tuning delay cell */ };struct esdhc_soc_data {
@@ -1057,7 +1060,7 @@ static void esdhc_reset_tuning(struct sdhci_host *host) {struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);struct pltfm_imx_data *imx_data =sdhci_pltfm_priv (pltfm_host); -u32 ctrl; +u32 ctrl, tuning_ctrl;int ret;/* Reset the tuning circuit */
@@ -1071,6 +1074,16 @@ static void esdhc_reset_tuning(struct sdhci_host *host)writel (0 , host->ioaddr +ESDHC_TUNE_CTRL_STATUS ); }else if (imx_data->socdata->flags &ESDHC_FLAG_STD_TUNING ) {writel (ctrl, host->ioaddr +ESDHC_MIX_CTRL ); +/* +* enable the std tuning just in case it cleared in +* sdhc_esdhc_tuning_restore. +*/ + tuning_ctrl =readl (host->ioaddr +ESDHC_TUNING_CTRL ); +if (!(tuning_ctrl &ESDHC_STD_TUNING_EN )) { + tuning_ctrl |=ESDHC_STD_TUNING_EN ; +writel (tuning_ctrl, host->ioaddr +ESDHC_TUNING_CTRL ); + } + ctrl =readl (host->ioaddr +SDHCI_AUTO_CMD_STATUS ); ctrl &= ~ESDHC_MIX_CTRL_SMPCLK_SEL ; ctrl &= ~ESDHC_MIX_CTRL_EXE_TUNE ;
@@ -1149,7 +1162,8 @@ static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val) reg |=ESDHC_MIX_CTRL_EXE_TUNE |ESDHC_MIX_CTRL_SMPCLK_SEL |ESDHC_MIX_CTRL_FBCLK_SEL ;writel (reg, host->ioaddr +ESDHC_MIX_CTRL ); -writel (val <<8 , host->ioaddr +ESDHC_TUNE_CTRL_STATUS ); +writel (FIELD_PREP (ESDHC_TUNE_CTRL_STATUS_DLY_CELL_SET_PRE_MASK , val), + host->ioaddr +ESDHC_TUNE_CTRL_STATUS );dev_dbg (mmc_dev (host->mmc),"tuning with delay 0x%x ESDHC_TUNE_CTRL_STATUS 0x%x\n" , val,readl (host->ioaddr +ESDHC_TUNE_CTRL_STATUS ));
@@ -1569,6 +1583,57 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) } } +static void sdhc_esdhc_tuning_save (struct sdhci_host *host) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct pltfm_imx_data *imx_data =sdhci_pltfm_priv (pltfm_host); +u32 reg; + +/* +* SD/eMMC do not need this tuning save because it will re-init +* after system resume back. +* Here save the tuning delay value for SDIO device since it may +* keep power during system PM. And for usdhc, only SDR50 and +* SDR104 mode for SDIO device need to do tuning, and need to +* save/restore. +*/ +if (host->timing ==MMC_TIMING_UHS_SDR50 || + host->timing ==MMC_TIMING_UHS_SDR104 ) { + reg =readl (host->ioaddr +ESDHC_TUNE_CTRL_STATUS ); + reg =FIELD_GET (ESDHC_TUNE_CTRL_STATUS_TAP_SEL_PRE_MASK , reg); + imx_data->boarddata.saved_tuning_delay_cell = reg; + } +} + +static void sdhc_esdhc_tuning_restore (struct sdhci_host *host) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct pltfm_imx_data *imx_data =sdhci_pltfm_priv (pltfm_host); +u32 reg; + +if (host->timing ==MMC_TIMING_UHS_SDR50 || + host->timing ==MMC_TIMING_UHS_SDR104 ) { +/* +* restore the tuning delay value actually is a +* manual tuning method, so clear the standard +* tuning enable bit here. Will set back this +* ESDHC_STD_TUNING_EN in esdhc_reset_tuning() +* when trigger re-tuning. +*/ + reg =readl (host->ioaddr +ESDHC_TUNING_CTRL ); + reg &= ~ESDHC_STD_TUNING_EN ; +writel (reg, host->ioaddr +ESDHC_TUNING_CTRL ); + + reg =readl (host->ioaddr +ESDHC_MIX_CTRL ); + reg |=ESDHC_MIX_CTRL_SMPCLK_SEL |ESDHC_MIX_CTRL_FBCLK_SEL ; +writel (reg, host->ioaddr +ESDHC_MIX_CTRL ); + +writel (FIELD_PREP (ESDHC_TUNE_CTRL_STATUS_DLY_CELL_SET_PRE_MASK , + imx_data->boarddata.saved_tuning_delay_cell), + host->ioaddr +ESDHC_TUNE_CTRL_STATUS ); + } +} +static void esdhc_cqe_enable (struct mmc_host *mmc) {struct sdhci_host *host =mmc_priv (mmc);
@@ -1900,6 +1965,15 @@ static int sdhci_esdhc_suspend(struct device *dev)if (host->tuning_mode !=SDHCI_TUNING_MODE_3 )mmc_retune_needed (host->mmc); +/* +* For the device need to keep power during system PM, need +* to save the tuning delay value just in case the usdhc +* lost power during system PM. +*/ +if (mmc_card_keep_power (host->mmc) &&mmc_card_wake_sdio_irq (host->mmc) && +esdhc_is_usdhc (imx_data)) +sdhc_esdhc_tuning_save (host); + ret =sdhci_suspend_host (host);if (ret)return ret;
@@ -1916,6 +1990,8 @@ static int sdhci_esdhc_suspend(struct device *dev)static int sdhci_esdhc_resume (struct device *dev) {struct sdhci_host *host =dev_get_drvdata (dev); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct pltfm_imx_data *imx_data =sdhci_pltfm_priv (pltfm_host);int ret; ret =pinctrl_pm_select_default_state (dev);
@@ -1929,6 +2005,14 @@ static int sdhci_esdhc_resume(struct device *dev)if (ret)return ret; +/* +* restore the saved tuning delay value for the device which keep +* power during system PM. +*/ +if (mmc_card_keep_power (host->mmc) &&mmc_card_wake_sdio_irq (host->mmc) && +esdhc_is_usdhc (imx_data)) +sdhc_esdhc_tuning_restore (host); +if (host->mmc->caps2 &MMC_CAP2_CQE ) ret =cqhci_resume (host->mmc);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/592 EDAC/igen6: Skip absent memory controllers
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit 20e190b1c1fd88b21cc5106c12cfe6def5ab849d ]
Some BIOS versions may fuse off certain memory controllers and set the registers of these absent memory controllers to ~0. The current igen6_edac mistakenly enumerates these absent memory controllers and registers them with the EDAC core.
Skip the absent memory controllers to avoid mistakenly enumerating them.
--- drivers/edac/igen6_edac.c | 78 +++++++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 16 deletions(-)
drivers/edac/igen6_edac.c +62 -16
@@ -127,6 +127,7 @@ static const struct res_config { bool machine_check; + /* The number of present memory controllers. */ int num_imc; u32 imc_base; u32 cmf_base;
@@ -1201,23 +1202,21 @@ static void igen6_check(struct mem_ctl_info *mci)irq_work_queue (&ecclog_irq_work); } -static int igen6_register_mci (int mc,u64 mchbar,struct pci_dev *pdev) +/* Check whether the memory controller is absent. */ +static bool igen6_imc_absent (void __iomem *window) +{ +return readl (window +MAD_INTER_CHANNEL_OFFSET ) == ~0 ; +} + +static int igen6_register_mci (int mc,void __iomem *window,struct pci_dev *pdev) {struct edac_mc_layer layers[2 ];struct mem_ctl_info *mci;struct igen6_imc *imc; -void __iomem *window;int rc;edac_dbg (2 ,"\n" ); - mchbar += mc *MCHBAR_SIZE ; - window =ioremap (mchbar,MCHBAR_SIZE ); -if (!window) { -igen6_printk (KERN_ERR ,"Failed to ioremap 0x%llx\n" , mchbar); -return -ENODEV ; - } - layers[0 ].type =EDAC_MC_LAYER_CHANNEL ; layers[0 ].size =NUM_CHANNELS ; layers[0 ].is_virt_csrow = false;
@@ -1283,7 +1282,6 @@ static int igen6_register_mci(int mc, u64 mchbar, struct pci_dev *pdev) fail2:edac_mc_free (mci); fail: -iounmap (window);return rc; }
@@ -1309,6 +1307,56 @@ static void igen6_unregister_mcis(void) } } +static int igen6_register_mcis (struct pci_dev *pdev,u64 mchbar) +{ +void __iomem *window; +int lmc, pmc, rc; +u64 base; + +for (lmc =0 , pmc =0 ; pmc <NUM_IMC ; pmc++) { + base = mchbar + pmc *MCHBAR_SIZE ; + window =ioremap (base,MCHBAR_SIZE ); +if (!window) { +igen6_printk (KERN_ERR ,"Failed to ioremap 0x%llx for mc%d\n" , base, pmc); + rc = -ENOMEM ; + goto out_unregister_mcis; + } + +if (igen6_imc_absent (window)) { +iounmap (window); +edac_dbg (2 ,"Skip absent mc%d\n" , pmc); +continue ; + } + + rc =igen6_register_mci (lmc, window, pdev); +if (rc) + goto out_iounmap; + +/* Done, if all present MCs are detected and registered. */ +if (++lmc >= res_cfg->num_imc) +break ; + } + +if (!lmc) { +igen6_printk (KERN_ERR ,"No mc found.\n" ); +return -ENODEV ; + } + +if (lmc < res_cfg->num_imc) +igen6_printk (KERN_WARNING ,"Expected %d mcs, but only %d detected." , + res_cfg->num_imc, lmc); + +return 0 ; + +out_iounmap: +iounmap (window); + +out_unregister_mcis: +igen6_unregister_mcis (); + +return rc; +} +static int igen6_mem_slice_setup (u64 mchbar) {struct igen6_imc *imc = &igen6_pvt->imc[0 ];
@@ -1405,7 +1453,7 @@ static void opstate_set(const struct res_config *cfg, const struct pci_device_idstatic int igen6_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {u64 mchbar; -int i, rc; +int rc;edac_dbg (2 ,"\n" );
@@ -1421,11 +1469,9 @@ static int igen6_probe(struct pci_dev *pdev, const struct pci_device_id *ent)opstate_set (res_cfg, ent); -for (i =0 ; i < res_cfg->num_imc; i++) { - rc =igen6_register_mci (i, mchbar, pdev); -if (rc) - goto fail2; - } + rc =igen6_register_mcis (pdev, mchbar); +if (rc) + goto fail;if (res_cfg->num_imc >1 ) { rc =igen6_mem_slice_setup (mchbar);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/592 ASoC: tas2770: Power cycle amp on ISENSE/VSENSE change
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
[ Upstream commit f529c91be8a34ac12e7599bf87c65b6f4a2c9f5c ]
The ISENSE/VSENSE blocks are only powered up when the amplifier transitions from shutdown to active. This means that if those controls are flipped on while the amplifier is already playing back audio, they will have no effect.
Fix this by forcing a power cycle around transitions in those controls.
--- sound/soc/codecs/tas2770.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
sound/soc/codecs/tas2770.c +28 -2
@@ -156,11 +156,37 @@ static const struct snd_kcontrol_new isense_switch =static const struct snd_kcontrol_new vsense_switch =SOC_DAPM_SINGLE ("Switch" ,TAS2770_PWR_CTRL ,2 ,1 ,1 ); +static int sense_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_component *component =snd_soc_dapm_to_component (w->dapm); +struct tas2770_priv *tas2770 =snd_soc_component_get_drvdata (component); + +/* +* Powering up ISENSE/VSENSE requires a trip through the shutdown state. +* Do that here to ensure that our changes are applied properly, otherwise +* we might end up with non-functional IVSENSE if playback started earlier, +* which would break software speaker protection. +*/ +switch (event) { +case SND_SOC_DAPM_PRE_REG : +return snd_soc_component_update_bits (component,TAS2770_PWR_CTRL , +TAS2770_PWR_CTRL_MASK , +TAS2770_PWR_CTRL_SHUTDOWN ); +case SND_SOC_DAPM_POST_REG : +return tas2770_update_pwr_ctrl (tas2770); +default : +return 0 ; + } +} +static const struct snd_soc_dapm_widget tas2770_dapm_widgets[] = {SND_SOC_DAPM_AIF_IN ("ASI1" ,"ASI1 Playback" ,0 ,SND_SOC_NOPM ,0 ,0 ),SND_SOC_DAPM_MUX ("ASI1 Sel" ,SND_SOC_NOPM ,0 ,0 , &tas2770_asi1_mux), -SND_SOC_DAPM_SWITCH ("ISENSE" ,TAS2770_PWR_CTRL ,3 ,1 , &isense_switch), -SND_SOC_DAPM_SWITCH ("VSENSE" ,TAS2770_PWR_CTRL ,2 ,1 , &vsense_switch), +SND_SOC_DAPM_SWITCH_E ("ISENSE" ,TAS2770_PWR_CTRL ,3 ,1 , &isense_switch, + sense_event,SND_SOC_DAPM_PRE_REG |SND_SOC_DAPM_POST_REG ), +SND_SOC_DAPM_SWITCH_E ("VSENSE" ,TAS2770_PWR_CTRL ,2 ,1 , &vsense_switch, + sense_event,SND_SOC_DAPM_PRE_REG |SND_SOC_DAPM_POST_REG ),SND_SOC_DAPM_DAC_E ("DAC" ,NULL ,SND_SOC_NOPM ,0 ,0 , tas2770_dac_event,SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_PRE_PMD ),SND_SOC_DAPM_OUTPUT ("OUT" ),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/592 ASoC: intel/sdw_utils: Assign initial value in asoc_sdw_rt_amp_spk_rtd_init()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: I Hsin Cheng <[email protected]>
[ Upstream commit 5fb3878216aece471af030b33a9fbef3babd8617 ]
Initialize "ret" with "-EINVAL" to handle cases where "strstr()" for "codec_dai->component->name_prefix" doesn't find "-1" nor "-2". In that case "name_prefix" is invalid because for current implementation it's expected to have either "-1" or "-2" in it. (Maybe "-3", "-4" and so on in the future.)
--- sound/soc/sdw_utils/soc_sdw_rt_amp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sdw_utils/soc_sdw_rt_amp.c +1 -1
@@ -190,7 +190,7 @@ int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_socconst struct snd_soc_dapm_route *rt_amp_map;char codec_name[CODEC_NAME_SIZE ];struct snd_soc_dai *codec_dai; -int ret; +int ret = -EINVAL ;int i; rt_amp_map =get_codec_name_and_route (dai, codec_name);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/592 ACPI: bus: Bail out if acpi_kobj registration fails
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 94a370fc8def6038dbc02199db9584b0b3690f1a ]
The ACPI sysfs code will fail to initialize if acpi_kobj is NULL, together with some ACPI drivers.
Follow the other firmware subsystems and bail out if the kobject cannot be registered.
--- drivers/acpi/bus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/acpi/bus.c +4 -2
@@ -1446,8 +1446,10 @@ static int __init acpi_init(void) } acpi_kobj =kobject_create_and_add ("acpi" , firmware_kobj); -if (!acpi_kobj) -pr_debug ("%s: kset create error\n" , __func__); +if (!acpi_kobj) { +pr_err ("Failed to register kobject\n" ); +return -ENOMEM ; + }init_prmt ();acpi_init_pcc ();
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 218/592 ALSA: hda/realtek: Add support for Acer Helios Laptops using CS35L41 HDA
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit d64cbb5ed9227566c068ac9300a85912234d10aa ]
Laptops use 2 CS35L41 Amps with HDA, using External boost with I2C. Similar to previous Acer laptops, these laptops also need the ALC255_FIXUP_PREDATOR_SUBWOOFER quirk to function properly.
--- sound/pci/hda/patch_realtek.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/pci/hda/patch_realtek.c +10 -0
@@ -8029,6 +8029,7 @@ enum {ALC283_FIXUP_DELL_HP_RESUME ,ALC294_FIXUP_ASUS_CS35L41_SPI_2 ,ALC274_FIXUP_HP_AIO_BIND_DACS , + ALC287_FIXUP_PREDATOR_SPK_CS35L41_I2C_2, };/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -9301,6 +9302,12 @@ static const struct hda_fixup alc269_fixups[] = { { } } }, + [ALC287_FIXUP_PREDATOR_SPK_CS35L41_I2C_2] = { + .type = HDA_FIXUP_FUNC, + .v.func = cs35l41_fixup_i2c_two, + .chained = true, + .chain_id = ALC255_FIXUP_PREDATOR_SUBWOOFER + }, [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) {
@@ -10456,6 +10463,9 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1025 ,0x1534 ,"Acer Predator PH315-54" ,ALC255_FIXUP_ACER_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1025 ,0x159c ,"Acer Nitro 5 AN515-58" ,ALC2XX_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x1025 ,0x169a ,"Acer Swift SFG16" ,ALC256_FIXUP_ACER_SFG16_MICMUTE_LED ), +SND_PCI_QUIRK (0x1025 ,0x1826 ,"Acer Helios ZPC" ,ALC287_FIXUP_PREDATOR_SPK_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x1025 ,0x182c ,"Acer Helios ZPD" ,ALC287_FIXUP_PREDATOR_SPK_CS35L41_I2C_2 ), +SND_PCI_QUIRK (0x1025 ,0x1844 ,"Acer Helios ZPS" ,ALC287_FIXUP_PREDATOR_SPK_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x1028 ,0x0470 ,"Dell M101z" ,ALC269_FIXUP_DELL_M101Z ),SND_PCI_QUIRK (0x1028 ,0x053c ,"Dell Latitude E5430" ,ALC292_FIXUP_DELL_E7X ), SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 219/592 ACPI: Add missing prototype for non CONFIG_SUSPEND/CONFIG_X86 case
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit e1bdbbc98279164d910d2de82a745f090a8b249f ]
acpi_register_lps0_dev() and acpi_unregister_lps0_dev() may be used in drivers that don't require CONFIG_SUSPEND or compile on !X86.
Add prototypes for those cases.
--- include/linux/acpi.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
include/linux/acpi.h +8 -1
@@ -1125,13 +1125,13 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,acpi_status acpi_os_prepare_extended_sleep (u8 sleep_state,u32 val_a,u32 val_b); -#if defined(CONFIG_SUSPEND ) && defined(CONFIG_X86 )struct acpi_s2idle_dev_ops {struct list_head list_node;void (*prepare)(void );void (*check)(void );void (*restore)(void ); }; +#if defined(CONFIG_SUSPEND ) && defined(CONFIG_X86 )int acpi_register_lps0_dev (struct acpi_s2idle_dev_ops *arg);void acpi_unregister_lps0_dev (struct acpi_s2idle_dev_ops *arg);int acpi_get_lps0_constraint (struct acpi_device *adev);
@@ -1140,6 +1140,13 @@ static inline int acpi_get_lps0_constraint(struct device *dev) {return ACPI_STATE_UNKNOWN ; } +static inline int acpi_register_lps0_dev (struct acpi_s2idle_dev_ops *arg) +{ +return -ENODEV ; +} +static inline void acpi_unregister_lps0_dev (struct acpi_s2idle_dev_ops *arg) +{ +}#endif /* CONFIG_SUSPEND && CONFIG_X86 */ void arch_reserve_mem_area (acpi_physical_address addr,size_t size);#else
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 220/592 ACPICA: fix acpi parse and parseext cache leaks
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seunghun Han <[email protected]>
[ Upstream commit bed18f0bdcd6737a938264a59d67923688696fc4 ]
ACPICA commit 8829e70e1360c81e7a5a901b5d4f48330e021ea5
I'm Seunghun Han, and I work for National Security Research Institute of South Korea.
I have been doing a research on ACPI and found an ACPI cache leak in ACPI early abort cases.
Boot log of ACPI cache leak is as follows:
[ 0.352414] ACPI: Added _OSI(Module Device) [ 0.353182] ACPI: Added _OSI(Processor Device) [ 0.353182] ACPI: Added _OSI(3.0 _SCP Extensions) [ 0.353182] ACPI: Added _OSI(Processor Aggregator Device) [ 0.356028] ACPI: Unable to start the ACPI Interpreter [ 0.356799] ACPI Error: Could not remove SCI handler (20170303/evmisc-281) [ 0.360215] kmem_cache_destroy Acpi-State: Slab cache still has objects [ 0.360648] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 4.12.0-rc4-next-20170608+ #10 [ 0.361273] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006 [ 0.361873] Call Trace: [ 0.362243] ? dump_stack+0x5c/0x81 [ 0.362591] ? kmem_cache_destroy+0x1aa/0x1c0 [ 0.362944] ? acpi_sleep_proc_init+0x27/0x27 [ 0.363296] ? acpi_os_delete_cache+0xa/0x10 [ 0.363646] ? acpi_ut_delete_caches+0x6d/0x7b [ 0.364000] ? acpi_terminate+0xa/0x14 [ 0.364000] ? acpi_init+0x2af/0x34f [ 0.364000] ? __class_create+0x4c/0x80 [ 0.364000] ? video_setup+0x7f/0x7f [ 0.364000] ? acpi_sleep_proc_init+0x27/0x27 [ 0.364000] ? do_one_initcall+0x4e/0x1a0 [ 0.364000] ? kernel_init_freeable+0x189/0x20a [ 0.364000] ? rest_init+0xc0/0xc0 [ 0.364000] ? kernel_init+0xa/0x100 [ 0.364000] ? ret_from_fork+0x25/0x30
I analyzed this memory leak in detail. I found that “Acpi-State” cache and “Acpi-Parse” cache were merged because the size of cache objects was same slab cache size.
I finally found “Acpi-Parse” cache and “Acpi-parse_ext” cache were leaked using SLAB_NEVER_MERGE flag in kmem_cache_create() function.
Real ACPI cache leak point is as follows:
[ 0.360101] ACPI: Added _OSI(Module Device) [ 0.360101] ACPI: Added _OSI(Processor Device) [ 0.360101] ACPI: Added _OSI(3.0 _SCP Extensions) [ 0.361043] ACPI: Added _OSI(Processor Aggregator Device) [ 0.364016] ACPI: Unable to start the ACPI Interpreter [ 0.365061] ACPI Error: Could not remove SCI handler (20170303/evmisc-281) [ 0.368174] kmem_cache_destroy Acpi-Parse: Slab cache still has objects [ 0.369332] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.12.0-rc4-next-20170608+ #8 [ 0.371256] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006 [ 0.372000] Call Trace: [ 0.372000] ? dump_stack+0x5c/0x81 [ 0.372000] ? kmem_cache_destroy+0x1aa/0x1c0 [ 0.372000] ? acpi_sleep_proc_init+0x27/0x27 [ 0.372000] ? acpi_os_delete_cache+0xa/0x10 [ 0.372000] ? acpi_ut_delete_caches+0x56/0x7b [ 0.372000] ? acpi_terminate+0xa/0x14 [ 0.372000] ? acpi_init+0x2af/0x34f [ 0.372000] ? __class_create+0x4c/0x80 [ 0.372000] ? video_setup+0x7f/0x7f [ 0.372000] ? acpi_sleep_proc_init+0x27/0x27 [ 0.372000] ? do_one_initcall+0x4e/0x1a0 [ 0.372000] ? kernel_init_freeable+0x189/0x20a [ 0.372000] ? rest_init+0xc0/0xc0 [ 0.372000] ? kernel_init+0xa/0x100 [ 0.372000] ? ret_from_fork+0x25/0x30 [ 0.388039] kmem_cache_destroy Acpi-parse_ext: Slab cache still has objects [ 0.389063] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.12.0-rc4-next-20170608+ #8 [ 0.390557] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006 [ 0.392000] Call Trace: [ 0.392000] ? dump_stack+0x5c/0x81 [ 0.392000] ? kmem_cache_destroy+0x1aa/0x1c0 [ 0.392000] ? acpi_sleep_proc_init+0x27/0x27 [ 0.392000] ? acpi_os_delete_cache+0xa/0x10 [ 0.392000] ? acpi_ut_delete_caches+0x6d/0x7b [ 0.392000] ? acpi_terminate+0xa/0x14 [ 0.392000] ? acpi_init+0x2af/0x34f [ 0.392000] ? __class_create+0x4c/0x80 [ 0.392000] ? video_setup+0x7f/0x7f [ 0.392000] ? acpi_sleep_proc_init+0x27/0x27 [ 0.392000] ? do_one_initcall+0x4e/0x1a0 [ 0.392000] ? kernel_init_freeable+0x189/0x20a [ 0.392000] ? rest_init+0xc0/0xc0 [ 0.392000] ? kernel_init+0xa/0x100 [ 0.392000] ? ret_from_fork+0x25/0x30
When early abort is occurred due to invalid ACPI information, Linux kernel terminates ACPI by calling acpi_terminate() function. The function calls acpi_ut_delete_caches() function to delete local caches (acpi_gbl_namespace_ cache, state_cache, operand_cache, ps_node_cache, ps_node_ext_cache).
But the deletion codes in acpi_ut_delete_caches() function only delete slab caches using kmem_cache_destroy() function, therefore the cache objects should be flushed before acpi_ut_delete_caches() function.
"Acpi-Parse" cache and "Acpi-ParseExt" cache are used in an AML parse function, acpi_ps_parse_loop(). The function should complete all ops using acpi_ps_complete_final_op() when an error occurs due to invalid AML codes.
However, the current implementation of acpi_ps_complete_final_op() does not complete all ops when it meets some errors and this cause cache leak.
This cache leak has a security threat because an old kernel (<= 4.9) shows memory locations of kernel functions in stack dump. Some malicious users could use this information to neutralize kernel ASLR.
To fix ACPI cache leak for enhancing security, I made a patch to complete all ops unconditionally for acpi_ps_complete_final_op() function.
I hope that this patch improves the security of Linux kernel.
Thank you.
--- drivers/acpi/acpica/psobject.c | 52 ++++++++++------------------------ 1 file changed, 15 insertions(+), 37 deletions(-)
drivers/acpi/acpica/psobject.c +15 -37
@@ -636,7 +636,8 @@ acpi_status acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, union acpi_parse_object *op, acpi_status status) { - acpi_status status2; + acpi_status return_status = status; +u8 ascending = TRUE;ACPI_FUNCTION_TRACE_PTR (ps_complete_final_op, walk_state);
@@ -650,7 +651,7 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, op)); do { if (op) { - if (walk_state->ascending_callback != NULL) { + if (ascending && walk_state->ascending_callback != NULL) { walk_state->op = op; walk_state->op_info = acpi_ps_get_opcode_info(op->common.
@@ -672,49 +673,26 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, }if (status ==AE_CTRL_TERMINATE ) { - status =AE_OK ; - -/* Clean up */ -do { -if (op) { - status2 = -acpi_ps_complete_this_op - (walk_state, op); -if (ACPI_FAILURE - (status2)) { -return_ACPI_STATUS - (status2); - } - } - -acpi_ps_pop_scope (& - (walk_state-> - parser_state), - &op, - &walk_state-> - arg_types, - &walk_state-> - arg_count); - - }while (op); - -return_ACPI_STATUS (status); + ascending = FALSE; + return_status =AE_CTRL_TERMINATE ; }else if (ACPI_FAILURE (status)) {/* First error is most important */ - (void ) -acpi_ps_complete_this_op (walk_state, - op); -return_ACPI_STATUS (status); + ascending = FALSE; + return_status = status; } } - status2 =acpi_ps_complete_this_op (walk_state, op); -if (ACPI_FAILURE (status2)) { -return_ACPI_STATUS (status2); + status =acpi_ps_complete_this_op (walk_state, op); +if (ACPI_FAILURE (status)) { + ascending = FALSE; +if (ACPI_SUCCESS (return_status) || + return_status ==AE_CTRL_TERMINATE ) { + return_status = status; + } } }
@@ -724,5 +702,5 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, }while (op); -return_ACPI_STATUS (status); +return_ACPI_STATUS (return_status); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 221/592 ACPICA: Apply pack(1) to union aml_resource
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tamir Duberstein <[email protected]>
[ Upstream commit eedf3e3c2f2af55dca42b0ea81dffb808211d269 ]
ACPICA commit 1c28da2242783579d59767617121035dafba18c3
This was originally done in NetBSD:
https://github.com/NetBSD/src/commit/b69d1ac3f7702f67edfe412e4392f77d09804910
and is the correct alternative to the smattering of memcpys I previously contributed to this repository.
This also sidesteps the newly strict checks added in UBSAN:
https://github.com/llvm/llvm-project/commit/792674400f6f04a074a3827349ed0e2ac10067f6
Before this change we see the following UBSAN stack trace in Fuchsia:
#0 0x000021afcfdeca5e in acpi_rs_get_address_common(struct acpi_resource*, union aml_resource*) ../../third_party/acpica/source/components/resources/rsaddr.c:329 <platform-bus-x86.so>+0x6aca5e #1.2 0x000021982bc4af3c in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x41f3c #1.1 0x000021982bc4af3c in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x41f3c #1 0x000021982bc4af3c in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:395 <libclang_rt.asan.so>+0x41f3c #2 0x000021982bc4bb6f in handletype_mismatch_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:137 <libclang_rt.asan.so>+0x42b6f #3 0x000021982bc4b723 in __ubsan_handle_type_mismatch_v1 compiler-rt/lib/ubsan/ubsan_handlers.cpp:142 <libclang_rt.asan.so>+0x42723 #4 0x000021afcfdeca5e in acpi_rs_get_address_common(struct acpi_resource*, union aml_resource*) ../../third_party/acpica/source/components/resources/rsaddr.c:329 <platform-bus-x86.so>+0x6aca5e #5 0x000021afcfdf2089 in acpi_rs_convert_aml_to_resource(struct acpi_resource*, union aml_resource*, struct acpi_rsconvert_info*) ../../third_party/acpica/source/components/resources/rsmisc.c:355 <platform-bus-x86.so>+0x6b2089 #6 0x000021afcfded169 in acpi_rs_convert_aml_to_resources(u8*, u32, u32, u8, void**) ../../third_party/acpica/source/components/resources/rslist.c:137 <platform-bus-x86.so>+0x6ad169 #7 0x000021afcfe2d24a in acpi_ut_walk_aml_resources(struct acpi_walk_state*, u8*, acpi_size, acpi_walk_aml_callback, void**) ../../third_party/acpica/source/components/utilities/utresrc.c:237 <platform-bus-x86.so>+0x6ed24a #8 0x000021afcfde66b7 in acpi_rs_create_resource_list(union acpi_operand_object*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rscreate.c:199 <platform-bus-x86.so>+0x6a66b7 #9 0x000021afcfdf6979 in acpi_rs_get_method_data(acpi_handle, const char*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rsutils.c:770 <platform-bus-x86.so>+0x6b6979 #10 0x000021afcfdf708f in acpi_walk_resources(acpi_handle, char*, acpi_walk_resource_callback, void*) ../../third_party/acpica/source/components/resources/rsxface.c:731 <platform-bus-x86.so>+0x6b708f #11 0x000021afcfa95dcf in acpi::acpi_impl::walk_resources(acpi::acpi_impl*, acpi_handle, const char*, acpi::Acpi::resources_callable) ../../src/devices/board/lib/acpi/acpi-impl.cc:41 <platform-bus-x86.so>+0x355dcf #12 0x000021afcfaa8278 in acpi::device_builder::gather_resources(acpi::device_builder*, acpi::Acpi*, fidl::any_arena&, acpi::Manager*, acpi::device_builder::gather_resources_callback) ../../src/devices/board/lib/acpi/device-builder.cc:84 <platform-bus-x86.so>+0x368278 #13 0x000021afcfbddb87 in acpi::Manager::configure_discovered_devices(acpi::Manager*) ../../src/devices/board/lib/acpi/manager.cc:75 <platform-bus-x86.so>+0x49db87 #14 0x000021afcf99091d in publish_acpi_devices(acpi::Manager*, zx_device_t*, zx_device_t*) ../../src/devices/board/drivers/x86/acpi-nswalk.cc:95 <platform-bus-x86.so>+0x25091d #15 0x000021afcf9c1d4e in x86::X86::do_init(x86::X86*) ../../src/devices/board/drivers/x86/x86.cc:60 <platform-bus-x86.so>+0x281d4e #16 0x000021afcf9e33ad in λ(x86::X86::ddk_init::(anon class)*) ../../src/devices/board/drivers/x86/x86.cc:77 <platform-bus-x86.so>+0x2a33ad #17 0x000021afcf9e313e in fit::internal::target<(lambda at../../src/devices/board/drivers/x86/x86.cc:76:19), false, false, std::__2::allocator<std::byte>, void>::invoke(void*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:183 <platform-bus-x86.so>+0x2a313e #18 0x000021afcfbab4c7 in fit::internal::function_base<16UL, false, void(), std::__2::allocator<std::byte>>::invoke(const fit::internal::function_base<16UL, false, void (), std::__2::allocator<std::byte> >*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:522 <platform-bus-x86.so>+0x46b4c7 #19 0x000021afcfbab342 in fit::function_impl<16UL, false, void(), std::__2::allocator<std::byte>>::operator()(const fit::function_impl<16UL, false, void (), std::__2::allocator<std::byte> >*) ../../sdk/lib/fit/include/lib/fit/function.h:315 <platform-bus-x86.so>+0x46b342 #20 0x000021afcfcd98c3 in async::internal::retained_task::Handler(async_dispatcher_t*, async_task_t*, zx_status_t) ../../sdk/lib/async/task.cc:24 <platform-bus-x86.so>+0x5998c3 #21 0x00002290f9924616 in λ(const driver_runtime::Dispatcher::post_task::(anon class)*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/dispatcher.cc:789 <libdriver_runtime.so>+0x10a616 #22 0x00002290f9924323 in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:788:7), true, false, std::__2::allocator<std::byte>, void, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int>::invoke(void*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0x10a323 #23 0x00002290f9904b76 in fit::internal::function_base<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int), std::__2::allocator<std::byte>>::invoke(const fit::internal::function_base<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int), std::__2::allocator<std::byte> >*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:522 <libdriver_runtime.so>+0xeab76 #24 0x00002290f9904831 in fit::callback_impl<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int), std::__2::allocator<std::byte>>::operator()(fit::callback_impl<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int), std::__2::allocator<std::byte> >*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/function.h:471 <libdriver_runtime.so>+0xea831 #25 0x00002290f98d5adc in driver_runtime::callback_request::Call(driver_runtime::callback_request*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/callback_request.h:74 <libdriver_runtime.so>+0xbbadc #26 0x00002290f98e1e58 in driver_runtime::Dispatcher::dispatch_callback(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >) ../../src/devices/bin/driver_runtime/dispatcher.cc:1248 <libdriver_runtime.so>+0xc7e58 #27 0x00002290f98e4159 in driver_runtime::Dispatcher::dispatch_callbacks(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.cc:1308 <libdriver_runtime.so>+0xca159 #28 0x00002290f9918414 in λ(const driver_runtime::Dispatcher::create_with_adder::(anon class)*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.cc:353 <libdriver_runtime.so>+0xfe414 #29 0x00002290f991812d in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:351:7), true, false, std::__2::allocator<std::byte>, void, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>>::invoke(void*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0xfe12d #30 0x00002290f9906fc7 in fit::internal::function_base<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>), std::__2::allocator<std::byte>>::invoke(const fit::internal::function_base<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>), std::__2::allocator<std::byte> >*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:522 <libdriver_runtime.so>+0xecfc7 #31 0x00002290f9906c66 in fit::function_impl<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>), std::__2::allocator<std::byte>>::operator()(const fit::function_impl<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>), std::__2::allocator<std::byte> >*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/function.h:315 <libdriver_runtime.so>+0xecc66 #32 0x00002290f98e73d9 in driver_runtime::Dispatcher::event_waiter::invoke_callback(driver_runtime::Dispatcher::event_waiter*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.h:543 <libdriver_runtime.so>+0xcd3d9 #33 0x00002290f98e700d in driver_runtime::Dispatcher::event_waiter::handle_event(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, async_dispatcher_t*, async::wait_base*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/dispatcher.cc:1442 <libdriver_runtime.so>+0xcd00d #34 0x00002290f9918983 in async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event(async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>*, async_dispatcher_t*, async::wait_base*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/async_loop_owned_event_handler.h:59 <libdriver_runtime.so>+0xfe983 #35 0x00002290f9918b9e in async::wait_method<async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>, &async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event>::call_handler(async_dispatcher_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../sdk/lib/async/include/lib/async/cpp/wait.h:201 <libdriver_runtime.so>+0xfeb9e #36 0x00002290f99bf509 in async_loop_dispatch_wait(async_loop_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../sdk/lib/async-loop/loop.c:394 <libdriver_runtime.so>+0x1a5509 #37 0x00002290f99b9958 in async_loop_run_once(async_loop_t*, zx_time_t) ../../sdk/lib/async-loop/loop.c:343 <libdriver_runtime.so>+0x19f958 #38 0x00002290f99b9247 in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../sdk/lib/async-loop/loop.c:301 <libdriver_runtime.so>+0x19f247 #39 0x00002290f99ba962 in async_loop_run_thread(void*) ../../sdk/lib/async-loop/loop.c:860 <libdriver_runtime.so>+0x1a0962 #40 0x000041afd176ef30 in start_c11(void*) ../../zircon/third_party/ulib/musl/pthread/pthread_create.c:63 <libc.so>+0x84f30 #41 0x000041afd18a448d in thread_trampoline(uintptr_t, uintptr_t) ../../zircon/system/ulib/runtime/thread.cc:100 <libc.so>+0x1ba48d
--- drivers/acpi/acpica/amlresrc.h | 8 ++++---- drivers/acpi/acpica/rsaddr.c | 13 ++++--------- drivers/acpi/acpica/rscalc.c | 22 +++++----------------- drivers/acpi/acpica/rslist.c | 12 +++--------- drivers/acpi/acpica/utresrc.c | 14 +++++--------- 5 files changed, 21 insertions(+), 48 deletions(-)
drivers/acpi/acpica/amlresrc.h +4 -4
@@ -504,10 +504,6 @@ struct aml_resource_pin_group_config {#define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION 1/* ACPI 6.2 */ -/* restore default alignment */ - -#pragma pack() -/* Union of all resource descriptors, so we can allocate the worst case */ union aml_resource {
@@ -562,6 +558,10 @@ union aml_resource {u8 byte_item; }; +/* restore default alignment */ + +#pragma pack() +/* Interfaces used by both the disassembler and compiler */ void
drivers/acpi/acpica/rsaddr.c +4 -9
@@ -272,18 +272,13 @@ u8 acpi_rs_get_address_common(struct acpi_resource *resource, union aml_resource *aml) { - struct aml_resource_address address; -ACPI_FUNCTION_ENTRY (); -/* Avoid undefined behavior: member access within misaligned address */ - -memcpy (&address, aml,sizeof (address)); -/* Validate the Resource Type */ -if ((address.resource_type >2 ) && - (address.resource_type <0xC0 ) && (address.resource_type !=0x0A )) { +if ((aml->address.resource_type >2 ) && + (aml->address.resource_type <0xC0 ) && + (aml->address.resource_type !=0x0A )) {return (FALSE); }
@@ -304,7 +299,7 @@ acpi_rs_get_address_common(struct acpi_resource *resource,/* Generic resource type, just grab the type_specific byte */ resource->data.address.info.type_specific = - address.specific_flags; + aml->address.specific_flags; }return (TRUE);
drivers/acpi/acpica/rscalc.c +5 -17
@@ -608,18 +608,12 @@ acpi_rs_get_list_length(u8 *aml_buffer,case ACPI_RESOURCE_NAME_SERIAL_BUS :{ -/* Avoid undefined behavior: member access within misaligned address */ - -struct aml_resource_common_serialbus - common_serial_bus; -memcpy (&common_serial_bus, aml_resource, -sizeof (common_serial_bus)); - minimum_aml_resource_length = acpi_gbl_resource_aml_serial_bus_sizes - [common_serial_bus.type]; + [aml_resource->common_serial_bus.type]; extra_struct_bytes += - common_serial_bus.resource_length - + aml_resource->common_serial_bus. + resource_length - minimum_aml_resource_length;break ; }
@@ -688,16 +682,10 @@ acpi_rs_get_list_length(u8 *aml_buffer,*/ if (acpi_ut_get_resource_type (aml_buffer) ==ACPI_RESOURCE_NAME_SERIAL_BUS ) { - -/* Avoid undefined behavior: member access within misaligned address */ - -struct aml_resource_common_serialbus common_serial_bus; -memcpy (&common_serial_bus, aml_resource, -sizeof (common_serial_bus)); - buffer_size = acpi_gbl_resource_struct_serial_bus_sizes - [common_serial_bus.type] + extra_struct_bytes; + [aml_resource->common_serial_bus.type] + + extra_struct_bytes; }else { buffer_size = acpi_gbl_resource_struct_sizes[resource_index] +
drivers/acpi/acpica/rslist.c +3 -9
@@ -55,21 +55,15 @@ acpi_rs_convert_aml_to_resources(u8 * aml, aml_resource = ACPI_CAST_PTR(union aml_resource, aml);if (acpi_ut_get_resource_type (aml) ==ACPI_RESOURCE_NAME_SERIAL_BUS ) { - -/* Avoid undefined behavior: member access within misaligned address */ - -struct aml_resource_common_serialbus common_serial_bus; -memcpy (&common_serial_bus, aml_resource, -sizeof (common_serial_bus)); - -if (common_serial_bus.type >AML_RESOURCE_MAX_SERIALBUSTYPE ) { +if (aml_resource->common_serial_bus.type > +AML_RESOURCE_MAX_SERIALBUSTYPE ) { conversion_table =NULL ; }else {/* This is an I2C, SPI, UART, or CSI2 serial_bus descriptor */ conversion_table = acpi_gbl_convert_resource_serial_bus_dispatch - [common_serial_bus.type]; + [aml_resource->common_serial_bus.type]; } }else { conversion_table =
drivers/acpi/acpica/utresrc.c +5 -9
@@ -361,20 +361,16 @@ acpi_ut_validate_resource(struct acpi_walk_state *walk_state, aml_resource = ACPI_CAST_PTR(union aml_resource, aml);if (resource_type ==ACPI_RESOURCE_NAME_SERIAL_BUS ) { -/* Avoid undefined behavior: member access within misaligned address */ - -struct aml_resource_common_serialbus common_serial_bus; -memcpy (&common_serial_bus, aml_resource, -sizeof (common_serial_bus)); -/* Validate the bus_type field */ -if ((common_serial_bus.type ==0 ) || - (common_serial_bus.type >AML_RESOURCE_MAX_SERIALBUSTYPE )) { +if ((aml_resource->common_serial_bus.type ==0 ) || + (aml_resource->common_serial_bus.type > +AML_RESOURCE_MAX_SERIALBUSTYPE )) {if (walk_state) {ACPI_ERROR ((AE_INFO ,"Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X" , - common_serial_bus.type)); + aml_resource->common_serial_bus. + type)); }return (AE_AML_INVALID_RESOURCE_TYPE ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 222/592 ALSA: hda: cs35l41: Fix swapped l/r audio channels for Acer Helios laptops
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Binding <[email protected]>
[ Upstream commit e43a93c41982e82c1b703dd7fa9c1d965260fbb3 ]
Fixes audio channel assignment from ACPI using configuration table.
--- sound/pci/hda/cs35l41_hda_property.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/pci/hda/cs35l41_hda_property.c +6 -0
@@ -31,6 +31,9 @@ struct cs35l41_config { };static const struct cs35l41_config cs35l41_config_table[] = { + {"10251826" ,2 ,EXTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },0 ,-1 ,-1 ,0 ,0 ,0 }, + {"1025182C" ,2 ,EXTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },0 ,-1 ,-1 ,0 ,0 ,0 }, + {"10251844" ,2 ,EXTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },0 ,-1 ,-1 ,0 ,0 ,0 }, {"10280B27" ,2 ,INTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },1 ,2 ,0 ,1000 ,4500 ,24 }, {"10280B28" ,2 ,INTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },1 ,2 ,0 ,1000 ,4500 ,24 }, {"10280BEB" ,2 ,EXTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },1 ,-1 ,0 ,0 ,0 ,0 },
@@ -452,6 +455,9 @@ struct cs35l41_prop_model {static const struct cs35l41_prop_model cs35l41_prop_model_table[] = { {"CLSA0100" ,NULL , lenovo_legion_no_acpi }, {"CLSA0101" ,NULL , lenovo_legion_no_acpi }, + {"CSC3551" ,"10251826" , generic_dsd_config }, + {"CSC3551" ,"1025182C" , generic_dsd_config }, + {"CSC3551" ,"10251844" , generic_dsd_config }, {"CSC3551" ,"10280B27" , generic_dsd_config }, {"CSC3551" ,"10280B28" , generic_dsd_config }, {"CSC3551" ,"10280BEB" , generic_dsd_config },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 225/592 pmdomain: core: Reset genpd->states to avoid freeing invalid data
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
[ Upstream commit 99012014c902cd9ad85fd288d8a107f33a69855e ]
If genpd_alloc_data() allocates data for the default power-states for the genpd, let's make sure to also reset the pointer in the error path. This makes sure a genpd provider driver doesn't end up trying to free the data again, but using an invalid pointer.
--- drivers/pmdomain/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pmdomain/core.c +3 -1
@@ -2229,8 +2229,10 @@ static int genpd_alloc_data(struct generic_pm_domain *genpd)return 0 ; put:put_device (&genpd->dev); -if (genpd->free_states == genpd_free_default_power_state) +if (genpd->free_states == genpd_free_default_power_state) {kfree (genpd->states); + genpd->states =NULL ; + } free:if (genpd_is_cpu_domain (genpd))free_cpumask_var (genpd->cpus);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 226/592 ACPICA: utilities: Fix overflow check in vsnprintf()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: gldrk <[email protected]>
[ Upstream commit 12b660251007e00a3e4d47ec62dbe3a7ace7023e ]
ACPICA commit d9d59b7918514ae55063b93f3ec041b1a569bf49
The old version breaks sprintf on 64-bit systems for buffers outside [0..UINT32_MAX].
--- drivers/acpi/acpica/utprint.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/acpi/acpica/utprint.c +2 -5
@@ -333,11 +333,8 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args) pos = string; -if (size !=ACPI_UINT32_MAX ) { - end = string + size; - }else { - end =ACPI_CAST_PTR (char,ACPI_UINT32_MAX ); - } + size =ACPI_MIN (size,ACPI_PTR_DIFF (ACPI_MAX_PTR , string)); + end = string + size;for (; *format; ++format) {if (*format !='%' ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 227/592 platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit 9a958e1fd40d6fae8c66385687a00ebd9575a7d2 ]
platform_device_msi_init_and_alloc_irqs() performs two tasks: allocating the MSI domain for a platform device, and allocate a number of MSIs in that domain.
platform_device_msi_free_irqs_all() only frees the MSIs, and leaves the MSI domain alive.
Given that platform_device_msi_init_and_alloc_irqs() is the sole tool a platform device has to allocate platform MSIs, it makes sense for platform_device_msi_free_irqs_all() to teardown the MSI domain at the same time as the MSIs.
This avoids warnings and unexpected behaviours when a driver repeatedly allocates and frees MSIs.
--- drivers/base/platform-msi.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/platform-msi.c +1 -0
@@ -95,5 +95,6 @@ EXPORT_SYMBOL_GPL(platform_device_msi_init_and_alloc_irqs);void platform_device_msi_free_irqs_all (struct device *dev) {msi_domain_free_irqs_all (dev,MSI_DEFAULT_DOMAIN ); +msi_remove_device_irq_domain (dev,MSI_DEFAULT_DOMAIN ); }EXPORT_SYMBOL_GPL (platform_device_msi_free_irqs_all);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/592 ASoC: tegra210_ahub: Add check to of_device_get_match_data()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuanjun Gong <[email protected]>
[ Upstream commit 04cb269c204398763a620d426cbee43064854000 ]
In tegra_ahub_probe(), check the result of function of_device_get_match_data(), return an error code in case it fails.
--- sound/soc/tegra/tegra210_ahub.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/tegra/tegra210_ahub.c +2 -0
@@ -1359,6 +1359,8 @@ static int tegra_ahub_probe(struct platform_device *pdev)return -ENOMEM ; ahub->soc_data =of_device_get_match_data (&pdev->dev); +if (!ahub->soc_data) +return -ENODEV ;platform_set_drvdata (pdev, ahub);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/592 Make cc-option work correctly for the -Wno-xyzzy pattern
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
[ Upstream commit 550ccb178de2f379f5e1a1833dd6f4bdafef4b68 ]
This is the follow-up to commit a79be02bba5c ("Fix mis-uses of 'cc-option' for warning disablement") where I mentioned that the best fix would be to just make 'cc-option' a bit smarter, and work for all compiler options, including the '-Wno-xyzzy' pattern that it used to accept unknown options for.
It turns out that fixing cc-option is pretty straightforward: just rewrite any '-Wno-xyzzy' option pattern to use '-Wxyzzy' instead for testing.
That makes the whole artificial distinction between 'cc-option' and 'cc-disable-warning' go away, and we can happily forget about the odd build rule that you have to treat compiler options that disable warnings specially.
The 'cc-disable-warning' helper remains as a backwards compatibility syntax for now, but is implemented in terms of the new and improved cc-option.
--- scripts/Makefile.compiler | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.compiler +2 -2
@@ -43,7 +43,7 @@ as-instr = $(call try-run,\ # __cc-option # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) __cc-option = $(call try-run,\ - $(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4)) + $(1) -Werror $(2) $(3:-Wno-%=-W%) -c -x c /dev/null -o "$$TMP",$(3),$(4)) # cc-option # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
@@ -57,7 +57,7 @@ cc-option-yn = $(if $(call cc-option,$1),y,n) # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) -cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1)) +cc-disable-warning = $(call cc-option,-Wno-$(strip $1)) # gcc-min-version # Usage: cflags-$(call gcc-min-version, 70100) += -foo
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/592 gpiolib: of: Add polarity quirk for s5m8767
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 4e310626eb4df52a31a142c1360fead0fcbd3793 ]
This is prepare patch for switching s5m8767 regulator driver to use GPIO descriptor. DTS for exynos5250 spring incorrectly specifies "active low" polarity for the DVS and DS line. But per datasheet, they are actually active high. So add polarity quirk for it.
--- drivers/gpio/gpiolib-of.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpio/gpiolib-of.c +9 -0
@@ -224,6 +224,15 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np, */ { "lantiq,pci-xway", "gpio-reset", false }, #endif +#if IS_ENABLED(CONFIG_REGULATOR_S5M8767) + /* + * According to S5M8767, the DVS and DS pin are + * active-high signals. However, exynos5250-spring.dts use + * active-low setting. + */ + { "samsung,s5m8767-pmic", "s5m8767,pmic-buck-dvs-gpios", true }, + { "samsung,s5m8767-pmic", "s5m8767,pmic-buck-ds-gpios", true }, +#endif #if IS_ENABLED(CONFIG_TOUCHSCREEN_TSC2005) /* * DTS for Nokia N900 incorrectly specified "active high"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/592 PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charan Teja Kalla <[email protected]>
[ Upstream commit 40d3b40dce375d6f1c1dbf08d79eed3aed6c691d ]
pm_runtime_put_autosuspend() schedules a hrtimer to expire at "dev->power.timer_expires". If the hrtimer's callback, pm_suspend_timer_fn(), observes that the current time equals "dev->power.timer_expires", it unexpectedly bails out instead of proceeding with runtime suspend.
pm_suspend_timer_fn():
if (expires > 0 && expires < ktime_get_mono_fast_ns()) {
dev->power.timer_expires = 0; rpm_suspend(..)
}
Additionally, as ->timer_expires is not cleared, all the future auto suspend requests will not schedule hrtimer to perform auto suspend.
rpm_suspend():
if ((rpmflags & RPM_AUTO) &&...) {
if (!(dev->power.timer_expires && ...) { <-- this will fail.
hrtimer_start_range_ns(&dev->power.suspend_timer,...);
}
}
Fix this by as well checking if current time reaches the set expiration.
--- drivers/base/power/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/runtime.c +1 -1
@@ -1011,7 +1011,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer)* If 'expires' is after the current time, we've been called * too early. */ -if (expires >0 && expires <ktime_get_mono_fast_ns ()) { +if (expires >0 && expires <=ktime_get_mono_fast_ns ()) { dev->power.timer_expires =0 ;rpm_suspend (dev, dev->power.timer_autosuspends ? (RPM_ASYNC |RPM_AUTO ) :RPM_ASYNC );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/592 power: supply: max17040: adjust thermal channel scaling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Svyatoslav Ryhel <[email protected]>
[ Upstream commit d055f51731744243b244aafb1720f793a5b61f7b ]
IIO thermal channel is in millidegree while power supply framework expects decidegree values. Adjust scaling to get correct readings.
--- drivers/power/supply/max17040_battery.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/power/supply/max17040_battery.c +3 -2
@@ -410,8 +410,9 @@ static int max17040_get_property(struct power_supply *psy,if (!chip->channel_temp)return -ENODATA ; -iio_read_channel_processed_scale (chip->channel_temp, - &val->intval,10 ); +iio_read_channel_processed (chip->channel_temp, &val->intval); + val->intval /=100 ;/* Convert from milli- to deci-degree */ +break ;default :return -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/592 ACPI: battery: negate current when discharging
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Marheine <[email protected]>
[ Upstream commit 234f71555019d308c6bc6f98c78c5551cb8cd56a ]
The ACPI specification requires that battery rate is always positive, but the kernel ABI for POWER_SUPPLY_PROP_CURRENT_NOW (Documentation/ABI/testing/sysfs-class-power) specifies that it should be negative when a battery is discharging. When reporting CURRENT_NOW, massage the value to match the documented ABI.
This only changes the sign of current_now and not power_now because documentation doesn't describe any particular meaning for power_now so leaving power_now unchanged is less likely to confuse userspace unnecessarily, whereas becoming consistent with the documented ABI is worth potentially confusing clients that read current_now.
--- drivers/acpi/battery.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/acpi/battery.c +16 -3
@@ -243,10 +243,23 @@ static int acpi_battery_get_property(struct power_supply *psy,break ;case POWER_SUPPLY_PROP_CURRENT_NOW :case POWER_SUPPLY_PROP_POWER_NOW : -if (battery->rate_now ==ACPI_BATTERY_VALUE_UNKNOWN ) +if (battery->rate_now ==ACPI_BATTERY_VALUE_UNKNOWN ) { ret = -ENODEV ; -else - val->intval = battery->rate_now *1000 ; +break ; + } + + val->intval = battery->rate_now *1000 ; +/* +* When discharging, the current should be reported as a +* negative number as per the power supply class interface +* definition. +*/ +if (psp ==POWER_SUPPLY_PROP_CURRENT_NOW && + (battery->state &ACPI_BATTERY_STATE_DISCHARGING ) && +acpi_battery_handle_discharging (battery) + ==POWER_SUPPLY_STATUS_DISCHARGING ) + val->intval = -val->intval; +break ;case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN :case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/592 drm/amd/display: disable DPP RCG before DPP CLK enable
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charlene Liu <[email protected]>
[ Upstream commit 1bcd679209420305a86833bc357d50021909edaf ]
[why]
DPP CLK enable needs to disable DPPCLK RCG first.
The DPPCLK_en in dccg should always be enabled when the corresponding pipe is enabled.
--- .../amd/display/dc/dccg/dcn35/dcn35_dccg.c | 38 ++++++++++++------- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 21 ++++++---- 2 files changed, 38 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +24 -14
@@ -391,6 +391,7 @@ static void dccg35_set_dppclk_rcg(struct dccg *dccg,struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg); +if (!dccg->ctx->dc->debug.root_clock_optimization.bits.dpp && enable)return ;
@@ -411,6 +412,8 @@ static void dccg35_set_dppclk_rcg(struct dccg *dccg,BREAK_TO_DEBUGGER ();break ; } +//DC_LOG_DEBUG("%s: inst(%d) DPPCLK rcg_disable: %d\n", __func__, inst, enable ? 0 : 1); + } static void dccg35_set_dpstreamclk_rcg(
@@ -1112,30 +1115,24 @@ static void dcn35_set_dppclk_enable(struct dccg *dccg, {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg); +switch (dpp_inst) {case 0 :REG_UPDATE (DPPCLK_CTRL ,DPPCLK0_EN , enable); -if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp) -REG_UPDATE (DCCG_GATE_DISABLE_CNTL6 ,DPPCLK0_ROOT_GATE_DISABLE , enable);break ;case 1 :REG_UPDATE (DPPCLK_CTRL ,DPPCLK1_EN , enable); -if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp) -REG_UPDATE (DCCG_GATE_DISABLE_CNTL6 ,DPPCLK1_ROOT_GATE_DISABLE , enable);break ;case 2 :REG_UPDATE (DPPCLK_CTRL ,DPPCLK2_EN , enable); -if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp) -REG_UPDATE (DCCG_GATE_DISABLE_CNTL6 ,DPPCLK2_ROOT_GATE_DISABLE , enable);break ;case 3 :REG_UPDATE (DPPCLK_CTRL ,DPPCLK3_EN , enable); -if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp) -REG_UPDATE (DCCG_GATE_DISABLE_CNTL6 ,DPPCLK3_ROOT_GATE_DISABLE , enable);break ;default :break ; } +//DC_LOG_DEBUG("%s: dpp_inst(%d) DPPCLK_EN = %d\n", __func__, dpp_inst, enable); }
@@ -1163,14 +1160,18 @@ static void dccg35_update_dpp_dto(struct dccg *dccg, int dpp_inst,ASSERT (false); phase =0xff ; } +dccg35_set_dppclk_rcg (dccg, dpp_inst, false);REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 ,DPPCLK0_DTO_PHASE , phase,DPPCLK0_DTO_MODULO , modulo);dcn35_set_dppclk_enable (dccg, dpp_inst, true); - }else + }else {dcn35_set_dppclk_enable (dccg, dpp_inst, false); +/*we have this in hwss: disable_plane*/ +//dccg35_set_dppclk_rcg(dccg, dpp_inst, true); + } dccg->pipe_dppclk_khz[dpp_inst] = req_dppclk; }
@@ -1182,6 +1183,7 @@ static void dccg35_set_dppclk_root_clock_gating(struct dccg *dccg,if (!dccg->ctx->dc->debug.root_clock_optimization.bits.dpp)return ; +switch (dpp_inst) {case 0 :REG_UPDATE (DCCG_GATE_DISABLE_CNTL6 ,DPPCLK0_ROOT_GATE_DISABLE , enable);
@@ -1198,6 +1200,8 @@ static void dccg35_set_dppclk_root_clock_gating(struct dccg *dccg,default :break ; } +//DC_LOG_DEBUG("%s: dpp_inst(%d) rcg: %d\n", __func__, dpp_inst, enable); + } static void dccg35_get_pixel_rate_div(
@@ -1521,28 +1525,30 @@ static void dccg35_set_physymclk_root_clock_gating(switch (phy_inst) {case 0 :REG_UPDATE (DCCG_GATE_DISABLE_CNTL2 , -PHYASYMCLK_ROOT_GATE_DISABLE , enable ?1 :0 ); +PHYASYMCLK_ROOT_GATE_DISABLE , enable ?0 :1 );break ;case 1 :REG_UPDATE (DCCG_GATE_DISABLE_CNTL2 , -PHYBSYMCLK_ROOT_GATE_DISABLE , enable ?1 :0 ); +PHYBSYMCLK_ROOT_GATE_DISABLE , enable ?0 :1 );break ;case 2 :REG_UPDATE (DCCG_GATE_DISABLE_CNTL2 , -PHYCSYMCLK_ROOT_GATE_DISABLE , enable ?1 :0 ); +PHYCSYMCLK_ROOT_GATE_DISABLE , enable ?0 :1 );break ;case 3 :REG_UPDATE (DCCG_GATE_DISABLE_CNTL2 , -PHYDSYMCLK_ROOT_GATE_DISABLE , enable ?1 :0 ); +PHYDSYMCLK_ROOT_GATE_DISABLE , enable ?0 :1 );break ;case 4 :REG_UPDATE (DCCG_GATE_DISABLE_CNTL2 , -PHYESYMCLK_ROOT_GATE_DISABLE , enable ?1 :0 ); +PHYESYMCLK_ROOT_GATE_DISABLE , enable ?0 :1 );break ;default :BREAK_TO_DEBUGGER ();return ; } +//DC_LOG_DEBUG("%s: dpp_inst(%d) PHYESYMCLK_ROOT_GATE_DISABLE:\n", __func__, phy_inst, enable ? 0 : 1); + } static void dccg35_set_physymclk(
@@ -1643,6 +1649,8 @@ static void dccg35_dpp_root_clock_control(return ;if (clock_on) { +dccg35_set_dppclk_rcg (dccg, dpp_inst, false); +/* turn off the DTO and leave phase/modulo at max */ dcn35_set_dppclk_enable (dccg, dpp_inst,1 ); REG_SET_2(DPPCLK_DTO_PARAM[dpp_inst], 0,
@@ -1654,6 +1662,8 @@ static void dccg35_dpp_root_clock_control(REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 ,DPPCLK0_DTO_PHASE ,0 ,DPPCLK0_DTO_MODULO ,1 ); +/*we have this in hwss: disable_plane*/ +//dccg35_set_dppclk_rcg(dccg, dpp_inst, true); } dccg->dpp_clock_gated[dpp_inst] = !clock_on;
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +14 -7
@@ -241,11 +241,6 @@ void dcn35_init_hw(struct dc *dc) dc->res_pool->hubbub->funcs->allow_self_refresh_control (dc->res_pool->hubbub, !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter); } -if (res_pool->dccg->funcs->dccg_root_gate_disable_control) { -for (i =0 ; i < res_pool->pipe_count; i++) - res_pool->dccg->funcs->dccg_root_gate_disable_control (res_pool->dccg, i,0 ); - } -for (i =0 ; i < res_pool->audio_count; i++) {struct audio *audio = res_pool->audios[i];
@@ -901,12 +896,18 @@ void dcn35_init_pipes(struct dc *dc, struct dc_state *context)void dcn35_enable_plane (struct dc *dc,struct pipe_ctx *pipe_ctx,struct dc_state *context) { +struct dpp *dpp = pipe_ctx->plane_res.dpp; +struct dccg *dccg = dc->res_pool->dccg; + +/* enable DCFCLK current DCHUB */ pipe_ctx->plane_res.hubp->funcs->hubp_clk_cntl (pipe_ctx->plane_res.hubp, true);/* initialize HUBP on power up */ pipe_ctx->plane_res.hubp->funcs->hubp_init (pipe_ctx->plane_res.hubp); - +/*make sure DPPCLK is on*/ + dccg->funcs->dccg_root_gate_disable_control (dccg, dpp->inst, true); + dpp->funcs->dpp_dppclk_control (dpp, false, true);/* make sure OPP_PIPE_CLOCK_EN = 1 */ pipe_ctx->stream_res.opp->funcs->opp_pipe_clock_control( pipe_ctx->stream_res.opp,
@@ -923,6 +924,7 @@ void dcn35_enable_plane(struct dc *dc, struct pipe_ctx *pipe_ctx,// Program system aperture settings pipe_ctx->plane_res.hubp->funcs->hubp_set_vm_system_aperture_settings (pipe_ctx->plane_res.hubp, &apt); } +//DC_LOG_DEBUG("%s: dpp_inst(%d) =\n", __func__, dpp->inst); if (!pipe_ctx->top_pipe && pipe_ctx->plane_state
@@ -938,6 +940,8 @@ void dcn35_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx) {struct hubp *hubp = pipe_ctx->plane_res.hubp;struct dpp *dpp = pipe_ctx->plane_res.dpp; +struct dccg *dccg = dc->res_pool->dccg; + dc->hwss.wait_for_mpcc_disconnect (dc, dc->res_pool, pipe_ctx);
@@ -955,7 +959,8 @@ void dcn35_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx) hubp->funcs->hubp_clk_cntl (hubp, false); dpp->funcs->dpp_dppclk_control (dpp, false, false); -/*to do, need to support both case*/ + dccg->funcs->dccg_root_gate_disable_control (dccg, dpp->inst, false); + hubp->power_gated = true; hubp->funcs->hubp_reset (hubp);
@@ -967,6 +972,8 @@ void dcn35_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx) pipe_ctx->top_pipe =NULL ; pipe_ctx->bottom_pipe =NULL ; pipe_ctx->plane_state =NULL ; +//DC_LOG_DEBUG("%s: dpp_inst(%d)=\n", __func__, dpp->inst); + }void dcn35_disable_plane (struct dc *dc,struct dc_state *state,struct pipe_ctx *pipe_ctx)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/592 drm/bridge: select DRM_KMS_HELPER for AUX_BRIDGE
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit b12fa5e76e1463fc5a196f2717040e4564e184b6 ]
The aux bridge uses devm_drm_of_get_bridge() from the panel bridge (and correctly selects DRM_PANEL_BRIDGE). However panel bridge is not a separate module, it is compiled into the drm_kms_helper.o. Select DRM_KMS_HELPER too to express this dependency.
--- drivers/gpu/drm/bridge/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/Kconfig +1 -0
@@ -16,6 +16,7 @@ config DRM_AUX_BRIDGE tristate depends on DRM_BRIDGE && OF select AUXILIARY_BUS + select DRM_KMS_HELPER select DRM_PANEL_BRIDGE help Simple transparent bridge that is used by several non-DRM drivers to
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/592 drm/amdgpu/gfx6: fix CSIB handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 8307ebc15c1ea98a8a0b7837af1faa6c01514577 ]
We shouldn't return after the last section.
We need to update the rest of the CSIB.
--- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -2
@@ -2874,8 +2874,6 @@ static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev, buffer[count++] =cpu_to_le32 (ext->reg_index -0xa000 );for (i =0 ; i < ext->reg_count; i++) buffer[count++] =cpu_to_le32 (ext->extent[i]); - }else { -return ; } } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/592 media: imx-jpeg: Check decoding is ongoing for motion-jpeg
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Qian <[email protected]>
[ Upstream commit fd5b6cd730676940df63b0970bb1ba30bca1aac3 ]
As the first frame in "repeat-mode" is the pattern, the pattern done interrupt is ignored by the driver. With small resolution bitstreams, the interrupts might fire too quickly and hardware combine two irqs to once because irq handle have latency. Thus the driver might miss the frame decode done interrupt from the first actual frame.
In order to avoid the driver wait for the frame done interrupt that has been combined to the pattern done interrupt and been ignored, driver will check the curr_desc and slot_status registers to figure out if the decoding of actual frame is finished or not.
Firstly we check the curr_desc register,
- if it is still pointing to the pattern descriptor, the second actual frame is not started, we can wait for its frame-done interrupt.
- if the curr_desc has pointed to the frame descriptor, then we check the ongoing bit of slot_status register.
- if the ongoing bit is set to 1, the decoding of the actual frame is not finished, we can wait for its frame-done interrupt.
- if the ongoing bit is set to 0, the decoding of the actual frame is finished, we can't wait for the second interrupt, but mark it as done.
But there is still a small problem, that the curr_desc and slot_status registers are not synchronous. curr_desc is updated when the next_descpt_ptr is loaded, but the ongoing bit of slot_status is set after the 32 bytes descriptor is loaded, there will be a short time interval in between, which may cause fake false. Consider read register is quite slow compared with IP read 32byte from memory, read twice slot_status can avoid this situation.
--- .../media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h | 1 + .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 31 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg-hw.h +1 -0
@@ -89,6 +89,7 @@/* SLOT_STATUS fields for slots 0..3 */ #define SLOT_STATUS_FRMDONE (0x1 << 3)#define SLOT_STATUS_ENC_CONFIG_ERR (0x1 << 8) +#define SLOT_STATUS_ONGOING (0x1 << 31)/* SLOT_IRQ_EN fields TBD */
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +30 -1
@@ -884,6 +884,34 @@ static u32 mxc_jpeg_get_plane_size(struct mxc_jpeg_q_data *q_data, u32 plane_no)return size; } +static bool mxc_dec_is_ongoing (struct mxc_jpeg_ctx *ctx) +{ +struct mxc_jpeg_dev *jpeg = ctx->mxc_jpeg; +u32 curr_desc; +u32 slot_status; + + curr_desc =readl (jpeg->base_reg +MXC_SLOT_OFFSET (ctx->slot,SLOT_CUR_DESCPT_PTR )); +if (curr_desc == jpeg->slot_data.cfg_desc_handle) +return true; + + slot_status =readl (jpeg->base_reg +MXC_SLOT_OFFSET (ctx->slot,SLOT_STATUS )); +if (slot_status &SLOT_STATUS_ONGOING ) +return true; + +/* +* The curr_desc register is updated when next_descpt_ptr is loaded, +* the ongoing bit of slot_status is set when the 32 bytes descriptor is loaded. +* So there will be a short time interval in between, which may cause fake false. +* Consider read register is quite slow compared with IP read 32byte from memory, +* read twice slot_status can avoid this situation. +*/ + slot_status =readl (jpeg->base_reg +MXC_SLOT_OFFSET (ctx->slot,SLOT_STATUS )); +if (slot_status &SLOT_STATUS_ONGOING ) +return true; + +return false; +} +static irqreturn_t mxc_jpeg_dec_irq (int irq,void *priv) {struct mxc_jpeg_dev *jpeg = priv;
@@ -953,7 +981,8 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv)mxc_jpeg_enc_mode_go (dev, reg,mxc_jpeg_is_extended_sequential (q_data->fmt)); goto job_unlock; } -if (jpeg->mode ==MXC_JPEG_DECODE && jpeg_src_buf->dht_needed) { +if (jpeg->mode ==MXC_JPEG_DECODE && jpeg_src_buf->dht_needed && +mxc_dec_is_ongoing (ctx)) { jpeg_src_buf->dht_needed = false;dev_dbg (dev,"Decoder DHT cfg finished. Start decoding...\n" ); goto job_unlock;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/592 drm/rockchip: inno-hdmi: Fix video timing HSYNC/VSYNC polarity setting for rk3036
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Yan <[email protected]>
[ Upstream commit ad10b82c2bcac7f87ac6eaecfca33378b43425ee ]
The HSYNC/VSYNC polarity of rk3036 HDMI are controlled by GRF. Without the polarity configuration in GRF, it can be observed from the HDMI protocol analyzer that the H/V front/back timing output by RK3036 HDMI are currently not in line with the specifications.
--- drivers/gpu/drm/rockchip/inno_hdmi.c | 36 +++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/inno_hdmi.c +35 -1
@@ -10,10 +10,12 @@#include <linux/delay.h> #include <linux/err.h> #include <linux/hdmi.h> +#include <linux/mfd/syscon.h> #include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/platform_device.h> +#include <linux/regmap.h> #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h>
@@ -29,8 +31,19 @@#include "inno_hdmi.h" +#define HIWORD_UPDATE (val, mask) ((val) | (mask) << 16) +#define INNO_HDMI_MIN_TMDS_CLOCK 25000000U +#define RK3036_GRF_SOC_CON2 0x148 +#define RK3036_HDMI_PHSYNC BIT(4) +#define RK3036_HDMI_PVSYNC BIT(5) + +enum inno_hdmi_dev_type { +RK3036_HDMI , +RK3128_HDMI , +}; +struct inno_hdmi_phy_config {unsigned long pixelclock;u8 pre_emphasis;
@@ -38,6 +51,7 @@ struct inno_hdmi_phy_config { };struct inno_hdmi_variant { +enum inno_hdmi_dev_type dev_type;struct inno_hdmi_phy_config *phy_configs;struct inno_hdmi_phy_config *default_phy_config; };
@@ -58,6 +72,7 @@ struct inno_hdmi {struct clk *pclk;struct clk *refclk;void __iomem *regs; +struct regmap *grf;struct drm_connector connector;struct rockchip_encoder encoder;
@@ -374,7 +389,15 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi)static int inno_hdmi_config_video_timing (struct inno_hdmi *hdmi,struct drm_display_mode *mode) { -int value; +int value, psync; + +if (hdmi->variant->dev_type ==RK3036_HDMI ) { + psync = mode->flags &DRM_MODE_FLAG_PHSYNC ?RK3036_HDMI_PHSYNC :0 ; + value =HIWORD_UPDATE (psync,RK3036_HDMI_PHSYNC ); + psync = mode->flags &DRM_MODE_FLAG_PVSYNC ?RK3036_HDMI_PVSYNC :0 ; + value |=HIWORD_UPDATE (psync,RK3036_HDMI_PVSYNC ); +regmap_write (hdmi->grf,RK3036_GRF_SOC_CON2 , value); + }/* Set detail external video timing polarity and interlace mode */ value =v_EXTERANL_VIDEO (1 );
@@ -911,6 +934,15 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, goto err_disable_pclk; } +if (hdmi->variant->dev_type ==RK3036_HDMI ) { + hdmi->grf =syscon_regmap_lookup_by_phandle (dev->of_node,"rockchip,grf" ); +if (IS_ERR (hdmi->grf)) { + ret =dev_err_probe (dev,PTR_ERR (hdmi->grf), +"Unable to get rockchip,grf\n" ); + goto err_disable_clk; + } + } + irq =platform_get_irq (pdev,0 );if (irq <0 ) { ret = irq;
@@ -995,11 +1027,13 @@ static void inno_hdmi_remove(struct platform_device *pdev) }static const struct inno_hdmi_variant rk3036_inno_hdmi_variant = { + .dev_type =RK3036_HDMI , .phy_configs = rk3036_hdmi_phy_configs, .default_phy_config = &rk3036_hdmi_phy_configs[1 ], };static const struct inno_hdmi_variant rk3128_inno_hdmi_variant = { + .dev_type =RK3128_HDMI , .phy_configs = rk3128_hdmi_phy_configs, .default_phy_config = &rk3128_hdmi_phy_configs[1 ], };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/592 drm/dp: add option to disable zero sized address only transactions.
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
[ Upstream commit f0ddbb1eed1898286d2bd99fd6ab64ca9700d267 ]
Some older NVIDIA and some newer NVIDIA hardware/firmware seems to have issues with address only transactions (firmware rejects them).
Add an option to the core drm dp to avoid address only transactions, This just puts the MOT flag removal on the last message of the transfer and avoids the start of transfer transaction.
This with the flag set in nouveau, allows eDP probing on GB203 device.
--- drivers/gpu/drm/display/drm_dp_helper.c | 39 +++++++++++++++---------- include/drm/display/drm_dp_helper.h | 5 ++++ 2 files changed, 28 insertions(+), 16 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +23 -16
@@ -2081,14 +2081,17 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,for (i =0 ; i < num; i++) { msg.address = msgs[i].addr; -drm_dp_i2c_msg_set_request (&msg, &msgs[i]); -/* Send a bare address packet to start the transaction. -* Zero sized messages specify an address only (bare -* address) transaction. -*/ - msg.buffer =NULL ; - msg.size =0 ; - err =drm_dp_i2c_do_msg (aux, &msg); + +if (!aux->no_zero_sized) { +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +/* Send a bare address packet to start the transaction. +* Zero sized messages specify an address only (bare +* address) transaction. +*/ + msg.buffer =NULL ; + msg.size =0 ; + err =drm_dp_i2c_do_msg (aux, &msg); + }/* * Reset msg.request in case in case it got
@@ -2107,6 +2110,8 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.buffer = msgs[i].buf + j; msg.size =min (transfer_size, msgs[i].len - j); +if (j + msg.size == msgs[i].len && aux->no_zero_sized) + msg.request &= ~DP_AUX_I2C_MOT ; err =drm_dp_i2c_drain_msg (aux, &msg);/*
@@ -2124,15 +2129,17 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, }if (err >=0 ) err = num; -/* Send a bare address packet to close out the transaction. -* Zero sized messages specify an address only (bare -* address) transaction. -*/ - msg.request &= ~DP_AUX_I2C_MOT ; - msg.buffer =NULL ; - msg.size =0 ; - (void )drm_dp_i2c_do_msg (aux, &msg); +if (!aux->no_zero_sized) { +/* Send a bare address packet to close out the transaction. +* Zero sized messages specify an address only (bare +* address) transaction. +*/ + msg.request &= ~DP_AUX_I2C_MOT ; + msg.buffer =NULL ; + msg.size =0 ; + (void )drm_dp_i2c_do_msg (aux, &msg); + }return err; }
include/drm/display/drm_dp_helper.h +5 -0
@@ -518,6 +518,11 @@ struct drm_dp_aux {* @powered_down: If true then the remote endpoint is powered down. */ bool powered_down; + +/** +* @no_zero_sized: If the hw can't use zero sized transfers (NVIDIA) +*/ +bool no_zero_sized; };int drm_dp_dpcd_probe (struct drm_dp_aux *aux,unsigned int offset);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/592 sunrpc: update nextcheck time when adding new cache entries
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
[ Upstream commit 5ca00634c8bbb2979c73465588f486b9632f5ed5 ]
The cache_detail structure uses a "nextcheck" field to control hash table scanning intervals. When a table scan begins, nextcheck is set to current time plus 1800 seconds. During scanning, if cache_detail is not empty and a cache entry's expiry time is earlier than the current nextcheck, the nextcheck is updated to that expiry time.
This mechanism ensures that:
1) Empty cache_details are scanned every 1800 seconds to avoid unnecessary scans
2) Non-empty cache_details are scanned based on the earliest expiry time found
However, when adding a new cache entry to an empty cache_detail, the nextcheck time was not being updated, remaining at 1800 seconds. This could delay cache cleanup for up to 1800 seconds, potentially blocking threads(such as nfsd) that are waiting for cache cleanup.
Fix this by updating the nextcheck time whenever a new cache entry is added.
--- net/sunrpc/cache.c | 2 ++ 1 file changed, 2 insertions(+)
net/sunrpc/cache.c +2 -0
@@ -135,6 +135,8 @@ static struct cache_head *sunrpc_cache_add_entry(struct cache_detail *detail,hlist_add_head_rcu (&new->cache_list, head); detail->entries++; +if (detail->nextcheck > new->expiry_time) + detail->nextcheck = new->expiry_time +1 ;cache_get (new);spin_unlock (&detail->hash_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/592 drm/amdgpu: Fix API status offset for MES queue reset
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse.Zhang <[email protected]>
[ Upstream commit ad7c088e31f026d71fe87fd09473fafb7d6ed006 ]
The mes_v11_0_reset_hw_queue and mes_v12_0_reset_hw_queue functions were using the wrong union type (MESAPI__REMOVE_QUEUE) when getting the offset for api_status. Since these functions handle queue reset operations, they should use MESAPI__RESET union instead.
This fixes the polling of API status during hardware queue reset operations in the MES for both v11 and v12 versions.
--- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1 -1
@@ -480,7 +480,7 @@ static int mes_v11_0_reset_hw_queue(struct amdgpu_mes *mes,return mes_v11_0_submit_pkt_and_poll_completion (mes, &mes_reset_queue_pkt,sizeof (mes_reset_queue_pkt), - offsetof(union MESAPI__REMOVE_QUEUE , api_status)); + offsetof(union MESAPI__RESET , api_status)); } static int mes_v11_0_map_legacy_queue(struct amdgpu_mes *mes,
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1 -1
@@ -500,7 +500,7 @@ static int mes_v12_0_reset_hw_queue(struct amdgpu_mes *mes,return mes_v12_0_submit_pkt_and_poll_completion (mes, pipe, &mes_reset_queue_pkt,sizeof (mes_reset_queue_pkt), - offsetof(union MESAPI__REMOVE_QUEUE , api_status)); + offsetof(union MESAPI__RESET , api_status)); } static int mes_v12_0_map_legacy_queue(struct amdgpu_mes *mes,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/592 drm/amd/display: DCN32 null data check
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yihan Zhu <[email protected]>
[ Upstream commit c9646e5a7e01c3ede286ec5edd4fcb2e1e80261d ]
[WHY & HOW]
Avoid null curve data structure used in the cm block for the potential issue.
--- .../drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c | 380 +++++++++--------- 1 file changed, 192 insertions(+), 188 deletions(-)
drivers/gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c +192 -188
@@ -370,275 +370,279 @@ void mpc32_program_shaper_luta_settings( MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_BASE_B, params->corner_points[1].red.custom_float_y); curve = params->arr_curve_points; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_0_1 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_2_3 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_4_5 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_6_7 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_8_9 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_10_11 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_12_13 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_14_15 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_16_17 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_18_19 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_20_21 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_22_23 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_24_25 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_26_27 [mpcc_id],0 , +if (curve) { +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_0_1 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_28_29 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_30_31 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_32_33 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); -} - - -void mpc32_program_shaper_lutb_settings ( -struct mpc *mpc, -const struct pwl_params *params, -uint32_t mpcc_id) -{ -const struct gamma_curve *curve; -struct dcn30_mpc *mpc30 =TO_DCN30_MPC (mpc); - -REG_SET_2 (MPCC_MCM_SHAPER_RAMB_START_CNTL_B [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_B , params->corner_points[0 ].blue.custom_float_x, -MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_SEGMENT_B ,0 ); -REG_SET_2 (MPCC_MCM_SHAPER_RAMB_START_CNTL_G [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_B , params->corner_points[0 ].green.custom_float_x, -MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_SEGMENT_B ,0 ); -REG_SET_2 (MPCC_MCM_SHAPER_RAMB_START_CNTL_R [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_B , params->corner_points[0 ].red.custom_float_x, -MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_SEGMENT_B ,0 ); - -REG_SET_2 (MPCC_MCM_SHAPER_RAMB_END_CNTL_B [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_B , params->corner_points[1 ].blue.custom_float_x, -MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_BASE_B , params->corner_points[1 ].blue.custom_float_y); -REG_SET_2 (MPCC_MCM_SHAPER_RAMB_END_CNTL_G [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_B , params->corner_points[1 ].green.custom_float_x, -MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_BASE_B , params->corner_points[1 ].green.custom_float_y); -REG_SET_2 (MPCC_MCM_SHAPER_RAMB_END_CNTL_R [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_B , params->corner_points[1 ].red.custom_float_x, -MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_BASE_B , params->corner_points[1 ].red.custom_float_y); - - curve = params->arr_curve_points; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_0_1 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_2_3 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_2_3 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_4_5 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_4_5 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_6_7 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_6_7 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_8_9 [mpcc_id],0 , -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, -MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_8_9 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_10_11 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_10_11 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_12_13 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_12_13 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_14_15 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_14_15 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_16_17 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_16_17 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_18_19 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_18_19 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_20_21 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_20_21 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_22_23 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_22_23 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_24_25 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_24_25 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_26_27 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_26_27 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_28_29 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_28_29 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_30_31 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_30_31 [mpcc_id],0 , + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMA_REGION_32_33 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + } +} + + +void mpc32_program_shaper_lutb_settings ( +struct mpc *mpc, +const struct pwl_params *params, +uint32_t mpcc_id) +{ +const struct gamma_curve *curve; +struct dcn30_mpc *mpc30 =TO_DCN30_MPC (mpc); + +REG_SET_2 (MPCC_MCM_SHAPER_RAMB_START_CNTL_B [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_B , params->corner_points[0 ].blue.custom_float_x, +MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_SEGMENT_B ,0 ); +REG_SET_2 (MPCC_MCM_SHAPER_RAMB_START_CNTL_G [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_B , params->corner_points[0 ].green.custom_float_x, +MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_SEGMENT_B ,0 ); +REG_SET_2 (MPCC_MCM_SHAPER_RAMB_START_CNTL_R [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_B , params->corner_points[0 ].red.custom_float_x, +MPCC_MCM_SHAPER_RAMA_EXP_REGION_START_SEGMENT_B ,0 ); - curve +=2 ; -REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_32_33 [mpcc_id],0 , +REG_SET_2 (MPCC_MCM_SHAPER_RAMB_END_CNTL_B [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_B , params->corner_points[1 ].blue.custom_float_x, +MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_BASE_B , params->corner_points[1 ].blue.custom_float_y); +REG_SET_2 (MPCC_MCM_SHAPER_RAMB_END_CNTL_G [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_B , params->corner_points[1 ].green.custom_float_x, +MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_BASE_B , params->corner_points[1 ].green.custom_float_y); +REG_SET_2 (MPCC_MCM_SHAPER_RAMB_END_CNTL_R [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_B , params->corner_points[1 ].red.custom_float_x, +MPCC_MCM_SHAPER_RAMA_EXP_REGION_END_BASE_B , params->corner_points[1 ].red.custom_float_y); + + curve = params->arr_curve_points; +if (curve) { +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_0_1 [mpcc_id],0 ,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset,MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_2_3 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_4_5 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_6_7 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_8_9 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_10_11 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_12_13 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_14_15 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_16_17 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_18_19 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_20_21 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_22_23 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_24_25 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_26_27 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_28_29 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_30_31 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + + curve +=2 ; +REG_SET_4 (MPCC_MCM_SHAPER_RAMB_REGION_32_33 [mpcc_id],0 , +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_LUT_OFFSET , curve[0 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION0_NUM_SEGMENTS , curve[0 ].segments_num, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_LUT_OFFSET , curve[1 ].offset, +MPCC_MCM_SHAPER_RAMA_EXP_REGION1_NUM_SEGMENTS , curve[1 ].segments_num); + } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/592 drm/xe: Fix CFI violation when accessing sysfs files
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeevaka Prabu Badrappan <[email protected]>
[ Upstream commit 4ea512714c42c69828b4a2647d206bf404043ad5 ]
When an attribute group is created with sysfs_create_group() or sysfs_create_files() the ->sysfs_ops() callback is set to kobj_sysfs_ops, which sets the ->show() callback to kobj_attr_show(). kobj_attr_show() uses container_of() to get the ->show() callback from the attribute it was passed, meaning the ->show() callback needs to be the same type as the ->show() callback in 'struct kobj_attribute'.
However, cur_freq_show() has the type of the ->show() callback in 'struct device_attribute', which causes a CFI violation when opening the 'id' sysfs node under gtidle/freq/throttle. This happens to work because the layout of 'struct kobj_attribute' and 'struct device_attribute' are the same, so the container_of() cast happens to allow the ->show() callback to still work.
Changed the type of cur_freq_show() and few more functions to match the ->show() callback in 'struct kobj_attributes' to resolve the CFI violation.
CFI failure seen while accessing sysfs files under /sys/class/drm/card0/device/tile0/gt*/gtidle/* /sys/class/drm/card0/device/tile0/gt*/freq0/* /sys/class/drm/card0/device/tile0/gt*/freq0/throttle/*
[ 2599.618075] RIP: 0010:__cfi_cur_freq_show+0xd/0x10 [xe] [ 2599.624452] Code: 44 c1 44 89 fa e8 03 95 39 f2 48 98 5b 41 5e 41 5f 5d c3 c9 [ 2599.646638] RSP: 0018:ffffbe438ead7d10 EFLAGS: 00010286 [ 2599.652823] RAX: ffff9f7d8b3845d8 RBX: ffff9f7dee8c95d8 RCX: 0000000000000000 [ 2599.661246] RDX: ffff9f7e6f439000 RSI: ffffffffc13ada30 RDI: ffff9f7d975d4b00 [ 2599.669669] RBP: ffffbe438ead7d18 R08: 0000000000001000 R09: ffff9f7e6f439000 [ 2599.678092] R10: 00000000e07304a6 R11: ffffffffc1241ca0 R12: ffffffffb4836ea0 [ 2599.688435] R13: ffff9f7e45fb1180 R14: ffff9f7d975d4b00 R15: ffff9f7e6f439000 [ 2599.696860] FS: 000076b02b66cfc0(0000) GS:ffff9f80ef400000(0000) knlGS:00000 [ 2599.706412] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2599.713196] CR2: 00005f80d94641a9 CR3: 00000001e44ec006 CR4: 0000000100f72ef0 [ 2599.721618] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2599.730041] DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400 [ 2599.738464] PKRU: 55555554 [ 2599.741655] Call Trace: [ 2599.744541] <TASK> [ 2599.747017] ? __die_body+0x69/0xb0 [ 2599.751151] ? die+0xa9/0xd0 [ 2599.754548] ? do_trap+0x89/0x160 [ 2599.758476] ? __cfi_cur_freq_show+0xd/0x10 [xe b37985c94829727668bd7c5b33c1] [ 2599.768315] ? handle_invalid_op+0x69/0x90 [ 2599.773167] ? __cfi_cur_freq_show+0xd/0x10 [xe b37985c94829727668bd7c5b33c1] [ 2599.783010] ? exc_invalid_op+0x36/0x60 [ 2599.787552] ? fred_hwexc+0x123/0x1a0 [ 2599.791873] ? fred_entry_from_kernel+0x7b/0xd0 [ 2599.797219] ? asm_fred_entrypoint_kernel+0x45/0x70 [ 2599.802976] ? act_freq_show+0x70/0x70 [xe b37985c94829727668bd7c5b33c1d9998] [ 2599.812301] ? __cfi_cur_freq_show+0xd/0x10 [xe b37985c94829727668bd7c5b33c1] [ 2599.822137] ? __kmalloc_node_noprof+0x1f3/0x420 [ 2599.827594] ? __kvmalloc_node_noprof+0xcb/0x180 [ 2599.833045] ? kobj_attr_show+0x22/0x40 [ 2599.837571] sysfs_kf_seq_show+0xa8/0x110 [ 2599.842302] kernfs_seq_show+0x38/0x50
--- drivers/gpu/drm/xe/xe_gt_freq.c | 82 ++++++++++++++------------ drivers/gpu/drm/xe/xe_gt_idle.c | 28 +++++---- drivers/gpu/drm/xe/xe_gt_throttle.c | 90 ++++++++++++++--------------- 3 files changed, 107 insertions(+), 93 deletions(-)
drivers/gpu/drm/xe/xe_gt_freq.c +46 -36
@@ -61,9 +61,10 @@ dev_to_xe(struct device *dev)return gt_to_xe (kobj_to_gt (dev->kobj.parent)); } -static ssize_t act_freq_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t act_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;
@@ -73,11 +74,12 @@ static ssize_t act_freq_show(struct device *dev,return sysfs_emit (buf,"%d\n" , freq); } -static DEVICE_ATTR_RO (act_freq); +static struct kobj_attribute attr_act_freq =__ATTR_RO (act_freq); -static ssize_t cur_freq_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t cur_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;ssize_t ret;
@@ -90,11 +92,12 @@ static ssize_t cur_freq_show(struct device *dev,return sysfs_emit (buf,"%d\n" , freq); } -static DEVICE_ATTR_RO (cur_freq); +static struct kobj_attribute attr_cur_freq =__ATTR_RO (cur_freq); -static ssize_t rp0_freq_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t rp0_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;
@@ -104,11 +107,12 @@ static ssize_t rp0_freq_show(struct device *dev,return sysfs_emit (buf,"%d\n" , freq); } -static DEVICE_ATTR_RO (rp0_freq); +static struct kobj_attribute attr_rp0_freq =__ATTR_RO (rp0_freq); -static ssize_t rpe_freq_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t rpe_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;
@@ -118,11 +122,12 @@ static ssize_t rpe_freq_show(struct device *dev,return sysfs_emit (buf,"%d\n" , freq); } -static DEVICE_ATTR_RO (rpe_freq); +static struct kobj_attribute attr_rpe_freq =__ATTR_RO (rpe_freq); -static ssize_t rpa_freq_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t rpa_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;
@@ -132,20 +137,22 @@ static ssize_t rpa_freq_show(struct device *dev,return sysfs_emit (buf,"%d\n" , freq); } -static DEVICE_ATTR_RO (rpa_freq); +static struct kobj_attribute attr_rpa_freq =__ATTR_RO (rpa_freq); -static ssize_t rpn_freq_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t rpn_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);return sysfs_emit (buf,"%d\n" ,xe_guc_pc_get_rpn_freq (pc)); } -static DEVICE_ATTR_RO (rpn_freq); +static struct kobj_attribute attr_rpn_freq =__ATTR_RO (rpn_freq); -static ssize_t min_freq_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t min_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;ssize_t ret;
@@ -159,9 +166,10 @@ static ssize_t min_freq_show(struct device *dev,return sysfs_emit (buf,"%d\n" , freq); } -static ssize_t min_freq_store (struct device *dev,struct device_attribute *attr, -const char *buff,size_t count) +static ssize_t min_freq_store (struct kobject *kobj, +struct kobj_attribute *attr,const char *buff,size_t count) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;ssize_t ret;
@@ -178,11 +186,12 @@ static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr,return count; } -static DEVICE_ATTR_RW (min_freq); +static struct kobj_attribute attr_min_freq =__ATTR_RW (min_freq); -static ssize_t max_freq_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t max_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;ssize_t ret;
@@ -196,9 +205,10 @@ static ssize_t max_freq_show(struct device *dev,return sysfs_emit (buf,"%d\n" , freq); } -static ssize_t max_freq_store (struct device *dev,struct device_attribute *attr, -const char *buff,size_t count) +static ssize_t max_freq_store (struct kobject *kobj, +struct kobj_attribute *attr,const char *buff,size_t count) { +struct device *dev =kobj_to_dev (kobj);struct xe_guc_pc *pc =dev_to_pc (dev);u32 freq;ssize_t ret;
@@ -215,17 +225,17 @@ static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,return count; } -static DEVICE_ATTR_RW (max_freq); +static struct kobj_attribute attr_max_freq =__ATTR_RW (max_freq);static const struct attribute *freq_attrs[] = { - &dev_attr_act_freq.attr, - &dev_attr_cur_freq.attr, - &dev_attr_rp0_freq.attr, - &dev_attr_rpa_freq.attr, - &dev_attr_rpe_freq.attr, - &dev_attr_rpn_freq.attr, - &dev_attr_min_freq.attr, - &dev_attr_max_freq.attr, + &attr_act_freq.attr, + &attr_cur_freq.attr, + &attr_rp0_freq.attr, + &attr_rpa_freq.attr, + &attr_rpe_freq.attr, + &attr_rpn_freq.attr, + &attr_min_freq.attr, + &attr_max_freq.attr,NULL };
drivers/gpu/drm/xe/xe_gt_idle.c +16 -12
@@ -249,9 +249,10 @@ int xe_gt_idle_pg_print(struct xe_gt *gt, struct drm_printer *p)return 0 ; } -static ssize_t name_show (struct device *dev, -struct device_attribute *attr,char *buff) +static ssize_t name_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buff) { +struct device *dev =kobj_to_dev (kobj);struct xe_gt_idle *gtidle =dev_to_gtidle (dev);struct xe_guc_pc *pc =gtidle_to_pc (gtidle);ssize_t ret;
@@ -262,11 +263,12 @@ static ssize_t name_show(struct device *dev,return ret; } -static DEVICE_ATTR_RO (name); +static struct kobj_attribute name_attr =__ATTR_RO (name); -static ssize_t idle_status_show (struct device *dev, -struct device_attribute *attr,char *buff) +static ssize_t idle_status_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buff) { +struct device *dev =kobj_to_dev (kobj);struct xe_gt_idle *gtidle =dev_to_gtidle (dev);struct xe_guc_pc *pc =gtidle_to_pc (gtidle);enum xe_gt_idle_state state;
@@ -277,6 +279,7 @@ static ssize_t idle_status_show(struct device *dev,return sysfs_emit (buff,"%s\n" ,gt_idle_state_to_string (state)); } +static struct kobj_attribute idle_status_attr =__ATTR_RO (idle_status);u64 xe_gt_idle_residency_msec (struct xe_gt_idle *gtidle) {
@@ -291,10 +294,11 @@ u64 xe_gt_idle_residency_msec(struct xe_gt_idle *gtidle)return residency; } -static DEVICE_ATTR_RO (idle_status); -static ssize_t idle_residency_ms_show (struct device *dev, -struct device_attribute *attr,char *buff) + +static ssize_t idle_residency_ms_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buff) { +struct device *dev =kobj_to_dev (kobj);struct xe_gt_idle *gtidle =dev_to_gtidle (dev);struct xe_guc_pc *pc =gtidle_to_pc (gtidle);u64 residency;
@@ -305,12 +309,12 @@ static ssize_t idle_residency_ms_show(struct device *dev,return sysfs_emit (buff,"%llu\n" , residency); } -static DEVICE_ATTR_RO (idle_residency_ms); +static struct kobj_attribute idle_residency_attr =__ATTR_RO (idle_residency_ms);static const struct attribute *gt_idle_attrs[] = { - &dev_attr_name.attr, - &dev_attr_idle_status.attr, - &dev_attr_idle_residency_ms.attr, + &name_attr.attr, + &idle_status_attr.attr, + &idle_residency_attr.attr,NULL , };
drivers/gpu/drm/xe/xe_gt_throttle.c +45 -45
160 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/592 drm/bridge: analogix_dp: Add irq flag IRQF_NO_AUTOEN instead of calling disable_irq()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damon Ding <[email protected]>
[ Upstream commit efab13e7d13a641a22c7508cde6e1a5285161944 ]
The IRQF_NO_AUTOEN can be used for the drivers that don't want interrupts to be enabled automatically via devm_request_threaded_irq(). Using this flag can provide be more robust compared to the way of calling disable_irq() after devm_request_threaded_irq() without the IRQF_NO_AUTOEN flag.
--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 -3
@@ -1622,10 +1622,10 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)* that we can get the current state of the GPIO. */ dp->irq =gpiod_to_irq (dp->hpd_gpiod); - irq_flags =IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING ; + irq_flags =IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING |IRQF_NO_AUTOEN ; }else { dp->irq =platform_get_irq (pdev,0 ); - irq_flags =0 ; + irq_flags =IRQF_NO_AUTOEN ; }if (dp->irq == -ENXIO ) {
@@ -1641,7 +1641,6 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)dev_err (&pdev->dev,"failed to request irq\n" );return ERR_PTR (ret); } -disable_irq (dp->irq); dp->aux.name ="DP-AUX" ; dp->aux.transfer = analogix_dpaux_transfer;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 245/592 workqueue: Fix race condition in wq->stats incrementation
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 70e1683ca3a6474360af1d3a020a9a98c8492cc0 ]
Fixed a race condition in incrementing wq->stats[PWQ_STAT_COMPLETED] by moving the operation under pool->lock.
--- kernel/workqueue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/workqueue.c +3 -1
@@ -3241,7 +3241,7 @@ __acquires(&pool->lock)* point will only record its address. */ trace_workqueue_execute_end (work, worker->current_func); - pwq->stats[PWQ_STAT_COMPLETED ]++; +lock_map_release (&lockdep_map);if (!bh_draining)lock_map_release (pwq->wq->lockdep_map);
@@ -3272,6 +3272,8 @@ __acquires(&pool->lock)raw_spin_lock_irq (&pool->lock); + pwq->stats[PWQ_STAT_COMPLETED ]++; +/* * In addition to %WQ_CPU_INTENSIVE, @worker may also have been marked * CPU intensive by wq_worker_tick() if @work hogged CPU longer than
Signature · 14 lines
2.39.5 w_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -42,7 +42,6 @@ #include <rdma/ib_umem.h> #include <rdma/uverbs_ioctl.h> -#include "hnae3.h" #include "hns_roce_common.h" #include "hns_roce_device.h" #include "hns_roce_cmd.h"
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1 -0
@@ -34,6 +34,7 @@#define _HNS_ROCE_HW_V2_H#include <linux/bitops.h> +#include "hnae3.h" #define HNS_ROCE_VF_QPC_BT_NUM 256#define HNS_ROCE_VF_SCCC_BT_NUM 64
drivers/infiniband/hw/hns/hns_roce_main.c +0 -1
@@ -38,7 +38,6 @@#include <rdma/ib_smi.h> #include <rdma/ib_user_verbs.h> #include <rdma/ib_cache.h> -#include "hnae3.h" #include "hns_roce_common.h" #include "hns_roce_device.h" #include "hns_roce_hem.h"
drivers/infiniband/hw/hns/hns_roce_restrack.c +0 -1
@@ -4,7 +4,6 @@#include <rdma/rdma_cm.h> #include <rdma/restrack.h> #include <uapi/rdma/rdma_netlink.h> -#include "hnae3.h" #include "hns_roce_common.h" #include "hns_roce_device.h" #include "hns_roce_hw_v2.h"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 246/592 drm/panel/sharp-ls043t1le01: Use _multi variants
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anusha Srivatsa <[email protected]>
[ Upstream commit 20e8219205145e1af3b98b6a0a3cc59568116a05 ]
Move away from using deprecated API and use _multi variants if available. Use mipi_dsi_msleep() and mipi_dsi_usleep_range() instead of msleep() and usleep_range() respectively.
Used Coccinelle to find the _multi variant APIs,replacing mpi_dsi_msleep() where necessary and for returning dsi_ctx.accum_err in these functions. mipi_dsi_dcs_write() does not have a corresponding _multi() variant. Replacing it with mipi_dsi_dcs_write_seq_multi() instead. This change is manual.
The Coccinelle script is the same as the one in commit c8ba07caaecc ("drm/panel/synaptics-r63353: Use _multi variants")
v2: Use mipi_dsi_write_buffer_multi() in place ofmipi_dsi_dcs_write(). (Dmitry)
v3: add commit details where the same coccinelle script is used and remove the actual script from commit log.
Use mipi_dsi_dcs_write_seq_multi() for mipi_dsi_dcs_write() (Doug)
--- .../gpu/drm/panel/panel-sharp-ls043t1le01.c | 41 +++++++------------ 1 file changed, 15 insertions(+), 26 deletions(-)
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +15 -26
@@ -36,60 +36,49 @@ static inline struct sharp_nt_panel *to_sharp_nt_panel(struct drm_panel *panel)static int sharp_nt_panel_init (struct sharp_nt_panel *sharp_nt) {struct mipi_dsi_device *dsi = sharp_nt->dsi; -int ret; +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; dsi->mode_flags |=MIPI_DSI_MODE_LPM ; - ret =mipi_dsi_dcs_exit_sleep_mode (dsi); -if (ret <0 ) -return ret; +mipi_dsi_dcs_exit_sleep_mode_multi (&dsi_ctx); -msleep (120 ); +mipi_dsi_msleep (&dsi_ctx,120 );/* Novatek two-lane operation */ - ret =mipi_dsi_dcs_write (dsi,0xae , (u8 []){0x03 },1 ); -if (ret <0 ) -return ret; +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xae ,0x03 );/* Set both MCU and RGB I/F to 24bpp */ - ret =mipi_dsi_dcs_set_pixel_format (dsi,MIPI_DCS_PIXEL_FMT_24BIT | - (MIPI_DCS_PIXEL_FMT_24BIT <<4 )); -if (ret <0 ) -return ret; +mipi_dsi_dcs_set_pixel_format_multi (&dsi_ctx, +MIPI_DCS_PIXEL_FMT_24BIT | + (MIPI_DCS_PIXEL_FMT_24BIT <<4 )); -return 0 ; +return dsi_ctx.accum_err; }static int sharp_nt_panel_on (struct sharp_nt_panel *sharp_nt) {struct mipi_dsi_device *dsi = sharp_nt->dsi; -int ret; +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; dsi->mode_flags |=MIPI_DSI_MODE_LPM ; - ret =mipi_dsi_dcs_set_display_on (dsi); -if (ret <0 ) -return ret; +mipi_dsi_dcs_set_display_on_multi (&dsi_ctx); -return 0 ; +return dsi_ctx.accum_err; }static int sharp_nt_panel_off (struct sharp_nt_panel *sharp_nt) {struct mipi_dsi_device *dsi = sharp_nt->dsi; -int ret; +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; - ret =mipi_dsi_dcs_set_display_off (dsi); -if (ret <0 ) -return ret; +mipi_dsi_dcs_set_display_off_multi (&dsi_ctx); - ret =mipi_dsi_dcs_enter_sleep_mode (dsi); -if (ret <0 ) -return ret; +mipi_dsi_dcs_enter_sleep_mode_multi (&dsi_ctx); -return 0 ; +return dsi_ctx.accum_err; }static int sharp_nt_panel_unprepare (struct drm_panel *panel)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 247/592 exfat: fix double free in delayed_free
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 1f3d9724e16d62c7d42c67d6613b8512f2887c22 ]
The double free could happen in the following path.
exfat_create_upcase_table()
exfat_create_upcase_table() : return error
exfat_free_upcase_table() : free ->vol_utbl
exfat_load_default_upcase_table : return error
exfat_kill_sb()
delayed_free()
exfat_free_upcase_table() <--------- double freeThis patch set ->vol_util as NULL after freeing it.
--- fs/exfat/nls.c | 1 + 1 file changed, 1 insertion(+)
fs/exfat/nls.c +1 -0
@@ -801,4 +801,5 @@ int exfat_create_upcase_table(struct super_block *sb)void exfat_free_upcase_table (struct exfat_sb_info *sbi) {kvfree (sbi->vol_utbl); + sbi->vol_utbl =NULL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 248/592 drm/bridge: anx7625: enable HPD interrupts
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ayushi Makhija <[email protected]>
[ Upstream commit ca8a78cdceb48ad3b753f836068611265840ef22 ]
When the device enters the suspend state, it prevents HPD interrupts from occurring. To address this, implement .hpd_enable() and .hpd_disable() callbacks functions of the drm_bridge.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/bridge/analogix/anx7625.c +18 -0
@@ -2474,6 +2474,22 @@ static const struct drm_edid *anx7625_bridge_edid_read(struct drm_bridge *bridgereturn anx7625_edid_read (ctx); } +static void anx7625_bridge_hpd_enable (struct drm_bridge *bridge) +{ +struct anx7625_data *ctx =bridge_to_anx7625 (bridge); +struct device *dev = ctx->dev; + +pm_runtime_get_sync (dev); +} + +static void anx7625_bridge_hpd_disable (struct drm_bridge *bridge) +{ +struct anx7625_data *ctx =bridge_to_anx7625 (bridge); +struct device *dev = ctx->dev; + +pm_runtime_put_sync (dev); +} +static const struct drm_bridge_funcs anx7625_bridge_funcs = { .attach = anx7625_bridge_attach, .detach = anx7625_bridge_detach,
@@ -2487,6 +2503,8 @@ static const struct drm_bridge_funcs anx7625_bridge_funcs = { .atomic_reset = drm_atomic_helper_bridge_reset, .detect = anx7625_bridge_detect, .edid_read = anx7625_bridge_edid_read, + .hpd_enable = anx7625_bridge_hpd_enable, + .hpd_disable = anx7625_bridge_hpd_disable, }; static int anx7625_register_i2c_dummy_clients(struct anx7625_data *ctx,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 249/592 drm/panthor: Dont update MMU_INT_MASK in panthor_mmu_irq_handler()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
[ Upstream commit 6c4a3fa26799785c1873aacabcfd9b2d27e8dc97 ]
Interrupts are automatically unmasked in panthor_mmu_irq_threaded_handler() when the handler returns. Unmasking prematurely might generate spurious interrupts if the IRQ line is shared.
Changes in v2:
- New patch
Changes in v3:
- Add R-bs
--- drivers/gpu/drm/panthor/panthor_mmu.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/panthor/panthor_mmu.c +0 -1
@@ -1714,7 +1714,6 @@ static void panthor_mmu_irq_handler(struct panthor_device *ptdev, u32 status)* re-enabled. */ ptdev->mmu->irq.mask = new_int_mask; -gpu_write (ptdev,MMU_INT_MASK , new_int_mask);if (ptdev->mmu->as.slots[as].vm) ptdev->mmu->as.slots[as].vm->unhandled_fault = true;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 250/592 drm/bridge: anx7625: change the gpiod_set_value API
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ayushi Makhija <[email protected]>
[ Upstream commit 50935044e58e563cdcfd556d62f27bc8744dd64e ]
Use gpiod_set_value_cansleep() instead of gpiod_set_value() to fix the below call trace in the boot log:
[ 5.690534] Call trace: [ 5.690536] gpiod_set_value+0x40/0xa4 [ 5.690540] anx7625_runtime_pm_resume+0xa0/0x324 [anx7625] [ 5.690545] __rpm_callback+0x48/0x1d8 [ 5.690549] rpm_callback+0x6c/0x78
Certain GPIO controllers require access via message-based buses such as I2C or SPI, which may cause the GPIOs to enter a sleep state. Therefore, use the gpiod_set_value_cansleep().
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +4 -4
@@ -1257,10 +1257,10 @@ static void anx7625_power_on(struct anx7625_data *ctx)usleep_range (11000 ,12000 );/* Power on pin enable */ -gpiod_set_value (ctx->pdata.gpio_p_on,1 ); +gpiod_set_value_cansleep (ctx->pdata.gpio_p_on,1 );usleep_range (10000 ,11000 );/* Power reset pin enable */ -gpiod_set_value (ctx->pdata.gpio_reset,1 ); +gpiod_set_value_cansleep (ctx->pdata.gpio_reset,1 );usleep_range (10000 ,11000 );DRM_DEV_DEBUG_DRIVER (dev,"power on !\n" );
@@ -1280,9 +1280,9 @@ static void anx7625_power_standby(struct anx7625_data *ctx)return ; } -gpiod_set_value (ctx->pdata.gpio_reset,0 ); +gpiod_set_value_cansleep (ctx->pdata.gpio_reset,0 );usleep_range (1000 ,1100 ); -gpiod_set_value (ctx->pdata.gpio_p_on,0 ); +gpiod_set_value_cansleep (ctx->pdata.gpio_p_on,0 );usleep_range (1000 ,1100 ); ret = regulator_bulk_disable(ARRAY_SIZE(ctx->pdata.supplies),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 251/592 exfat: do not clear volume dirty flag during sync
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuezhang Mo <[email protected]>
[ Upstream commit 46a557694b464881b3c2c4a0ba389a6436419a37 ]
xfstests generic/482 tests the file system consistency after each FUA operation. It fails when run on exfat.
exFAT clears the volume dirty flag with a FUA operation during sync. Since s_lock is not held when data is being written to a file, sync can be executed at the same time. When data is being written to a file, the FAT chain is updated first, and then the file size is updated. If sync is executed between updating them, the length of the FAT chain may be inconsistent with the file size.
To avoid the situation where the file system is inconsistent but the volume dirty flag is cleared, this commit moves the clearing of the volume dirty flag from exfat_fs_sync() to exfat_put_super(), so that the volume dirty flag is not cleared until unmounting. After the move, there is no additional action during sync, so exfat_fs_sync() can be deleted.
--- fs/exfat/super.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-)
fs/exfat/super.c +7 -23
@@ -36,31 +36,12 @@ static void exfat_put_super(struct super_block *sb)struct exfat_sb_info *sbi =EXFAT_SB (sb);mutex_lock (&sbi->s_lock); +exfat_clear_volume_dirty (sb);exfat_free_bitmap (sbi);brelse (sbi->boot_bh);mutex_unlock (&sbi->s_lock); } -static int exfat_sync_fs (struct super_block *sb,int wait) -{ -struct exfat_sb_info *sbi =EXFAT_SB (sb); -int err =0 ; - -if (unlikely (exfat_forced_shutdown (sb))) -return 0 ; - -if (!wait) -return 0 ; - -/* If there are some dirty buffers in the bdev inode */ -mutex_lock (&sbi->s_lock); -sync_blockdev (sb->s_bdev); -if (exfat_clear_volume_dirty (sb)) - err = -EIO ; -mutex_unlock (&sbi->s_lock); -return err; -} -static int exfat_statfs (struct dentry *dentry,struct kstatfs *buf) {struct super_block *sb = dentry->d_sb;
@@ -219,7 +200,6 @@ static const struct super_operations exfat_sops = { .write_inode = exfat_write_inode, .evict_inode = exfat_evict_inode, .put_super = exfat_put_super, - .sync_fs = exfat_sync_fs, .statfs = exfat_statfs, .show_options = exfat_show_options, .shutdown = exfat_shutdown,
@@ -751,10 +731,14 @@ static void exfat_free(struct fs_context *fc)static int exfat_reconfigure (struct fs_context *fc) { +struct super_block *sb = fc->root->d_sb; fc->sb_flags |=SB_NODIRATIME ; -/* volume flag will be updated in exfat_sync_fs */ -sync_filesystem (fc->root->d_sb); +sync_filesystem (sb); +mutex_lock (&EXFAT_SB (sb)->s_lock); +exfat_clear_volume_dirty (sb); +mutex_unlock (&EXFAT_SB (sb)->s_lock); +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 252/592 drm/amdkfd: Drop workaround for GC v9.4.3 revID 0
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Apurv Mishra <[email protected]>
[ Upstream commit daafa303d19f5522e4c24fbf5c1c981a16df2c2f ]
Remove workaround code for the early engineering samples GC v9.4.3 SOCs with revID 0
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 14 ++------------ drivers/gpu/drm/amd/amdkfd/kfd_device.c | 5 ----- drivers/gpu/drm/amd/amdkfd/kfd_queue.c | 4 ++-- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +-- 5 files changed, 12 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -1
@@ -2689,6 +2689,13 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)break ; } +/* Check for IP version 9.4.3 with A0 hardware */ +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,3 ) && + !amdgpu_device_get_rev_id (adev)) { +dev_err (adev->dev,"Unsupported A0 hardware\n" ); +return -ENODEV ;/* device unsupported - no device error */ + } + if (amdgpu_has_atpx() && (amdgpu_is_atpx_hybrid() || amdgpu_has_atpx_dgpu_power_cntl()) &&
@@ -2701,7 +2708,6 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) adev->has_pr3 = parent ?pci_pr3_present (parent) : false; } - adev->pm.pp_feature = amdgpu_pp_feature_mask;if (amdgpu_sriov_vf (adev) || sched_policy ==KFD_SCHED_POLICY_NO_HWS ) adev->pm.pp_feature &= ~PP_GFXOFF_MASK ;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -12
@@ -1213,10 +1213,7 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev,if (uncached) { mtype =MTYPE_UC ; }else if (ext_coherent) { -if (gc_ip_version ==IP_VERSION (9 ,5 ,0 ) || adev->rev_id) - mtype = is_local ?MTYPE_CC :MTYPE_UC ; -else - mtype =MTYPE_UC ; + mtype = is_local ?MTYPE_CC :MTYPE_UC ; }else if (adev->flags &AMD_IS_APU ) { mtype = is_local ? mtype_local :MTYPE_NC ; }else {
@@ -1336,7 +1333,7 @@ static void gmc_v9_0_override_vm_pte_flags(struct amdgpu_device *adev, mtype_local =MTYPE_CC ; *flags =AMDGPU_PTE_MTYPE_VG10 (*flags, mtype_local); - }else if (adev->rev_id) { + }else {/* MTYPE_UC case */ *flags =AMDGPU_PTE_MTYPE_VG10 (*flags,MTYPE_CC ); }
@@ -2411,13 +2408,6 @@ static int gmc_v9_0_hw_init(struct amdgpu_ip_block *ip_block) adev->gmc.flush_tlb_needs_extra_type_2 =amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,0 ) && adev->gmc.xgmi.num_physical_nodes; -/* -* TODO: This workaround is badly documented and had a buggy -* implementation. We should probably verify what we do here. -*/ - adev->gmc.flush_tlb_needs_extra_type_0 = -amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,3 ) && - adev->rev_id ==0 ;/* The sequence of these two function calls matters.*/ gmc_v9_0_init_golden_registers (adev);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -5
@@ -352,11 +352,6 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf) f2g = &aldebaran_kfd2kgd;break ;case IP_VERSION (9 ,4 ,3 ): - gfx_target_version = adev->rev_id >=1 ?90402 - : adev->flags &AMD_IS_APU ?90400 - :90401 ; - f2g = &gc_9_4_3_kfd2kgd; -break ;case IP_VERSION (9 ,4 ,4 ): gfx_target_version =90402 ; f2g = &gc_9_4_3_kfd2kgd;
drivers/gpu/drm/amd/amdkfd/kfd_queue.c +2 -2
@@ -402,7 +402,7 @@ static u32 kfd_get_vgpr_size_per_cu(u32 gfxv) {u32 vgpr_size =0x40000 ; -if ((gfxv /100 *100 ) ==90400 ||/* GFX_VERSION_AQUA_VANJARAM */ +if (gfxv ==90402 ||/* GFX_VERSION_AQUA_VANJARAM */ gfxv ==90010 ||/* GFX_VERSION_ALDEBARAN */ gfxv ==90008 ||/* GFX_VERSION_ARCTURUS */ gfxv ==90500 )
@@ -462,7 +462,7 @@ void kfd_queue_ctx_save_restore_size(struct kfd_topology_device *dev)if (gfxv ==80002 )/* GFX_VERSION_TONGA */ props->eop_buffer_size =0x8000 ; -else if ((gfxv /100 *100 ) ==90400 )/* GFX_VERSION_AQUA_VANJARAM */ +else if (gfxv ==90402 )/* GFX_VERSION_AQUA_VANJARAM */ props->eop_buffer_size =4096 ;else if (gfxv >=80000 ) props->eop_buffer_size =4096 ;
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -2
@@ -1245,8 +1245,7 @@ svm_range_get_pte_flags(struct kfd_node *node,case IP_VERSION (9 ,4 ,4 ):case IP_VERSION (9 ,5 ,0 ):if (ext_coherent) - mtype_local = (gc_ip_version <IP_VERSION (9 ,5 ,0 ) && !node->adev->rev_id) ? -AMDGPU_VM_MTYPE_UC :AMDGPU_VM_MTYPE_CC ; + mtype_local =AMDGPU_VM_MTYPE_CC ;else mtype_local = amdgpu_mtype_local ==1 ?AMDGPU_VM_MTYPE_NC : amdgpu_mtype_local ==2 ?AMDGPU_VM_MTYPE_CC :AMDGPU_VM_MTYPE_RW ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 253/592 drm/amdgpu/gfx11: fix CSIB handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit a9a8bccaa3ba64d509cf7df387cf0b5e1cd06499 ]
We shouldn't return after the last section.
We need to update the rest of the CSIB.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -2
@@ -859,8 +859,6 @@ static void gfx_v11_0_get_csb_buffer(struct amdgpu_device *adev, PACKET3_SET_CONTEXT_REG_START);for (i =0 ; i < ext->reg_count; i++) buffer[count++] =cpu_to_le32 (ext->extent[i]); - }else { -return ; } } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 254/592 media: nuvoton: npcm-video: Fix stuck due to no video signal error
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chang <[email protected]>
[ Upstream commit 497f1fb94759fa0c638f15c12b1ab3e586bccfcb ]
Fix the issue when start_frame and detect_resolution functions are executed at the same time, which may cause driver stops capturing due to status of no video signal error.
--- drivers/media/platform/nuvoton/npcm-video.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/media/platform/nuvoton/npcm-video.c +9 -6
@@ -863,7 +863,6 @@ static void npcm_video_detect_resolution(struct npcm_video *video)struct regmap *gfxi = video->gfx_regmap;unsigned int dispst; - video->v4l2_input_status =V4L2_IN_ST_NO_SIGNAL ; det->width =npcm_video_hres (video); det->height =npcm_video_vres (video);
@@ -892,12 +891,16 @@ static void npcm_video_detect_resolution(struct npcm_video *video)clear_bit (VIDEO_RES_CHANGING , &video->flags); } -if (det->width && det->height) +if (det->width && det->height) { video->v4l2_input_status =0 ; - -dev_dbg (video->dev,"Got resolution[%dx%d] -> [%dx%d], status %d\n" , - act->width, act->height, det->width, det->height, - video->v4l2_input_status); +dev_dbg (video->dev,"Got resolution[%dx%d] -> [%dx%d], status %d\n" , + act->width, act->height, det->width, det->height, + video->v4l2_input_status); + }else { + video->v4l2_input_status =V4L2_IN_ST_NO_SIGNAL ; +dev_err (video->dev,"Got invalid resolution[%dx%d]\n" , det->width, + det->height); + } } static int npcm_video_set_resolution(struct npcm_video *video,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 255/592 drm/nouveau: fix hibernate on disabled GPU
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Rudorff <[email protected]>
[ Upstream commit 4c4d9b7b6c6e676eca22585139aba5f03de74b90 ]
Hibernate bricks the machine if a discrete GPU was disabled via
echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
The freeze and thaw handler lacks checking the GPU power state, as suspend and resume do.
This patch add the checks and fix this issue.
--- drivers/gpu/drm/nouveau/nouveau_drm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +8 -0
@@ -1079,6 +1079,10 @@ nouveau_pmops_freeze(struct device *dev) {struct nouveau_drm *drm =dev_get_drvdata (dev); +if (drm->dev->switch_power_state ==DRM_SWITCH_POWER_OFF || + drm->dev->switch_power_state ==DRM_SWITCH_POWER_DYNAMIC_OFF ) +return 0 ; +return nouveau_do_suspend (drm, false); }
@@ -1087,6 +1091,10 @@ nouveau_pmops_thaw(struct device *dev) {struct nouveau_drm *drm =dev_get_drvdata (dev); +if (drm->dev->switch_power_state ==DRM_SWITCH_POWER_OFF || + drm->dev->switch_power_state ==DRM_SWITCH_POWER_DYNAMIC_OFF ) +return 0 ; +return nouveau_do_resume (drm, false); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 256/592 media: i2c: imx334: Enable runtime PM before sub-device registration
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tarang Raval <[email protected]>
[ Upstream commit 01dfdf6a80c57151af0589af0db7adbbdd1361c7 ]
Runtime PM is fully initialized before calling v4l2_async_register_subdev_sensor(). Moving the runtime PM initialization earlier prevents potential access to an uninitialized or powered-down device.
--- drivers/media/i2c/imx334.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/i2c/imx334.c +5 -2
@@ -1391,6 +1391,9 @@ static int imx334_probe(struct i2c_client *client) goto error_handler_free; } +pm_runtime_set_active (imx334->dev); +pm_runtime_enable (imx334->dev); + ret =v4l2_async_register_subdev_sensor (&imx334->sd);if (ret <0 ) { dev_err(imx334->dev,
@@ -1398,13 +1401,13 @@ static int imx334_probe(struct i2c_client *client) goto error_media_entity; } -pm_runtime_set_active (imx334->dev); -pm_runtime_enable (imx334->dev);pm_runtime_idle (imx334->dev);return 0 ; error_media_entity: +pm_runtime_disable (imx334->dev); +pm_runtime_set_suspended (imx334->dev);media_entity_cleanup (&imx334->sd.entity); error_handler_free:v4l2_ctrl_handler_free (imx334->sd.ctrl_handler);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 257/592 drm/amd/display: Avoid divide by zero by initializing dummy pitch to 1
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 7e40f64896e8e3dca471e287672db5ace12ea0be ]
[Why]
If the dummy values in populate_dummy_dml_surface_cfg() aren't updated then they can lead to a divide by zero in downstream callers like CalculateVMAndRowBytes()
[How]
Initialize dummy value to a value to avoid divide by zero.
--- drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +1 -1
@@ -896,7 +896,7 @@ static void populate_dummy_dml_surface_cfg(struct dml_surface_cfg_st *out, unsig out->SurfaceWidthC[location] = in->timing.h_addressable; out->SurfaceHeightC[location] = in->timing.v_addressable; out->PitchY[location] = ((out->SurfaceWidthY[location] +127 ) /128 ) *128 ; - out->PitchC[location] =0 ; + out->PitchC[location] =1 ; out->DCCEnable[location] = false; out->DCCMetaPitchY[location] =0 ; out->DCCMetaPitchC[location] =0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 258/592 drm/nouveau/gsp: fix rm shutdown wait condition
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Skeggs <[email protected]>
[ Upstream commit 7904bcdcf6b56602a049ed2b47282db63671fa99 ]
Though the initial upstreamed GSP-RM version in nouveau was 535.113.01, the code was developed against earlier versions.
535.42.02 modified the mailbox value used by GSP-RM to signal shutdown has completed, which was missed at the time.
I'm not aware of any issues caused by this, but noticed the bug while working on GB20x support.
--- drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +1 -1
@@ -2838,7 +2838,7 @@ r535_gsp_fini(struct nvkm_gsp *gsp, bool suspend)return ret;nvkm_msec (gsp->subdev.device,2000 , - if (nvkm_falcon_rd32(&gsp->falcon, 0x040) & 0x80000000) + if (nvkm_falcon_rd32(&gsp->falcon, 0x040) == 0x80000000) break; );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 259/592 drm/msm/hdmi: add runtime PM calls to DDC transfer function
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 531b4e2c206e5f7dead04d9da84dfa693ac57481 ]
We must be sure that the HDMI controller is powered on, while performing the DDC transfer. Add corresponding runtime PM calls to msm_hdmi_i2c_xfer().
Patchwork: https://patchwork.freedesktop.org/patch/651727/
--- drivers/gpu/drm/msm/hdmi/hdmi_i2c.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi_i2c.c +12 -2
@@ -107,11 +107,15 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,if (num ==0 )return num; + ret =pm_runtime_resume_and_get (&hdmi->pdev->dev); +if (ret) +return ret; +init_ddc (hdmi_i2c); ret =ddc_clear_irq (hdmi_i2c);if (ret) -return ret; + goto fail;for (i =0 ; i < num; i++) {struct i2c_msg *p = &msgs[i];
@@ -169,7 +173,7 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,hdmi_read (hdmi,REG_HDMI_DDC_SW_STATUS ),hdmi_read (hdmi,REG_HDMI_DDC_HW_STATUS ), hdmi_read(hdmi, REG_HDMI_DDC_INT_CTRL)); -return ret; + goto fail; } ddc_status =hdmi_read (hdmi,REG_HDMI_DDC_SW_STATUS );
@@ -202,7 +206,13 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c, } } +pm_runtime_put (&hdmi->pdev->dev); +return i; + +fail: +pm_runtime_put (&hdmi->pdev->dev); +return ret; }static u32 msm_hdmi_i2c_func (struct i2c_adapter *adapter)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 260/592 media: uapi: v4l: Fix V4L2_TYPE_IS_OUTPUT condition
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nas Chung <[email protected]>
[ Upstream commit f81f69a0e3da141bdd73a16b8676f4e542533d87 ]
V4L2_TYPE_IS_OUTPUT() returns true for V4L2_BUF_TYPE_VIDEO_OVERLAY which definitely belongs to CAPTURE.
--- include/uapi/linux/videodev2.h | 1 - 1 file changed, 1 deletion(-)
include/uapi/linux/videodev2.h +0 -1
@@ -164,7 +164,6 @@ enum v4l2_buf_type {#define V4L2_TYPE_IS_OUTPUT (type) \ ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \ - || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \ || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \ || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 261/592 drm/amd/display: Add NULL pointer checks in dm_force_atomic_commit()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 3f397cd203f247879c2f1a061e90d4c8d23655de ]
This commit updates the dm_force_atomic_commit function to replace the usage of PTR_ERR_OR_ZERO with IS_ERR for checking error states after retrieving the Connector (drm_atomic_get_connector_state), CRTC (drm_atomic_get_crtc_state), and Plane (drm_atomic_get_plane_state) states.
The function utilized PTR_ERR_OR_ZERO for error checking. However, this approach is inappropriate in this context because the respective functions do not return NULL; they return pointers that encode errors.
This change ensures that error pointers are properly checked using IS_ERR before attempting to dereference.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +12 -6
@@ -10510,16 +10510,20 @@ static int dm_force_atomic_commit(struct drm_connector *connector)*/ conn_state =drm_atomic_get_connector_state (state, connector); - ret =PTR_ERR_OR_ZERO (conn_state); -if (ret) +/* Check for error in getting connector state */ +if (IS_ERR (conn_state)) { + ret =PTR_ERR (conn_state); goto out; + }/* Attach crtc to drm_atomic_state*/ crtc_state =drm_atomic_get_crtc_state (state, &disconnected_acrtc->base); - ret =PTR_ERR_OR_ZERO (crtc_state); -if (ret) +/* Check for error in getting crtc state */ +if (IS_ERR (crtc_state)) { + ret =PTR_ERR (crtc_state); goto out; + }/* force a restore */ crtc_state->mode_changed = true;
@@ -10527,9 +10531,11 @@ static int dm_force_atomic_commit(struct drm_connector *connector)/* Attach plane to drm_atomic_state */ plane_state =drm_atomic_get_plane_state (state, plane); - ret =PTR_ERR_OR_ZERO (plane_state); -if (ret) +/* Check for error in getting plane state */ +if (IS_ERR (plane_state)) { + ret =PTR_ERR (plane_state); goto out; + }/* Call commit internally with the state we just constructed */ ret =drm_atomic_commit (state);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 262/592 media: verisilicon: Enable wide 4K in AV1 decoder
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dufresne <[email protected]>
[ Upstream commit 311e40e877bd980bc665e6c8d3b15d96f0ec2aa8 ]
Tested on RK3588, this decoder is capable of handling WUHD, so bump the maximum width and height accordingly.
--- .../platform/verisilicon/rockchip_vpu_hw.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/media/platform/verisilicon/rockchip_vpu_hw.c +10 -10
@@ -85,10 +85,10 @@ static const struct hantro_fmt rockchip_vpu981_postproc_fmts[] = { .postprocessed = true, .frmsize = { .min_width = ROCKCHIP_VPU981_MIN_SIZE, - .max_width = FMT_UHD_WIDTH, + .max_width = FMT_4K_WIDTH, .step_width = MB_DIM, .min_height = ROCKCHIP_VPU981_MIN_SIZE, - .max_height = FMT_UHD_HEIGHT, + .max_height = FMT_4K_HEIGHT, .step_height = MB_DIM, }, },
@@ -99,10 +99,10 @@ static const struct hantro_fmt rockchip_vpu981_postproc_fmts[] = { .postprocessed = true, .frmsize = { .min_width = ROCKCHIP_VPU981_MIN_SIZE, - .max_width = FMT_UHD_WIDTH, + .max_width = FMT_4K_WIDTH, .step_width = MB_DIM, .min_height = ROCKCHIP_VPU981_MIN_SIZE, - .max_height = FMT_UHD_HEIGHT, + .max_height = FMT_4K_HEIGHT, .step_height = MB_DIM, }, },
@@ -318,10 +318,10 @@ static const struct hantro_fmt rockchip_vpu981_dec_fmts[] = { .match_depth = true, .frmsize = { .min_width = ROCKCHIP_VPU981_MIN_SIZE, - .max_width = FMT_UHD_WIDTH, + .max_width = FMT_4K_WIDTH, .step_width = MB_DIM, .min_height = ROCKCHIP_VPU981_MIN_SIZE, - .max_height = FMT_UHD_HEIGHT, + .max_height = FMT_4K_HEIGHT, .step_height = MB_DIM, }, },
@@ -331,10 +331,10 @@ static const struct hantro_fmt rockchip_vpu981_dec_fmts[] = { .match_depth = true, .frmsize = { .min_width = ROCKCHIP_VPU981_MIN_SIZE, - .max_width = FMT_UHD_WIDTH, + .max_width = FMT_4K_WIDTH, .step_width = MB_DIM, .min_height = ROCKCHIP_VPU981_MIN_SIZE, - .max_height = FMT_UHD_HEIGHT, + .max_height = FMT_4K_HEIGHT, .step_height = MB_DIM, }, },
@@ -344,10 +344,10 @@ static const struct hantro_fmt rockchip_vpu981_dec_fmts[] = { .max_depth = 2, .frmsize = { .min_width = ROCKCHIP_VPU981_MIN_SIZE, - .max_width = FMT_UHD_WIDTH, + .max_width = FMT_4K_WIDTH, .step_width = MB_DIM, .min_height = ROCKCHIP_VPU981_MIN_SIZE, - .max_height = FMT_UHD_HEIGHT, + .max_height = FMT_4K_HEIGHT, .step_height = MB_DIM, }, },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 263/592 drm/amd/display: Skip to enable dsc if it has been off
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Hsieh <[email protected]>
[ Upstream commit 8b8a602c985e99074fa1d5233cd224b7bcfb9df2 ]
[Why]
It makes DSC enable when we commit the stream which need keep power off.And then it will skip to disable DSC if pipe reset at this situation as power has been off. It may cause the DSC unexpected enable on the pipe with the next new stream which doesn't support DSC.
[HOW]
Check the DSC used on current pipe status when update stream. Skip to enable if it has been off. The operation enable DSC should happen when set power on.
--- .../drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +14 -0
@@ -84,6 +84,20 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)struct dsc_config dsc_cfg;struct dsc_optc_config dsc_optc_cfg = {0 };enum optc_dsc_mode optc_dsc_mode; +struct dcn_dsc_state dsc_state = {0 }; + +if (!dsc) { +DC_LOG_DSC ("DSC is NULL for tg instance %d:" , pipe_ctx->stream_res.tg->inst); +return ; + } + +if (dsc->funcs->dsc_read_state) { + dsc->funcs->dsc_read_state (dsc, &dsc_state); +if (!dsc_state.dsc_fw_en) { +DC_LOG_DSC ("DSC has been disabled for tg instance %d:" , pipe_ctx->stream_res.tg->inst); +return ; + } + }/* Enable DSC hw block */ dsc_cfg.pic_width = (stream->timing.h_addressable + stream->timing.h_border_left + stream->timing.h_border_right) / opp_cnt;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 264/592 drm/amdgpu: Add basic validation for RAS header
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit 5df0d6addb7e9b6f71f7162d1253762a5be9138e ]
If RAS header read from EEPROM is corrupted, it could result in trying to allocate huge memory for reading the records. Add some validation to header fields.
--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +19 -3
@@ -1392,17 +1392,33 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)__decode_table_header_from_buf (hdr, buf); -if (hdr->version >=RAS_TABLE_VER_V2_1 ) { +switch (hdr->version) { +case RAS_TABLE_VER_V2_1 : +case RAS_TABLE_VER_V3 : control->ras_num_recs =RAS_NUM_RECS_V2_1 (hdr); control->ras_record_offset =RAS_RECORD_START_V2_1 ; control->ras_max_record_count =RAS_MAX_RECORD_COUNT_V2_1 ; - }else { +break ; +case RAS_TABLE_VER_V1 : control->ras_num_recs =RAS_NUM_RECS (hdr); control->ras_record_offset =RAS_RECORD_START ; control->ras_max_record_count =RAS_MAX_RECORD_COUNT ; +break ; +default : +dev_err (adev->dev, +"RAS header invalid, unsupported version: %u" , + hdr->version); +return -EINVAL ; } - control->ras_fri =RAS_OFFSET_TO_INDEX (control, hdr->first_rec_offset); +if (control->ras_num_recs > control->ras_max_record_count) { +dev_err (adev->dev, +"RAS header invalid, records in header: %u max allowed :%u" , + control->ras_num_recs, control->ras_max_record_count); +return -EINVAL ; + } + + control->ras_fri =RAS_OFFSET_TO_INDEX (control, hdr->first_rec_offset); control->ras_num_mca_recs =0 ; control->ras_num_pa_recs =0 ;return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 265/592 dlm: use SHUT_RDWR for SCTP shutdown
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <[email protected]>
[ Upstream commit 55612ddb62fc12437a7ff2f27b51a8981bc187a4 ]
Currently SCTP shutdown() call gets stuck because there is no incoming EOF indicator on its socket. On the peer side the EOF indicator as recvmsg() returns 0 will be triggered as mechanism to flush the socket queue on the receive side. In SCTP recvmsg() function sctp_recvmsg() we can see that only if sk_shutdown has the bit RCV_SHUTDOWN set SCTP will recvmsg() will return EOF. The RCV_SHUTDOWN bit will only be set when shutdown with SHUT_RD is called. We use now SHUT_RDWR to also get a EOF indicator from recvmsg() call on the shutdown() initiator.
SCTP does not support half closed sockets and the semantic of SHUT_WR is different here, it seems that calling SHUT_WR on sctp sockets keeps the socket open to have the possibility to do some specific SCTP operations on it that we don't do here.
There exists still a difference in the limitations of TCP vs SCTP in case if we are required to have a half closed socket functionality. This was tried to archieve with DLM protocol changes in the past and hopefully we really don't require half closed socket functionality.
--- fs/dlm/lowcomms.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/dlm/lowcomms.c +4 -1
@@ -160,6 +160,7 @@ struct dlm_proto_ops {bool try_new_addr;const char *name;int proto; +int how;void (*sockopts)(struct socket *sock);int (*bind)(struct socket *sock);
@@ -810,7 +811,7 @@ static void shutdown_connection(struct connection *con, bool and_other)return ; } - ret =kernel_sock_shutdown (con->sock,SHUT_WR ); + ret =kernel_sock_shutdown (con->sock, dlm_proto_ops->how);up_read (&con->sock_lock);if (ret) { log_print("Connection %p failed to shutdown: %d will force close",
@@ -1858,6 +1859,7 @@ static int dlm_tcp_listen_bind(struct socket *sock)static const struct dlm_proto_ops dlm_tcp_ops = { .name ="TCP" , .proto =IPPROTO_TCP , + .how =SHUT_WR , .sockopts = dlm_tcp_sockopts, .bind = dlm_tcp_bind, .listen_validate = dlm_tcp_listen_validate,
@@ -1896,6 +1898,7 @@ static void dlm_sctp_sockopts(struct socket *sock)static const struct dlm_proto_ops dlm_sctp_ops = { .name ="SCTP" , .proto =IPPROTO_SCTP , + .how =SHUT_RDWR , .try_new_addr = true, .sockopts = dlm_sctp_sockopts, .bind = dlm_sctp_bind,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 266/592 drm/msm/a6xx: Increase HFI response timeout
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akhil P Oommen <[email protected]>
[ Upstream commit 5f02f5e78ec9688e29b6857813185b1181796abe ]
When ACD feature is enabled, it triggers some internal calibrations which result in a pretty long delay during the first HFI perf vote. So, increase the HFI response timeout to match the downstream driver.
Patchwork: https://patchwork.freedesktop.org/patch/649344/
--- drivers/gpu/drm/msm/adreno/a6xx_hfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_hfi.c +1 -1
@@ -109,7 +109,7 @@ static int a6xx_hfi_wait_for_ack(struct a6xx_gmu *gmu, u32 id, u32 seqnum,/* Wait for a response */ ret =gmu_poll_timeout (gmu,REG_A6XX_GMU_GMU2HOST_INTR_INFO , val, - val &A6XX_GMU_GMU2HOST_INTR_INFO_MSGQ ,100 ,5000 ); + val &A6XX_GMU_GMU2HOST_INTR_INFO_MSGQ ,100 ,1000000 );if (ret) { DRM_DEV_ERROR(gmu->dev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 267/592 drm/amd/display: Do Not Consider DSC if Valid Config Not Found
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fangzhi Zuo <[email protected]>
[ Upstream commit 146a4429b5674b7520a96aea34233949731c6086 ]
[why]
In the mode validation, mst dsc is considered for bw calculation after common dsc config is determined. Currently it considered common dsc config is found if max and min target bpp are non zero which is not accurate. Invalid max and min target bpp values would not get max_kbps and min_kbps calculated, leading to falsefully pass a mode that does not have valid dsc parameters available.
[how]
Use the return value of decide_dsc_bandwidth_range() to determine whether valid dsc common config is found or not. Prune out modes that do not have valid common dsc config determined.
--- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +9 -8
@@ -1739,16 +1739,17 @@ static bool is_dsc_common_config_possible(struct dc_stream_state *stream, struct dc_dsc_bw_range *bw_range) {struct dc_dsc_policy dsc_policy = {0 }; +bool is_dsc_possible;dc_dsc_get_policy_for_timing (&stream->timing,0 , &dsc_policy,dc_link_get_highest_encoding_format (stream->link)); -dc_dsc_compute_bandwidth_range (stream->sink->ctx->dc->res_pool->dscs[0 ], - stream->sink->ctx->dc->debug.dsc_min_slice_height_override, - dsc_policy.min_target_bpp *16 , - dsc_policy.max_target_bpp *16 , - &stream->sink->dsc_caps.dsc_dec_caps, - &stream->timing,dc_link_get_highest_encoding_format (stream->link), bw_range); - -return bw_range->max_target_bpp_x16 && bw_range->min_target_bpp_x16; + is_dsc_possible =dc_dsc_compute_bandwidth_range (stream->sink->ctx->dc->res_pool->dscs[0 ], + stream->sink->ctx->dc->debug.dsc_min_slice_height_override, + dsc_policy.min_target_bpp *16 , + dsc_policy.max_target_bpp *16 , + &stream->sink->dsc_caps.dsc_dec_caps, + &stream->timing,dc_link_get_highest_encoding_format (stream->link), bw_range); + +return is_dsc_possible; }#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 268/592 media: i2c: imx334: Fix runtime PM handling in remove function
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tarang Raval <[email protected]>
[ Upstream commit b493cd3c03641f9bbaa9787e43ca92163cb50051 ]
pm_runtime_suspended() only checks the current runtime PM status and does not modify it, making it ineffective in this context. This could result in improper power management if the device remains active when removed.
This patch fixes the issue by introducing a check with pm_runtime_status_suspended() to determine if the device is already suspended. If it is not, it calls imx334_power_off() to power down the device and then uses pm_runtime_set_suspended() to correctly update the runtime PM status to suspended.
--- drivers/media/i2c/imx334.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/i2c/imx334.c +4 -1
@@ -1435,7 +1435,10 @@ static void imx334_remove(struct i2c_client *client)v4l2_ctrl_handler_free (sd->ctrl_handler);pm_runtime_disable (&client->dev); -pm_runtime_suspended (&client->dev); +if (!pm_runtime_status_suspended (&client->dev)) { +imx334_power_off (&client->dev); +pm_runtime_set_suspended (&client->dev); + }mutex_destroy (&imx334->mutex); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 269/592 drm/amdgpu/gfx10: fix CSIB handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 683308af030cd9b8d3f1de5cbc1ee51788878feb ]
We shouldn't return after the last section.
We need to update the rest of the CSIB.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -2
@@ -4322,8 +4322,6 @@ static void gfx_v10_0_get_csb_buffer(struct amdgpu_device *adev, PACKET3_SET_CONTEXT_REG_START);for (i =0 ; i < ext->reg_count; i++) buffer[count++] =cpu_to_le32 (ext->extent[i]); - }else { -return ; } } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 270/592 drm: panel-orientation-quirks: Add ZOTAC Gaming Zone
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vicki Pfau <[email protected]>
[ Upstream commit 96c85e428ebaeacd2c640eba075479ab92072ccd ]
Add a panel orientation quirk for the ZOTAC Gaming Zone handheld gaming device.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -517,6 +517,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LTH17"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* ZOTAC Gaming Zone */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ZOTAC" ), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "G0A1W"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* One Mix 2S (generic strings, also match on bios date) */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 271/592 media: ccs-pll: Better validate VT PLL branch
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
[ Upstream commit cd9cb0313a42ae029cd5af9293b0add984ed252e ]
Check that the VT PLL dividers are actually found, don't trust they always are even though they should be.
--- drivers/media/i2c/ccs-pll.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/media/i2c/ccs-pll.c +9 -3
@@ -442,7 +442,7 @@ static int ccs_pll_calculate_vt_tree(struct device *dev,return -EINVAL ; } -static void +static int ccs_pll_calculate_vt(struct device *dev, const struct ccs_pll_limits *lim, const struct ccs_pll_branch_limits_bk *op_lim_bk, struct ccs_pll *pll, struct ccs_pll_branch_fr *pll_fr,
@@ -565,6 +565,8 @@ ccs_pll_calculate_vt(struct device *dev, const struct ccs_pll_limits *lim,if (best_pix_div <SHRT_MAX >>1 )break ; } +if (best_pix_div ==SHRT_MAX >>1 ) +return -EINVAL ; pll->vt_bk.sys_clk_div =DIV_ROUND_UP (vt_div, best_pix_div); pll->vt_bk.pix_clk_div = best_pix_div;
@@ -577,6 +579,8 @@ ccs_pll_calculate_vt(struct device *dev, const struct ccs_pll_limits *lim, out_calc_pixel_rate: pll->pixel_rate_pixel_array = pll->vt_bk.pix_clk_freq_hz * pll->vt_lanes; + +return 0 ; }/*
@@ -852,8 +856,10 @@ int ccs_pll_calculate(struct device *dev, const struct ccs_pll_limits *lim,if (pll->flags &CCS_PLL_FLAG_DUAL_PLL )break ; -ccs_pll_calculate_vt (dev, lim, op_lim_bk, pll, op_pll_fr, - op_pll_bk, cphy, phy_const); + rval =ccs_pll_calculate_vt (dev, lim, op_lim_bk, pll, op_pll_fr, + op_pll_bk, cphy, phy_const); +if (rval) +continue ; rval =check_bk_bounds (dev, lim, pll,PLL_VT );if (rval)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 272/592 media: uapi: v4l: Change V4L2_TYPE_IS_CAPTURE condition
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nas Chung <[email protected]>
[ Upstream commit ad2698efce37e910dcf3c3914263e6cb3e86f8cd ]
Explicitly compare a buffer type only with valid buffer types, to avoid matching a buffer type outside of the valid buffer type set.
--- include/uapi/linux/videodev2.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
include/uapi/linux/videodev2.h +10 -1
@@ -153,10 +153,18 @@ enum v4l2_buf_type {V4L2_BUF_TYPE_SDR_OUTPUT =12 ,V4L2_BUF_TYPE_META_CAPTURE =13 ,V4L2_BUF_TYPE_META_OUTPUT =14 , +/* +* Note: V4L2_TYPE_IS_VALID and V4L2_TYPE_IS_OUTPUT must +* be updated if a new type is added. +*/ /* Deprecated, do not use */ V4L2_BUF_TYPE_PRIVATE = 0x80, }; +#define V4L2_TYPE_IS_VALID (type) \ + ((type) >= V4L2_BUF_TYPE_VIDEO_CAPTURE &&\ + (type) <= V4L2_BUF_TYPE_META_OUTPUT) +#define V4L2_TYPE_IS_MULTIPLANAR (type) \ ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
@@ -170,7 +178,8 @@ enum v4l2_buf_type { || (type) == V4L2_BUF_TYPE_SDR_OUTPUT \ || (type) == V4L2_BUF_TYPE_META_OUTPUT) -#define V4L2_TYPE_IS_CAPTURE (type) (!V4L2_TYPE_IS_OUTPUT(type)) +#define V4L2_TYPE_IS_CAPTURE (type) \ + (V4L2_TYPE_IS_VALID(type) && !V4L2_TYPE_IS_OUTPUT(type))enum v4l2_tuner_type {V4L2_TUNER_RADIO =1 ,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 273/592 drm/amd/display: fix zero value for APU watermark_c
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charlene Liu <[email protected]>
[ Upstream commit d5a7fdc88a2d64242d959942cbd0e1499ebb9806 ]
[why]
the guard of is_apu not in sync, caused no watermark_c output.
--- drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +4 -1
@@ -663,7 +663,10 @@ static bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_sdml2_copy_clocks_to_dc_state (&out_clks, context);dml2_extract_watermark_set (&context->bw_ctx.bw.dcn.watermarks.a, &dml2->v20.dml_core_ctx);dml2_extract_watermark_set (&context->bw_ctx.bw.dcn.watermarks.b, &dml2->v20.dml_core_ctx); -memcpy (&context->bw_ctx.bw.dcn.watermarks.c, &dml2->v20.g6_temp_read_watermark_set,sizeof (context->bw_ctx.bw.dcn.watermarks.c)); +if (context->streams[0 ]->sink->link->dc->caps.is_apu) +dml2_extract_watermark_set (&context->bw_ctx.bw.dcn.watermarks.c, &dml2->v20.dml_core_ctx); +else +memcpy (&context->bw_ctx.bw.dcn.watermarks.c, &dml2->v20.g6_temp_read_watermark_set,sizeof (context->bw_ctx.bw.dcn.watermarks.c));dml2_extract_watermark_set (&context->bw_ctx.bw.dcn.watermarks.d, &dml2->v20.dml_core_ctx);dml2_extract_writeback_wm (context, &dml2->v20.dml_core_ctx);//copy for deciding zstate use
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 274/592 drm/ttm/tests: fix incorrect assert in ttm_bo_unreserve_bulk()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qasim Ijaz <[email protected]>
[ Upstream commit 878516a9e62cd220379e511d43dcf58df3a6ca9f ]
In the ttm_bo_unreserve_bulk() test function, resv is allocated using kunit_kzalloc(), but the subsequent assertion mistakenly verifies the ttm_dev pointer instead of the resv pointer.
Fix the assertion to properly verify the resv pointer.
--- drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/tests/ttm_bo_test.c +1 -1
@@ -340,7 +340,7 @@ static void ttm_bo_unreserve_bulk(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, ttm_dev); resv =kunit_kzalloc (test,sizeof (*resv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, ttm_dev); +KUNIT_ASSERT_NOT_NULL (test, resv); err =ttm_device_kunit_init (priv, ttm_dev, false, false);KUNIT_ASSERT_EQ (test, err,0 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 275/592 drm/amdgpu/gfx7: fix CSIB handling
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit be7652c23d833d1ab2c67b16e173b1a4e69d1ae6 ]
We shouldn't return after the last section.
We need to update the rest of the CSIB.
--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -2
@@ -3906,8 +3906,6 @@ static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, buffer[count++] =cpu_to_le32 (ext->reg_index -PACKET3_SET_CONTEXT_REG_START );for (i =0 ; i < ext->reg_count; i++) buffer[count++] =cpu_to_le32 (ext->extent[i]); - }else { -return ; } } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 276/592 drm/xe: Use copy_from_user() instead of __copy_from_user()
In reply to Greg Kroah-Hartman6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harish Chegondi <[email protected]>
[ Upstream commit aef87a5fdb5117eafb498ac4fc25e9f26f630f45 ]
copy_from_user() has more checks and is more safer than __copy_from_user()
--- drivers/gpu/drm/xe/xe_bo.c | 4 ++-- drivers/gpu/drm/xe/xe_eu_stall.c | 4 ++-- drivers/gpu/drm/xe/xe_exec.c | 4 ++-- drivers/gpu/drm/xe/xe_exec_queue.c | 9 ++++----- drivers/gpu/drm/xe/xe_oa.c | 6 +++--- drivers/gpu/drm/xe/xe_vm.c | 6 +++--- 6 files changed, 16 insertions(+), 17 deletions(-)
drivers/gpu/drm/xe/xe_bo.c +2 -2
@@ -2408,7 +2408,7 @@ static int gem_create_user_ext_set_property(struct xe_device *xe,int err;u32 idx; - err =__copy_from_user (&ext, address,sizeof (ext)); + err =copy_from_user (&ext, address,sizeof (ext));if (XE_IOCTL_DBG (xe, err))return -EFAULT ;
@@ -2445,7 +2445,7 @@ static int gem_create_user_extensions(struct xe_device *xe, struct xe_bo *bo,if (XE_IOCTL_DBG (xe, ext_number >=MAX_USER_EXTENSIONS ))return -E2BIG ; - err =__copy_from_user (&ext, address,sizeof (ext)); + err =copy_from_user (&ext, address,sizeof (ext));if (XE_IOCTL_DBG (xe, err))return -EFAULT ;
drivers/gpu/drm/xe/xe_eu_stall.c +2 -2
@@ -283,7 +283,7 @@ static int xe_eu_stall_user_ext_set_property(struct xe_device *xe, u64 extensionint err;u32 idx; - err =__copy_from_user (&ext, address,sizeof (ext)); + err =copy_from_user (&ext, address,sizeof (ext));if (XE_IOCTL_DBG (xe, err))return -EFAULT ;
@@ -313,7 +313,7 @@ static int xe_eu_stall_user_extensions(struct xe_device *xe, u64 extension,if (XE_IOCTL_DBG (xe, ext_number >=MAX_USER_EXTENSIONS ))return -E2BIG ; - err =__copy_from_user (&ext, address,sizeof (ext)); + err =copy_from_user (&ext, address,sizeof (ext));if (XE_IOCTL_DBG (xe, err))return -EFAULT ;
drivers/gpu/drm/xe/xe_exec.c +2 -2
@@ -176,8 +176,8 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file) }if (xe_exec_queue_is_parallel (q)) { - err =__copy_from_user (addresses, addresses_user,sizeof (u64) * - q->width); + err =copy_from_user (addresses, addresses_user,sizeof (u64) * + q->width);if (err) { err = -EFAULT ; goto err_syncs;
drivers/gpu/drm/xe/xe_exec_queue.c +4 -5
@@ -479,7 +479,7 @@ static int exec_queue_user_ext_set_property(struct xe_device *xe,int err;u32 idx; - err =__copy_from_user (&ext, address,sizeof (ext)); + err =copy_from_user (&ext, address,sizeof (ext));if (XE_IOCTL_DBG (xe, err))return -EFAULT ;
@@ -518,7 +518,7 @@ static int exec_queue_user_extensions(struct xe_device *xe, struct xe_exec_queueif (XE_IOCTL_DBG (xe, ext_number >=MAX_USER_EXTENSIONS ))return -E2BIG ; - err =__copy_from_user (&ext, address,sizeof (ext)); + err =copy_from_user (&ext, address,sizeof (ext));if (XE_IOCTL_DBG (xe, err))return -EFAULT ;
@@ -618,9 +618,8 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,if (XE_IOCTL_DBG (xe, !len || len >XE_HW_ENGINE_MAX_INSTANCE ))return -EINVAL ; - err =__copy_from_user (eci, user_eci, -sizeof (struct drm_xe_engine_class_instance ) * - len); + err =copy_from_user (eci, user_eci, +sizeof (struct drm_xe_engine_class_instance ) * len);if (XE_IOCTL_DBG (xe, err))return -EFAULT ;
drivers/gpu/drm/xe/xe_oa.c +3 -3
@@ -1301,7 +1301,7 @@ static int xe_oa_user_ext_set_property(struct xe_oa *oa, enum xe_oa_user_extn_frint err;u32 idx; - err =__copy_from_user (&ext, address,sizeof (ext)); + err =copy_from_user (&ext, address,sizeof (ext));if (XE_IOCTL_DBG (oa->xe, err))return -EFAULT ;
@@ -1338,7 +1338,7 @@ static int xe_oa_user_extensions(struct xe_oa *oa, enum xe_oa_user_extn_from froif (XE_IOCTL_DBG (oa->xe, ext_number >=MAX_USER_EXTENSIONS ))return -E2BIG ; - err =__copy_from_user (&ext, address,sizeof (ext)); + err =copy_from_user (&ext, address,sizeof (ext));if (XE_IOCTL_DBG (oa->xe, err))return -EFAULT ;
@@ -2280,7 +2280,7 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *fireturn -EACCES ; } - err =__copy_from_user (¶m,u64_to_user_ptr (data),sizeof (param)); + err =copy_from_user (¶m,u64_to_user_ptr (data),sizeof (param));if (XE_IOCTL_DBG (oa->xe, err))return -EFAULT ;
drivers/gpu/drm/xe/xe_vm.c +3 -3
@@ -3087,9 +3087,9 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe, struct xe_vm *vm,if (!*bind_ops)return args->num_binds >1 ? -ENOBUFS : -ENOMEM ; - err =__copy_from_user (*bind_ops, bind_user, -sizeof (struct drm_xe_vm_bind_op ) * - args->num_binds); + err =copy_from_user (*bind_ops, bind_user, +sizeof (struct drm_xe_vm_bind_op ) * + args->num_binds);if (XE_IOCTL_DBG (xe, err)) { err = -EFAULT ; goto free_bind_ops;
Signature · 1 line
2.39.5