media: ov6650: Fix control handler not freed on init error
Subsystems (41)
Sasha Levin
maintainerPATCH 65/350 tools/memory-model: Fix data race detection for unordered store and load
In reply to Sasha LevinFrom: Alan Stern <[email protected]>
[ Upstream commit daebf24a8e8c6064cba3a330db9fe9376a137d2c ]
Currently the Linux Kernel Memory Model gives an incorrect response for the following litmus test:
C plain-WWC
{}
P0(int *x)
{
WRITE_ONCE(*x, 2);
}P1(int *x, int *y)
{
int r1;
int r2;
int r3;
r1 = READ_ONCE(*x);
if (r1 == 2) {
smp_rmb();
r2 = *x;
}
smp_rmb();
r3 = READ_ONCE(*x);
WRITE_ONCE(*y, r3 - 1);
}P2(int *x, int *y)
{
int r4;
r4 = READ_ONCE(*y);
if (r4 > 0)
WRITE_ONCE(*x, 1);
}exists (x=2 /\ 1:r2=2 /\ 2:r4=1)
The memory model says that the plain read of *x in P1 races with the WRITE_ONCE(*x) in P2.
The problem is that we have a write W and a read R related by neither fre or rfe, but rather W ->coe W' ->rfe R, where W' is an intermediate write (the WRITE_ONCE() in P0). In this situation there is no particular ordering between W and R, so either a wr-vis link from W to R or an rw-xbstar link from R to W would prove that the accesses aren't concurrent.
But the LKMM only looks for a wr-vis link, which is equivalent to assuming that W must execute before R. This is not necessarily true on non-multicopy-atomic systems, as the WWC pattern demonstrates.
This patch changes the LKMM to accept either a wr-vis or a reverse rw-xbstar link as a proof of non-concurrency.
--- tools/memory-model/linux-kernel.cat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/memory-model/linux-kernel.cat +1 -1
@@ -197,7 +197,7 @@ empty (wr-incoh | rw-incoh | ww-incoh) as plain-coherence (* Actual races *) let ww-nonrace = ww-vis & ((Marked * W) | rw-xbstar) & ((W * Marked) | wr-vis) let ww-race = (pre-race & co) \ ww-nonrace -let wr-race = (pre-race & (co? ; rf)) \ wr-vis +let wr-race = (pre-race & (co? ; rf)) \ wr-vis \ rw-xbstar^-1 let rw-race = (pre-race & fr) \ rw-xbstar flag ~empty (ww-race | wr-race | rw-race) as data-race
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 128/350 spi: pxa2xx: Set controller->max_transfer_size in dma mode
In reply to Sasha LevinFrom: Daniel Vetter <[email protected]>
[ Upstream commit b2662a164f9dc48da8822e56600686d639056282 ]
In DMA mode we have a maximum transfer size, past that the driver falls back to PIO (see the check at the top of pxa2xx_spi_transfer_one). Falling back to PIO for big transfers defeats the point of a dma engine, hence set the max transfer size to inform spi clients that they need to do something smarter.
This was uncovered by the drm_mipi_dbi spi panel code, which does large spi transfers, but stopped splitting them after:
commit e143364b4c1774f68e923a5a0bb0fca28ac25888
Author: Noralf Trønnes <[email protected]> Date: Fri Jul 19 17:59:10 2019 +0200
drm/tinydrm: Remove tinydrm_spi_max_transfer_size()
After this commit the code relied on the spi core to split transfers into max dma-able blocks, which also papered over the PIO fallback issue.
Fix this by setting the overall max transfer size to the DMA limit, but only when the controller runs in DMA mode.
--- drivers/spi/spi-pxa2xx.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/spi/spi-pxa2xx.c +7 -0
@@ -1602,6 +1602,11 @@ static int pxa2xx_spi_fw_translate_cs(struct spi_controller *controller,return cs; } +static size_t pxa2xx_spi_max_dma_transfer_size (struct spi_device *spi) +{ +return MAX_DMA_LEN ; +} +static int pxa2xx_spi_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -1707,6 +1712,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) }else { controller->can_dma = pxa2xx_spi_can_dma; controller->max_dma_len =MAX_DMA_LEN ; + controller->max_transfer_size = + pxa2xx_spi_max_dma_transfer_size; } }
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 143/350 drm/nouveau: Resume hotplug interrupts earlier
In reply to Sasha LevinFrom: Lyude Paul <[email protected]>
[ Upstream commit ac0de16a38a9ec7026ca96132e3883c564497068 ]
Currently, we enable hotplug detection only after we re-enable the display. However, this is too late if we're planning on sending sideband messages during the resume process - which we'll need to do in order to reprobe the topology on resume.
So, enable hotplug events before reinitializing the display.
--- drivers/gpu/drm/nouveau/nouveau_display.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/nouveau/nouveau_display.c +11 -8
@@ -407,6 +407,17 @@ nouveau_display_init(struct drm_device *dev, bool resume, bool runtime)struct drm_connector_list_iter conn_iter;int ret; +/* +* Enable hotplug interrupts (done as early as possible, since we need +* them for MST) +*/ +drm_connector_list_iter_begin (dev, &conn_iter); +nouveau_for_each_non_mst_connector_iter (connector, &conn_iter) { +struct nouveau_connector *conn =nouveau_connector (connector); +nvif_notify_get (&conn->hpd); + } +drm_connector_list_iter_end (&conn_iter); + ret = disp->init (dev, resume, runtime);if (ret)return ret;
@@ -416,14 +427,6 @@ nouveau_display_init(struct drm_device *dev, bool resume, bool runtime)*/ drm_kms_helper_poll_enable (dev); -/* enable hotplug interrupts */ -drm_connector_list_iter_begin (dev, &conn_iter); -nouveau_for_each_non_mst_connector_iter (connector, &conn_iter) { -struct nouveau_connector *conn =nouveau_connector (connector); -nvif_notify_get (&conn->hpd); - } -drm_connector_list_iter_end (&conn_iter); -return ret; }
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 145/350 media: aspeed: set hsync and vsync polarities to normal before starting mode detection
In reply to Sasha LevinFrom: Jae Hyun Yoo <[email protected]>
[ Upstream commit 5b3f3c41c5c791c1c22cd91655e7ef4b2a1dff7c ]
Sometimes it detects a weird resolution such as 1024x287 when the actual resolution is 1024x768. To resolve such an issue, this commit adds clearing for hsync and vsync polarity register bits at the beginning of the first mode detection. This is recommended in the datasheet.
--- drivers/media/platform/aspeed-video.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/aspeed-video.c +2 -0
@@ -741,6 +741,8 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) }set_bit (VIDEO_RES_DETECT , &video->flags); +aspeed_video_update (video,VE_CTRL , +VE_CTRL_VSYNC_POL |VE_CTRL_HSYNC_POL ,0 );aspeed_video_enable_mode_detect (video); rc = wait_event_interruptible_timeout(video->wait,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 146/350 drm/nouveau: Don't grab runtime PM refs for HPD IRQs
In reply to Sasha LevinFrom: Lyude Paul <[email protected]>
[ Upstream commit 09e530657e1c982d3dbc5e4302bf9207950c3d0a ]
In order for suspend/resume reprobing to work, we need to be able to perform sideband communications during suspend/resume, along with runtime PM suspend/resume. In order to do so, we also need to make sure that nouveau doesn't bother grabbing a runtime PM reference to do so, since otherwise we'll start deadlocking runtime PM again.
Note that we weren't able to do this before, because of the DP MST helpers processing UP requests from topologies in the same context as drm_dp_mst_hpd_irq() which would have caused us to open ourselves up to receiving hotplug events and deadlocking with runtime suspend/resume. Now that those requests are handled asynchronously, this change should be completely safe.
--- drivers/gpu/drm/nouveau/nouveau_connector.c | 33 +++++++++++---------- 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +17 -16
@@ -1131,6 +1131,16 @@ nouveau_connector_hotplug(struct nvif_notify *notify)const char *name = connector->name;struct nouveau_encoder *nv_encoder;int ret; +bool plugged = (rep->mask !=NVIF_NOTIFY_CONN_V0_UNPLUG ); + +if (rep->mask &NVIF_NOTIFY_CONN_V0_IRQ ) { +NV_DEBUG (drm,"service %s\n" , name); +drm_dp_cec_irq (&nv_connector->aux); +if ((nv_encoder =find_encoder (connector,DCB_OUTPUT_DP ))) +nv50_mstm_service (nv_encoder->dp.mstm); + +return NVIF_NOTIFY_KEEP ; + } ret =pm_runtime_get (drm->dev->dev);if (ret ==0 ) {
@@ -1151,25 +1161,16 @@ nouveau_connector_hotplug(struct nvif_notify *notify)return NVIF_NOTIFY_DROP ; } -if (rep->mask &NVIF_NOTIFY_CONN_V0_IRQ ) { -NV_DEBUG (drm,"service %s\n" , name); -drm_dp_cec_irq (&nv_connector->aux); -if ((nv_encoder =find_encoder (connector,DCB_OUTPUT_DP ))) -nv50_mstm_service (nv_encoder->dp.mstm); - }else { -bool plugged = (rep->mask !=NVIF_NOTIFY_CONN_V0_UNPLUG ); - +if (!plugged) +drm_dp_cec_unset_edid (&nv_connector->aux); +NV_DEBUG (drm,"%splugged %s\n" , plugged ?"" :"un" , name); +if ((nv_encoder =find_encoder (connector,DCB_OUTPUT_DP ))) {if (!plugged) -drm_dp_cec_unset_edid (&nv_connector->aux); -NV_DEBUG (drm,"%splugged %s\n" , plugged ?"" :"un" , name); -if ((nv_encoder =find_encoder (connector,DCB_OUTPUT_DP ))) { -if (!plugged) -nv50_mstm_remove (nv_encoder->dp.mstm); - } - -drm_helper_hpd_irq_event (connector->dev); +nv50_mstm_remove (nv_encoder->dp.mstm); } +drm_helper_hpd_irq_event (connector->dev); +pm_runtime_mark_last_busy (drm->dev->dev);pm_runtime_put_autosuspend (drm->dev->dev);return NVIF_NOTIFY_KEEP ;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 152/350 media: aspeed: clear garbage interrupts
In reply to Sasha LevinFrom: Jae Hyun Yoo <[email protected]>
[ Upstream commit 65d270acb2d662c3346793663ac3a759eb4491b8 ]
CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even when these are disabled in the VE_INTERRUPT_CTRL register and eventually this behavior causes disabling irq itself like below:
[10055.108784] irq 23: nobody cared (try booting with the "irqpoll" option) [10055.115525] CPU: 0 PID: 331 Comm: swampd Tainted: G W 5.3.0-4fde000-dirty-d683e2e #1 [10055.124565] Hardware name: Generic DT based system [10055.129355] Backtrace: [10055.131854] [<80107d7c>] (dump_backtrace) from [<80107fb0>] (show_stack+0x20/0x24) [10055.139431] r7:00000017 r6:00000001 r5:00000000 r4:9d51dc00 [10055.145120] [<80107f90>] (show_stack) from [<8074bf50>] (dump_stack+0x20/0x28) [10055.152361] [<8074bf30>] (dump_stack) from [<80150ffc>] (__report_bad_irq+0x40/0xc0) [10055.160109] [<80150fbc>] (__report_bad_irq) from [<80150f2c>] (note_interrupt+0x23c/0x294) [10055.168374] r9:015b6e60 r8:00000000 r7:00000017 r6:00000001 r5:00000000 r4:9d51dc00 [10055.176136] [<80150cf0>] (note_interrupt) from [<8014df1c>] (handle_irq_event_percpu+0x88/0x98) [10055.184835] r10:7eff7910 r9:015b6e60 r8:00000000 r7:9d417600 r6:00000001 r5:00000002 [10055.192657] r4:9d51dc00 r3:00000000 [10055.196248] [<8014de94>] (handle_irq_event_percpu) from [<8014df64>] (handle_irq_event+0x38/0x4c) [10055.205113] r5:80b56d50 r4:9d51dc00 [10055.208697] [<8014df2c>] (handle_irq_event) from [<80151f1c>] (handle_level_irq+0xbc/0x12c) [10055.217037] r5:80b56d50 r4:9d51dc00 [10055.220623] [<80151e60>] (handle_level_irq) from [<8014d4b8>] (generic_handle_irq+0x30/0x44) [10055.229052] r5:80b56d50 r4:00000017 [10055.232648] [<8014d488>] (generic_handle_irq) from [<8014d524>] (__handle_domain_irq+0x58/0xb4) [10055.241356] [<8014d4cc>] (__handle_domain_irq) from [<801021e4>] (avic_handle_irq+0x68/0x70) [10055.249797] r9:015b6e60 r8:00c5387d r7:00c5387d r6:ffffffff r5:9dd33fb0 r4:9d402380 [10055.257539] [<8010217c>] (avic_handle_irq) from [<80101e34>] (__irq_usr+0x54/0x80) [10055.265105] Exception stack(0x9dd33fb0 to 0x9dd33ff8) [10055.270152] 3fa0: 015d0530 00000000 00000000 015d0538 [10055.278328] 3fc0: 015d0530 015b6e60 00000000 00000000 0052c5d0 015b6e60 7eff7910 7eff7918 [10055.286496] 3fe0: 76ce5614 7eff7908 0050e2f4 76a3a08c 20000010 ffffffff [10055.293104] r5:20000010 r4:76a3a08c [10055.296673] handlers: [10055.298967] [<79f218a5>] irq_default_primary_handler threaded [<1de88514>] aspeed_video_irq [10055.307344] Disabling IRQ #23
To fix this issue, this commit makes the interrupt handler clear these garbage interrupts. This driver enables and uses only COMP_COMPLETE interrupt instead for frame handling.
--- drivers/media/platform/aspeed-video.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/media/platform/aspeed-video.c +10 -0
@@ -606,6 +606,16 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg)aspeed_video_start_frame (video); } +/* +* CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even when these +* are disabled in the VE_INTERRUPT_CTRL register so clear them to +* prevent unnecessary interrupt calls. +*/ +if (sts &VE_INTERRUPT_CAPTURE_COMPLETE ) + sts &= ~VE_INTERRUPT_CAPTURE_COMPLETE ; +if (sts &VE_INTERRUPT_FRAME_COMPLETE ) + sts &= ~VE_INTERRUPT_FRAME_COMPLETE ; +return sts ?IRQ_NONE :IRQ_HANDLED ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 154/350 md: no longer compare spare disk superblock events in super_load
In reply to Sasha LevinFrom: Yufen Yu <[email protected]>
[ Upstream commit 6a5cb53aaa4ef515ddeffa04ce18b771121127b4 ]
We have a test case as follow:
mdadm -CR /dev/md1 -l 1 -n 4 /dev/sd[a-d] \ --assume-clean --bitmap=internal
mdadm -S /dev/md1
mdadm -A /dev/md1 /dev/sd[b-c] --run --force
mdadm --zero /dev/sda mdadm /dev/md1 -a /dev/sda
echo offline > /sys/block/sdc/device/state
echo offline > /sys/block/sdb/device/state
sleep 5
mdadm -S /dev/md1
echo running > /sys/block/sdb/device/state echo running > /sys/block/sdc/device/state mdadm -A /dev/md1 /dev/sd[a-c] --run --force
When we readd /dev/sda to the array, it started to do recovery. After offline the other two disks in md1, the recovery have been interrupted and superblock update info cannot be written to the offline disks. While the spare disk (/dev/sda) can continue to update superblock info.
After stopping the array and assemble it, we found the array run fail, with the follow kernel message:
[ 172.986064] md: kicking non-fresh sdb from array! [ 173.004210] md: kicking non-fresh sdc from array! [ 173.022383] md/raid1:md1: active with 0 out of 4 mirrors [ 173.022406] md1: failed to create bitmap (-5) [ 173.023466] md: md1 stopped.
Since both sdb and sdc have the value of 'sb->events' smaller than that in sda, they have been kicked from the array. However, the only remained disk sda is in 'spare' state before stop and it cannot be added to conf->mirrors[] array. In the end, raid array assemble and run fail.
In fact, we can use the older disk sdb or sdc to assemble the array. That means we should not choose the 'spare' disk as the fresh disk in analyze_sbs().
To fix the problem, we do not compare superblock events when it is a spare disk, as same as validate_super.
--- drivers/md/md.c | 57 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 6 deletions(-)
drivers/md/md.c +51 -6
@@ -1149,7 +1149,15 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor rdev->desc_nr = sb->this_disk.number;if (!refdev) { - ret =1 ; +/* +* Insist on good event counter while assembling, except +* for spares (which don't need an event count) +*/ +if (sb->disks[rdev->desc_nr].state & ( + (1 <<MD_DISK_SYNC ) | (1 <<MD_DISK_ACTIVE ))) + ret =1 ; +else + ret =0 ; }else {__u64 ev1, ev2;mdp_super_t *refsb =page_address (refdev->sb_page);
@@ -1165,7 +1173,14 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor } ev1 =md_event (sb); ev2 =md_event (refsb); -if (ev1 > ev2) + +/* +* Insist on good event counter while assembling, except +* for spares (which don't need an event count) +*/ +if (sb->disks[rdev->desc_nr].state & ( + (1 <<MD_DISK_SYNC ) | (1 <<MD_DISK_ACTIVE )) && + (ev1 > ev2)) ret =1 ;else ret =0 ;
@@ -1525,6 +1540,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_sector_t sectors;char b[BDEVNAME_SIZE ], b2[BDEVNAME_SIZE ];int bmask; +__u64 role;/* * Calculate the position of the superblock in 512byte sectors.
@@ -1658,8 +1674,20 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ sb->level != 0)return -EINVAL ; + role =le16_to_cpu (sb->dev_roles[rdev->desc_nr]); +if (!refdev) { - ret =1 ; +/* +* Insist of good event counter while assembling, except for +* spares (which don't need an event count) +*/ +if (rdev->desc_nr >=0 && + rdev->desc_nr <le32_to_cpu (sb->max_dev) && + (role <MD_DISK_ROLE_MAX || + role ==MD_DISK_ROLE_JOURNAL )) + ret =1 ; +else + ret =0 ; }else {__u64 ev1, ev2;struct mdp_superblock_1 *refsb =page_address (refdev->sb_page);
@@ -1676,7 +1704,14 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ ev1 =le64_to_cpu (sb->events); ev2 =le64_to_cpu (refsb->events); -if (ev1 > ev2) +/* +* Insist of good event counter while assembling, except for +* spares (which don't need an event count) +*/ +if (rdev->desc_nr >=0 && + rdev->desc_nr <le32_to_cpu (sb->max_dev) && + (role <MD_DISK_ROLE_MAX || + role ==MD_DISK_ROLE_JOURNAL ) && ev1 > ev2) ret =1 ;else ret =0 ;
@@ -3597,7 +3632,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe* Check a full RAID array for plausibility */ -static void analyze_sbs (struct mddev *mddev) +static int analyze_sbs (struct mddev *mddev) {int i;struct md_rdev *rdev, *freshest, *tmp;
@@ -3618,6 +3653,12 @@ static void analyze_sbs(struct mddev *mddev)md_kick_rdev_from_array (rdev); } +/* Cannot find a valid fresh disk */ +if (!freshest) { +pr_warn ("md: cannot find a valid disk\n" ); +return -EINVAL ; + } + super_types[mddev->major_version].validate_super (mddev, freshest);
@@ -3652,6 +3693,8 @@ static void analyze_sbs(struct mddev *mddev)clear_bit (In_sync, &rdev->flags); } } + +return 0 ; }/* Read a fixed-point number.
@@ -5570,7 +5613,9 @@ int md_run(struct mddev *mddev)if (!mddev->raid_disks) {if (!mddev->persistent)return -EINVAL ; -analyze_sbs (mddev); + err =analyze_sbs (mddev); +if (err) +return -EINVAL ; }if (mddev->level !=LEVEL_NONE )
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 156/350 md/bitmap: avoid race window between md_bitmap_resize and bitmap_file_clear_bit
In reply to Sasha LevinFrom: Guoqing Jiang <[email protected]>
[ Upstream commit fadcbd2901a0f7c8721f3bdb69eac95c272dc8ed ]
We need to move "spin_lock_irq(&bitmap->counts.lock)" before unmap previous storage, otherwise panic like belows could happen as follows.
[ 902.353802] sdl: detected capacity change from 1077936128 to 3221225472 [ 902.616948] general protection fault: 0000 [#1] SMP [snip] [ 902.618588] CPU: 12 PID: 33698 Comm: md0_raid1 Tainted: G O 4.14.144-1-pserver #4.14.144-1.1~deb10 [ 902.618870] Hardware name: Supermicro SBA-7142G-T4/BHQGE, BIOS 3.00 10/24/2012 [ 902.619120] task: ffff9ae1860fc600 task.stack: ffffb52e4c704000 [ 902.619301] RIP: 0010:bitmap_file_clear_bit+0x90/0xd0 [md_mod] [ 902.619464] RSP: 0018:ffffb52e4c707d28 EFLAGS: 00010087 [ 902.619626] RAX: ffe8008b0d061000 RBX: ffff9ad078c87300 RCX: 0000000000000000 [ 902.619792] RDX: ffff9ad986341868 RSI: 0000000000000803 RDI: ffff9ad078c87300 [ 902.619986] RBP: ffff9ad0ed7a8000 R08: 0000000000000000 R09: 0000000000000000 [ 902.620154] R10: ffffb52e4c707ec0 R11: ffff9ad987d1ed44 R12: ffff9ad0ed7a8360 [ 902.620320] R13: 0000000000000003 R14: 0000000000060000 R15: 0000000000000800 [ 902.620487] FS: 0000000000000000(0000) GS:ffff9ad987d00000(0000) knlGS:0000000000000000 [ 902.620738] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 902.620901] CR2: 000055ff12aecec0 CR3: 0000001005207000 CR4: 00000000000406e0 [ 902.621068] Call Trace: [ 902.621256] bitmap_daemon_work+0x2dd/0x360 [md_mod] [ 902.621429] ? find_pers+0x70/0x70 [md_mod] [ 902.621597] md_check_recovery+0x51/0x540 [md_mod] [ 902.621762] raid1d+0x5c/0xeb0 [raid1] [ 902.621939] ? try_to_del_timer_sync+0x4d/0x80 [ 902.622102] ? del_timer_sync+0x35/0x40 [ 902.622265] ? schedule_timeout+0x177/0x360 [ 902.622453] ? call_timer_fn+0x130/0x130 [ 902.622623] ? find_pers+0x70/0x70 [md_mod] [ 902.622794] ? md_thread+0x94/0x150 [md_mod] [ 902.622959] md_thread+0x94/0x150 [md_mod] [ 902.623121] ? wait_woken+0x80/0x80 [ 902.623280] kthread+0x119/0x130 [ 902.623437] ? kthread_create_on_node+0x60/0x60 [ 902.623600] ret_from_fork+0x22/0x40 [ 902.624225] RIP: bitmap_file_clear_bit+0x90/0xd0 [md_mod] RSP: ffffb52e4c707d28
Because mdadm was running on another cpu to do resize, so bitmap_resize was called to replace bitmap as below shows.
PID: 38801 TASK: ffff9ad074a90e00 CPU: 0 COMMAND: "mdadm"
[exception RIP: queued_spin_lock_slowpath+56]
[snip]
-- <NMI exception stack> --
#5 [ffffb52e60f17c58] queued_spin_lock_slowpath at ffffffff9c0b27b8 #6 [ffffb52e60f17c58] bitmap_resize at ffffffffc0399877 [md_mod] #7 [ffffb52e60f17d30] raid1_resize at ffffffffc0285bf9 [raid1] #8 [ffffb52e60f17d50] update_size at ffffffffc038a31a [md_mod] #9 [ffffb52e60f17d70] md_ioctl at ffffffffc0395ca4 [md_mod]
And the procedure to keep resize bitmap safe is allocate new storage space, then quiesce, copy bits, replace bitmap, and re-start.
However the daemon (bitmap_daemon_work) could happen even the array is quiesced, which means when bitmap_file_clear_bit is triggered by raid1d, then it thinks it should be fine to access store->filemap since counts->lock is held, but resize could change the storage without the protection of the lock.
--- drivers/md/md-bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md-bitmap.c +1 -1
@@ -2139,6 +2139,7 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks,memcpy (page_address (store.sb_page),page_address (bitmap->storage.sb_page),sizeof (bitmap_super_t)); +spin_lock_irq (&bitmap->counts.lock);md_bitmap_file_unmap (&bitmap->storage); bitmap->storage = store;
@@ -2154,7 +2155,6 @@ int md_bitmap_resize(struct bitmap *bitmap, sector_t blocks, blocks =min (old_counts.chunks << old_counts.chunkshift, chunks << chunkshift); -spin_lock_irq (&bitmap->counts.lock);/* For cluster raid, need to pre-allocate bitmap */ if (mddev_is_clustered (bitmap->mddev)) {unsigned long page;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 161/350 i40e: initialize ITRN registers with correct values
In reply to Sasha LevinFrom: Nicholas Nunley <[email protected]>
[ Upstream commit 998e5166e604fd37afe94352f7b8c2d816b11049 ]
Since commit 92418fb14750 ("i40e/i40evf: Use usec value instead of reg value for ITR defines") the driver tracks the interrupt throttling intervals in single usec units, although the actual ITRN/ITR0 registers are programmed in 2 usec units. Most register programming flows in the driver correctly handle the conversion, although it is currently not applied when the registers are initialized to their default values. Most of the time this doesn't present a problem since the default values are usually immediately overwritten through the standard adaptive throttling mechanism, or updated manually by the user, but if adaptive throttling is disabled and the interval values are left alone then the incorrect value will persist.
Since the intended default interval of 50 usecs (vs. 100 usecs as programmed) performs better for most traffic workloads, this can lead to performance regressions.
This patch adds the correct conversion when writing the initial values to the ITRN registers.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +5 -5
@@ -3534,14 +3534,14 @@ static void i40e_vsi_configure_msix(struct i40e_vsi *vsi) q_vector->rx.target_itr =ITR_TO_REG (vsi->rx_rings[i]->itr_setting);wr32 (hw,I40E_PFINT_ITRN (I40E_RX_ITR , vector -1 ), - q_vector->rx.target_itr); + q_vector->rx.target_itr >>1 ); q_vector->rx.current_itr = q_vector->rx.target_itr; q_vector->tx.next_update = jiffies +1 ; q_vector->tx.target_itr =ITR_TO_REG (vsi->tx_rings[i]->itr_setting);wr32 (hw,I40E_PFINT_ITRN (I40E_TX_ITR , vector -1 ), - q_vector->tx.target_itr); + q_vector->tx.target_itr >>1 ); q_vector->tx.current_itr = q_vector->tx.target_itr; wr32(hw, I40E_PFINT_RATEN(vector - 1),
@@ -3646,11 +3646,11 @@ static void i40e_configure_msi_and_legacy(struct i40e_vsi *vsi)/* set the ITR configuration */ q_vector->rx.next_update = jiffies +1 ; q_vector->rx.target_itr =ITR_TO_REG (vsi->rx_rings[0 ]->itr_setting); -wr32 (hw,I40E_PFINT_ITR0 (I40E_RX_ITR ), q_vector->rx.target_itr); +wr32 (hw,I40E_PFINT_ITR0 (I40E_RX_ITR ), q_vector->rx.target_itr >>1 ); q_vector->rx.current_itr = q_vector->rx.target_itr; q_vector->tx.next_update = jiffies +1 ; q_vector->tx.target_itr =ITR_TO_REG (vsi->tx_rings[0 ]->itr_setting); -wr32 (hw,I40E_PFINT_ITR0 (I40E_TX_ITR ), q_vector->tx.target_itr); +wr32 (hw,I40E_PFINT_ITR0 (I40E_TX_ITR ), q_vector->tx.target_itr >>1 ); q_vector->tx.current_itr = q_vector->tx.target_itr;i40e_enable_misc_int_causes (pf);
@@ -11396,7 +11396,7 @@ static int i40e_setup_misc_vector(struct i40e_pf *pf)/* associate no queues to the misc vector */ wr32 (hw,I40E_PFINT_LNKLST0 ,I40E_QUEUE_END_OF_LIST ); -wr32 (hw,I40E_PFINT_ITR0 (I40E_RX_ITR ),I40E_ITR_8K ); +wr32 (hw,I40E_PFINT_ITR0 (I40E_RX_ITR ),I40E_ITR_8K >>1 );i40e_flush (hw);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 163/350 i40e: Wrong 'Advertised FEC modes' after set FEC to AUTO
In reply to Sasha LevinFrom: Jaroslaw Gawin <[email protected]>
[ Upstream commit e42b7e9cefca9dd008cbafffca97285cf264f72d ]
Fix display of parameters "Configured FEC encodings:" and "Advertised FEC modes:" in ethtool. Implemented by setting proper FEC bits in ?advertising? bitmask of link_modes struct and ?fec? bitmask in ethtool_fecparam struct. Without this patch wrong FEC settings can be shown.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 13 ++++++-- .../net/ethernet/intel/i40e/i40e_ethtool.c | 32 +++++++++---------- 2 files changed, 26 insertions(+), 19 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +10 -3
@@ -2571,9 +2571,16 @@ noinline_for_stack i40e_status i40e_update_link_info(struct i40e_hw *hw)if (status)return status; - hw->phy.link_info.req_fec_info = - abilities.fec_cfg_curr_mod_ext_info & - (I40E_AQ_REQUEST_FEC_KR |I40E_AQ_REQUEST_FEC_RS ); +if (abilities.fec_cfg_curr_mod_ext_info & +I40E_AQ_ENABLE_FEC_AUTO ) + hw->phy.link_info.req_fec_info = + (I40E_AQ_REQUEST_FEC_KR | +I40E_AQ_REQUEST_FEC_RS ); +else + hw->phy.link_info.req_fec_info = + abilities.fec_cfg_curr_mod_ext_info & + (I40E_AQ_REQUEST_FEC_KR | +I40E_AQ_REQUEST_FEC_RS );memcpy (hw->phy.link_info.module_type, &abilities.module_type,sizeof (hw->phy.link_info.module_type));
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +16 -16
@@ -722,7 +722,14 @@ static void i40e_get_settings_link_up_fec(u8 req_fec_info,ethtool_link_ksettings_add_link_mode (ks, supported,FEC_RS );ethtool_link_ksettings_add_link_mode (ks, supported,FEC_BASER ); -if (I40E_AQ_SET_FEC_REQUEST_RS & req_fec_info) { +if ((I40E_AQ_SET_FEC_REQUEST_RS & req_fec_info) && + (I40E_AQ_SET_FEC_REQUEST_KR & req_fec_info)) { +ethtool_link_ksettings_add_link_mode (ks, advertising, +FEC_NONE ); +ethtool_link_ksettings_add_link_mode (ks, advertising, +FEC_BASER ); +ethtool_link_ksettings_add_link_mode (ks, advertising,FEC_RS ); + }else if (I40E_AQ_SET_FEC_REQUEST_RS & req_fec_info) {ethtool_link_ksettings_add_link_mode (ks, advertising,FEC_RS ); }else if (I40E_AQ_SET_FEC_REQUEST_KR & req_fec_info) { ethtool_link_ksettings_add_link_mode(ks, advertising,
@@ -730,12 +737,6 @@ static void i40e_get_settings_link_up_fec(u8 req_fec_info, }else {ethtool_link_ksettings_add_link_mode (ks, advertising,FEC_NONE ); -if (I40E_AQ_SET_FEC_AUTO & req_fec_info) { -ethtool_link_ksettings_add_link_mode (ks, advertising, -FEC_RS ); -ethtool_link_ksettings_add_link_mode (ks, advertising, -FEC_BASER ); - } } }
@@ -1437,6 +1438,7 @@ static int i40e_get_fec_param(struct net_device *netdev,struct i40e_hw *hw = &pf->hw;i40e_status status =0 ;int err =0 ; +u8 fec_cfg;/* Get the current phy config */ memset (&abilities,0 ,sizeof (abilities));
@@ -1448,18 +1450,16 @@ static int i40e_get_fec_param(struct net_device *netdev, } fecparam->fec =0 ; -if (abilities.fec_cfg_curr_mod_ext_info &I40E_AQ_SET_FEC_AUTO ) + fec_cfg = abilities.fec_cfg_curr_mod_ext_info; +if (fec_cfg &I40E_AQ_SET_FEC_AUTO ) fecparam->fec |=ETHTOOL_FEC_AUTO ; -if ((abilities.fec_cfg_curr_mod_ext_info & -I40E_AQ_SET_FEC_REQUEST_RS ) || - (abilities.fec_cfg_curr_mod_ext_info & -I40E_AQ_SET_FEC_ABILITY_RS )) +else if (fec_cfg & (I40E_AQ_SET_FEC_REQUEST_RS | +I40E_AQ_SET_FEC_ABILITY_RS )) fecparam->fec |=ETHTOOL_FEC_RS ; -if ((abilities.fec_cfg_curr_mod_ext_info & -I40E_AQ_SET_FEC_REQUEST_KR ) || - (abilities.fec_cfg_curr_mod_ext_info &I40E_AQ_SET_FEC_ABILITY_KR )) +else if (fec_cfg & (I40E_AQ_SET_FEC_REQUEST_KR | +I40E_AQ_SET_FEC_ABILITY_KR )) fecparam->fec |=ETHTOOL_FEC_BASER ; -if (abilities.fec_cfg_curr_mod_ext_info ==0 ) +if (fec_cfg ==0 ) fecparam->fec |=ETHTOOL_FEC_OFF ;if (hw->phy.link_info.fec_info &I40E_AQ_CONFIG_FEC_KR_ENA )
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 165/350 drm/tegra: sor: Use correct SOR index on Tegra210
In reply to Sasha LevinFrom: Thierry Reding <[email protected]>
[ Upstream commit 24e64f86da40e68c5f58af08796110f147b12193 ]
The device tree bindings for the Tegra210 SOR don't require the controller instance to be defined, since the instance can be derived from the compatible string. The index is never used on Tegra210, so we got away with it not getting set. However, subsequent patches will change that, so make sure the proper index is used.
--- drivers/gpu/drm/tegra/sor.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/tegra/sor.c +5 -0
@@ -3200,6 +3200,11 @@ static int tegra_sor_parse_dt(struct tegra_sor *sor)* earlier */ sor->pad =TEGRA_IO_PAD_HDMI_DP0 + sor->index; + }else { +if (sor->soc->supports_edp) + sor->index =0 ; +else + sor->index =1 ; } err =of_property_read_u32_array (np,"nvidia,xbar-cfg" , xbar_cfg,5 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 168/350 spi: sprd: adi: Add missing lock protection when rebooting
In reply to Sasha LevinFrom: Lingling Xu <[email protected]>
[ Upstream commit 91ea1d70607e374b014b4b9bea771ce661f9f64b ]
When rebooting the system, we should lock the watchdog after configuration to make sure the watchdog can reboot the system successfully.
--- drivers/spi/spi-sprd-adi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-sprd-adi.c +3 -0
@@ -393,6 +393,9 @@ static int sprd_adi_restart_handler(struct notifier_block *this, val |=BIT_WDG_RUN |BIT_WDG_RST ;sprd_adi_write (sadi, sadi->slave_pbase +REG_WDG_CTRL , val); +/* Lock the watchdog */ +sprd_adi_write (sadi, sadi->slave_pbase +REG_WDG_LOCK , ~WDG_UNLOCK_KEY ); +mdelay (1000 );dev_emerg (sadi->dev,"Unable to restart system\n" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 176/350 gpu: host1x: Allocate gather copy for host1x
In reply to Sasha LevinFrom: Thierry Reding <[email protected]>
[ Upstream commit b78e70c04c149299bd210759d7c7af7c86b89ca8 ]
Currently when the gather buffers are copied, they are copied to a buffer that is allocated for the host1x client that wants to execute the command streams in the buffers. However, the gather buffers will be read by the host1x device, which causes SMMU faults if the DMA API is backed by an IOMMU.
Fix this by allocating the gather buffer copy for the host1x device, which makes sure that it will be mapped into the host1x's IOVA space if the DMA API is backed by an IOMMU.
--- drivers/gpu/host1x/job.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/host1x/job.c +6 -5
@@ -436,7 +436,8 @@ static int validate(struct host1x_firewall *fw, struct host1x_job_gather *g)return err; } -static inline int copy_gathers (struct host1x_job *job,struct device *dev) +static inline int copy_gathers (struct device *host,struct host1x_job *job, +struct device *dev) {struct host1x_firewall fw;size_t size =0 ;
@@ -459,12 +460,12 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev)* Try a non-blocking allocation from a higher priority pools first, * as awaiting for the allocation here is a major performance hit. */ - job->gather_copy_mapped =dma_alloc_wc (dev, size, &job->gather_copy, + job->gather_copy_mapped =dma_alloc_wc (host, size, &job->gather_copy,GFP_NOWAIT );/* the higher priority allocation failed, try the generic-blocking */ if (!job->gather_copy_mapped) - job->gather_copy_mapped =dma_alloc_wc (dev, size, + job->gather_copy_mapped =dma_alloc_wc (host, size, &job->gather_copy,GFP_KERNEL );if (!job->gather_copy_mapped)
@@ -512,7 +513,7 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) goto out;if (IS_ENABLED (CONFIG_TEGRA_HOST1X_FIREWALL )) { - err =copy_gathers (job, dev); + err =copy_gathers (host->dev, job, dev);if (err) goto out; }
@@ -573,7 +574,7 @@ void host1x_job_unpin(struct host1x_job *job) job->num_unpins =0 ;if (job->gather_copy_size) -dma_free_wc (job->channel->dev, job->gather_copy_size, +dma_free_wc (host->dev, job->gather_copy_size, job->gather_copy_mapped, job->gather_copy); }EXPORT_SYMBOL (host1x_job_unpin);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 182/350 s390/time: ensure get_clock_monotonic() returns monotonic values
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 011620688a71f2f1fe9901dbc2479a7c01053196 ]
The current implementation of get_clock_monotonic() leaves it up to the caller to call the function with preemption disabled. The only core kernel caller (sched_clock) however does not disable preemption.
In order to make sure that all callers of this function see monotonic values handle disabling preemption within the function itself.
--- arch/s390/include/asm/timex.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/s390/include/asm/timex.h +10 -6
@@ -10,8 +10,9 @@#ifndef _ASM_S390_TIMEX_H#define _ASM_S390_TIMEX_H -#include <asm/lowcore.h> +#include <linux/preempt.h> #include <linux/time64.h> +#include <asm/lowcore.h> /* The value of the TOD clock for 1.1.1970. */ #define TOD_UNIX_EPOCH 0x7d91048bca000000ULL
@@ -186,15 +187,18 @@ extern unsigned char tod_clock_base[16] __aligned(8);/** * get_clock_monotonic - returns current time in clock rate units * -* The caller must ensure that preemption is disabled. * The clock and tod_clock_base get changed via stop_machine. -* Therefore preemption must be disabled when calling this -* function, otherwise the returned value is not guaranteed to -* be monotonic. +* Therefore preemption must be disabled, otherwise the returned +* value is not guaranteed to be monotonic. */ static inline unsigned long long get_tod_clock_monotonic (void ) { -return get_tod_clock () - *(unsigned long long *) &tod_clock_base[1 ]; +unsigned long long tod; + +preempt_disable (); + tod =get_tod_clock () - *(unsigned long long *) &tod_clock_base[1 ]; +preempt_enable (); +return tod; }/**
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 183/350 s390: add error handling to perf_callchain_kernel
In reply to Sasha LevinFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit effb83ccc83a97dbbe5214f4c443522719f05f3a ]
perf_callchain_kernel stops neither when it encounters a garbage address, nor when it runs out of space. Fix both issues using x86 version as an inspiration.
--- arch/s390/kernel/perf_event.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/s390/kernel/perf_event.c +6 -2
@@ -224,9 +224,13 @@ void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) {struct unwind_state state; +unsigned long addr; -unwind_for_each_frame (&state, current, regs,0 ) -perf_callchain_store (entry, state.ip); +unwind_for_each_frame (&state, current, regs,0 ) { + addr =unwind_get_return_address (&state); +if (!addr ||perf_callchain_store (entry, addr)) +return ; + } }/* Perf definitions for PMU event attributes in sysfs */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 184/350 s390/mm: add mm_pxd_folded() checks to pxd_free()
In reply to Sasha LevinFrom: Gerald Schaefer <[email protected]>
[ Upstream commit 2416cefc504ba8ae9b17e3e6b40afc72708f96be ]
Unlike pxd_free_tlb(), the pxd_free() functions do not check for folded page tables. This is not an issue so far, as those functions will actually never be called, since no code will reach them when page tables are folded.
In order to avoid future issues, and to make the s390 code more similar to other architectures, add mm_pxd_folded() checks, similar to how it is done in pxd_free_tlb().
This was found by testing a patch from from Anshuman Khandual, which is currently discussed on LKML ("mm/debug: Add tests validating architecture page table helpers").
--- arch/s390/include/asm/pgalloc.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
arch/s390/include/asm/pgalloc.h +14 -2
@@ -56,7 +56,12 @@ static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long address)crst_table_init (table, _REGION2_ENTRY_EMPTY);return (p4d_t *) table; } -#define p4d_free (mm, p4d) crst_table_free(mm, (unsigned long *) p4d) + +static inline void p4d_free (struct mm_struct *mm,p4d_t *p4d) +{ +if (!mm_p4d_folded (mm)) +crst_table_free (mm, (unsigned long *) p4d); +}static inline pud_t *pud_alloc_one (struct mm_struct *mm,unsigned long address) {
@@ -65,7 +70,12 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)crst_table_init (table, _REGION3_ENTRY_EMPTY);return (pud_t *) table; } -#define pud_free (mm, pud) crst_table_free(mm, (unsigned long *) pud) + +static inline void pud_free (struct mm_struct *mm,pud_t *pud) +{ +if (!mm_pud_folded (mm)) +crst_table_free (mm, (unsigned long *) pud); +}static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long vmaddr) {
@@ -83,6 +93,8 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) { +if (mm_pmd_folded (mm)) +return ;pgtable_pmd_page_dtor (virt_to_page (pmd));crst_table_free (mm, (unsigned long *) pmd); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 190/350 pinctrl: sh-pfc: sh7734: Fix duplicate TCLK1_B
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 884caadad128efad8e00c1cdc3177bc8912ee8ec ]
The definitions for bit field [19:18] of the Peripheral Function Select Register 3 were accidentally copied from bit field [20], leading to duplicates for the TCLK1_B function, and missing TCLK0, CAN_CLK_B, and ET0_ETXD4 functions.
Fix this by adding the missing GPIO_FN_CAN_CLK_B and GPIO_FN_ET0_ETXD4 enum values, and correcting the functions.
--- arch/sh/include/cpu-sh4/cpu/sh7734.h | 2 +- drivers/pinctrl/sh-pfc/pfc-sh7734.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/sh/include/cpu-sh4/cpu/sh7734.h +1 -1
@@ -134,7 +134,7 @@ enum {GPIO_FN_EX_WAIT1 ,GPIO_FN_SD1_DAT0_A ,GPIO_FN_DREQ2 ,GPIO_FN_CAN1_TX_C ,GPIO_FN_ET0_LINK_C ,GPIO_FN_ET0_ETXD5_A ,GPIO_FN_EX_WAIT0 ,GPIO_FN_TCLK1_B , -GPIO_FN_RD_WR ,GPIO_FN_TCLK0 , +GPIO_FN_RD_WR ,GPIO_FN_TCLK0 ,GPIO_FN_CAN_CLK_B ,GPIO_FN_ET0_ETXD4 ,GPIO_FN_EX_CS5 ,GPIO_FN_SD1_CMD_A ,GPIO_FN_ATADIR ,GPIO_FN_QSSL_B ,GPIO_FN_ET0_ETXD3_A , GPIO_FN_EX_CS4, GPIO_FN_SD1_WP_A, GPIO_FN_ATAWR, GPIO_FN_QMI_QIO1_B,
drivers/pinctrl/sh-pfc/pfc-sh7734.c +2 -2
@@ -1450,7 +1450,7 @@ static const struct pinmux_func pinmux_func_gpios[] = {GPIO_FN (ET0_ETXD2_A ),GPIO_FN (EX_CS5 ),GPIO_FN (SD1_CMD_A ),GPIO_FN (ATADIR ),GPIO_FN (QSSL_B ),GPIO_FN (ET0_ETXD3_A ), -GPIO_FN (RD_WR ),GPIO_FN (TCLK1_B ), +GPIO_FN (RD_WR ),GPIO_FN (TCLK0 ),GPIO_FN (CAN_CLK_B ),GPIO_FN (ET0_ETXD4 ),GPIO_FN (EX_WAIT0 ),GPIO_FN (TCLK1_B ),GPIO_FN (EX_WAIT1 ),GPIO_FN (SD1_DAT0_A ),GPIO_FN (DREQ2 ), GPIO_FN(CAN1_TX_C), GPIO_FN(ET0_LINK_C), GPIO_FN(ET0_ETXD5_A),
@@ -1949,7 +1949,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {/* IP3_20 [1] */ FN_EX_WAIT0 ,FN_TCLK1_B ,/* IP3_19_18 [2] */ -FN_RD_WR ,FN_TCLK1_B ,0 ,0 , +FN_RD_WR ,FN_TCLK0 ,FN_CAN_CLK_B ,FN_ET0_ETXD4 ,/* IP3_17_15 [3] */ FN_EX_CS5 ,FN_SD1_CMD_A ,FN_ATADIR ,FN_QSSL_B , FN_ET0_ETXD3_A, 0, 0, 0,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 196/350 spi: sifive: disable clk when probe fails and remove
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
[ Upstream commit a725272bda77e61c1b4de85c7b0c875b2ea639b6 ]
The driver forgets to disable and unprepare clk when probe fails and remove.
Add the calls to fix the problem.
--- drivers/spi/spi-sifive.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/spi/spi-sifive.c +7 -4
@@ -357,14 +357,14 @@ static int sifive_spi_probe(struct platform_device *pdev)if (!cs_bits) {dev_err (&pdev->dev,"Could not auto probe CS lines\n" ); ret = -EINVAL ; - goto put_master; + goto disable_clk; } num_cs =ilog2 (cs_bits) +1 ;if (num_cs >SIFIVE_SPI_MAX_CS ) {dev_err (&pdev->dev,"Invalid number of spi slaves\n" ); ret = -EINVAL ; - goto put_master; + goto disable_clk; }/* Define our master */
@@ -393,7 +393,7 @@ static int sifive_spi_probe(struct platform_device *pdev) dev_name(&pdev->dev), spi);if (ret) {dev_err (&pdev->dev,"Unable to bind to interrupt\n" ); - goto put_master; + goto disable_clk; } dev_info(&pdev->dev, "mapped; irq=%d, cs=%d\n",
@@ -402,11 +402,13 @@ static int sifive_spi_probe(struct platform_device *pdev) ret =devm_spi_register_master (&pdev->dev, master);if (ret <0 ) {dev_err (&pdev->dev,"spi_register_master failed\n" ); - goto put_master; + goto disable_clk; }return 0 ; +disable_clk: +clk_disable_unprepare (spi->clk); put_master:spi_master_put (master);
@@ -420,6 +422,7 @@ static int sifive_spi_remove(struct platform_device *pdev)/* Disable all the interrupts just in case */ sifive_spi_write (spi,SIFIVE_SPI_REG_IE ,0 ); +clk_disable_unprepare (spi->clk);return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 200/350 ixgbe: protect TX timestamping from API misuse
In reply to Sasha LevinFrom: Manjunath Patil <[email protected]>
[ Upstream commit 07066d9dc3d2326fbad8f7b0cb0120cff7b7dedb ]
HW timestamping can only be requested for a packet if the NIC is first setup via ioctl(SIOCSHWTSTAMP). If this step was skipped, then the ixgbe driver still allowed TX packets to request HW timestamping. In this situation, we see 'clearing Tx Timestamp hang' noise in the log.
Fix this by checking that the NIC is configured for HW TX timestamping before accepting a HW TX timestamping request.
Similar-to:
commit 26bd4e2db06b ("igb: protect TX timestamping from API misuse") commit 0a6f2f05a2f5 ("igb: Fix a test with HWTSTAMP_TX_ON")
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
@@ -8639,7 +8639,8 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ) && adapter->ptp_clock) { -if (!test_and_set_bit_lock (__IXGBE_PTP_TX_IN_PROGRESS, +if (adapter->tstamp_config.tx_type ==HWTSTAMP_TX_ON && + !test_and_set_bit_lock (__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state)) {skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ; tx_flags |=IXGBE_TX_FLAGS_TSTAMP ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 210/350 spi: dw: Fix Designware SPI loopback
In reply to Sasha LevinFrom: Thor Thayer <[email protected]>
[ Upstream commit 1403cfa69d310781f9548951c97725c67ffcf613 ]
The SPI_LOOP is set in spi->mode but not propagated to the register. A previous patch removed the bit during a cleanup.
--- drivers/spi/spi-dw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-dw.c +2 -1
@@ -308,7 +308,8 @@ static int dw_spi_transfer_one(struct spi_controller *master, cr0 = (transfer->bits_per_word -1 ) | (chip->type <<SPI_FRF_OFFSET ) | ((((spi->mode &SPI_CPOL ) ?1 :0 ) <<SPI_SCOL_OFFSET ) | - (((spi->mode &SPI_CPHA ) ?1 :0 ) <<SPI_SCPH_OFFSET )) + (((spi->mode &SPI_CPHA ) ?1 :0 ) <<SPI_SCPH_OFFSET ) | + (((spi->mode &SPI_LOOP ) ?1 :0 ) <<SPI_SRL_OFFSET )) | (chip->tmode <<SPI_TMOD_OFFSET );/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 213/350 spi: img-spfi: fix potential double release
In reply to Sasha LevinFrom: Pan Bian <[email protected]>
[ Upstream commit e9a8ba9769a0e354341bc6cc01b98aadcea1dfe9 ]
The channels spfi->tx_ch and spfi->rx_ch are not set to NULL after they are released. As a result, they will be released again, either on the error handling branch in the same function or in the corresponding remove function, i.e. img_spfi_remove(). This patch fixes the bug by setting the two members to NULL.
--- drivers/spi/spi-img-spfi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-img-spfi.c +2 -0
@@ -673,6 +673,8 @@ static int img_spfi_probe(struct platform_device *pdev)dma_release_channel (spfi->tx_ch);if (spfi->rx_ch)dma_release_channel (spfi->rx_ch); + spfi->tx_ch =NULL ; + spfi->rx_ch =NULL ;dev_warn (spfi->dev,"Failed to get DMA channels, falling back to PIO mode\n" ); }else { master->dma_tx = spfi->tx_ch;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 233/350 ice: Check for null pointer dereference when setting rings
In reply to Sasha LevinFrom: Michal Swiatkowski <[email protected]>
[ Upstream commit eb0ee8abfeb9ff4b98e8e40217b8667bfb08587a ]
Without this check rebuild vsi can lead to kernel panic.
--- drivers/net/ethernet/intel/ice/ice_main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +14 -4
@@ -3970,8 +3970,13 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi) }ice_for_each_txq (vsi, i) { - vsi->tx_rings[i]->netdev = vsi->netdev; - err =ice_setup_tx_ring (vsi->tx_rings[i]); +struct ice_ring *ring = vsi->tx_rings[i]; + +if (!ring) +return -EINVAL ; + + ring->netdev = vsi->netdev; + err =ice_setup_tx_ring (ring);if (err)break ; }
@@ -3996,8 +4001,13 @@ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi) }ice_for_each_rxq (vsi, i) { - vsi->rx_rings[i]->netdev = vsi->netdev; - err =ice_setup_rx_ring (vsi->rx_rings[i]); +struct ice_ring *ring = vsi->rx_rings[i]; + +if (!ring) +return -EINVAL ; + + ring->netdev = vsi->netdev; + err =ice_setup_rx_ring (ring);if (err)break ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 243/350 s390/bpf: Use kvcalloc for addrs array
In reply to Sasha LevinFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 166f11d11f6f70439830d09bfa5552ec1b368494 ]
A BPF program may consist of 1m instructions, which means JIT instruction-address mapping can be as large as 4m. s390 has FORCE_MAX_ZONEORDER=9 (for memory hotplug reasons), which means maximum kmalloc size is 1m. This makes it impossible to JIT programs with more than 256k instructions.
Fix by using kvcalloc, which falls back to vmalloc for larger allocations. An alternative would be to use a radix tree, but that is not supported by bpf_prog_fill_jited_linfo.
--- arch/s390/net/bpf_jit_comp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/s390/net/bpf_jit_comp.c +3 -2
@@ -23,6 +23,7 @@#include <linux/filter.h> #include <linux/init.h> #include <linux/bpf.h> +#include <linux/mm.h> #include <asm/cacheflush.h> #include <asm/dis.h> #include <asm/facility.h>
@@ -1369,7 +1370,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) }memset (&jit,0 ,sizeof (jit)); - jit.addrs =kcalloc (fp->len +1 ,sizeof (*jit.addrs),GFP_KERNEL ); + jit.addrs =kvcalloc (fp->len +1 ,sizeof (*jit.addrs),GFP_KERNEL );if (jit.addrs ==NULL ) { fp = orig_fp; goto out;
@@ -1422,7 +1423,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)if (!fp->is_func || extra_pass) {bpf_prog_fill_jited_linfo (fp, jit.addrs +1 ); free_addrs: -kfree (jit.addrs); +kvfree (jit.addrs);kfree (jit_data); fp->aux->jit_data =NULL ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 244/350 cgroup: freezer: don't change task and cgroups status unnecessarily
In reply to Sasha LevinFrom: Honglei Wang <[email protected]>
[ Upstream commit 742e8cd3e1ba6f19cad6d912f8d469df5557d0fd ]
It's not necessary to adjust the task state and revisit the state of source and destination cgroups if the cgroups are not in freeze state and the task itself is not frozen.
And in this scenario, it wakes up the task who's not supposed to be ready to run.
Don't do the unnecessary task state adjustment can help stop waking up the task without a reason.
--- kernel/cgroup/freezer.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kernel/cgroup/freezer.c +9 -0
@@ -230,6 +230,15 @@ void cgroup_freezer_migrate_task(struct task_struct *task,if (task->flags &PF_KTHREAD )return ; +/* +* It's not necessary to do changes if both of the src and dst cgroups +* are not freezing and task is not frozen. +*/ +if (!test_bit (CGRP_FREEZE , &src->flags) && + !test_bit (CGRP_FREEZE , &dst->flags) && + !task->frozen) +return ; +/* * Adjust counters of freezing and frozen tasks. * Note, that if the task is frozen, but the destination cgroup is not
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 255/350 ice: delay less
In reply to Sasha LevinFrom: Mitch Williams <[email protected]>
[ Upstream commit 88bb432a55de8ae62106305083a8bfbb23b01ad2 ]
Shorten the delay for SQ responses, but increase the number of loops. Max delay time is unchanged, but some operations complete much more quickly.
In the process, add a new define to make the delay count and delay time more explicit. Add comments to make things more explicit.
This fixes a problem with VF resets failing on with many VFs.
--- drivers/net/ethernet/intel/ice/ice_controlq.c | 2 +- drivers/net/ethernet/intel/ice/ice_controlq.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_controlq.c +1 -1
@@ -948,7 +948,7 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,if (ice_sq_done (hw, cq))break ; -mdelay (1 ); +udelay (ICE_CTL_Q_SQ_CMD_USEC ); total_delay++; }while (total_delay < cq->sq_cmd_timeout);
drivers/net/ethernet/intel/ice/ice_controlq.h +3 -2
@@ -31,8 +31,9 @@ enum ice_ctl_q { ICE_CTL_Q_MAILBOX, }; -/* Control Queue default settings */ -#define ICE_CTL_Q_SQ_CMD_TIMEOUT 250/* msecs */ +/* Control Queue timeout settings - max delay 250ms */ +#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500/* Count 2500 times */ +#define ICE_CTL_Q_SQ_CMD_USEC 100/* Check every 100usec */ struct ice_ctl_q_ring {void *dma_head;/* Virtual address to DMA head */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 264/350 spi: pxa2xx: Add missed security checks
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 5eb263ef08b5014cfc2539a838f39d2fd3531423 ]
pxa2xx_spi_init_pdata misses checks for devm_clk_get and platform_get_irq.
Add checks for them to fix the bugs.
Since ssp->clk and ssp->irq are used in probe, they are mandatory here. So we cannot use _optional() for devm_clk_get and platform_get_irq.
--- drivers/spi/spi-pxa2xx.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/spi/spi-pxa2xx.c +6 -0
@@ -1565,7 +1565,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)#endif ssp->clk =devm_clk_get (&pdev->dev,NULL ); +if (IS_ERR (ssp->clk)) +return NULL ; + ssp->irq =platform_get_irq (pdev,0 ); +if (ssp->irq <0 ) +return NULL ; + ssp->type = type; ssp->pdev = pdev; ssp->port_id =pxa2xx_spi_get_port_id (adev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 272/350 s390/disassembler: don't hide instruction addresses
In reply to Sasha LevinFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 544f1d62e3e6c6e6d17a5e56f6139208acb5ff46 ]
Due to kptr_restrict, JITted BPF code is now displayed like this:
000000000b6ed1b2: ebdff0800024 stmg %r13,%r15,128(%r15) 000000004cde2ba0: 41d0f040 la %r13,64(%r15) 00000000fbad41b0: a7fbffa0 aghi %r15,-96
Leaking kernel addresses to dmesg is not a concern in this case, because this happens only when JIT debugging is explicitly activated, which only root can do.
Use %px in this particular instance, and also to print an instruction address in show_code and PCREL (e.g. brasl) arguments in print_insn. While at present functionally equivalent to %016lx, %px is recommended by Documentation/core-api/printk-formats.rst for such cases.
--- arch/s390/kernel/dis.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
arch/s390/kernel/dis.c +7 -6
@@ -461,10 +461,11 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr) ptr +=sprintf (ptr,"%%c%i" , value); else if (operand->flags & OPERAND_VR) ptr += sprintf(ptr, "%%v%i", value); - else if (operand->flags & OPERAND_PCREL) - ptr += sprintf(ptr, "%lx", (signed int) value - + addr); - else if (operand->flags & OPERAND_SIGNED) + else if (operand->flags & OPERAND_PCREL) { +void *pcrel = (void *)((int )value + addr); + + ptr +=sprintf (ptr,"%px" , pcrel); + } else if (operand->flags & OPERAND_SIGNED) ptr += sprintf(ptr, "%i", value); else ptr += sprintf(ptr, "%u", value);
@@ -536,7 +537,7 @@ void show_code(struct pt_regs *regs)else *ptr++ =' ' ; addr = regs->psw.addr + start -32 ; - ptr +=sprintf (ptr,"%016lx: " , addr); + ptr +=sprintf (ptr,"%px: " , (void *)addr);if (start + opsize >= end)break ;for (i =0 ; i < opsize; i++)
@@ -564,7 +565,7 @@ void print_fn_code(unsigned char *code, unsigned long len) opsize =insn_length (*code);if (opsize > len)break ; - ptr +=sprintf (ptr,"%p: " , code); + ptr +=sprintf (ptr,"%px: " , code);for (i =0 ; i < opsize; i++) ptr +=sprintf (ptr,"%02x" , code[i]); *ptr++ ='\t' ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 273/350 mailbox: tegra: Fix superfluous IRQ error message
In reply to Sasha LevinFrom: Jon Hunter <[email protected]>
[ Upstream commit c745da8d4320c49e54662c0a8f7cb6b8204f44c4 ]
Commit 7723f4c5ecdb ("driver core: platform: Add an error message to platform_get_irq*()") added an error message to avoid drivers having to print an error message when IRQ lookup fails. However, there are some cases where IRQs are optional and so new optional versions of the platform_get_irq*() APIs have been added for these cases.
The IRQs for Tegra HSP module are optional because not all instances of the module have the doorbell and all of the shared interrupts. Hence, since the above commit was applied the following error messages are now seen on Tegra194 ...
ERR KERN tegra-hsp c150000.hsp: IRQ doorbell not found ERR KERN tegra-hsp c150000.hsp: IRQ shared0 not found
The Tegra HSP driver deliberately does not fail if these are not found and so fix the above errors by updating the Tegra HSP driver to use the platform_get_irq_byname_optional() API.
--- drivers/mailbox/tegra-hsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mailbox/tegra-hsp.c +2 -2
@@ -657,7 +657,7 @@ static int tegra_hsp_probe(struct platform_device *pdev) hsp->num_db = (value >> HSP_nDB_SHIFT) & HSP_nINT_MASK; hsp->num_si = (value >> HSP_nSI_SHIFT) & HSP_nINT_MASK; - err =platform_get_irq_byname (pdev,"doorbell" ); + err =platform_get_irq_byname_optional (pdev,"doorbell" );if (err >=0 ) hsp->doorbell_irq = err;
@@ -677,7 +677,7 @@ static int tegra_hsp_probe(struct platform_device *pdev)if (!name)return -ENOMEM ; - err =platform_get_irq_byname (pdev, name); + err =platform_get_irq_byname_optional (pdev, name);if (err >=0 ) { hsp->shared_irqs[i] = err; count++;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 279/350 bcache: fix static checker warning in bcache_device_free()
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit 2d8869518a525c9bce5f5268419df9dfbe3dfdeb ]
Commit cafe56359144 ("bcache: A block layer cache") leads to the following static checker warning:
./drivers/md/bcache/super.c:770 bcache_device_free()
warn: variable dereferenced before check 'd->disk' (see line 766)drivers/md/bcache/super.c
762 static void bcache_device_free(struct bcache_device *d) 763 {
764 lockdep_assert_held(&bch_register_lock);
765
766 pr_info("%s stopped", d->disk->disk_name);
^^^^^^^^^Unchecked dereference.
767
768 if (d->c)
769 bcache_device_detach(d);
770 if (d->disk && d->disk->flags & GENHD_FL_UP)
^^^^^^^
Check too late.
771 del_gendisk(d->disk);
772 if (d->disk && d->disk->queue)
773 blk_cleanup_queue(d->disk->queue);
774 if (d->disk) {
775 ida_simple_remove(&bcache_device_idx,
776 first_minor_to_idx(d->disk->first_minor));
777 put_disk(d->disk);
778 }
779It is not 100% sure that the gendisk struct of bcache device will always be there, the warning makes sense when there is problem in block core.
This patch tries to remove the static checking warning by checking d->disk to avoid NULL pointer deferences.
--- drivers/md/bcache/super.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/md/bcache/super.c +16 -8
@@ -761,20 +761,28 @@ static inline int idx_to_first_minor(int idx)static void bcache_device_free (struct bcache_device *d) { +struct gendisk *disk = d->disk; +lockdep_assert_held (&bch_register_lock); -pr_info ("%s stopped" , d->disk->disk_name); +if (disk) +pr_info ("%s stopped" , disk->disk_name); +else +pr_err ("bcache device (NULL gendisk) stopped" );if (d->c)bcache_device_detach (d); -if (d->disk && d->disk->flags &GENHD_FL_UP ) -del_gendisk (d->disk); -if (d->disk && d->disk->queue) -blk_cleanup_queue (d->disk->queue); -if (d->disk) { + +if (disk) { +if (disk->flags &GENHD_FL_UP ) +del_gendisk (disk); + +if (disk->queue) +blk_cleanup_queue (disk->queue); +ida_simple_remove (&bcache_device_idx, -first_minor_to_idx (d->disk->first_minor)); -put_disk (d->disk); +first_minor_to_idx (disk->first_minor)); +put_disk (disk); }bioset_exit (&d->bio_split);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 290/350 bcache: fix deadlock in bcache_allocator
In reply to Sasha LevinFrom: Andrea Righi <[email protected]>
[ Upstream commit 84c529aea182939e68f618ed9813740c9165c7eb ]
bcache_allocator can call the following:
bch_allocator_thread()
-> bch_prio_write()
-> bch_bucket_alloc()
-> wait on &ca->set->bucket_waitBut the wake up event on bucket_wait is supposed to come from bch_allocator_thread() itself => deadlock:
[ 1158.490744] INFO: task bcache_allocato:15861 blocked for more than 10 seconds. [ 1158.495929] Not tainted 5.3.0-050300rc3-generic #201908042232 [ 1158.500653] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 1158.504413] bcache_allocato D 0 15861 2 0x80004000 [ 1158.504419] Call Trace: [ 1158.504429] __schedule+0x2a8/0x670 [ 1158.504432] schedule+0x2d/0x90 [ 1158.504448] bch_bucket_alloc+0xe5/0x370 [bcache] [ 1158.504453] ? wait_woken+0x80/0x80 [ 1158.504466] bch_prio_write+0x1dc/0x390 [bcache] [ 1158.504476] bch_allocator_thread+0x233/0x490 [bcache] [ 1158.504491] kthread+0x121/0x140 [ 1158.504503] ? invalidate_buckets+0x890/0x890 [bcache] [ 1158.504506] ? kthread_park+0xb0/0xb0 [ 1158.504510] ret_from_fork+0x35/0x40
Fix by making the call to bch_prio_write() non-blocking, so that bch_allocator_thread() never waits on itself.
Moreover, make sure to wake up the garbage collector thread when bch_prio_write() is failing to allocate buckets.
--- drivers/md/bcache/alloc.c | 5 ++++- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/super.c | 27 +++++++++++++++++++++------ 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/md/bcache/alloc.c +4 -1
@@ -377,7 +377,10 @@ static int bch_allocator_thread(void *arg)if (!fifo_full (&ca->free_inc)) goto retry_invalidate; -bch_prio_write (ca); +if (bch_prio_write (ca, false) <0 ) { + ca->invalidate_needs_gc =1 ; +wake_up_gc (ca->set); + } } } out:
drivers/md/bcache/bcache.h +1 -1
@@ -977,7 +977,7 @@ bool bch_cached_dev_error(struct cached_dev *dc); __printf(2, 3)bool bch_cache_set_error (struct cache_set *c,const char *fmt, ...); -void bch_prio_write (struct cache *ca); +int bch_prio_write (struct cache *ca,bool wait);void bch_write_bdev_super (struct cached_dev *dc,struct closure *parent);extern struct workqueue_struct *bcache_wq;
drivers/md/bcache/super.c +21 -6
@@ -529,12 +529,29 @@ static void prio_io(struct cache *ca, uint64_t bucket, int op,closure_sync (cl); } -void bch_prio_write (struct cache *ca) +int bch_prio_write (struct cache *ca,bool wait) {int i;struct bucket *b;struct closure cl; +pr_debug ("free_prio=%zu, free_none=%zu, free_inc=%zu" , +fifo_used (&ca->free[RESERVE_PRIO ]), +fifo_used (&ca->free[RESERVE_NONE ]), +fifo_used (&ca->free_inc)); + +/* +* Pre-check if there are enough free buckets. In the non-blocking +* scenario it's better to fail early rather than starting to allocate +* buckets and do a cleanup later in case of failure. +*/ +if (!wait) { +size_t avail =fifo_used (&ca->free[RESERVE_PRIO ]) + +fifo_used (&ca->free[RESERVE_NONE ]); +if (prio_buckets (ca) > avail) +return -ENOMEM ; + } +closure_init_stack (&cl);lockdep_assert_held (&ca->set->bucket_lock);
@@ -544,9 +561,6 @@ void bch_prio_write(struct cache *ca)atomic_long_add (ca->sb.bucket_size *prio_buckets (ca), &ca->meta_sectors_written); -//pr_debug("free %zu, free_inc %zu, unused %zu", fifo_used(&ca->free), -// fifo_used(&ca->free_inc), fifo_used(&ca->unused)); -for (i =prio_buckets (ca) -1 ; i >=0 ; --i) {long bucket;struct prio_set *p = ca->disk_buckets;
@@ -564,7 +578,7 @@ void bch_prio_write(struct cache *ca) p->magic =pset_magic (&ca->sb); p->csum =bch_crc64 (&p->magic,bucket_bytes (ca) -8 ); - bucket =bch_bucket_alloc (ca,RESERVE_PRIO , true); + bucket =bch_bucket_alloc (ca,RESERVE_PRIO , wait);BUG_ON (bucket ==-1 );mutex_unlock (&ca->set->bucket_lock);
@@ -593,6 +607,7 @@ void bch_prio_write(struct cache *ca) ca->prio_last_buckets[i] = ca->prio_buckets[i]; } +return 0 ; }static void prio_read (struct cache *ca,uint64_t bucket)
@@ -1962,7 +1977,7 @@ static int run_cache_set(struct cache_set *c)mutex_lock (&c->bucket_lock);for_each_cache (ca, c, i) -bch_prio_write (ca); +bch_prio_write (ca, true);mutex_unlock (&c->bucket_lock); err ="cannot allocate new UUID bucket" ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 294/350 spi: tegra20-slink: add missed clk_unprepare
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 04358e40ba96d687c0811c21d9dede73f5244a98 ]
The driver misses calling clk_unprepare in probe failure and remove. Add the calls to fix it.
--- drivers/spi/spi-tegra20-slink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/spi/spi-tegra20-slink.c +4 -1
@@ -1073,7 +1073,7 @@ static int tegra_slink_probe(struct platform_device *pdev) ret =clk_enable (tspi->clk);if (ret <0 ) {dev_err (&pdev->dev,"Clock enable failed %d\n" , ret); - goto exit_free_master; + goto exit_clk_unprepare; } spi_irq =platform_get_irq (pdev,0 );
@@ -1146,6 +1146,8 @@ static int tegra_slink_probe(struct platform_device *pdev)free_irq (spi_irq, tspi); exit_clk_disable:clk_disable (tspi->clk); +exit_clk_unprepare: +clk_unprepare (tspi->clk); exit_free_master:spi_master_put (master);return ret;
@@ -1159,6 +1161,7 @@ static int tegra_slink_remove(struct platform_device *pdev)free_irq (tspi->irq, tspi);clk_disable (tspi->clk); +clk_unprepare (tspi->clk);if (tspi->tx_dma_chan)tegra_slink_deinit_dma_param (tspi, false);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 297/350 crypto: virtio - deal with unsupported input sizes
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 19c5da7d4a2662e85ea67d2d81df57e038fde3ab ]
Return -EINVAL for input sizes that are not a multiple of the AES block size, since they are not supported by our CBC chaining mode.
While at it, remove the pr_err() that reports unsupported key sizes being used: we shouldn't spam the kernel log with that.
--- drivers/crypto/virtio/virtio_crypto_algs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_crypto_algs.c +10 -2
@@ -105,8 +105,6 @@ virtio_crypto_alg_validate_key(int key_len, uint32_t *alg) *alg =VIRTIO_CRYPTO_CIPHER_AES_CBC ;break ;default : -pr_err ("virtio_crypto: Unsupported key length: %d\n" , - key_len);return -EINVAL ; }return 0 ;
@@ -484,6 +482,11 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
@@ -504,6 +507,11 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 303/350 spi: st-ssc4: add missed pm_runtime_disable
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
[ Upstream commit cd050abeba2a95fe5374eec28ad2244617bcbab6 ]
The driver forgets to call pm_runtime_disable in probe failure and remove.
Add the missed calls to fix it.
--- drivers/spi/spi-st-ssc4.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-st-ssc4.c +3 -0
@@ -381,6 +381,7 @@ static int spi_st_probe(struct platform_device *pdev)return 0 ; clk_disable: +pm_runtime_disable (&pdev->dev);clk_disable_unprepare (spi_st->clk); put_master:spi_master_put (master);
@@ -392,6 +393,8 @@ static int spi_st_remove(struct platform_device *pdev)struct spi_master *master =platform_get_drvdata (pdev);struct spi_st *spi_st =spi_master_get_devdata (master); +pm_runtime_disable (&pdev->dev); +clk_disable_unprepare (spi_st->clk);pinctrl_pm_select_sleep_state (&pdev->dev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 317/350 s390/crypto: Fix unsigned variable compared with zero
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 0398d4ab1677f7d8cd43aac2aa29a93dfcf9e2e3 ]
s390_crypto_shash_parmsize() return type is int, it should not be stored in a unsigned variable, which compared with zero.
--- arch/s390/crypto/sha_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/s390/crypto/sha_common.c +5 -2
@@ -74,14 +74,17 @@ int s390_sha_final(struct shash_desc *desc, u8 *out)struct s390_sha_ctx *ctx =shash_desc_ctx (desc);unsigned int bsize =crypto_shash_blocksize (desc->tfm);u64 bits; -unsigned int n, mbl_offset; +unsigned int n; +int mbl_offset; n = ctx->count % bsize; bits = ctx->count *8 ; - mbl_offset =s390_crypto_shash_parmsize (ctx->func) /sizeof (u32); + mbl_offset =s390_crypto_shash_parmsize (ctx->func);if (mbl_offset <0 )return -EINVAL ; + mbl_offset = mbl_offset /sizeof (u32); +/* set total msg bit length (mbl) in CPACF parmblock */ switch (ctx->func) {case CPACF_KLMD_SHA_1 :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 321/350 fbtft: Make sure string is NULL terminated
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 21f585480deb4bcf0d92b08879c35d066dfee030 ]
New GCC warns about inappropriate use of strncpy():
drivers/staging/fbtft/fbtft-core.c: In function ‘fbtft_framebuffer_alloc’:drivers/staging/fbtft/fbtft-core.c:665:2: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
665 | strncpy(info->fix.id, dev->driver->name, 16);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Later on the copy is being used with the assumption to be NULL terminated. Make sure string is NULL terminated by switching to snprintf().
--- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fbtft-core.c +1 -1
@@ -666,7 +666,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, fbdefio->deferred_io = fbtft_deferred_io;fb_deferred_io_init (info); -strncpy (info->fix.id, dev->driver->name,16 ); +snprintf (info->fix.id,sizeof (info->fix.id),"%s" , dev->driver->name); info->fix.type =FB_TYPE_PACKED_PIXELS ; info->fix.visual =FB_VISUAL_TRUECOLOR ; info->fix.xpanstep =0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 323/350 net: ethernet: ti: ale: clean ale tbl on init and intf restart
In reply to Sasha LevinFrom: Grygorii Strashko <[email protected]>
[ Upstream commit 7fe579dfb90fcdf0c7722f33c772d5f0d1bc7cb6 ]
Clean CPSW ALE on init and intf restart (up/down) to avoid reading obsolete or garbage entries from ALE table.
--- drivers/net/ethernet/ti/cpsw_ale.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/ti/cpsw_ale.c +2 -0
@@ -779,6 +779,7 @@ void cpsw_ale_start(struct cpsw_ale *ale)void cpsw_ale_stop (struct cpsw_ale *ale) {del_timer_sync (&ale->timer); +cpsw_ale_control_set (ale,0 ,ALE_CLEAR ,1 );cpsw_ale_control_set (ale,0 ,ALE_ENABLE ,0 ); }
@@ -862,6 +863,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)ALE_UNKNOWNVLAN_FORCE_UNTAG_EGRESS ; } +cpsw_ale_control_set (ale,0 ,ALE_CLEAR ,1 );return ale; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 338/350 ice: Only disable VF state when freeing each VF resources
In reply to Sasha LevinFrom: Akeem G Abodunrin <[email protected]>
[ Upstream commit 1f9639d2fb9188a59acafae9dea626391c442a8d ]
It is wrong to set PF disable state flag for all VFs when freeing VF resources - Instead, we should set VF disable state flag for each VF with its resources being returned to the device. Right now, all VF opcodes, mailbox communication to clear its resources as well fails - since we already indicate that PF is in disable state, with all VFs not active. In addition, we don't need to notify VF that PF is intending to reset it, if it is already in disabled state.
--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +8 -4
@@ -317,8 +317,9 @@ void ice_free_vfs(struct ice_pf *pf) pf->num_alloc_vfs =0 ;for (i =0 ; i < tmp; i++) {if (test_bit (ICE_VF_STATE_INIT , pf->vf[i].vf_states)) { -/* disable VF qp mappings */ +/* disable VF qp mappings and set VF disable state */ ice_dis_vf_mappings (&pf->vf[i]); +set_bit (ICE_VF_STATE_DIS , pf->vf[i].vf_states);ice_free_vf_res (&pf->vf[i]); } }
@@ -1287,9 +1288,12 @@ static void ice_vc_notify_vf_reset(struct ice_vf *vf)if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)return ; -/* verify if the VF is in either init or active before proceeding */ -if (!test_bit (ICE_VF_STATE_INIT , vf->vf_states) && - !test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) +/* Bail out if VF is in disabled state, neither initialized, nor active +* state - otherwise proceed with notifications +*/ +if ((!test_bit (ICE_VF_STATE_INIT , vf->vf_states) && + !test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) || +test_bit (ICE_VF_STATE_DIS , vf->vf_states))return ; pfe.event =VIRTCHNL_EVENT_RESET_IMPENDING ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 339/350 ice: Fix setting coalesce to handle DCB configuration
In reply to Sasha LevinFrom: Brett Creeley <[email protected]>
[ Upstream commit e25f9152bc07de534b2b590ce6c052ea25dd8900 ]
Currently there can be a case where a DCB map is applied and there are more interrupt vectors (vsi->num_q_vectors) than Rx queues (vsi->num_rxq) and Tx queues (vsi->num_txq). If we try to set coalesce settings in this case it will report a false failure. Fix this by checking if vector index is valid with respect to the number of Tx and Rx queues configured.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +10 -3
@@ -3368,10 +3368,17 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec,struct ice_vsi *vsi = np->vsi;if (q_num <0 ) { -int i; +int v_idx; + +ice_for_each_q_vector (vsi, v_idx) { +/* In some cases if DCB is configured the num_[rx|tx]q +* can be less than vsi->num_q_vectors. This check +* accounts for that so we don't report a false failure +*/ +if (v_idx >= vsi->num_rxq && v_idx >= vsi->num_txq) + goto set_complete; -ice_for_each_q_vector (vsi, i) { -if (ice_set_q_coalesce (vsi, ec, i)) +if (ice_set_q_coalesce (vsi, ec, v_idx))return -EINVAL ; } goto set_complete;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 40/350 media: ov6650: Fix control handler not freed on init error
From: Janusz Krzysztofik <[email protected]>
[ Upstream commit c404af950d14b71bfbf574a752b6c29d726baaba ]
Since commit afd9690c72c3 ("[media] ov6650: convert to the control framework"), if an error occurs during initialization of a control handler, resources possibly allocated to the handler are not freed before device initialiaton is aborted. Fix it.
--- drivers/media/i2c/ov6650.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/media/i2c/ov6650.c +8 -4
@@ -989,8 +989,10 @@ static int ov6650_probe(struct i2c_client *client, V4L2_CID_GAMMA, 0, 0xff, 1, 0x12); priv->subdev.ctrl_handler = &priv->hdl; -if (priv->hdl.error) -return priv->hdl.error; +if (priv->hdl.error) { + ret = priv->hdl.error; + goto ectlhdlfree; + }v4l2_ctrl_auto_cluster (2 , &priv->autogain,0 , true);v4l2_ctrl_auto_cluster (3 , &priv->autowb,0 , true);
@@ -1008,8 +1010,10 @@ static int ov6650_probe(struct i2c_client *client, priv->subdev.internal_ops = &ov6650_internal_ops; ret =v4l2_async_register_subdev (&priv->subdev); -if (ret) -v4l2_ctrl_handler_free (&priv->hdl); +if (!ret) +return 0 ; +ectlhdlfree: +v4l2_ctrl_handler_free (&priv->hdl);return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 41/350 media: i2c: ov2659: fix s_stream return value
From: Benoit Parrot <[email protected]>
[ Upstream commit 85c4043f1d403c222d481dfc91846227d66663fb ]
In ov2659_s_stream() return value for invoked function should be checked and propagated.
--- drivers/media/i2c/ov2659.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/media/i2c/ov2659.c +9 -5
@@ -1201,11 +1201,15 @@ static int ov2659_s_stream(struct v4l2_subdev *sd, int on) goto unlock; } -ov2659_set_pixel_clock (ov2659); -ov2659_set_frame_size (ov2659); -ov2659_set_format (ov2659); -ov2659_set_streaming (ov2659,1 ); - ov2659->streaming = on; + ret =ov2659_set_pixel_clock (ov2659); +if (!ret) + ret =ov2659_set_frame_size (ov2659); +if (!ret) + ret =ov2659_set_format (ov2659); +if (!ret) { +ov2659_set_streaming (ov2659,1 ); + ov2659->streaming = on; + } unlock:mutex_unlock (&ov2659->lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 44/350 media: ov6650: Fix stored frame format not in sync with hardware
In reply to Sasha LevinFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 3143b459de4cdcce67b36827476c966e93c1cf01 ]
The driver stores frame format settings supposed to be in line with hardware state in a device private structure. Since the driver initial submission, those settings are updated before they are actually applied on hardware. If an error occurs on device update, the stored settings my not reflect hardware state anymore and consecutive calls to .get_fmt() may return incorrect information. That in turn may affect ability of a bridge device to use correct DMA transfer settings if such incorrect informmation on active frame format returned by .get_fmt() is used.
Assuming a failed device update means its state hasn't changed, update frame format related settings stored in the device private structure only after they are successfully applied so the stored values always reflect hardware state as closely as possible.
--- drivers/media/i2c/ov6650.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/i2c/ov6650.c +6 -3
@@ -609,7 +609,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)dev_err (&client->dev,"Pixel format not handled: 0x%x\n" , code);return -EINVAL ; } - priv->code = code;if (code ==MEDIA_BUS_FMT_Y8_1X8 || code ==MEDIA_BUS_FMT_SBGGR8_1X8 ) {
@@ -635,7 +634,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)dev_dbg (&client->dev,"max resolution: CIF\n" ); coma_mask |=COMA_QCIF ; } - priv->half_scale = half_scale; clkrc = CLKRC_12MHz; mclk =12000000 ;
@@ -653,8 +651,13 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) ret =ov6650_reg_rmw (client,REG_COMA , coma_set, coma_mask);if (!ret) ret =ov6650_reg_write (client,REG_CLKRC , clkrc); -if (!ret) +if (!ret) { + priv->half_scale = half_scale; + ret =ov6650_reg_rmw (client,REG_COML , coml_set, coml_mask); + } +if (!ret) + priv->code = code;if (!ret) { mf->colorspace = priv->colorspace;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 45/350 media: ov6650: Fix stored crop rectangle not in sync with hardware
In reply to Sasha LevinFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 1463b371aff0682c70141f7521db13cc4bbf3016 ]
The driver stores crop rectangle settings supposed to be in line with hardware state in a device private structure. Since the driver initial submission, crop rectangle width and height settings are not updated correctly when rectangle offset settings are applied on hardware. If an error occurs while the device is updated, the stored settings my no longer reflect hardware state and consecutive calls to .get_selection() as well as .get/set_fmt() may return incorrect information. That in turn may affect ability of a bridge device to use correct DMA transfer settings if such incorrect informamtion on active frame format returned by .get/set_fmt() is used.
Assuming a failed update of the device means its actual settings haven't changed, update crop rectangle width and height settings stored in the device private structure correctly while the rectangle offset is successfully applied on hardware so the stored values always reflect actual hardware state to the extent possible.
--- drivers/media/i2c/ov6650.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ov6650.c +2 -0
@@ -481,6 +481,7 @@ static int ov6650_set_selection(struct v4l2_subdev *sd, ret =ov6650_reg_write (client,REG_HSTRT , sel->r.left >>1 );if (!ret) { + priv->rect.width += priv->rect.left - sel->r.left; priv->rect.left = sel->r.left; ret =ov6650_reg_write (client,REG_HSTOP , (sel->r.left + sel->r.width) >>1 );
@@ -490,6 +491,7 @@ static int ov6650_set_selection(struct v4l2_subdev *sd, ret =ov6650_reg_write (client,REG_VSTRT , sel->r.top >>1 ); }if (!ret) { + priv->rect.height += priv->rect.top - sel->r.top; priv->rect.top = sel->r.top; ret =ov6650_reg_write (client,REG_VSTOP , (sel->r.top + sel->r.height) >>1 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 43/350 media: i2c: ov2659: Fix missing 720p register config
In reply to Sasha LevinFrom: Benoit Parrot <[email protected]>
[ Upstream commit 9d669fbfca20e6035ead814e55d9ef1a6b500540 ]
The initial registers sequence is only loaded at probe time. Afterward only the resolution and format specific register are modified. Care must be taken to make sure registers modified by one resolution setting are reverted back when another resolution is programmed.
This was not done properly for the 720p case.
--- drivers/media/i2c/ov2659.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/i2c/ov2659.c +4 -0
@@ -419,10 +419,14 @@ static struct sensor_register ov2659_720p[] = { { REG_TIMING_YINC, 0x11 }, { REG_TIMING_VERT_FORMAT, 0x80 }, { REG_TIMING_HORIZ_FORMAT, 0x00 }, + { 0x370a, 0x12 }, { 0x3a03, 0xe8 }, { 0x3a09, 0x6f }, { 0x3a0b, 0x5d }, { 0x3a15, 0x9a }, + { REG_VFIFO_READ_START_H, 0x00 }, + { REG_VFIFO_READ_START_L, 0x80 }, + { REG_ISP_CTRL02, 0x00 }, { REG_NULL, 0x00 }, };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 47/350 media: venus: core: Fix msm8996 frequency table
In reply to Sasha LevinFrom: Loic Poulain <[email protected]>
[ Upstream commit c690435ed07901737e5c007a65ec59f53b33eb71 ]
In downstream driver, there are two frequency tables defined, one for the encoder and one for the decoder:
/* Encoders /
<972000 490000000 0x55555555>, / 4k UHD @ 30 /
<489600 320000000 0x55555555>, / 1080p @ 60 /
<244800 150000000 0x55555555>, / 1080p @ 30 /
<108000 75000000 0x55555555>, / 720p @ 30 */
/* Decoders /
<1944000 490000000 0xffffffff>, / 4k UHD @ 60 /
< 972000 320000000 0xffffffff>, / 4k UHD @ 30 /
< 489600 150000000 0xffffffff>, / 1080p @ 60 /
< 244800 75000000 0xffffffff>; / 1080p @ 30 */
It shows that encoder always needs a higher clock than decoder.
In current venus driver, the unified frequency table is aligned with the downstream decoder table which causes performance issues in encoding scenarios. Fix that by aligning frequency table on worst case (encoding).
--- drivers/media/platform/qcom/venus/core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/core.c +5 -4
@@ -427,10 +427,11 @@ static const struct venus_resources msm8916_res = { };static const struct freq_tbl msm8996_freq_table[] = { - {1944000 ,490000000 },/* 4k UHD @ 60 */ - {972000 ,320000000 },/* 4k UHD @ 30 */ - {489600 ,150000000 },/* 1080p @ 60 */ - {244800 ,75000000 },/* 1080p @ 30 */ + {1944000 ,520000000 },/* 4k UHD @ 60 (decode only) */ + {972000 ,520000000 },/* 4k UHD @ 30 */ + {489600 ,346666667 },/* 1080p @ 60 */ + {244800 ,150000000 },/* 1080p @ 30 */ + {108000 ,75000000 },/* 720p @ 30 */ };static const struct reg_val msm8996_reg_preset[] = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 48/350 ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq
In reply to Sasha LevinFrom: Ben Greear <[email protected]>
[ Upstream commit cc6df017e55764ffef9819dd9554053182535ffd ]
Offchannel management frames were failing:
[18099.253732] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780 [18102.293686] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780 [18105.333653] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780 [18108.373712] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780 [18111.413687] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e36c0 [18114.453726] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3f00 [18117.493773] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e36c0 [18120.533631] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3f00
This bug appears to have been added between 4.0 (which works for us), and 4.4, which does not work.
I think this is because the tx-offchannel logic gets in a loop when ath10k_mac_tx_frm_has_freq(ar) is false, so pkt is never actually sent to the firmware for transmit.
This patch fixes the problem on 4.9 for me, and now HS20 clients can work again with my firmware.
Antonio: tested with 10.4-3.5.3-00057 on QCA4019 and QCA9888
--- drivers/net/wireless/ath/ath10k/mac.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +11 -11
@@ -3708,7 +3708,7 @@ static int ath10k_mac_tx(struct ath10k *ar,struct ieee80211_vif *vif, enum ath10k_hw_txrx_mode txmode, enum ath10k_mac_tx_path txpath, - struct sk_buff *skb) + struct sk_buff *skb, bool noque_offchan) { struct ieee80211_hw *hw = ar->hw;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);
@@ -3738,10 +3738,10 @@ static int ath10k_mac_tx(struct ath10k *ar, } } -if (info->flags &IEEE80211_TX_CTL_TX_OFFCHAN ) { +if (!noque_offchan && info->flags &IEEE80211_TX_CTL_TX_OFFCHAN ) {if (!ath10k_mac_tx_frm_has_freq (ar)) { -ath10k_dbg (ar,ATH10K_DBG_MAC ,"queued offchannel skb %pK\n" , - skb); +ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac queued offchannel skb %pK len %d\n" , + skb, skb->len);skb_queue_tail (&ar->offchan_tx_queue, skb);ieee80211_queue_work (hw, &ar->offchan_tx_work);
@@ -3803,8 +3803,8 @@ void ath10k_offchan_tx_work(struct work_struct *work)mutex_lock (&ar->conf_mutex); -ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac offchannel skb %pK\n" , - skb); +ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac offchannel skb %pK len %d\n" , + skb, skb->len); hdr = (struct ieee80211_hdr *)skb->data; peer_addr =ieee80211_get_DA (hdr);
@@ -3850,7 +3850,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) txmode =ath10k_mac_tx_h_get_txmode (ar, vif, sta, skb); txpath =ath10k_mac_tx_h_get_txpath (ar, skb, txmode); - ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb); + ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb, true);if (ret) {ath10k_warn (ar,"failed to transmit offchannel frame: %d\n" , ret);
@@ -3860,8 +3860,8 @@ void ath10k_offchan_tx_work(struct work_struct *work) time_left =wait_for_completion_timeout (&ar->offchan_tx_completed,3 *HZ );if (time_left ==0 ) -ath10k_warn (ar,"timed out waiting for offchannel skb %pK\n" , - skb); +ath10k_warn (ar,"timed out waiting for offchannel skb %pK, len: %d\n" , + skb, skb->len);if (!peer && tmp_peer_created) { ret =ath10k_peer_delete (ar, vdev_id, peer_addr);
@@ -4097,7 +4097,7 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,spin_unlock_bh (&ar->htt.tx_lock); } - ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb); + ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb, false);if (unlikely (ret)) {ath10k_warn (ar,"failed to push frame: %d\n" , ret);
@@ -4378,7 +4378,7 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,spin_unlock_bh (&ar->htt.tx_lock); } - ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb); + ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb, false);if (ret) {ath10k_warn (ar,"failed to transmit frame: %d\n" , ret);if (is_htt) {
Signature · 7 lines
2.20.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 49/350 media: vimc: Fix gpf in rmmod path when stream is active
In reply to Sasha LevinFrom: Shuah Khan <[email protected]>
[ Upstream commit d7fb5c361c2a2666d20e044206e1756bc8e87df2 ]
If vimc module is removed while streaming is in progress, sensor subdev unregister runs into general protection fault when it tries to unregister media entities. This is a common subdev problem related to releasing pads from v4l2_device_unregister_subdev() before calling unregister. Unregister references pads during unregistering subdev.
The sd release handler is the right place for releasing all sd resources including pads. The release handlers currently release all resources except the pads.
Fix v4l2_device_unregister_subdev() not release pads and release pads from the sd_int_op release handlers.
kernel: [ 4136.715839] general protection fault: 0000 [#1] SMP PTI
kernel: [ 4136.715847] CPU: 2 PID: 1972 Comm: bash Not tainted 5.3.0-rc2+ #4
kernel: [ 4136.715850] Hardware name: Dell Inc. OptiPlex 790/0HY9JP, BIOS A18 09/24/2013
kernel: [ 4136.715858] RIP: 0010:media_gobj_destroy.part.16+0x1f/0x60
kernel: [ 4136.715863] Code: ff 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 48 89 fe 48 89 e5 53 48 89 fb 48 c7 c7 00 7f cf b0 e8 24 fa ff ff 48 8b 03 <48> 83 80 a0 00 00 00 01 48 8b 43 18 48 8b 53 10 48 89 42 08 48 89
kernel: [ 4136.715866] RSP: 0018:ffff9b2248fe3cb0 EFLAGS: 00010246
kernel: [ 4136.715870] RAX: bcf2bfbfa0d63c2f RBX: ffff88c3eb37e9c0 RCX: 00000000802a0018
kernel: [ 4136.715873] RDX: ffff88c3e4f6a078 RSI: ffff88c3eb37e9c0 RDI: ffffffffb0cf7f00
kernel: [ 4136.715876] RBP: ffff9b2248fe3cb8 R08: 0000000001000002 R09: ffffffffb0492b00
kernel: [ 4136.715879] R10: ffff9b2248fe3c28 R11: 0000000000000001 R12: 0000000000000038
kernel: [ 4136.715881] R13: ffffffffc09a1628 R14: ffff88c3e4f6a028 R15: fffffffffffffff2
kernel: [ 4136.715885] FS: 00007f8389647740(0000) GS:ffff88c465500000(0000) knlGS:0000000000000000
kernel: [ 4136.715888] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
kernel: [ 4136.715891] CR2: 000055d008f80fd8 CR3: 00000001996ec005 CR4: 00000000000606e0
kernel: [ 4136.715894] Call Trace:
kernel: [ 4136.715903] media_gobj_destroy+0x14/0x20
kernel: [ 4136.715908] __media_device_unregister_entity+0xb3/0xe0
kernel: [ 4136.715915] media_device_unregister_entity+0x30/0x40
kernel: [ 4136.715920] v4l2_device_unregister_subdev+0xa8/0xe0
kernel: [ 4136.715928] vimc_ent_sd_unregister+0x1e/0x30 [vimc]
kernel: [ 4136.715933] vimc_sen_rm+0x16/0x20 [vimc]
kernel: [ 4136.715938] vimc_remove+0x3e/0xa0 [vimc]
kernel: [ 4136.715945] platform_drv_remove+0x25/0x50
kernel: [ 4136.715951] device_release_driver_internal+0xe0/0x1b0
kernel: [ 4136.715956] device_driver_detach+0x14/0x20
kernel: [ 4136.715960] unbind_store+0xd1/0x130
kernel: [ 4136.715965] drv_attr_store+0x27/0x40
kernel: [ 4136.715971] sysfs_kf_write+0x48/0x60
kernel: [ 4136.715976] kernfs_fop_write+0x128/0x1b0
kernel: [ 4136.715982] __vfs_write+0x1b/0x40
kernel: [ 4136.715987] vfs_write+0xc3/0x1d0
kernel: [ 4136.715993] ksys_write+0xaa/0xe0
kernel: [ 4136.715999] __x64_sys_write+0x1a/0x20
kernel: [ 4136.716005] do_syscall_64+0x5a/0x130
kernel: [ 4136.716010] entry_SYSCALL_64_after_hwframe+0x4
--- drivers/media/platform/vimc/vimc-common.c | 3 +-- drivers/media/platform/vimc/vimc-debayer.c | 1 + drivers/media/platform/vimc/vimc-scaler.c | 1 + drivers/media/platform/vimc/vimc-sensor.c | 1 + 4 files changed, 4 insertions(+), 2 deletions(-)
drivers/media/platform/vimc/vimc-common.c +1 -2
@@ -375,7 +375,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, {int ret; -/* Allocate the pads */ +/* Allocate the pads. Should be released from the sd_int_op release */ ved->pads =vimc_pads_init (num_pads, pads_flag);if (IS_ERR (ved->pads))return PTR_ERR (ved->pads);
@@ -424,7 +424,6 @@ EXPORT_SYMBOL_GPL(vimc_ent_sd_register);void vimc_ent_sd_unregister (struct vimc_ent_device *ved,struct v4l2_subdev *sd) {media_entity_cleanup (ved->ent); -vimc_pads_cleanup (ved->pads);v4l2_device_unregister_subdev (sd); }EXPORT_SYMBOL_GPL (vimc_ent_sd_unregister);
drivers/media/platform/vimc/vimc-debayer.c +1 -0
@@ -484,6 +484,7 @@ static void vimc_deb_release(struct v4l2_subdev *sd)struct vimc_deb_device *vdeb = container_of(sd, struct vimc_deb_device, sd); +vimc_pads_cleanup (vdeb->ved.pads);kfree (vdeb); }
drivers/media/platform/vimc/vimc-scaler.c +1 -0
@@ -343,6 +343,7 @@ static void vimc_sca_release(struct v4l2_subdev *sd)struct vimc_sca_device *vsca = container_of(sd, struct vimc_sca_device, sd); +vimc_pads_cleanup (vsca->ved.pads);kfree (vsca); }
drivers/media/platform/vimc/vimc-sensor.c +1 -0
@@ -297,6 +297,7 @@ static void vimc_sen_release(struct v4l2_subdev *sd)v4l2_ctrl_handler_free (&vsen->hdl);tpg_free (&vsen->tpg); +vimc_pads_cleanup (vsen->ved.pads);kfree (vsen); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 51/350 pinctrl: devicetree: Avoid taking direct reference to device name string
In reply to Sasha LevinFrom: Will Deacon <[email protected]>
[ Upstream commit be4c60b563edee3712d392aaeb0943a768df7023 ]
When populating the pinctrl mapping table entries for a device, the 'dev_name' field for each entry is initialised to point directly at the string returned by 'dev_name()' for the device and subsequently used by 'create_pinctrl()' when looking up the mappings for the device being probed.
This is unreliable in the presence of calls to 'dev_set_name()', which may reallocate the device name string leaving the pinctrl mappings with a dangling reference. This then leads to a use-after-free every time the name is dereferenced by a device probe:
| BUG: KASAN: invalid-access in strcmp+0x20/0x64 | Read of size 1 at addr 13ffffc153494b00 by task modprobe/590 | Pointer tag: [13], memory tag: [fe] | | Call trace: | __kasan_report+0x16c/0x1dc | kasan_report+0x10/0x18 | check_memory_region | __hwasan_load1_noabort+0x4c/0x54 | strcmp+0x20/0x64 | create_pinctrl+0x18c/0x7f4 | pinctrl_get+0x90/0x114 | devm_pinctrl_get+0x44/0x98 | pinctrl_bind_pins+0x5c/0x450 | really_probe+0x1c8/0x9a4 | driver_probe_device+0x120/0x1d8
Follow the example of sysfs, and duplicate the device name string before stashing it away in the pinctrl mapping entries.
--- drivers/pinctrl/devicetree.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/pinctrl/devicetree.c +20 -5
@@ -29,6 +29,13 @@ struct pinctrl_dt_map {static void dt_free_map (struct pinctrl_dev *pctldev,struct pinctrl_map *map,unsigned num_maps) { +int i; + +for (i =0 ; i < num_maps; ++i) { +kfree_const (map[i].dev_name); + map[i].dev_name =NULL ; + } +if (pctldev) {const struct pinctrl_ops *ops = pctldev->desc->pctlops;if (ops->dt_free_map)
@@ -63,7 +70,13 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,/* Initialize common mapping table entry fields */ for (i =0 ; i < num_maps; i++) { - map[i].dev_name =dev_name (p->dev); +const char *devname; + + devname =kstrdup_const (dev_name (p->dev),GFP_KERNEL ); +if (!devname) + goto err_free_map; + + map[i].dev_name = devname; map[i].name = statename;if (pctldev) map[i].ctrl_dev_name =dev_name (pctldev->dev);
@@ -71,10 +84,8 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,/* Remember the converted mapping table entries */ dt_map =kzalloc (sizeof (*dt_map),GFP_KERNEL ); -if (!dt_map) { -dt_free_map (pctldev, map, num_maps); -return -ENOMEM ; - } +if (!dt_map) + goto err_free_map; dt_map->pctldev = pctldev; dt_map->map = map;
@@ -82,6 +93,10 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,list_add_tail (&dt_map->node, &p->dt_maps);return pinctrl_register_map (map, num_maps, false); + +err_free_map: +dt_free_map (pctldev, map, num_maps); +return -ENOMEM ; }struct pinctrl_dev *of_pinctrl_get (struct device_node *np)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 54/350 x86/math-emu: Check __copy_from_user() result
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit e6b44ce1925a8329a937c57f0d60ba0d9bb5d226 ]
The new __must_check annotation on __copy_from_user() successfully identified some code that has lacked the check since at least linux-2.1.73:
arch/x86/math-emu/reg_ld_str.c:88:2: error: ignoring return value of \
function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] __copy_from_user(sti_ptr, s, 10);
^~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1129:2: error: ignoring return value of \
function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] __copy_from_user(register_base + offset, s, other); ^~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/x86/math-emu/reg_ld_str.c:1131:3: error: ignoring return value of \
function declared with 'warn_unused_result' attribute [-Werror,-Wunused-result] __copy_from_user(register_base, s + other, offset);
^~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In addition, the get_user()/put_user() helpers do not enforce a return value check, but actually still require one. These have been missing for even longer.
Change the internal wrappers around get_user()/put_user() to force a signal and add a corresponding wrapper around __copy_from_user() to check all such cases.
[ bp: Break long lines. ]
--- arch/x86/math-emu/fpu_system.h | 6 ++++-- arch/x86/math-emu/reg_ld_str.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-)
arch/x86/math-emu/fpu_system.h +4 -2
@@ -107,6 +107,8 @@ static inline bool seg_writable(struct desc_struct *d)#define FPU_access_ok (y,z) if ( !access_ok(y,z) ) \ math_abort(FPU_info,SIGSEGV)#define FPU_abort math_abort(FPU_info, SIGSEGV) +#define FPU_copy_from_user (to, from, n) \ + do { if (copy_from_user(to, from, n)) FPU_abort; } while (0)#undef FPU_IGNORE_CODE_SEGV#ifdef FPU_IGNORE_CODE_SEGV
@@ -122,7 +124,7 @@ static inline bool seg_writable(struct desc_struct *d)#define FPU_code_access_ok (z) FPU_access_ok((void __user *)FPU_EIP,z)#endif -#define FPU_get_user (x,y) get_user((x),(y)) -#define FPU_put_user (x,y) put_user((x),(y)) +#define FPU_get_user (x,y) do { if (get_user((x),(y))) FPU_abort; } while (0) +#define FPU_put_user (x,y) do { if (put_user((x),(y))) FPU_abort; } while (0)#endif
arch/x86/math-emu/reg_ld_str.c +3 -3
@@ -85,7 +85,7 @@ int FPU_load_extended(long double __user *s, int stnr)RE_ENTRANT_CHECK_OFF ;FPU_access_ok (s,10 ); -__copy_from_user (sti_ptr, s,10 ); +FPU_copy_from_user (sti_ptr, s,10 );RE_ENTRANT_CHECK_ON ;return FPU_tagof (sti_ptr);
@@ -1126,9 +1126,9 @@ void frstor(fpu_addr_modes addr_modes, u_char __user *data_address)/* Copy all registers in stack order. */ RE_ENTRANT_CHECK_OFF ;FPU_access_ok (s,80 ); -__copy_from_user (register_base + offset, s, other); +FPU_copy_from_user (register_base + offset, s, other);if (offset) -__copy_from_user (register_base, s + other, offset); +FPU_copy_from_user (register_base, s + other, offset);RE_ENTRANT_CHECK_ON ;for (i =0 ; i <8 ; i++) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 53/350 drm/amdkfd: fix a potential NULL pointer dereference (v2)
In reply to Sasha LevinFrom: Allen Pais <[email protected]>
[ Upstream commit 81de29d842ccb776c0f77aa3e2b11b07fff0c0e2 ]
alloc_workqueue is not checked for errors and as a result, a potential NULL dereference could occur.
v2 (Felix Kuehling):
* Fix compile error (kfifo_free instead of fifo_free)
* Return proper error code
--- drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +5 -0
@@ -62,6 +62,11 @@ int kfd_interrupt_init(struct kfd_dev *kfd) } kfd->ih_wq =alloc_workqueue ("KFD IH" ,WQ_HIGHPRI ,1 ); +if (unlikely (!kfd->ih_wq)) { +kfifo_free (&kfd->ih_fifo); +dev_err (kfd_chardev (),"Failed to allocate KFD IH workqueue\n" ); +return -ENOMEM ; + }spin_lock_init (&kfd->interrupt_lock);INIT_WORK (&kfd->interrupt_work, interrupt_wq);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 55/350 drm/amd/powerplay: A workaround to GPU RESET on APU
In reply to Sasha LevinFrom: chen gong <[email protected]>
[ Upstream commit 068ad870bbd8f4f2c5b2fd4977a4f3330c9988f4 ]
Changes to function "smu_suspend" in amdgpu_smu.c is a workaround.
We should get real information about if baco is enabled or not, while we always consider APU SMU feature as enabled in current code.
I know APU do not support baco mode for GPU reset, so I use "adev->flags" to skip function "smu_feature_is_enabled".
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +4 -1
@@ -1344,7 +1344,10 @@ static int smu_suspend(void *handle)int ret;struct amdgpu_device *adev = (struct amdgpu_device *)handle;struct smu_context *smu = &adev->smu; -bool baco_feature_is_enabled =smu_feature_is_enabled (smu,SMU_FEATURE_BACO_BIT ); +bool baco_feature_is_enabled = false; + +if (!(adev->flags &AMD_IS_APU )) + baco_feature_is_enabled =smu_feature_is_enabled (smu,SMU_FEATURE_BACO_BIT ); ret =smu_system_features_control (smu, false);if (ret)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 67/350 media: cec-funcs.h: add status_req checks
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit 9b211f9c5a0b67afc435b86f75d78273b97db1c5 ]
The CEC_MSG_GIVE_DECK_STATUS and CEC_MSG_GIVE_TUNER_DEVICE_STATUS commands both have a status_req argument: ON, OFF, ONCE. If ON or ONCE, then the follower will reply with a STATUS message. Either once or whenever the status changes (status_req == ON).
If status_req == OFF, then it will stop sending continuous status updates, but the follower will *not* send a STATUS message in that case.
This means that if status_req == OFF, then msg->reply should be 0 as well since no reply is expected in that case.
--- include/uapi/linux/cec-funcs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/uapi/linux/cec-funcs.h +4 -2
@@ -923,7 +923,8 @@ static inline void cec_msg_give_deck_status(struct cec_msg *msg, msg->len =3 ; msg->msg[1 ] =CEC_MSG_GIVE_DECK_STATUS ; msg->msg[2 ] = status_req; - msg->reply = reply ?CEC_MSG_DECK_STATUS :0 ; + msg->reply = (reply && status_req !=CEC_OP_STATUS_REQ_OFF ) ? +CEC_MSG_DECK_STATUS :0 ; } static inline void cec_ops_give_deck_status(const struct cec_msg *msg,
@@ -1027,7 +1028,8 @@ static inline void cec_msg_give_tuner_device_status(struct cec_msg *msg, msg->len =3 ; msg->msg[1 ] =CEC_MSG_GIVE_TUNER_DEVICE_STATUS ; msg->msg[2 ] = status_req; - msg->reply = reply ?CEC_MSG_TUNER_DEVICE_STATUS :0 ; + msg->reply = (reply && status_req !=CEC_OP_STATUS_REQ_OFF ) ? +CEC_MSG_TUNER_DEVICE_STATUS :0 ; } static inline void cec_ops_give_tuner_device_status(const struct cec_msg *msg,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 68/350 media: meson/ao-cec: move cec_notifier_cec_adap_register after hw setup
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
[ Upstream commit 3e84a18a259e1df35e5b549ab92ec3baf82ff010 ]
When probed after the HDMI notifier, calling cec_notifier_cec_adap_register() calls the enable() adapter callback, but the HW is not yet set up.
Moving cec_notifier_cec_adap_register() right before cec_register_adapter() fixes the following crash:
Ignoring spurious kernel translation fault at virtual address 0000000000000008 [...]
Hardware name: Khadas VIM (DT) [...] pc : __do_kernel_fault+0xdc/0x120 lr : __do_kernel_fault+0xdc/0x120 [...] Call trace: __do_kernel_fault+0xdc/0x120 do_page_fault+0x180/0x458 do_translation_fault+0x64/0x70 do_mem_abort+0x3c/0x98 el1_da+0x20/0x94 meson_ao_cec_adap_enable+0x30/0x218 [ao_cec] __cec_s_phys_addr+0x184/0x270 cec_s_phys_addr+0x44/0x60 cec_notifier_cec_adap_register+0x68/0x90 meson_ao_cec_probe+0xb0/0x288 [ao_cec]
[...]
el0_svc_compat+0x8/0x10
--- drivers/media/platform/meson/ao-cec-g12a.c | 36 +++++++++++----------- drivers/media/platform/meson/ao-cec.c | 30 +++++++++--------- 2 files changed, 33 insertions(+), 33 deletions(-)
drivers/media/platform/meson/ao-cec-g12a.c +18 -18
@@ -662,34 +662,27 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev)if (IS_ERR (ao_cec->adap))return PTR_ERR (ao_cec->adap); - ao_cec->notify =cec_notifier_cec_adap_register (hdmi_dev,NULL , - ao_cec->adap); -if (!ao_cec->notify) { - ret = -ENOMEM ; - goto out_probe_adapter; - } - ao_cec->adap->owner =THIS_MODULE ; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); base =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (base)) { ret =PTR_ERR (base); - goto out_probe_notify; + goto out_probe_adapter; } ao_cec->regmap =devm_regmap_init_mmio (&pdev->dev, base, &meson_ao_cec_g12a_regmap_conf);if (IS_ERR (ao_cec->regmap)) { ret =PTR_ERR (ao_cec->regmap); - goto out_probe_notify; + goto out_probe_adapter; } ao_cec->regmap_cec =devm_regmap_init (&pdev->dev,NULL , ao_cec, &meson_ao_cec_g12a_cec_regmap_conf);if (IS_ERR (ao_cec->regmap_cec)) { ret =PTR_ERR (ao_cec->regmap_cec); - goto out_probe_notify; + goto out_probe_adapter; } irq =platform_get_irq (pdev,0 );
@@ -699,45 +692,52 @@ static int meson_ao_cec_g12a_probe(struct platform_device *pdev) 0, NULL, ao_cec);if (ret) {dev_err (&pdev->dev,"irq request failed\n" ); - goto out_probe_notify; + goto out_probe_adapter; } ao_cec->oscin =devm_clk_get (&pdev->dev,"oscin" );if (IS_ERR (ao_cec->oscin)) {dev_err (&pdev->dev,"oscin clock request failed\n" ); ret =PTR_ERR (ao_cec->oscin); - goto out_probe_notify; + goto out_probe_adapter; } ret =meson_ao_cec_g12a_setup_clk (ao_cec);if (ret) - goto out_probe_notify; + goto out_probe_adapter; ret =clk_prepare_enable (ao_cec->core);if (ret) {dev_err (&pdev->dev,"core clock enable failed\n" ); - goto out_probe_notify; + goto out_probe_adapter; }device_reset_optional (&pdev->dev);platform_set_drvdata (pdev, ao_cec); + ao_cec->notify =cec_notifier_cec_adap_register (hdmi_dev,NULL , + ao_cec->adap); +if (!ao_cec->notify) { + ret = -ENOMEM ; + goto out_probe_core_clk; + } + ret =cec_register_adapter (ao_cec->adap, &pdev->dev);if (ret <0 ) - goto out_probe_core_clk; + goto out_probe_notify;/* Setup Hardware */ regmap_write (ao_cec->regmap,CECB_GEN_CNTL_REG ,CECB_GEN_CNTL_RESET );return 0 ; -out_probe_core_clk: -clk_disable_unprepare (ao_cec->core); - out_probe_notify:cec_notifier_cec_adap_unregister (ao_cec->notify); +out_probe_core_clk: +clk_disable_unprepare (ao_cec->core); + out_probe_adapter:cec_delete_adapter (ao_cec->adap);
drivers/media/platform/meson/ao-cec.c +15 -15
@@ -624,20 +624,13 @@ static int meson_ao_cec_probe(struct platform_device *pdev)if (IS_ERR (ao_cec->adap))return PTR_ERR (ao_cec->adap); - ao_cec->notify =cec_notifier_cec_adap_register (hdmi_dev,NULL , - ao_cec->adap); -if (!ao_cec->notify) { - ret = -ENOMEM ; - goto out_probe_adapter; - } - ao_cec->adap->owner =THIS_MODULE ; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); ao_cec->base =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (ao_cec->base)) { ret =PTR_ERR (ao_cec->base); - goto out_probe_notify; + goto out_probe_adapter; } irq =platform_get_irq (pdev,0 );
@@ -647,20 +640,20 @@ static int meson_ao_cec_probe(struct platform_device *pdev) 0, NULL, ao_cec);if (ret) {dev_err (&pdev->dev,"irq request failed\n" ); - goto out_probe_notify; + goto out_probe_adapter; } ao_cec->core =devm_clk_get (&pdev->dev,"core" );if (IS_ERR (ao_cec->core)) {dev_err (&pdev->dev,"core clock request failed\n" ); ret =PTR_ERR (ao_cec->core); - goto out_probe_notify; + goto out_probe_adapter; } ret =clk_prepare_enable (ao_cec->core);if (ret) {dev_err (&pdev->dev,"core clock enable failed\n" ); - goto out_probe_notify; + goto out_probe_adapter; } ret =clk_set_rate (ao_cec->core,CEC_CLK_RATE );
@@ -674,9 +667,16 @@ static int meson_ao_cec_probe(struct platform_device *pdev) ao_cec->pdev = pdev;platform_set_drvdata (pdev, ao_cec); + ao_cec->notify =cec_notifier_cec_adap_register (hdmi_dev,NULL , + ao_cec->adap); +if (!ao_cec->notify) { + ret = -ENOMEM ; + goto out_probe_clk; + } + ret =cec_register_adapter (ao_cec->adap, &pdev->dev);if (ret <0 ) - goto out_probe_clk; + goto out_probe_notify;/* Setup Hardware */ writel_relaxed(CEC_GEN_CNTL_RESET,
@@ -684,12 +684,12 @@ static int meson_ao_cec_probe(struct platform_device *pdev)return 0 ; -out_probe_clk: -clk_disable_unprepare (ao_cec->core); - out_probe_notify:cec_notifier_cec_adap_unregister (ao_cec->notify); +out_probe_clk: +clk_disable_unprepare (ao_cec->core); + out_probe_adapter:cec_delete_adapter (ao_cec->adap);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 59/350 rtw88: fix NSS of hw_cap
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 4f5bb7ff8b8d4bafd91243fc969ed240e67aa1ca ]
8822C is a 2x2 11ac chip, and then NSS must be less or equal to 2. However, current nss of hw cap is 3, likes
hw cap: hci=0x0f, bw=0x07, ptcl=0x03, ant_num=7, nss=3
This commit adds constraint to make sure NSS <= rf_path_num, and result looks like
hw cap: hci=0x0f, bw=0x07, ptcl=0x03, ant_num=7, nss=2
--- drivers/net/wireless/realtek/rtw88/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/main.c +2 -1
@@ -1020,7 +1020,8 @@ static int rtw_dump_hw_feature(struct rtw_dev *rtwdev)rtw_hw_config_rf_ant_num (rtwdev, efuse->hw_cap.ant_num); -if (efuse->hw_cap.nss ==EFUSE_HW_CAP_IGNORE ) +if (efuse->hw_cap.nss ==EFUSE_HW_CAP_IGNORE || + efuse->hw_cap.nss > rtwdev->hal.rf_path_num) efuse->hw_cap.nss = rtwdev->hal.rf_path_num; rtw_dbg(rtwdev, RTW_DBG_EFUSE,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 52/350 drm/sun4i: dsi: Fix TCON DRQ set bits
In reply to Sasha LevinFrom: Jagan Teki <[email protected]>
[ Upstream commit 7ac6269968826f9cad61b501bb613cc5cadb7229 ]
The LCD timing definitions between Linux DRM vs Allwinner are different, below diagram shows this clear differences.
Active Front Sync Back
Region Porch Porch
<-----------------------><----------------><--------------><-------------->
//////////////////////|
////////////////////// |
////////////////////// |.................. ................
________________<----- [hv]display ----->
<------------- [hv]sync_start ------------> <--------------------- [hv]sync_end ----------------------> <-------------------------------- [hv]total ------------------------------>
<----- lcd_[xy] --------> <- lcd_[hv]spw ->
<---------- lcd_[hv]bp --------->
<-------------------------------- lcd_[hv]t ------------------------------>
The DSI driver misinterpreted the hbp term from the BSP code to refer only to the backporch, when in fact it was backporch + sync. Thus the driver incorrectly used the horizontal front porch plus sync in its calculation of the DRQ set bit value, when it should not have included the sync timing.
Including additional sync timings leads to flip_done timed out as:
WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0 [CRTC:46:crtc-0] vblank wait timed out Modules linked in: CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13 Hardware name: Allwinner sun8i Family Workqueue: events deferred_probe_work_func [<c010ed54>] (unwind_backtrace) from [<c010b76c>] (show_stack+0x10/0x14) [<c010b76c>] (show_stack) from [<c0688c70>] (dump_stack+0x84/0x98) [<c0688c70>] (dump_stack) from [<c011d9e4>] (__warn+0xfc/0x114) [<c011d9e4>] (__warn) from [<c011da40>] (warn_slowpath_fmt+0x44/0x68) [<c011da40>] (warn_slowpath_fmt) from [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0) [<c040cd50>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c040e694>] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c) [<c040e694>] (drm_atomic_helper_commit_tail_rpm) from [<c040e4dc>] (commit_tail+0x40/0x6c) [<c040e4dc>] (commit_tail) from [<c040e5cc>] (drm_atomic_helper_commit+0xbc/0x128) [<c040e5cc>] (drm_atomic_helper_commit) from [<c0411b64>] (restore_fbdev_mode_atomic+0x1cc/0x1dc) [<c0411b64>] (restore_fbdev_mode_atomic) from [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0) [<c04156f8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0415774>] (drm_fb_helper_set_par+0x30/0x54) [<c0415774>] (drm_fb_helper_set_par) from [<c03ad450>] (fbcon_init+0x560/0x5ac) [<c03ad450>] (fbcon_init) from [<c03eb8a0>] (visual_init+0xbc/0x104) [<c03eb8a0>] (visual_init) from [<c03ed1b8>] (do_bind_con_driver+0x1b0/0x390) [<c03ed1b8>] (do_bind_con_driver) from [<c03ed780>] (do_take_over_console+0x13c/0x1c4) [<c03ed780>] (do_take_over_console) from [<c03ad800>] (do_fbcon_takeover+0x74/0xcc) [<c03ad800>] (do_fbcon_takeover) from [<c013c9c8>] (notifier_call_chain+0x44/0x84) [<c013c9c8>] (notifier_call_chain) from [<c013cd20>] (__blocking_notifier_call_chain+0x48/0x60) [<c013cd20>] (__blocking_notifier_call_chain) from [<c013cd50>] (blocking_notifier_call_chain+0x18/0x20) [<c013cd50>] (blocking_notifier_call_chain) from [<c03a6e44>] (register_framebuffer+0x1e0/0x2f8) [<c03a6e44>] (register_framebuffer) from [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c) [<c04153c0>] (__drm_fb_helper_initial_config_and_unlock) from [<c04158c8>] (drm_fbdev_client_hotplug+0xe8/0x1b8) [<c04158c8>] (drm_fbdev_client_hotplug) from [<c0415a20>] (drm_fbdev_generic_setup+0x88/0x118) [<c0415a20>] (drm_fbdev_generic_setup) from [<c043f060>] (sun4i_drv_bind+0x128/0x160) [<c043f060>] (sun4i_drv_bind) from [<c044b598>] (try_to_bring_up_master+0x164/0x1a0) [<c044b598>] (try_to_bring_up_master) from [<c044b668>] (__component_add+0x94/0x140) [<c044b668>] (__component_add) from [<c0445e1c>] (sun6i_dsi_probe+0x144/0x234) [<c0445e1c>] (sun6i_dsi_probe) from [<c0452ef4>] (platform_drv_probe+0x48/0x9c) [<c0452ef4>] (platform_drv_probe) from [<c04512cc>] (really_probe+0x1dc/0x2c8) [<c04512cc>] (really_probe) from [<c0451518>] (driver_probe_device+0x60/0x160) [<c0451518>] (driver_probe_device) from [<c044f7a4>] (bus_for_each_drv+0x74/0xb8) [<c044f7a4>] (bus_for_each_drv) from [<c045107c>] (__device_attach+0xd0/0x13c) [<c045107c>] (__device_attach) from [<c0450474>] (bus_probe_device+0x84/0x8c) [<c0450474>] (bus_probe_device) from [<c0450900>] (deferred_probe_work_func+0x64/0x90) [<c0450900>] (deferred_probe_work_func) from [<c0135970>] (process_one_work+0x204/0x420) [<c0135970>] (process_one_work) from [<c013690c>] (worker_thread+0x274/0x5a0) [<c013690c>] (worker_thread) from [<c013b3d8>] (kthread+0x11c/0x14c) [<c013b3d8>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c) Exception stack(0xde539fb0 to 0xde539ff8) 9fa0: 00000000 00000000 00000000 00000000 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace b57eb1e5c64c6b8b ]---
random: fast init done
[drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out
With the terms(as described in above diagram) fixed, the panel displays correctly without any timeouts.
--- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +2 -2
@@ -437,9 +437,9 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, SUN6I_DSI_BURST_LINE_SYNC_POINT(SUN6I_DSI_SYNC_POINT)); val =SUN6I_DSI_TCON_DRQ_ENABLE_MODE ; - }else if ((mode->hsync_end - mode->hdisplay) >20 ) { + }else if ((mode->hsync_start - mode->hdisplay) >20 ) {/* Maaaaaagic */ -u16 drq = (mode->hsync_end - mode->hdisplay) -20 ; +u16 drq = (mode->hsync_start - mode->hdisplay) -20 ; drq *=mipi_dsi_pixel_format_to_bpp (device->format); drq /=32 ;
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 66/350 media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 649cd16c438f51d4cd777e71ca1f47f6e0c5e65d ]
If usb_set_interface() failed, iface->cur_altsetting will not be assigned and it will be used in flexcop_usb_transfer_init() It may lead a NULL pointer dereference.
Check usb_set_interface() return value in flexcop_usb_init() and return failed to avoid using this NULL pointer.
--- drivers/media/usb/b2c2/flexcop-usb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/usb/b2c2/flexcop-usb.c +7 -1
@@ -504,7 +504,13 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)static int flexcop_usb_init (struct flexcop_usb *fc_usb) {/* use the alternate setting with the larges buffer */ -usb_set_interface (fc_usb->udev,0 ,1 ); +int ret =usb_set_interface (fc_usb->udev,0 ,1 ); + +if (ret) { +err ("set interface failed." ); +return ret; + } +switch (fc_usb->udev->speed) {case USB_SPEED_LOW :err ("cannot handle USB speed because it is too slow." );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 75/350 MIPS: futex: Emit Loongson3 sync workarounds within asm
In reply to Sasha LevinFrom: Paul Burton <[email protected]>
[ Upstream commit 3c1d3f0979721a39dd2980c97466127ce65aa130 ]
Generate the sync instructions required to workaround Loongson3 LL/SC errata within inline asm blocks, which feels a little safer than doing it from C where strictly speaking the compiler would be well within its rights to insert a memory access between the separate asm statements we previously had, containing sync & ll instructions respectively.
--- arch/mips/include/asm/barrier.h | 13 +++++++------ arch/mips/include/asm/futex.h | 15 +++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-)
arch/mips/include/asm/barrier.h +7 -6
@@ -218,13 +218,14 @@* ordering will be done by smp_llsc_mb() and friends. */ #if defined(CONFIG_WEAK_REORDERING_BEYOND_LLSC ) && defined(CONFIG_SMP ) -#define __WEAK_LLSC_MB " sync \n" -#define smp_llsc_mb () __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory") -#define __LLSC_CLOBBER +# define __WEAK_LLSC_MB sync +# define smp_llsc_mb () \ + __asm__ __volatile__(__stringify(__WEAK_LLSC_MB) : : :"memory") +# define __LLSC_CLOBBER#else -#define __WEAK_LLSC_MB " \n" -#define smp_llsc_mb () do { } while (0) -#define __LLSC_CLOBBER "memory" +# define __WEAK_LLSC_MB +# define smp_llsc_mb () do { } while (0) +# define __LLSC_CLOBBER "memory"#endif #ifdef CONFIG_CPU_CAVIUM_OCTEON
arch/mips/include/asm/futex.h +7 -8
@@ -16,6 +16,7 @@#include <asm/barrier.h> #include <asm/compiler.h> #include <asm/errno.h> +#include <asm/sync.h> #include <asm/war.h> #define __futex_atomic_op (insn, ret, oldval, uaddr, oparg) \
@@ -32,7 +33,7 @@" .set arch=r4000 \n" \"2: sc $1, %2 \n" \" beqzl $1, 1b \n" \ - __WEAK_LLSC_MB \ + __stringify(__WEAK_LLSC_MB) \"3: \n" \" .insn \n" \" .set pop \n" \
@@ -50,19 +51,19 @@ "i" (-EFAULT) \ : "memory"); \ } else if (cpu_has_llsc) { \ - loongson_llsc_mb(); \ __asm__ __volatile__( \ " .set push \n" \ " .set noat \n" \ " .set push \n" \ " .set "MIPS_ISA_ARCH_LEVEL" \n" \ + " " __SYNC(full, loongson3_war) " \n" \ "1: "user_ll("%1", "%4")" # __futex_atomic_op\n" \ " .set pop \n" \ " " insn " \n" \ " .set "MIPS_ISA_ARCH_LEVEL" \n" \ "2: "user_sc("$1", "%2")" \n" \ " beqz $1, 1b \n" \ - __WEAK_LLSC_MB \ + __stringify(__WEAK_LLSC_MB) \"3: \n" \" .insn \n" \" .set pop \n" \
@@ -147,7 +148,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr," .set arch=r4000 \n" "2: sc $1, %2 \n" " beqzl $1, 1b \n" - __WEAK_LLSC_MB + __stringify(__WEAK_LLSC_MB)"3: \n" " .insn \n" " .set pop \n"
@@ -164,13 +165,13 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, "i" (-EFAULT) : "memory"); }else if (cpu_has_llsc) { -loongson_llsc_mb (); __asm__ __volatile__("# futex_atomic_cmpxchg_inatomic \n" " .set push \n" " .set noat \n" " .set push \n" " .set " MIPS_ISA_ARCH_LEVEL " \n" + " " __SYNC(full, loongson3_war) " \n" "1: "user_ll("%1", "%3")" \n"" bne %1, %z4, 3f \n" " .set pop \n"
@@ -178,8 +179,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr," .set " MIPS_ISA_ARCH_LEVEL " \n" "2: "user_sc("$1", "%2")" \n"" beqz $1, 1b \n" - __WEAK_LLSC_MB -"3: \n" + "3: " __SYNC_ELSE(full, loongson3_war, __WEAK_LLSC_MB) "\n"" .insn \n" " .set pop \n" " .section .fixup,\"ax\" \n"
@@ -194,7 +194,6 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT) : "memory"); -loongson_llsc_mb (); }else return -ENOSYS ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 77/350 mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
In reply to Sasha LevinFrom: Navid Emamdoost <[email protected]>
[ Upstream commit d10dcb615c8e29d403a24d35f8310a7a53e3050c ]
In mwifiex_pcie_init_evt_ring, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release for skb and card->evtbd_ring_vbase is added.
--- drivers/net/wireless/marvell/mwifiex/pcie.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +4 -1
@@ -687,8 +687,11 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter)skb_put (skb,MAX_EVENT_SIZE );if (mwifiex_map_pci_memory (adapter, skb,MAX_EVENT_SIZE , -PCI_DMA_FROMDEVICE )) +PCI_DMA_FROMDEVICE )) { +kfree_skb (skb); +kfree (card->evtbd_ring_vbase);return -1 ; + } buf_pa =MWIFIEX_SKB_DMA_ADDR (skb);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 82/350 net/smc: increase device refcount for added link group
In reply to Sasha LevinFrom: Ursula Braun <[email protected]>
[ Upstream commit b3cb53c05f20c5b4026a36a7bbd3010d1f3e0a55 ]
SMCD link groups belong to certain ISM-devices and SMCR link group links belong to certain IB-devices. Increase the refcount for these devices, as long as corresponding link groups exist.
--- net/smc/smc_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/smc/smc_core.c +7 -2
@@ -231,10 +231,12 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini) lgr->conns_all =RB_ROOT ;if (ini->is_smcd) {/* SMC-D specific settings */ +get_device (&ini->ism_dev->dev); lgr->peer_gid = ini->ism_gid; lgr->smcd = ini->ism_dev; }else {/* SMC-R specific settings */ +get_device (&ini->ib_dev->ibdev->dev); lgr->role = smc->listen_smc ?SMC_SERV :SMC_CLNT ;memcpy (lgr->peer_systemid, ini->ib_lcl->id_for_peer,SMC_SYSTEMID_LEN );
@@ -433,10 +435,13 @@ static void smc_lgr_free_bufs(struct smc_link_group *lgr)static void smc_lgr_free (struct smc_link_group *lgr) {smc_lgr_free_bufs (lgr); -if (lgr->is_smcd) +if (lgr->is_smcd) {smc_ism_put_vlan (lgr->smcd, lgr->vlan_id); -else +put_device (&lgr->smcd->dev); + }else {smc_link_clear (&lgr->lnk[SMC_SINGLE_LINK ]); +put_device (&lgr->lnk[SMC_SINGLE_LINK ].smcibdev->ibdev->dev); + }kfree (lgr); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 86/350 crypto: aegis128/simd - build 32-bit ARM for v8 architecture explicitly
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 830536770f968ab33ece123b317e252c269098db ]
Now that the Clang compiler has taken it upon itself to police the compiler command line, and reject combinations for arguments it views as incompatible, the AEGIS128 no longer builds correctly, and errors out like this:
clang-10: warning: ignoring extension 'crypto' because the 'armv7-a' architecture does not support it [-Winvalid-command-line-argument]
So let's switch to armv8-a instead, which matches the crypto-neon-fp-armv8 FPU profile we specify. Since neither were actually supported by GCC versions before 4.8, let's tighten the Kconfig dependencies as well so we won't run into errors when building with an ancient compiler.
--- crypto/Kconfig | 1 + 1 file changed, 1 insertion(+)
crypto/Kconfig +1 -0
@@ -309,6 +309,7 @@ config CRYPTO_AEGIS128 config CRYPTO_AEGIS128_SIMD bool "Support SIMD acceleration for AEGIS-128" depends on CRYPTO_AEGIS128 && ((ARM || ARM64) && KERNEL_MODE_NEON) + depends on !ARM || CC_IS_CLANG || GCC_VERSION >= 40800 default y config CRYPTO_AEGIS128_AESNI_SSE2
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 89/350 media: ti-vpe: vpe: Fix Motion Vector vpdma stride
In reply to Sasha LevinFrom: Benoit Parrot <[email protected]>
[ Upstream commit 102af9b9922f658f705a4b0deaccabac409131bf ]
commit 3dc2046ca78b ("[media] media: ti-vpe: vpe: allow use of user specified stride") and commit da4414eaed15 ("[media] media: ti-vpe: vpdma:
add support for user specified stride") resulted in the Motion Vector stride to be the same as the image stride.
This caused memory corruption in the output image as mentioned in commit 00db969964c8 ("[media] media: ti-vpe: vpe: Fix line stride for output motion vector").
--- drivers/media/platform/ti-vpe/vpe.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/media/platform/ti-vpe/vpe.c +13 -5
@@ -1013,11 +1013,14 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port)dma_addr_t dma_addr;u32 flags =0 ;u32 offset =0 ; +u32 stride;if (port ==VPE_PORT_MV_OUT ) { vpdma_fmt = &vpdma_misc_fmts[VPDMA_DATA_FMT_MV ]; dma_addr = ctx->mv_buf_dma[mv_buf_selector]; q_data = &ctx->q_data[Q_DATA_SRC ]; + stride =ALIGN ((q_data->width * vpdma_fmt->depth) >>3 , +VPDMA_STRIDE_ALIGN ); }else {/* to incorporate interleaved formats */ int plane = fmt->coplanar ? p_data->vb_part :0 ;
@@ -1044,6 +1047,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) }/* Apply the offset */ dma_addr += offset; + stride = q_data->bytesperline[VPE_LUMA ]; }if (q_data->flags &Q_DATA_FRAME_1D )
@@ -1055,7 +1059,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) MAX_W, MAX_H);vpdma_add_out_dtd (&ctx->desc_list, q_data->width, - q_data->bytesperline[VPE_LUMA ], &q_data->c_rect, + stride, &q_data->c_rect, vpdma_fmt, dma_addr,MAX_OUT_WIDTH_REG1 ,MAX_OUT_HEIGHT_REG1 , p_data->channel, flags); }
@@ -1074,10 +1078,13 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port)dma_addr_t dma_addr;u32 flags =0 ;u32 offset =0 ; +u32 stride;if (port ==VPE_PORT_MV_IN ) { vpdma_fmt = &vpdma_misc_fmts[VPDMA_DATA_FMT_MV ]; dma_addr = ctx->mv_buf_dma[mv_buf_selector]; + stride =ALIGN ((q_data->width * vpdma_fmt->depth) >>3 , +VPDMA_STRIDE_ALIGN ); }else {/* to incorporate interleaved formats */ int plane = fmt->coplanar ? p_data->vb_part :0 ;
@@ -1104,6 +1111,7 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port) }/* Apply the offset */ dma_addr += offset; + stride = q_data->bytesperline[VPE_LUMA ];if (q_data->flags &Q_DATA_INTERLACED_SEQ_TB ) {/*
@@ -1139,10 +1147,10 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port)if (p_data->vb_part && fmt->fourcc ==V4L2_PIX_FMT_NV12 ) frame_height /=2 ; -vpdma_add_in_dtd (&ctx->desc_list, q_data->width, - q_data->bytesperline[VPE_LUMA ], &q_data->c_rect, - vpdma_fmt, dma_addr, p_data->channel, field, flags, frame_width, - frame_height,0 ,0 ); +vpdma_add_in_dtd (&ctx->desc_list, q_data->width, stride, + &q_data->c_rect, vpdma_fmt, dma_addr, + p_data->channel, field, flags, frame_width, + frame_height,0 ,0 ); }/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 87/350 misc: fastrpc: fix memory leak from miscdev->name
In reply to Sasha LevinFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 2d10d2d170723e9278282458a6704552dcb77eac ]
Fix a memory leak in miscdev->name by using devm_variant
Orignally reported by kmemleak:
[<ffffff80088b74d8>] kmemleak_alloc+0x50/0x84
[<ffffff80081e015c>] __kmalloc_track_caller+0xe8/0x168
[<ffffff8008371ab0>] kvasprintf+0x78/0x100
[<ffffff8008371c6c>] kasprintf+0x50/0x74
[<ffffff8008507f2c>] fastrpc_rpmsg_probe+0xd8/0x20c
[<ffffff80086b63b4>] rpmsg_dev_probe+0xa8/0x148
[<ffffff80084de50c>] really_probe+0x208/0x248
[<ffffff80084de2dc>] driver_probe_device+0x98/0xc0
[<ffffff80084dec6c>] __device_attach_driver+0x9c/0xac
[<ffffff80084dca8c>] bus_for_each_drv+0x60/0x8c
[<ffffff80084de64c>] __device_attach+0x8c/0x100
[<ffffff80084de6e0>] device_initial_probe+0x20/0x28
[<ffffff80084dcbd0>] bus_probe_device+0x34/0x7c
[<ffffff80084da32c>] device_add+0x420/0x498
[<ffffff80084da680>] device_register+0x24/0x2c--- drivers/misc/fastrpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/fastrpc.c +2 -2
@@ -1430,8 +1430,8 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)return -ENOMEM ; data->miscdev.minor =MISC_DYNAMIC_MINOR ; - data->miscdev.name =kasprintf (GFP_KERNEL ,"fastrpc-%s" , - domains[domain_id]); + data->miscdev.name =devm_kasprintf (rdev,GFP_KERNEL ,"fastrpc-%s" , + domains[domain_id]); data->miscdev.fops = &fastrpc_fops; err =misc_register (&data->miscdev);if (err)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 96/350 drm/amd/display: wait for set pipe mcp command completion
In reply to Sasha LevinFrom: Josip Pavic <[email protected]>
[ Upstream commit 15caeabc5787c15babad7ee444afe9c26df1c8b3 ]
[Why]
When the driver sends a pipe set command to the DMCU FW, it does not wait for the command to complete. This can lead to unpredictable behavior if, for example, the driver were to request a pipe disable to the FW via MCP, then power down some hardware before the firmware has completed processing the command.
[How]
Wait for the DMCU FW to finish processing set pipe commands
--- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +3 -0
@@ -77,6 +77,9 @@ static bool dce_abm_set_pipe(struct abm *abm, uint32_t controller_id)/* notifyDMCUMsg */ REG_UPDATE (MASTER_COMM_CNTL_REG ,MASTER_COMM_INTERRUPT ,1 ); +REG_WAIT (MASTER_COMM_CNTL_REG ,MASTER_COMM_INTERRUPT ,0 , +1 ,80000 ); +return true; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 93/350 media: ti-vpe: vpe: fix a v4l2-compliance failure causing a kernel panic
In reply to Sasha LevinFrom: Benoit Parrot <[email protected]>
[ Upstream commit a37980ac5be29b83da67bf7d571c6bd9f90f8e45 ]
v4l2-compliance fails with this message:
warn: v4l2-test-formats.cpp(717): \
TRY_FMT cannot handle an invalid pixelformat.
test VIDIOC_TRY_FMT: FAIL
This causes the following kernel panic:
Unable to handle kernel paging request at virtual address 56595561 pgd = ecd80e00 *pgd=00000000 Internal error: Oops: 205 [#1] PREEMPT SMP ARM ... CPU: 0 PID: 930 Comm: v4l2-compliance Not tainted \ 4.14.62-01715-gc8cd67f49a19 #1 Hardware name: Generic DRA72X (Flattened Device Tree)
task: ece44d80 task.stack: ecc6e000
PC is at __vpe_try_fmt+0x18c/0x2a8 [ti_vpe]
LR is at 0x8
Because the driver fails to properly check the 'num_planes' values for proper ranges it ends up accessing out of bound data causing the kernel panic.
Since this driver only handle single or dual plane pixel format, make sure the provided value does not exceed 2 planes.
--- drivers/media/platform/ti-vpe/vpe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/ti-vpe/vpe.c +1 -1
@@ -1629,7 +1629,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, &pix->height,MIN_H ,MAX_H ,H_ALIGN , S_ALIGN); -if (!pix->num_planes) +if (!pix->num_planes || pix->num_planes >2 ) pix->num_planes = fmt->coplanar ?2 :1 ;else if (pix->num_planes >1 && !fmt->coplanar) pix->num_planes =1 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 95/350 drm/amd/display: Properly round nominal frequency for SPD
In reply to Sasha LevinFrom: Aric Cyr <[email protected]>
[ Upstream commit c59802313e84bede954235b3a5dd0dd5325f49c5 ]
[Why]
Some displays rely on the SPD verticle frequency maximum value. Must round the calculated refresh rate to the nearest integer.
[How]
Round the nominal calculated refresh rate to the nearest whole integer.
--- .../gpu/drm/amd/display/modules/freesync/freesync.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +8 -5
@@ -743,6 +743,10 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, nominal_field_rate_in_uhz =mod_freesync_calc_nominal_field_rate (stream); +/* Rounded to the nearest Hz */ + nominal_field_rate_in_uhz =1000000ULL * +div_u64 (nominal_field_rate_in_uhz +500000 ,1000000 ); + min_refresh_in_uhz = in_config->min_refresh_in_uhz; max_refresh_in_uhz = in_config->max_refresh_in_uhz;
@@ -996,14 +1000,13 @@ unsigned long long mod_freesync_calc_nominal_field_rate( const struct dc_stream_state *stream) {unsigned long long nominal_field_rate_in_uhz =0 ; +unsigned int total = stream->timing.h_total * stream->timing.v_total; -/* Calculate nominal field rate for stream */ +/* Calculate nominal field rate for stream, rounded up to nearest integer */ nominal_field_rate_in_uhz = stream->timing.pix_clk_100hz /10 ; nominal_field_rate_in_uhz *=1000ULL *1000ULL *1000ULL ; - nominal_field_rate_in_uhz =div_u64 (nominal_field_rate_in_uhz, - stream->timing.h_total); - nominal_field_rate_in_uhz =div_u64 (nominal_field_rate_in_uhz, - stream->timing.v_total); + + nominal_field_rate_in_uhz =div_u64 (nominal_field_rate_in_uhz, total);return nominal_field_rate_in_uhz; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 101/350 extcon: sm5502: Reset registers during initialization
In reply to Sasha LevinFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 6942635032cfd3e003e980d2dfa4e6323a3ce145 ]
On some devices (e.g. Samsung Galaxy A5 (2015)), the bootloader seems to keep interrupts enabled for SM5502 when booting Linux. Changing the cable state (i.e. plugging in a cable) - until the driver is loaded - will therefore produce an interrupt that is never read.
In this situation, the cable state will be stuck forever on the initial state because SM5502 stops sending interrupts. This can be avoided by clearing those pending interrupts after the driver has been loaded.
One way to do this is to reset all registers to default state by writing to SM5502_REG_RESET. This ensures that we start from a clean state, with all interrupts disabled.
--- drivers/extcon/extcon-sm5502.c | 4 ++++ drivers/extcon/extcon-sm5502.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/extcon/extcon-sm5502.c +4 -0
@@ -65,6 +65,10 @@ struct sm5502_muic_info {/* Default value of SM5502 register to bring up MUIC device. */ static struct reg_data sm5502_reg_data[] = { { + .reg =SM5502_REG_RESET , + .val =SM5502_REG_RESET_MASK , + .invert = true, + }, { .reg =SM5502_REG_CONTROL , .val =SM5502_REG_CONTROL_MASK_INT_MASK , .invert = false,
drivers/extcon/extcon-sm5502.h +2 -0
@@ -237,6 +237,8 @@ enum sm5502_reg {#define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) +#define SM5502_REG_RESET_MASK (0x1) +/* SM5502 Interrupts */ enum sm5502_irq {/* INT1 */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 98/350 drm/amd/display: add new active dongle to existent w/a
In reply to Sasha LevinFrom: Vitaly Prosyak <[email protected]>
[ Upstream commit 566b4252fe9da9582dde008c5e9c3eb7c136e348 ]
[Why & How]
Dongle 0x00E04C power down all internal circuits including AUX communication preventing reading DPCD table. Encoder will skip DP RX power down on disable output to keep receiver powered all the time.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 1 + drivers/gpu/drm/amd/display/include/ddc_service_types.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -0
@@ -2691,6 +2691,7 @@ static void dp_wa_power_up_0010FA(struct dc_link *link, uint8_t *dpcd_data,* keep receiver powered all the time.*/ case DP_BRANCH_DEVICE_ID_0010FA :case DP_BRANCH_DEVICE_ID_0080E1 : +case DP_BRANCH_DEVICE_ID_00E04C : link->wa_flags.dp_keep_receiver_powered = true;break ;
drivers/gpu/drm/amd/display/include/ddc_service_types.h +2 -0
@@ -31,6 +31,8 @@#define DP_BRANCH_DEVICE_ID_0022B9 0x0022B9#define DP_BRANCH_DEVICE_ID_00001A 0x00001A#define DP_BRANCH_DEVICE_ID_0080E1 0x0080e1 +#define DP_BRANCH_DEVICE_ID_90CC24 0x90CC24 +#define DP_BRANCH_DEVICE_ID_00E04C 0x00E04Cenum ddc_result {DDC_RESULT_UNKNOWN =0 ,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 106/350 ath10k: Correct error handling of dma_map_single()
In reply to Sasha LevinFrom: Bjorn Andersson <[email protected]>
[ Upstream commit d43810b2c1808ac865aa1a2a2c291644bf95345c ]
The return value of dma_map_single() should be checked for errors using dma_mapping_error() and the skb has been dequeued so it needs to be freed.
This was found when enabling CONFIG_DMA_API_DEBUG and it warned about the missing dma_mapping_error() call.
--- drivers/net/wireless/ath/ath10k/mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +3 -1
@@ -3903,8 +3903,10 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) ar->running_fw->fw_file.fw_features)) { paddr =dma_map_single (ar->dev, skb->data, skb->len,DMA_TO_DEVICE ); -if (!paddr) +if (dma_mapping_error (ar->dev, paddr)) { +ieee80211_free_txskb (ar->hw, skb);continue ; + } ret =ath10k_wmi_mgmt_tx_send (ar, skb, paddr);if (ret) { ath10k_warn(ar, "failed to transmit management frame by ref via WMI: %d\n",
Signature · 7 lines
2.20.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 102/350 drm/amd/display: Program DWB watermarks from correct state
In reply to Sasha LevinFrom: Julian Parkin <[email protected]>
[ Upstream commit edb922b022c0c94805c4ffad202b3edff83d76f0 ]
[Why]
When diags adds a DWB via a stream update, we calculate MMHUBBUB paramaters, but dc->current_state has not yet been updated when the DWB programming happens. This leads to overflow on high bandwidth tests since the incorrect MMHUBBUB arbitration parameters are programmed.
[How]
Pass the updated context down to the (enable|update)_writeback functions so that they can use the correct watermarks when programming MMHUBBUB.
--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++-- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 5 +++-- drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +2 -2
@@ -423,10 +423,10 @@ bool dc_stream_add_writeback(struct dc *dc,if (dwb->funcs->is_enabled (dwb)) {/* writeback pipe already enabled, only need to update */ - dc->hwss.update_writeback (dc, stream_status, wb_info); + dc->hwss.update_writeback (dc, stream_status, wb_info, dc->current_state); }else {/* Enable writeback pipe from scratch*/ - dc->hwss.enable_writeback (dc, stream_status, wb_info); + dc->hwss.enable_writeback (dc, stream_status, wb_info, dc->current_state); } }
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +3 -2
@@ -1337,7 +1337,8 @@ bool dcn20_update_bandwidth(static void dcn20_enable_writeback (struct dc *dc,const struct dc_stream_status *stream_status, -struct dc_writeback_info *wb_info) +struct dc_writeback_info *wb_info, +struct dc_state *context) {struct dwbc *dwb;struct mcif_wb *mcif_wb;
@@ -1354,7 +1355,7 @@ static void dcn20_enable_writeback( optc->funcs->set_dwb_source (optc, wb_info->dwb_pipe_inst);/* set MCIF_WB buffer and arbitration configuration */ mcif_wb->funcs->config_mcif_buf (mcif_wb, &wb_info->mcif_buf_params, wb_info->dwb_params.dest_height); - mcif_wb->funcs->config_mcif_arb (mcif_wb, &dc->current_state->bw_ctx.bw.dcn.bw_writeback.mcif_wb_arb[wb_info->dwb_pipe_inst]); + mcif_wb->funcs->config_mcif_arb (mcif_wb, &context->bw_ctx.bw.dcn.bw_writeback.mcif_wb_arb[wb_info->dwb_pipe_inst]);/* Enable MCIF_WB */ mcif_wb->funcs->enable_mcif (mcif_wb);/* Enable DWB */
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +4 -2
@@ -321,10 +321,12 @@ struct hw_sequencer_funcs { struct dc_state *context);void (*update_writeback)(struct dc *dc,const struct dc_stream_status *stream_status, -struct dc_writeback_info *wb_info); +struct dc_writeback_info *wb_info, +struct dc_state *context);void (*enable_writeback)(struct dc *dc,const struct dc_stream_status *stream_status, -struct dc_writeback_info *wb_info); +struct dc_writeback_info *wb_info, +struct dc_state *context);void (*disable_writeback)(struct dc *dc,unsigned int dwb_pipe_inst);#endif
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 103/350 syscalls/x86: Use COMPAT_SYSCALL_DEFINE0 for IA32 (rt_)sigreturn
In reply to Sasha LevinFrom: Sami Tolvanen <[email protected]>
[ Upstream commit 00198a6eaf66609de5e4de9163bb42c7ca9dd7b7 ]
Use COMPAT_SYSCALL_DEFINE0 to define (rt_)sigreturn() syscalls to replace sys32_sigreturn() and sys32_rt_sigreturn(). This fixes indirect call mismatches with Control-Flow Integrity (CFI) checking.
--- arch/x86/entry/syscalls/syscall_32.tbl | 4 ++-- arch/x86/ia32/ia32_signal.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/x86/entry/syscalls/syscall_32.tbl +2 -2
@@ -130,7 +130,7 @@ 116 i386 sysinfo sys_sysinfo __ia32_compat_sys_sysinfo 117 i386 ipc sys_ipc __ia32_compat_sys_ipc 118 i386 fsync sys_fsync __ia32_sys_fsync -119 i386 sigreturn sys_sigreturn sys32_sigreturn +119 i386 sigreturn sys_sigreturn __ia32_compat_sys_sigreturn 120 i386 clone sys_clone __ia32_compat_sys_x86_clone 121 i386 setdomainname sys_setdomainname __ia32_sys_setdomainname 122 i386 uname sys_newuname __ia32_sys_newuname
@@ -184,7 +184,7 @@ 170 i386 setresgid sys_setresgid16 __ia32_sys_setresgid16 171 i386 getresgid sys_getresgid16 __ia32_sys_getresgid16 172 i386 prctl sys_prctl __ia32_sys_prctl -173 i386 rt_sigreturn sys_rt_sigreturn sys32_rt_sigreturn +173 i386 rt_sigreturn sys_rt_sigreturn __ia32_compat_sys_rt_sigreturn 174 i386 rt_sigaction sys_rt_sigaction __ia32_compat_sys_rt_sigaction 175 i386 rt_sigprocmask sys_rt_sigprocmask __ia32_compat_sys_rt_sigprocmask 176 i386 rt_sigpending sys_rt_sigpending __ia32_compat_sys_rt_sigpending
arch/x86/ia32/ia32_signal.c +3 -2
@@ -21,6 +21,7 @@#include <linux/personality.h> #include <linux/compat.h> #include <linux/binfmts.h> +#include <linux/syscalls.h> #include <asm/ucontext.h> #include <linux/uaccess.h> #include <asm/fpu/internal.h>
@@ -118,7 +119,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,return err; } -asmlinkage long sys32_sigreturn (void ) +COMPAT_SYSCALL_DEFINE0 (sigreturn) {struct pt_regs *regs =current_pt_regs ();struct sigframe_ia32 __user *frame = (struct sigframe_ia32 __user *)(regs->sp-8 );
@@ -144,7 +145,7 @@ asmlinkage long sys32_sigreturn(void)return 0 ; } -asmlinkage long sys32_rt_sigreturn (void ) +COMPAT_SYSCALL_DEFINE0 (rt_sigreturn) {struct pt_regs *regs =current_pt_regs ();struct rt_sigframe_ia32 __user *frame;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 105/350 iio: chemical: atlas-ph-sensor: fix iio_triggered_buffer_predisable() position
In reply to Sasha LevinFrom: Alexandru Ardelean <[email protected]>
[ Upstream commit 0c8a6e72f3c04bfe92a64e5e0791bfe006aabe08 ]
The iio_triggered_buffer_{predisable,postenable} functions attach/detach the poll functions.
The iio_triggered_buffer_predisable() should be called last, to detach the poll func after the devices has been suspended.
The position of iio_triggered_buffer_postenable() is correct.
Note this is not stable material. It's a fix in the logical model rather fixing an actual bug. These are being tidied up throughout the subsystem to allow more substantial rework that was blocked by variations in how things were done.
--- drivers/iio/chemical/atlas-ph-sensor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/chemical/atlas-ph-sensor.c +4 -4
@@ -323,16 +323,16 @@ static int atlas_buffer_predisable(struct iio_dev *indio_dev)struct atlas_data *data =iio_priv (indio_dev);int ret; - ret =iio_triggered_buffer_predisable (indio_dev); + ret =atlas_set_interrupt (data, false);if (ret)return ret; - ret =atlas_set_interrupt (data, false); +pm_runtime_mark_last_busy (&data->client->dev); + ret =pm_runtime_put_autosuspend (&data->client->dev);if (ret)return ret; -pm_runtime_mark_last_busy (&data->client->dev); -return pm_runtime_put_autosuspend (&data->client->dev); +return iio_triggered_buffer_predisable (indio_dev); }static const struct iio_trigger_ops atlas_interrupt_trigger_ops = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 108/350 drm/bridge: dw-hdmi: Restore audio when setting a mode
In reply to Sasha LevinFrom: Daniel Kurtz <[email protected]>
[ Upstream commit fadfee3f9d8f114435a8a3e9f83a227600d89de7 ]
When setting a new display mode, dw_hdmi_setup() calls dw_hdmi_enable_video_path(), which disables all hdmi clocks, including the audio clock.
We should only (re-)enable the audio clock if audio was already enabled when setting the new mode.
Without this patch, on RK3288, there will be HDMI audio on some monitors if i2s was played to headphone when the monitor was plugged. ACER H277HU and ASUS PB278 are two of the monitors showing this issue.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -1
@@ -2033,7 +2033,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)/* HDMI Initialization Step E - Configure audio */ hdmi_clk_regenerator_update_pixel_clock (hdmi); -hdmi_enable_audio_clk (hdmi, true); +hdmi_enable_audio_clk (hdmi, hdmi->audio_enable); }/* not for DVI mode */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 107/350 rtw88: coex: Set 4 slot mode for A2DP
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 12078aae453556a88fb46777b7cc5fc97f867b7c ]
With shallow buffer size, certain BT devices have active A2DP flow control to fill buffer frequently. If the slot is not at BT side, data can't be sent successfully to BT devices, and will cause audio glitch.
To resolve this issue, this commit splits TUs into 4-slots instead of 2-slot for all of the A2DP related coexistence strategies. That makes BT have higher opportunity to fill the A2DP buffer in time, and the audio quality could be more stable and smooth.
--- drivers/net/wireless/realtek/rtw88/coex.c | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/net/wireless/realtek/rtw88/coex.c +15 -9
@@ -1308,6 +1308,7 @@ static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev)struct rtw_chip_info *chip = rtwdev->chip;bool wl_hi_pri = false;u8 table_case, tdma_case; +u32 slot_type =0 ;if (coex_stat->wl_linkscan_proc || coex_stat->wl_hi_pri_task1 || coex_stat->wl_hi_pri_task2)
@@ -1318,14 +1319,16 @@ static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev)if (wl_hi_pri) { table_case =15 ;if (coex_stat->bt_a2dp_exist && - !coex_stat->bt_pan_exist) + !coex_stat->bt_pan_exist) { + slot_type =TDMA_4SLOT ; tdma_case =11 ; -else if (coex_stat->wl_hi_pri_task1) + }else if (coex_stat->wl_hi_pri_task1) { tdma_case =6 ; -else if (!coex_stat->bt_page) + }else if (!coex_stat->bt_page) { tdma_case =8 ; -else + }else { tdma_case =9 ; + } }else if (coex_stat->wl_connected) { table_case =10 ; tdma_case =10 ;
@@ -1361,7 +1364,7 @@ static void rtw_coex_action_bt_inquiry(struct rtw_dev *rtwdev)rtw_coex_set_ant_path (rtwdev, false,COEX_SET_ANT_2G );rtw_coex_set_rf_para (rtwdev, chip->wl_rf_para_rx[0 ]);rtw_coex_table (rtwdev, table_case); -rtw_coex_tdma (rtwdev, false, tdma_case); +rtw_coex_tdma (rtwdev, false, tdma_case | slot_type); }static void rtw_coex_action_bt_hfp (struct rtw_dev *rtwdev)
@@ -1475,13 +1478,13 @@ static void rtw_coex_action_bt_a2dp(struct rtw_dev *rtwdev)if (efuse->share_ant) {/* Shared-Ant */ + slot_type =TDMA_4SLOT ; +if (coex_stat->wl_gl_busy && coex_stat->wl_noisy_level ==0 ) table_case =10 ;else table_case =9 ; - slot_type =TDMA_4SLOT ; -if (coex_stat->wl_gl_busy) tdma_case =13 ;else
@@ -1585,13 +1588,14 @@ static void rtw_coex_action_bt_a2dp_hid(struct rtw_dev *rtwdev)if (efuse->share_ant) {/* Shared-Ant */ + slot_type =TDMA_4SLOT ; +if (coex_stat->bt_ble_exist) table_case =26 ;else table_case =9 ;if (coex_stat->wl_gl_busy) { - slot_type =TDMA_4SLOT ; tdma_case =13 ; }else { tdma_case =14 ;
@@ -1794,10 +1798,12 @@ static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev)struct rtw_efuse *efuse = &rtwdev->efuse;struct rtw_chip_info *chip = rtwdev->chip;u8 table_case, tdma_case; +u32 slot_type =0 ;if (efuse->share_ant) {/* Shared-Ant */ if (coex_stat->bt_a2dp_exist) { + slot_type =TDMA_4SLOT ; table_case =9 ; tdma_case =11 ; }else {
@@ -1818,7 +1824,7 @@ static void rtw_coex_action_wl_linkscan(struct rtw_dev *rtwdev)rtw_coex_set_ant_path (rtwdev, true,COEX_SET_ANT_2G );rtw_coex_set_rf_para (rtwdev, chip->wl_rf_para_rx[0 ]);rtw_coex_table (rtwdev, table_case); -rtw_coex_tdma (rtwdev, false, tdma_case); +rtw_coex_tdma (rtwdev, false, tdma_case | slot_type); }static void rtw_coex_action_wl_not_connected (struct rtw_dev *rtwdev)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 111/350 perf test: Avoid infinite loop for task exit case
In reply to Sasha LevinFrom: Leo Yan <[email protected]>
[ Upstream commit 791ce9c48c79210d2ffcdbe69421e7783b32921f ]
When executing the task exit testing case, perf gets stuck in an endless loop this case and doesn't return back on Arm64 Juno board.
After digging into this issue, since Juno board has Arm's big.LITTLE CPUs, thus the PMUs are not compatible between the big CPUs and little CPUs. This leads to a PMU event that cannot be enabled properly when the traced task is migrated from one variant's CPU to another variant. Finally, the test case runs into infinite loop for cannot read out any event data after return from polling.
Eventually, we need to work out formal solution to allow PMU events can be freely migrated from one CPU variant to another, but this is a difficult task and a different topic. This patch tries to fix the Perf test case to avoid infinite loop, when the testing detects 1000 times retrying for reading empty events, it will directly bail out and return failure. This allows the Perf tool can continue its other test cases.
--- tools/perf/tests/task-exit.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/tests/task-exit.c +8 -0
@@ -53,6 +53,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedstruct perf_cpu_map *cpus;struct perf_thread_map *threads;struct mmap *md; +int retry_count =0 ;signal (SIGCHLD , sig_handler);
@@ -132,6 +133,13 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused out_init:if (!exited || !nr_exit) {evlist__poll (evlist,-1 ); + +if (retry_count++ >1000 ) { +pr_debug ("Failed after retrying 1000 times\n" ); + err =-1 ; + goto out_free_maps; + } + goto retry; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 115/350 drm/amd/powerplay: avoid disabling ECC if RAS is enabled for VEGA20
In reply to Sasha LevinFrom: Le Ma <[email protected]>
[ Upstream commit df9331e561dab0a451cbd6a679ee88a95f306fd6 ]
Program THM_BACO_CNTL.SOC_DOMAIN_IDLE=1 will tell VBIOS to disable ECC when BACO exit. This can save BACO exit time by PSP on none-ECC SKU. Drop the setting for ECC supported SKU.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_baco.c +7 -5
@@ -29,7 +29,7 @@#include "vega20_baco.h" #include "vega20_smumgr.h" - +#include "amdgpu_ras.h" static const struct soc15_baco_cmd_entry clean_baco_tbl[] = {
@@ -74,6 +74,7 @@ int vega20_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state)int vega20_baco_set_state (struct pp_hwmgr *hwmgr,enum BACO_STATE state) {struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); +struct amdgpu_ras *ras =amdgpu_ras_get_context (adev);enum BACO_STATE cur_state;uint32_t data;
@@ -84,10 +85,11 @@ int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state)return 0 ;if (state ==BACO_STATE_IN ) { - data =RREG32_SOC15 (THM ,0 , mmTHM_BACO_CNTL); - data |=0x80000000 ; -WREG32_SOC15 (THM ,0 , mmTHM_BACO_CNTL, data); - +if (!ras || !ras->supported) { + data =RREG32_SOC15 (THM ,0 , mmTHM_BACO_CNTL); + data |=0x80000000 ; +WREG32_SOC15 (THM ,0 , mmTHM_BACO_CNTL, data); + }if (smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_EnterBaco,0 ))return -EINVAL ;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 112/350 perf vendor events arm64: Fix Hisi hip08 DDRC PMU eventname
In reply to Sasha LevinFrom: John Garry <[email protected]>
[ Upstream commit 84b0975f4853ba32d2d9b3c19ffa2b947f023fb3 ]
The "EventName" for the DDRC precharge command event is incorrect, so fix it.
--- .../perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/pmu-events/arch/arm64/hisilicon/hip08/uncore-ddrc.json +1 -1
@@ -15,7 +15,7 @@ }, { "EventCode": "0x04", - "EventName": "uncore_hisi_ddrc.flux_wr", + "EventName": "uncore_hisi_ddrc.pre_cmd", "BriefDescription": "DDRC precharge commands", "PublicDescription": "DDRC precharge commands", "Unit": "hisi_sccl,ddrc",
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 119/350 Bluetooth: missed cpu_to_le16 conversion in hci_init4_req
In reply to Sasha LevinFrom: "Ben Dooks (Codethink)" <[email protected]>
[ Upstream commit 727ea61a5028f8ac96f75ab34cb1b56e63fd9227 ]
It looks like in hci_init4_req() the request is being initialised from cpu-endian data but the packet is specified to be little-endian. This causes an warning from sparse due to __le16 to u16 conversion.
Fix this by using cpu_to_le16() on the two fields in the packet.
net/bluetooth/hci_core.c:845:27: warning: incorrect type in assignment (different base types)net/bluetooth/hci_core.c:845:27: expected restricted __le16 [usertype] tx_lennet/bluetooth/hci_core.c:845:27: got unsigned short [usertype] le_max_tx_lennet/bluetooth/hci_core.c:846:28: warning: incorrect type in assignment (different base types)net/bluetooth/hci_core.c:846:28: expected restricted __le16 [usertype] tx_timenet/bluetooth/hci_core.c:846:28: got unsigned short [usertype] le_max_tx_time
--- net/bluetooth/hci_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/hci_core.c +2 -2
@@ -842,8 +842,8 @@ static int hci_init4_req(struct hci_request *req, unsigned long opt)if (hdev->le_features[0 ] &HCI_LE_DATA_LEN_EXT ) {struct hci_cp_le_write_def_data_len cp; - cp.tx_len = hdev->le_max_tx_len; - cp.tx_time = hdev->le_max_tx_time; + cp.tx_len =cpu_to_le16 (hdev->le_max_tx_len); + cp.tx_time =cpu_to_le16 (hdev->le_max_tx_time);hci_req_add (req,HCI_OP_LE_WRITE_DEF_DATA_LEN ,sizeof (cp), &cp); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 121/350 Bluetooth: hci_core: fix init for HCI_USER_CHANNEL
In reply to Sasha LevinFrom: Mattijs Korpershoek <[email protected]>
[ Upstream commit eb8c101e28496888a0dcfe16ab86a1bee369e820 ]
During the setup() stage, HCI device drivers expect the chip to acknowledge its setup() completion via vendor specific frames.
If userspace opens() such HCI device in HCI_USER_CHANNEL [1] mode, the vendor specific frames are never tranmitted to the driver, as they are filtered in hci_rx_work().
Allow HCI devices which operate in HCI_USER_CHANNEL mode to receive frames if the HCI device is is HCI_INIT state.
[1] https://www.spinics.net/lists/linux-bluetooth/msg37345.html
--- net/bluetooth/hci_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/bluetooth/hci_core.c +8 -1
@@ -4440,7 +4440,14 @@ static void hci_rx_work(struct work_struct *work)hci_send_to_sock (hdev, skb); } -if (hci_dev_test_flag (hdev,HCI_USER_CHANNEL )) { +/* If the device has been opened in HCI_USER_CHANNEL, +* the userspace has exclusive access to device. +* When device is HCI_INIT, we still need to process +* the data packets to the driver in order +* to complete its setup(). +*/ +if (hci_dev_test_flag (hdev,HCI_USER_CHANNEL ) && + !test_bit (HCI_INIT , &hdev->flags)) {kfree_skb (skb);continue ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 122/350 selftests: Fix O= and KBUILD_OUTPUT handling for relative paths
In reply to Sasha LevinFrom: Shuah Khan <[email protected]>
[ Upstream commit 303e6218ecec475d5bc3e5922dec770ee5baf107 ]
Fix O= and KBUILD_OUTPUT handling for relative paths.
export KBUILD_OUTPUT=../kselftest_size
make TARGETS=size kselftest-all
or
make O=../kselftest_size TARGETS=size kselftest-all
In both of these cases, targets get built in ../kselftest_size which is a one level up from the size test directory.
make[1]: Entering directory '/mnt/data/lkml/kselftest_size'
make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
ARCH=x86 -C ../../.. headers_install INSTALL ../kselftest_size/usr/include
gcc -static -ffreestanding -nostartfiles -s get_size.c -o ../kselftest_size/size/get_size/usr/bin/ld: cannot open output file ../kselftest_size/size/get_size: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [../lib.mk:138: ../kselftest_size/size/get_size] Error 1
make[2]: *** [Makefile:143: all] Error 2
make[1]: *** [/mnt/data/lkml/linux_5.4/Makefile:1221: kselftest-all] Error 2 make[1]: Leaving directory '/mnt/data/lkml/kselftest_size'
make: *** [Makefile:179: sub-make] Error 2
Use abs_objtree exported by the main Makefile.
--- tools/testing/selftests/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/Makefile +3 -2
@@ -86,10 +86,10 @@ override LDFLAGS = endif ifneq ($(O),) - BUILD := $(O) + BUILD := $(abs_objtree) else ifneq ($(KBUILD_OUTPUT),) - BUILD := $(KBUILD_OUTPUT)/kselftest + BUILD := $(abs_objtree)/kselftest else BUILD := $(shell pwd) DEFAULT_INSTALL_HDR_PATH := 1
@@ -102,6 +102,7 @@ include $(top_srcdir)/scripts/subarch.include ARCH ?= $(SUBARCH) export KSFT_KHDR_INSTALL_DONE := 1 export BUILD +#$(info abd_objtree = $(abs_objtree) BUILD = $(BUILD)) # build and run gpio when output directory is the src dir. # gpio has dependency on tools/gpio and builds tools/gpio
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 125/350 drm/amd/display: enable hostvm based on roimmu active for dcn2.1
In reply to Sasha LevinFrom: Dmytro Laktyushkin <[email protected]>
[ Upstream commit 48d92e8eda3d9b61978377e7539bfc5958e850cf ]
Enabling hostvm when ROIMMU is not active seems to break GPUVM. This fixes the issue by not enabling hostvm if ROIMMU is not activated.
--- .../drm/amd/display/dc/dcn21/dcn21_hubbub.c | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c +25 -15
@@ -22,6 +22,7 @@* Authors: AMD * */ +#include <linux/delay.h> #include "dm_services.h" #include "dcn20/dcn20_hubbub.h" #include "dcn21_hubbub.h"
@@ -71,30 +72,39 @@ static uint32_t convert_and_clamp(void dcn21_dchvm_init (struct hubbub *hubbub) {struct dcn20_hubbub *hubbub1 =TO_DCN20_HUBBUB (hubbub); +uint32_t riommu_active; +int i;//Init DCHVM block REG_UPDATE (DCHVM_CTRL0 ,HOSTVM_INIT_REQ ,1 );//Poll until RIOMMU_ACTIVE = 1 -//TODO: Figure out interval us and retry count -REG_WAIT (DCHVM_RIOMMU_STAT0 ,RIOMMU_ACTIVE ,1 ,5 ,100 ); +for (i =0 ; i <100 ; i++) { +REG_GET (DCHVM_RIOMMU_STAT0 ,RIOMMU_ACTIVE , &riommu_active); -//Reflect the power status of DCHUBBUB -REG_UPDATE (DCHVM_RIOMMU_CTRL0 ,HOSTVM_POWERSTATUS ,1 ); +if (riommu_active) +break ; +else +udelay (5 ); + } + +if (riommu_active) { +//Reflect the power status of DCHUBBUB +REG_UPDATE (DCHVM_RIOMMU_CTRL0 ,HOSTVM_POWERSTATUS ,1 ); -//Start rIOMMU prefetching -REG_UPDATE (DCHVM_RIOMMU_CTRL0 ,HOSTVM_PREFETCH_REQ ,1 ); +//Start rIOMMU prefetching +REG_UPDATE (DCHVM_RIOMMU_CTRL0 ,HOSTVM_PREFETCH_REQ ,1 ); -// Enable dynamic clock gating -REG_UPDATE_4 (DCHVM_CLK_CTRL , -HVM_DISPCLK_R_GATE_DIS ,0 , -HVM_DISPCLK_G_GATE_DIS ,0 , -HVM_DCFCLK_R_GATE_DIS ,0 , -HVM_DCFCLK_G_GATE_DIS ,0 ); +// Enable dynamic clock gating +REG_UPDATE_4 (DCHVM_CLK_CTRL , +HVM_DISPCLK_R_GATE_DIS ,0 , +HVM_DISPCLK_G_GATE_DIS ,0 , +HVM_DCFCLK_R_GATE_DIS ,0 , +HVM_DCFCLK_G_GATE_DIS ,0 ); -//Poll until HOSTVM_PREFETCH_DONE = 1 -//TODO: Figure out interval us and retry count -REG_WAIT (DCHVM_RIOMMU_STAT0 ,HOSTVM_PREFETCH_DONE ,1 ,5 ,100 ); +//Poll until HOSTVM_PREFETCH_DONE = 1 +REG_WAIT (DCHVM_RIOMMU_STAT0 ,HOSTVM_PREFETCH_DONE ,1 ,5 ,100 ); + } } static int hubbub21_init_dchub(struct hubbub *hubbub,
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 126/350 drm/amd/display: fix header for RN clk mgr
In reply to Sasha LevinFrom: joseph gravenor <[email protected]>
[ Upstream commit cd83fa1ea9b9431cf1d57ac4179a11bc4393a5b6 ]
[why]
Should always MP0_BASE for any register definition from MP per-IP header files. I belive the reason the linux version of MP1_BASE works is The 0th element of the 0th table of that is identical to the corrisponding value of MP0_BASE in the renoir offset header file. The reason we should only use MP0_BASE is There is only one set of per-IP headers MP that includes all register definitions related to SMU IP block. This IP includes MP0, MP1, MP2 and an ecryption engine that can be used only by MP0. As a result all register definitions from MP file should be based only on MP0_BASE data.
[How]
Change MP1_BASE to MP0_BASE
--- .../gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c +1 -1
@@ -33,7 +33,7 @@#include "mp/mp_12_0_0_sh_mask.h" #define REG (reg_name) \ - (MP1_BASE.instance[0].segment[mm ## reg_name ## _BASE_IDX] + mm ## reg_name) + (MP0_BASE.instance[0].segment[mm ## reg_name ## _BASE_IDX] + mm ## reg_name)#define FN (reg_name, field) \ FD(reg_name##__##field)
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 127/350 drm/amdgpu: fix amdgpu trace event print string format error
In reply to Sasha LevinFrom: Kevin Wang <[email protected]>
[ Upstream commit 2c2fdb8bca290c439e383cfb6857b0c65e528964 ]
the trace event print string format error.
(use integer type to handle string)
before:
amdgpu_test_kev-1556 [002] 138.508781: amdgpu_cs_ioctl:
sched_job=8, timeline=gfx_0.0.0, context=177, seqno=1, ring_name=ffff94d01c207bf0, num_ibs=2
after:
amdgpu_test_kev-1506 [004] 370.703783: amdgpu_cs_ioctl:
sched_job=12, timeline=gfx_0.0.0, context=234, seqno=2, ring_name=gfx_0.0.0, num_ibs=1
change trace event list:
1.amdgpu_cs_ioctl
2.amdgpu_sched_run_job
3.amdgpu_ib_pipe_sync
--- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +9 -9
@@ -170,7 +170,7 @@ TRACE_EVENT(amdgpu_cs_ioctl, __field(unsigned int, context) __field(unsigned int, seqno) __field(struct dma_fence *, fence) - __field(char *, ring_name) + __string(ring, to_amdgpu_ring(job->base.sched)->name) __field(u32, num_ibs) ),
@@ -179,12 +179,12 @@ TRACE_EVENT(amdgpu_cs_ioctl,__assign_str (timeline,AMDGPU_JOB_GET_TIMELINE_NAME (job)) __entry->context = job->base.s_fence->finished.context; __entry->seqno = job->base.s_fence->finished.seqno; - __entry->ring_name =to_amdgpu_ring (job->base.sched)->name; +__assign_str (ring,to_amdgpu_ring (job->base.sched)->name) __entry->num_ibs = job->num_ibs; ),TP_printk ("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u" , __entry->sched_job_id,__get_str (timeline), __entry->context, - __entry->seqno, __entry->ring_name, __entry->num_ibs) + __entry->seqno,__get_str (ring), __entry->num_ibs) ); TRACE_EVENT(amdgpu_sched_run_job,
@@ -195,7 +195,7 @@ TRACE_EVENT(amdgpu_sched_run_job, __string(timeline, AMDGPU_JOB_GET_TIMELINE_NAME(job)) __field(unsigned int, context) __field(unsigned int, seqno) - __field(char *, ring_name) + __string(ring, to_amdgpu_ring(job->base.sched)->name) __field(u32, num_ibs) ),
@@ -204,12 +204,12 @@ TRACE_EVENT(amdgpu_sched_run_job,__assign_str (timeline,AMDGPU_JOB_GET_TIMELINE_NAME (job)) __entry->context = job->base.s_fence->finished.context; __entry->seqno = job->base.s_fence->finished.seqno; - __entry->ring_name =to_amdgpu_ring (job->base.sched)->name; +__assign_str (ring,to_amdgpu_ring (job->base.sched)->name) __entry->num_ibs = job->num_ibs; ),TP_printk ("sched_job=%llu, timeline=%s, context=%u, seqno=%u, ring_name=%s, num_ibs=%u" , __entry->sched_job_id,__get_str (timeline), __entry->context, - __entry->seqno, __entry->ring_name, __entry->num_ibs) + __entry->seqno,__get_str (ring), __entry->num_ibs) );
@@ -468,7 +468,7 @@ TRACE_EVENT(amdgpu_ib_pipe_sync, TP_PROTO(struct amdgpu_job *sched_job, struct dma_fence *fence),TP_ARGS (sched_job, fence),TP_STRUCT__entry ( - __field(const char *,name) + __string(ring, sched_job->base.sched->name);__field (uint64_t ,id ) __field(struct dma_fence *, fence) __field(uint64_t, ctx)
@@ -476,14 +476,14 @@ TRACE_EVENT(amdgpu_ib_pipe_sync, ),TP_fast_assign ( - __entry->name = sched_job->base.sched->name; +__assign_str (ring, sched_job->base.sched->name) __entry->id = sched_job->base.id; __entry->fence = fence; __entry->ctx = fence->context; __entry->seqno = fence->seqno; ),TP_printk ("job ring=%s, id=%llu, need pipe sync to fence=%p, context=%llu, seq=%u" , - __entry->name, __entry->id, +__get_str (ring), __entry->id, __entry->fence, __entry->ctx, __entry->seqno) );
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 88/350 ASoC: SOF: enable sync_write in hdac_bus
In reply to Sasha LevinFrom: Kai Vehmanen <[email protected]>
[ Upstream commit f3416e7144f5d4ba0fc5dcef6ebfff891266c46a ]
Align SOF HDA implementation with snd-hda-intel driver and enable sync_write flag for all supported Intel platforms in SOF. When set, a sync is issued after each verb write.
Sync after write has helped to overcome intermittent delays in system resume flow on Intel Coffee Lake systems, and most recently probe errors related to the HDMI codec on Ice Lake systems.
Matches the snd-hda-intel driver change done in commit 2756d9143aa5 ("ALSA: hda - Fix intermittent CORB/RIRB stall on Intel chips").
--- sound/soc/sof/intel/hda.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/intel/hda.c +1 -0
@@ -268,6 +268,7 @@ static int hda_init(struct snd_sof_dev *sdev) bus->use_posbuf =1 ; bus->bdl_pos_adj =0 ; + bus->sync_write =1 ;mutex_init (&hbus->prepare_mutex); hbus->pci = pci;
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 132/350 selftests/bpf: Make a copy of subtest name
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit f90415e9600c5227131531c0ed11514a2d3bbe62 ]
test_progs never created a copy of subtest name, rather just stored pointer to whatever string test provided. This is bad as that string might be freed or modified by the end of subtest. Fix this by creating a copy of given subtest name when subtest starts.
--- tools/testing/selftests/bpf/test_progs.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
tools/testing/selftests/bpf/test_progs.c +12 -5
@@ -20,7 +20,7 @@ struct prog_test_def {bool tested;bool need_cgroup_cleanup; -const char *subtest_name; +char *subtest_name;int subtest_num;/* store counts before subtest started */
@@ -81,16 +81,17 @@ void test__end_subtest()fprintf (env.stdout,"#%d/%d %s:%s\n" , test->test_num, test->subtest_num, test->subtest_name, sub_error_cnt ?"FAIL" :"OK" ); + +free (test->subtest_name); + test->subtest_name =NULL ; }bool test__start_subtest (const char *name) {struct prog_test_def *test = env.test; -if (test->subtest_name) { +if (test->subtest_name)test__end_subtest (); - test->subtest_name =NULL ; - } test->subtest_num++;
@@ -104,7 +105,13 @@ bool test__start_subtest(const char *name)if (!should_run (&env.subtest_selector, test->subtest_num, name))return false; - test->subtest_name = name; + test->subtest_name =strdup (name); +if (!test->subtest_name) { +fprintf (env.stderr, +"Subtest #%d: failed to copy subtest name!\n" , + test->subtest_num); +return false; + } env.test->old_error_cnt = env.test->error_cnt;return true;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 134/350 net: hns3: log and clear hardware error after reset complete
In reply to Sasha LevinFrom: Jian Shen <[email protected]>
[ Upstream commit 4fdd0bca6152aa201898454e63cbb255a18ae6e9 ]
When device is resetting, the CMDQ service may be stopped until reset completed. If a new RAS error occurs at this moment, it will no be able to clear the RAS source. This patch fixes it by clear the RAS source after reset complete.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +3 -0
@@ -9443,6 +9443,9 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)return ret; } +/* Log and clear the hw errors those already occurred */ +hclge_handle_all_hns_hw_errors (ae_dev); +/* Re-enable the hw error interrupts because * the interrupts get disabled on global reset. */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 136/350 drm/gma500: fix memory disclosures due to uninitialized bytes
In reply to Sasha LevinFrom: Kangjie Lu <[email protected]>
[ Upstream commit ec3b7b6eb8c90b52f61adff11b6db7a8db34de19 ]
"clock" may be copied to "best_clock". Initializing best_clock is not sufficient. The fix initializes clock as well to avoid memory disclosures and informaiton leaks.
--- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/gma500/oaktrail_crtc.c +2 -0
@@ -129,6 +129,7 @@ static bool mrst_sdvo_find_best_pll(const struct gma_limit_t *limit,s32 freq_error, min_error =100000 ;memset (best_clock,0 ,sizeof (*best_clock)); +memset (&clock,0 ,sizeof (clock));for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { for (clock.n = limit->n.min; clock.n <= limit->n.max;
@@ -185,6 +186,7 @@ static bool mrst_lvds_find_best_pll(const struct gma_limit_t *limit,int err = target;memset (best_clock,0 ,sizeof (*best_clock)); +memset (&clock,0 ,sizeof (clock));for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { for (clock.p1 = limit->p1.min; clock.p1 <= limit->p1.max;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 135/350 RDMA/hns: Fix wrong parameters when initial mtt of srq->idx_que
In reply to Sasha LevinFrom: Weihang Li <[email protected]>
[ Upstream commit e8a07de57ea4ca7c2d604871c52826e66899fc70 ]
The parameters npages used to initial mtt of srq->idx_que shouldn't be same with srq's. And page_shift should be calculated from idx_buf_pg_sz. This patch fixes above issues and use field named npage and page_shift in hns_roce_buf instead of two temporary variables to let us use them anywhere.
--- drivers/infiniband/hw/hns/hns_roce_srq.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/infiniband/hw/hns/hns_roce_srq.c +14 -10
@@ -180,8 +180,7 @@ static int create_user_srq(struct hns_roce_srq *srq, struct ib_udata *udata, {struct hns_roce_dev *hr_dev =to_hr_dev (srq->ibsrq.device);struct hns_roce_ib_create_srq ucmd; -u32 page_shift; -u32 npages; +struct hns_roce_buf *buf;int ret;if (ib_copy_from_udata (&ucmd, udata,sizeof (ucmd)))
@@ -191,11 +190,13 @@ static int create_user_srq(struct hns_roce_srq *srq, struct ib_udata *udata,if (IS_ERR (srq->umem))return PTR_ERR (srq->umem); - npages = (ib_umem_page_count (srq->umem) + - (1 << hr_dev->caps.srqwqe_buf_pg_sz) -1 ) / - (1 << hr_dev->caps.srqwqe_buf_pg_sz); - page_shift =PAGE_SHIFT + hr_dev->caps.srqwqe_buf_pg_sz; - ret =hns_roce_mtt_init (hr_dev, npages, page_shift, &srq->mtt); + buf = &srq->buf; + buf->npages = (ib_umem_page_count (srq->umem) + + (1 << hr_dev->caps.srqwqe_buf_pg_sz) -1 ) / + (1 << hr_dev->caps.srqwqe_buf_pg_sz); + buf->page_shift =PAGE_SHIFT + hr_dev->caps.srqwqe_buf_pg_sz; + ret =hns_roce_mtt_init (hr_dev, buf->npages, buf->page_shift, + &srq->mtt);if (ret) goto err_user_buf;
@@ -212,9 +213,12 @@ static int create_user_srq(struct hns_roce_srq *srq, struct ib_udata *udata, goto err_user_srq_mtt; } - ret =hns_roce_mtt_init (hr_dev,ib_umem_page_count (srq->idx_que.umem), -PAGE_SHIFT , &srq->idx_que.mtt); - + buf = &srq->idx_que.idx_buf; + buf->npages =DIV_ROUND_UP (ib_umem_page_count (srq->idx_que.umem), +1 << hr_dev->caps.idx_buf_pg_sz); + buf->page_shift =PAGE_SHIFT + hr_dev->caps.idx_buf_pg_sz; + ret =hns_roce_mtt_init (hr_dev, buf->npages, buf->page_shift, + &srq->idx_que.mtt);if (ret) {dev_err (hr_dev->dev,"hns_roce_mtt_init error for idx que\n" ); goto err_user_idx_mtt;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 139/350 rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot
In reply to Sasha LevinFrom: Chris Chiu <[email protected]>
[ Upstream commit 0eeb91ade90ce06d2fa1e2fcb55e3316b64c203c ]
The RTL8723BU has problems connecting to AP after each warm reboot. Sometimes it returns no scan result, and in most cases, it fails the authentication for unknown reason. However, it works totally fine after cold reboot.
Compare the value of register SYS_CR and SYS_CLK_MAC_CLK_ENABLE for cold reboot and warm reboot, the registers imply that the MAC is already powered and thus some procedures are skipped during driver initialization. Double checked the vendor driver, it reads the SYS_CR and SYS_CLK_MAC_CLK_ENABLE also but doesn't skip any during initialization based on them. This commit only tells the RTL8723BU to do full initialization without checking MAC status.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ 3 files changed, 5 insertions(+)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1 -0
@@ -1341,6 +1341,7 @@ struct rtl8xxxu_fileops { u8 has_s0s1:1; u8 has_tx_report:1; u8 gen2_thermal_meter:1; + u8 needs_full_init:1;u32 adda_1t_init;u32 adda_1t_path_on;u32 adda_2t_path_on_a;
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +1 -0
@@ -1670,6 +1670,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = { .has_s0s1 = 1, .has_tx_report = 1, .gen2_thermal_meter = 1, + .needs_full_init = 1, .adda_1t_init = 0x01c00014, .adda_1t_path_on = 0x01c00014, .adda_2t_path_on_a = 0x01c00014,
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +3 -0
@@ -3902,6 +3902,9 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)else macpower = true; +if (fops->needs_full_init) + macpower = false; + ret = fops->power_on (priv);if (ret <0 ) {dev_warn (dev,"%s: Failed power on\n" , __func__);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 142/350 x86/ioapic: Prevent inconsistent state when moving an interrupt
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit df4393424af3fbdcd5c404077176082a8ce459c4 ]
There is an issue with threaded interrupts which are marked ONESHOT and using the fasteoi handler:
if (IS_ONESHOT())
mask_irq();
....
cond_unmask_eoi_irq()
chip->irq_eoi();
if (setaffinity_pending) {
mask_ioapic();
...
move_affinity();
unmask_ioapic();
}So if setaffinity is pending the interrupt will be moved and then unconditionally unmasked at the ioapic level, which is wrong in two aspects:
1) It should be kept masked up to the point where the threaded handler finished.
2) The physical chip state and the software masked state are inconsistent
Guard both the mask and the unmask with a check for the software masked state. If the line is marked masked then the ioapic line is also masked, so both mask_ioapic() and unmask_ioapic() can be skipped safely.
--- arch/x86/kernel/apic/io_apic.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/io_apic.c +6 -3
@@ -1727,9 +1727,10 @@ static bool io_apic_level_ack_pending(struct mp_chip_data *data)static inline bool ioapic_irqd_mask (struct irq_data *data) { -/* If we are moving the irq we need to mask it */ +/* If we are moving the IRQ we need to mask it */ if (unlikely (irqd_is_setaffinity_pending (data))) { -mask_ioapic_irq (data); +if (!irqd_irq_masked (data)) +mask_ioapic_irq (data);return true; }return false;
@@ -1766,7 +1767,9 @@ static inline void ioapic_irqd_unmask(struct irq_data *data, bool masked)*/ if (!io_apic_level_ack_pending (data->chip_data))irq_move_masked_irq (data); - unmask_ioapic_irq(data); +/* If the IRQ is masked in the core, leave it: */ +if (!irqd_irq_masked (data)) + unmask_ioapic_irq(data); } }#else
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 148/350 media: ad5820: Define entity function
In reply to Sasha LevinFrom: Ricardo Ribalda Delgado <[email protected]>
[ Upstream commit 801ef7c4919efba6b96b5aed1e72844ca69e26d3 ]
Without this patch, media_device_register_entity throws a warning:
dev_warn(mdev->dev,
"Entity type for entity %s was not initialized!\n", entity->name);
--- drivers/media/i2c/ad5820.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ad5820.c +1 -0
@@ -309,6 +309,7 @@ static int ad5820_probe(struct i2c_client *client,v4l2_i2c_subdev_init (&coil->subdev, client, &ad5820_ops); coil->subdev.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; coil->subdev.internal_ops = &ad5820_internal_ops; + coil->subdev.entity.function =MEDIA_ENT_F_LENS ;strscpy (coil->subdev.name,"ad5820 focus" ,sizeof (coil->subdev.name)); ret =media_entity_pads_init (&coil->subdev.entity,0 ,NULL );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 149/350 media: ov5640: Make 2592x1944 mode only available at 15 fps
In reply to Sasha LevinFrom: Benoit Parrot <[email protected]>
[ Upstream commit 981e445454531c9d5ac5d3fa8c0f1bd55262d001 ]
The sensor data sheet clearly state that 2592x1944 only works at 15 fps make sure we don't try to miss configure the pll out of acceptable range.
--- drivers/media/i2c/ov5640.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/i2c/ov5640.c +5 -0
@@ -1611,6 +1611,11 @@ ov5640_find_mode(struct ov5640_dev *sensor, enum ov5640_frame_rate fr, !(mode->hact == 640 && mode->vact == 480))return NULL ; +/* 2592x1944 only works at 15fps max */ +if ((mode->hact ==2592 && mode->vact ==1944 ) && + fr >OV5640_15_FPS ) +return NULL ; +return mode; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 144/350 media: cedrus: Fix undefined shift with a SHIFT_AND_MASK_BITS macro
In reply to Sasha LevinFrom: Paul Kocialkowski <[email protected]>
[ Upstream commit 06eff2150d4db991ca236f3d05a9dc0101475aea ]
We need to shift and mask values at different occasions to fill up cedrus registers. This was done using macros that don't explicitly treat arguments as unsigned, leading to possibly undefined behavior.
Introduce the SHIFT_AND_MASK_BITS macro and use it where possible. In cases where it doesn't apply as-is, explicitly cast to unsigned instead.
This macro should be moved to include/linux/bits.h eventually.
--- .../staging/media/sunxi/cedrus/cedrus_regs.h | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-)
drivers/staging/media/sunxi/cedrus/cedrus_regs.h +17 -14
@@ -10,6 +10,9 @@#ifndef _CEDRUS_REGS_H_#define _CEDRUS_REGS_H_ +#define SHIFT_AND_MASK_BITS (v, h, l) \ + (((unsigned long)(v) << (l)) & GENMASK(h, l)) +/* * Common acronyms and contractions used in register descriptions: * * VLD : Variable-Length Decoder
@@ -37,8 +40,8 @@#define VE_PRIMARY_CHROMA_BUF_LEN 0xc4#define VE_PRIMARY_FB_LINE_STRIDE 0xc8 -#define VE_PRIMARY_FB_LINE_STRIDE_CHROMA (s) (((s) << 16) & GENMASK(31, 16)) -#define VE_PRIMARY_FB_LINE_STRIDE_LUMA (s) (((s) << 0) & GENMASK(15, 0)) +#define VE_PRIMARY_FB_LINE_STRIDE_CHROMA (s) SHIFT_AND_MASK_BITS(s, 31, 16) +#define VE_PRIMARY_FB_LINE_STRIDE_LUMA (s) SHIFT_AND_MASK_BITS(s, 15, 0)#define VE_CHROMA_BUF_LEN 0xe8
@@ -46,7 +49,7 @@#define VE_SECONDARY_OUT_FMT_EXT (0x01 << 30)#define VE_SECONDARY_OUT_FMT_YU12 (0x02 << 30)#define VE_SECONDARY_OUT_FMT_YV12 (0x03 << 30) -#define VE_CHROMA_BUF_LEN_SDRT (l) ((l) & GENMASK(27, 0)) +#define VE_CHROMA_BUF_LEN_SDRT (l) SHIFT_AND_MASK_BITS(l, 27, 0)#define VE_PRIMARY_OUT_FMT 0xec
@@ -69,15 +72,15 @@#define VE_DEC_MPEG_MP12HDR (VE_ENGINE_DEC_MPEG + 0x00) -#define VE_DEC_MPEG_MP12HDR_SLICE_TYPE (t) (((t) << 28) & GENMASK(30, 28)) +#define VE_DEC_MPEG_MP12HDR_SLICE_TYPE (t) SHIFT_AND_MASK_BITS(t, 30, 28)#define VE_DEC_MPEG_MP12HDR_F_CODE_SHIFT (x, y) (24 - 4 * (y) - 8 * (x))#define VE_DEC_MPEG_MP12HDR_F_CODE (__x, __y, __v) \ - (((__v) & GENMASK(3, 0)) << VE_DEC_MPEG_MP12HDR_F_CODE_SHIFT(__x, __y)) + (((unsigned long)(__v) & GENMASK(3, 0)) << VE_DEC_MPEG_MP12HDR_F_CODE_SHIFT(__x, __y))#define VE_DEC_MPEG_MP12HDR_INTRA_DC_PRECISION (p) \ - (((p) << 10) & GENMASK(11, 10)) + SHIFT_AND_MASK_BITS(p, 11, 10)#define VE_DEC_MPEG_MP12HDR_INTRA_PICTURE_STRUCTURE (s) \ - (((s) << 8) & GENMASK(9, 8)) + SHIFT_AND_MASK_BITS(s, 9, 8)#define VE_DEC_MPEG_MP12HDR_TOP_FIELD_FIRST (v) \ ((v) ? BIT(7) : 0)#define VE_DEC_MPEG_MP12HDR_FRAME_PRED_FRAME_DCT (v) \
@@ -98,19 +101,19 @@#define VE_DEC_MPEG_PICCODEDSIZE (VE_ENGINE_DEC_MPEG + 0x08)#define VE_DEC_MPEG_PICCODEDSIZE_WIDTH (w) \ - ((DIV_ROUND_UP((w), 16) << 8) & GENMASK(15, 8)) + SHIFT_AND_MASK_BITS(DIV_ROUND_UP((w), 16), 15, 8)#define VE_DEC_MPEG_PICCODEDSIZE_HEIGHT (h) \ - ((DIV_ROUND_UP((h), 16) << 0) & GENMASK(7, 0)) + SHIFT_AND_MASK_BITS(DIV_ROUND_UP((h), 16), 7, 0)#define VE_DEC_MPEG_PICBOUNDSIZE (VE_ENGINE_DEC_MPEG + 0x0c) -#define VE_DEC_MPEG_PICBOUNDSIZE_WIDTH (w) (((w) << 16) & GENMASK(27, 16)) -#define VE_DEC_MPEG_PICBOUNDSIZE_HEIGHT (h) (((h) << 0) & GENMASK(11, 0)) +#define VE_DEC_MPEG_PICBOUNDSIZE_WIDTH (w) SHIFT_AND_MASK_BITS(w, 27, 16) +#define VE_DEC_MPEG_PICBOUNDSIZE_HEIGHT (h) SHIFT_AND_MASK_BITS(h, 11, 0)#define VE_DEC_MPEG_MBADDR (VE_ENGINE_DEC_MPEG + 0x10) -#define VE_DEC_MPEG_MBADDR_X (w) (((w) << 8) & GENMASK(15, 8)) -#define VE_DEC_MPEG_MBADDR_Y (h) (((h) << 0) & GENMASK(7, 0)) +#define VE_DEC_MPEG_MBADDR_X (w) SHIFT_AND_MASK_BITS(w, 15, 8) +#define VE_DEC_MPEG_MBADDR_Y (h) SHIFT_AND_MASK_BITS(h, 7, 0)#define VE_DEC_MPEG_CTRL (VE_ENGINE_DEC_MPEG + 0x14)
@@ -225,7 +228,7 @@#define VE_DEC_MPEG_IQMINPUT_FLAG_INTRA (0x01 << 14)#define VE_DEC_MPEG_IQMINPUT_FLAG_NON_INTRA (0x00 << 14)#define VE_DEC_MPEG_IQMINPUT_WEIGHT (i, v) \ - (((v) & GENMASK(7, 0)) | (((i) << 8) & GENMASK(13, 8))) + (SHIFT_AND_MASK_BITS(i, 13, 8) | SHIFT_AND_MASK_BITS(v, 7, 0))#define VE_DEC_MPEG_ERROR (VE_ENGINE_DEC_MPEG + 0xc4)#define VE_DEC_MPEG_CRTMBADDR (VE_ENGINE_DEC_MPEG + 0xc8)
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 153/350 media: smiapp: Register sensor after enabling runtime PM on the device
In reply to Sasha LevinFrom: Sakari Ailus <[email protected]>
[ Upstream commit 90c9e4a4dba9f4de331372e745fb1991c1faa598 ]
Earlier it was possible that the parts of the driver that assumed runtime PM was enabled were being called before runtime PM was enabled in the driver's probe function. So enable runtime PM before registering the sub-device.
--- drivers/media/i2c/smiapp/smiapp-core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/media/i2c/smiapp/smiapp-core.c +8 -4
@@ -3101,19 +3101,23 @@ static int smiapp_probe(struct i2c_client *client)if (rval <0 ) goto out_media_entity_cleanup; - rval =v4l2_async_register_subdev_sensor_common (&sensor->src->sd); -if (rval <0 ) - goto out_media_entity_cleanup; -pm_runtime_set_active (&client->dev);pm_runtime_get_noresume (&client->dev);pm_runtime_enable (&client->dev); + + rval =v4l2_async_register_subdev_sensor_common (&sensor->src->sd); +if (rval <0 ) + goto out_disable_runtime_pm; +pm_runtime_set_autosuspend_delay (&client->dev,1000 );pm_runtime_use_autosuspend (&client->dev);pm_runtime_put_autosuspend (&client->dev);return 0 ; +out_disable_runtime_pm: +pm_runtime_disable (&client->dev); + out_media_entity_cleanup:media_entity_cleanup (&sensor->src->sd.entity);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 147/350 media: ov6650: Fix stored frame interval not in sync with hardware
In reply to Sasha LevinFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 57822068dd120386b98891cb151dc20107b63ba7 ]
The driver stores a frame interval value supposed to be in line with hardware state in a device private structure. Since the driver initial submission, the respective field of the structure has never been initialised on device probe. Moreover, if updated from .s_frame_interval(), a new value is stored before it is applied on hardware. If an error occurs during device update, the stored value may no longer reflect hardware state and consecutive calls to .g_frame_interval() may return incorrect information.
Assuming a failed update of the device means its actual state hasn't changed, update the frame interval field of the device private structure with a new value only after it is successfully applied on hardware so it always reflects actual hardware state to the extent possible. Also, initialise the field with hardware default frame interval on device probe.
--- drivers/media/i2c/ov6650.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/media/i2c/ov6650.c +12 -9
@@ -130,6 +130,7 @@#define CLKRC_24MHz 0xc0#define CLKRC_DIV_MASK 0x3f#define GET_CLKRC_DIV (x) (((x) & CLKRC_DIV_MASK) + 1) +#define DEF_CLKRC 0x00#define COMA_RESET BIT(7)#define COMA_QCIF BIT(5)
@@ -758,19 +759,17 @@ static int ov6650_s_frame_interval(struct v4l2_subdev *sd,else if (div >GET_CLKRC_DIV (CLKRC_DIV_MASK )) div =GET_CLKRC_DIV (CLKRC_DIV_MASK ); -/* -* Keep result to be used as tpf limit -* for subsequent clock divider calculations -*/ - priv->tpf.numerator = div; - priv->tpf.denominator =FRAME_RATE_MAX ; + tpf->numerator = div; + tpf->denominator =FRAME_RATE_MAX ; - clkrc =to_clkrc (&priv->tpf, priv->pclk_limit, priv->pclk_max); + clkrc =to_clkrc (tpf, priv->pclk_limit, priv->pclk_max); ret =ov6650_reg_rmw (client,REG_CLKRC , clkrc,CLKRC_DIV_MASK );if (!ret) { - tpf->numerator =GET_CLKRC_DIV (clkrc); - tpf->denominator =FRAME_RATE_MAX ; + priv->tpf.numerator =GET_CLKRC_DIV (clkrc); + priv->tpf.denominator =FRAME_RATE_MAX ; + + *tpf = priv->tpf; }return ret;
@@ -1011,6 +1010,10 @@ static int ov6650_probe(struct i2c_client *client, priv->code =MEDIA_BUS_FMT_YUYV8_2X8 ; priv->colorspace =V4L2_COLORSPACE_JPEG ; +/* Hardware default frame interval */ + priv->tpf.numerator =GET_CLKRC_DIV (DEF_CLKRC ); + priv->tpf.denominator =FRAME_RATE_MAX ; + priv->subdev.internal_ops = &ov6650_internal_ops; ret =v4l2_async_register_subdev (&priv->subdev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 155/350 staging: wilc1000: potential corruption in wilc_parse_join_bss_param()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit d59dc92f1bccd5acde793aebdbb4f7121cf3f9af ]
The "rates_len" value needs to be capped so that the memcpy() doesn't copy beyond the end of the array.
--- drivers/staging/wilc1000/wilc_hif.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/wilc1000/wilc_hif.c +2 -0
@@ -473,6 +473,8 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, rates_ie =cfg80211_find_ie (WLAN_EID_SUPP_RATES , ies->data, ies->len);if (rates_ie) { rates_len = rates_ie[1 ]; +if (rates_len >WILC_MAX_RATES_SUPPORTED ) + rates_len =WILC_MAX_RATES_SUPPORTED ; param->supp_rates[0 ] = rates_len;memcpy (¶m->supp_rates[1 ], rates_ie +2 , rates_len); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 157/350 drm: Don't free jobs in wait_event_interruptible()
In reply to Sasha LevinFrom: Steven Price <[email protected]>
[ Upstream commit 588b9828f0744ca13555c4a35cd0251ac8ad8ad2 ]
drm_sched_cleanup_jobs() attempts to free finished jobs, however because it is called as the condition of wait_event_interruptible() it must not sleep. Unfortunately some free callbacks (notably for Panfrost) do sleep.
Instead let's rename drm_sched_cleanup_jobs() to drm_sched_get_cleanup_job() and simply return a job for processing if there is one. The caller can then call the free_job() callback outside the wait_event_interruptible() where sleeping is possible before re-checking and returning to sleep if necessary.
--- drivers/gpu/drm/scheduler/sched_main.c | 43 ++++++++++++++------------ 1 file changed, 24 insertions(+), 19 deletions(-)
drivers/gpu/drm/scheduler/sched_main.c +24 -19
@@ -632,43 +632,41 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb) }/** -* drm_sched_cleanup_jobs - destroy finished jobs +* drm_sched_get_cleanup_job - fetch the next finished job to be destroyed * * @sched: scheduler instance * -* Remove all finished jobs from the mirror list and destroy them. +* Returns the next finished job from the mirror list (if there is one) +* ready for it to be destroyed. */ -static void drm_sched_cleanup_jobs (struct drm_gpu_scheduler *sched) +static struct drm_sched_job * +drm_sched_get_cleanup_job (struct drm_gpu_scheduler *sched) { +struct drm_sched_job *job;unsigned long flags;/* Don't destroy jobs while the timeout worker is running */ if (sched->timeout !=MAX_SCHEDULE_TIMEOUT && !cancel_delayed_work (&sched->work_tdr)) -return ; - +return NULL ; -while (!list_empty (&sched->ring_mirror_list)) { -struct drm_sched_job *job; +spin_lock_irqsave (&sched->job_list_lock, flags); - job =list_first_entry (&sched->ring_mirror_list, + job =list_first_entry_or_null (&sched->ring_mirror_list, struct drm_sched_job, node); -if (!dma_fence_is_signaled (&job->s_fence->finished)) -break ; -spin_lock_irqsave (&sched->job_list_lock, flags); +if (job &&dma_fence_is_signaled (&job->s_fence->finished)) {/* remove job from ring_mirror_list */ list_del_init (&job->node); -spin_unlock_irqrestore (&sched->job_list_lock, flags); - - sched->ops->free_job (job); + }else { + job =NULL ; +/* queue timeout for next job */ +drm_sched_start_timeout (sched); } -/* queue timeout for next job */ -spin_lock_irqsave (&sched->job_list_lock, flags); -drm_sched_start_timeout (sched);spin_unlock_irqrestore (&sched->job_list_lock, flags); +return job; }/**
@@ -708,12 +706,19 @@ static int drm_sched_main(void *param)struct drm_sched_fence *s_fence;struct drm_sched_job *sched_job;struct dma_fence *fence; +struct drm_sched_job *cleanup_job =NULL ;wait_event_interruptible (sched->wake_up_worker, - (drm_sched_cleanup_jobs (sched), + (cleanup_job =drm_sched_get_cleanup_job (sched)) || (!drm_sched_blocked (sched) && (entity =drm_sched_select_entity (sched))) || -kthread_should_stop ())); +kthread_should_stop ()); + +if (cleanup_job) { + sched->ops->free_job (cleanup_job); +/* queue timeout for next job */ +drm_sched_start_timeout (sched); + }if (!entity)continue ;
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 160/350 drm/amd/display: setting the DIG_MODE to the correct value.
In reply to Sasha LevinFrom: Zhan liu <[email protected]>
[ Upstream commit 967a3b85bac91c55eff740e61bf270c2732f48b2 ]
[Why]
This patch is for fixing Navi14 HDMI display pink screen issue.
[How]
Call stream->link->link_enc->funcs->setup twice. This is setting the DIG_MODE to the correct value after having been overridden by the call to transmitter control.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +9 -0
@@ -2769,6 +2769,15 @@ void core_link_enable_stream( CONTROLLER_DP_TEST_PATTERN_VIDEOMODE, COLOR_DEPTH_UNDEFINED); +/* This second call is needed to reconfigure the DIG +* as a workaround for the incorrect value being applied +* from transmitter control. +*/ +if (!dc_is_virtual_signal (pipe_ctx->stream->signal)) + stream->link->link_enc->funcs->setup ( + stream->link->link_enc, + pipe_ctx->stream->signal); +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT if (pipe_ctx->stream->timing.flags.DSC) { if (dc_is_dp_signal(pipe_ctx->stream->signal) ||
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 162/350 drm/amd/display: correctly populate dpp refclk in fpga
In reply to Sasha LevinFrom: Anthony Koo <[email protected]>
[ Upstream commit 952f6c4b5d72d40f93f3deb61239290b357d434e ]
[Why]
In diags environment we are not programming the DPP DTO correctly.
[How]
Populate the dpp refclk in dccg so it can be used to correctly program DPP DTO.
--- .../drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c +8 -2
@@ -320,6 +320,8 @@ void dcn2_update_clocks_fpga(struct clk_mgr *clk_mgr, struct dc_state *context, bool safe_to_lower) { +struct clk_mgr_internal *clk_mgr_int =TO_CLK_MGR_INTERNAL (clk_mgr); +struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;/* Min fclk = 1.2GHz since all the extra scemi logic seems to run off of it */ int fclk_adj = new_clocks->fclk_khz >1200000 ? new_clocks->fclk_khz :1200000 ;
@@ -357,14 +359,18 @@ void dcn2_update_clocks_fpga(struct clk_mgr *clk_mgr, clk_mgr->clks.dispclk_khz = new_clocks->dispclk_khz; } -/* Both fclk and dppclk ref are run on the same scemi clock so we -* need to keep the same value for both +/* Both fclk and ref_dppclk run on the same scemi clock. +* So take the higher value since the DPP DTO is typically programmed +* such that max dppclk is 1:1 with ref_dppclk. */ if (clk_mgr->clks.fclk_khz > clk_mgr->clks.dppclk_khz) clk_mgr->clks.dppclk_khz = clk_mgr->clks.fclk_khz;if (clk_mgr->clks.dppclk_khz > clk_mgr->clks.fclk_khz) clk_mgr->clks.fclk_khz = clk_mgr->clks.dppclk_khz; +// Both fclk and ref_dppclk run on the same scemi clock. + clk_mgr_int->dccg->ref_dppclk = clk_mgr->clks.fclk_khz; +dm_set_dcn_clocks (clk_mgr->ctx, &clk_mgr->clks); }
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 159/350 arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill()
In reply to Sasha LevinFrom: Yunfeng Ye <[email protected]>
[ Upstream commit bfcef4ab1d7ee8921bc322109b1692036cc6cbe0 ]
In cases like suspend-to-disk and suspend-to-ram, a large number of CPU cores need to be shut down. At present, the CPU hotplug operation is serialised, and the CPU cores can only be shut down one by one. In this process, if PSCI affinity_info() does not return LEVEL_OFF quickly, cpu_psci_cpu_kill() needs to wait for 10ms. If hundreds of CPU cores need to be shut down, it will take a long time.
Normally, there is no need to wait 10ms in cpu_psci_cpu_kill(). So change the wait interval from 10 ms to max 1 ms and use usleep_range() instead of msleep() for more accurate timer.
In addition, reducing the time interval will increase the messages output, so remove the "Retry ..." message, instead, track time and output to the the sucessful message.
--- arch/arm64/kernel/psci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/arm64/kernel/psci.c +9 -6
@@ -81,7 +81,8 @@ static void cpu_psci_cpu_die(unsigned int cpu)static int cpu_psci_cpu_kill (unsigned int cpu) { -int err, i; +int err; +unsigned long start, end;if (!psci_ops.affinity_info)return 0 ;
@@ -91,16 +92,18 @@ static int cpu_psci_cpu_kill(unsigned int cpu)* while it is dying. So, try again a few times. */ -for (i =0 ; i <10 ; i++) { + start = jiffies; + end = start +msecs_to_jiffies (100 ); +do { err = psci_ops.affinity_info (cpu_logical_map (cpu),0 );if (err ==PSCI_0_2_AFFINITY_LEVEL_OFF ) { -pr_info ("CPU%d killed.\n" , cpu); +pr_info ("CPU%d killed (polled %d ms)\n" , cpu, +jiffies_to_msecs (jiffies - start));return 0 ; } -msleep (10 ); -pr_info ("Retrying again to check for CPU kill\n" ); - } +usleep_range (100 ,1000 ); + }while (time_before (jiffies, end));pr_warn ("CPU%d may not have shut down cleanly (AFFINITY_INFO reports %d)\n" , cpu, err);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 170/350 ALSA: hda - Fix pending unsol events at shutdown
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit ca58f55108fee41d87c9123f85ad4863e5de7f45 ]
This is an alternative fix attemp for the issue reported in the commit caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling") that was reverted later due to regressions. Instead of tweaking the hardware disablement order and the enforced irq flushing, do calling cancel_work_sync() of the unsol work early enough, and explicitly ignore the unsol events during the shutdown by checking the bus->shutdown flag.
--- sound/pci/hda/hda_bind.c | 4 ++++ sound/pci/hda/hda_intel.c | 3 +++ 2 files changed, 7 insertions(+)
sound/pci/hda/hda_bind.c +4 -0
@@ -43,6 +43,10 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev) { struct hda_codec *codec = container_of(dev, struct hda_codec, core); +/* ignore unsol events during shutdown */ +if (codec->bus->shutdown) +return ; +if (codec->patch_ops.unsol_event) codec->patch_ops.unsol_event (codec, ev); }
sound/pci/hda/hda_intel.c +3 -0
@@ -1382,8 +1382,11 @@ static int azx_free(struct azx *chip)static int azx_dev_disconnect (struct snd_device *device) {struct azx *chip = device->device_data; +struct hdac_bus *bus =azx_bus (chip); chip->bus.shutdown =1 ; +cancel_work_sync (&bus->unsol_work); +return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 173/350 RDMA/qedr: Fix srqs xarray initialization
In reply to Sasha LevinFrom: Michal Kalderon <[email protected]>
[ Upstream commit 73ab512f720298aabe23b34110e3f6a8545b0ba5 ]
There was a missing initialization for the srqs xarray. SRQs xarray can also be called from irq context when searching for an element and uses the xa_XXX_irq apis, therefore should be initialized with IRQ flags.
--- drivers/infiniband/hw/qedr/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/qedr/main.c +1 -0
@@ -357,6 +357,7 @@ static int qedr_alloc_resources(struct qedr_dev *dev)return -ENOMEM ;spin_lock_init (&dev->sgid_lock); +xa_init_flags (&dev->srqs,XA_FLAGS_LOCK_IRQ );if (IS_IWARP (dev)) {xa_init_flags (&dev->qps,XA_FLAGS_LOCK_IRQ );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 172/350 RDMA/hns: Fix memory leak on 'context' on error return path
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 994195e1537074f56df216a9309f6e366cb35b67 ]
Currently, the error return path when the call to function dev->dfx->query_cqc_info fails will leak object 'context'. Fix this by making the error return path via 'err' return return codes rather than -EMSGSIZE, set ret appropriately for all error return paths and for the memory leak now return via 'err' rather than just returning without freeing context.
Addresses-Coverity: ("Resource leak")
--- drivers/infiniband/hw/hns/hns_roce_restrack.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/infiniband/hw/hns/hns_roce_restrack.c +7 -3
@@ -98,11 +98,15 @@ static int hns_roce_fill_res_cq_entry(struct sk_buff *msg, goto err; table_attr =nla_nest_start (msg,RDMA_NLDEV_ATTR_DRIVER ); -if (!table_attr) +if (!table_attr) { + ret = -EMSGSIZE ; goto err; + } -if (hns_roce_fill_cq (msg, context)) +if (hns_roce_fill_cq (msg, context)) { + ret = -EMSGSIZE ; goto err_cancel_table; + }nla_nest_end (msg, table_attr);kfree (context);
@@ -113,7 +117,7 @@ static int hns_roce_fill_res_cq_entry(struct sk_buff *msg,nla_nest_cancel (msg, table_attr); err:kfree (context); -return -EMSGSIZE ; +return ret; } int hns_roce_fill_res_entry(struct sk_buff *msg,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 174/350 RDMA/core: Set DMA parameters correctly
In reply to Sasha LevinFrom: Bart Van Assche <[email protected]>
[ Upstream commit c9121262d57b8a3be4f08073546436ba0128ca6a ]
The dma_set_max_seg_size() call in setup_dma_device() does not have any effect since device->dev.dma_parms is NULL. Fix this by initializing device->dev.dma_parms first.
--- drivers/infiniband/core/device.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/infiniband/core/device.c +14 -2
@@ -1199,9 +1199,21 @@ static void setup_dma_device(struct ib_device *device)WARN_ON_ONCE (!parent); device->dma_device = parent; } -/* Setup default max segment size for all IB devices */ -dma_set_max_seg_size (device->dma_device,SZ_2G ); +if (!device->dev.dma_parms) { +if (parent) { +/* +* The caller did not provide DMA parameters, so +* 'parent' probably represents a PCI device. The PCI +* core sets the maximum segment size to 64 +* KB. Increase this parameter to 2 GB. +*/ + device->dev.dma_parms = parent->dma_parms; +dma_set_max_seg_size (device->dma_device,SZ_2G ); + }else { +WARN_ON_ONCE (true); + } + } }/*
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 177/350 regulator: fixed: add off-on-delay
In reply to Sasha LevinFrom: Peng Fan <[email protected]>
[ Upstream commit f7907e57aea2adcd0b57ebcca410e125412ab680 ]
Depends on board design, the gpio controlling regulator may connects with a big capacitance. When need off, it takes some time to let the regulator to be truly off. If not add enough delay, the regulator might have always been on, so introduce off-on-delay to handle such case.
--- drivers/regulator/fixed.c | 2 ++ include/linux/regulator/fixed.h | 1 + 2 files changed, 3 insertions(+)
drivers/regulator/fixed.c +2 -0
@@ -123,6 +123,7 @@ of_get_fixed_voltage_config(struct device *dev, config->enabled_at_boot = true;of_property_read_u32 (np,"startup-delay-us" , &config->startup_delay); +of_property_read_u32 (np,"off-on-delay-us" , &config->off_on_delay);if (of_find_property (np,"vin-supply" ,NULL )) config->input_supply ="vin" ;
@@ -189,6 +190,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) } drvdata->desc.enable_time = config->startup_delay; + drvdata->desc.off_on_delay = config->off_on_delay;if (config->input_supply) { drvdata->desc.supply_name = devm_kstrdup(&pdev->dev,
include/linux/regulator/fixed.h +1 -0
@@ -36,6 +36,7 @@ struct fixed_voltage_config {const char *input_supply;int microvolts;unsigned startup_delay; +unsigned int off_on_delay; unsigned enabled_at_boot:1;struct regulator_init_data *init_data; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 179/350 ALSA: hda/hdmi - implement mst_no_extra_pcms flag
In reply to Sasha LevinFrom: Kai Vehmanen <[email protected]>
[ Upstream commit 2a2edfbbfee47947dd05f5860c66c0e80ee5e09d ]
To support the DP-MST multiple streams via single connector feature, the HDMI driver was extended with the concept of backup PCMs. See commit 9152085defb6 ("ALSA: hda - add DP MST audio support").
This implementation works fine with snd_hda_intel.c as PCM topology is fully managed within the single driver.
When the HDA codec driver is used from ASoC components, the concept of backup PCMs no longer fits. For ASoC topologies, the physical HDMI converters are presented as backend DAIs and these should match with hardware capabilities. The ASoC topology may define arbitrary PCMs (i.e. frontend DAIs) and have processing elements before eventual routing to the HDMI BE DAIs. With backup PCMs, the link between FE and BE DAIs would become dynamic and change when monitors are (un)plugged. This would lead to modifying the topology every time hotplug events happen, which is not currently possible in ASoC and there does not seem to be any obvious benefits from this design.
To overcome above problems and enable the HDMI driver to be used from ASoC, this patch adds a new mode (mst_no_extra_pcms flags) to patch_hdmi.c. In this mode, the codec driver does not assume the backup PCMs to be created.
--- include/sound/hda_codec.h | 1 + sound/pci/hda/patch_hdmi.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-)
include/sound/hda_codec.h +1 -0
@@ -254,6 +254,7 @@ struct hda_codec { unsigned int force_pin_prefix:1; /* Add location prefix */ unsigned int link_down_at_suspend:1; /* link down at runtime suspend */ unsigned int relaxed_resume:1; /* don't resume forcibly for jack */ + unsigned int mst_no_extra_pcms:1; /* no backup PCMs for DP-MST */#ifdef CONFIG_PM unsigned long power_on_acct;
sound/pci/hda/patch_hdmi.c +14 -5
@@ -2075,15 +2075,24 @@ static bool is_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx)static int generic_hdmi_build_pcms (struct hda_codec *codec) {struct hdmi_spec *spec = codec->spec; -int idx; +int idx, pcm_num;/* * for non-mst mode, pcm number is the same as before -* for DP MST mode, pcm number is (nid number + dev_num - 1) -* dev_num is the device entry number in a pin -* +* for DP MST mode without extra PCM, pcm number is same +* for DP MST mode with extra PCMs, pcm number is +* (nid number + dev_num - 1) +* dev_num is the device entry number in a pin */ -for (idx =0 ; idx < spec->num_nids + spec->dev_num -1 ; idx++) { + +if (codec->mst_no_extra_pcms) + pcm_num = spec->num_nids; +else + pcm_num = spec->num_nids + spec->dev_num -1 ; + +codec_dbg (codec,"hdmi: pcm_num set to %d\n" , pcm_num); + +for (idx =0 ; idx < pcm_num; idx++) {struct hda_pcm *info;struct hda_pcm_stream *pstr;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 151/350 media: imx7-mipi-csis: Add a check for devm_regulator_get
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
[ Upstream commit a0219deefe9ee5006a28d48522f76b217d198c51 ]
devm_regulator_get may return an error but mipi_csis_phy_init misses a check for it.
This may lead to problems when regulator_set_voltage uses the unchecked pointer.
This patch adds a check for devm_regulator_get to avoid potential risk.
--- drivers/staging/media/imx/imx7-mipi-csis.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/media/imx/imx7-mipi-csis.c +6 -1
@@ -350,6 +350,8 @@ static void mipi_csis_sw_reset(struct csi_state *state)static int mipi_csis_phy_init (struct csi_state *state) { state->mipi_phy_regulator =devm_regulator_get (state->dev,"phy" ); +if (IS_ERR (state->mipi_phy_regulator)) +return PTR_ERR (state->mipi_phy_regulator);return regulator_set_voltage (state->mipi_phy_regulator,1000000 ,1000000 );
@@ -966,7 +968,10 @@ static int mipi_csis_probe(struct platform_device *pdev)return ret; } -mipi_csis_phy_init (state); + ret =mipi_csis_phy_init (state); +if (ret <0 ) +return ret; +mipi_csis_phy_reset (state); mem_res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 138/350 ASoC: soc-pcm: fixup dpcm_prune_paths() loop continue
In reply to Sasha LevinFrom: Kuninori Morimoto <[email protected]>
[ Upstream commit bed646dc3f7bcec91178c278deaf969cce0700a8 ]
dpcm_prune_paths() is checking widget at 2 parts.
(A) is for CPU, (B) is for Codec.
If we focus to (A) part, continue at (a) is for (1) loop. But, if we focus to (B) part, continue at (b) is for (2) loop, not for (1). This is bug.
This patch fixup this issue.
static int dpcm_prune_paths(...)
{
...
(1) for_each_dpcm_be(fe, stream, dpcm) {
... ^ widget = dai_get_widget(...);
|
(A) if (widget && widget_in_list(...))
| (a) continue;
v
^ (2) for_each_rtd_codec_dai(...) {
| widget = dai_get_widget(...);
(B)
| if (widget && widget_in_list(...))
v (b) continue; } ...
--- sound/soc/soc-pcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/soc-pcm.c +5 -1
@@ -1385,6 +1385,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,struct snd_soc_dapm_widget *widget;struct snd_soc_dai *dai;int prune =0 ; +int do_prune;/* Destroy any old FE <--> BE connections */ for_each_dpcm_be (fe, stream, dpcm) {
@@ -1398,13 +1399,16 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,continue ;/* is there a valid CODEC DAI widget for this BE */ + do_prune =1 ;for_each_rtd_codec_dai (dpcm->be, i, dai) { widget =dai_get_widget (dai, stream);/* prune the BE if it's no longer in our active list */ if (widget &&widget_in_list (list, widget)) -continue ; + do_prune =0 ; } +if (!do_prune) +continue ; dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n", stream ? "capture" : "playback",
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 186/350 libata: Ensure ata_port probe has completed before detach
In reply to Sasha LevinFrom: John Garry <[email protected]>
[ Upstream commit 130f4caf145c3562108b245a576db30b916199d2 ]
With CONFIG_DEBUG_TEST_DRIVER_REMOVE set, we may find the following WARN:
[ 23.452574] ------------[ cut here ]------------ [ 23.457190] WARNING: CPU: 59 PID: 1 at drivers/ata/libata-core.c:6676 ata_host_detach+0x15c/0x168 [ 23.466047] Modules linked in: [ 23.469092] CPU: 59 PID: 1 Comm: swapper/0 Not tainted 5.4.0-rc1-00010-g5b83fd27752b-dirty #296 [ 23.477776] Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 - V1.16.01 03/15/2019 [ 23.486286] pstate: a0c00009 (NzCv daif +PAN +UAO) [ 23.491065] pc : ata_host_detach+0x15c/0x168 [ 23.495322] lr : ata_host_detach+0x88/0x168 [ 23.499491] sp : ffff800011cabb50 [ 23.502792] x29: ffff800011cabb50 x28: 0000000000000007 [ 23.508091] x27: ffff80001137f068 x26: ffff8000112c0c28 [ 23.513390] x25: 0000000000003848 x24: ffff0023ea185300 [ 23.518689] x23: 0000000000000001 x22: 00000000000014c0 [ 23.523987] x21: 0000000000013740 x20: ffff0023bdc20000 [ 23.529286] x19: 0000000000000000 x18: 0000000000000004 [ 23.534584] x17: 0000000000000001 x16: 00000000000000f0 [ 23.539883] x15: ffff0023eac13790 x14: ffff0023eb76c408 [ 23.545181] x13: 0000000000000000 x12: ffff0023eac13790 [ 23.550480] x11: ffff0023eb76c228 x10: 0000000000000000 [ 23.555779] x9 : ffff0023eac13798 x8 : 0000000040000000 [ 23.561077] x7 : 0000000000000002 x6 : 0000000000000001 [ 23.566376] x5 : 0000000000000002 x4 : 0000000000000000 [ 23.571674] x3 : ffff0023bf08a0bc x2 : 0000000000000000 [ 23.576972] x1 : 3099674201f72700 x0 : 0000000000400284 [ 23.582272] Call trace: [ 23.584706] ata_host_detach+0x15c/0x168 [ 23.588616] ata_pci_remove_one+0x10/0x18 [ 23.592615] ahci_remove_one+0x20/0x40 [ 23.596356] pci_device_remove+0x3c/0xe0 [ 23.600267] really_probe+0xdc/0x3e0 [ 23.603830] driver_probe_device+0x58/0x100 [ 23.608000] device_driver_attach+0x6c/0x90 [ 23.612169] __driver_attach+0x84/0xc8 [ 23.615908] bus_for_each_dev+0x74/0xc8 [ 23.619730] driver_attach+0x20/0x28 [ 23.623292] bus_add_driver+0x148/0x1f0 [ 23.627115] driver_register+0x60/0x110 [ 23.630938] __pci_register_driver+0x40/0x48 [ 23.635199] ahci_pci_driver_init+0x20/0x28 [ 23.639372] do_one_initcall+0x5c/0x1b0 [ 23.643199] kernel_init_freeable+0x1a4/0x24c [ 23.647546] kernel_init+0x10/0x108 [ 23.651023] ret_from_fork+0x10/0x18 [ 23.654590] ---[ end trace 634a14b675b71c13 ]---
With KASAN also enabled, we may also get many use-after-free reports.
The issue is that when CONFIG_DEBUG_TEST_DRIVER_REMOVE is set, we may attempt to detach the ata_port before it has been probed.
This is because the ata_ports are async probed, meaning that there is no guarantee that the ata_port has probed prior to detach. When the ata_port does probe in this scenario, we get all sorts of issues as the detach may have already happened.
Fix by ensuring synchronisation with async_synchronize_full(). We could alternatively use the cookie returned from the ata_port probe async_schedule() call, but that means managing the cookie, so more complicated.
--- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-core.c +3 -0
@@ -6708,6 +6708,9 @@ void ata_host_detach(struct ata_host *host) {int i; +/* Ensure ata_port probe has completed */ +async_synchronize_full (); +for (i =0 ; i < host->n_ports; i++)ata_port_detach (host->ports[i]);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 189/350 net/mlx5e: Verify that rule has at least one fwd/drop action
In reply to Sasha LevinFrom: Vlad Buslov <[email protected]>
[ Upstream commit ae2741e2b6ce2bf1b656b1152c4ef147ff35b096 ]
Currently, mlx5 tc layer doesn't verify that rule has at least one forward or drop action which leads to following firmware syndrome when user tries to offload such action:
[ 1824.860501] mlx5_core 0000:81:00.0: mlx5_cmd_check:753:(pid 29458): SET_FLOW_TABLE_ENTRY(0x936) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0x144b7a)
Add check at the end of parse_tc_fdb_actions() that verifies that resulting attribute has action fwd or drop flag set.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +6 -0
@@ -3443,6 +3443,12 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, attr->action |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; } +if (!(attr->action & + (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |MLX5_FLOW_CONTEXT_ACTION_DROP ))) { +NL_SET_ERR_MSG (extack,"Rule must have at least one forward/drop action" ); +return -EOPNOTSUPP ; + } +if (attr->split_count >0 && !mlx5_esw_has_fwd_fdb (priv->mdev)) {NL_SET_ERR_MSG_MOD (extack,"current firmware doesn't support split rule for port mirroring" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 197/350 ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit f9ad75468453b019b92c5296e6a04bf7c37f49e4 ]
updated solution to the problem reported with randconfig:
CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in turn referenced by the sof-of-dev driver. This creates a reverse dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF is built-in but CONFIG_SND_SOC_SOF_IMX=m:
sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
use def_trisate to propagate the right settings without select.
--- sound/soc/sof/imx/Kconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/sof/imx/Kconfig +6 -2
@@ -11,8 +11,8 @@ config SND_SOC_SOF_IMX_TOPLEVEL if SND_SOC_SOF_IMX_TOPLEVEL -config SND_SOC_SOF_IMX8 - tristate "SOF support for i.MX8" +config SND_SOC_SOF_IMX8_SUPPORT + bool "SOF support for i.MX8" depends on IMX_SCU depends on IMX_DSP help
@@ -20,4 +20,8 @@ config SND_SOC_SOF_IMX8 Say Y if you have such a device. If unsure select "N". +config SND_SOC_SOF_IMX8 + def_tristate SND_SOC_SOF_OF + depends on SND_SOC_SOF_IMX8_SUPPORT + endif ## SND_SOC_SOF_IMX_IMX_TOPLEVEL
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 191/350 ALSA: bebob: expand sleep just after breaking connections for protocol version 1
In reply to Sasha LevinFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit d3eabe939aee3ffd5b133766a932629a9746298c ]
As long as I investigated, some devices with BeBoB protocol version 1 can be freezed during several hundreds milliseconds after breaking connections. When accessing during the freezed time, any transaction is corrupted. In the worst case, the device is going to reboot.
I can see this issue in:
* Roland FA-66
* M-Audio FireWire Solo
This commit expands sleep just after breaking connections to avoid the freezed time as much as possible. I note that the freeze/reboot behaviour is similar to below models:
* Focusrite Saffire Pro 10 I/O
* Focusrite Saffire Pro 26 I/O
The above models certainly reboot after breaking connections.
--- sound/firewire/bebob/bebob_stream.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
sound/firewire/bebob/bebob_stream.c +6 -5
@@ -415,15 +415,16 @@ static int make_both_connections(struct snd_bebob *bebob)return 0 ; } -static void -break_both_connections (struct snd_bebob *bebob) +static void break_both_connections (struct snd_bebob *bebob) {cmp_connection_break (&bebob->in_conn);cmp_connection_break (&bebob->out_conn); -/* These models seems to be in transition state for a longer time. */ -if (bebob->maudio_special_quirk !=NULL ) -msleep (200 ); +// These models seem to be in transition state for a longer time. When +// accessing in the state, any transactions is corrupted. In the worst +// case, the device is going to reboot. +if (bebob->version <2 ) +msleep (600 ); } static int
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 202/350 media: rcar_drif: fix a memory disclosure
In reply to Sasha LevinFrom: Kangjie Lu <[email protected]>
[ Upstream commit d39083234c60519724c6ed59509a2129fd2aed41 ]
"f->fmt.sdr.reserved" is uninitialized. As other peer drivers like msi2500 and airspy do, the fix initializes it to avoid memory disclosures.
--- drivers/media/platform/rcar_drif.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/rcar_drif.c +1 -0
@@ -912,6 +912,7 @@ static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv, {struct rcar_drif_sdr *sdr =video_drvdata (file); +memset (f->fmt.sdr.reserved,0 ,sizeof (f->fmt.sdr.reserved)); f->fmt.sdr.pixelformat = sdr->fmt->pixelformat; f->fmt.sdr.buffersize = sdr->fmt->buffersize;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 193/350 libbpf: Fix error handling in bpf_map__reuse_fd()
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit d1b4574a4b86565325ef2e545eda8dfc9aa07c60 ]
bpf_map__reuse_fd() was calling close() in the error path before returning an error value based on errno. However, close can change errno, so that can lead to potentially misleading error messages. Instead, explicitly store errno in the err variable before each goto.
--- tools/lib/bpf/libbpf.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
tools/lib/bpf/libbpf.c +10 -4
@@ -1897,16 +1897,22 @@ int bpf_map__reuse_fd(struct bpf_map *map, int fd)return -errno; new_fd =open ("/" ,O_RDONLY |O_CLOEXEC ); -if (new_fd <0 ) +if (new_fd <0 ) { + err = -errno; goto err_free_new_name; + } new_fd =dup3 (fd, new_fd,O_CLOEXEC ); -if (new_fd <0 ) +if (new_fd <0 ) { + err = -errno; goto err_close_new_fd; + } err =zclose (map->fd); -if (err) +if (err) { + err = -errno; goto err_close_new_fd; + }free (map->name); map->fd = new_fd;
@@ -1925,7 +1931,7 @@ int bpf_map__reuse_fd(struct bpf_map *map, int fd)close (new_fd); err_free_new_name:free (new_name); -return -errno; +return err; }int bpf_map__resize (struct bpf_map *map,__u32 max_entries)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 205/350 media: staging/imx: Use a shorter name for driver
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit ce22c6f242b6d7b5e0318da2c92b5b00b5bbc698 ]
Currently v4l2-compliance tool returns the following output:
Compliance test for imx-media-captu device /dev/video0:
Driver Info:
Driver name : imx-media-captu
Card type : imx-media-capture
...
The driver name string is limited to 16 characters, so provide a shorter name so that we can have a better output.
While at it, use the same shorter name for driver and card.
--- drivers/staging/media/imx/imx-media-capture.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/media/imx/imx-media-capture.c +4 -2
@@ -26,6 +26,8 @@#include <media/imx.h> #include "imx-media.h" +#define IMX_CAPTURE_NAME "imx-capture" +struct capture_priv {struct imx_media_video_dev vdev;
@@ -69,8 +71,8 @@ static int vidioc_querycap(struct file *file, void *fh, {struct capture_priv *priv =video_drvdata (file); -strscpy (cap->driver,"imx-media-capture" ,sizeof (cap->driver)); -strscpy (cap->card,"imx-media-capture" ,sizeof (cap->card)); +strscpy (cap->driver,IMX_CAPTURE_NAME ,sizeof (cap->driver)); +strscpy (cap->card,IMX_CAPTURE_NAME ,sizeof (cap->card));snprintf (cap->bus_info,sizeof (cap->bus_info),"platform:%s" , priv->src_sd->name);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 208/350 ASoC: SOF: topology: set trigger order for FE DAI link
In reply to Sasha LevinFrom: Ranjani Sridharan <[email protected]>
[ Upstream commit 5eee2b3f60065a2530d13f28e771be48b989eb4c ]
Set trigger order for FE DAI links to SND_SOC_DPCM_TRIGGER_POST to trigger the BE DAI's before the FE DAI's. This prevents the xruns seen on playback pipelines using the link DMA.
--- sound/soc/sof/topology.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/sof/topology.c +4 -0
@@ -2828,6 +2828,10 @@ static int sof_link_load(struct snd_soc_component *scomp, int index,if (!link->no_pcm) { link->nonatomic = true; +/* set trigger order */ + link->trigger[0 ] =SND_SOC_DPCM_TRIGGER_POST ; + link->trigger[1 ] =SND_SOC_DPCM_TRIGGER_POST ; +/* nothing more to do for FE dai links */ return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 211/350 rfkill: allocate static minor
In reply to Sasha LevinFrom: Marcel Holtmann <[email protected]>
[ Upstream commit 8670b2b8b029a6650d133486be9d2ace146fd29a ]
udev has a feature of creating /dev/<node> device-nodes if it finds a devnode:<node> modalias. This allows for auto-loading of modules that provide the node. This requires to use a statically allocated minor number for misc character devices.
However, rfkill uses dynamic minor numbers and prevents auto-loading of the module. So allocate the next static misc minor number and use it for rfkill.
--- include/linux/miscdevice.h | 1 + net/rfkill/core.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
include/linux/miscdevice.h +1 -0
@@ -57,6 +57,7 @@#define UHID_MINOR 239#define USERIO_MINOR 240#define VHOST_VSOCK_MINOR 241 +#define RFKILL_MINOR 242#define MISC_DYNAMIC_MINOR 255struct device ;
net/rfkill/core.c +7 -2
@@ -1316,10 +1316,12 @@ static const struct file_operations rfkill_fops = { .llseek = no_llseek, }; +#define RFKILL_NAME "rfkill" +static struct miscdevice rfkill_miscdev = { - .name ="rfkill" , .fops = &rfkill_fops, - .minor =MISC_DYNAMIC_MINOR , + .name =RFKILL_NAME , + .minor =RFKILL_MINOR , };static int __init rfkill_init (void )
@@ -1371,3 +1373,6 @@ static void __exit rfkill_exit(void)class_unregister (&rfkill_class); }module_exit (rfkill_exit); + +MODULE_ALIAS_MISCDEV (RFKILL_MINOR ); +MODULE_ALIAS ("devname:" RFKILL_NAME );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 216/350 drm: msm: a6xx: fix debug bus register configuration
In reply to Sasha LevinFrom: Sharat Masetty <[email protected]>
[ Upstream commit 7f4009c4bbea4438b50f3b12d1c57da3f5cd8db3 ]
Fix the cx debugbus related register configuration, to collect accurate bus data during gpu snapshot. This helps with complete snapshot dump and also complete proper GPU recovery.
--- drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +12 -12
@@ -352,26 +352,26 @@ static void a6xx_get_debugbus(struct msm_gpu *gpu, cxdbg =ioremap (res->start,resource_size (res));if (cxdbg) { -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_CNTLT , +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_CNTLT ,A6XX_DBGC_CFG_DBGBUS_CNTLT_SEGT (0xf )); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_CNTLM , +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_CNTLM ,A6XX_DBGC_CFG_DBGBUS_CNTLM_ENABLE (0xf )); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_IVTL_0 ,0 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_IVTL_1 ,0 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_IVTL_2 ,0 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_IVTL_3 ,0 ); +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_IVTL_0 ,0 ); +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_IVTL_1 ,0 ); +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_IVTL_2 ,0 ); +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_IVTL_3 ,0 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_BYTEL_0 , +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_BYTEL_0 ,0x76543210 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_BYTEL_1 , +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_BYTEL_1 ,0xFEDCBA98 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_MASKL_0 ,0 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_MASKL_1 ,0 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_MASKL_2 ,0 ); -cxdbg_write (cxdbg,REG_A6XX_DBGC_CFG_DBGBUS_MASKL_3 ,0 ); +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_MASKL_0 ,0 ); +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_MASKL_1 ,0 ); +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_MASKL_2 ,0 ); +cxdbg_write (cxdbg,REG_A6XX_CX_DBGC_CFG_DBGBUS_MASKL_3 ,0 ); } a6xx_state->debugbus = state_kcalloc(a6xx_state,
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 212/350 bnx2x: Fix PF-VF communication over multi-cos queues.
In reply to Sasha LevinFrom: Manish Chopra <[email protected]>
[ Upstream commit dc5a3d79c345871439ffe72550b604fcde9770e1 ]
PF driver doesn't enable tx-switching for all cos queues/clients, which causes packets drop from PF to VF. Fix this by enabling tx-switching on all cos queues/clients.
--- .../net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +11 -5
@@ -2397,15 +2397,21 @@ static int bnx2x_set_pf_tx_switching(struct bnx2x *bp, bool enable)/* send the ramrod on all the queues of the PF */ for_each_eth_queue (bp, i) {struct bnx2x_fastpath *fp = &bp->fp[i]; +int tx_idx;/* Set the appropriate Queue object */ q_params.q_obj = &bnx2x_sp_obj (bp, fp).q_obj; -/* Update the Queue state */ - rc =bnx2x_queue_state_change (bp, &q_params); -if (rc) { -BNX2X_ERR ("Failed to configure Tx switching\n" ); -return rc; +for (tx_idx =FIRST_TX_COS_INDEX ; + tx_idx < fp->max_cos; tx_idx++) { + q_params.params.update.cid_index = tx_idx; + +/* Update the Queue state */ + rc =bnx2x_queue_state_change (bp, &q_params); +if (rc) { +BNX2X_ERR ("Failed to configure Tx switching\n" ); +return rc; + } } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 221/350 perf jevents: Fix resource leak in process_mapfile() and main()
In reply to Sasha LevinFrom: Yunfeng Ye <[email protected]>
[ Upstream commit 1785fbb73896dbd9d27a406f0d73047df42db710 ]
There are memory leaks and file descriptor resource leaks in process_mapfile() and main().
Fix this by adding free(), fclose() and free_arch_std_events() on the error paths.
--- tools/perf/pmu-events/jevents.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
tools/perf/pmu-events/jevents.c +11 -2
@@ -758,6 +758,7 @@ static int process_mapfile(FILE *outfp, char *fpath)char *line, *p;int line_num;char *tblname; +int ret =0 ;pr_info ("%s: Processing mapfile %s\n" , prog, fpath);
@@ -769,6 +770,7 @@ static int process_mapfile(FILE *outfp, char *fpath)if (!mapfp) {pr_info ("%s: Error %s opening %s\n" , prog,strerror (errno), fpath); +free (line);return -1 ; }
@@ -795,7 +797,8 @@ static int process_mapfile(FILE *outfp, char *fpath)/* TODO Deal with lines longer than 16K */ pr_info ("%s: Mapfile %s: line %d too long, aborting\n" , prog, fpath, line_num); -return -1 ; + ret =-1 ; + goto out; } line[strlen (line)-1 ] ='\0' ;
@@ -825,7 +828,9 @@ static int process_mapfile(FILE *outfp, char *fpath) out:print_mapping_table_suffix (outfp); -return 0 ; +fclose (mapfp); +free (line); +return ret; }/*
@@ -1122,6 +1127,7 @@ int main(int argc, char *argv[]) goto empty_map; }else if (rc <0 ) {/* Make build fail */ +fclose (eventsfp);free_arch_std_events ();return 1 ; }else if (rc) {
@@ -1134,6 +1140,7 @@ int main(int argc, char *argv[]) goto empty_map; }else if (rc <0 ) {/* Make build fail */ +fclose (eventsfp);free_arch_std_events ();return 1 ; }else if (rc) {
@@ -1151,6 +1158,8 @@ int main(int argc, char *argv[])if (process_mapfile (eventsfp, mapfile)) {pr_info ("%s: Error processing mapfile %s\n" , prog, mapfile);/* Make build fail */ +fclose (eventsfp); +free_arch_std_events ();return 1 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 215/350 RDMA/core: Fix return code when modify_port isn't supported
In reply to Sasha LevinFrom: Kamal Heib <[email protected]>
[ Upstream commit 55bfe905fa97633438c13fb029aed85371d85480 ]
Improve return code from ib_modify_port() by doing the following:
- Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code
- Allow only fake IB_PORT_CM_SUP manipulation for RoCE providers that didn't implement the modify_port callback, otherwise return "-EOPNOTSUPP"
--- drivers/infiniband/core/device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/core/device.c +5 -1
@@ -2409,8 +2409,12 @@ int ib_modify_port(struct ib_device *device, rc = device->ops.modify_port (device, port_num, port_modify_mask, port_modify); + else if (rdma_protocol_roce(device, port_num) && + ((port_modify->set_port_cap_mask & ~IB_PORT_CM_SUP) == 0 || + (port_modify->clr_port_cap_mask & ~IB_PORT_CM_SUP) == 0)) + rc =0 ; else - rc =rdma_protocol_roce (device, port_num) ?0 : -ENOSYS ; + rc = -EOPNOTSUPP ;return rc; }EXPORT_SYMBOL (ib_modify_port);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 226/350 libsubcmd: Use -O0 with DEBUG=1
In reply to Sasha LevinFrom: James Clark <[email protected]>
[ Upstream commit 22bd8f1b5a1dd168ba4eba27cb17643a11012f5d ]
When a 'make DEBUG=1' build is done, the command parser is still built with -O6 and is hard to step through, fix it making it use -O0 in that case.
--- tools/lib/subcmd/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/subcmd/Makefile +3 -1
@@ -28,7 +28,9 @@ ifeq ($(DEBUG),0) endif endif -ifeq ($(CC_NO_CLANG), 0) +ifeq ($(DEBUG),1) + CFLAGS += -O0 +else ifeq ($(CC_NO_CLANG), 0) CFLAGS += -O3 else CFLAGS += -O6
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 217/350 rtlwifi: fix memory leak in rtl92c_set_fw_rsvdpagepkt()
In reply to Sasha LevinFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 5174f1e41074b5186608badc2e89441d021e8c08 ]
This leak was found by testing the EDIMAX EW-7612 on Raspberry Pi 3B+ with Linux 5.4-rc5 (multi_v7_defconfig + rtlwifi + kmemleak) and noticed a single memory leak during probe:
unreferenced object 0xec13ee40 (size 176):
comm "kworker/u8:1", pid 36, jiffies 4294939321 (age 5580.790s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<fc1bbb3e>] __netdev_alloc_skb+0x9c/0x164
[<863dfa6e>] rtl92c_set_fw_rsvdpagepkt+0x254/0x340 [rtl8192c_common]
[<9572be0d>] rtl92cu_set_hw_reg+0xf48/0xfa4 [rtl8192cu]
[<116df4d8>] rtl_op_bss_info_changed+0x234/0x96c [rtlwifi]
[<8933575f>] ieee80211_bss_info_change_notify+0xb8/0x264 [mac80211]
[<d4061e86>] ieee80211_assoc_success+0x934/0x1798 [mac80211]
[<e55adb56>] ieee80211_rx_mgmt_assoc_resp+0x174/0x314 [mac80211]
[<5974629e>] ieee80211_sta_rx_queued_mgmt+0x3f4/0x7f0 [mac80211]
[<d91091c6>] ieee80211_iface_work+0x208/0x318 [mac80211]
[<ac5fcae4>] process_one_work+0x22c/0x564
[<f5e6d3b6>] worker_thread+0x44/0x5d8
[<82c7b073>] kthread+0x150/0x154
[<b43e1b7d>] ret_from_fork+0x14/0x2c
[<794dff30>] 0x0It is because 8192cu doesn't implement usb_cmd_send_packet(), and this patch just frees the skb within the function to resolve memleak problem by now. Since 8192cu doesn't turn on fwctrl_lps that needs to download command packet for firmware via the function, applying this patch doesn't affect driver behavior.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c +2 -0
@@ -1540,6 +1540,8 @@ static bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)* This is maybe necessary: * rtlpriv->cfg->ops->fill_tx_cmddesc(hw, buffer, 1, 1, skb); */ +dev_kfree_skb (skb); +return true; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 219/350 perf cs-etm: Fix definition of macro TO_CS_QUEUE_NR
In reply to Sasha LevinFrom: Leo Yan <[email protected]>
[ Upstream commit 9d604aad4bb022e848dec80d6fe5f73fe87061a2 ]
Macro TO_CS_QUEUE_NR definition has a typo, which uses 'trace_id_chan' as its parameter, this doesn't match with its definition body which uses 'trace_chan_id'. So renames the parameter to 'trace_chan_id'.
It's luck to have a local variable 'trace_chan_id' in the function cs_etm__setup_queue(), even we wrongly define the macro TO_CS_QUEUE_NR, the local variable 'trace_chan_id' is used rather than the macro's parameter 'trace_id_chan'; so the compiler doesn't complain for this before.
After renaming the parameter, it leads to a compiling error due cs_etm__setup_queue() has no variable 'trace_id_chan'. This patch uses the variable 'trace_chan_id' for the macro so that fixes the compiling error.
--- tools/perf/util/cs-etm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/cs-etm.c +2 -2
@@ -110,7 +110,7 @@ static int cs_etm__decode_data_block(struct cs_etm_queue *etmq);* encode the etm queue number as the upper 16 bit and the channel as * the lower 16 bit. */ -#define TO_CS_QUEUE_NR (queue_nr, trace_id_chan) \ +#define TO_CS_QUEUE_NR (queue_nr, trace_chan_id) \ (queue_nr << 16 | trace_chan_id)#define TO_QUEUE_NR (cs_queue_nr) (cs_queue_nr >> 16)#define TO_TRACE_CHAN_ID (cs_queue_nr) (cs_queue_nr & 0x0000ffff)
@@ -819,7 +819,7 @@ static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm,* Note that packets decoded above are still in the traceID's packet * queue and will be processed in cs_etm__process_queues(). */ - cs_queue_nr =TO_CS_QUEUE_NR (queue_nr, trace_id_chan); + cs_queue_nr =TO_CS_QUEUE_NR (queue_nr, trace_chan_id); ret =auxtrace_heap__add (&etm->heap, cs_queue_nr, timestamp); out:return ret;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 229/350 perf tools: Splice events onto evlist even on error
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 8e8714c3d157568b7a769917a5e05573bbaf5af0 ]
If event parsing fails the event list is leaked, instead splice the list onto the out result and let the caller cleanup.
An example input for parse_events found by libFuzzer that reproduces this memory leak is 'm{'.
--- tools/perf/util/parse-events.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
tools/perf/util/parse-events.c +11 -6
@@ -1927,15 +1927,20 @@ int parse_events(struct evlist *evlist, const char *str, ret =parse_events__scanner (str, &parse_state,PE_START_EVENTS );perf_pmu__parse_cleanup (); + +if (!ret &&list_empty (&parse_state.list)) { +WARN_ONCE (true,"WARNING: event parser found nothing\n" ); +return -1 ; + } + +/* +* Add list to the evlist even with errors to allow callers to clean up. +*/ +perf_evlist__splice_list_tail (evlist, &parse_state.list); +if (!ret) {struct evsel *last; -if (list_empty (&parse_state.list)) { -WARN_ONCE (true,"WARNING: event parser found nothing\n" ); -return -1 ; - } - -perf_evlist__splice_list_tail (evlist, &parse_state.list); evlist->nr_groups += parse_state.nr_groups; last =evlist__last (evlist); last->cmdline_group_boundary = true;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 230/350 drm/amdgpu: disallow direct upload save restore list from gfx driver
In reply to Sasha LevinFrom: Hawking Zhang <[email protected]>
[ Upstream commit 58f46d4b65021083ef4b4d49c6e2c58e5783f626 ]
Direct uploading save/restore list via mmio register writes breaks the security policy. Instead, the driver should pass s&r list to psp.
For all the ASICs that use rlc v2_1 headers, the driver actually upload s&r list twice, in non-psp ucode front door loading phase and gfx pg initialization phase. The latter is not allowed.
VG12 is the only exception where the driver still keeps legacy approach for S&R list uploading. In theory, this can be elimnated if we have valid srcntl ucode for VG12.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -2930,7 +2930,8 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)* And it's needed by gfxoff feature. */ if (adev->gfx.rlc.is_rlc_v2_1) { -gfx_v9_1_init_rlc_save_restore_list (adev); +if (adev->asic_type ==CHIP_VEGA12 ) +gfx_v9_1_init_rlc_save_restore_list (adev);gfx_v9_0_enable_save_restore_machine (adev); }
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 231/350 drm/amd/powerplay: fix struct init in renoir_print_clk_levels
In reply to Sasha LevinFrom: Raul E Rangel <[email protected]>
[ Upstream commit d942070575910fdb687b9c8fd5467704b2f77c24 ]
drivers/gpu/drm/amd/powerplay/renoir_ppt.c:186:2: error: missing braces around initializer [-Werror=missing-braces]
SmuMetrics_t metrics = {0};
^--- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +3 -1
@@ -183,11 +183,13 @@ static int renoir_print_clk_levels(struct smu_context *smu,int i, size =0 , ret =0 ;uint32_t cur_value =0 , value =0 , count =0 , min =0 , max =0 ;DpmClocks_t *clk_table = smu->smu_table.clocks_table; -SmuMetrics_t metrics = {0 }; +SmuMetrics_t metrics;if (!clk_table || clk_type >=SMU_CLK_COUNT )return -EINVAL ; +memset (&metrics,0 ,sizeof (metrics)); + ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS ,0 , (void *)&metrics, false);if (ret)
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 232/350 drm/amdgpu: fix potential double drop fence reference
In reply to Sasha LevinFrom: Pan Bian <[email protected]>
[ Upstream commit 946ab8db6953535a3a88c957db8328beacdfed9d ]
The object fence is not set to NULL after its reference is dropped. As a result, its reference may be dropped again if error occurs after that, which may lead to a use after free bug. To avoid the issue, fence is explicitly set to NULL after dropping its reference.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +2 -0
@@ -138,6 +138,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (vram_obj, &vram_map);if (r) {
@@ -183,6 +184,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (gtt_obj[i], >t_map);if (r) {
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 227/350 perf probe: Fix to probe a function which has no entry pc
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 5d16dbcc311d91267ddb45c6da4f187be320ecee ]
Fix 'perf probe' to probe a function which has no entry pc or low pc but only has ranges attribute.
probe_point_search_cb() uses dwarf_entrypc() to get the probe address, but that doesn't work for the function DIE which has only ranges attribute. Use die_entrypc() instead.
Without this fix:
# perf probe -k ../build-x86_64/vmlinux -D clear_tasks_mm_cpumask:0
Probe point 'clear_tasks_mm_cpumask' not found.
Error: Failed to add events.With this:
# perf probe -k ../build-x86_64/vmlinux -D clear_tasks_mm_cpumask:0 p:probe/clear_tasks_mm_cpumask clear_tasks_mm_cpumask+0
Committer testing:
Before:
[root@quaco ~]# perf probe clear_tasks_mm_cpumask:0 Probe point 'clear_tasks_mm_cpumask' not found.
Error: Failed to add events.
[root@quaco ~]#
After:
[root@quaco ~]# perf probe clear_tasks_mm_cpumask:0 Added new event:
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask)
You can now use it in all perf tools, such as:
perf record -e probe:clear_tasks_mm_cpumask -aR sleep 1
[root@quaco ~]#
Using it with 'perf trace':
[root@quaco ~]# perf trace -e probe:clear_tasks_mm_cpumask
Doesn't seem to be used in x86_64:
$ find . -name "*.c" | xargs grep clear_tasks_mm_cpumask ./kernel/cpu.c: * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU ./kernel/cpu.c:void clear_tasks_mm_cpumask(int cpu) ./arch/xtensa/kernel/smp.c: clear_tasks_mm_cpumask(cpu); ./arch/csky/kernel/smp.c: clear_tasks_mm_cpumask(cpu); ./arch/sh/kernel/smp.c: clear_tasks_mm_cpumask(cpu); ./arch/arm/kernel/smp.c: clear_tasks_mm_cpumask(cpu); ./arch/powerpc/mm/nohash/mmu_context.c: clear_tasks_mm_cpumask(cpu); $ find . -name "*.h" | xargs grep clear_tasks_mm_cpumask ./include/linux/cpu.h:void clear_tasks_mm_cpumask(int cpu); $ find . -name "*.S" | xargs grep clear_tasks_mm_cpumask $
--- tools/perf/util/probe-finder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-finder.c +1 -1
@@ -994,7 +994,7 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) param->retval =find_probe_point_by_line (pf); }else if (die_is_func_instance (sp_die)) {/* Instances always have the entry address */ -dwarf_entrypc (sp_die, &pf->addr); +die_entrypc (sp_die, &pf->addr);/* But in some case the entry address is 0 */ if (pf->addr ==0 ) { pr_debug("%s has no entry PC. Skipped\n",
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 201/350 cpufreq: sun50i: Fix CPU speed bin detection
In reply to Sasha LevinFrom: Ondrej Jirman <[email protected]>
[ Upstream commit c23734487fb44ee16c1b007ba72d793c085e4ec4 ]
I have observed failures to boot on Orange Pi 3, because this driver determined that my SoC is from the normal bin, but my SoC only works reliably with the OPP values for the slowest bin.
By querying H6 owners, it was found that e-fuse values found in the wild are in the range of 1-3, value of 7 was not reported, yet. From this and from unused defines in BSP code, it can be assumed that meaning of efuse values on H6 actually is:
- 1 = slowest bin
- 2 = normal bin
- 3 = fastest bin
Vendor code actually treats 0 and 2 as invalid efuse values, but later treats all invalid values as a normal bin. This looks like a mistake in bin detection code, that was plastered over by a hack in cpufreq code, so let's not repeat it here. It probably only works because there are no SoCs in the wild with efuse value of 0, and fast bin SoCs are made to use normal bin OPP tables, which is also safe.
Let's play it safe and interpret 0 as the slowest bin, but fix detection of other bins to match this research. More research will be done before actual OPP tables are merged.
--- drivers/cpufreq/sun50i-cpufreq-nvmem.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
drivers/cpufreq/sun50i-cpufreq-nvmem.c +10 -15
@@ -25,7 +25,7 @@static struct platform_device *cpufreq_dt_pdev, *sun50i_cpufreq_pdev;/** -* sun50i_cpufreq_get_efuse() - Parse and return efuse value present on SoC +* sun50i_cpufreq_get_efuse() - Determine speed grade from efuse value * @versions: Set to the value parsed from efuse * * Returns 0 if success.
@@ -69,21 +69,16 @@ static int sun50i_cpufreq_get_efuse(u32 *versions)return PTR_ERR (speedbin); efuse_value = (*speedbin >>NVMEM_SHIFT ) &NVMEM_MASK ; -switch (efuse_value) { -case 0b0001 : - *versions =1 ; -break ; -case 0b0011 : - *versions =2 ; -break ; -default : -/* -* For other situations, we treat it as bin0. -* This vf table can be run for any good cpu. -*/ + +/* +* We treat unexpected efuse values as if the SoC was from +* the slowest bin. Expected efuse values are 1-3, slowest +* to fastest. +*/ +if (efuse_value >=1 && efuse_value <=3 ) + *versions = efuse_value -1 ; +else *versions =0 ; -break ; - }kfree (speedbin);return 0 ;
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 235/350 perf parse: If pmu configuration fails free terms
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 38f2c4226e6bc3e8c41c318242821ba5dc825aba ]
Avoid a memory leak when the configuration fails.
--- tools/perf/util/parse-events.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/parse-events.c +8 -1
@@ -1365,8 +1365,15 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,if (get_config_terms (head_config, &config_terms))return -ENOMEM ; -if (perf_pmu__config (pmu, &attr, head_config, parse_state->error)) +if (perf_pmu__config (pmu, &attr, head_config, parse_state->error)) { +struct perf_evsel_config_term *pos, *tmp; + +list_for_each_entry_safe (pos, tmp, &config_terms, list) { +list_del_init (&pos->list); +free (pos); + }return -EINVAL ; + } evsel = __add_event(list, &parse_state->idx, &attr, get_config_name(head_config), pmu,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 238/350 perf probe: Return a better scope DIE if there is no best scope
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit c701636aeec4c173208697d68da6e4271125564b ]
Make find_best_scope() returns innermost DIE at given address if there is no best matched scope DIE. Since Gcc sometimes generates intuitively strange line info which is out of inlined function address range, we need this fixup.
Without this, sometimes perf probe failed to probe on a line inside an inlined function:
# perf probe -D ksys_open:3
Failed to find scope of probe point.
Error: Failed to add events.With this fix, 'perf probe' can probe it:
# perf probe -D ksys_open:3 p:probe/ksys_open _text+25707308 p:probe/ksys_open_1 _text+25710596 p:probe/ksys_open_2 _text+25711114 p:probe/ksys_open_3 _text+25711343 p:probe/ksys_open_4 _text+25714058 p:probe/ksys_open_5 _text+2819653 p:probe/ksys_open_6 _text+2819701
--- tools/perf/util/probe-finder.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tools/perf/util/probe-finder.c +16 -1
@@ -756,6 +756,16 @@ static int find_best_scope_cb(Dwarf_Die *fn_die, void *data)return 0 ; } +/* Return innermost DIE */ +static int find_inner_scope_cb (Dwarf_Die *fn_die,void *data) +{ +struct find_scope_param *fsp = data; + +memcpy (fsp->die_mem, fn_die,sizeof (Dwarf_Die)); + fsp->found = true; +return 1 ; +} +/* Find an appropriate scope fits to given conditions */ static Dwarf_Die *find_best_scope (struct probe_finder *pf,Dwarf_Die *die_mem) {
@@ -767,8 +777,13 @@ static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) .die_mem = die_mem, .found = false, }; +int ret; -cu_walk_functions_at (&pf->cu_die, pf->addr, find_best_scope_cb, &fsp); + ret =cu_walk_functions_at (&pf->cu_die, pf->addr, find_best_scope_cb, + &fsp); +if (!ret && !fsp.found) +cu_walk_functions_at (&pf->cu_die, pf->addr, + find_inner_scope_cb, &fsp);return fsp.found ? die_mem :NULL ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 241/350 perf probe: Filter out instances except for inlined subroutine and subprogram
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit da6cb952a89efe24bb76c4971370d485737a2d85 ]
Filter out instances except for inlined_subroutine and subprogram DIE in die_walk_instances() and die_is_func_instance().
This fixes an issue that perf probe sets some probes on calling address instead of a target function itself.
When perf probe walks on instances of an abstruct origin (a kind of function prototype of inlined function), die_walk_instances() can also pass a GNU_call_site (a GNU extension for call site) to callback. Since it is not an inlined instance of target function, we have to filter out when searching a probe point.
Without this patch, perf probe sets probes on call site address too.This can happen on some function which is marked "inlined", but has actual symbol. (I'm not sure why GCC mark it "inlined"):
# perf probe -D vfs_read p:probe/vfs_read _text+2500017 p:probe/vfs_read_1 _text+2499468 p:probe/vfs_read_2 _text+2499563 p:probe/vfs_read_3 _text+2498876 p:probe/vfs_read_4 _text+2498512 p:probe/vfs_read_5 _text+2498627
With this patch:
Slightly different results, similar tho:
# perf probe -D vfs_read p:probe/vfs_read _text+2498512
Committer testing:
# uname -a Linux quaco 5.3.8-200.fc30.x86_64 #1 SMP Tue Oct 29 14:46:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Before:
# perf probe -D vfs_read p:probe/vfs_read _text+3131557 p:probe/vfs_read_1 _text+3130975 p:probe/vfs_read_2 _text+3131047 p:probe/vfs_read_3 _text+3130380 p:probe/vfs_read_4 _text+3130000 # uname -a Linux quaco 5.3.8-200.fc30.x86_64 #1 SMP Tue Oct 29 14:46:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux #
After:
# perf probe -D vfs_read p:probe/vfs_read _text+3130000 #
--- tools/perf/util/dwarf-aux.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
tools/perf/util/dwarf-aux.c +13 -6
@@ -312,18 +312,22 @@ bool die_is_func_def(Dwarf_Die *dw_die)* @dw_die: a DIE * * Ensure that this DIE is an instance (which has an entry address). -* This returns true if @dw_die is a function instance. If not, you need to -* call die_walk_instances() to find actual instances. +* This returns true if @dw_die is a function instance. If not, the @dw_die +* must be a prototype. You can use die_walk_instances() to find actual +* instances. **/ bool die_is_func_instance (Dwarf_Die *dw_die) {Dwarf_Addr tmp;Dwarf_Attribute attr_mem; +int tag =dwarf_tag (dw_die); -/* Actually gcc optimizes non-inline as like as inlined */ -return !dwarf_func_inline (dw_die) && - (dwarf_entrypc (dw_die, &tmp) ==0 || -dwarf_attr (dw_die, DW_AT_ranges, &attr_mem) !=NULL ); +if (tag != DW_TAG_subprogram && + tag != DW_TAG_inlined_subroutine) +return false; + +return dwarf_entrypc (dw_die, &tmp) ==0 || +dwarf_attr (dw_die, DW_AT_ranges, &attr_mem) !=NULL ; }/**
@@ -602,6 +606,9 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data)Dwarf_Die *origin;int tmp; +if (!die_is_func_instance (inst)) +return DIE_FIND_CB_CONTINUE ; + attr =dwarf_attr (inst, DW_AT_abstract_origin, &attr_mem);if (attr ==NULL )return DIE_FIND_CB_CONTINUE ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 245/350 selftests: proc: Make va_max 1MB
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 2f3571ea71311bbb2cbb9c3bbefc9c1969a3e889 ]
Currently proc-self-map-files-002.c sets va_max (max test address of user virtual address) to 4GB, but it is too big for 32bit arch and 1UL << 32 is overflow on 32bit long.
Also since this value should be enough bigger than vm.mmap_min_addr (64KB or 32KB by default), 1MB should be enough.
Make va_max 1MB unconditionally.
--- tools/testing/selftests/proc/proc-self-map-files-002.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/testing/selftests/proc/proc-self-map-files-002.c +5 -1
@@ -47,7 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b)int main (void ) {const int PAGE_SIZE =sysconf (_SC_PAGESIZE); -const unsigned long va_max =1UL <<32 ; +/* +* va_max must be enough bigger than vm.mmap_min_addr, which is +* 64KB/32KB by default. (depends on CONFIG_LSM_MMAP_MIN_ADDR) +*/ +const unsigned long va_max =1UL <<20 ;unsigned long va;void *p;int fd;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 246/350 drm/amdgpu: Avoid accidental thread reactivation.
In reply to Sasha LevinFrom: Andrey Grodzovsky <[email protected]>
[ Upstream commit a28fda312a9fabdf0e5f5652449d6197c9fb0a90 ]
Problem:
During GPU reset we call the GPU scheduler to suspend it's thread, those two functions in amdgpu also suspend and resume the sceduler for their needs but this can collide with GPU reset in progress and accidently restart a suspended thread before time.
Fix:
Serialize with GPU reset.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +10 -0
@@ -859,6 +859,9 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data)struct amdgpu_device *adev = dev->dev_private;int r =0 , i; +/* Avoid accidently unparking the sched thread during GPU reset */ +mutex_lock (&adev->lock_reset); +/* hold on the scheduler */ for (i =0 ; i <AMDGPU_MAX_RINGS ; i++) {struct amdgpu_ring *ring = adev->rings[i];
@@ -884,6 +887,8 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data)kthread_unpark (ring->sched.thread); } +mutex_unlock (&adev->lock_reset); +return 0 ; }
@@ -1036,6 +1041,9 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val)if (!fences)return -ENOMEM ; +/* Avoid accidently unparking the sched thread during GPU reset */ +mutex_lock (&adev->lock_reset); +/* stop the scheduler */ kthread_park (ring->sched.thread);
@@ -1075,6 +1083,8 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val)/* restart the scheduler */ kthread_unpark (ring->sched.thread); +mutex_unlock (&adev->lock_reset); +ttm_bo_unlock_delayed_workqueue (&adev->mman.bdev, resched);if (fences)
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 204/350 nvme: introduce "Command Aborted By host" status code
In reply to Sasha LevinFrom: Max Gurtovoy <[email protected]>
[ Upstream commit 2dc3947b53f573e8a75ea9cbec5588df88ca502e ]
Fix the status code of canceled requests initiated by the host according to TP4028 (Status Code 0x371):
"Command Aborted By host: The command was aborted as a result of host action (e.g., the host disconnected the Fabric connection)."
Also in a multipath environment, unless otherwise specified, errors of this type (path related) should be retried using a different path, if one is available.
--- drivers/nvme/host/core.c | 2 +- drivers/nvme/host/multipath.c | 1 + include/linux/nvme.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -313,7 +313,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved)if (blk_mq_request_completed (req))return true; -nvme_req (req)->status =NVME_SC_HOST_PATH_ERROR ; +nvme_req (req)->status =NVME_SC_HOST_ABORTED_CMD ;blk_mq_complete_request (req);return true; }
drivers/nvme/host/multipath.c +1 -0
@@ -95,6 +95,7 @@ void nvme_failover_req(struct request *req) }break ;case NVME_SC_HOST_PATH_ERROR : +case NVME_SC_HOST_ABORTED_CMD :/* * Temporary transport disruption in talking to the controller. * Try to send on a new path.
include/linux/nvme.h +1 -0
@@ -1368,6 +1368,7 @@ enum {NVME_SC_ANA_INACCESSIBLE =0x302 ,NVME_SC_ANA_TRANSITION =0x303 ,NVME_SC_HOST_PATH_ERROR =0x370 , +NVME_SC_HOST_ABORTED_CMD =0x371 ,NVME_SC_CRD =0x1800 , NVME_SC_DNR = 0x4000,
Signature · 7 lines
2.20.1 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 248/350 ath10k: fix get invalid tx rate for Mesh metric
In reply to Sasha LevinFrom: Miaoqing Pan <[email protected]>
[ Upstream commit 05a11003a56507023f18d3249a4d4d119c0a3e9c ]
ath10k does not provide transmit rate info per MSDU in tx completion, mark that as -1 so mac80211 will ignore the rates. This fixes mac80211 update Mesh link metric with invalid transmit rate info.
Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00035
--- drivers/net/wireless/ath/ath10k/txrx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath10k/txrx.c +2 -0
@@ -95,6 +95,8 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, info =IEEE80211_SKB_CB (msdu);memset (&info->status,0 ,sizeof (info->status)); + info->status.rates[0 ].idx =-1 ; +trace_ath10k_txrx_tx_unref (ar, tx_done->msdu_id);if (!(info->flags &IEEE80211_TX_CTL_NO_ACK ))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 249/350 fsi: core: Fix small accesses and unaligned offsets via sysfs
In reply to Sasha LevinFrom: Andrew Jeffery <[email protected]>
[ Upstream commit 9f4c2b516b4f031e3cd0e45957f4150b3c1a083d ]
Subtracting the offset delta from four-byte alignment lead to wrapping of the requested length where count is less than off. Generalise the length handling to enable and optimise aligned access sizes for all offset and size combinations. The new formula produces the following results for given offset and count values:
offset count | length
--------------+-------
0 1 | 1
0 2 | 2
0 3 | 2
0 4 | 4
0 5 | 4
1 1 | 1
1 2 | 1
1 3 | 1
1 4 | 1
1 5 | 1
2 1 | 1
2 2 | 2
2 3 | 2
2 4 | 2
2 5 | 2
3 1 | 1
3 2 | 1
3 3 | 1
3 4 | 1
3 5 | 1
We might need something like this for the cfam chardevs as well, for example we don't currently implement any alignment restrictions / handling in the hardware master driver.
--- drivers/fsi/fsi-core.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
drivers/fsi/fsi-core.c +27 -4
@@ -544,6 +544,31 @@ static int fsi_slave_scan(struct fsi_slave *slave)return 0 ; } +static unsigned long aligned_access_size (size_t offset,size_t count) +{ +unsigned long offset_unit, count_unit; + +/* Criteria: +* +* 1. Access size must be less than or equal to the maximum access +* width or the highest power-of-two factor of offset +* 2. Access size must be less than or equal to the amount specified by +* count +* +* The access width is optimal if we can calculate 1 to be strictly +* equal while still satisfying 2. +*/ + +/* Find 1 by the bottom bit of offset (with a 4 byte access cap) */ + offset_unit =BIT (__builtin_ctzl (offset |4 )); + +/* Find 2 by the top bit of count */ + count_unit =BIT (8 *sizeof (unsigned long ) -1 -__builtin_clzl (count)); + +/* Constrain the maximum access width to the minimum of both criteria */ +return BIT (__builtin_ctzl (offset_unit | count_unit)); +} +static ssize_t fsi_slave_sysfs_raw_read (struct file *file,struct kobject *kobj,struct bin_attribute *attr,char *buf,loff_t off,size_t count)
@@ -559,8 +584,7 @@ static ssize_t fsi_slave_sysfs_raw_read(struct file *file,return -EINVAL ;for (total_len =0 ; total_len < count; total_len += read_len) { - read_len =min_t (size_t, count,4 ); - read_len -= off &0x3 ; + read_len =aligned_access_size (off, count - total_len); rc =fsi_slave_read (slave, off, buf + total_len, read_len);if (rc)
@@ -587,8 +611,7 @@ static ssize_t fsi_slave_sysfs_raw_write(struct file *file,return -EINVAL ;for (total_len =0 ; total_len < count; total_len += write_len) { - write_len =min_t (size_t, count,4 ); - write_len -= off &0x3 ; + write_len =aligned_access_size (off, count - total_len); rc =fsi_slave_write (slave, off, buf + total_len, write_len);if (rc)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 234/350 xen/gntdev: Use select for DMA_SHARED_BUFFER
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit fa6614d8ef13c63aac52ad7c07c5e69ce4aba3dd ]
DMA_SHARED_BUFFER can not be enabled by the user (it represents a library set in the kernel). The kconfig convention is to use select for such symbols so they are turned on implicitly when the user enables a kconfig that needs them.
Otherwise the XEN_GNTDEV_DMABUF kconfig is overly difficult to enable.
--- drivers/xen/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/xen/Kconfig +2 -1
@@ -141,7 +141,8 @@ config XEN_GNTDEV config XEN_GNTDEV_DMABUF bool "Add support for dma-buf grant access device driver extension" - depends on XEN_GNTDEV && XEN_GRANT_DMA_ALLOC && DMA_SHARED_BUFFER + depends on XEN_GNTDEV && XEN_GRANT_DMA_ALLOC + select DMA_SHARED_BUFFER help Allows userspace processes and kernel modules to use Xen backed dma-buf implementation. With this extension grant references to
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Sasha Levin
maintainerPATCH 252/350 media: pvrusb2: Fix oops on tear-down when radio support is not present
In reply to Sasha LevinFrom: Mike Isely <[email protected]>
[ Upstream commit 7f404ae9cf2a285f73b3c18ab9303d54b7a3d8e1 ]
In some device configurations there's no radio or radio support in the driver. That's OK, as the driver sets itself up accordingly. However on tear-down in these caes it's still trying to tear down radio related context when there isn't anything there, leading to dereferences through a null pointer and chaos follows.
How this bug survived unfixed for 11 years in the pvrusb2 driver is a mystery to me.
[hverkuil: fix two checkpatch warnings]
--- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +7 -2
@@ -898,8 +898,12 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp)pvr2_v4l2_dev_disassociate_parent (vp->dev_video);pvr2_v4l2_dev_disassociate_parent (vp->dev_radio);if (!list_empty (&vp->dev_video->devbase.fh_list) || - !list_empty (&vp->dev_radio->devbase.fh_list)) + (vp->dev_radio && + !list_empty (&vp->dev_radio->devbase.fh_list))) { +pvr2_trace (PVR2_TRACE_STRUCT , +"pvr2_v4l2 internal_check exit-empty id=%p" , vp);return ; + }pvr2_v4l2_destroy_no_lock (vp); }
@@ -935,7 +939,8 @@ static int pvr2_v4l2_release(struct file *file)kfree (fhp);if (vp->channel.mc_head->disconnect_flag &&list_empty (&vp->dev_video->devbase.fh_list) && -list_empty (&vp->dev_radio->devbase.fh_list)) { + (!vp->dev_radio || +list_empty (&vp->dev_radio->devbase.fh_list))) {pvr2_v4l2_destroy_no_lock (vp); }return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 253/350 soundwire: intel: fix PDI/stream mapping for Bulk
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit c134f914e9f55b7817e2bae625ec0e5f1379f7cd ]
The previous formula is incorrect for PDI0/1, the mapping is not linear but has a discontinuity between PDI1 and PDI2.
This change has no effect on PCM PDIs (same mapping).
--- drivers/soundwire/intel.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/soundwire/intel.c +8 -2
@@ -479,7 +479,10 @@ intel_pdi_shim_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)unsigned int link_id = sdw->instance;int pdi_conf =0 ; - pdi->intel_alh_id = (link_id *16 ) + pdi->num +5 ; +/* the Bulk and PCM streams are not contiguous */ + pdi->intel_alh_id = (link_id *16 ) + pdi->num +3 ; +if (pdi->num >=2 ) + pdi->intel_alh_id +=2 ;/* * Program stream parameters to stream SHIM register
@@ -508,7 +511,10 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)unsigned int link_id = sdw->instance;unsigned int conf; - pdi->intel_alh_id = (link_id *16 ) + pdi->num +5 ; +/* the Bulk and PCM streams are not contiguous */ + pdi->intel_alh_id = (link_id *16 ) + pdi->num +3 ; +if (pdi->num >=2 ) + pdi->intel_alh_id +=2 ;/* Program Stream config ALH register */ conf =intel_readl (alh,SDW_ALH_STRMZCFG (pdi->intel_alh_id));
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 256/350 iio: imu: st_lsm6dsx: fix ODR check in st_lsm6dsx_write_raw
In reply to Sasha LevinFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit fc3f6ad7f5dc6c899fbda0255865737bac88c2e0 ]
Since st_lsm6dsx i2c master controller relies on accel device as trigger and slave devices can run at different ODRs we must select an accel_odr >= slave_odr. Report real accel ODR in st_lsm6dsx_check_odr() in order to properly set sensor frequency in st_lsm6dsx_write_raw and avoid to report unsupported frequency
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +5 -4
@@ -985,8 +985,7 @@ int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u16 odr, u8 *val)return -EINVAL ; *val = odr_table->odr_avl[i].val; - -return 0 ; +return odr_table->odr_avl[i].hz; } static u16 st_lsm6dsx_check_odr_dependency(struct st_lsm6dsx_hw *hw, u16 odr,
@@ -1149,8 +1148,10 @@ static int st_lsm6dsx_write_raw(struct iio_dev *iio_dev,case IIO_CHAN_INFO_SAMP_FREQ : {u8 data; - err =st_lsm6dsx_check_odr (sensor, val, &data); -if (!err) + val =st_lsm6dsx_check_odr (sensor, val, &data); +if (val <0 ) + err = val; +else sensor->odr = val;break ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 260/350 iio: cros_ec_baro: set info_mask_shared_by_all_available field
In reply to Sasha LevinFrom: Gwendal Grignou <[email protected]>
[ Upstream commit e9a4cbcaaa391ef44d623d548ee715e77265030c ]
Field was already set for light/proximity and
accelerometer/gyroscope/magnetometer sensors.
--- drivers/iio/pressure/cros_ec_baro.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/pressure/cros_ec_baro.c +3 -0
@@ -114,6 +114,7 @@ static int cros_ec_baro_write(struct iio_dev *indio_dev,static const struct iio_info cros_ec_baro_info = { .read_raw = &cros_ec_baro_read, .write_raw = &cros_ec_baro_write, + .read_avail = &cros_ec_sensors_core_read_avail, };static int cros_ec_baro_probe (struct platform_device *pdev)
@@ -149,6 +150,8 @@ static int cros_ec_baro_probe(struct platform_device *pdev)BIT (IIO_CHAN_INFO_SCALE ) |BIT (IIO_CHAN_INFO_SAMP_FREQ ) |BIT (IIO_CHAN_INFO_FREQUENCY ); + channel->info_mask_shared_by_all_available = +BIT (IIO_CHAN_INFO_SAMP_FREQ ); channel->scan_type.realbits =CROS_EC_SENSOR_BITS ; channel->scan_type.storagebits =CROS_EC_SENSOR_BITS ; channel->scan_type.shift =0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 263/350 media: vim2m: media_device_cleanup was called too early
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit 9f22e88a4bba270d3427684cee84dfbf67489e86 ]
Running the contrib/test/test-media script in v4l-utils with the vim2m argument will cause this kernel warning:
[ 554.430157] ------------[ cut here ]------------ [ 554.433034] DEBUG_LOCKS_WARN_ON(lock->magic != lock) [ 554.433064] WARNING: CPU: 0 PID: 616 at kernel/locking/mutex.c:938 __mutex_lock+0xd7a/0x1380 [ 554.439736] Modules linked in: vim2m v4l2_mem2mem vivid rc_cec videobuf2_dma_contig v4l2_dv_timings cec videobuf2_vmalloc videobuf2_memops v4l2_tpg videobuf2_v4l2 videobuf2_common videodev mc rc_core [last unloaded: vivid] [ 554.445794] CPU: 0 PID: 616 Comm: sleep Not tainted 5.4.0-rc1-virtme #1 [ 554.448481] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014 [ 554.453088] RIP: 0010:__mutex_lock+0xd7a/0x1380 [ 554.454955] Code: d2 0f 85 de 05 00 00 44 8b 05 82 d9 f7 00 45 85 c0 0f 85 bf f3 ff ff 48 c7 c6 e0 30 a6 b7 48 c7 c7 e0 2e a6 b7 e8 5c 76 36 fe <0f> 0b e9 a5 f3 ff ff 65 48 8b 1c 25 80 ef 01 00 be 08 00 00 00 48 [ 554.462836] RSP: 0018:ffff88803a4cfad0 EFLAGS: 00010282 [ 554.465129] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffffb5a3d24f [ 554.468143] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffffb85273f4 [ 554.471000] RBP: ffff88803a4cfc50 R08: fffffbfff701e681 R09: fffffbfff701e681 [ 554.473990] R10: fffffbfff701e680 R11: ffffffffb80f3403 R12: 0000000000000000 [ 554.476831] R13: dffffc0000000000 R14: ffffffffb9714f00 R15: ffff888053103fc8 [ 554.479622] FS: 00007fac6358a540(0000) GS:ffff88805d000000(0000) knlGS:0000000000000000 [ 554.482673] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 554.484949] CR2: 00007fac6343faf0 CR3: 0000000036c22000 CR4: 00000000003406f0 [ 554.487811] Call Trace: [ 554.488860] ? v4l2_release+0x1b8/0x390 [videodev] [ 554.490818] ? do_exit+0x946/0x2980 [ 554.492269] ? mutex_lock_io_nested+0x1250/0x1250 [ 554.494128] ? __lock_acquire+0xe90/0x3c30 [ 554.495774] ? fsnotify_first_mark+0x120/0x120 [ 554.497487] ? vim2m_device_release+0x50/0x50 [vim2m] [ 554.499469] ? v4l2_release+0x1b8/0x390 [videodev] [ 554.501493] v4l2_release+0x1b8/0x390 [videodev] [ 554.503430] __fput+0x256/0x790 [ 554.504711] task_work_run+0x109/0x190 [ 554.506145] do_exit+0x95e/0x2980 [ 554.507421] ? vfs_lock_file+0x21/0xf0 [ 554.509013] ? find_held_lock+0x33/0x1c0 [ 554.510382] ? __close_fd+0xee/0x190 [ 554.511862] ? release_task.part.21+0x1310/0x1310 [ 554.513701] ? lock_downgrade+0x6d0/0x6d0 [ 554.515299] do_group_exit+0xeb/0x2d0 [ 554.516862] __x64_sys_exit_group+0x35/0x40 [ 554.518610] do_syscall_64+0x90/0x450 [ 554.520142] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 554.522289] RIP: 0033:0x7fac6348ecf6 [ 554.523876] Code: Bad RIP value. [ 554.525294] RSP: 002b:00007ffe6373dc58 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 554.528555] RAX: ffffffffffffffda RBX: 00007fac6357f760 RCX: 00007fac6348ecf6 [ 554.531537] RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000 [ 554.534709] RBP: 0000000000000000 R08: 00000000000000e7 R09: ffffffffffffff80 [ 554.536752] R10: 00007ffe6373db24 R11: 0000000000000246 R12: 00007fac6357f760 [ 554.538643] R13: 0000000000000002 R14: 00007fac63588428 R15: 0000000000000000 [ 554.540634] irq event stamp: 21731 [ 554.541618] hardirqs last enabled at (21731): [<ffffffffb75b3cd4>] _raw_spin_unlock_irq+0x24/0x30 [ 554.544145] hardirqs last disabled at (21730): [<ffffffffb75b3ada>] _raw_spin_lock_irq+0xa/0x40 [ 554.547027] softirqs last enabled at (20148): [<ffffffffb780064d>] __do_softirq+0x64d/0x906 [ 554.550385] softirqs last disabled at (19857): [<ffffffffb5926bd5>] irq_exit+0x175/0x1a0 [ 554.553668] ---[ end trace a389c80c2ca84244 ]---
This is caused by media_device_cleanup() which destroys v4l2_dev->mdev->req_queue_mutex. But v4l2_release() tries to lock that mutex after media_device_cleanup() is called.
By moving media_device_cleanup() to the video_device's release function it is guaranteed that the mutex is valid whenever v4l2_release is called.
--- drivers/media/platform/vim2m.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/vim2m.c +3 -1
@@ -1275,6 +1275,9 @@ static void vim2m_device_release(struct video_device *vdev)v4l2_device_unregister (&dev->v4l2_dev);v4l2_m2m_release (dev->m2m_dev); +#ifdef CONFIG_MEDIA_CONTROLLER +media_device_cleanup (&dev->mdev); +#endif kfree (dev); }
@@ -1399,7 +1402,6 @@ static int vim2m_remove(struct platform_device *pdev)#ifdef CONFIG_MEDIA_CONTROLLER media_device_unregister (&dev->mdev);v4l2_m2m_unregister_media_controller (dev->m2m_dev); -media_device_cleanup (&dev->mdev);#endif video_unregister_device (&dev->vfd);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 254/350 crypto: atmel - Fix authenc support when it is set to m
In reply to Sasha LevinFrom: Herbert Xu <[email protected]>
[ Upstream commit 1520c72596dde7f22b8bd6bed3ef7df2b8b7ef39 ]
As it is if CONFIG_CRYPTO_DEV_ATMEL_AUTHENC is set to m it is in effect disabled. This patch fixes it by using IS_ENABLED instead of ifdef.
--- drivers/crypto/atmel-aes.c | 18 +++++++++--------- drivers/crypto/atmel-authenc.h | 2 +- drivers/crypto/atmel-sha.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/crypto/atmel-aes.c +9 -9
@@ -145,7 +145,7 @@ struct atmel_aes_xts_ctx {u32 key2[AES_KEYSIZE_256 /sizeof (u32)]; }; -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) struct atmel_aes_authenc_ctx { struct atmel_aes_base_ctx base; struct atmel_sha_authenc_ctx *auth;
@@ -157,7 +157,7 @@ struct atmel_aes_reqctx {u32 lastc[AES_BLOCK_SIZE /sizeof (u32)]; }; -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) struct atmel_aes_authenc_reqctx { struct atmel_aes_reqctx base;
@@ -486,13 +486,13 @@ static inline bool atmel_aes_is_encrypt(const struct atmel_aes_dev *dd)return (dd->flags &AES_FLAGS_ENCRYPT ); } -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )static void atmel_aes_authenc_complete (struct atmel_aes_dev *dd,int err);#endif static inline int atmel_aes_complete (struct atmel_aes_dev *dd,int err) { -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )if (dd->ctx->is_aead)atmel_aes_authenc_complete (dd, err);#endif
@@ -1973,7 +1973,7 @@ static struct crypto_alg aes_xts_alg = { } }; -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )/* authenc aead functions */ static int atmel_aes_authenc_start (struct atmel_aes_dev *dd);
@@ -2460,7 +2460,7 @@ static void atmel_aes_unregister_algs(struct atmel_aes_dev *dd) {int i; -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )if (dd->caps.has_authenc)for (i =0 ; i <ARRAY_SIZE (aes_authenc_algs); i++)crypto_unregister_aead (&aes_authenc_algs[i]);
@@ -2507,7 +2507,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd) goto err_aes_xts_alg; } -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )if (dd->caps.has_authenc) {for (i =0 ; i <ARRAY_SIZE (aes_authenc_algs); i++) { err =crypto_register_aead (&aes_authenc_algs[i]);
@@ -2519,7 +2519,7 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd)return 0 ; -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )/* i = ARRAY_SIZE(aes_authenc_algs); */ err_aes_authenc_alg:for (j =0 ; j < i; j++)
@@ -2709,7 +2709,7 @@ static int atmel_aes_probe(struct platform_device *pdev)atmel_aes_get_cap (aes_dd); -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )if (aes_dd->caps.has_authenc && !atmel_sha_authenc_is_ready ()) { err = -EPROBE_DEFER ; goto iclk_unprepare;
drivers/crypto/atmel-authenc.h +1 -1
@@ -12,7 +12,7 @@#ifndef __ATMEL_AUTHENC_H__#define __ATMEL_AUTHENC_H__ -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )#include <crypto/authenc.h> #include <crypto/hash.h>
drivers/crypto/atmel-sha.c +1 -1
@@ -2212,7 +2212,7 @@ static struct ahash_alg sha_hmac_algs[] = { }, }; -#ifdef CONFIG_CRYPTO_DEV_ATMEL_AUTHENC +#if IS_ENABLED (CONFIG_CRYPTO_DEV_ATMEL_AUTHENC )/* authenc functions */ static int atmel_sha_authenc_init2 (struct atmel_sha_dev *dd);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 206/350 nvmem: imx-ocotp: reset error status on probe
In reply to Sasha LevinFrom: Lucas Stach <[email protected]>
[ Upstream commit c33c585f1b3a99d53920bdac614aca461d8db06f ]
If software running before the OCOTP driver is loaded left the controller with the error status pending, the driver will never be able to complete the read timing setup. Reset the error status on probe to make sure the controller is in usable state.
--- drivers/nvmem/imx-ocotp.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/nvmem/imx-ocotp.c +4 -0
@@ -521,6 +521,10 @@ static int imx_ocotp_probe(struct platform_device *pdev)if (IS_ERR (priv->clk))return PTR_ERR (priv->clk); +clk_prepare_enable (priv->clk); +imx_ocotp_clr_err_if_set (priv->base); +clk_disable_unprepare (priv->clk); + priv->params =of_device_get_match_data (&pdev->dev); imx_ocotp_nvmem_config.size =4 * priv->params->nregs; imx_ocotp_nvmem_config.dev = dev;
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 269/350 ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint
In reply to Sasha LevinFrom: Yu-Hsuan Hsu <[email protected]>
[ Upstream commit e2db787bdcb4f2722ecf410168f0583764634e45 ]
On KBL platform, the microphone is attached to external codec(rt5514) instead of PCH. However, TDM slot between PCH and codec is 16 bits only. In order to avoid setting wrong format, we should add a constraint to force to use 16 bits format forever.
--- sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +3 -0
@@ -400,6 +400,9 @@ static int kabylake_dmic_startup(struct snd_pcm_substream *substream)snd_pcm_hw_constraint_list (runtime,0 ,SNDRV_PCM_HW_PARAM_CHANNELS , dmic_constraints); + runtime->hw.formats =SNDRV_PCM_FMTBIT_S16_LE ; +snd_pcm_hw_constraint_msbits (runtime,0 ,16 ,16 ); +return snd_pcm_hw_constraint_list (substream->runtime,0 ,SNDRV_PCM_HW_PARAM_RATE , &constraints_rates); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 271/350 r8169: respect EEE user setting when restarting network
In reply to Sasha LevinFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 7ec3f872bc85ada93db34448d73bb399d6b82c2c ]
Currently, if network is re-started, we advertise all supported EEE modes, thus potentially overriding a manual adjustment the user made e.g. via ethtool. Be friendly to the user and preserve a manual setting on network re-start.
--- drivers/net/ethernet/realtek/r8169_main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +15 -3
@@ -680,6 +680,7 @@ struct rtl8169_private {struct rtl8169_counters *counters;struct rtl8169_tc_offsets tc_offset;u32 saved_wolopts; +int eee_adv;const char *fw_name;struct rtl_fw *rtl_fw;
@@ -2075,6 +2076,10 @@ static int rtl8169_set_eee(struct net_device *dev, struct ethtool_eee *data) } ret =phy_ethtool_set_eee (tp->phydev, data); + +if (!ret) + tp->eee_adv =phy_read_mmd (dev->phydev,MDIO_MMD_AN , +MDIO_AN_EEE_ADV ); out:pm_runtime_put_noidle (d);return ret;
@@ -2105,10 +2110,16 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {static void rtl_enable_eee (struct rtl8169_private *tp) {struct phy_device *phydev = tp->phydev; -int supported =phy_read_mmd (phydev,MDIO_MMD_PCS ,MDIO_PCS_EEE_ABLE ); +int adv; + +/* respect EEE advertisement the user may have set */ +if (tp->eee_adv >=0 ) + adv = tp->eee_adv; +else + adv =phy_read_mmd (phydev,MDIO_MMD_PCS ,MDIO_PCS_EEE_ABLE ); -if (supported >0 ) -phy_write_mmd (phydev,MDIO_MMD_AN ,MDIO_AN_EEE_ADV , supported); +if (adv >=0 ) +phy_write_mmd (phydev,MDIO_MMD_AN ,MDIO_AN_EEE_ADV , adv); }static void rtl8169_get_mac_version (struct rtl8169_private *tp)
@@ -7064,6 +7075,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) tp->pci_dev = pdev; tp->msg_enable =netif_msg_init (debug.msg_enable,R8169_MSG_DEFAULT ); tp->supports_gmii = ent->driver_data ==RTL_CFG_NO_GBIT ?0 :1 ; + tp->eee_adv =-1 ;/* Get the *optional* external "ether_clk" used on some boards */ rc =rtl_get_ether_clk (tp);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 282/350 qtnfmac: fix invalid channel information output
In reply to Sasha LevinFrom: Sergey Matyukevich <[email protected]>
[ Upstream commit 24227a9e956a7c9913a7e6e7199a9ae3f540fe88 ]
Do not attempt to print frequency for an invalid channel provided by firmware. That channel may simply not exist.
--- drivers/net/wireless/quantenna/qtnfmac/event.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/event.c +4 -3
@@ -171,8 +171,9 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,return -EPROTO ; } -pr_debug ("VIF%u.%u: BSSID:%pM status:%u\n" , - vif->mac->macid, vif->vifid, join_info->bssid, status); +pr_debug ("VIF%u.%u: BSSID:%pM chan:%u status:%u\n" , + vif->mac->macid, vif->vifid, join_info->bssid, +le16_to_cpu (join_info->chan.chan.center_freq), status);if (status !=WLAN_STATUS_SUCCESS ) goto done;
@@ -181,7 +182,7 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,if (!cfg80211_chandef_valid (&chandef)) {pr_warn ("MAC%u.%u: bad channel freq=%u cf1=%u cf2=%u bw=%u\n" , vif->mac->macid, vif->vifid, - chandef.chan->center_freq, + chandef.chan ? chandef.chan->center_freq :0 , chandef.center_freq1, chandef.center_freq2, chandef.width);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 283/350 x86/crash: Add a forward declaration of struct kimage
In reply to Sasha LevinFrom: Lianbo Jiang <[email protected]>
[ Upstream commit 112eee5d06007dae561f14458bde7f2a4879ef4e ]
Add a forward declaration of struct kimage to the crash.h header because future changes will invoke a crash-specific function from the realmode init path and the compiler will complain otherwise like this:
In file included from arch/x86/realmode/init.c:11:
./arch/x86/include/asm/crash.h:5:32: warning: ‘struct kimage’ declared inside\
parameter list will not be visible outside of this definition or declaration
5 | int crash_load_segments(struct kimage *image);
| ^~~~~~
./arch/x86/include/asm/crash.h:6:37: warning: ‘struct kimage’ declared inside\
parameter list will not be visible outside of this definition or declaration
6 | int crash_copy_backup_region(struct kimage *image);
| ^~~~~~ ./arch/x86/include/asm/crash.h:7:39: warning: ‘struct kimage’ declared inside\
parameter list will not be visible outside of this definition or declaration
7 | int crash_setup_memmap_entries(struct kimage *image,
|
[ bp: Rewrite the commit message. ]
--- arch/x86/include/asm/crash.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/crash.h +2 -0
@@ -2,6 +2,8 @@#ifndef _ASM_X86_CRASH_H#define _ASM_X86_CRASH_H +struct kimage ; +int crash_load_segments (struct kimage *image);int crash_copy_backup_region (struct kimage *image); int crash_setup_memmap_entries(struct kimage *image,
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Sasha Levin
maintainerPATCH 284/350 qtnfmac: fix using skb after free
In reply to Sasha LevinFrom: Sergey Matyukevich <[email protected]>
[ Upstream commit 4a33f21cef84b1b933958c99ed5dac1726214b35 ]
KASAN reported use-after-free error:
[ 995.220767] BUG: KASAN: use-after-free in qtnf_cmd_send_with_reply+0x169/0x3e0 [qtnfmac] [ 995.221098] Read of size 2 at addr ffff888213d1ded0 by task kworker/1:1/71
The issue in qtnf_cmd_send_with_reply impacts all the commands that do not need response other then return code. For such commands, consume_skb is used for response skb and right after that return code in response skb is accessed.
--- drivers/net/wireless/quantenna/qtnfmac/commands.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/commands.c +4 -2
@@ -83,6 +83,7 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus,struct qlink_cmd *cmd;struct qlink_resp *resp =NULL ;struct sk_buff *resp_skb =NULL ; +int resp_res =0 ;u16 cmd_id;u8 mac_id;u8 vif_id;
@@ -113,6 +114,7 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus, } resp = (struct qlink_resp *)resp_skb->data; + resp_res =le16_to_cpu (resp->result); ret =qtnf_cmd_check_reply_header (resp, cmd_id, mac_id, vif_id, const_resp_size);if (ret)
@@ -128,8 +130,8 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus,else consume_skb (resp_skb); -if (!ret && resp) -return qtnf_cmd_resp_result_decode (le16_to_cpu (resp->result)); +if (!ret) +return qtnf_cmd_resp_result_decode (resp_res);pr_warn ("VIF%u.%u: cmd 0x%.4X failed: %d\n" , mac_id, vif_id, cmd_id, ret);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 286/350 RDMA/efa: Clear the admin command buffer prior to its submission
In reply to Sasha LevinFrom: Gal Pressman <[email protected]>
[ Upstream commit 64c264872b8879e2ab9017eefe9514d4c045c60e ]
We cannot rely on the entry memcpy as we only copy the actual size of the command, the rest of the bytes must be memset to zero.
Currently providing non-zero memory will not have any user visible impact. However, since admin commands are extendable (in a backwards compatible way) everything beyond the size of the command must be cleared to prevent issues in the future.
--- drivers/infiniband/hw/efa/efa_com.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/efa/efa_com.c +4 -1
@@ -317,6 +317,7 @@ static struct efa_comp_ctx *__efa_com_submit_admin_cmd(struct efa_com_admin_queu struct efa_admin_acq_entry *comp, size_t comp_size_in_bytes) { +struct efa_admin_aq_entry *aqe;struct efa_comp_ctx *comp_ctx;u16 queue_size_mask;u16 cmd_id;
@@ -350,7 +351,9 @@ static struct efa_comp_ctx *__efa_com_submit_admin_cmd(struct efa_com_admin_queureinit_completion (&comp_ctx->wait_event); -memcpy (&aq->sq.entries[pi], cmd, cmd_size_in_bytes); + aqe = &aq->sq.entries[pi]; +memset (aqe,0 ,sizeof (*aqe)); +memcpy (aqe, cmd, cmd_size_in_bytes); aq->sq.pc++;atomic64_inc (&aq->stats.submitted_cmd);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 293/350 regulator: core: Let boot-on regulators be powered off
In reply to Sasha LevinFrom: Pascal Paillet <[email protected]>
[ Upstream commit 089b3f61ecfc43ca4ea26d595e1d31ead6de3f7b ]
Boot-on regulators are always kept on because their use_count value is now incremented at boot time and never cleaned.
Only increment count value for alway-on regulators. regulator_late_cleanup() is now able to power off boot-on regulators when unused.
--- drivers/regulator/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/regulator/core.c +3 -1
@@ -1403,7 +1403,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,rdev_err (rdev,"failed to enable\n" );return ret; } - rdev->use_count++; + +if (rdev->constraints->always_on) + rdev->use_count++; }print_constraints (rdev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 297/350 crypto: virtio - deal with unsupported input sizes
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 19c5da7d4a2662e85ea67d2d81df57e038fde3ab ]
Return -EINVAL for input sizes that are not a multiple of the AES block size, since they are not supported by our CBC chaining mode.
While at it, remove the pr_err() that reports unsupported key sizes being used: we shouldn't spam the kernel log with that.
--- drivers/crypto/virtio/virtio_crypto_algs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_crypto_algs.c +10 -2
@@ -105,8 +105,6 @@ virtio_crypto_alg_validate_key(int key_len, uint32_t *alg) *alg =VIRTIO_CRYPTO_CIPHER_AES_CBC ;break ;default : -pr_err ("virtio_crypto: Unsupported key length: %d\n" , - key_len);return -EINVAL ; }return 0 ;
@@ -484,6 +482,11 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
@@ -504,6 +507,11 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 300/350 btrfs: don't prematurely free work in run_ordered_work()
In reply to Sasha LevinFrom: Omar Sandoval <[email protected]>
[ Upstream commit c495dcd6fbe1dce51811a76bb85b4675f6494938 ]
We hit the following very strange deadlock on a system with Btrfs on a loop device backed by another Btrfs filesystem:
1. The top (loop device) filesystem queues an async_cow work item from cow_file_range_async(). We'll call this work X.
2. Worker thread A starts work X (normal_work_helper()).
3. Worker thread A executes the ordered work for the top filesystem (run_ordered_work()).
4. Worker thread A finishes the ordered work for work X and frees X (work->ordered_free()).
5. Worker thread A executes another ordered work and gets blocked on I/O to the bottom filesystem (still in run_ordered_work()).
6. Meanwhile, the bottom filesystem allocates and queues an async_cow work item which happens to be the recently-freed X.
7. The workqueue code sees that X is already being executed by worker thread A, so it schedules X to be executed _after_ worker thread A finishes (see the find_worker_executing_work() call in process_one_work()).
Now, the top filesystem is waiting for I/O on the bottom filesystem, but the bottom filesystem is waiting for the top filesystem to finish, so we deadlock.
This happens because we are breaking the workqueue assumption that a work item cannot be recycled while it still depends on other work. Fix it by waiting to free the work item until we are done with all of the related ordered work.
P.S.:
One might ask why the workqueue code doesn't try to detect a recycled work item. It actually does try by checking whether the work item has the same work function (find_worker_executing_work()), but in our case the function is the same. This is the only key that the workqueue code has available to compare, short of adding an additional, layer-violating "custom key". Considering that we're the only ones that have ever hit this, we should just play by the rules.
Unfortunately, we haven't been able to create a minimal reproducer other than our full container setup using a compress-force=zstd filesystem on top of another compress-force=zstd filesystem.
--- fs/btrfs/async-thread.c | 56 ++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 12 deletions(-)
fs/btrfs/async-thread.c +44 -12
@@ -252,16 +252,17 @@ static inline void thresh_exec_hook(struct __btrfs_workqueue *wq) } } -static void run_ordered_work (struct __btrfs_workqueue *wq) +static void run_ordered_work (struct __btrfs_workqueue *wq, +struct btrfs_work *self) {struct list_head *list = &wq->ordered_list;struct btrfs_work *work;spinlock_t *lock = &wq->list_lock;unsigned long flags; +void *wtag; +bool free_self = false;while (1 ) { -void *wtag; -spin_lock_irqsave (lock, flags);if (list_empty (list))break ;
@@ -287,16 +288,47 @@ static void run_ordered_work(struct __btrfs_workqueue *wq)list_del (&work->ordered_list);spin_unlock_irqrestore (lock, flags); -/* -* We don't want to call the ordered free functions with the -* lock held though. Save the work as tag for the trace event, -* because the callback could free the structure. -*/ - wtag = work; - work->ordered_free (work); -trace_btrfs_all_work_done (wq->fs_info, wtag); +if (work == self) { +/* +* This is the work item that the worker is currently +* executing. +* +* The kernel workqueue code guarantees non-reentrancy +* of work items. I.e., if a work item with the same +* address and work function is queued twice, the second +* execution is blocked until the first one finishes. A +* work item may be freed and recycled with the same +* work function; the workqueue code assumes that the +* original work item cannot depend on the recycled work +* item in that case (see find_worker_executing_work()). +* +* Note that the work of one Btrfs filesystem may depend +* on the work of another Btrfs filesystem via, e.g., a +* loop device. Therefore, we must not allow the current +* work item to be recycled until we are really done, +* otherwise we break the above assumption and can +* deadlock. +*/ + free_self = true; + }else { +/* +* We don't want to call the ordered free functions with +* the lock held though. Save the work as tag for the +* trace event, because the callback could free the +* structure. +*/ + wtag = work; + work->ordered_free (work); +trace_btrfs_all_work_done (wq->fs_info, wtag); + } }spin_unlock_irqrestore (lock, flags); + +if (free_self) { + wtag = self; + self->ordered_free (self); +trace_btrfs_all_work_done (wq->fs_info, wtag); + } }static void normal_work_helper (struct btrfs_work *work)
@@ -324,7 +356,7 @@ static void normal_work_helper(struct btrfs_work *work) work->func (work);if (need_order) {set_bit (WORK_DONE_BIT , &work->flags); -run_ordered_work (wq); +run_ordered_work (wq, work); }if (!need_order)trace_btrfs_all_work_done (wq->fs_info, wtag);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 228/350 perf tools: Fix cross compile for ARM64
In reply to Sasha LevinFrom: John Garry <[email protected]>
[ Upstream commit 71f699078b154fcb1c9162fd0208ada9ce532ffc ]
Currently when cross compiling perf tool for ARM64 on my x86 machine I get this error:
arch/arm64/util/sym-handling.c:9:10: fatal error: gelf.h: No such file or directory
#include <gelf.h>
For the build, libelf is reported off:
Auto-detecting system features:
...
... libelf: [ OFF ]
Indeed, test-libelf is not built successfully:
more ./build/feature/test-libelf.make.output test-libelf.c:2:10: fatal error: libelf.h: No such file or directory
#include <libelf.h>
^~~~~~~~~~compilation terminated.
I have no such problems natively compiling on ARM64, and I did not previously have this issue for cross compiling. Fix by relocating the gelf.h include.
--- tools/perf/arch/arm64/util/sym-handling.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/arch/arm64/util/sym-handling.c +2 -1
@@ -6,9 +6,10 @@#include "symbol.h" // for the elf__needs_adjust_symbols() prototype #include <stdbool.h> -#include <gelf.h> #ifdef HAVE_LIBELF_SUPPORT +#include <gelf.h> +bool elf__needs_adjust_symbols (GElf_Ehdr ehdr) { return ehdr.e_type == ET_EXEC ||
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 305/350 perf/core: Fix the mlock accounting, again
In reply to Sasha LevinFrom: Alexander Shishkin <[email protected]>
[ Upstream commit 36b3db03b4741b8935b68fffc7e69951d8d70a89 ]
Commit:
5e6c3c7b1ec2 ("perf/aux: Fix tracking of auxiliary trace buffer allocation")
tried to guess the correct combination of arithmetic operations that would undo the AUX buffer's mlock accounting, and failed, leaking the bottom part when an allocation needs to be charged partially to both user->locked_vm and mm->pinned_vm, eventually leaving the user with no locked bonus:
$ perf record -e intel_pt//u -m1,128 uname [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.061 MB perf.data ]
$ perf record -e intel_pt//u -m1,128 uname Permission error mapping pages. Consider increasing /proc/sys/kernel/perf_event_mlock_kb, or try again with a smaller value of -m/--mmap_pages. (current value: 1,128)
Fix this by subtracting both locked and pinned counts when AUX buffer is unmapped.
--- kernel/events/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/events/core.c +2 -4
@@ -5607,10 +5607,8 @@ static void perf_mmap_close(struct vm_area_struct *vma)perf_pmu_output_stop (event);/* now it's safe to free the pages */ -if (!rb->aux_mmap_locked) -atomic_long_sub (rb->aux_nr_pages, &mmap_user->locked_vm); -else -atomic64_sub (rb->aux_mmap_locked, &vma->vm_mm->pinned_vm); +atomic_long_sub (rb->aux_nr_pages - rb->aux_mmap_locked, &mmap_user->locked_vm); +atomic64_sub (rb->aux_mmap_locked, &vma->vm_mm->pinned_vm);/* this has to be the last one */ rb_free_aux (rb);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 307/350 selftests, bpf: Workaround an alu32 sub-register spilling issue
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
[ Upstream commit 2ea2612b987ad703235c92be21d4e98ee9c2c67c ]
Currently, with latest llvm trunk, selftest test_progs failed obj file test_seg6_loop.o with the following error in verifier:
infinite loop detected at insn 76
The byte code sequence looks like below, and noted that alu32 has been turned off by default for better generated codes in general:
48: w3 = 100
49: *(u32 *)(r10 - 68) = r3
...
; if (tlv.type == SR6_TLV_PADDING) {
76: if w3 == 5 goto -18 <LBB0_19>
...
85: r1 = *(u32 *)(r10 - 68)
; for (int i = 0; i < 100; i++) {
86: w1 += -1
87: if w1 == 0 goto +5 <LBB0_20>
88: *(u32 *)(r10 - 68) = r1The main reason for verification failure is due to partial spills at r10 - 68 for induction variable "i".
Current verifier only handles spills with 8-byte values. The above 4-byte value spill to stack is treated to STACK_MISC and its content is not saved. For the above example:
w3 = 100
R3_w=inv100 fp-64_w=inv1086626730498
*(u32 *)(r10 - 68) = r3
R3_w=inv100 fp-64_w=inv1086626730498
...
r1 = *(u32 *)(r10 - 68)
R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff))
fp-64=inv1086626730498To resolve this issue, verifier needs to be extended to track sub-registers in spilling, or llvm needs to enhanced to prevent sub-register spilling in register allocation phase. The former will increase verifier complexity and the latter will need some llvm "hacking".
Let us workaround this issue by declaring the induction variable as "long" type so spilling will happen at non sub-register level. We can revisit this later if sub-register spilling causes similar or other verification issues.
--- tools/testing/selftests/bpf/progs/test_seg6_loop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/test_seg6_loop.c +3 -1
@@ -132,8 +132,10 @@ static __always_inline int is_valid_tlv_boundary(struct __sk_buff *skb, *pad_off =0 ;// we can only go as far as ~10 TLVs due to the BPF max stack size +// workaround: define induction variable "i" as "long" instead +// of "int" to prevent alu32 sub-register spilling. #pragma clang loop unroll(disable) -for (int i =0 ; i <100 ; i++) { +for (long i =0 ; i <100 ; i++) {struct sr6_tlv_t tlv;if (cur_off == *tlv_off)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 309/350 net: phy: avoid matching all-ones clause 45 PHY IDs
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit b95e86d846b63b02ecdc94802ddbeaf9005fb6d9 ]
We currently match clause 45 PHYs using any ID read from a MMD marked as present in the "Devices in package" registers 5 and 6. However, this is incorrect. 45.2 says:
"The definition of the term package is vendor specific and could be
a chip, module, or other similar entity."
so a package could be more or less than the whole PHY - a PHY could be made up of several modules instantiated onto a single chip such as the Marvell 88x3310, or some of the MMDs could be disabled according to chip configuration, such as the Broadcom 84881.
In the case of Broadcom 84881, the "Devices in package" registers contain 0xc000009b, meaning that there is a PHYXS present in the package, but all registers in MMD 4 return 0xffff. This leads to our matching code incorrectly binding this PHY to one of our generic PHY drivers.
This patch changes the way we determine whether to attempt to match a MMD identifier, or use it to request a module - if the identifier is all-ones, then we skip over it. When reading the identifiers, we initialise phydev->c45_ids.device_ids to all-ones, only reading the device ID if the "Devices in package" registers indicates we should.
This avoids the generic drivers incorrectly matching on a PHY ID of 0xffffffff.
--- drivers/net/phy/phy_device.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/phy/phy_device.c +6 -3
@@ -488,7 +488,7 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv)if (phydev->is_c45) {for (i =1 ; i < num_ids; i++) { -if (!(phydev->c45_ids.devices_in_package & (1 << i))) +if (phydev->c45_ids.device_ids[i] ==0xffffffff )continue ; if ((phydrv->phy_id & phydrv->phy_id_mask) ==
@@ -632,7 +632,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,int i;for (i =1 ; i < num_ids; i++) { -if (!(c45_ids->devices_in_package & (1 << i))) +if (c45_ids->device_ids[i] ==0xffffffff )continue ; ret = phy_request_driver_module(dev,
@@ -812,10 +812,13 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id,*/ struct phy_device *get_phy_device (struct mii_bus *bus,int addr,bool is_c45) { -struct phy_c45_device_ids c45_ids = {0 }; +struct phy_c45_device_ids c45_ids;u32 phy_id =0 ;int r; + c45_ids.devices_in_package =0 ; +memset (c45_ids.device_ids,0xff ,sizeof (c45_ids.device_ids)); + r =get_phy_id (bus, addr, &phy_id, is_c45, &c45_ids);if (r)return ERR_PTR (r);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 311/350 ASoC: Intel: bytcr_rt5640: Update quirk for Acer Switch 10 SW5-012 2-in-1
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 0bb887709eb16bdc4b5baddd8337abf3de72917f ]
When the Acer Switch 10 SW5-012 quirk was added we did not have jack-detection support yet; and the builtin microphone selection of the original quirk is wrong too.
Fix the microphone-input quirk and add jack-detection info so that the internal-microphone and headphone/set jack on the Switch 10 work properly.
--- sound/soc/intel/boards/bytcr_rt5640.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +6 -4
@@ -405,10 +405,12 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {DMI_MATCH (DMI_SYS_VENDOR ,"Acer" ), DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), }, - .driver_data = (void *)(BYT_RT5640_IN1_MAP | -BYT_RT5640_MCLK_EN | -BYT_RT5640_SSP0_AIF1 ), - + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD2_IN4N | +BYT_RT5640_OVCD_TH_2000UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), }, { .matches = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 312/350 x86/insn: Add some Intel instructions to the opcode map
In reply to Sasha LevinFrom: Adrian Hunter <[email protected]>
[ Upstream commit b980be189c9badba50634671e2303e92bf28e35a ]
Add to the opcode map the following instructions:
cldemote
tpause
umonitor
umwait
movdiri
movdir64b
enqcmd
enqcmds
encls
enclu
enclv
pconfig
wbnoinvd
For information about the instructions, refer Intel SDM May 2019 (325462-070US) and Intel Architecture Instruction Set Extensions May 2019 (319433-037).
The instruction decoding can be tested using the perf tools' "x86 instruction decoder - new instructions" test as folllows:
$ perf test -v "new " 2>&1 | grep -i cldemote Decoded ok: 0f 1c 00 cldemote (%eax) Decoded ok: 0f 1c 05 78 56 34 12 cldemote 0x12345678 Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%eax,%ecx,8) Decoded ok: 0f 1c 00 cldemote (%rax) Decoded ok: 41 0f 1c 00 cldemote (%r8) Decoded ok: 0f 1c 04 25 78 56 34 12 cldemote 0x12345678 Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%rax,%rcx,8) Decoded ok: 41 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%r8,%rcx,8) $ perf test -v "new " 2>&1 | grep -i tpause Decoded ok: 66 0f ae f3 tpause %ebx Decoded ok: 66 0f ae f3 tpause %ebx Decoded ok: 66 41 0f ae f0 tpause %r8d $ perf test -v "new " 2>&1 | grep -i umonitor Decoded ok: 67 f3 0f ae f0 umonitor %ax Decoded ok: f3 0f ae f0 umonitor %eax Decoded ok: 67 f3 0f ae f0 umonitor %eax Decoded ok: f3 0f ae f0 umonitor %rax Decoded ok: 67 f3 41 0f ae f0 umonitor %r8d $ perf test -v "new " 2>&1 | grep -i umwait Decoded ok: f2 0f ae f0 umwait %eax Decoded ok: f2 0f ae f0 umwait %eax Decoded ok: f2 41 0f ae f0 umwait %r8d $ perf test -v "new " 2>&1 | grep -i movdiri Decoded ok: 0f 38 f9 03 movdiri %eax,(%ebx) Decoded ok: 0f 38 f9 88 78 56 34 12 movdiri %ecx,0x12345678(%eax) Decoded ok: 48 0f 38 f9 03 movdiri %rax,(%rbx) Decoded ok: 48 0f 38 f9 88 78 56 34 12 movdiri %rcx,0x12345678(%rax) $ perf test -v "new " 2>&1 | grep -i movdir64b Decoded ok: 66 0f 38 f8 18 movdir64b (%eax),%ebx Decoded ok: 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%eax),%ecx Decoded ok: 67 66 0f 38 f8 1c movdir64b (%si),%bx Decoded ok: 67 66 0f 38 f8 8c 34 12 movdir64b 0x1234(%si),%cx Decoded ok: 66 0f 38 f8 18 movdir64b (%rax),%rbx Decoded ok: 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%rax),%rcx Decoded ok: 67 66 0f 38 f8 18 movdir64b (%eax),%ebx Decoded ok: 67 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i enqcmd Decoded ok: f2 0f 38 f8 18 enqcmd (%eax),%ebx Decoded ok: f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%eax),%ecx Decoded ok: 67 f2 0f 38 f8 1c enqcmd (%si),%bx Decoded ok: 67 f2 0f 38 f8 8c 34 12 enqcmd 0x1234(%si),%cx Decoded ok: f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx Decoded ok: 67 f3 0f 38 f8 1c enqcmds (%si),%bx Decoded ok: 67 f3 0f 38 f8 8c 34 12 enqcmds 0x1234(%si),%cx Decoded ok: f2 0f 38 f8 18 enqcmd (%rax),%rbx Decoded ok: f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%rax),%rcx Decoded ok: 67 f2 0f 38 f8 18 enqcmd (%eax),%ebx Decoded ok: 67 f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%eax),%ecx Decoded ok: f3 0f 38 f8 18 enqcmds (%rax),%rbx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%rax),%rcx Decoded ok: 67 f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i enqcmds Decoded ok: f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx Decoded ok: 67 f3 0f 38 f8 1c enqcmds (%si),%bx Decoded ok: 67 f3 0f 38 f8 8c 34 12 enqcmds 0x1234(%si),%cx Decoded ok: f3 0f 38 f8 18 enqcmds (%rax),%rbx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%rax),%rcx Decoded ok: 67 f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i encls Decoded ok: 0f 01 cf encls Decoded ok: 0f 01 cf encls $ perf test -v "new " 2>&1 | grep -i enclu Decoded ok: 0f 01 d7 enclu Decoded ok: 0f 01 d7 enclu $ perf test -v "new " 2>&1 | grep -i enclv Decoded ok: 0f 01 c0 enclv Decoded ok: 0f 01 c0 enclv $ perf test -v "new " 2>&1 | grep -i pconfig Decoded ok: 0f 01 c5 pconfig Decoded ok: 0f 01 c5 pconfig $ perf test -v "new " 2>&1 | grep -i wbnoinvd Decoded ok: f3 0f 09 wbnoinvd Decoded ok: f3 0f 09 wbnoinvd
--- arch/x86/lib/x86-opcode-map.txt | 18 ++++++++++++------ tools/arch/x86/lib/x86-opcode-map.txt | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-)
arch/x86/lib/x86-opcode-map.txt +12 -6
@@ -333,7 +333,7 @@ AVXcode: 1 06: CLTS 07: SYSRET (o64) 08: INVD -09: WBINVD +09: WBINVD | WBNOINVD (F3) 0a: 0b: UD2 (1B) 0c:
@@ -364,7 +364,7 @@ AVXcode: 1 # a ModR/M byte. 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv -1c: +1c: Grp20 (1A),(1C) 1d: 1e: 1f: NOP Ev
@@ -792,6 +792,8 @@ f3: Grp17 (1A) f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) +f9: MOVDIRI My,Gy EndTable Table: 3-byte opcode 2 (0x0f 0x3a)
@@ -943,9 +945,9 @@ GrpTable: Grp6 EndTable GrpTable: Grp7 -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) 3: LIDT Ms 4: SMSW Mw/Rv 5: rdpkru (110),(11B) | wrpkru (111),(11B)
@@ -1020,7 +1022,7 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE | ptwrite Ey (F3),(11B) 5: XRSTOR | lfence (11B) -6: XSAVEOPT | clwb (66) | mfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) 7: clflush | clflushopt (66) | sfence (11B) EndTable
@@ -1051,6 +1053,10 @@ GrpTable: Grp19 6: vscatterpf1qps/d Wx (66),(ev) EndTable +GrpTable: Grp20 +0: cldemote Mb +EndTable + # AMD's Prefetch Group GrpTable: GrpP 0: PREFETCH
tools/arch/x86/lib/x86-opcode-map.txt +12 -6
@@ -333,7 +333,7 @@ AVXcode: 1 06: CLTS 07: SYSRET (o64) 08: INVD -09: WBINVD +09: WBINVD | WBNOINVD (F3) 0a: 0b: UD2 (1B) 0c:
@@ -364,7 +364,7 @@ AVXcode: 1 # a ModR/M byte. 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv -1c: +1c: Grp20 (1A),(1C) 1d: 1e: 1f: NOP Ev
@@ -792,6 +792,8 @@ f3: Grp17 (1A) f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) +f9: MOVDIRI My,Gy EndTable Table: 3-byte opcode 2 (0x0f 0x3a)
@@ -943,9 +945,9 @@ GrpTable: Grp6 EndTable GrpTable: Grp7 -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) 3: LIDT Ms 4: SMSW Mw/Rv 5: rdpkru (110),(11B) | wrpkru (111),(11B)
@@ -1020,7 +1022,7 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE | ptwrite Ey (F3),(11B) 5: XRSTOR | lfence (11B) -6: XSAVEOPT | clwb (66) | mfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) 7: clflush | clflushopt (66) | sfence (11B) EndTable
@@ -1051,6 +1053,10 @@ GrpTable: Grp19 6: vscatterpf1qps/d Wx (66),(ev) EndTable +GrpTable: Grp20 +0: cldemote Mb +EndTable + # AMD's Prefetch Group GrpTable: GrpP 0: PREFETCH
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 313/350 net-af_xdp: Use correct number of channels from ethtool
In reply to Sasha LevinFrom: Luigi Rizzo <[email protected]>
[ Upstream commit 3de88c9113f88c04abda339f1aa629397bf89e02 ]
Drivers use different fields to report the number of channels, so take the maximum of all data channels (rx, tx, combined) when determining the size of the xsk map. The current code used only 'combined' which was set to 0 in some drivers e.g. mlx4.
Tested: compiled and run xdpsock -q 3 -r -S on mlx4
--- tools/lib/bpf/xsk.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/lib/bpf/xsk.c +8 -3
@@ -344,13 +344,18 @@ static int xsk_get_max_queues(struct xsk_socket *xsk) goto out; } -if (err || channels.max_combined ==0 ) +if (err) {/* If the device says it has no channels, then all traffic * is sent to a single stream, so max queues = 1. */ ret =1 ; -else - ret = channels.max_combined; + }else { +/* Take the max of rx, tx, combined. Drivers return +* the number of channels in different ways. +*/ + ret =max (channels.max_rx, channels.max_tx); + ret =max (ret, (int )channels.max_combined); + } out:close (fd);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 318/350 s390/kasan: support memcpy_real with TRACE_IRQFLAGS
In reply to Sasha LevinFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 13f9bae579c6bd051e58f326913dd09af1291208 ]
Currently if the kernel is built with CONFIG_TRACE_IRQFLAGS and KASAN and used as crash kernel it crashes itself due to trace_hardirqs_off/trace_hardirqs_on being called with DAT off. This happens because trace_hardirqs_off/trace_hardirqs_on are instrumented and kasan code tries to perform access to shadow memory to validate memory accesses. Kasan shadow memory is populated with vmemmap, so all accesses require DAT on.
memcpy_real could be called with DAT on or off (with kasan enabled DAT is set even before early code is executed).
Make sure that trace_hardirqs_off/trace_hardirqs_on are called with DAT on and only actual __memcpy_real is called with DAT off.
Also annotate __memcpy_real and _memcpy_real with __no_sanitize_address to avoid further problems due to switching DAT off.
--- arch/s390/mm/maccess.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/s390/mm/maccess.c +8 -4
@@ -70,7 +70,7 @@ void notrace s390_kernel_write(void *dst, const void *src, size_t size)spin_unlock_irqrestore (&s390_kernel_write_lock, flags); } -static int __memcpy_real (void *dest,void *src,size_t count) +static int __no_sanitize_address __memcpy_real(void *dest, void *src, size_t count) { register unsigned long _dest asm("2") = (unsigned long) dest; register unsigned long _len1 asm("3") = (unsigned long) count;
@@ -91,19 +91,23 @@ static int __memcpy_real(void *dest, void *src, size_t count)return rc; } -static unsigned long _memcpy_real (unsigned long dest,unsigned long src, -unsigned long count) +static unsigned long __no_sanitize_address _memcpy_real (unsigned long dest, +unsigned long src, +unsigned long count) {int irqs_disabled, rc;unsigned long flags;if (!count)return 0 ; - flags =__arch_local_irq_stnsm (0xf8UL ); + flags =arch_local_irq_save (); irqs_disabled =arch_irqs_disabled_flags (flags);if (!irqs_disabled)trace_hardirqs_off (); +__arch_local_irq_stnsm (0xf8 );// disable DAT rc =__memcpy_real ((void *) dest, (void *) src, (size_t ) count); +if (flags &PSW_MASK_DAT ) +__arch_local_irq_stosm (0x04 );// enable DAT if (!irqs_disabled)trace_hardirqs_on ();__arch_local_irq_ssm (flags);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 316/350 int128: move __uint128_t compiler test to Kconfig
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit c12d3362a74bf0cd9e1d488918d40607b62a3104 ]
In order to use 128-bit integer arithmetic in C code, the architecture needs to have declared support for it by setting ARCH_SUPPORTS_INT128, and it requires a version of the toolchain that supports this at build time. This is why all existing tests for ARCH_SUPPORTS_INT128 also test whether __SIZEOF_INT128__ is defined, since this is only the case for compilers that can support 128-bit integers.
Let's fold this additional test into the Kconfig declaration of ARCH_SUPPORTS_INT128 so that we can also use the symbol in Makefiles, e.g., to decide whether a certain object needs to be included in the first place.
--- arch/arm64/Kconfig | 2 +- arch/riscv/Kconfig | 2 +- arch/x86/Kconfig | 2 +- crypto/ecc.c | 2 +- init/Kconfig | 4 ++++ lib/ubsan.c | 2 +- lib/ubsan.h | 2 +- 7 files changed, 10 insertions(+), 6 deletions(-)
arch/arm64/Kconfig +1 -1
@@ -67,7 +67,7 @@ config ARM64 select ARCH_USE_QUEUED_SPINLOCKS select ARCH_SUPPORTS_MEMORY_FAILURE select ARCH_SUPPORTS_ATOMIC_RMW - select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 || CC_IS_CLANG + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && (GCC_VERSION >= 50000 || CC_IS_CLANG) select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_COMPAT_IPC_PARSE_VERSION if COMPAT select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
arch/riscv/Kconfig +1 -1
@@ -164,7 +164,7 @@ config ARCH_RV32I config ARCH_RV64I bool "RV64I" select 64BIT - select ARCH_SUPPORTS_INT128 if GCC_VERSION >= 50000 + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000 select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FTRACE_MCOUNT_RECORD
arch/x86/Kconfig +1 -1
@@ -24,7 +24,7 @@ config X86_64 depends on 64BIT # Options that are inherently 64-bit kernel only: select ARCH_HAS_GIGANTIC_PAGE - select ARCH_SUPPORTS_INT128 + select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_USE_CMPXCHG_LOCKREF select HAVE_ARCH_SOFT_DIRTY select MODULES_USE_ELF_RELA
crypto/ecc.c +1 -1
@@ -336,7 +336,7 @@ static u64 vli_usub(u64 *result, const u64 *left, u64 right,static uint128_t mul_64_64 (u64 left,u64 right) {uint128_t result; -#if defined(CONFIG_ARCH_SUPPORTS_INT128 ) && defined(__SIZEOF_INT128__) +#if defined(CONFIG_ARCH_SUPPORTS_INT128 )unsigned __int128 m = (unsigned __int128 )left * right; result.m_low = m;
init/Kconfig +4 -0
@@ -785,6 +785,10 @@ config ARCH_SUPPORTS_NUMA_BALANCING config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH bool +config CC_HAS_INT128 + def_bool y + depends on !$(cc-option,-D__SIZEOF_INT128__=0) + # # For architectures that know their GCC __int128 support is sound #
lib/ubsan.c +1 -1
@@ -119,7 +119,7 @@ static void val_to_string(char *str, size_t size, struct type_descriptor *type, {if (type_is_int (type)) {if (type_bit_width (type) ==128 ) { -#if defined(CONFIG_ARCH_SUPPORTS_INT128 ) && defined(__SIZEOF_INT128__) +#if defined(CONFIG_ARCH_SUPPORTS_INT128 )u_max val =get_unsigned_val (type, value); scnprintf(str, size, "0x%08x%08x%08x%08x",
lib/ubsan.h +1 -1
@@ -78,7 +78,7 @@ struct invalid_value_data {struct type_descriptor *type; }; -#if defined(CONFIG_ARCH_SUPPORTS_INT128 ) && defined(__SIZEOF_INT128__) +#if defined(CONFIG_ARCH_SUPPORTS_INT128 )typedef __int128 s_max ;typedef unsigned __int128 u_max ;#else
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 195/350 ALSA: pcm: Fix missing check of the new non-cached buffer type
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 6111fd2370eecae9f11bfdc08ba097e0b51fcfd3 ]
The check for the mmap support via hw_support_mmap() function misses the case where the device is with SNDRV_DMA_TYPE_DEV_UC, which should have been treated equally as SNDRV_DMA_TYPE_DEV. Let's fix it.
Note that this bug doesn't hit any practical problem, because SNDRV_DMA_TYPE_DEV_UC is used only for x86-specific drivers (snd-hda-intel and snd-intel8x0) for the specific platforms that need the non-cached buffers. And, on such platforms, hw_support_mmap() already returns true in anyway. That's the reason I didn't put Cc-to-stable mark here. This is only for any theoretical future extension.
--- sound/core/pcm_native.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/pcm_native.c +2 -1
@@ -222,7 +222,8 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream)return false;if (substream->ops->mmap || - substream->dma_buffer.dev.type !=SNDRV_DMA_TYPE_DEV ) + (substream->dma_buffer.dev.type !=SNDRV_DMA_TYPE_DEV && + substream->dma_buffer.dev.type !=SNDRV_DMA_TYPE_DEV_UC ))return true;return dma_can_mmap (substream->dma_buffer.dev.dev);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 325/350 s390/cpumf: Adjust registration of s390 PMU device drivers
In reply to Sasha LevinFrom: Thomas Richter <[email protected]>
[ Upstream commit 6a82e23f45fe0aa821e7a935e39d0acb20c275c0 ]
Linux-next commit titled "perf/core: Optimize perf_init_event()" changed the semantics of PMU device driver registration. It was done to speed up the lookup/handling of PMU device driver specific events. It also enforces that only one PMU device driver will be registered of type PERF_EVENT_RAW.
This change added these line in function perf_pmu_register():
...
+ ret = idr_alloc(&pmu_idr, pmu, max, 0, GFP_KERNEL);
+ if (ret < 0)
goto free_pdc;
+
+ WARN_ON(type >= 0 && ret != type);
The warn_on generates a message. We have 3 PMU device drivers, each registered as type PERF_TYPE_RAW.
The cf_diag device driver (arch/s390/kernel/perf_cpumf_cf_diag.c) always hits the WARN_ON because it is the second PMU device driver (after sampling device driver arch/s390/kernel/perf_cpumf_sf.c) which is registered as type 4 (PERF_TYPE_RAW).
So when the sampling device driver is registered, ret has value 4. When cf_diag device driver is registered with type 4, ret has value of 5 and WARN_ON fires.
Adjust the PMU device drivers for s390 to support the new semantics required by perf_pmu_register().
--- arch/s390/kernel/perf_cpum_cf.c | 21 ++++++++++----------- arch/s390/kernel/perf_cpum_cf_diag.c | 10 +++++----- 2 files changed, 15 insertions(+), 16 deletions(-)
arch/s390/kernel/perf_cpum_cf.c +10 -11
@@ -199,7 +199,7 @@ static const int cpumf_generic_events_user[] = { [PERF_COUNT_HW_BUS_CYCLES] = -1, }; -static int __hw_perf_event_init (struct perf_event *event) +static int __hw_perf_event_init (struct perf_event *event,unsigned int type) {struct perf_event_attr *attr = &event->attr;struct hw_perf_event *hwc = &event->hw;
@@ -207,7 +207,7 @@ static int __hw_perf_event_init(struct perf_event *event)int err =0 ;u64 ev; -switch (attr->type) { +switch (type) {case PERF_TYPE_RAW :/* Raw events are used to access counters directly, * hence do not permit excludes */
@@ -294,17 +294,16 @@ static int __hw_perf_event_init(struct perf_event *event)static int cpumf_pmu_event_init (struct perf_event *event) { +unsigned int type = event->attr.type;int err; -switch (event->attr.type) { -case PERF_TYPE_HARDWARE : -case PERF_TYPE_HW_CACHE : -case PERF_TYPE_RAW : - err =__hw_perf_event_init (event); -break ; -default : +if (type ==PERF_TYPE_HARDWARE || type ==PERF_TYPE_RAW ) + err =__hw_perf_event_init (event, type); +else if (event->pmu->type == type) +/* Registered as unknown PMU */ + err =__hw_perf_event_init (event,PERF_TYPE_RAW ); +else return -ENOENT ; - }if (unlikely (err) && event->destroy) event->destroy (event);
@@ -553,7 +552,7 @@ static int __init cpumf_pmu_init(void)return -ENODEV ; cpumf_pmu.attr_groups =cpumf_cf_event_group (); - rc =perf_pmu_register (&cpumf_pmu,"cpum_cf" ,PERF_TYPE_RAW ); + rc =perf_pmu_register (&cpumf_pmu,"cpum_cf" ,-1 );if (rc)pr_err ("Registering the cpum_cf PMU failed with rc=%i\n" , rc);return rc;
arch/s390/kernel/perf_cpum_cf_diag.c +5 -5
@@ -243,13 +243,13 @@ static int cf_diag_event_init(struct perf_event *event)int err = -ENOENT ;debug_sprintf_event (cf_diag_dbg,5 , -"%s event %p cpu %d config %#llx " +"%s event %p cpu %d config %#llx type:%u " "sample_type %#llx cf_diag_events %d\n" , __func__, - event, event->cpu, attr->config, attr->sample_type, -atomic_read (&cf_diag_events)); + event, event->cpu, attr->config, event->pmu->type, + attr->sample_type,atomic_read (&cf_diag_events));if (event->attr.config !=PERF_EVENT_CPUM_CF_DIAG || - event->attr.type !=PERF_TYPE_RAW ) + event->attr.type != event->pmu->type) goto out;/* Raw events are used to access counters directly,
@@ -693,7 +693,7 @@ static int __init cf_diag_init(void) }debug_register_view (cf_diag_dbg, &debug_sprintf_view); - rc =perf_pmu_register (&cf_diag,"cpum_cf_diag" ,PERF_TYPE_RAW ); + rc =perf_pmu_register (&cf_diag,"cpum_cf_diag" ,-1 );if (rc) {debug_unregister_view (cf_diag_dbg, &debug_sprintf_view);debug_unregister (cf_diag_dbg);
Signature · 1 line
2.20.1