ASoC: qcom: sdm845: set driver name correctly
Subsystems (15)
Sasha Levin
maintainerPATCH 1/42 ASoC: qcom: sdm845: set driver name correctly
From: Srinivas Kandagatla <[email protected]>
[ Upstream commit 3f48b6eba15ea342ef4cb420b580f5ed6605669f ]
With the current state of code, we would endup with something like below in /proc/asound/cards for 2 machines based on this driver.
Machine 1:
0 [DB845c ]: DB845c - DB845c
DB845c
Machine 2:
0 [LenovoYOGAC6301]: Lenovo-YOGA-C63 - Lenovo-YOGA-C630-13Q50
LENOVO-81JL-LenovoYOGAC630_13Q50-LNVNB161216This is not very UCM friendly both w.r.t to common up configs and card identification, and UCM2 became totally not usefull with just one ucm sdm845.conf for two machines which have different setups w.r.t HDMI and other dais.
Reasons for such thing is partly because Qualcomm machine drivers never cared to set driver_name.
This patch sets up driver name for the this driver to sort out the UCM integration issues!
after this patch contents of /proc/asound/cards:
Machine 1:
0 [DB845c ]: sdm845 - DB845c
DB845c
Machine 2:
0 [LenovoYOGAC6301]: sdm845 - Lenovo-YOGA-C630-13Q50
LENOVO-81JL-LenovoYOGAC630_13Q50-LNVNB161216with this its possible to align with what UCM2 expects and we can have sdm845/DB845.conf sdm845/LENOVO-81JL-LenovoYOGAC630_13Q50-LNVNB161216.conf ... for board variants. This should scale much better!
--- sound/soc/qcom/sdm845.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/qcom/sdm845.c +2 -0
@@ -16,6 +16,7 @@#include "qdsp6/q6afe.h" #include "../codecs/rt5663.h" +#define DRIVER_NAME "sdm845"#define DEFAULT_SAMPLE_RATE_48K 48000#define DEFAULT_MCLK_RATE 24576000#define TDM_BCLK_RATE 6144000
@@ -407,6 +408,7 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev) goto data_alloc_fail; } + card->driver_name =DRIVER_NAME ; card->dapm_widgets = sdm845_snd_widgets; card->num_dapm_widgets =ARRAY_SIZE (sdm845_snd_widgets); card->dev = dev;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 2/42 ASoC: cs42l51: manage mclk shutdown delay
From: Olivier Moysan <[email protected]>
[ Upstream commit 20afe581c9b980848ad097c4d54dde9bec7593ef ]
A delay must be introduced before the shutdown down of the mclk, as stated in CS42L51 datasheet. Otherwise the codec may produce some noise after the end of DAPM power down sequence. The delay between DAC and CLOCK_SUPPLY widgets is too short. Add a delay in mclk shutdown request to manage the shutdown delay explicitly. From experiments, at least 10ms delay is necessary. Set delay to 20ms as recommended in Documentation/timers/timers-howto.rst when using msleep().
--- sound/soc/codecs/cs42l51.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
sound/soc/codecs/cs42l51.c +21 -1
@@ -247,8 +247,28 @@ static const struct snd_soc_dapm_widget cs42l51_dapm_widgets[] = { &cs42l51_adcr_mux_controls), }; +static int mclk_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_component *comp =snd_soc_dapm_to_component (w->dapm); +struct cs42l51_private *cs42l51 =snd_soc_component_get_drvdata (comp); + +switch (event) { +case SND_SOC_DAPM_PRE_PMU : +return clk_prepare_enable (cs42l51->mclk_handle); +case SND_SOC_DAPM_POST_PMD : +/* Delay mclk shutdown to fulfill power-down sequence requirements */ +msleep (20 ); +clk_disable_unprepare (cs42l51->mclk_handle); +break ; + } + +return 0 ; +} +static const struct snd_soc_dapm_widget cs42l51_dapm_mclk_widgets[] = { -SND_SOC_DAPM_CLOCK_SUPPLY ("MCLK" ) +SND_SOC_DAPM_SUPPLY ("MCLK" ,SND_SOC_NOPM ,0 ,0 , mclk_event, +SND_SOC_DAPM_PRE_PMU |SND_SOC_DAPM_POST_PMD ), };static const struct snd_soc_dapm_route cs42l51_routes[] = {
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 3/42 usb: dwc3: pci: add support for the Intel Alder Lake-S
In reply to Sasha LevinFrom: Heikki Krogerus <[email protected]>
[ Upstream commit 1384ab4fee12c4c4f8bd37bc9f8686881587b286 ]
This patch adds the necessary PCI ID for Intel Alder Lake-S devices.
--- drivers/usb/dwc3/dwc3-pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/dwc3/dwc3-pci.c +4 -0
@@ -40,6 +40,7 @@#define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee#define PCI_DEVICE_ID_INTEL_TGPH 0x43ee#define PCI_DEVICE_ID_INTEL_JSP 0x4dee +#define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1#define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"#define PCI_INTEL_BXT_FUNC_PMU_PWR 4
@@ -367,6 +368,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_JSP ), (kernel_ulong_t) &dwc3_pci_intel_properties, }, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS), + (kernel_ulong_t) &dwc3_pci_intel_properties, }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB), (kernel_ulong_t) &dwc3_pci_amd_properties, }, { } /* Terminating Entry */
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 4/42 opp: Reduce the size of critical section in _opp_table_kref_release()
In reply to Sasha LevinFrom: Viresh Kumar <[email protected]>
[ Upstream commit e0df59de670b48a923246fae1f972317b84b2764 ]
There is a lot of stuff here which can be done outside of the big opp_table_lock, do that. This helps avoiding few circular dependency lockdeps around debugfs and interconnects.
--- drivers/opp/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/opp/core.c +4 -3
@@ -1046,6 +1046,10 @@ static void _opp_table_kref_release(struct kref *kref) struct opp_table *opp_table = container_of(kref, struct opp_table, kref);struct opp_device *opp_dev, *temp; +/* Drop the lock as soon as we can */ +list_del (&opp_table->node); +mutex_unlock (&opp_table_lock); +_of_clear_opp_table (opp_table);/* Release clk */
@@ -1067,10 +1071,7 @@ static void _opp_table_kref_release(struct kref *kref)mutex_destroy (&opp_table->genpd_virt_dev_lock);mutex_destroy (&opp_table->lock); -list_del (&opp_table->node);kfree (opp_table); - -mutex_unlock (&opp_table_lock); }void dev_pm_opp_put_opp_table (struct opp_table *opp_table)
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 5/42 usb: gadget: goku_udc: fix potential crashes in probe
In reply to Sasha LevinFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 0d66e04875c5aae876cf3d4f4be7978fa2b00523 ]
goku_probe() goes to error label "err" and invokes goku_remove() in case of failures of pci_enable_device(), pci_resource_start() and ioremap(). goku_remove() gets a device from pci_get_drvdata(pdev) and works with it without any checks, in particular it dereferences a corresponding pointer. But goku_probe() did not set this device yet. So, one can expect various crashes. The patch moves setting the device just after allocation of memory for it.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/usb/gadget/udc/goku_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/goku_udc.c +1 -1
@@ -1757,6 +1757,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err; } +pci_set_drvdata (pdev, dev);spin_lock_init (&dev->lock); dev->pdev = pdev; dev->gadget.ops = &goku_ops;
@@ -1790,7 +1791,6 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) } dev->regs = (struct goku_udc_regs __iomem *) base; -pci_set_drvdata (pdev, dev);INFO (dev,"%s\n" , driver_desc);INFO (dev,"version: " DRIVER_VERSION " %s\n" ,dmastr ());INFO (dev,"irq %d, pci mem %p\n" , pdev->irq, base);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 6/42 selftests/ftrace: check for do_sys_openat2 in user-memory test
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit e3e40312567087fbe6880f316cb2b0e1f3d8a82c ]
More recent libc implementations are now using openat/openat2 system calls so also add do_sys_openat2 to the tracing so that the test passes on these systems because do_sys_open may not be called.
Thanks to Masami Hiramatsu for the help on getting this fix to work correctly.
--- .../selftests/ftrace/test.d/kprobe/kprobe_args_user.tc | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc +4 -0
@@ -11,12 +11,16 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported :;: "user-memory access syntax and ustring working on user memory";: echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \ > kprobe_events +echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \ + >> kprobe_events grep myevent kprobe_events | \ grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string' echo 1 > events/kprobes/myevent/enable +echo 1 > events/kprobes/myevent2/enable echo > /dev/null echo 0 > events/kprobes/myevent/enable +echo 0 > events/kprobes/myevent2/enable grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"'
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 7/42 selftests: pidfd: fix compilation errors due to wait.h
In reply to Sasha LevinFrom: Tommi Rantala <[email protected]>
[ Upstream commit 1948172fdba5ad643529ddcd00a601c0caa913ed ]
Drop unneeded <linux/wait.h> header inclusion to fix pidfd compilation errors seen in Fedora 32:
In file included from pidfd_open_test.c:9:../../../../usr/include/linux/wait.h:17:16: error: expected identifier before numeric constant
17 | #define P_ALL 0
| ^--- tools/testing/selftests/pidfd/pidfd_open_test.c | 1 - tools/testing/selftests/pidfd/pidfd_poll_test.c | 1 - 2 files changed, 2 deletions(-)
tools/testing/selftests/pidfd/pidfd_open_test.c +0 -1
@@ -6,7 +6,6 @@#include <inttypes.h> #include <limits.h> #include <linux/types.h> -#include <linux/wait.h> #include <sched.h> #include <signal.h> #include <stdbool.h>
tools/testing/selftests/pidfd/pidfd_poll_test.c +0 -1
@@ -3,7 +3,6 @@#define _GNU_SOURCE#include <errno.h> #include <linux/types.h> -#include <linux/wait.h> #include <poll.h> #include <signal.h> #include <stdbool.h>
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 8/42 ALSA: hda: Separate runtime and system suspend
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit f5dac54d9d93826a776dffc848df76746f7135bb ]
Both pm_runtime_force_suspend() and pm_runtime_force_resume() have some implicit checks, so it can make code flow more straightforward if we separate runtime and system suspend callbacks.
High Definition Audio Specification, 4.5.9.3 Codec Wake From System S3 states that codec can wake the system up from S3 if WAKEEN is toggled. Since HDA controller has different wakeup settings for runtime and system susend, we also need to explicitly disable direct-complete which can be enabled automatically by PCI core. In addition to that, avoid waking up codec if runtime resume is for system suspend, to not break direct-complete for codecs.
While at it, also remove AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP, as the original bug commit a6630529aecb ("ALSA: hda: Workaround for spurious wakeups on some Intel platforms") solves doesn't happen with this patch.
--- sound/pci/hda/hda_controller.h | 3 +- sound/pci/hda/hda_intel.c | 62 +++++++++++++++++++--------------- 2 files changed, 36 insertions(+), 29 deletions(-)
sound/pci/hda/hda_controller.h +2 -1
@@ -41,7 +41,7 @@/* 24 unused */ #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25)/* Take LPIB as delay */ #define AZX_DCAPS_PM_RUNTIME (1 << 26)/* runtime PM support */ -#define AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP (1 << 27)/* Workaround for spurious wakeups after suspend */ +/* 27 unused */ #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28)/* CORBRP clears itself after reset */ #define AZX_DCAPS_NO_MSI64 (1 << 29)/* Stick to 32-bit MSIs */ #define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30)/* capture and playback use separate stream tag */
@@ -143,6 +143,7 @@ struct azx { unsigned int align_buffer_size:1; unsigned int region_requested:1; unsigned int disabled:1; /* disabled by vga_switcheroo */ + unsigned int pm_prepared:1;/* GTS present */ unsigned int gts_present:1;
sound/pci/hda/hda_intel.c +34 -28
122 lines not on this page · raw message
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 9/42 ALSA: hda: Reinstate runtime_allow() for all hda controllers
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 9fc149c3bce7bdbb94948a8e6bd025e3b3538603 ]
The broken jack detection should be fixed by commit a6e7d0a4bdb0 ("ALSA:
hda: fix jack detection with Realtek codecs when in D3"), let's try enabling runtime PM by default again.
--- sound/pci/hda/hda_intel.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/hda_intel.c +1 -0
@@ -2328,6 +2328,7 @@ static int azx_probe_continue(struct azx *chip)if (azx_has_pm_runtime (chip)) {pm_runtime_use_autosuspend (&pci->dev); +pm_runtime_allow (&pci->dev);pm_runtime_put_autosuspend (&pci->dev); }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 10/42 gfs2: Free rd_bits later in gfs2_clear_rgrpd to fix use-after-free
In reply to Sasha LevinFrom: Bob Peterson <[email protected]>
[ Upstream commit d0f17d3883f1e3f085d38572c2ea8edbd5150172 ]
Function gfs2_clear_rgrpd calls kfree(rgd->rd_bits) before calling return_all_reservations, but return_all_reservations still dereferences rgd->rd_bits in __rs_deltree. Fix that by moving the call to kfree below the call to return_all_reservations.
--- fs/gfs2/rgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/rgrp.c +1 -1
@@ -736,9 +736,9 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) }gfs2_free_clones (rgd); +return_all_reservations (rgd);kfree (rgd->rd_bits); rgd->rd_bits =NULL ; -return_all_reservations (rgd);kmem_cache_free (gfs2_rgrpd_cachep, rgd); } }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 11/42 gfs2: Add missing truncate_inode_pages_final for sd_aspace
In reply to Sasha LevinFrom: Bob Peterson <[email protected]>
[ Upstream commit a9dd945ccef07a904e412f208f8de708a3d7159e ]
Gfs2 creates an address space for its rgrps called sd_aspace, but it never called truncate_inode_pages_final on it. This confused vfs greatly which tried to reference the address space after gfs2 had freed the superblock that contained it.
This patch adds a call to truncate_inode_pages_final for sd_aspace, thus avoiding the use-after-free.
--- fs/gfs2/super.c | 1 + 1 file changed, 1 insertion(+)
fs/gfs2/super.c +1 -0
@@ -689,6 +689,7 @@ static void gfs2_put_super(struct super_block *sb)gfs2_jindex_free (sdp);/* Take apart glock structures and buffer lists */ gfs2_gl_hash_clear (sdp); +truncate_inode_pages_final (&sdp->sd_aspace);gfs2_delete_debugfs_file (sdp);/* Unmount the locking protocol */ gfs2_lm_unmount (sdp);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 12/42 gfs2: check for live vs. read-only file system in gfs2_fitrim
In reply to Sasha LevinFrom: Bob Peterson <[email protected]>
[ Upstream commit c5c68724696e7d2f8db58a5fce3673208d35c485 ]
Before this patch, gfs2_fitrim was not properly checking for a "live" file system. If the file system had something to trim and the file system was read-only (or spectator) it would start the trim, but when it starts the transaction, gfs2_trans_begin returns -EROFS (read-only file system) and it errors out. However, if the file system was already trimmed so there's no work to do, it never called gfs2_trans_begin. That code is bypassed so it never returns the error. Instead, it returns a good return code with 0 work. All this makes for inconsistent behavior:
The same fstrim command can return -EROFS in one case and 0 in another. This tripped up xfstests generic/537 which reports the error as:
+fstrim with unrecovered metadata just ate your filesystem
This patch adds a check for a "live" (iow, active journal, iow, RW) file system, and if not, returns the error properly.
--- fs/gfs2/rgrp.c | 3 +++ 1 file changed, 3 insertions(+)
fs/gfs2/rgrp.c +3 -0
@@ -1410,6 +1410,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp)if (!capable (CAP_SYS_ADMIN ))return -EPERM ; +if (!test_bit (SDF_JOURNAL_LIVE , &sdp->sd_flags)) +return -EROFS ; +if (!blk_queue_discard (q))return -EOPNOTSUPP ;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 13/42 scsi: hpsa: Fix memory leak in hpsa_init_one()
In reply to Sasha LevinFrom: Keita Suzuki <[email protected]>
[ Upstream commit af61bc1e33d2c0ec22612b46050f5b58ac56a962 ]
When hpsa_scsi_add_host() fails, h->lastlogicals is leaked since it is missing a free() in the error handler.
Fix this by adding free() when hpsa_scsi_add_host() fails.
--- drivers/scsi/hpsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/hpsa.c +3 -1
@@ -8854,7 +8854,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)/* hook into SCSI subsystem */ rc =hpsa_scsi_add_host (h);if (rc) - goto clean7;/* perf, sg, cmd, irq, shost, pci, lu, aer/h */ + goto clean8;/* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ /* Monitor the controller for firmware lockups */ h->heartbeat_sample_interval =HEARTBEAT_SAMPLE_INTERVAL ;
@@ -8869,6 +8869,8 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) HPSA_EVENT_MONITOR_INTERVAL);return 0 ; +clean8:/* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ +kfree (h->lastlogicals); clean7:/* perf, sg, cmd, irq, shost, pci, lu, aer/h */ hpsa_free_performant_mode (h); h->access.set_intr_mask (h,HPSA_INTR_OFF );
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 14/42 drm/amdgpu: perform srbm soft reset always on SDMA resume
In reply to Sasha LevinFrom: Evan Quan <[email protected]>
[ Upstream commit 253475c455eb5f8da34faa1af92709e7bb414624 ]
This can address the random SDMA hang after pci config reset seen on Hawaii.
--- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +12 -15
@@ -1071,22 +1071,19 @@ static int cik_sdma_soft_reset(void *handle) {u32 srbm_soft_reset =0 ;struct amdgpu_device *adev = (struct amdgpu_device *)handle; -u32 tmp =RREG32 (mmSRBM_STATUS2); +u32 tmp; -if (tmp &SRBM_STATUS2__SDMA_BUSY_MASK ) { -/* sdma0 */ - tmp =RREG32 (mmSDMA0_F32_CNTL +SDMA0_REGISTER_OFFSET ); - tmp |=SDMA0_F32_CNTL__HALT_MASK ; -WREG32 (mmSDMA0_F32_CNTL +SDMA0_REGISTER_OFFSET , tmp); - srbm_soft_reset |=SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK ; - } -if (tmp &SRBM_STATUS2__SDMA1_BUSY_MASK ) { -/* sdma1 */ - tmp =RREG32 (mmSDMA0_F32_CNTL +SDMA1_REGISTER_OFFSET ); - tmp |=SDMA0_F32_CNTL__HALT_MASK ; -WREG32 (mmSDMA0_F32_CNTL +SDMA1_REGISTER_OFFSET , tmp); - srbm_soft_reset |=SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK ; - } +/* sdma0 */ + tmp =RREG32 (mmSDMA0_F32_CNTL +SDMA0_REGISTER_OFFSET ); + tmp |=SDMA0_F32_CNTL__HALT_MASK ; +WREG32 (mmSDMA0_F32_CNTL +SDMA0_REGISTER_OFFSET , tmp); + srbm_soft_reset |=SRBM_SOFT_RESET__SOFT_RESET_SDMA_MASK ; + +/* sdma1 */ + tmp =RREG32 (mmSDMA0_F32_CNTL +SDMA1_REGISTER_OFFSET ); + tmp |=SDMA0_F32_CNTL__HALT_MASK ; +WREG32 (mmSDMA0_F32_CNTL +SDMA1_REGISTER_OFFSET , tmp); + srbm_soft_reset |=SRBM_SOFT_RESET__SOFT_RESET_SDMA1_MASK ;if (srbm_soft_reset) { tmp =RREG32 (mmSRBM_SOFT_RESET);
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 15/42 drm/amd/pm: perform SMC reset on suspend/hibernation
In reply to Sasha LevinFrom: Evan Quan <[email protected]>
[ Upstream commit 277b080f98803cb73a83fb234f0be83a10e63958 ]
So that the succeeding resume can be performed based on a clean state.
--- .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 ++++ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + drivers/gpu/drm/amd/powerplay/inc/smumgr.h | 2 ++ .../gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 24 +++++++++++++++++++ drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c | 8 +++++++ 5 files changed, 39 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +4 -0
@@ -1533,6 +1533,10 @@ int smu7_disable_dpm_tasks(struct pp_hwmgr *hwmgr)PP_ASSERT_WITH_CODE ((tmp_result ==0 ),"Failed to reset to default!" , result = tmp_result); + tmp_result =smum_stop_smc (hwmgr); +PP_ASSERT_WITH_CODE ((tmp_result ==0 ), +"Failed to stop smc!" , result = tmp_result); + tmp_result =smu7_force_switch_to_arbf0 (hwmgr);PP_ASSERT_WITH_CODE ((tmp_result ==0 ),"Failed to force to switch arbf0!" , result = tmp_result);
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
@@ -229,6 +229,7 @@ struct pp_smumgr_func {bool (*is_hw_avfs_present)(struct pp_hwmgr *hwmgr);int (*update_dpm_settings)(struct pp_hwmgr *hwmgr,void *profile_setting);int (*smc_table_manager)(struct pp_hwmgr *hwmgr,uint8_t *table,uint16_t table_id,bool rw);/*rw: true for read, false for write */ +int (*stop_smc)(struct pp_hwmgr *hwmgr); };struct pp_hwmgr_func {
drivers/gpu/drm/amd/powerplay/inc/smumgr.h +2 -0
@@ -114,4 +114,6 @@ extern int smum_update_dpm_settings(struct pp_hwmgr *hwmgr, void *profile_settinextern int smum_smc_table_manager (struct pp_hwmgr *hwmgr,uint8_t *table,uint16_t table_id,bool rw); +extern int smum_stop_smc (struct pp_hwmgr *hwmgr); +#endif
drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c +24 -0
@@ -2936,6 +2936,29 @@ static int ci_update_smc_table(struct pp_hwmgr *hwmgr, uint32_t type)return 0 ; } +static void ci_reset_smc (struct pp_hwmgr *hwmgr) +{ +PHM_WRITE_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC , +SMC_SYSCON_RESET_CNTL , + rst_reg,1 ); +} + + +static void ci_stop_smc_clock (struct pp_hwmgr *hwmgr) +{ +PHM_WRITE_INDIRECT_FIELD (hwmgr->device,CGS_IND_REG__SMC , +SMC_SYSCON_CLOCK_CNTL_0 , + ck_disable,1 ); +} + +static int ci_stop_smc (struct pp_hwmgr *hwmgr) +{ +ci_reset_smc (hwmgr); +ci_stop_smc_clock (hwmgr); + +return 0 ; +} +const struct pp_smumgr_func ci_smu_funcs = { .name ="ci_smu" , .smu_init = ci_smu_init,
@@ -2960,4 +2983,5 @@ const struct pp_smumgr_func ci_smu_funcs = { .is_dpm_running = ci_is_dpm_running, .update_dpm_settings = ci_update_dpm_settings, .update_smc_table = ci_update_smc_table, + .stop_smc = ci_stop_smc, };
drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +8 -0
@@ -217,3 +217,11 @@ int smum_smc_table_manager(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t tablreturn -EINVAL ; } + +int smum_stop_smc (struct pp_hwmgr *hwmgr) +{ +if (hwmgr->smumgr_funcs->stop_smc) +return hwmgr->smumgr_funcs->stop_smc (hwmgr); + +return 0 ; +}
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 16/42 drm/amd/pm: do not use ixFEATURE_STATUS for checking smc running
In reply to Sasha LevinFrom: Evan Quan <[email protected]>
[ Upstream commit 786436b453001dafe81025389f96bf9dac1e9690 ]
This reverts commit f87812284172a9809820d10143b573d833cd3f75 ("drm/amdgpu:
Fix bug where DPM is not enabled after hibernate and resume"). It was intended to fix Hawaii S4(hibernation) issue but break S3. As ixFEATURE_STATUS is filled with garbage data on resume which can be only cleared by reloading smc firmware(but that will involve many changes). So, we will revert this S4 fix and seek a new way.
--- drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c +1 -4
@@ -2725,10 +2725,7 @@ static int ci_initialize_mc_reg_table(struct pp_hwmgr *hwmgr)static bool ci_is_dpm_running (struct pp_hwmgr *hwmgr) { -return (1 ==PHM_READ_INDIRECT_FIELD (hwmgr->device, -CGS_IND_REG__SMC ,FEATURE_STATUS , -VOLTAGE_CONTROLLER_ON )) - ? true : false; +return ci_is_smc_ram_running (hwmgr); }static int ci_smu_init (struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 17/42 mac80211: fix use of skb payload instead of header
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 14f46c1e5108696ec1e5a129e838ecedf108c7bf ]
When ieee80211_skb_resize() is called from ieee80211_build_hdr() the skb has no 802.11 header yet, in fact it consist only of the payload as the ethernet frame is removed. As such, we're using the payload data for ieee80211_is_mgmt(), which is of course completely wrong. This didn't really hurt us because these are always data frames, so we could only have added more tailroom than we needed if we determined it was a management frame and sdata->crypto_tx_tailroom_needed_cnt was false.
However, syzbot found that of course there need not be any payload, so we're using at best uninitialized memory for the check.
Fix this to pass explicitly the kind of frame that we have instead of checking there, by replacing the "bool may_encrypt" argument with an argument that can carry the three possible states - it's not going to be encrypted, it's a management frame, or it's a data frame (and then we check sdata->crypto_tx_tailroom_needed_cnt).
--- net/mac80211/tx.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-)
net/mac80211/tx.c +24 -13
@@ -1944,19 +1944,24 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,/* device xmit handlers */ +enum ieee80211_encrypt { +ENCRYPT_NO , +ENCRYPT_MGMT , +ENCRYPT_DATA , +}; +static int ieee80211_skb_resize (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, -int head_need,bool may_encrypt) +int head_need, +enum ieee80211_encrypt encrypt) {struct ieee80211_local *local = sdata->local; -struct ieee80211_hdr *hdr;bool enc_tailroom;int tail_need =0 ; - hdr = (struct ieee80211_hdr *) skb->data; - enc_tailroom = may_encrypt && - (sdata->crypto_tx_tailroom_needed_cnt || -ieee80211_is_mgmt (hdr->frame_control)); + enc_tailroom = encrypt ==ENCRYPT_MGMT || + (encrypt ==ENCRYPT_DATA && + sdata->crypto_tx_tailroom_needed_cnt);if (enc_tailroom) { tail_need =IEEE80211_ENCRYPT_TAILROOM ;
@@ -1988,23 +1993,29 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, {struct ieee80211_local *local = sdata->local;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb); -struct ieee80211_hdr *hdr; +struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;int headroom; -bool may_encrypt; +enum ieee80211_encrypt encrypt; - may_encrypt = !(info->flags &IEEE80211_TX_INTFL_DONT_ENCRYPT ); +if (info->flags &IEEE80211_TX_INTFL_DONT_ENCRYPT ) + encrypt =ENCRYPT_NO ; +else if (ieee80211_is_mgmt (hdr->frame_control)) + encrypt =ENCRYPT_MGMT ; +else + encrypt =ENCRYPT_DATA ; headroom = local->tx_headroom; -if (may_encrypt) +if (encrypt !=ENCRYPT_NO ) headroom += sdata->encrypt_headroom; headroom -=skb_headroom (skb); headroom =max_t (int,0 , headroom); -if (ieee80211_skb_resize (sdata, skb, headroom, may_encrypt)) { +if (ieee80211_skb_resize (sdata, skb, headroom, encrypt)) {ieee80211_free_txskb (&local->hw, skb);return ; } +/* reload after potential resize */ hdr = (struct ieee80211_hdr *) skb->data; info->control.vif = &sdata->vif;
@@ -2808,7 +2819,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, head_need += sdata->encrypt_headroom; head_need += local->tx_headroom; head_need =max_t (int,0 , head_need); -if (ieee80211_skb_resize (sdata, skb, head_need, true)) { +if (ieee80211_skb_resize (sdata, skb, head_need,ENCRYPT_DATA )) {ieee80211_free_txskb (&local->hw, skb); skb =NULL ;return ERR_PTR (-ENOMEM );
@@ -3482,7 +3493,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,if (unlikely (ieee80211_skb_resize (sdata, skb,max_t (int, extra_head + hw_headroom -skb_headroom (skb),0 ), - false))) { +ENCRYPT_NO ))) {kfree_skb (skb);return true; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 18/42 cfg80211: initialize wdev data earlier
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 9bdaf3b91efd229dd272b228e13df10310c80d19 ]
There's a race condition in the netdev registration in that NETDEV_REGISTER actually happens after the netdev is available, and so if we initialize things only there, we might get called with an uninitialized wdev through nl80211 - not using a wdev but using a netdev interface index.
I found this while looking into a syzbot report, but it doesn't really seem to be related, and unfortunately there's no repro for it (yet). I can't (yet) explain how it managed to get into cfg80211_release_pmsr() from nl80211_netlink_notify() without the wdev having been initialized, as the latter only iterates the wdevs that are linked into the rdev, which even without the change here happened after init.
However, looking at this, it seems fairly clear that the init needs to be done earlier, otherwise we might even re-init on a netns move, when data might still be pending.
--- net/wireless/core.c | 57 +++++++++++++++++++++++------------------- net/wireless/core.h | 5 ++-- net/wireless/nl80211.c | 3 ++- 3 files changed, 36 insertions(+), 29 deletions(-)
net/wireless/core.c +31 -26
@@ -1224,8 +1224,7 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, }EXPORT_SYMBOL (cfg80211_stop_iface); -void cfg80211_init_wdev (struct cfg80211_registered_device *rdev, -struct wireless_dev *wdev) +void cfg80211_init_wdev (struct wireless_dev *wdev) {mutex_init (&wdev->mtx);INIT_LIST_HEAD (&wdev->event_list);
@@ -1236,6 +1235,30 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,spin_lock_init (&wdev->pmsr_lock);INIT_WORK (&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk); +#ifdef CONFIG_CFG80211_WEXT + wdev->wext.default_key =-1 ; + wdev->wext.default_mgmt_key =-1 ; + wdev->wext.connect.auth_type =NL80211_AUTHTYPE_AUTOMATIC ; +#endif + +if (wdev->wiphy->flags &WIPHY_FLAG_PS_ON_BY_DEFAULT ) + wdev->ps = true; +else + wdev->ps = false; +/* allow mac80211 to determine the timeout */ + wdev->ps_timeout =-1 ; + +if ((wdev->iftype ==NL80211_IFTYPE_STATION || + wdev->iftype ==NL80211_IFTYPE_P2P_CLIENT || + wdev->iftype ==NL80211_IFTYPE_ADHOC ) && !wdev->use_4addr) + wdev->netdev->priv_flags |=IFF_DONT_BRIDGE ; + +INIT_WORK (&wdev->disconnect_wk, cfg80211_autodisconnect_wk); +} + +void cfg80211_register_wdev (struct cfg80211_registered_device *rdev, +struct wireless_dev *wdev) +{/* * We get here also when the interface changes network namespaces, * as it's registered into the new one, but we don't want it to
@@ -1269,6 +1292,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,switch (state) {case NETDEV_POST_INIT :SET_NETDEV_DEVTYPE (dev, &wiphy_type); + wdev->netdev = dev; +/* can only change netns with wiphy */ + dev->features |=NETIF_F_NETNS_LOCAL ; + +cfg80211_init_wdev (wdev);break ;case NETDEV_REGISTER :/*
@@ -1276,35 +1304,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,* called within code protected by it when interfaces * are added with nl80211. */ -/* can only change netns with wiphy */ - dev->features |=NETIF_F_NETNS_LOCAL ; -if (sysfs_create_link (&dev->dev.kobj, &rdev->wiphy.dev.kobj,"phy80211" )) {pr_err ("failed to add phy80211 symlink to netdev!\n" ); } - wdev->netdev = dev; -#ifdef CONFIG_CFG80211_WEXT - wdev->wext.default_key =-1 ; - wdev->wext.default_mgmt_key =-1 ; - wdev->wext.connect.auth_type =NL80211_AUTHTYPE_AUTOMATIC ; -#endif - -if (wdev->wiphy->flags &WIPHY_FLAG_PS_ON_BY_DEFAULT ) - wdev->ps = true; -else - wdev->ps = false; -/* allow mac80211 to determine the timeout */ - wdev->ps_timeout =-1 ; - -if ((wdev->iftype ==NL80211_IFTYPE_STATION || - wdev->iftype ==NL80211_IFTYPE_P2P_CLIENT || - wdev->iftype ==NL80211_IFTYPE_ADHOC ) && !wdev->use_4addr) - dev->priv_flags |=IFF_DONT_BRIDGE ; - -INIT_WORK (&wdev->disconnect_wk, cfg80211_autodisconnect_wk); -cfg80211_init_wdev (rdev, wdev); +cfg80211_register_wdev (rdev, wdev);break ;case NETDEV_GOING_DOWN :cfg80211_leave (rdev, wdev);
net/wireless/core.h +3 -2
@@ -210,8 +210,9 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx);int cfg80211_switch_netns (struct cfg80211_registered_device *rdev,struct net *net); -void cfg80211_init_wdev (struct cfg80211_registered_device *rdev, -struct wireless_dev *wdev); +void cfg80211_init_wdev (struct wireless_dev *wdev); +void cfg80211_register_wdev (struct cfg80211_registered_device *rdev, +struct wireless_dev *wdev); static inline void wdev_lock(struct wireless_dev *wdev) __acquires(wdev)
net/wireless/nl80211.c +2 -1
@@ -3654,7 +3654,8 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)* P2P Device and NAN do not have a netdev, so don't go * through the netdev notifier and must be added here */ -cfg80211_init_wdev (rdev, wdev); +cfg80211_init_wdev (wdev); +cfg80211_register_wdev (rdev, wdev);break ;default :break ;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 19/42 mac80211: always wind down STA state
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit dcd479e10a0510522a5d88b29b8f79ea3467d501 ]
When (for example) an IBSS station is pre-moved to AUTHORIZED before it's inserted, and then the insertion fails, we don't clean up the fast RX/TX states that might already have been created, since we don't go through all the state transitions again on the way down.
Do that, if it hasn't been done already, when the station is freed. I considered only freeing the fast TX/RX state there, but we might add more state so it's more robust to wind down the state properly.
Note that we warn if the station was ever inserted, it should have been properly cleaned up in that case, and the driver will probably not like things happening out of order.
--- net/mac80211/sta_info.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
net/mac80211/sta_info.c +18 -0
@@ -244,6 +244,24 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,*/ void sta_info_free (struct ieee80211_local *local,struct sta_info *sta) { +/* +* If we had used sta_info_pre_move_state() then we might not +* have gone through the state transitions down again, so do +* it here now (and warn if it's inserted). +* +* This will clear state such as fast TX/RX that may have been +* allocated during state transitions. +*/ +while (sta->sta_state >IEEE80211_STA_NONE ) { +int ret; + +WARN_ON_ONCE (test_sta_flag (sta,WLAN_STA_INSERTED )); + + ret =sta_info_move_state (sta, sta->sta_state -1 ); +if (WARN_ONCE (ret,"sta_info_move_state() returned %d\n" , ret)) +break ; + } +if (sta->rate_ctrl)rate_control_free_sta (sta);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 20/42 cfg80211: regulatory: Fix inconsistent format argument
In reply to Sasha LevinFrom: Ye Bin <[email protected]>
[ Upstream commit db18d20d1cb0fde16d518fb5ccd38679f174bc04 ]
Fix follow warning:
[net/wireless/reg.c:3619]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
--- net/wireless/reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/reg.c +1 -1
@@ -3405,7 +3405,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd) power_rule = ®_rule->power_rule;if (reg_rule->flags &NL80211_RRF_AUTO_BW ) -snprintf (bw,sizeof (bw),"%d KHz, %d KHz AUTO" , +snprintf (bw,sizeof (bw),"%d KHz, %u KHz AUTO" , freq_range->max_bandwidth_khz,reg_get_max_bandwidth (rd, reg_rule));else
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 21/42 tracing: Fix the checking of stackidx in __ftrace_trace_stack
In reply to Sasha LevinFrom: Qiujun Huang <[email protected]>
[ Upstream commit 906695e59324635c62b5ae59df111151a546ca66 ]
The array size is FTRACE_KSTACK_NESTING, so the index FTRACE_KSTACK_NESTING is illegal too. And fix two typos by the way.
--- kernel/trace/trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
@@ -2510,7 +2510,7 @@ trace_event_buffer_lock_reserve(struct ring_buffer **current_rb,/* * If tracing is off, but we have triggers enabled * we still need to look at the event data. Use the temp_buffer -* to store the trace event for the tigger to use. It's recusive +* to store the trace event for the trigger to use. It's recursive * safe and will not be recorded anywhere. */ if (!entry && trace_file->flags &EVENT_FILE_FL_TRIGGER_COND ) {
@@ -2832,7 +2832,7 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer, stackidx =__this_cpu_inc_return (ftrace_stack_reserve) -1 ;/* This should never happen. If it does, yell once and skip */ -if (WARN_ON_ONCE (stackidx >FTRACE_KSTACK_NESTING )) +if (WARN_ON_ONCE (stackidx >=FTRACE_KSTACK_NESTING )) goto out;/*
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 22/42 scsi: scsi_dh_alua: Avoid crash during alua_bus_detach()
In reply to Sasha LevinFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 5faf50e9e9fdc2117c61ff7e20da49cd6a29e0ca ]
alua_bus_detach() might be running concurrently with alua_rtpg_work(), so we might trip over h->sdev == NULL and call BUG_ON(). The correct way of handling it is to not set h->sdev to NULL in alua_bus_detach(), and call rcu_synchronize() before the final delete to ensure that all concurrent threads have left the critical section. Then we can get rid of the BUG_ON() and replace it with a simple if condition.
--- drivers/scsi/device_handler/scsi_dh_alua.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +5 -4
@@ -658,8 +658,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)rcu_read_lock ();list_for_each_entry_rcu (h, &tmp_pg->dh_list, node) { -/* h->sdev should always be valid */ -BUG_ON (!h->sdev); +if (!h->sdev) +continue ; h->sdev->access_state = desc[0 ]; }rcu_read_unlock ();
@@ -705,7 +705,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) pg->expiry =0 ;rcu_read_lock ();list_for_each_entry_rcu (h, &pg->dh_list, node) { -BUG_ON (!h->sdev); +if (!h->sdev) +continue ; h->sdev->access_state = (pg->state &SCSI_ACCESS_STATE_MASK );if (pg->pref)
@@ -1147,7 +1148,6 @@ static void alua_bus_detach(struct scsi_device *sdev)spin_lock (&h->pg_lock); pg =rcu_dereference_protected (h->pg,lockdep_is_held (&h->pg_lock));rcu_assign_pointer (h->pg,NULL ); - h->sdev =NULL ;spin_unlock (&h->pg_lock);if (pg) {spin_lock_irq (&pg->lock);
@@ -1156,6 +1156,7 @@ static void alua_bus_detach(struct scsi_device *sdev)kref_put (&pg->kref, release_port_group); } sdev->handler_data =NULL ; +synchronize_rcu ();kfree (h); }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 23/42 scsi: mpt3sas: Fix timeouts observed while reenabling IRQ
In reply to Sasha LevinFrom: Sreekanth Reddy <[email protected]>
[ Upstream commit 5feed64f9199ff90c4239971733f23f30aeb2484 ]
While reenabling the IRQ after irq poll there may be small time window where HBA firmware has posted some replies and raise the interrupts but driver has not received the interrupts. So we may observe I/O timeouts as the driver has not processed the replies as interrupts got missed while reenabling the IRQ.
To fix this issue the driver has to go for one more round of processing the reply descriptors from reply descriptor post queue after enabling the IRQ.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_base.c +7 -0
@@ -1641,6 +1641,13 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget) reply_q->irq_poll_scheduled = false; reply_q->irq_line_enable = true;enable_irq (reply_q->os_irq); +/* +* Go for one more round of processing the +* reply descriptor post queue incase if HBA +* Firmware has posted some reply descriptors +* while reenabling the IRQ. +*/ +_base_process_reply_queue (reply_q); }return num_entries;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 24/42 nvme: introduce nvme_sync_io_queues
In reply to Sasha LevinFrom: Chao Leng <[email protected]>
[ Upstream commit 04800fbff4764ab7b32c49d19628605a5d4cb85c ]
Introduce sync io queues for some scenarios which just only need sync io queues not sync all queues.
--- drivers/nvme/host/core.c | 8 ++++++-- drivers/nvme/host/nvme.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +6 -2
@@ -4226,8 +4226,7 @@ void nvme_start_queues(struct nvme_ctrl *ctrl) }EXPORT_SYMBOL_GPL (nvme_start_queues); - -void nvme_sync_queues (struct nvme_ctrl *ctrl) +void nvme_sync_io_queues (struct nvme_ctrl *ctrl) {struct nvme_ns *ns;
@@ -4235,7 +4234,12 @@ void nvme_sync_queues(struct nvme_ctrl *ctrl)list_for_each_entry (ns, &ctrl->namespaces, list)blk_sync_queue (ns->queue);up_read (&ctrl->namespaces_rwsem); +} +EXPORT_SYMBOL_GPL (nvme_sync_io_queues); +void nvme_sync_queues (struct nvme_ctrl *ctrl) +{ +nvme_sync_io_queues (ctrl);if (ctrl->admin_q)blk_sync_queue (ctrl->admin_q); }
drivers/nvme/host/nvme.h +1 -0
@@ -494,6 +494,7 @@ void nvme_stop_queues(struct nvme_ctrl *ctrl);void nvme_start_queues (struct nvme_ctrl *ctrl);void nvme_kill_queues (struct nvme_ctrl *ctrl);void nvme_sync_queues (struct nvme_ctrl *ctrl); +void nvme_sync_io_queues (struct nvme_ctrl *ctrl);void nvme_unfreeze (struct nvme_ctrl *ctrl);void nvme_wait_freeze (struct nvme_ctrl *ctrl);int nvme_wait_freeze_timeout (struct nvme_ctrl *ctrl,long timeout);
Signature · 7 lines
2.27.0 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 25/42 nvme-rdma: avoid race between time out and tear down
In reply to Sasha LevinFrom: Chao Leng <[email protected]>
[ Upstream commit 3017013dcc82a4862bd1e140f8b762cfc594008d ]
Now use teardown_lock to serialize for time out and tear down. This may cause abnormal: first cancel all request in tear down, then time out may complete the request again, but the request may already be freed or restarted.
To avoid race between time out and tear down, in tear down process, first we quiesce the queue, and then delete the timer and cancel the time out work for the queue. At the same time we need to delete teardown_lock.
--- drivers/nvme/host/rdma.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/nvme/host/rdma.c +2 -10
@@ -110,7 +110,6 @@ struct nvme_rdma_ctrl {struct sockaddr_storage src_addr;struct nvme_ctrl ctrl; -struct mutex teardown_lock;bool use_inline_data;u32 io_queues[HCTX_MAX_TYPES ]; };
@@ -933,8 +932,8 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)static void nvme_rdma_teardown_admin_queue (struct nvme_rdma_ctrl *ctrl,bool remove) { -mutex_lock (&ctrl->teardown_lock);blk_mq_quiesce_queue (ctrl->ctrl.admin_q); +blk_sync_queue (ctrl->ctrl.admin_q);nvme_rdma_stop_queue (&ctrl->queues[0 ]);if (ctrl->ctrl.admin_tagset) { blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset,
@@ -944,16 +943,15 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,if (remove)blk_mq_unquiesce_queue (ctrl->ctrl.admin_q);nvme_rdma_destroy_admin_queue (ctrl, remove); -mutex_unlock (&ctrl->teardown_lock); }static void nvme_rdma_teardown_io_queues (struct nvme_rdma_ctrl *ctrl,bool remove) { -mutex_lock (&ctrl->teardown_lock);if (ctrl->ctrl.queue_count >1 ) {nvme_start_freeze (&ctrl->ctrl);nvme_stop_queues (&ctrl->ctrl); +nvme_sync_io_queues (&ctrl->ctrl);nvme_rdma_stop_io_queues (ctrl);if (ctrl->ctrl.tagset) { blk_mq_tagset_busy_iter(ctrl->ctrl.tagset,
@@ -964,7 +962,6 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,nvme_start_queues (&ctrl->ctrl);nvme_rdma_destroy_io_queues (ctrl, remove); } -mutex_unlock (&ctrl->teardown_lock); }static void nvme_rdma_free_ctrl (struct nvme_ctrl *nctrl)
@@ -1720,16 +1717,12 @@ static void nvme_rdma_complete_timed_out(struct request *rq) {struct nvme_rdma_request *req =blk_mq_rq_to_pdu (rq);struct nvme_rdma_queue *queue = req->queue; -struct nvme_rdma_ctrl *ctrl = queue->ctrl; -/* fence other contexts that may complete the command */ -mutex_lock (&ctrl->teardown_lock);nvme_rdma_stop_queue (queue);if (!blk_mq_request_completed (rq)) {nvme_req (rq)->status =NVME_SC_HOST_ABORTED_CMD ;blk_mq_complete_request (rq); } -mutex_unlock (&ctrl->teardown_lock); } static enum blk_eh_timer_return
@@ -2021,7 +2014,6 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,return ERR_PTR (-ENOMEM ); ctrl->ctrl.opts = opts;INIT_LIST_HEAD (&ctrl->list); -mutex_init (&ctrl->teardown_lock);if (!(opts->mask &NVMF_OPT_TRSVCID )) { opts->trsvcid =
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 26/42 nvme-tcp: avoid race between time out and tear down
In reply to Sasha LevinFrom: Chao Leng <[email protected]>
[ Upstream commit d6f66210f4b1aa2f5944f0e34e0f8db44f499f92 ]
Now use teardown_lock to serialize for time out and tear down. This may cause abnormal: first cancel all request in tear down, then time out may complete the request again, but the request may already be freed or restarted.
To avoid race between time out and tear down, in tear down process, first we quiesce the queue, and then delete the timer and cancel the time out work for the queue. At the same time we need to delete teardown_lock.
--- drivers/nvme/host/tcp.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/nvme/host/tcp.c +3 -11
@@ -110,7 +110,6 @@ struct nvme_tcp_ctrl {struct sockaddr_storage src_addr;struct nvme_ctrl ctrl; -struct mutex teardown_lock;struct work_struct err_work;struct delayed_work connect_work;struct nvme_tcp_request async_req;
@@ -1797,8 +1796,8 @@ static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new)static void nvme_tcp_teardown_admin_queue (struct nvme_ctrl *ctrl,bool remove) { -mutex_lock (&to_tcp_ctrl (ctrl)->teardown_lock);blk_mq_quiesce_queue (ctrl->admin_q); +blk_sync_queue (ctrl->admin_q);nvme_tcp_stop_queue (ctrl,0 );if (ctrl->admin_tagset) { blk_mq_tagset_busy_iter(ctrl->admin_tagset,
@@ -1808,18 +1807,17 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,if (remove)blk_mq_unquiesce_queue (ctrl->admin_q);nvme_tcp_destroy_admin_queue (ctrl, remove); -mutex_unlock (&to_tcp_ctrl (ctrl)->teardown_lock); }static void nvme_tcp_teardown_io_queues (struct nvme_ctrl *ctrl,bool remove) { -mutex_lock (&to_tcp_ctrl (ctrl)->teardown_lock);if (ctrl->queue_count <=1 ) - goto out; +return ;blk_mq_quiesce_queue (ctrl->admin_q);nvme_start_freeze (ctrl);nvme_stop_queues (ctrl); +nvme_sync_io_queues (ctrl);nvme_tcp_stop_io_queues (ctrl);if (ctrl->tagset) { blk_mq_tagset_busy_iter(ctrl->tagset,
@@ -1829,8 +1827,6 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,if (remove)nvme_start_queues (ctrl);nvme_tcp_destroy_io_queues (ctrl, remove); -out: -mutex_unlock (&to_tcp_ctrl (ctrl)->teardown_lock); }static void nvme_tcp_reconnect_or_remove (struct nvme_ctrl *ctrl)
@@ -2074,14 +2070,11 @@ static void nvme_tcp_complete_timed_out(struct request *rq)struct nvme_tcp_request *req =blk_mq_rq_to_pdu (rq);struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; -/* fence other contexts that may complete the command */ -mutex_lock (&to_tcp_ctrl (ctrl)->teardown_lock);nvme_tcp_stop_queue (ctrl,nvme_tcp_queue_id (req->queue));if (!blk_mq_request_completed (rq)) {nvme_req (rq)->status =NVME_SC_HOST_ABORTED_CMD ;blk_mq_complete_request (rq); } -mutex_unlock (&to_tcp_ctrl (ctrl)->teardown_lock); } static enum blk_eh_timer_return
@@ -2344,7 +2337,6 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, nvme_tcp_reconnect_ctrl_work);INIT_WORK (&ctrl->err_work, nvme_tcp_error_recovery_work);INIT_WORK (&ctrl->ctrl.reset_work, nvme_reset_ctrl_work); -mutex_init (&ctrl->teardown_lock);if (!(opts->mask &NVMF_OPT_TRSVCID )) { opts->trsvcid =
Signature · 7 lines
2.27.0 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 27/42 nvme-rdma: avoid repeated request completion
In reply to Sasha LevinFrom: Sagi Grimberg <[email protected]>
[ Upstream commit fdf58e02adecbef4c7cbb2073d8ea225e6fd5f26 ]
The request may be executed asynchronously, and rq->state may be changed to IDLE. To avoid repeated request completion, only MQ_RQ_COMPLETE of rq->state is checked in nvme_rdma_complete_timed_out. It is not safe, so need adding check IDLE for rq->state.
--- drivers/nvme/host/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/rdma.c +1 -1
@@ -1719,7 +1719,7 @@ static void nvme_rdma_complete_timed_out(struct request *rq)struct nvme_rdma_queue *queue = req->queue;nvme_rdma_stop_queue (queue); -if (!blk_mq_request_completed (rq)) { +if (blk_mq_request_started (rq) && !blk_mq_request_completed (rq)) {nvme_req (rq)->status =NVME_SC_HOST_ABORTED_CMD ;blk_mq_complete_request (rq); }
Signature · 7 lines
2.27.0 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 28/42 nvme-tcp: avoid repeated request completion
In reply to Sasha LevinFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 0a8a2c85b83589a5c10bc5564b796836bf4b4984 ]
The request may be executed asynchronously, and rq->state may be changed to IDLE. To avoid repeated request completion, only MQ_RQ_COMPLETE of rq->state is checked in nvme_tcp_complete_timed_out. It is not safe, so need adding check IDLE for rq->state.
--- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/tcp.c +1 -1
@@ -2071,7 +2071,7 @@ static void nvme_tcp_complete_timed_out(struct request *rq)struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;nvme_tcp_stop_queue (ctrl,nvme_tcp_queue_id (req->queue)); -if (!blk_mq_request_completed (rq)) { +if (blk_mq_request_started (rq) && !blk_mq_request_completed (rq)) {nvme_req (rq)->status =NVME_SC_HOST_ABORTED_CMD ;blk_mq_complete_request (rq); }
Signature · 7 lines
2.27.0 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 29/42 iommu/amd: Increase interrupt remapping table limit to 512 entries
In reply to Sasha LevinFrom: Suravee Suthikulpanit <[email protected]>
[ Upstream commit 73db2fc595f358460ce32bcaa3be1f0cce4a2db1 ]
Certain device drivers allocate IO queues on a per-cpu basis. On AMD EPYC platform, which can support up-to 256 cpu threads, this can exceed the current MAX_IRQ_PER_TABLE limit of 256, and result in the error message:
AMD-Vi: Failed to allocate IRTE
This has been observed with certain NVME devices.
AMD IOMMU hardware can actually support upto 512 interrupt remapping table entries. Therefore, update the driver to match the hardware limit.
Please note that this also increases the size of interrupt remapping table to 8KB per device when using the 128-bit IRTE format.
--- drivers/iommu/amd_iommu_types.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu_types.h +5 -1
@@ -406,7 +406,11 @@ extern bool amd_iommu_np_cache;/* Only true if all IOMMUs support device IOTLBs */ extern bool amd_iommu_iotlb_sup; -#define MAX_IRQS_PER_TABLE 256 +/* +* AMD IOMMU hardware only support 512 IRTEs despite +* the architectural limitation of 2048 entries. +*/ +#define MAX_IRQS_PER_TABLE 512#define IRQ_TABLE_ALIGNMENT 128struct irq_remap_table {
Signature · 6 lines
2.27.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 30/42 s390/smp: move rcu_cpu_starting() earlier
In reply to Sasha LevinFrom: Qian Cai <[email protected]>
[ Upstream commit de5d9dae150ca1c1b5c7676711a9ca139d1a8dec ]
The call to rcu_cpu_starting() in smp_init_secondary() is not early enough in the CPU-hotplug onlining process, which results in lockdep splats as follows:
WARNING: suspicious RCU usage
-----------------------------
kernel/locking/lockdep.c:3497 RCU-list traversed in non-reader section!!
other info that might help us debug this:
RCU used illegally from offline CPU!
rcu_scheduler_active = 1, debug_locks = 1
no locks held by swapper/1/0.
Call Trace: show_stack+0x158/0x1f0 dump_stack+0x1f2/0x238 __lock_acquire+0x2640/0x4dd0 lock_acquire+0x3a8/0xd08 _raw_spin_lock_irqsave+0xc0/0xf0 clockevents_register_device+0xa8/0x528 init_cpu_timer+0x33e/0x468 smp_init_secondary+0x11a/0x328 smp_start_secondary+0x82/0x88
This is avoided by moving the call to rcu_cpu_starting up near the beginning of the smp_init_secondary() function. Note that the raw_smp_processor_id() is required in order to avoid calling into lockdep before RCU has declared the CPU to be watched for readers.
--- arch/s390/kernel/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/s390/kernel/smp.c +2 -1
@@ -845,13 +845,14 @@ void __init smp_detect_cpus(void)static void smp_init_secondary (void ) { -int cpu =smp_processor_id (); +int cpu =raw_smp_processor_id (); S390_lowcore.last_update_clock =get_tod_clock ();restore_access_regs (S390_lowcore.access_regs_save_area);set_cpu_flag (CIF_ASCE_PRIMARY );set_cpu_flag (CIF_ASCE_SECONDARY );cpu_init (); +rcu_cpu_starting (cpu);preempt_disable ();init_cpu_timer ();vtime_init ();
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 31/42 vfio: platform: fix reference leak in vfio_platform_open
In reply to Sasha LevinFrom: Zhang Qilong <[email protected]>
[ Upstream commit bb742ad01961a3b9d1f9d19375487b879668b6b2 ]
pm_runtime_get_sync() will increment pm usage counter even it failed. Forgetting to call pm_runtime_put will result in reference leak in vfio_platform_open, so we should fix it.
--- drivers/vfio/platform/vfio_platform_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/vfio/platform/vfio_platform_common.c +1 -2
@@ -267,7 +267,7 @@ static int vfio_platform_open(void *device_data) ret =pm_runtime_get_sync (vdev->device);if (ret <0 ) - goto err_pm; + goto err_rst; ret =vfio_platform_call_reset (vdev, &extra_dbg);if (ret && vdev->reset_required) {
@@ -284,7 +284,6 @@ static int vfio_platform_open(void *device_data) err_rst:pm_runtime_put (vdev->device); -err_pm:vfio_platform_irq_cleanup (vdev); err_irq:vfio_platform_regions_cleanup (vdev);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 32/42 vfio/pci: Bypass IGD init in case of -ENODEV
In reply to Sasha LevinFrom: Fred Gao <[email protected]>
[ Upstream commit e4eccb853664de7bcf9518fb658f35e748bf1f68 ]
Bypass the IGD initialization when -ENODEV returns, that should be the case if opregion is not available for IGD or within discrete graphics device's option ROM, or host/lpc bridge is not found.
Then use of -ENODEV here means no special device resources found which needs special care for VFIO, but we still allow other normal device resource access.
--- drivers/vfio/pci/vfio_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci.c +1 -1
@@ -334,7 +334,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) pdev->vendor == PCI_VENDOR_ID_INTEL && IS_ENABLED(CONFIG_VFIO_PCI_IGD)) { ret =vfio_pci_igd_init (vdev); -if (ret) { +if (ret && ret != -ENODEV ) {pci_warn (pdev,"Failed to setup Intel IGD regions\n" ); goto disable_exit; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 33/42 i2c: mediatek: move dma reset before i2c reset
In reply to Sasha LevinFrom: Qii Wang <[email protected]>
[ Upstream commit aafced673c06b7c77040c1df42e2e965be5d0376 ]
The i2c driver default do dma reset after i2c reset, but sometimes i2c reset will trigger dma tx2rx, then apdma write data to dram which has been i2c_put_dma_safe_msg_buf(kfree). Move dma reset before i2c reset in mtk_i2c_init_hw to fix it.
--- drivers/i2c/busses/i2c-mt65xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-mt65xx.c +4 -4
@@ -389,6 +389,10 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) {u16 control_reg; +writel (I2C_DMA_HARD_RST , i2c->pdmabase +OFFSET_RST ); +udelay (50 ); +writel (I2C_DMA_CLR_FLAG , i2c->pdmabase +OFFSET_RST ); +mtk_i2c_writew (i2c,I2C_SOFT_RST ,OFFSET_SOFTRESET );/* Set ioconfig */
@@ -419,10 +423,6 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)mtk_i2c_writew (i2c, control_reg,OFFSET_CONTROL );mtk_i2c_writew (i2c,I2C_DELAY_LEN ,OFFSET_DELAY_LEN ); - -writel (I2C_DMA_HARD_RST , i2c->pdmabase +OFFSET_RST ); -udelay (50 ); -writel (I2C_DMA_CLR_FLAG , i2c->pdmabase +OFFSET_RST ); }/*
Signature · 7 lines
2.27.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Sasha Levin
maintainerPATCH 34/42 net: usb: qmi_wwan: add Telit LE910Cx 0x1230 composition
In reply to Sasha LevinFrom: Daniele Palmas <[email protected]>
[ Upstream commit 5fd8477ed8ca77e64b93d44a6dae4aa70c191396 ]
Add support for Telit LE910Cx 0x1230 composition:
0x1230: tty, adb, rmnet, audio, tty, tty, tty, tty
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1331,6 +1331,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1230, 2)}, /* Telit LE910Cx */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 35/42 amd/amdgpu: Disable VCN DPG mode for Picasso
In reply to Sasha LevinFrom: Veerabadhran Gopalakrishnan <[email protected]>
[ Upstream commit c6d2b0fbb893d5c7dda405aa0e7bcbecf1c75f98 ]
Concurrent operation of VCN and JPEG decoder in DPG mode is causing ring timeout due to power state.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -2
@@ -1144,8 +1144,7 @@ static int soc15_common_early_init(void *handle) adev->pg_flags =AMD_PG_SUPPORT_SDMA |AMD_PG_SUPPORT_MMHUB | -AMD_PG_SUPPORT_VCN | -AMD_PG_SUPPORT_VCN_DPG ; +AMD_PG_SUPPORT_VCN ; }else { adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG | AMD_CG_SUPPORT_GFX_MGLS |
Signature · 6 lines
2.27.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 36/42 kprobes: Tell lockdep about kprobe nesting
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit 645f224e7ba2f4200bf163153d384ceb0de5462e ]
Since the kprobe handlers have protection that prohibits other handlers from executing in other contexts (like if an NMI comes in while processing a kprobe, and executes the same kprobe, it will get fail with a "busy" return). Lockdep is unaware of this protection. Use lockdep's nesting api to differentiate between locks taken in INT3 context and other context to suppress the false warnings.
--- kernel/kprobes.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
kernel/kprobes.c +21 -4
@@ -1215,7 +1215,13 @@ __acquires(hlist_lock) *head = &kretprobe_inst_table[hash]; hlist_lock =kretprobe_table_lock_ptr (hash); -raw_spin_lock_irqsave (hlist_lock, *flags); +/* +* Nested is a workaround that will soon not be needed. +* There's other protections that make sure the same lock +* is not taken on the same CPU that lockdep is unaware of. +* Differentiate when it is taken in NMI context. +*/ +raw_spin_lock_irqsave_nested (hlist_lock, *flags, !!in_nmi ()); }NOKPROBE_SYMBOL (kretprobe_hash_lock);
@@ -1224,7 +1230,13 @@ static void kretprobe_table_lock(unsigned long hash,__acquires (hlist_lock) {raw_spinlock_t *hlist_lock =kretprobe_table_lock_ptr (hash); -raw_spin_lock_irqsave (hlist_lock, *flags); +/* +* Nested is a workaround that will soon not be needed. +* There's other protections that make sure the same lock +* is not taken on the same CPU that lockdep is unaware of. +* Differentiate when it is taken in NMI context. +*/ +raw_spin_lock_irqsave_nested (hlist_lock, *flags, !!in_nmi ()); }NOKPROBE_SYMBOL (kretprobe_table_lock);
@@ -1911,7 +1923,12 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs)/* TODO: consider to only swap the RA after the last pre_handler fired */ hash =hash_ptr (current,KPROBE_HASH_BITS ); -raw_spin_lock_irqsave (&rp->lock, flags); +/* +* Nested is a workaround that will soon not be needed. +* There's other protections that make sure the same lock +* is not taken on the same CPU that lockdep is unaware of. +*/ +raw_spin_lock_irqsave_nested (&rp->lock, flags,1 );if (!hlist_empty (&rp->free_instances)) { ri =hlist_entry (rp->free_instances.first, struct kretprobe_instance, hlist);
@@ -1922,7 +1939,7 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs) ri->task = current;if (rp->entry_handler && rp->entry_handler (ri, regs)) { -raw_spin_lock_irqsave (&rp->lock, flags); +raw_spin_lock_irqsave_nested (&rp->lock, flags,1 );hlist_add_head (&ri->hlist, &rp->free_instances);raw_spin_unlock_irqrestore (&rp->lock, flags);return 0 ;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 37/42 selftests: proc: fix warning: _GNU_SOURCE redefined
In reply to Sasha LevinFrom: Tommi Rantala <[email protected]>
[ Upstream commit f3ae6c6e8a3ea49076d826c64e63ea78fbf9db43 ]
Makefile already contains -D_GNU_SOURCE, so we can remove it from the *.c files.
--- tools/testing/selftests/proc/proc-loadavg-001.c | 1 - tools/testing/selftests/proc/proc-self-syscall.c | 1 - tools/testing/selftests/proc/proc-uptime-002.c | 1 - 3 files changed, 3 deletions(-)
tools/testing/selftests/proc/proc-loadavg-001.c +0 -1
@@ -14,7 +14,6 @@* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* Test that /proc/loadavg correctly reports last pid in pid namespace. */ -#define _GNU_SOURCE#include <errno.h> #include <sched.h> #include <sys/types.h>
tools/testing/selftests/proc/proc-self-syscall.c +0 -1
@@ -13,7 +13,6 @@* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _GNU_SOURCE#include <unistd.h> #include <sys/syscall.h> #include <sys/types.h>
tools/testing/selftests/proc/proc-uptime-002.c +0 -1
@@ -15,7 +15,6 @@*/ // Test that values in /proc/uptime increment monotonically // while shifting across CPUs. -#define _GNU_SOURCE#undef NDEBUG#include <assert.h> #include <unistd.h>
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 38/42 riscv: Set text_offset correctly for M-Mode
In reply to Sasha LevinFrom: Sean Anderson <[email protected]>
[ Upstream commit 79605f1394261995c2b955c906a5a20fb27cdc84 ]
M-Mode Linux is loaded at the start of RAM, not 2MB later. Perhaps this should be calculated based on PAGE_OFFSET somehow? Even better would be to deprecate text_offset and instead introduce something absolute.
--- arch/riscv/kernel/head.S | 5 +++++ 1 file changed, 5 insertions(+)
arch/riscv/kernel/head.S +5 -0
@@ -26,12 +26,17 @@ ENTRY(_start) /* reserved */ .word 0 .balign 8 +#ifdef CONFIG_RISCV_M_MODE + /* Image load offset (0MB) from start of RAM for M-mode */ + .dword 0 +#else #if __riscv_xlen == 64 /* Image load offset(2MB) from start of RAM */ .dword 0x200000 #else /* Image load offset(4MB) from start of RAM */ .dword 0x400000 +#endif #endif /* Effective size of kernel image */ .dword _end - _start
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 39/42 i2c: sh_mobile: implement atomic transfers
In reply to Sasha LevinFrom: Ulrich Hecht <[email protected]>
[ Upstream commit a49cc1fe9d64a2dc4e19b599204f403e5d25f44b ]
Implements atomic transfers to fix reboot/shutdown on r8a7790 Lager and similar boards.
--- drivers/i2c/busses/i2c-sh_mobile.c | 86 +++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 20 deletions(-)
drivers/i2c/busses/i2c-sh_mobile.c +66 -20
@@ -129,6 +129,7 @@ struct sh_mobile_i2c_data {int sr;bool send_stop;bool stop_after_dma; +bool atomic_xfer;struct resource *res;struct dma_chan *dma_tx;
@@ -333,13 +334,15 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, enum sh_mobile_i2c_op ret =iic_rd (pd,ICDR );break ;case OP_RX_STOP :/* enable DTE interrupt, issue stop */ -iic_wr (pd,ICIC , -ICIC_DTEE |ICIC_WAITE |ICIC_ALE |ICIC_TACKE ); +if (!pd->atomic_xfer) +iic_wr (pd,ICIC , +ICIC_DTEE |ICIC_WAITE |ICIC_ALE |ICIC_TACKE );iic_wr (pd,ICCR ,ICCR_ICE |ICCR_RACK );break ;case OP_RX_STOP_DATA :/* enable DTE interrupt, read data, issue stop */ -iic_wr (pd,ICIC , -ICIC_DTEE |ICIC_WAITE |ICIC_ALE |ICIC_TACKE ); +if (!pd->atomic_xfer) +iic_wr (pd,ICIC , +ICIC_DTEE |ICIC_WAITE |ICIC_ALE |ICIC_TACKE ); ret =iic_rd (pd,ICDR );iic_wr (pd,ICCR ,ICCR_ICE |ICCR_RACK );break ;
@@ -435,7 +438,8 @@ static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id)if (wakeup) { pd->sr |=SW_DONE ; -wake_up (&pd->wait); +if (!pd->atomic_xfer) +wake_up (&pd->wait); }/* defeat write posting to avoid spurious WAIT interrupts */
@@ -587,6 +591,9 @@ static void start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg, pd->pos =-1 ; pd->sr =0 ; +if (pd->atomic_xfer) +return ; + pd->dma_buf =i2c_get_dma_safe_msg_buf (pd->msg,8 );if (pd->dma_buf)sh_mobile_i2c_xfer_dma (pd);
@@ -643,15 +650,13 @@ static int poll_busy(struct sh_mobile_i2c_data *pd)return i ?0 : -ETIMEDOUT ; } -static int sh_mobile_i2c_xfer (struct i2c_adapter *adapter, -struct i2c_msg *msgs, -int num) +static int sh_mobile_xfer (struct sh_mobile_i2c_data *pd, +struct i2c_msg *msgs,int num) { -struct sh_mobile_i2c_data *pd =i2c_get_adapdata (adapter);struct i2c_msg *msg;int err =0 ;int i; -long timeout; +long time_left;/* Wake up device and enable clock */ pm_runtime_get_sync (pd->dev);
@@ -668,15 +673,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,if (do_start)i2c_op (pd,OP_START ); -/* The interrupt handler takes care of the rest... */ - timeout =wait_event_timeout (pd->wait, - pd->sr & (ICSR_TACK |SW_DONE ), - adapter->timeout); - -/* 'stop_after_dma' tells if DMA transfer was complete */ -i2c_put_dma_safe_msg_buf (pd->dma_buf, pd->msg, pd->stop_after_dma); +if (pd->atomic_xfer) { +unsigned long j = jiffies + pd->adap.timeout; + + time_left =time_before_eq (jiffies, j); +while (time_left && + !(pd->sr & (ICSR_TACK |SW_DONE ))) { +unsigned char sr =iic_rd (pd,ICSR ); + +if (sr & (ICSR_AL |ICSR_TACK | +ICSR_WAIT |ICSR_DTE )) { +sh_mobile_i2c_isr (0 , pd); +udelay (150 ); + }else { +cpu_relax (); + } + time_left =time_before_eq (jiffies, j); + } + }else { +/* The interrupt handler takes care of the rest... */ + time_left =wait_event_timeout (pd->wait, + pd->sr & (ICSR_TACK |SW_DONE ), + pd->adap.timeout); + +/* 'stop_after_dma' tells if DMA xfer was complete */ +i2c_put_dma_safe_msg_buf (pd->dma_buf, pd->msg, + pd->stop_after_dma); + } -if (!timeout) { +if (!time_left) {dev_err (pd->dev,"Transfer request timed out\n" );if (pd->dma_direction !=DMA_NONE )sh_mobile_i2c_cleanup_dma (pd);
@@ -702,14 +727,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,return err ?: num; } +static int sh_mobile_i2c_xfer (struct i2c_adapter *adapter, +struct i2c_msg *msgs, +int num) +{ +struct sh_mobile_i2c_data *pd =i2c_get_adapdata (adapter); + + pd->atomic_xfer = false; +return sh_mobile_xfer (pd, msgs, num); +} + +static int sh_mobile_i2c_xfer_atomic (struct i2c_adapter *adapter, +struct i2c_msg *msgs, +int num) +{ +struct sh_mobile_i2c_data *pd =i2c_get_adapdata (adapter); + + pd->atomic_xfer = true; +return sh_mobile_xfer (pd, msgs, num); +} +static u32 sh_mobile_i2c_func (struct i2c_adapter *adapter) {return I2C_FUNC_I2C |I2C_FUNC_SMBUS_EMUL |I2C_FUNC_PROTOCOL_MANGLING ; }static const struct i2c_algorithm sh_mobile_i2c_algorithm = { - .functionality = sh_mobile_i2c_func, - .master_xfer = sh_mobile_i2c_xfer, + .functionality = sh_mobile_i2c_func, + .master_xfer = sh_mobile_i2c_xfer, + .master_xfer_atomic = sh_mobile_i2c_xfer_atomic, };static const struct i2c_adapter_quirks sh_mobile_i2c_quirks = {
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 40/42 tpm_tis: Disable interrupts on ThinkPad T490s
In reply to Sasha LevinFrom: Jerry Snitselaar <[email protected]>
[ Upstream commit b154ce11ead925de6a94feb3b0317fafeefa0ebc ]
There is a misconfiguration in the bios of the gpio pin used for the interrupt in the T490s. When interrupts are enabled in the tpm_tis driver code this results in an interrupt storm. This was initially reported when we attempted to enable the interrupt code in the tpm_tis driver, which previously wasn't setting a flag to enable it. Due to the reports of the interrupt storm that code was reverted and we went back to polling instead of using interrupts. Now that we know the T490s problem is a firmware issue, add code to check if the system is a T490s and disable interrupts if that is the case. This will allow us to enable interrupts for everyone else. If the user has a fixed bios they can force the enabling of interrupts with tpm_tis.interrupts=1 on the kernel command line.
--- drivers/char/tpm/tpm_tis.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis.c +27 -2
@@ -27,6 +27,7 @@#include <linux/of.h> #include <linux/of_device.h> #include <linux/kernel.h> +#include <linux/dmi.h> #include "tpm.h" #include "tpm_tis_core.h"
@@ -49,8 +50,8 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da return container_of(data, struct tpm_tis_tcg_phy, priv); } -static bool interrupts = true; -module_param (interrupts, bool,0444 ); +static int interrupts =-1 ; +module_param (interrupts, int,0444 );MODULE_PARM_DESC (interrupts,"Enable interrupts" );static bool itpm;
@@ -63,6 +64,28 @@ module_param(force, bool, 0444);MODULE_PARM_DESC (force,"Force device probe rather than using ACPI entry" );#endif +static int tpm_tis_disable_irq (const struct dmi_system_id *d) +{ +if (interrupts ==-1 ) { +pr_notice ("tpm_tis: %s detected: disabling interrupts.\n" , d->ident); + interrupts =0 ; + } + +return 0 ; +} + +static const struct dmi_system_id tpm_tis_dmi_table[] = { + { + .callback = tpm_tis_disable_irq, + .ident ="ThinkPad T490s" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), +DMI_MATCH (DMI_PRODUCT_VERSION ,"ThinkPad T490s" ), + }, + }, + {} +}; +#if defined(CONFIG_PNP ) && defined(CONFIG_ACPI )static int has_hid (struct acpi_device *dev,const char *hid) {
@@ -192,6 +215,8 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info)int irq =-1 ;int rc; +dmi_check_system (tpm_tis_dmi_table); + rc =check_acpi_tpm2 (dev);if (rc)return rc;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 41/42 vt: Disable KD_FONT_OP_COPY
In reply to Sasha LevinFrom: Daniel Vetter <[email protected]>
[ Upstream commit 3c4e0dff2095c579b142d5a0693257f1c58b4804 ]
It's buggy:
Quoted 7 lines · Minh Yuan
We recently discovered a slab-out-of-bounds read in fbcon in the latest kernel ( v5.10-rc2 for now ). The root cause of this vulnerability is that "
fbcon_do_set_font" did not handle "vc->vc_font.data" and "vc->vc_font.height" correctly, and the patch
<https://lkml.org/lkml/2020/9/27/223> forVT_RESIZEXcan't handle this issue.
Quoted 6 lines
Specifically, we use
KD_FONT_OP_SETto set a small font.data for tty6, and useKD_FONT_OP_SETagain to set a large font.height for tty1. After that, we useKD_FONT_OP_COPYto assign tty6's vc_font.data to tty1's vc_font.data in "fbcon_do_set_font", while tty1 retains the original larger height. Obviously, this will cause an out-of-bounds read, because we can access a smaller vc_font.data with a larger vc_font.height.
Further there was only one user ever.
- Android's loadfont, busybox and console-tools only ever use OP_GET and OP_SET
- fbset documentation only mentions the kernel cmdline font: option, not anything else.
- systemd used OP_COPY before release 232 published in Nov 2016
Now unfortunately the crucial report seems to have gone down with gmane, and the commit message doesn't say much. But the pull request hints at OP_COPY being broken
https://github.com/systemd/systemd/pull/3651
So in other words, this never worked, and the only project which foolishly every tried to use it, realized that rather quickly too.
Instead of trying to fix security issues here on dead code by adding missing checks, fix the entire thing by removing the functionality.
Note that systemd code using the OP_COPY function ignored the return value, so it doesn't matter what we're doing here really - just in case a lone server somewhere happens to be extremely unlucky and running an affected old version of systemd. The relevant code from font_copy_to_all_vcs() in systemd was:
/* copy font from active VT, where the font was uploaded to */ cfo.op = KD_FONT_OP_COPY; cfo.height = vcs.v_active-1; /* tty1 == index 0 */ (void) ioctl(vcfd, KDFONTOP, &cfo);
Note this just disables the ioctl, garbage collecting the now unused callbacks is left for -next.
v2: Tetsuo found the old mail, which allowed me to find it on another archive. Add the link too.
References: https://lists.freedesktop.org/archives/systemd-devel/2016-June/036935.html
References: https://github.com/systemd/systemd/pull/3651
--- drivers/tty/vt/vt.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-)
drivers/tty/vt/vt.c +2 -22
@@ -4620,27 +4620,6 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op)return rc; } -static int con_font_copy (struct vc_data *vc,struct console_font_op *op) -{ -int con = op->height; -int rc; - - -console_lock (); -if (vc->vc_mode !=KD_TEXT ) - rc = -EINVAL ; -else if (!vc->vc_sw->con_font_copy) - rc = -ENOSYS ; -else if (con <0 || !vc_cons_allocated (con)) - rc = -ENOTTY ; -else if (con == vc->vc_num)/* nothing to do */ - rc =0 ; -else - rc = vc->vc_sw->con_font_copy (vc, con); -console_unlock (); -return rc; -} -int con_font_op (struct vc_data *vc,struct console_font_op *op) {switch (op->op) {
@@ -4651,7 +4630,8 @@ int con_font_op(struct vc_data *vc, struct console_font_op *op)case KD_FONT_OP_SET_DEFAULT :return con_font_default (vc, op);case KD_FONT_OP_COPY : -return con_font_copy (vc, op); +/* was buggy and never really used */ +return -EINVAL ; }return -ENOSYS ; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 42/42 fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent
In reply to Sasha LevinFrom: Eddy Wu <[email protected]>
[ Upstream commit b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948 ]
current->group_leader->exit_signal may change during copy_process() if current->real_parent exits.
Move the assignment inside tasklist_lock to avoid the race.
--- kernel/fork.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/fork.c +5 -5
@@ -2100,14 +2100,9 @@ static __latent_entropy struct task_struct *copy_process(/* ok, now we should be set up.. */ p->pid =pid_nr (pid);if (clone_flags &CLONE_THREAD ) { - p->exit_signal =-1 ; p->group_leader = current->group_leader; p->tgid = current->tgid; }else { -if (clone_flags &CLONE_PARENT ) - p->exit_signal = current->group_leader->exit_signal; -else - p->exit_signal = args->exit_signal; p->group_leader = p; p->tgid = p->pid; }
@@ -2152,9 +2147,14 @@ static __latent_entropy struct task_struct *copy_process(if (clone_flags & (CLONE_PARENT |CLONE_THREAD )) { p->real_parent = current->real_parent; p->parent_exec_id = current->parent_exec_id; +if (clone_flags &CLONE_THREAD ) + p->exit_signal =-1 ; +else + p->exit_signal = current->group_leader->exit_signal; }else { p->real_parent = current; p->parent_exec_id = current->self_exec_id; + p->exit_signal = args->exit_signal; }klp_copy_process (p);
Signature · 1 line
2.27.0