From: Greg Kroah-Hartman Date: Sun, 24 Mar 2024 16:50:55 +0000 (+0100) Subject: 6.6-stable patches X-Git-Tag: v6.8.2~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed0ed4119297049a344edaf635688c027e1b4767;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: comedi-comedi_test-prevent-timers-rescheduling-during-deletion.patch mei-gsc_proxy-match-component-when-gsc-is-on-different-bus.patch --- diff --git a/queue-6.6/comedi-comedi_test-prevent-timers-rescheduling-during-deletion.patch b/queue-6.6/comedi-comedi_test-prevent-timers-rescheduling-during-deletion.patch new file mode 100644 index 00000000000..088f6740fd2 --- /dev/null +++ b/queue-6.6/comedi-comedi_test-prevent-timers-rescheduling-during-deletion.patch @@ -0,0 +1,123 @@ +From f53641a6e849034a44bf80f50245a75d7a376025 Mon Sep 17 00:00:00 2001 +From: Ian Abbott +Date: Wed, 14 Feb 2024 10:07:25 +0000 +Subject: comedi: comedi_test: Prevent timers rescheduling during deletion + +From: Ian Abbott + +commit f53641a6e849034a44bf80f50245a75d7a376025 upstream. + +The comedi_test devices have a couple of timers (ai_timer and ao_timer) +that can be started to simulate hardware interrupts. Their expiry +functions normally reschedule the timer. The driver code calls either +del_timer_sync() or del_timer() to delete the timers from the queue, but +does not currently prevent the timers from rescheduling themselves so +synchronized deletion may be ineffective. + +Add a couple of boolean members (one for each timer: ai_timer_enable and +ao_timer_enable) to the device private data structure to indicate +whether the timers are allowed to reschedule themselves. Set the member +to true when adding the timer to the queue, and to false when deleting +the timer from the queue in the waveform_ai_cancel() and +waveform_ao_cancel() functions. + +The del_timer_sync() function is also called from the waveform_detach() +function, but the timer enable members will already be set to false when +that function is called, so no change is needed there. + +Fixes: 403fe7f34e33 ("staging: comedi: comedi_test: fix timer race conditions") +Cc: stable@vger.kernel.org # 4.4+ +Signed-off-by: Ian Abbott +Link: https://lore.kernel.org/r/20240214100747.16203-1-abbotti@mev.co.uk +Signed-off-by: Greg Kroah-Hartman +--- + drivers/comedi/drivers/comedi_test.c | 30 ++++++++++++++++++++++++++---- + 1 file changed, 26 insertions(+), 4 deletions(-) + +--- a/drivers/comedi/drivers/comedi_test.c ++++ b/drivers/comedi/drivers/comedi_test.c +@@ -87,6 +87,8 @@ struct waveform_private { + struct comedi_device *dev; /* parent comedi device */ + u64 ao_last_scan_time; /* time of previous AO scan in usec */ + unsigned int ao_scan_period; /* AO scan period in usec */ ++ bool ai_timer_enable:1; /* should AI timer be running? */ ++ bool ao_timer_enable:1; /* should AO timer be running? */ + unsigned short ao_loopbacks[N_CHANS]; + }; + +@@ -236,8 +238,12 @@ static void waveform_ai_timer(struct tim + time_increment = devpriv->ai_convert_time - now; + else + time_increment = 1; +- mod_timer(&devpriv->ai_timer, +- jiffies + usecs_to_jiffies(time_increment)); ++ spin_lock(&dev->spinlock); ++ if (devpriv->ai_timer_enable) { ++ mod_timer(&devpriv->ai_timer, ++ jiffies + usecs_to_jiffies(time_increment)); ++ } ++ spin_unlock(&dev->spinlock); + } + + overrun: +@@ -393,9 +399,12 @@ static int waveform_ai_cmd(struct comedi + * Seem to need an extra jiffy here, otherwise timer expires slightly + * early! + */ ++ spin_lock_bh(&dev->spinlock); ++ devpriv->ai_timer_enable = true; + devpriv->ai_timer.expires = + jiffies + usecs_to_jiffies(devpriv->ai_convert_period) + 1; + add_timer(&devpriv->ai_timer); ++ spin_unlock_bh(&dev->spinlock); + return 0; + } + +@@ -404,6 +413,9 @@ static int waveform_ai_cancel(struct com + { + struct waveform_private *devpriv = dev->private; + ++ spin_lock_bh(&dev->spinlock); ++ devpriv->ai_timer_enable = false; ++ spin_unlock_bh(&dev->spinlock); + if (in_softirq()) { + /* Assume we were called from the timer routine itself. */ + del_timer(&devpriv->ai_timer); +@@ -495,8 +507,12 @@ static void waveform_ao_timer(struct tim + unsigned int time_inc = devpriv->ao_last_scan_time + + devpriv->ao_scan_period - now; + +- mod_timer(&devpriv->ao_timer, +- jiffies + usecs_to_jiffies(time_inc)); ++ spin_lock(&dev->spinlock); ++ if (devpriv->ao_timer_enable) { ++ mod_timer(&devpriv->ao_timer, ++ jiffies + usecs_to_jiffies(time_inc)); ++ } ++ spin_unlock(&dev->spinlock); + } + + underrun: +@@ -517,9 +533,12 @@ static int waveform_ao_inttrig_start(str + async->inttrig = NULL; + + devpriv->ao_last_scan_time = ktime_to_us(ktime_get()); ++ spin_lock_bh(&dev->spinlock); ++ devpriv->ao_timer_enable = true; + devpriv->ao_timer.expires = + jiffies + usecs_to_jiffies(devpriv->ao_scan_period); + add_timer(&devpriv->ao_timer); ++ spin_unlock_bh(&dev->spinlock); + + return 1; + } +@@ -604,6 +623,9 @@ static int waveform_ao_cancel(struct com + struct waveform_private *devpriv = dev->private; + + s->async->inttrig = NULL; ++ spin_lock_bh(&dev->spinlock); ++ devpriv->ao_timer_enable = false; ++ spin_unlock_bh(&dev->spinlock); + if (in_softirq()) { + /* Assume we were called from the timer routine itself. */ + del_timer(&devpriv->ao_timer); diff --git a/queue-6.6/mei-gsc_proxy-match-component-when-gsc-is-on-different-bus.patch b/queue-6.6/mei-gsc_proxy-match-component-when-gsc-is-on-different-bus.patch new file mode 100644 index 00000000000..e4f83cd0dd2 --- /dev/null +++ b/queue-6.6/mei-gsc_proxy-match-component-when-gsc-is-on-different-bus.patch @@ -0,0 +1,62 @@ +From a0776c214d47ea4f7aaef138095beaa41cff03ef Mon Sep 17 00:00:00 2001 +From: Alexander Usyskin +Date: Tue, 20 Feb 2024 22:00:20 +0200 +Subject: mei: gsc_proxy: match component when GSC is on different bus + +From: Alexander Usyskin + +commit a0776c214d47ea4f7aaef138095beaa41cff03ef upstream. + +On Arrow Lake S systems, MEI is no longer strictly connected to bus 0, +while graphics remain exclusively on bus 0. Adapt the component +matching logic to accommodate this change: + +Original behavior: Required both MEI and graphics to be on the same +bus 0. + +New behavior: Only enforces graphics to be on bus 0 (integrated), +allowing MEI to reside on any bus. +This ensures compatibility with Arrow Lake S and maintains functionality +for the legacy systems. + +Fixes: 1dd924f6885b ("mei: gsc_proxy: add gsc proxy driver") +Cc: stable@vger.kernel.org # v6.3+ +Signed-off-by: Alexander Usyskin +Signed-off-by: Tomas Winkler +Link: https://lore.kernel.org/r/20240220200020.231192-1-tomas.winkler@intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/mei/gsc_proxy/mei_gsc_proxy.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/misc/mei/gsc_proxy/mei_gsc_proxy.c ++++ b/drivers/misc/mei/gsc_proxy/mei_gsc_proxy.c +@@ -96,7 +96,8 @@ static const struct component_master_ops + * + * The function checks if the device is pci device and + * Intel VGA adapter, the subcomponent is SW Proxy +- * and the parent of MEI PCI and the parent of VGA are the same PCH device. ++ * and the VGA is on the bus 0 reserved for built-in devices ++ * to reject discrete GFX. + * + * @dev: master device + * @subcomponent: subcomponent to match (I915_COMPONENT_SWPROXY) +@@ -123,7 +124,8 @@ static int mei_gsc_proxy_component_match + if (subcomponent != I915_COMPONENT_GSC_PROXY) + return 0; + +- return component_compare_dev(dev->parent, ((struct device *)data)->parent); ++ /* Only built-in GFX */ ++ return (pdev->bus->number == 0); + } + + static int mei_gsc_proxy_probe(struct mei_cl_device *cldev, +@@ -146,7 +148,7 @@ static int mei_gsc_proxy_probe(struct me + } + + component_match_add_typed(&cldev->dev, &master_match, +- mei_gsc_proxy_component_match, cldev->dev.parent); ++ mei_gsc_proxy_component_match, NULL); + if (IS_ERR_OR_NULL(master_match)) { + ret = -ENOMEM; + goto err_exit; diff --git a/queue-6.6/series b/queue-6.6/series index b1e096147af..1ff700b5e18 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -568,3 +568,5 @@ perf-x86-amd-core-avoid-register-reset-when-cpu-is-d.patch afs-revert-afs-hide-silly-rename-files-from-userspac.patch nfs-fix-panic-when-nfs4_ff_layout_prepare_ds-fails.patch io_uring-net-correct-the-type-of-variable.patch +comedi-comedi_test-prevent-timers-rescheduling-during-deletion.patch +mei-gsc_proxy-match-component-when-gsc-is-on-different-bus.patch