6.14.3-rc1 review
Subsystems (10)
Greg Kroah-Hartman
maintainerPATCH 128/449 ext4: ignore xattrs past end
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bhupesh <[email protected]>
[ Upstream commit c8e008b60492cf6fd31ef127aea6d02fd3d314cd ]
Once inside 'ext4_xattr_inode_dec_ref_all' we should ignore xattrs entries past the 'end' entry.
This fixes the following KASAN reported issue:
==================================================================
BUG: KASAN: slab-use-after-free in ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 Read of size 4 at addr ffff888012c120c4 by task repro/2065 CPU: 1 UID: 0 PID: 2065 Comm: repro Not tainted 6.13.0-rc2+ #11 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x1fd/0x300 ? tcp_gro_dev_warn+0x260/0x260 ? _printk+0xc0/0x100 ? read_lock_is_recursive+0x10/0x10 ? irq_work_queue+0x72/0xf0 ? __virt_addr_valid+0x17b/0x4b0 print_address_description+0x78/0x390 print_report+0x107/0x1f0 ? __virt_addr_valid+0x17b/0x4b0 ? __virt_addr_valid+0x3ff/0x4b0 ? __phys_addr+0xb5/0x160 ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 kasan_report+0xcc/0x100 ? ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 ext4_xattr_inode_dec_ref_all+0xb8c/0xe90 ? ext4_xattr_delete_inode+0xd30/0xd30 ? __ext4_journal_ensure_credits+0x5f0/0x5f0 ? __ext4_journal_ensure_credits+0x2b/0x5f0 ? inode_update_timestamps+0x410/0x410 ext4_xattr_delete_inode+0xb64/0xd30 ? ext4_truncate+0xb70/0xdc0 ? ext4_expand_extra_isize_ea+0x1d20/0x1d20 ? __ext4_mark_inode_dirty+0x670/0x670 ? ext4_journal_check_start+0x16f/0x240 ? ext4_inode_is_fast_symlink+0x2f2/0x3a0 ext4_evict_inode+0xc8c/0xff0 ? ext4_inode_is_fast_symlink+0x3a0/0x3a0 ? do_raw_spin_unlock+0x53/0x8a0 ? ext4_inode_is_fast_symlink+0x3a0/0x3a0 evict+0x4ac/0x950 ? proc_nr_inodes+0x310/0x310 ? trace_ext4_drop_inode+0xa2/0x220 ? _raw_spin_unlock+0x1a/0x30 ? iput+0x4cb/0x7e0 do_unlinkat+0x495/0x7c0 ? try_break_deleg+0x120/0x120 ? 0xffffffff81000000 ? __check_object_size+0x15a/0x210 ? strncpy_from_user+0x13e/0x250 ? getname_flags+0x1dc/0x530 __x64_sys_unlinkat+0xc8/0xf0 do_syscall_64+0x65/0x110 entry_SYSCALL_64_after_hwframe+0x67/0x6f RIP: 0033:0x434ffd Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 8 RSP: 002b:00007ffc50fa7b28 EFLAGS: 00000246 ORIG_RAX: 0000000000000107 RAX: ffffffffffffffda RBX: 00007ffc50fa7e18 RCX: 0000000000434ffd RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000005 RBP: 00007ffc50fa7be0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffc50fa7e08 R14: 00000000004bbf30 R15: 0000000000000001 </TASK> The buggy address belongs to the object at ffff888012c12000 which belongs to the cache filp of size 360
The buggy address is located 196 bytes inside of
freed 360-byte region [ffff888012c12000, ffff888012c12168)
The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12c12 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x40(head|node=0|zone=0) page_type: f5(slab) raw: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004 raw: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
head: 0000000000000040 ffff888000ad7640 ffffea0000497a00 dead000000000004
head: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000
head: 0000000000000001 ffffea00004b0481 ffffffffffffffff 0000000000000000
head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888012c11f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888012c12000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
Quoted 1 line
ffff888012c12080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888012c12100: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff888012c12180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
--- fs/ext4/xattr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/ext4/xattr.c +10 -1
@@ -1159,15 +1159,24 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent, {struct inode *ea_inode;struct ext4_xattr_entry *entry; +struct ext4_iloc iloc;bool dirty = false;unsigned int ea_ino;int err;int credits; +void *end; + +if (block_csum) + end = (void *)bh->b_data + bh->b_size; +else { +ext4_get_inode_loc (parent, &iloc); + end = (void *)ext4_raw_inode (&iloc) +EXT4_SB (parent->i_sb)->s_inode_size; + }/* One credit for dec ref on ea_inode, one for orphan list addition, */ credits =2 + extra_credits; -for (entry = first; !IS_LAST_ENTRY (entry); +for (entry = first; (void *)entry < end && !IS_LAST_ENTRY (entry); entry =EXT4_XATTR_NEXT (entry)) {if (!entry->e_value_inum)continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 129/449 cdc_ether|r8152: ThinkPad Hybrid USB-C/A Dock quirk
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philipp Hahn <[email protected]>
[ Upstream commit a07f23ad9baf716cbf7746e452c92960536ceae6 ]
Lenovo ThinkPad Hybrid USB-C with USB-A Dock (17ef:a359) is affected by the same problem as the Lenovo Powered USB-C Travel Hub (17ef:721e):
Both are based on the Realtek RTL8153B chip used to use the cdc_ether driver. However, using this driver, with the system suspended the device constantly sends pause-frames as soon as the receive buffer fills up. This causes issues with other devices, where some Ethernet switches stop forwarding packets altogether.
Using the Realtek driver (r8152) fixes this issue. Pause frames are no longer sent while the host system is suspended.
--- drivers/net/usb/cdc_ether.c | 7 +++++++ drivers/net/usb/r8152.c | 6 ++++++ drivers/net/usb/r8153_ecm.c | 6 ++++++ 3 files changed, 19 insertions(+)
drivers/net/usb/cdc_ether.c +7 -0
@@ -783,6 +783,13 @@ static const struct usb_device_id products[] = { .driver_info = 0, }, +/* Lenovo ThinkPad Hybrid USB-C with USB-A Dock (40af0135eu, based on Realtek RTL8153) */ +{ +USB_DEVICE_AND_INTERFACE_INFO (LENOVO_VENDOR_ID ,0xa359 ,USB_CLASS_COMM , + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), + .driver_info =0 , +}, + /* Aquantia AQtion USB to 5GbE Controller (based on AQC111U) */ { USB_DEVICE_AND_INTERFACE_INFO(AQUANTIA_VENDOR_ID, 0xc101,
drivers/net/usb/r8152.c +6 -0
@@ -785,6 +785,7 @@ enum rtl8152_flags {#define DEVICE_ID_THINKPAD_USB_C_DONGLE 0x720c#define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 0xa387#define DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3 0x3062 +#define DEVICE_ID_THINKPAD_HYBRID_USB_C_DOCK 0xa359struct tally_counter {__le64 tx_packets;
@@ -9787,6 +9788,7 @@ static bool rtl8152_supports_lenovo_macpassthru(struct usb_device *udev)case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2 :case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN3 :case DEVICE_ID_THINKPAD_USB_C_DONGLE : +case DEVICE_ID_THINKPAD_HYBRID_USB_C_DOCK :return 1 ; } }else if (vendor_id ==VENDOR_ID_REALTEK && parent_vendor_id ==VENDOR_ID_LENOVO ) {
@@ -10064,6 +10066,8 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927) }, { USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0c5e) }, { USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101) }, + +/* Lenovo */ { USB_DEVICE(VENDOR_ID_LENOVO, 0x304f) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x3054) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x3062) },
@@ -10074,7 +10078,9 @@ static const struct usb_device_id rtl8152_table[] = { { USB_DEVICE(VENDOR_ID_LENOVO, 0x720c) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x7214) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0x721e) }, + { USB_DEVICE(VENDOR_ID_LENOVO, 0xa359) }, { USB_DEVICE(VENDOR_ID_LENOVO, 0xa387) }, + { USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041) }, { USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff) }, { USB_DEVICE(VENDOR_ID_TPLINK, 0x0601) },
drivers/net/usb/r8153_ecm.c +6 -0
@@ -135,6 +135,12 @@ static const struct usb_device_id products[] = { USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&r8153_info, }, +/* Lenovo ThinkPad Hybrid USB-C with USB-A Dock (40af0135eu, based on Realtek RTL8153) */ +{ + USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID_LENOVO, 0xa359, USB_CLASS_COMM, +USB_CDC_SUBCLASS_ETHERNET ,USB_CDC_PROTO_NONE ), + .driver_info = (unsigned long)&r8153_info, +}, { }, /* END */ };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 130/449 scsi: st: Fix array overflow in st_setup()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Mäkisara <[email protected]>
[ Upstream commit a018d1cf990d0c339fe0e29b762ea5dc10567d67 ]
Change the array size to follow parms size instead of a fixed value.
--- drivers/scsi/st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/st.c +1 -1
@@ -4122,7 +4122,7 @@ static void validate_options(void)*/ static int __init st_setup (char *str) { -int i, len, ints[5 ]; +int i, len, ints[ARRAY_SIZE (parms) +1 ];char *stp; stp =get_options (str,ARRAY_SIZE (ints), ints);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 131/449 ahci: Marvell 88SE9215 controllers prefer DMA for ATAPI
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
[ Upstream commit 0507c777f5d8f9e34b137d28ee263599a7b81242 ]
We use CD/DVD drives under Marvell 88SE9215 SATA controller on many Loongson-based machines. We found its PIO doesn't work well, and on the opposite its DMA seems work very well.
We don't know the detail of the 88SE9215 SATA controller, but we have tested different CD/DVD drives and they all have problems under 88SE9215 (but they all work well under an Intel SATA controller). So, we consider this problem is bound to 88SE9215 SATA controller rather than bound to CD/DVD drives.
As a solution, we define a new dedicated AHCI board id which is named board_ahci_yes_fbs_atapi_dma for 88SE9215, and for this id we set the AHCI_HFLAG_ATAPI_DMA_QUIRK and ATA_QUIRK_ATAPI_MOD16_DMA flags on the SATA controller in order to prefer ATAPI DMA.
--- drivers/ata/ahci.c | 11 ++++++++++- drivers/ata/ahci.h | 1 + drivers/ata/libahci.c | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/ata/ahci.c +10 -1
@@ -63,6 +63,7 @@ enum board_ids { board_ahci_pcs_quirk_no_devslp, board_ahci_pcs_quirk_no_sntf, board_ahci_yes_fbs, + board_ahci_yes_fbs_atapi_dma,/* board IDs for specific chipsets in alphabetical order */ board_ahci_al,
@@ -188,6 +189,14 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, + [board_ahci_yes_fbs_atapi_dma] = { +AHCI_HFLAGS (AHCI_HFLAG_YES_FBS | + AHCI_HFLAG_ATAPI_DMA_QUIRK), + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &ahci_ops, + },/* by chipsets */ [board_ahci_al] = { AHCI_HFLAGS (AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_MSI),
@@ -590,7 +599,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9215), - .driver_data = board_ahci_yes_fbs }, + .driver_data = board_ahci_yes_fbs_atapi_dma }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9235),
drivers/ata/ahci.h +1 -0
@@ -246,6 +246,7 @@ enum {AHCI_HFLAG_NO_SXS =BIT (26 ),/* SXS not supported */ AHCI_HFLAG_43BIT_ONLY =BIT (27 ),/* 43bit DMA addr limit */ AHCI_HFLAG_INTEL_PCS_QUIRK =BIT (28 ),/* apply Intel PCS quirk */ + AHCI_HFLAG_ATAPI_DMA_QUIRK = BIT(29), /* force ATAPI to use DMA *//* ap->flags bits */
drivers/ata/libahci.c +4 -0
@@ -1322,6 +1322,10 @@ static void ahci_dev_config(struct ata_device *dev) {struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; +if ((dev->class ==ATA_DEV_ATAPI ) && + (hpriv->flags &AHCI_HFLAG_ATAPI_DMA_QUIRK )) + dev->quirks |=ATA_QUIRK_ATAPI_MOD16_DMA ; +if (hpriv->flags &AHCI_HFLAG_SECT255 ) { dev->max_sectors =255 ; ata_dev_info(dev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 132/449 btrfs: harden block_group::bg_list against list_del() races
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <[email protected]>
[ Upstream commit 7511e29cf1355b2c47d0effb39e463119913e2f6 ]
As far as I can tell, these calls of list_del_init() on bg_list cannot run concurrently with btrfs_mark_bg_unused() or btrfs_mark_bg_to_reclaim(), as they are in transaction error paths and situations where the block group is readonly.
However, if there is any chance at all of racing with mark_bg_unused(), or a different future user of bg_list, better to be safe than sorry.
Otherwise we risk the following interleaving (bg_list refcount in parens)
T1 (some random op) T2 (btrfs_mark_bg_unused)
!list_empty(&bg->bg_list); (1)
list_del_init(&bg->bg_list); (1)
list_move_tail (1)
btrfs_put_block_group (0)
btrfs_delete_unused_bgs
bg = list_first_entry
list_del_init(&bg->bg_list);
btrfs_put_block_group(bg); (-1)Ultimately, this results in a broken ref count that hits zero one deref early and the real final deref underflows the refcount, resulting in a WARNING.
--- fs/btrfs/extent-tree.c | 8 ++++++++ fs/btrfs/transaction.c | 12 ++++++++++++ 2 files changed, 20 insertions(+)
fs/btrfs/extent-tree.c +8 -0
@@ -2874,7 +2874,15 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans) block_group->length, &trimmed); +/* +* Not strictly necessary to lock, as the block_group should be +* read-only from btrfs_delete_unused_bgs(). +*/ +ASSERT (block_group->ro); +spin_lock (&fs_info->unused_bgs_lock);list_del_init (&block_group->bg_list); +spin_unlock (&fs_info->unused_bgs_lock); +btrfs_unfreeze_block_group (block_group);btrfs_put_block_group (block_group);
fs/btrfs/transaction.c +12 -0
@@ -160,7 +160,13 @@ void btrfs_put_transaction(struct btrfs_transaction *transaction) cache =list_first_entry (&transaction->deleted_bgs, struct btrfs_block_group, bg_list); +/* +* Not strictly necessary to lock, as no other task will be using a +* block_group on the deleted_bgs list during a transaction abort. +*/ +spin_lock (&transaction->fs_info->unused_bgs_lock);list_del_init (&cache->bg_list); +spin_unlock (&transaction->fs_info->unused_bgs_lock);btrfs_unfreeze_block_group (cache);btrfs_put_block_group (cache); }
@@ -2096,7 +2102,13 @@ static void btrfs_cleanup_pending_block_groups(struct btrfs_trans_handle *trans)list_for_each_entry_safe (block_group, tmp, &trans->new_bgs, bg_list) {btrfs_dec_delayed_refs_rsv_bg_inserts (fs_info); +/* +* Not strictly necessary to lock, as no other task will be using a +* block_group on the new_bgs list during a transaction abort. +*/ +spin_lock (&fs_info->unused_bgs_lock);list_del_init (&block_group->bg_list); +spin_unlock (&fs_info->unused_bgs_lock); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 133/449 wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Icenowy Zheng <[email protected]>
[ Upstream commit 06cccc2ebbe6c8a20f714f3a0ff3ff489d3004bb ]
The TP-Link TL-WDN6200 "Driverless" version cards use a MT7612U chipset.
Add the USB ID to mt76x2u driver.
--- drivers/net/wireless/mediatek/mt76/mt76x2/usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c +1 -0
@@ -22,6 +22,7 @@ static const struct usb_device_id mt76x2u_device_table[] = { { USB_DEVICE(0x0846, 0x9053) }, /* Netgear A6210 */ { USB_DEVICE(0x045e, 0x02e6) }, /* XBox One Wireless Adapter */ { USB_DEVICE(0x045e, 0x02fe) }, /* XBox One Wireless Adapter */ + { USB_DEVICE(0x2357, 0x0137) }, /* TP-Link TL-WDN6200 */ { }, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 134/449 net: vlan: dont propagate flags on open
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit 27b918007d96402aba10ed52a6af8015230f1793 ]
With the device instance lock, there is now a possibility of a deadlock:
[ 1.211455] ============================================
[ 1.211571] WARNING: possible recursive locking detected
[ 1.211687] 6.14.0-rc5-01215-g032756b4ca7a-dirty #5 Not tainted
[ 1.211823] --------------------------------------------
[ 1.211936] ip/184 is trying to acquire lock:
[ 1.212032] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_set_allmulti+0x4e/0xb0
[ 1.212207]
[ 1.212207] but task is already holding lock:
[ 1.212332] ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
[ 1.212487]
[ 1.212487] other info that might help us debug this:
[ 1.212626] Possible unsafe locking scenario:
[ 1.212626]
[ 1.212751] CPU0
[ 1.212815] ----
[ 1.212871] lock(&dev->lock);
[ 1.212944] lock(&dev->lock);
[ 1.213016]
[ 1.213016] *** DEADLOCK ***
[ 1.213016]
[ 1.213143] May be due to missing lock nesting notation
[ 1.213143]
[ 1.213294] 3 locks held by ip/184:
[ 1.213371] #0: ffffffff838b53e0 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x1b/0xa0
[ 1.213543] #1: ffffffff84e5fc70 (&net->rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock+0x37/0xa0
[ 1.213727] #2: ffff8881024a4c30 (&dev->lock){+.+.}-{4:4}, at: dev_open+0x50/0xb0
[ 1.213895]
[ 1.213895] stack backtrace:
[ 1.213991] CPU: 0 UID: 0 PID: 184 Comm: ip Not tainted 6.14.0-rc5-01215-g032756b4ca7a-dirty #5
[ 1.213993] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
[ 1.213994] Call Trace:
[ 1.213995] <TASK>
[ 1.213996] dump_stack_lvl+0x8e/0xd0
[ 1.214000] print_deadlock_bug+0x28b/0x2a0
[ 1.214020] lock_acquire+0xea/0x2a0
[ 1.214027] __mutex_lock+0xbf/0xd40
[ 1.214038] dev_set_allmulti+0x4e/0xb0 # real_dev->flags & IFF_ALLMULTI
[ 1.214040] vlan_dev_open+0xa5/0x170 # ndo_open on vlandev
[ 1.214042] __dev_open+0x145/0x270
[ 1.214046] __dev_change_flags+0xb0/0x1e0
[ 1.214051] netif_change_flags+0x22/0x60 # IFF_UP vlandev
[ 1.214053] dev_change_flags+0x61/0xb0 # for each device in group from dev->vlan_info
[ 1.214055] vlan_device_event+0x766/0x7c0 # on netdevsim0
[ 1.214058] notifier_call_chain+0x78/0x120
[ 1.214062] netif_open+0x6d/0x90
[ 1.214064] dev_open+0x5b/0xb0 # locks netdevsim0
[ 1.214066] bond_enslave+0x64c/0x1230
[ 1.214075] do_set_master+0x175/0x1e0 # on netdevsim0
[ 1.214077] do_setlink+0x516/0x13b0
[ 1.214094] rtnl_newlink+0xaba/0xb80
[ 1.214132] rtnetlink_rcv_msg+0x440/0x490
[ 1.214144] netlink_rcv_skb+0xeb/0x120
[ 1.214150] netlink_unicast+0x1f9/0x320
[ 1.214153] netlink_sendmsg+0x346/0x3f0
[ 1.214157] __sock_sendmsg+0x86/0xb0
[ 1.214160] ____sys_sendmsg+0x1c8/0x220
[ 1.214164] ___sys_sendmsg+0x28f/0x2d0
[ 1.214179] __x64_sys_sendmsg+0xef/0x140
[ 1.214184] do_syscall_64+0xec/0x1d0
[ 1.214190] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 1.214191] RIP: 0033:0x7f2d1b4a7e56Device setup:
netdevsim0 (down)
^ ^
bond netdevsim1.100@netdevsim1 allmulticast=on (down)
When we enslave the lower device (netdevsim0) which has a vlan, we propagate vlan's allmuti/promisc flags during ndo_open. This causes (re)locking on of the real_dev.
Propagate allmulti/promisc on flags change, not on the open. There is a slight semantics change that vlans that are down now propagate the flags, but this seems unlikely to result in the real issues.
Reproducer:
echo 0 1 > /sys/bus/netdevsim/new_device
dev_path=$(ls -d /sys/bus/netdevsim/devices/netdevsim0/net/*) dev=$(echo $dev_path | rev | cut -d/ -f1 | rev)
ip link set dev $dev name netdevsim0
ip link set dev netdevsim0 up
ip link add link netdevsim0 name netdevsim0.100 type vlan id 100 ip link set dev netdevsim0.100 allmulticast on down ip link add name bond1 type bond mode 802.3ad
ip link set dev netdevsim0 down
ip link set dev netdevsim0 master bond1
ip link set dev bond1 up
ip link show
--- net/8021q/vlan_dev.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-)
net/8021q/vlan_dev.c +4 -27
@@ -273,17 +273,6 @@ static int vlan_dev_open(struct net_device *dev) goto out; } -if (dev->flags &IFF_ALLMULTI ) { - err =dev_set_allmulti (real_dev,1 ); -if (err <0 ) - goto del_unicast; - } -if (dev->flags &IFF_PROMISC ) { - err =dev_set_promiscuity (real_dev,1 ); -if (err <0 ) - goto clear_allmulti; - } -ether_addr_copy (vlan->real_dev_addr, real_dev->dev_addr);if (vlan->flags &VLAN_FLAG_GVRP )
@@ -297,12 +286,6 @@ static int vlan_dev_open(struct net_device *dev)netif_carrier_on (dev);return 0 ; -clear_allmulti: -if (dev->flags &IFF_ALLMULTI ) -dev_set_allmulti (real_dev,-1 ); -del_unicast: -if (!ether_addr_equal (dev->dev_addr, real_dev->dev_addr)) -dev_uc_del (real_dev, dev->dev_addr); out:netif_carrier_off (dev);return err;
@@ -315,10 +298,6 @@ static int vlan_dev_stop(struct net_device *dev)dev_mc_unsync (real_dev, dev);dev_uc_unsync (real_dev, dev); -if (dev->flags &IFF_ALLMULTI ) -dev_set_allmulti (real_dev,-1 ); -if (dev->flags &IFF_PROMISC ) -dev_set_promiscuity (real_dev,-1 );if (!ether_addr_equal (dev->dev_addr, real_dev->dev_addr))dev_uc_del (real_dev, dev->dev_addr);
@@ -490,12 +469,10 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change) {struct net_device *real_dev =vlan_dev_priv (dev)->real_dev; -if (dev->flags &IFF_UP ) { -if (change &IFF_ALLMULTI ) -dev_set_allmulti (real_dev, dev->flags &IFF_ALLMULTI ?1 :-1 ); -if (change &IFF_PROMISC ) -dev_set_promiscuity (real_dev, dev->flags &IFF_PROMISC ?1 :-1 ); - } +if (change &IFF_ALLMULTI ) +dev_set_allmulti (real_dev, dev->flags &IFF_ALLMULTI ?1 :-1 ); +if (change &IFF_PROMISC ) +dev_set_promiscuity (real_dev, dev->flags &IFF_PROMISC ?1 :-1 ); }static void vlan_dev_set_rx_mode (struct net_device *vlan_dev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 135/449 tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Paoloni <[email protected]>
[ Upstream commit 0c588ac0ca6c22b774d9ad4a6594681fdfa57d9d ]
When __ftrace_event_enable_disable invokes the class callback to unregister the event, the return value is not reported up to the caller, hence leading to event unregister failures being silently ignored.
This patch assigns the ret variable to the invocation of the event unregister callback, so that its return value is stored and reported to the caller, and it raises a warning in case of error.
--- kernel/trace/trace_events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/trace_events.c +3 -1
@@ -797,7 +797,9 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,clear_bit (EVENT_FILE_FL_RECORDED_TGID_BIT , &file->flags); } - call->class->reg (call,TRACE_REG_UNREGISTER , file); + ret = call->class->reg (call,TRACE_REG_UNREGISTER , file); + +WARN_ON_ONCE (ret); }/* If in SOFT_MODE, just set the SOFT_DISABLE_BIT, else clear it */ if (file->flags &EVENT_FILE_FL_SOFT_MODE )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 136/449 Bluetooth: btusb: Add new VID/PID for WCN785x
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dorian Cruveiller <[email protected]>
[ Upstream commit c7629ccfa175e16bb44a60c469214e1a6051f63d ]
Add VID 0489 & PID e10d for Qualcomm WCN785x USB Bluetooth chip.
The information in /sys/kernel/debug/usb/devices about the Bluetooth device is listed as the below.
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=03 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0489 ProdID=e10d Rev= 0.01 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms I: If#= 1 Alt= 7 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 65 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 65 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -376,6 +376,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe0f3), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe10d), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3623), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2c7c, 0x0130), .driver_info = BTUSB_QCA_WCN6855 |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 137/449 Bluetooth: btintel_pcie: Add device id of Whale Peak
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kiran K <[email protected]>
[ Upstream commit 6b8c05e52d66e4fe4ab1df4c6e15f339ecd9aa51 ]
Add device of Whale Peak.
Output of sudo lspci -v -s 00:14.7:
00:14.7 Bluetooth: Intel Corporation Device e476
Subsystem: Intel Corporation Device 0011
Flags: bus master, fast devsel, latency 0, IRQ 16, IOMMU group 11 Memory at 11011c30000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [c8] Power Management version 3
Capabilities: [d0] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [40] Express Root Complex Integrated Endpoint, MSI 00
Capabilities: [80] MSI-X: Enable+ Count=32 Masked-
Capabilities: [100] Latency Tolerance Reporting
Kernel driver in use: btintel_pcie
Kernel modules: btintel_pcie
--- drivers/bluetooth/btintel_pcie.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btintel_pcie.c +1 -0
@@ -36,6 +36,7 @@/* Intel Bluetooth PCIe device id table */ static const struct pci_device_id btintel_pcie_table[] = { {BTINTEL_PCI_DEVICE (0xA876 ,PCI_ANY_ID ) }, + {BTINTEL_PCI_DEVICE (0xE476 ,PCI_ANY_ID ) }, {0 } };MODULE_DEVICE_TABLE (pci, btintel_pcie_table);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 138/449 Bluetooth: btusb: Add 13 USB device IDs for Qualcomm WCN785x
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit 2dd1c1eee3e496fcc16971be4db5bb792a36025c ]
Add 13 USB device IDs for Qualcomm WCN785x, and these IDs are extracted from Windows driver inf file for various types of WoS (Windows on Snapdragon) laptop.
--- drivers/bluetooth/btusb.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/bluetooth/btusb.c +26 -0
@@ -376,12 +376,38 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe0f3), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe100), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe103), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe10a), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe10d), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe11b), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe11c), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe11f), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe141), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe14a), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe14b), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe14d), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x13d3, 0x3623), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x13d3, 0x3624), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2c7c, 0x0130), .driver_info = BTUSB_QCA_WCN6855 | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x2c7c, 0x0131), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x2c7c, 0x0132), .driver_info = BTUSB_QCA_WCN6855 | + BTUSB_WIDEBAND_SPEECH }, /* Broadcom BCM2035 */ { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 139/449 Bluetooth: hci_uart: fix race during initialization
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arseniy Krasnov <[email protected]>
[ Upstream commit 366ceff495f902182d42b6f41525c2474caf3f9a ]
'hci_register_dev()' calls power up function, which is executed by kworker - 'hci_power_on()'. This function does access to bluetooth chip using callbacks from 'hci_ldisc.c', for example 'hci_uart_send_frame()'. Now 'hci_uart_send_frame()' checks 'HCI_UART_PROTO_READY' bit set, and if not - it fails. Problem is that 'HCI_UART_PROTO_READY' is set after 'hci_register_dev()', and there is tiny chance that 'hci_power_on()' will be executed before setting this bit. In that case HCI init logic fails.
Patch moves setting of 'HCI_UART_PROTO_READY' before calling function 'hci_uart_register_dev()'.
--- drivers/bluetooth/hci_ldisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_ldisc.c +2 -1
@@ -707,12 +707,13 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id) hu->proto = p; +set_bit (HCI_UART_PROTO_READY , &hu->flags); + err =hci_uart_register_dev (hu);if (err) {return err; } -set_bit (HCI_UART_PROTO_READY , &hu->flags);return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 140/449 Bluetooth: btusb: Add 2 HWIDs for MT7922
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiande Lu <[email protected]>
[ Upstream commit a88643b7e48506777e175e80c902c727ddd90851 ]
Add below HWIDs for MediaTek MT7922 USB Bluetooth chip. VID 0x0489, PID 0xe152
VID 0x0489, PID 0xe153
Patch has been tested successfully and controller is recognized device pair successfully.
MT7922 module bring up message as below.
Bluetooth: Core ver 2.22
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
Bluetooth: hci0: HW/SW Version: 0x008a008a, Build Time: 20241106163512
Bluetooth: hci0: Device setup in 2284925 usecs
Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
Bluetooth: hci0: AOSP extensions version v1.00
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: BNEP socket layer initialized
Bluetooth: MGMT ver 1.22
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
--- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/bluetooth/btusb.c +4 -0
@@ -668,6 +668,10 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0489, 0xe102), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe152), .driver_info = BTUSB_MEDIATEK | + BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x0489, 0xe153), .driver_info = BTUSB_MEDIATEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x04ca, 0x3804), .driver_info = BTUSB_MEDIATEK | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x04ca, 0x38e4), .driver_info = BTUSB_MEDIATEK |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 141/449 Bluetooth: hci_qca: use the power sequencer for wcn6750
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janaki Ramaiah Thota <[email protected]>
[ Upstream commit 852cfdc7a5a5af54358325c1e0f490cc178d9664 ]
Older boards are having entry "enable-gpios" in dts, we can safely assume latest boards which are supporting PMU node enrty will support power sequencer.
--- drivers/bluetooth/hci_qca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_qca.c +1 -1
@@ -2359,6 +2359,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)switch (qcadev->btsoc_type) {case QCA_WCN6855 :case QCA_WCN7850 : +case QCA_WCN6750 :if (!device_property_present (&serdev->dev,"enable-gpios" )) {/* * Backward compatibility with old DT sources. If the
@@ -2378,7 +2379,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 : -case QCA_WCN6750 : qcadev->bt_power->dev = &serdev->dev; err =qca_init_regulators (qcadev->bt_power, data->vregs, data->num_vregs);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 142/449 Bluetooth: qca: simplify WCN399x NVM loading
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1cc41b5092e3aa511454ec882c525af311bee631 ]
The WCN399x code has two separate cases for loading the NVM data. In preparation to adding support for WCN3950, which also requires similar quirk, split the "variant" to be specified explicitly and merge two snprintfs into a single one.
--- drivers/bluetooth/btqca.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/bluetooth/btqca.c +6 -7
@@ -785,6 +785,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, const char *firmware_name, const char *rampatch_name) { struct qca_fw_config config = {}; +const char *variant ="" ;int err;u8 rom_ver =0 ;u32 soc_ver;
@@ -883,13 +884,11 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 : -if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02xu.bin" , rom_ver); - }else { -snprintf (config.fwname,sizeof (config.fwname), -"qca/crnv%02x.bin" , rom_ver); - } +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3991_SOC_ID ) + variant ="u" ; + +snprintf (config.fwname,sizeof (config.fwname), +"qca/crnv%02x%s.bin" , rom_ver, variant);break ;case QCA_WCN3988 : snprintf(config.fwname, sizeof(config.fwname),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 143/449 Bluetooth: qca: add WCN3950 support
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit d5712c511cb358ab87f1e884848419ec76a67ab2 ]
WCN3950 is another example of the WCN39xx BT/WiFI family of chips. It requires different firmware files and has different current requirements, so add it as a separate SoC type.
The firmware for these chips has been recently added to the linux-firmware repository and will be a part of the upcoming release:
- qca/cmbtfw12.tlv
- qca/cmbtfw13.tlv
- qca/cmnv12.bin
- qca/cmnv13.bin
- qca/cmnv13s.bin
- qca/cmnv13t.bin
--- drivers/bluetooth/btqca.c | 14 ++++++++++++++ drivers/bluetooth/btqca.h | 4 ++++ drivers/bluetooth/hci_qca.c | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+)
drivers/bluetooth/btqca.c +14 -0
@@ -816,6 +816,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,snprintf (config.fwname,sizeof (config.fwname),"qca/%s" , rampatch_name); }else {switch (soc_type) { +case QCA_WCN3950 : +snprintf (config.fwname,sizeof (config.fwname), +"qca/cmbtfw%02x.tlv" , rom_ver); +break ;case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 :
@@ -881,6 +885,15 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, } }else {switch (soc_type) { +case QCA_WCN3950 : +if (le32_to_cpu (ver.soc_id) ==QCA_WCN3950_SOC_ID_T ) + variant ="t" ; +else if (le32_to_cpu (ver.soc_id) ==QCA_WCN3950_SOC_ID_S ) + variant ="u" ; + +snprintf (config.fwname,sizeof (config.fwname), +"qca/cmnv%02x%s.bin" , rom_ver, variant); +break ;case QCA_WCN3990 :case QCA_WCN3991 :case QCA_WCN3998 :
@@ -947,6 +960,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,* VsMsftOpCode. */ switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
drivers/bluetooth/btqca.h +4 -0
@@ -41,6 +41,9 @@#define QCA_WCN3991_SOC_ID 0x40014320 +#define QCA_WCN3950_SOC_ID_T 0x40074130 +#define QCA_WCN3950_SOC_ID_S 0x40075130 +/* QCA chipset version can be decided by patch and SoC * version, combination with upper 2 bytes from SoC * and lower 2 bytes from patch will be used.
@@ -145,6 +148,7 @@ enum qca_btsoc_type {QCA_INVALID =-1 ,QCA_AR3002 ,QCA_ROME , +QCA_WCN3950 ,QCA_WCN3988 ,QCA_WCN3990 , QCA_WCN3998,
drivers/bluetooth/hci_qca.c +25 -0
@@ -623,6 +623,7 @@ static int qca_open(struct hci_uart *hu) qcadev =serdev_device_get_drvdata (hu->serdev);switch (qcadev->btsoc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1366,6 +1367,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)/* Give the controller time to process the request */ switch (qca_soc_type (hu)) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1452,6 +1454,7 @@ static unsigned int qca_get_speed(struct hci_uart *hu,static int qca_check_speeds (struct hci_uart *hu) {switch (qca_soc_type (hu)) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1494,6 +1497,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)* changing the baudrate of chip and host. */ switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1528,6 +1532,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type) error:switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1746,6 +1751,7 @@ static int qca_regulator_init(struct hci_uart *hu) }switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1776,6 +1782,7 @@ static int qca_regulator_init(struct hci_uart *hu)qca_set_speed (hu,QCA_INIT_SPEED );switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1807,6 +1814,7 @@ static int qca_power_on(struct hci_dev *hdev)return 0 ;switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1891,6 +1899,7 @@ static int qca_setup(struct hci_uart *hu) soc_name ="qca2066" ;break ; +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1925,6 +1934,7 @@ static int qca_setup(struct hci_uart *hu)clear_bit (QCA_SSR_TRIGGERED , &qca->flags);switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -1958,6 +1968,7 @@ static int qca_setup(struct hci_uart *hu) }switch (soc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -2046,6 +2057,17 @@ static const struct hci_uart_proto qca_proto = { .dequeue = qca_dequeue, }; +static const struct qca_device_data qca_soc_data_wcn3950__maybe_unused = { + .soc_type =QCA_WCN3950 , + .vregs = (struct qca_vreg []) { + {"vddio" ,15000 }, + {"vddxo" ,60000 }, + {"vddrf" ,155000 }, + {"vddch0" ,585000 }, + }, + .num_vregs =4 , +}; +static const struct qca_device_data qca_soc_data_wcn3988__maybe_unused = { .soc_type =QCA_WCN3988 , .vregs = (struct qca_vreg []) {
@@ -2338,6 +2360,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->btsoc_type =QCA_ROME ;switch (qcadev->btsoc_type) { +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -2375,6 +2398,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)break ; } fallthrough; +case QCA_WCN3950 :case QCA_WCN3988 :case QCA_WCN3990 :case QCA_WCN3991 :
@@ -2683,6 +2707,7 @@ static const struct of_device_id qca_bluetooth_of_match[] = { { .compatible = "qcom,qca6174-bt" }, { .compatible = "qcom,qca6390-bt", .data = &qca_soc_data_qca6390}, { .compatible = "qcom,qca9377-bt" }, + { .compatible = "qcom,wcn3950-bt", .data = &qca_soc_data_wcn3950}, { .compatible = "qcom,wcn3988-bt", .data = &qca_soc_data_wcn3988}, { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990}, { .compatible = "qcom,wcn3991-bt", .data = &qca_soc_data_wcn3991},
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 144/449 drm: allow encoder mode_set even when connectors change for crtc
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhinav Kumar <[email protected]>
[ Upstream commit 7e182cb4f5567f53417b762ec0d679f0b6f0039d ]
In certain use-cases, a CRTC could switch between two encoders and because the mode being programmed on the CRTC remains the same during this switch, the CRTC's mode_changed remains false. In such cases, the encoder's mode_set also gets skipped.
Skipping mode_set on the encoder for such cases could cause an issue because even though the same CRTC mode was being used, the encoder type could have changed like the CRTC could have switched from a real time encoder to a writeback encoder OR vice-versa.
Allow encoder's mode_set to happen even when connectors changed on a CRTC and not just when the mode changed.
--- drivers/gpu/drm/drm_atomic_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +1 -1
@@ -1376,7 +1376,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) mode = &new_crtc_state->mode; adjusted_mode = &new_crtc_state->adjusted_mode; -if (!new_crtc_state->mode_changed) +if (!new_crtc_state->mode_changed && !new_crtc_state->connectors_changed)continue ; drm_dbg_atomic(dev, "modeset on [ENCODER:%d:%s]\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 145/449 drm/virtio: Set missing bo->attached flag
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Osipenko <[email protected]>
[ Upstream commit ffda6454267d0b870f3a09945a7ce88137b914a6 ]
VirtIO-GPU driver now supports detachment of shmem BOs from host, but doing it only for imported dma-bufs. Mark all shmem BOs as attached, not just dma-bufs. This is a minor correction since detachment of a non-dmabuf BOs not supported today.
--- drivers/gpu/drm/virtio/virtgpu_prime.c | 1 - drivers/gpu/drm/virtio/virtgpu_vq.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_prime.c +0 -1
@@ -250,7 +250,6 @@ static int virtgpu_dma_buf_init_obj(struct drm_device *dev,virtio_gpu_cmd_resource_create_blob (vgdev, bo, ¶ms, ents, nents); bo->guest_blob = true; - bo->attached = true;dma_buf_unpin (attach);dma_resv_unlock (resv);
drivers/gpu/drm/virtio/virtgpu_vq.c +3 -0
@@ -1300,6 +1300,9 @@ virtio_gpu_cmd_resource_create_blob(struct virtio_gpu_device *vgdev,virtio_gpu_queue_ctrl_buffer (vgdev, vbuf); bo->created = true; + +if (nents) + bo->attached = true; } void virtio_gpu_cmd_set_scanout_blob(struct virtio_gpu_device *vgdev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 146/449 drm/rockchip: Dont change hdmi reference clock rate
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Derek Foreman <[email protected]>
[ Upstream commit 1854df7087be70ad54e24b2e308d7558ebea9f27 ]
The code that changes hdmi->ref_clk was accidentally copied from downstream code that sets a different clock. We don't actually want to set any clock here at all.
Setting this clock incorrectly leads to incorrect timings for DDC, CEC, and HDCP signal generation.
No Fixes listed, as the theoretical timing error in DDC appears to still be within tolerances and harmless - and HDCP and CEC are not yet supported.
--- drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +0 -13
@@ -54,7 +54,6 @@ struct rockchip_hdmi_qp {struct regmap *regmap;struct regmap *vo_regmap;struct rockchip_encoder encoder; -struct clk *ref_clk;struct dw_hdmi_qp *hdmi;struct phy *phy;struct gpio_desc *enable_gpio;
@@ -81,7 +80,6 @@ static void dw_hdmi_qp_rockchip_encoder_enable(struct drm_encoder *encoder)if (crtc && crtc->state) { rate =drm_hdmi_compute_mode_clock (&crtc->state->adjusted_mode,8 ,HDMI_COLORSPACE_RGB ); -clk_set_rate (hdmi->ref_clk, rate);/* * FIXME: Temporary workaround to pass pixel clock rate * to the PHY driver until phy_configure_opts_hdmi
@@ -330,17 +328,6 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,return ret; } -for (i =0 ; i < ret; i++) { -if (!strcmp (clks[i].id,"ref" )) { - hdmi->ref_clk = clks[1 ].clk; -break ; - } - } -if (!hdmi->ref_clk) { -drm_err (hdmi,"Missing ref clock\n" ); -return -EINVAL ; - } - hdmi->enable_gpio =devm_gpiod_get_optional (hdmi->dev,"enable" ,GPIOD_OUT_HIGH );if (IS_ERR (hdmi->enable_gpio)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 147/449 drm/xe/bmg: Add new PCI IDs
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shekhar Chauhan <[email protected]>
[ Upstream commit fa8ffaae1b15236b8afb0fbbc04117ff7c900a83 ]
Add 3 new PCI IDs for BMG.
v2: Fix typo -> Replace '.' with ','
--- include/drm/intel/pciids.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/drm/intel/pciids.h +4 -1
@@ -846,7 +846,10 @@ MACRO__(0xE20B, ## __VA_ARGS__), \ MACRO__(0xE20C, ## __VA_ARGS__), \ MACRO__(0xE20D, ## __VA_ARGS__), \ - MACRO__(0xE212, ## __VA_ARGS__) + MACRO__(0xE210, ## __VA_ARGS__), \ + MACRO__(0xE212, ## __VA_ARGS__), \ + MACRO__(0xE215, ## __VA_ARGS__), \ + MACRO__(0xE216, ## __VA_ARGS__)/* PTL */ #define INTEL_PTL_IDS (MACRO__ , ...) \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 148/449 drm/xe/ptl: Update the PTL pci id table
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Atwood <[email protected]>
[ Upstream commit 16016ade13f691da315fac7b23ebf1ab7b28b7ab ]
Update to current bspec table.
Bspec: 72574
--- include/drm/intel/pciids.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
include/drm/intel/pciids.h +2 -4
@@ -856,12 +856,10 @@ MACRO__(0xB080, ## __VA_ARGS__), \ MACRO__(0xB081, ## __VA_ARGS__), \ MACRO__(0xB082, ## __VA_ARGS__), \ + MACRO__(0xB083, ## __VA_ARGS__), \ + MACRO__(0xB08F, ## __VA_ARGS__), \ MACRO__(0xB090, ## __VA_ARGS__), \ - MACRO__(0xB091, ## __VA_ARGS__), \ - MACRO__(0xB092, ## __VA_ARGS__), \ MACRO__(0xB0A0, ## __VA_ARGS__), \ - MACRO__(0xB0A1, ## __VA_ARGS__), \ - MACRO__(0xB0A2, ## __VA_ARGS__), \ MACRO__(0xB0B0, ## __VA_ARGS__) #endif /* __PCIIDS_H__ */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 149/449 drm/xe/pf: Dont send BEGIN_ID if VF has no context/doorbells
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wajdeczko <[email protected]>
[ Upstream commit 21ccac0e22aaf27b767f9de4bf573e7c47f619c8 ]
It turned out that GuC validates VF configuration immediately after receiving "some" set of configuration KLVs and complains if one of the critical, from GuC understanding, resource is left unprovisioned, even if PF should be still allowed to make late VF config adjustments, since VF was not yet started.
This issue was discovered after we decided to asynchronously re-send configuration KLVs after GT reset/resume, as then fair VF auto-provisioning could already allocate some of the resources, which was a prerequiste for sending those config KLVs:
# fair GGTT provisioning
[] xe 0000:00:02.0: [drm] GT0: PF: pushed VF1 config with 2 KLVs:
[] xe 0000:00:02.0: [drm] GT0: { key 0x0001 : 64b value 0x176a000 } # ggtt_start
[] xe 0000:00:02.0: [drm] GT0: { key 0x0002 : 64b value 0xfd696000 } # ggtt_size
[] xe 0000:00:02.0: [drm] GT0: PF: VF1 provisioned with 4251541504 (3.96 GiB) GGTT
# re-provisioning worker
[] xe 0000:00:02.0: [drm] *ERROR* GT0: H2G request 0x5503 failed: error 0x60 hint 0x0
[] xe 0000:00:02.0: [drm] GT0: PF: Failed to push VF1 14 config KLVs (-EIO)
[] xe 0000:00:02.0: [drm] GT0: { key 0x0001 : 64b value 0x176a000 } # ggtt_start
[] xe 0000:00:02.0: [drm] GT0: { key 0x0002 : 64b value 0xfd696000 } # ggtt_size
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a0b : 32b value 0 } # begin_ctx_id
[] xe 0000:00:02.0: [drm] GT0: { key 0x0004 : 32b value 0 } # num_contexts
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a0a : 32b value 0 } # begin_db_id
[] xe 0000:00:02.0: [drm] GT0: { key 0x0006 : 32b value 0 } # num_doorbells
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a01 : 32b value 0 } # exec_quantum
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a02 : 32b value 0 } # preempt_timeout
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a03 : 32b value 0 } # cat_error_count
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a04 : 32b value 0 } # engine_reset_count
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a05 : 32b value 0 } # page_fault_count
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a06 : 32b value 0 } # guc_time_us
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a07 : 32b value 0 } # irq_time_us
[] xe 0000:00:02.0: [drm] GT0: { key 0x8a08 : 32b value 0 } # doorbell_time_us
[] xe 0000:00:02.0: [drm] GT0: PF: Failed to push VF1 configuration (-EIO)To avoid such errors stop sending BEGIN_CONTEXT/DOORBELL_ID KLVs if no GuC context/doorbell IDs were provisioned to VF.
--- drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c +2 -2
@@ -262,7 +262,7 @@ static u32 encode_config(u32 *cfg, const struct xe_gt_sriov_config *config, bool n +=encode_config_ggtt (cfg, config, details); -if (details) { +if (details && config->num_ctxs) { cfg[n++] =PREP_GUC_KLV_TAG (VF_CFG_BEGIN_CONTEXT_ID ); cfg[n++] = config->begin_ctx; }
@@ -270,7 +270,7 @@ static u32 encode_config(u32 *cfg, const struct xe_gt_sriov_config *config, bool cfg[n++] =PREP_GUC_KLV_TAG (VF_CFG_NUM_CONTEXTS ); cfg[n++] = config->num_ctxs; -if (details) { +if (details && config->num_dbs) { cfg[n++] =PREP_GUC_KLV_TAG (VF_CFG_BEGIN_DOORBELL_ID ); cfg[n++] = config->begin_db; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/449 drm/xe/vf: Dont try to trigger a full GT reset if VF
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wajdeczko <[email protected]>
[ Upstream commit 459777724d306315070d24608fcd89aea85516d6 ]
VFs don't have access to the GDRST(0x941c) register that driver uses to reset a GT. Attempt to trigger a reset using debugfs:
$ cat /sys/kernel/debug/dri/0000:00:02.1/gt0/force_reset
or due to a hang condition detected by the driver leads to:
[ ] xe 0000:00:02.1: [drm] GT0: trying reset from force_reset [xe]
[ ] xe 0000:00:02.1: [drm] GT0: reset queued
[ ] xe 0000:00:02.1: [drm] GT0: reset started
[ ] ------------[ cut here ]------------
[ ] xe 0000:00:02.1: [drm] GT0: VF is trying to write 0x1 to an inaccessible register 0x941c+0x0 [ ] WARNING: CPU: 3 PID: 3069 at drivers/gpu/drm/xe/xe_gt_sriov_vf.c:996 xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] RIP: 0010:xe_gt_sriov_vf_write32+0xc6/0x580 [xe]
[ ] Call Trace:
[ ] <TASK> [ ] ? show_regs+0x6c/0x80 [ ] ? __warn+0x93/0x1c0 [ ] ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] ? report_bug+0x182/0x1b0 [ ] ? handle_bug+0x6e/0xb0 [ ] ? exc_invalid_op+0x18/0x80 [ ] ? asm_exc_invalid_op+0x1b/0x20 [ ] ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] ? xe_gt_tlb_invalidation_reset+0xef/0x110 [xe] [ ] ? __mutex_unlock_slowpath+0x41/0x2e0 [ ] xe_mmio_write32+0x64/0x150 [xe] [ ] do_gt_reset+0x2f/0xa0 [xe] [ ] gt_reset_worker+0x14e/0x1e0 [xe] [ ] process_one_work+0x21c/0x740 [ ] worker_thread+0x1db/0x3c0
Fix that by sending H2G VF_RESET(0x5507) action instead.
--- drivers/gpu/drm/xe/xe_gt.c | 4 ++++ drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 16 ++++++++++++++++ drivers/gpu/drm/xe/xe_gt_sriov_vf.h | 1 + 3 files changed, 21 insertions(+)
drivers/gpu/drm/xe/xe_gt.c +4 -0
@@ -32,6 +32,7 @@#include "xe_gt_pagefault.h" #include "xe_gt_printk.h" #include "xe_gt_sriov_pf.h" +#include "xe_gt_sriov_vf.h" #include "xe_gt_sysfs.h" #include "xe_gt_tlb_invalidation.h" #include "xe_gt_topology.h"
@@ -676,6 +677,9 @@ static int do_gt_reset(struct xe_gt *gt) {int err; +if (IS_SRIOV_VF (gt_to_xe (gt))) +return xe_gt_sriov_vf_reset (gt); +xe_gsc_wa_14015076503 (gt, true);xe_mmio_write32 (>->mmio,GDRST ,GRDOM_FULL );
drivers/gpu/drm/xe/xe_gt_sriov_vf.c +16 -0
@@ -58,6 +58,22 @@ static int vf_reset_guc_state(struct xe_gt *gt)return err; } +/** +* xe_gt_sriov_vf_reset - Reset GuC VF internal state. +* @gt: the &xe_gt +* +* It requires functional `GuC MMIO based communication`_. +* +* Return: 0 on success or a negative error code on failure. +*/ +int xe_gt_sriov_vf_reset (struct xe_gt *gt) +{ +if (!xe_device_uc_enabled (gt_to_xe (gt))) +return -ENODEV ; + +return vf_reset_guc_state (gt); +} +static int guc_action_match_version (struct xe_guc *guc,u32 wanted_branch,u32 wanted_major,u32 wanted_minor,u32 *branch,u32 *major,u32 *minor,u32 *patch)
drivers/gpu/drm/xe/xe_gt_sriov_vf.h +1 -0
@@ -12,6 +12,7 @@ struct drm_printer;struct xe_gt ;struct xe_reg ; +int xe_gt_sriov_vf_reset (struct xe_gt *gt);int xe_gt_sriov_vf_bootstrap (struct xe_gt *gt);int xe_gt_sriov_vf_query_config (struct xe_gt *gt);int xe_gt_sriov_vf_connect (struct xe_gt *gt);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/449 drm/amd/display: Update Cursor request mode to the beginning prefetch always
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhikai Zhai <[email protected]>
[ Upstream commit 4a4077b4b63a8404efd6d37fc2926f03fb25bace ]
[Why]
The double buffer cursor registers is updated by the cursor vupdate event. There is a gap between vupdate and cursor data fetch if cursor fetch data reletive to cursor position. Cursor corruption will happen if we update the cursor surface in this gap.
[How]
Modify the cursor request mode to the beginning prefetch always and avoid wraparound calculation issues.
--- .../amd/display/dc/hubp/dcn31/dcn31_hubp.c | 2 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 22 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/hubp/dcn31/dcn31_hubp.c +1 -1
@@ -44,7 +44,7 @@ void hubp31_set_unbounded_requesting(struct hubp *hubp, bool enable)struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp);REG_UPDATE (DCHUBP_CNTL ,HUBP_UNBOUNDED_REQ_MODE , enable); -REG_UPDATE (CURSOR_CONTROL ,CURSOR_REQ_MODE , enable); +REG_UPDATE (CURSOR_CONTROL ,CURSOR_REQ_MODE ,1 ); }void hubp31_soft_reset (struct hubp *hubp,bool reset)
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +9 -13
@@ -1992,20 +1992,11 @@ static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx) dc->hwss.get_position (&pipe_ctx,1 , &position); vpos = position.vertical_count; -/* Avoid wraparound calculation issues */ - vupdate_start += stream->timing.v_total; - vupdate_end += stream->timing.v_total; - vpos += stream->timing.v_total; -if (vpos <= vupdate_start) {/* VPOS is in VACTIVE or back porch. */ lines_to_vupdate = vupdate_start - vpos; - }else if (vpos > vupdate_end) { -/* VPOS is in the front porch. */ -return ; }else { -/* VPOS is in VUPDATE. */ - lines_to_vupdate =0 ; + lines_to_vupdate = stream->timing.v_total - vpos + vupdate_start; }/* Calculate time until VUPDATE in microseconds. */
@@ -2013,13 +2004,18 @@ static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx) stream->timing.h_total *10000u / stream->timing.pix_clk_100hz; us_to_vupdate = lines_to_vupdate * us_per_line; +/* Stall out until the cursor update completes. */ +if (vupdate_end < vupdate_start) + vupdate_end += stream->timing.v_total; + +/* Position is in the range of vupdate start and end*/ +if (lines_to_vupdate > stream->timing.v_total - vupdate_end + vupdate_start) + us_to_vupdate =0 ; +/* 70 us is a conservative estimate of cursor update time*/ if (us_to_vupdate >70 )return ; -/* Stall out until the cursor update completes. */ -if (vupdate_end < vupdate_start) - vupdate_end += stream->timing.v_total; us_vupdate = (vupdate_end - vupdate_start +1 ) * us_per_line;udelay (us_to_vupdate + us_vupdate); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/449 drm/amd/display: Guard Possible Null Pointer Dereference
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sung Lee <[email protected]>
[ Upstream commit c87d202692de34ee71d1fd4679a549a29095658a ]
[WHY]
In some situations, dc->res_pool may be null.
[HOW]
Check if pointer is null before dereference.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -3
@@ -5549,9 +5549,11 @@ void dc_allow_idle_optimizations_internal(struct dc *dc, bool allow, char constif (dc->clk_mgr !=NULL && dc->clk_mgr->funcs->get_hard_min_memclk) idle_dramclk_khz = dc->clk_mgr->funcs->get_hard_min_memclk (dc->clk_mgr); -for (i =0 ; i < dc->res_pool->pipe_count; i++) { - pipe = &context->res_ctx.pipe_ctx[i]; - subvp_pipe_type[i] =dc_state_get_pipe_subvp_type (context, pipe); +if (dc->res_pool && context) { +for (i =0 ; i < dc->res_pool->pipe_count; i++) { + pipe = &context->res_ctx.pipe_ctx[i]; + subvp_pipe_type[i] =dc_state_get_pipe_subvp_type (context, pipe); + } } DC_LOG_DC("%s: allow_idle=%d\n HardMinUClk_Khz=%d HardMinDramclk_Khz=%d\n Pipe_0=%d Pipe_1=%d Pipe_2=%d Pipe_3=%d Pipe_4=%d Pipe_5=%d (caller=%s)\n",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/449 drm/amd/display: add workaround flag to link to force FFE preset
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brendan Tam <[email protected]>
[ Upstream commit 51d1b338541dea83fec8e6f95d3e46fa469a73a8 ]
[Why]
There have been instances of some monitors being unable to link train on their reported link speed using their selected FFE preset. If a different FFE preset is found that has a higher rate of success during link training this workaround can be used to force its FFE preset.
[How]
A new link workaround flag is made called force_dp_ffe_preset. The flag is checked in override_training_settings and will set lt_settings->ffe_preset which is null if the flag is not set. The flag is then set in override_lane_settings.
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 ++ .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
@@ -1788,7 +1788,9 @@ struct dc_link {bool dongle_mode_timing_override;bool blank_stream_on_ocs_change;bool read_dpcd204h_on_irq_hpd; +bool force_dp_ffe_preset; } wa_flags; +union dc_dp_ffe_preset forced_dp_ffe_preset;struct link_mst_stream_allocation_table mst_stream_alloc_table;struct dc_link_status link_status;
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c +2 -0
@@ -736,6 +736,8 @@ void override_training_settings( lt_settings->pre_emphasis = overrides->pre_emphasis;if (overrides->post_cursor2 !=NULL ) lt_settings->post_cursor2 = overrides->post_cursor2; +if (link->wa_flags.force_dp_ffe_preset && !dp_is_lttpr_present (link)) + lt_settings->ffe_preset = &link->forced_dp_ffe_preset;if (overrides->ffe_preset !=NULL ) lt_settings->ffe_preset = overrides->ffe_preset;/* Override HW lane settings with BIOS forced values if present */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/449 drm/amdgpu: Unlocked unmap only clear page table leaves
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
[ Upstream commit 23b645231eeffdaf44021debac881d2f26824150 ]
SVM migration unmap pages from GPU and then update mapping to GPU to recover page fault. Currently unmap clears the PDE entry for range length >= huge page and free PTB bo, update mapping to alloc new PT bo. There is race bug that the freed entry bo maybe still on the pt_free list, reused when updating mapping and then freed, leave invalid PDE entry and cause GPU page fault.
By setting the update to clear only one PDE entry or clear PTB, to avoid unmap to free PTE bo. This fixes the race bug and improve the unmap and map to GPU performance. Update mapping to huge page will still free the PTB bo.
With this change, the vm->pt_freed list and work is not needed. Add WARN_ON(unlocked) in amdgpu_vm_pt_free_dfs to catch if unmap to free the PTB.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 4 --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 43 +++++++---------------- 3 files changed, 13 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -4
@@ -2534,8 +2534,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,spin_lock_init (&vm->status_lock);INIT_LIST_HEAD (&vm->freed);INIT_LIST_HEAD (&vm->done); -INIT_LIST_HEAD (&vm->pt_freed); -INIT_WORK (&vm->pt_free_work, amdgpu_vm_pt_free_work);INIT_KFIFO (vm->faults); r =amdgpu_vm_init_entities (adev, vm);
@@ -2717,8 +2715,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)amdgpu_amdkfd_gpuvm_destroy_cb (adev, vm); -flush_work (&vm->pt_free_work); - root =amdgpu_bo_ref (vm->root.bo);amdgpu_bo_reserve (root, true);amdgpu_vm_set_pasid (adev, vm,0 );
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +0 -4
@@ -374,10 +374,6 @@ struct amdgpu_vm {/* BOs which are invalidated, has been updated in the PTs */ struct list_head done; -/* PT BOs scheduled to free and fill with zero if vm_resv is not hold */ -struct list_head pt_freed; -struct work_struct pt_free_work; -/* contains the page directory */ struct amdgpu_vm_bo_base root;struct dma_fence *last_update;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +13 -30
66 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/449 drm: panel-orientation-quirks: Add support for AYANEO 2S
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit eb8f1e3e8ee10cff591d4a47437dfd34d850d454 ]
AYANEO 2S uses the same panel and orientation as the AYANEO 2.
Update the AYANEO 2 DMI match to also match AYANEO 2S.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_panel_orientation_quirks.c +2 -2
@@ -184,10 +184,10 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"), }, .driver_data = (void *)&lcd800x1280_rightside_up, - }, { /* AYA NEO AYANEO 2 */ + }, { /* AYA NEO AYANEO 2/2S */ .matches = {DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), + DMI_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* AYA NEO 2021 */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/449 drm: panel-orientation-quirks: Add quirks for AYA NEO Flip DS and KB
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit 529741c331da1fbf54f86c6ec3a4558b9b0b16dc ]
The AYA NEO Flip DS and KB both use a 1080x1920 portrait LCD panel. The Flip DS additionally uses a 640x960 portrait LCD panel as a second display.
Add DMI matches to correctly rotate these panels.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +18 -0
@@ -93,6 +93,12 @@ static const struct drm_dmi_panel_orientation_data onegx1_pro = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd640x960_leftside_up = { + .width =640 , + .height =960 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd720x1280_rightside_up = { .width =720 , .height =1280 ,
@@ -202,6 +208,18 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_PRODUCT_NAME, "AIR"), }, .driver_data = (void *)&lcd1080x1920_leftside_up, + }, { /* AYA NEO Flip DS Bottom Screen */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FLIP DS"), + }, + .driver_data = (void *)&lcd640x960_leftside_up, + }, { /* AYA NEO Flip KB/DS Top Screen */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "FLIP"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYA NEO Founder */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYA NEO"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/449 drm: panel-orientation-quirks: Add quirk for AYA NEO Slide
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit 132c89ef8872e602cfb909377815111d121fe8d7 ]
The AYANEO Slide uses a 1080x1920 portrait LCD panel. This is the same panel used on the AYANEO Air Plus, but the DMI data is too different to match both with one entry.
Add a DMI match to correctly rotate the panel on the AYANEO Slide.
This also covers the Antec Core HS, which is a rebranded AYANEO Slide with the exact same hardware and DMI strings.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -244,6 +244,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_BOARD_NAME, "KUN"), }, .driver_data = (void *)&lcd1600x2560_rightside_up, + }, { /* AYA NEO SLIDE */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "SLIDE"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYN Loki Max */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ayn"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/449 drm: panel-orientation-quirks: Add new quirk for GPD Win 2
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit a860eb9c6ba6cdbf32e3e01a606556e5a90a2931 ]
Some GPD Win 2 units shipped with the correct DMI strings.
Add a DMI match to correctly rotate the panel on these units.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -339,6 +339,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), }, .driver_data = (void *)&gpd_win2, + }, { /* GPD Win 2 (correct DMI strings) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"GPD" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"WIN2" ) + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* GPD Win 3 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/449 drm: panel-orientation-quirks: Add quirk for OneXPlayer Mini (Intel)
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Wyatt <[email protected]>
[ Upstream commit b24dcc183583fc360ae0f0899e286a68f46abbd0 ]
The Intel model of the OneXPlayer Mini uses a 1200x1920 portrait LCD panel. The DMI strings are the same as the OneXPlayer, which already has a DMI quirk, but the panel is different.
Add a DMI match to correctly rotate this panel.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +12 -0
@@ -129,6 +129,12 @@ static const struct drm_dmi_panel_orientation_data lcd1080x1920_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1200x1920_leftside_up = { + .width =1200 , + .height =1920 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .width =1200 , .height =1920 ,
@@ -473,6 +479,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), }, .driver_data = (void *)&lcd1600x2560_leftside_up, + }, { /* OneXPlayer Mini (Intel) */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ONE-NETBOOK TECHNOLOGY CO., LTD." ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), + }, + .driver_data = (void *)&lcd1200x1920_leftside_up, }, { /* OrangePi Neo */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "OrangePi"),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/449 drm/debugfs: fix printk format for bridge index
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Ceresoli <[email protected]>
[ Upstream commit 72443c730b7a7b5670a921ea928e17b9b99bd934 ]
idx is an unsigned int, use %u for printk-style strings.
--- drivers/gpu/drm/drm_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_debugfs.c +1 -1
@@ -748,7 +748,7 @@ static int bridges_show(struct seq_file *m, void *data)unsigned int idx =0 ;drm_for_each_bridge_in_chain (encoder, bridge) { -drm_printf (&p,"bridge[%d]: %ps\n" , idx++, bridge->funcs); +drm_printf (&p,"bridge[%u]: %ps\n" , idx++, bridge->funcs);drm_printf (&p,"\ttype: [%d] %s\n" , bridge->type,drm_get_connector_type_name (bridge->type));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/449 drm/bridge: panel: forbid initializing a panel with unknown connector type
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Ceresoli <[email protected]>
[ Upstream commit b296955b3a740ecc8b3b08e34fd64f1ceabb8fb4 ]
Having an DRM_MODE_CONNECTOR_Unknown connector type is considered bad, and drm_panel_bridge_add_typed() and derivatives are deprecated for this.
drm_panel_init() won't prevent initializing a panel with a DRM_MODE_CONNECTOR_Unknown connector type. Luckily there are no in-tree users doing it, so take this as an opportinuty to document a valid connector type must be passed.
Returning an error if this rule is violated is not possible because drm_panel_init() is a void function. Add at least a warning to make any violations noticeable, especially to non-upstream drivers.
--- drivers/gpu/drm/drm_panel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_panel.c +4 -1
@@ -50,7 +50,7 @@ static LIST_HEAD(panel_list);* @dev: parent device of the panel * @funcs: panel operations * @connector_type: the connector type (DRM_MODE_CONNECTOR_*) corresponding to -* the panel interface +* the panel interface (must NOT be DRM_MODE_CONNECTOR_Unknown) * * Initialize the panel structure for subsequent registration with * drm_panel_add().
@@ -58,6 +58,9 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel,struct device *dev,const struct drm_panel_funcs *funcs,int connector_type) { +if (connector_type == DRM_MODE_CONNECTOR_Unknown) +DRM_WARN ("%s: %s: a valid connector type is required!\n" , __func__,dev_name (dev)); +INIT_LIST_HEAD (&panel->list);INIT_LIST_HEAD (&panel->followers);mutex_init (&panel->follower_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/449 drm/amd/display: Update FIXED_VS Link Rate Toggle Workaround Usage
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Strauss <[email protected]>
[ Upstream commit 7c6518c1c73199a230b5fc55ddfed3e5b9dc3290 ]
[WHY]
Previously the 128b/132b LTTPR support DPCD field was used to decide if FIXED_VS training sequence required a rate toggle before initiating LT.
When running DP2.1 4.9.x.x compliance tests, emulated LTTPRs can report no-128b/132b support which is then forwarded by the FIXED_VS retimer. As a result this test exposes the rate toggle again, erroneously causing failures as certain compliance sinks don't expect this behaviour.
[HOW]
Add new DPCD register defines/reads to read LTTPR IEEE OUI and device ID.
Decide whether to perform the rate toggle based on the LTTPR's IEEE OUI which guarantees that we only perform the toggle on affected retimers.
--- drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 8 ++++++++ .../display/dc/link/protocols/link_dp_capability.c | 12 ++++++++++-- .../protocols/link_dp_training_fixed_vs_pe_retimer.c | 3 ++- 3 files changed, 20 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_dp_types.h +8 -0
@@ -1119,6 +1119,8 @@ struct dc_lttpr_caps {union dp_main_link_channel_coding_lttpr_cap main_link_channel_coding;union dp_128b_132b_supported_lttpr_link_rates supported_128b_132b_rates;uint8_t aux_rd_interval[MAX_REPEATER_CNT -1 ]; +uint8_t lttpr_ieee_oui[3 ]; +uint8_t lttpr_device_id[6 ]; };struct dc_dongle_dfp_cap_ext {
@@ -1379,6 +1381,12 @@ struct dp_trace {#ifndef DP_BRANCH_VENDOR_SPECIFIC_START #define DP_BRANCH_VENDOR_SPECIFIC_START 0x50C#endif +#ifndef DP_LTTPR_IEEE_OUI +#define DP_LTTPR_IEEE_OUI 0xF003D +#endif +#ifndef DP_LTTPR_DEVICE_ID +#define DP_LTTPR_DEVICE_ID 0xF0040 +#endif /** USB4 DPCD BW Allocation Registers Chapter 10.7 **/ #ifndef DP_TUNNELING_CAPABILITIES #define DP_TUNNELING_CAPABILITIES 0xE000D/* 1.4a */
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +10 -2
@@ -1568,10 +1568,18 @@ enum dc_status dp_retrieve_lttpr_cap(struct dc_link *link)/* Attempt to train in LTTPR transparent mode if repeater count exceeds 8. */ is_lttpr_present =dp_is_lttpr_present (link); -if (is_lttpr_present) +DC_LOG_DC ("is_lttpr_present = %d\n" , is_lttpr_present); + +if (is_lttpr_present) {CONN_DATA_DETECT (link, lttpr_dpcd_data,sizeof (lttpr_dpcd_data),"LTTPR Caps: " ); -DC_LOG_DC ("is_lttpr_present = %d\n" , is_lttpr_present); +core_link_read_dpcd (link,DP_LTTPR_IEEE_OUI , link->dpcd_caps.lttpr_caps.lttpr_ieee_oui,sizeof (link->dpcd_caps.lttpr_caps.lttpr_ieee_oui)); +CONN_DATA_DETECT (link, link->dpcd_caps.lttpr_caps.lttpr_ieee_oui,sizeof (link->dpcd_caps.lttpr_caps.lttpr_ieee_oui),"LTTPR IEEE OUI: " ); + +core_link_read_dpcd (link,DP_LTTPR_DEVICE_ID , link->dpcd_caps.lttpr_caps.lttpr_device_id,sizeof (link->dpcd_caps.lttpr_caps.lttpr_device_id)); +CONN_DATA_DETECT (link, link->dpcd_caps.lttpr_caps.lttpr_device_id,sizeof (link->dpcd_caps.lttpr_caps.lttpr_device_id),"LTTPR Device ID: " ); + } +return status; }
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_fixed_vs_pe_retimer.c +2 -1
@@ -270,7 +270,8 @@ enum link_training_result dp_perform_fixed_vs_pe_training_sequence( rate =get_dpcd_link_rate (<_settings->link_settings); -if (!link->dpcd_caps.lttpr_caps.main_link_channel_coding.bits.DP_128b_132b_SUPPORTED) { +// Only perform toggle if FIXED_VS LTTPR reports no IEEE OUI +if (memcmp ("\x0,\x0,\x0" , &link->dpcd_caps.lttpr_caps.lttpr_ieee_oui[0 ],3 ) ==0 ) {/* Vendor specific: Toggle link rate */ toggle_rate = (rate ==0x6 ) ?0xA :0x6 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/449 drm/amd/display: stop DML2 from removing pipes based on planes
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Katsnelson <[email protected]>
[ Upstream commit 8adeff83a3b07fa6d0958ed51e1b38ba7469e448 ]
[Why]
Transitioning from low to high resolutions at high refresh rates caused grey corruption. During the transition state, there is a period where plane size is based on low resultion state and ODM slices are based on high resoultion state, causing the entire plane to be contained in one ODM slice. DML2 would turn off the pipe for the ODM slice with no plane, causing an underflow since the pixel rate for the higher resolution cannot be supported on one pipe. This change stops DML2 from turning off pipes that are mapped to an ODM slice with no plane. This is possible to do without negative consequences because pipes can now take the minimum viewport and draw with zero recout size, removing the need to have the pipe turned off.
[How]
In map_pipes_from_plane(), remove "check" that skips ODM slices that are not covered by the plane. This prevents the pipes for those ODM slices from being freed.
--- .../display/dc/dml2/dml2_dc_resource_mgmt.c | 26 ------------------- 1 file changed, 26 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +0 -26
@@ -532,26 +532,6 @@ static void calculate_odm_slices(const struct dc_stream_state *stream, unsigned odm_slice_end_x[odm_factor -1 ] = stream->src.width -1 ; } -static bool is_plane_in_odm_slice (const struct dc_plane_state *plane,unsigned int slice_index,unsigned int *odm_slice_end_x,unsigned int num_slices) -{ -unsigned int slice_start_x, slice_end_x; - -if (slice_index ==0 ) - slice_start_x =0 ; -else - slice_start_x = odm_slice_end_x[slice_index -1 ] +1 ; - - slice_end_x = odm_slice_end_x[slice_index]; - -if (plane->clip_rect.x + plane->clip_rect.width < slice_start_x) -return false; - -if (plane->clip_rect.x > slice_end_x) -return false; - -return true; -} - static void add_odm_slice_to_odm_tree(struct dml2_context *ctx, struct dc_state *state, struct dc_pipe_mapping_scratch *scratch,
@@ -791,12 +771,6 @@ static void map_pipes_for_plane(struct dml2_context *ctx, struct dc_state *statesort_pipes_for_splitting (&scratch->pipe_pool);for (odm_slice_index =0 ; odm_slice_index < scratch->odm_info.odm_factor; odm_slice_index++) { -// We build the tree for one ODM slice at a time. -// Each ODM slice shares a common OPP -if (!is_plane_in_odm_slice (plane, odm_slice_index, scratch->odm_info.odm_slice_end_x, scratch->odm_info.odm_factor)) { -continue ; - } -// Now we have a list of all pipes to be used for this plane/stream, now setup the tree. scratch->odm_info.next_higher_pipe_for_odm_slice[odm_slice_index] = add_plane_to_blend_tree(ctx, state, plane,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/449 drivers: base: devres: Allow to release group on device release
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas De Marchi <[email protected]>
[ Upstream commit 8e1ddfada4530939a8cb64ee9251aef780474274 ]
When releasing a device, if the release action causes a group to be released, a warning is emitted because it can't find the group. This happens because devres_release_all() moves the entire list to a todo list and also move the group markers. Considering r* normal resource nodes and g1 a group resource node:
g1 -----------. v v r1 -> r2 -> g1[0] -> r3-> g[1] -> r4
After devres_release_all(), dev->devres_head becomes empty and the todo list it iterates on becomes:
g1 v r1 -> r2 -> r3-> r4 -> g1[0]
When a call to component_del() is made and takes down the aggregate device, a warning like this happen:
RIP: 0010:devres_release_group+0x362/0x530 ... Call Trace: <TASK> component_unbind+0x156/0x380 component_unbind_all+0x1d0/0x270 mei_component_master_unbind+0x28/0x80 [mei_hdcp] take_down_aggregate_device+0xc1/0x160 component_del+0x1c6/0x3e0 intel_hdcp_component_fini+0xf1/0x170 [xe] xe_display_fini+0x1e/0x40 [xe]
Because the devres group corresponding to the hdcp component cannot be found. Just ignore this corner case: if the dev->devres_head is empty and the caller is trying to remove a group, it's likely in the process of device cleanup so just ignore it instead of warning.
--- drivers/base/devres.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/base/devres.c +7 -0
@@ -687,6 +687,13 @@ int devres_release_group(struct device *dev, void *id)spin_unlock_irqrestore (&dev->devres_lock, flags);release_nodes (dev, &todo); + }else if (list_empty (&dev->devres_head)) { +/* +* dev is probably dying via devres_release_all(): groups +* have already been removed and are on the process of +* being released - don't touch and don't warn. +*/ +spin_unlock_irqrestore (&dev->devres_lock, flags); }else {WARN_ON (1 );spin_unlock_irqrestore (&dev->devres_lock, flags);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/449 drm/amdkfd: clamp queue size to minimum
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Yat Sin <[email protected]>
[ Upstream commit e90711946b53590371ecce32e8fcc381a99d6333 ]
If queue size is less than minimum, clamp it to minimum to prevent underflow when writing queue mqd.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++++++ include/uapi/linux/kfd_ioctl.h | 2 ++ 2 files changed, 12 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +10 -0
@@ -212,6 +212,11 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties,return -EINVAL ; } +if (args->ring_size <KFD_MIN_QUEUE_RING_SIZE ) { + args->ring_size =KFD_MIN_QUEUE_RING_SIZE ; +pr_debug ("Size lower. clamped to KFD_MIN_QUEUE_RING_SIZE" ); + } +if (!access_ok ((const void __user *) args->read_pointer_address,sizeof (uint32_t ))) {pr_err ("Can't access read pointer\n" );
@@ -461,6 +466,11 @@ static int kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p,return -EINVAL ; } +if (args->ring_size <KFD_MIN_QUEUE_RING_SIZE ) { + args->ring_size =KFD_MIN_QUEUE_RING_SIZE ; +pr_debug ("Size lower. clamped to KFD_MIN_QUEUE_RING_SIZE" ); + } + properties.queue_address = args->ring_base_address; properties.queue_size = args->ring_size; properties.queue_percent = args->queue_percentage &0xFF ;
include/uapi/linux/kfd_ioctl.h +2 -0
@@ -62,6 +62,8 @@ struct kfd_ioctl_get_version_args {#define KFD_MAX_QUEUE_PERCENTAGE 100#define KFD_MAX_QUEUE_PRIORITY 15 +#define KFD_MIN_QUEUE_RING_SIZE 1024 +struct kfd_ioctl_create_queue_args {__u64 ring_base_address;/* to KFD */ __u64 write_pointer_address;/* from KFD */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/449 drm/amdkfd: Fix mode1 reset crash issue
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
[ Upstream commit f0b4440cdc1807bb6ec3dce0d6de81170803569b ]
If HW scheduler hangs and mode1 reset is used to recover GPU, KFD signal user space to abort the processes. After process abort exit, user queues still use the GPU to access system memory before h/w is reset while KFD cleanup worker free system memory and free VRAM.
There is use-after-free race bug that KFD allocate and reuse the freed system memory, and user queue write to the same system memory to corrupt the data structure and cause driver crash.
To fix this race, KFD cleanup worker terminate user queues, then flush reset_domain wq to wait for any GPU ongoing reset complete, and then free outstanding BOs.
--- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +17 -0
@@ -35,6 +35,7 @@#include <linux/pm_runtime.h> #include "amdgpu_amdkfd.h" #include "amdgpu.h" +#include "amdgpu_reset.h" struct mm_struct ;
@@ -1140,6 +1141,17 @@ static void kfd_process_remove_sysfs(struct kfd_process *p) p->kobj =NULL ; } +/* +* If any GPU is ongoing reset, wait for reset complete. +*/ +static void kfd_process_wait_gpu_reset_complete (struct kfd_process *p) +{ +int i; + +for (i =0 ; i < p->n_pdds; i++) +flush_workqueue (p->pdds[i]->dev->adev->reset_domain->wq); +} +/* No process locking is needed in this function, because the process * is not findable any more. We must assume that no other thread is * using it any more, otherwise we couldn't safely free the process
@@ -1154,6 +1166,11 @@ static void kfd_process_wq_release(struct work_struct *work)kfd_process_dequeue_from_all_devices (p);pqm_uninit (&p->pqm); +/* +* If GPU in reset, user queues may still running, wait for reset complete. +*/ +kfd_process_wait_gpu_reset_complete (p); +/* Signal the eviction fence after user mode queues are * destroyed. This allows any BOs to be freed without * triggering pointless evictions or waiting for fences.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/449 drm/amdkfd: Fix pqm_destroy_queue race with GPU reset
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
[ Upstream commit 7919b4cad5545ed93778f11881ceee72e4dbed66 ]
If GPU in reset, destroy_queue return -EIO, pqm_destroy_queue should delete the queue from process_queue_list and free the resource.
--- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1 -1
@@ -548,7 +548,7 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)pr_err ("Pasid 0x%x destroy queue %d failed, ret %d\n" , pqm->process->pasid, pqn->q->properties.queue_id, retval); -if (retval != -ETIME ) +if (retval != -ETIME && retval != -EIO ) goto err_destroy_queue; }kfd_procfs_del_queue (pqn->q);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/449 drm/amdkfd: debugfs hang_hws skip GPU with MES
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philip Yang <[email protected]>
[ Upstream commit fe9d0061c413f8fb8c529b18b592b04170850ded ]
debugfs hang_hws is used by GPU reset test with HWS, for MES this crash the kernel with NULL pointer access because dqm->packet_mgr is not setup for MES path.
Skip GPU with MES for now, MES hang_hws debugfs interface will be supported later.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +5 -0
@@ -1593,6 +1593,11 @@ int kfd_debugfs_hang_hws(struct kfd_node *dev)return -EINVAL ; } +if (dev->kfd->shared_resources.enable_mes) { +dev_err (dev->adev->dev,"Inducing MES hang is not supported\n" ); +return -EINVAL ; + } +return dqm_debugfs_hang_hws (dev->dqm); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/449 drm/xe/xelp: Move Wa_16011163337 from tunings to workarounds
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
[ Upstream commit d9b5d83c5a4d720af6ddbefe2825c78f0325a3fd ]
Workaround database specifies 16011163337 as a workaround so lets move it there.
--- drivers/gpu/drm/xe/xe_tuning.c | 8 -------- drivers/gpu/drm/xe/xe_wa.c | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/xe/xe_tuning.c +0 -8
@@ -97,14 +97,6 @@ static const struct xe_rtp_entry_sr engine_tunings[] = { };static const struct xe_rtp_entry_sr lrc_tunings[] = { - {XE_RTP_NAME ("Tuning: ganged timer, also known as 16011163337" ), -XE_RTP_RULES (GRAPHICS_VERSION_RANGE (1200 ,1210 ),ENGINE_CLASS (RENDER )), -/* read verification is ignored due to 1608008084. */ -XE_RTP_ACTIONS (FIELD_SET_NO_READ_MASK (FF_MODE2 , -FF_MODE2_GS_TIMER_MASK , -FF_MODE2_GS_TIMER_224 )) - }, -/* DG2 */ {XE_RTP_NAME ("Tuning: L3 cache" ),
drivers/gpu/drm/xe/xe_wa.c +7 -0
@@ -618,6 +618,13 @@ static const struct xe_rtp_entry_sr engine_was[] = { };static const struct xe_rtp_entry_sr lrc_was[] = { + {XE_RTP_NAME ("16011163337" ), +XE_RTP_RULES (GRAPHICS_VERSION_RANGE (1200 ,1210 ),ENGINE_CLASS (RENDER )), +/* read verification is ignored due to 1608008084. */ +XE_RTP_ACTIONS (FIELD_SET_NO_READ_MASK (FF_MODE2 , +FF_MODE2_GS_TIMER_MASK , +FF_MODE2_GS_TIMER_224 )) + }, {XE_RTP_NAME ("1409342910, 14010698770, 14010443199, 1408979724, 1409178076, 1409207793, 1409217633, 1409252684, 1409347922, 1409142259" ),XE_RTP_RULES (GRAPHICS_VERSION_RANGE (1200 ,1210 )), XE_RTP_ACTIONS(SET(COMMON_SLICE_CHICKEN3,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/449 drm/mediatek: mtk_dpi: Move the input_2p_en bit to platform data
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit c90876a695dd83e76680b88b40067275a5982811 ]
In preparation for adding support for MT8195's HDMI reserved DPI instance, move the input_2p_en bit for DP_INTF to platform data.
While at it, remove the input_2pixel member from platform data as having this bit implies that the 2pixel feature must be enabled.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +7 -7
@@ -127,14 +127,14 @@ struct mtk_dpi_yc_limit {* @is_ck_de_pol: Support CK/DE polarity. * @swap_input_support: Support input swap function. * @support_direct_pin: IP supports direct connection to dpi panels. -* @input_2pixel: Input pixel of dp_intf is 2 pixel per round, so enable this -* config to enable this feature. * @dimension_mask: Mask used for HWIDTH, HPORCH, VSYNC_WIDTH and VSYNC_PORCH * (no shift). * @hvsize_mask: Mask of HSIZE and VSIZE mask (no shift). * @channel_swap_shift: Shift value of channel swap. * @yuv422_en_bit: Enable bit of yuv422. * @csc_enable_bit: Enable bit of CSC. +* @input_2p_en_bit: Enable bit for input two pixel per round feature. +* If present, implies that the feature must be enabled. * @pixels_per_iter: Quantity of transferred pixels per iteration. * @edge_cfg_in_mmsys: If the edge configuration for DPI's output needs to be set in MMSYS. */
@@ -148,12 +148,12 @@ struct mtk_dpi_conf {bool is_ck_de_pol;bool swap_input_support;bool support_direct_pin; -bool input_2pixel;u32 dimension_mask;u32 hvsize_mask;u32 channel_swap_shift;u32 yuv422_en_bit;u32 csc_enable_bit; +u32 input_2p_en_bit;u32 pixels_per_iter;bool edge_cfg_in_mmsys; };
@@ -610,9 +610,9 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,mtk_dpi_dual_edge (dpi);mtk_dpi_config_disable_edge (dpi); } -if (dpi->conf->input_2pixel) { -mtk_dpi_mask (dpi,DPI_CON ,DPINTF_INPUT_2P_EN , -DPINTF_INPUT_2P_EN ); +if (dpi->conf->input_2p_en_bit) { +mtk_dpi_mask (dpi,DPI_CON , dpi->conf->input_2p_en_bit, + dpi->conf->input_2p_en_bit); }mtk_dpi_sw_reset (dpi, false);
@@ -1006,12 +1006,12 @@ static const struct mtk_dpi_conf mt8195_dpintf_conf = { .output_fmts = mt8195_output_fmts, .num_output_fmts = ARRAY_SIZE(mt8195_output_fmts), .pixels_per_iter = 4, - .input_2pixel = true, .dimension_mask = DPINTF_HPW_MASK, .hvsize_mask = DPINTF_HSIZE_MASK, .channel_swap_shift = DPINTF_CH_SWAP, .yuv422_en_bit = DPINTF_YUV422_EN, .csc_enable_bit = DPINTF_CSC_ENABLE, + .input_2p_en_bit = DPINTF_INPUT_2P_EN, };static int mtk_dpi_probe (struct platform_device *pdev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/449 drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 473c33f5ce651365468503c76f33158aaa1c7dd2 ]
In preparation for adding support for MT8195's HDMI reserved DPI, add calls to clk_prepare_enable() / clk_disable_unprepare() for the TVD clock: in this particular case, the aforementioned clock is not (and cannot be) parented to neither pixel or engine clocks hence it won't get enabled automatically by the clock framework.
Please note that on all of the currently supported MediaTek platforms, the TVD clock is always a parent of either pixel or engine clocks, and this means that the common clock framework is already enabling this clock before the children. On such platforms, this commit will only increase the refcount of the TVD clock without any functional change.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/mediatek/mtk_dpi.c +9 -0
@@ -471,6 +471,7 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)mtk_dpi_disable (dpi);clk_disable_unprepare (dpi->pixel_clk); +clk_disable_unprepare (dpi->tvd_clk);clk_disable_unprepare (dpi->engine_clk); }
@@ -487,6 +488,12 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) goto err_refcount; } + ret =clk_prepare_enable (dpi->tvd_clk); +if (ret) { +dev_err (dpi->dev,"Failed to enable tvd pll: %d\n" , ret); + goto err_engine; + } + ret =clk_prepare_enable (dpi->pixel_clk);if (ret) {dev_err (dpi->dev,"Failed to enable pixel clock: %d\n" , ret);
@@ -496,6 +503,8 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)return 0 ; err_pixel: +clk_disable_unprepare (dpi->tvd_clk); +err_engine:clk_disable_unprepare (dpi->engine_clk); err_refcount: dpi->refcount--;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/449 drm/rockchip: stop passing non struct drm_device to drm_err() and friends
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
[ Upstream commit abeef1f9eaf9301cc98a6841dab5f72de5c95360 ]
The expectation is that the struct drm_device based logging helpers get passed an actual struct drm_device pointer rather than some random struct pointer where you can dereference the ->dev member.
Convert drm_err(hdmi, ...) to dev_err(hdmi->dev, ...). This matches current usage, but drops "[drm] *ERROR*" prefix from logging.
--- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 16 ++++++++-------- drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +8 -8
@@ -203,7 +203,7 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) hdmi->regmap =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (hdmi->regmap)) { -drm_err (hdmi,"Unable to get rockchip,grf\n" ); +dev_err (hdmi->dev,"Unable to get rockchip,grf\n" );return PTR_ERR (hdmi->regmap); }
@@ -214,7 +214,7 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)if (IS_ERR (hdmi->ref_clk)) { ret =PTR_ERR (hdmi->ref_clk);if (ret != -EPROBE_DEFER ) -drm_err (hdmi,"failed to get reference clock\n" ); +dev_err (hdmi->dev,"failed to get reference clock\n" );return ret; }
@@ -222,7 +222,7 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)if (IS_ERR (hdmi->grf_clk)) { ret =PTR_ERR (hdmi->grf_clk);if (ret != -EPROBE_DEFER ) -drm_err (hdmi,"failed to get grf clock\n" ); +dev_err (hdmi->dev,"failed to get grf clock\n" );return ret; }
@@ -302,16 +302,16 @@ static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder) ret =clk_prepare_enable (hdmi->grf_clk);if (ret <0 ) { -drm_err (hdmi,"failed to enable grfclk %d\n" , ret); +dev_err (hdmi->dev,"failed to enable grfclk %d\n" , ret);return ; } ret =regmap_write (hdmi->regmap, hdmi->chip_data->lcdsel_grf_reg, val);if (ret !=0 ) -drm_err (hdmi,"Could not write to GRF: %d\n" , ret); +dev_err (hdmi->dev,"Could not write to GRF: %d\n" , ret);clk_disable_unprepare (hdmi->grf_clk); -drm_dbg (hdmi,"vop %s output to hdmi\n" , ret ?"LIT" :"BIG" ); +dev_dbg (hdmi->dev,"vop %s output to hdmi\n" , ret ?"LIT" :"BIG" ); } static int
@@ -574,7 +574,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, ret =rockchip_hdmi_parse_dt (hdmi);if (ret) {if (ret != -EPROBE_DEFER ) -drm_err (hdmi,"Unable to parse OF data\n" ); +dev_err (hdmi->dev,"Unable to parse OF data\n" );return ret; }
@@ -582,7 +582,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,if (IS_ERR (hdmi->phy)) { ret =PTR_ERR (hdmi->phy);if (ret != -EPROBE_DEFER ) -drm_err (hdmi,"failed to get phy\n" ); +dev_err (hdmi->dev,"failed to get phy\n" );return ret; }
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c +8 -8
@@ -170,7 +170,7 @@ static void dw_hdmi_qp_rk3588_hpd_work(struct work_struct *work)if (drm) { changed =drm_helper_hpd_irq_event (drm);if (changed) -drm_dbg (hdmi,"connector status changed\n" ); +dev_dbg (hdmi->dev,"connector status changed\n" ); } }
@@ -287,7 +287,7 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master, } }if (hdmi->port_id <0 ) { -drm_err (hdmi,"Failed to match HDMI port ID\n" ); +dev_err (hdmi->dev,"Failed to match HDMI port ID\n" );return hdmi->port_id; }
@@ -311,20 +311,20 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master, hdmi->regmap =syscon_regmap_lookup_by_phandle (dev->of_node,"rockchip,grf" );if (IS_ERR (hdmi->regmap)) { -drm_err (hdmi,"Unable to get rockchip,grf\n" ); +dev_err (hdmi->dev,"Unable to get rockchip,grf\n" );return PTR_ERR (hdmi->regmap); } hdmi->vo_regmap =syscon_regmap_lookup_by_phandle (dev->of_node,"rockchip,vo-grf" );if (IS_ERR (hdmi->vo_regmap)) { -drm_err (hdmi,"Unable to get rockchip,vo-grf\n" ); +dev_err (hdmi->dev,"Unable to get rockchip,vo-grf\n" );return PTR_ERR (hdmi->vo_regmap); } ret =devm_clk_bulk_get_all_enabled (hdmi->dev, &clks);if (ret <0 ) { -drm_err (hdmi,"Failed to get clocks: %d\n" , ret); +dev_err (hdmi->dev,"Failed to get clocks: %d\n" , ret);return ret; }
@@ -332,7 +332,7 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master, GPIOD_OUT_HIGH);if (IS_ERR (hdmi->enable_gpio)) { ret =PTR_ERR (hdmi->enable_gpio); -drm_err (hdmi,"Failed to request enable GPIO: %d\n" , ret); +dev_err (hdmi->dev,"Failed to request enable GPIO: %d\n" , ret);return ret; }
@@ -340,7 +340,7 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,if (IS_ERR (hdmi->phy)) { ret =PTR_ERR (hdmi->phy);if (ret != -EPROBE_DEFER ) -drm_err (hdmi,"failed to get phy: %d\n" , ret); +dev_err (hdmi->dev,"failed to get phy: %d\n" , ret);return ret; }
@@ -403,7 +403,7 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master, connector =drm_bridge_connector_init (drm, encoder);if (IS_ERR (connector)) { ret =PTR_ERR (connector); -drm_err (hdmi,"failed to init bridge connector: %d\n" , ret); +dev_err (hdmi->dev,"failed to init bridge connector: %d\n" , ret);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/449 PCI: Add Rockchip Vendor ID
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Lin <[email protected]>
[ Upstream commit 20bbb083bbc9d3f8db390f2e35e168f1b23dae8a ]
Move PCI_VENDOR_ID_ROCKCHIP from pci_endpoint_test.c to pci_ids.h and reuse it in pcie-rockchip-host.c.
--- drivers/misc/pci_endpoint_test.c | 1 - drivers/pci/controller/pcie-rockchip-host.c | 2 +- drivers/pci/controller/pcie-rockchip.h | 1 - include/linux/pci_ids.h | 2 ++ 4 files changed, 3 insertions(+), 3 deletions(-)
drivers/misc/pci_endpoint_test.c +0 -1
@@ -88,7 +88,6 @@#define PCI_DEVICE_ID_RENESAS_R8A774E1 0x0025#define PCI_DEVICE_ID_RENESAS_R8A779F0 0x0031 -#define PCI_VENDOR_ID_ROCKCHIP 0x1d87#define PCI_DEVICE_ID_ROCKCHIP_RK3588 0x3588static DEFINE_IDA (pci_endpoint_test_ida);
drivers/pci/controller/pcie-rockchip-host.c +1 -1
@@ -367,7 +367,7 @@ static int rockchip_pcie_host_init_port(struct rockchip_pcie *rockchip) } } -rockchip_pcie_write (rockchip,ROCKCHIP_VENDOR_ID , +rockchip_pcie_write (rockchip,PCI_VENDOR_ID_ROCKCHIP ,PCIE_CORE_CONFIG_VENDOR ); rockchip_pcie_write(rockchip, PCI_CLASS_BRIDGE_PCI_NORMAL << 8,
drivers/pci/controller/pcie-rockchip.h +0 -1
@@ -200,7 +200,6 @@#define AXI_WRAPPER_NOR_MSG 0xc#define PCIE_RC_SEND_PME_OFF 0x11960 -#define ROCKCHIP_VENDOR_ID 0x1d87#define PCIE_LINK_IS_L2 (x) \ (((x) & PCIE_CLIENT_DEBUG_LTSSM_MASK) == PCIE_CLIENT_DEBUG_LTSSM_L2)#define PCIE_LINK_TRAINING_DONE (x) \
include/linux/pci_ids.h +2 -0
@@ -2609,6 +2609,8 @@#define PCI_VENDOR_ID_ZHAOXIN 0x1d17 +#define PCI_VENDOR_ID_ROCKCHIP 0x1d87 +#define PCI_VENDOR_ID_HYGON 0x1d94#define PCI_VENDOR_ID_META 0x1d9b
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/449 drm/amdgpu: handle amdgpu_cgs_create_device() errors in amd_powerplay_create()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 1435e895d4fc967d64e9f5bf81e992ac32f5ac76 ]
Add error handling to propagate amdgpu_cgs_create_device() failures to the caller. When amdgpu_cgs_create_device() fails, release hwmgr and return -ENOMEM to prevent null pointer dereference.
[v1]->[v2]: Change error code from -EINVAL to -ENOMEM. Free hwmgr.
--- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +5 -0
@@ -51,6 +51,11 @@ static int amd_powerplay_create(struct amdgpu_device *adev) hwmgr->adev = adev; hwmgr->not_vf = !amdgpu_sriov_vf (adev); hwmgr->device =amdgpu_cgs_create_device (adev); +if (!hwmgr->device) { +kfree (hwmgr); +return -ENOMEM ; + } +mutex_init (&hwmgr->msg_lock); hwmgr->chip_family = adev->family; hwmgr->chip_id = adev->asic_type;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/449 drm/amd/display: Prevent VStartup Overflow
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Seto <[email protected]>
[ Upstream commit 29c1c20496a7a9bafe2bc2f833d69aa52e0f2c2d ]
[Why]
For some VR headsets with large blanks, it's possible to overflow the OTG_VSTARTUP_PARAM:VSTARTUP_START register. This can lead to incorrect DML calculations and underflow downstream.
[How]
Min the calcualted max_vstartup_lines with the max value of the register.
--- .../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +2 -0
@@ -15,6 +15,7 @@//#define DML_MODE_SUPPORT_USE_DPM_DRAM_BW //#define DML_GLOBAL_PREFETCH_CHECK #define ALLOW_SDPIF_RATE_LIMIT_PRE_CSTATE +#define DML_MAX_VSTARTUP_START 1023const char *dml2_core_internal_bw_type_str (enum dml2_core_internal_bw_type bw_type) {
@@ -3726,6 +3727,7 @@ static unsigned int CalculateMaxVStartup(dml2_printf ("DML::%s: vblank_avail = %u\n" , __func__, vblank_avail);dml2_printf ("DML::%s: max_vstartup_lines = %u\n" , __func__, max_vstartup_lines);#endif + max_vstartup_lines = (unsigned int )math_min2 (max_vstartup_lines,DML_MAX_VSTARTUP_START );return max_vstartup_lines; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/449 PCI: Enable Configuration RRS SV early
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
[ Upstream commit 3f8c4959fc18e477801386a625e726c59f52a2c4 ]
Following a reset, a Function may respond to Config Requests with Request Retry Status (RRS) Completion Status to indicate that it is temporarily unable to process the Request, but will be able to process the Request in the future (PCIe r6.0, sec 2.3.1).
If the Configuration RRS Software Visibility feature is enabled and a Root Complex receives RRS for a config read of the Vendor ID, the Root Complex completes the Request to the host by returning PCI_VENDOR_ID_PCI_SIG, 0x0001 (sec 2.3.2).
The Config RRS SV feature applies only to Root Ports and is not directly related to pci_scan_bridge_extend(). Move the RRS SV enable to set_pcie_port_type() where we handle other PCIe-specific configuration.
--- drivers/pci/probe.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/pci/probe.c +5 -3
@@ -1373,8 +1373,6 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,pci_write_config_word (dev,PCI_BRIDGE_CONTROL , bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT ); -pci_enable_rrs_sv (dev); -if ((secondary || subordinate) && !pcibios_assign_all_busses () && !is_cardbus && !broken) {unsigned int cmax, buses;
@@ -1615,6 +1613,11 @@ void set_pcie_port_type(struct pci_dev *pdev) pdev->pcie_cap = pos;pci_read_config_word (pdev, pos +PCI_EXP_FLAGS , ®16); pdev->pcie_flags_reg = reg16; + + type =pci_pcie_type (pdev); +if (type ==PCI_EXP_TYPE_ROOT_PORT ) +pci_enable_rrs_sv (pdev); +pci_read_config_dword (pdev, pos +PCI_EXP_DEVCAP , &pdev->devcap); pdev->pcie_mpss =FIELD_GET (PCI_EXP_DEVCAP_PAYLOAD , pdev->devcap);
@@ -1631,7 +1634,6 @@ void set_pcie_port_type(struct pci_dev *pdev)* correctly so detect impossible configurations here and correct * the port type accordingly. */ - type =pci_pcie_type (pdev);if (type ==PCI_EXP_TYPE_DOWNSTREAM ) {/* * If pdev claims to be downstream port but the parent
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/449 drm/amdgpu: Fix the race condition for draining retry fault
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emily Deng <[email protected]>
[ Upstream commit f844732e3ad9c4b78df7436232949b8d2096d1a6 ]
Issue:
In the scenario where svm_range_restore_pages is called, but svm->checkpoint_ts has not been set and the retry fault has not been drained, svm_range_unmap_from_cpu is triggered and calls svm_range_free. Meanwhile, svm_range_restore_pages continues execution and reaches svm_range_from_addr. This results in a "failed to find prange..." error,
causing the page recovery to fail.
How to fix:
Move the timestamp check code under the protection of svm->lock.
v2:
Make sure all right locks are released before go out.
v3:
Directly goto out_unlock_svms, and return -EAGAIN.
v4:
Refine code.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 31 +++++++++++++++------------- 1 file changed, 17 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +17 -14
@@ -3002,19 +3002,6 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid, goto out; } -/* check if this page fault time stamp is before svms->checkpoint_ts */ -if (svms->checkpoint_ts[gpuidx] !=0 ) { -if (amdgpu_ih_ts_after (ts, svms->checkpoint_ts[gpuidx])) { -pr_debug ("draining retry fault, drop fault 0x%llx\n" , addr); - r =0 ; - goto out; - }else -/* ts is after svms->checkpoint_ts now, reset svms->checkpoint_ts -* to zero to avoid following ts wrap around give wrong comparing -*/ - svms->checkpoint_ts[gpuidx] =0 ; - } -if (!p->xnack_enabled) {pr_debug ("XNACK not enabled for pasid 0x%x\n" , pasid); r = -EFAULT ;
@@ -3034,6 +3021,21 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,mmap_read_lock (mm); retry_write_locked:mutex_lock (&svms->lock); + +/* check if this page fault time stamp is before svms->checkpoint_ts */ +if (svms->checkpoint_ts[gpuidx] !=0 ) { +if (amdgpu_ih_ts_after (ts, svms->checkpoint_ts[gpuidx])) { +pr_debug ("draining retry fault, drop fault 0x%llx\n" , addr); + r = -EAGAIN ; + goto out_unlock_svms; + }else { +/* ts is after svms->checkpoint_ts now, reset svms->checkpoint_ts +* to zero to avoid following ts wrap around give wrong comparing +*/ + svms->checkpoint_ts[gpuidx] =0 ; + } + } + prange =svm_range_from_addr (svms, addr,NULL );if (!prange) { pr_debug("failed to find prange svms 0x%p address [0x%llx]\n",
@@ -3159,7 +3161,8 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,mutex_unlock (&svms->lock);mmap_read_unlock (mm); -svm_range_count_fault (node, p, gpuidx); +if (r != -EAGAIN ) +svm_range_count_fault (node, p, gpuidx);mmput (mm); out:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/449 PCI: Check BAR index for validity
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philipp Stanner <[email protected]>
[ Upstream commit b1a7f99967fc0c052db8e65b449c7b32b1e9177f ]
Many functions in PCI use accessor macros such as pci_resource_len(), which take a BAR index. That index, however, is never checked for validity, potentially resulting in undefined behavior by overflowing the array pci_dev.resource in the macro pci_resource_n().
Since many users of those macros directly assign the accessed value to an unsigned integer, the macros cannot be changed easily anymore to return -EINVAL for invalid indexes. Consequently, the problem has to be mitigated in higher layers.
Add pci_bar_index_valid(). Use it where appropriate.
[kwilczynski: correct if-statement condition the pci_bar_index_is_valid() helper function uses, tidy up code comments]
--- drivers/pci/devres.c | 16 ++++++++++++++-- drivers/pci/iomap.c | 29 +++++++++++++++++++++-------- drivers/pci/pci.c | 6 ++++++ drivers/pci/pci.h | 16 ++++++++++++++++ 4 files changed, 57 insertions(+), 10 deletions(-)
drivers/pci/devres.c +14 -2
@@ -577,7 +577,7 @@ static int pcim_add_mapping_to_legacy_table(struct pci_dev *pdev, {void __iomem **legacy_iomap_table; -if (bar >=PCI_STD_NUM_BARS ) +if (!pci_bar_index_is_valid (bar))return -EINVAL ; legacy_iomap_table = (void __iomem **)pcim_iomap_table (pdev);
@@ -622,7 +622,7 @@ static void pcim_remove_bar_from_legacy_table(struct pci_dev *pdev, int bar) {void __iomem **legacy_iomap_table; -if (bar >=PCI_STD_NUM_BARS ) +if (!pci_bar_index_is_valid (bar))return ; legacy_iomap_table = (void __iomem **)pcim_iomap_table (pdev);
@@ -655,6 +655,9 @@ void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen)void __iomem *mapping;struct pcim_addr_devres *res; +if (!pci_bar_index_is_valid (bar)) +return NULL ; + res =pcim_addr_devres_alloc (pdev);if (!res)return NULL ;
@@ -722,6 +725,9 @@ void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,int ret;struct pcim_addr_devres *res; +if (!pci_bar_index_is_valid (bar)) +return IOMEM_ERR_PTR (-EINVAL ); + res =pcim_addr_devres_alloc (pdev);if (!res)return IOMEM_ERR_PTR (-ENOMEM );
@@ -823,6 +829,9 @@ static int _pcim_request_region(struct pci_dev *pdev, int bar, const char *name,int ret;struct pcim_addr_devres *res; +if (!pci_bar_index_is_valid (bar)) +return -EINVAL ; + res =pcim_addr_devres_alloc (pdev);if (!res)return -ENOMEM ;
@@ -991,6 +1000,9 @@ void __iomem *pcim_iomap_range(struct pci_dev *pdev, int bar,void __iomem *mapping;struct pcim_addr_devres *res; +if (!pci_bar_index_is_valid (bar)) +return IOMEM_ERR_PTR (-EINVAL ); + res =pcim_addr_devres_alloc (pdev);if (!res)return IOMEM_ERR_PTR (-ENOMEM );
drivers/pci/iomap.c +21 -8
@@ -9,6 +9,8 @@#include <linux/export.h> +#include "pci.h" /* for pci_bar_index_is_valid() */ +/** * pci_iomap_range - create a virtual mapping cookie for a PCI BAR * @dev: PCI device that owns the BAR
@@ -33,12 +35,19 @@ void __iomem *pci_iomap_range(struct pci_dev *dev, unsigned long offset, unsigned long maxlen) { -resource_size_t start =pci_resource_start (dev, bar); -resource_size_t len =pci_resource_len (dev, bar); -unsigned long flags =pci_resource_flags (dev, bar); +resource_size_t start, len; +unsigned long flags; + +if (!pci_bar_index_is_valid (bar)) +return NULL ; + + start =pci_resource_start (dev, bar); + len =pci_resource_len (dev, bar); + flags =pci_resource_flags (dev, bar);if (len <= offset || !start)return NULL ; + len -= offset; start += offset;if (maxlen && len > maxlen)
@@ -77,16 +86,20 @@ void __iomem *pci_iomap_wc_range(struct pci_dev *dev, unsigned long offset, unsigned long maxlen) { -resource_size_t start =pci_resource_start (dev, bar); -resource_size_t len =pci_resource_len (dev, bar); -unsigned long flags =pci_resource_flags (dev, bar); +resource_size_t start, len; +unsigned long flags; - -if (flags &IORESOURCE_IO ) +if (!pci_bar_index_is_valid (bar))return NULL ; + start =pci_resource_start (dev, bar); + len =pci_resource_len (dev, bar); + flags =pci_resource_flags (dev, bar); +if (len <= offset || !start)return NULL ; +if (flags &IORESOURCE_IO ) +return NULL ; len -= offset; start += offset;
drivers/pci/pci.c +6 -0
@@ -3929,6 +3929,9 @@ EXPORT_SYMBOL(pci_enable_atomic_ops_to_root);*/ void pci_release_region (struct pci_dev *pdev,int bar) { +if (!pci_bar_index_is_valid (bar)) +return ; +/* * This is done for backwards compatibility, because the old PCI devres * API had a mode in which the function became managed if it had been
@@ -3973,6 +3976,9 @@ EXPORT_SYMBOL(pci_release_region);static int __pci_request_region (struct pci_dev *pdev,int bar,const char *name,int exclusive) { +if (!pci_bar_index_is_valid (bar)) +return -EINVAL ; +if (pci_is_managed (pdev)) {if (exclusive ==IORESOURCE_EXCLUSIVE )return pcim_request_region_exclusive (pdev, bar, name);
drivers/pci/pci.h +16 -0
@@ -167,6 +167,22 @@ static inline void pci_wakeup_event(struct pci_dev *dev)pm_wakeup_event (&dev->dev,100 ); } +/** +* pci_bar_index_is_valid - Check whether a BAR index is within valid range +* @bar: BAR index +* +* Protects against overflowing &struct pci_dev.resource array. +* +* Return: true for valid index, false otherwise. +*/ +static inline bool pci_bar_index_is_valid (int bar) +{ +if (bar >=0 && bar <PCI_NUM_RESOURCES ) +return true; + +return false; +} +static inline bool pci_has_subordinate (struct pci_dev *pci_dev) {return !!(pci_dev->subordinate);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/449 PCI: vmd: Make vmd_dev::cfg_lock a raw_spinlock_t type
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryo Takakura <[email protected]>
[ Upstream commit 18056a48669a040bef491e63b25896561ee14d90 ]
The access to the PCI config space via pci_ops::read and pci_ops::write is a low-level hardware access. The functions can be accessed with disabled interrupts even on PREEMPT_RT. The pci_lock is a raw_spinlock_t for this purpose.
A spinlock_t becomes a sleeping lock on PREEMPT_RT, so it cannot be acquired with disabled interrupts. The vmd_dev::cfg_lock is accessed in the same context as the pci_lock.
Make vmd_dev::cfg_lock a raw_spinlock_t type so it can be used with interrupts disabled.
This was reported as:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 Call Trace: rt_spin_lock+0x4e/0x130 vmd_pci_read+0x8d/0x100 [vmd] pci_user_read_config_byte+0x6f/0xe0 pci_read_config+0xfe/0x290 sysfs_kf_bin_read+0x68/0x90
[bhelgaas: add back report info from
https://lore.kernel.org/lkml/[email protected]/]
--- drivers/pci/controller/vmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/controller/vmd.c +6 -6
@@ -125,7 +125,7 @@ struct vmd_irq_list {struct vmd_dev {struct pci_dev *dev; -spinlock_t cfg_lock; +raw_spinlock_t cfg_lock;void __iomem *cfgbar;int msix_count;
@@ -391,7 +391,7 @@ static int vmd_pci_read(struct pci_bus *bus, unsigned int devfn, int reg,if (!addr)return -EFAULT ; -spin_lock_irqsave (&vmd->cfg_lock, flags); +raw_spin_lock_irqsave (&vmd->cfg_lock, flags);switch (len) {case 1 : *value =readb (addr);
@@ -406,7 +406,7 @@ static int vmd_pci_read(struct pci_bus *bus, unsigned int devfn, int reg, ret = -EINVAL ;break ; } -spin_unlock_irqrestore (&vmd->cfg_lock, flags); +raw_spin_unlock_irqrestore (&vmd->cfg_lock, flags);return ret; }
@@ -426,7 +426,7 @@ static int vmd_pci_write(struct pci_bus *bus, unsigned int devfn, int reg,if (!addr)return -EFAULT ; -spin_lock_irqsave (&vmd->cfg_lock, flags); +raw_spin_lock_irqsave (&vmd->cfg_lock, flags);switch (len) {case 1 :writeb (value, addr);
@@ -444,7 +444,7 @@ static int vmd_pci_write(struct pci_bus *bus, unsigned int devfn, int reg, ret = -EINVAL ;break ; } -spin_unlock_irqrestore (&vmd->cfg_lock, flags); +raw_spin_unlock_irqrestore (&vmd->cfg_lock, flags);return ret; }
@@ -1009,7 +1009,7 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)if (features &VMD_FEAT_OFFSET_FIRST_VECTOR ) vmd->first_vec =1 ; -spin_lock_init (&vmd->cfg_lock); +raw_spin_lock_init (&vmd->cfg_lock);pci_set_drvdata (dev, vmd); err =vmd_enable_domain (vmd, features);if (err)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/449 drm/amdgpu: grab an additional reference on the gang fence v2
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
[ Upstream commit 0d9a95099dcb05b5f4719c830d15bf4fdcad0dc2 ]
We keep the gang submission fence around in adev, make sure that it stays alive.
v2: fix memory leak on retry
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -1
@@ -6851,18 +6851,26 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev, {struct dma_fence *old =NULL ; +dma_fence_get (gang);do {dma_fence_put (old); old =amdgpu_device_get_gang (adev);if (old == gang)break ; -if (!dma_fence_is_signaled (old)) +if (!dma_fence_is_signaled (old)) { +dma_fence_put (gang);return old; + } }while (cmpxchg ((struct dma_fence __force **)&adev->gang_submit, old, gang) != old); +/* +* Drop it once for the exchanged reference in adev and once for the +* thread local reference acquired in amdgpu_device_get_gang(). +*/ +dma_fence_put (old);dma_fence_put (old);return NULL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/449 s390/pci: Support mmap() of PCI resources except for ISM devices
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Schnelle <[email protected]>
[ Upstream commit aa9f168d55dc47c0de564f7dfe0e90467c9fee71 ]
So far s390 does not allow mmap() of PCI resources to user-space via the usual mechanisms, though it does use it for RDMA. For the PCI sysfs resource files and /proc/bus/pci it defines neither HAVE_PCI_MMAP nor ARCH_GENERIC_PCI_MMAP_RESOURCE. For vfio-pci s390 previously relied on disabled VFIO_PCI_MMAP and now relies on setting pdev->non_mappable_bars for all devices.
This is partly because access to mapped PCI resources from user-space requires special PCI load/store memory-I/O (MIO) instructions, or the special MMIO syscalls when these are not available. Still, such access is possible and useful not just for RDMA, in fact not being able to mmap() PCI resources has previously caused extra work when testing devices.
One thing that doesn't work with PCI resources mapped to user-space though is the s390 specific virtual ISM device. Not only because the BAR size of 256 TiB prevents mapping the whole BAR but also because access requires use of the legacy PCI instructions which are not accessible to user-space on systems with the newer MIO PCI instructions.
Now with the pdev->non_mappable_bars flag ISM can be excluded from mapping its resources while making this functionality available for all other PCI devices. To this end introduce a minimal implementation of PCI_QUIRKS and use that to set pdev->non_mappable_bars for ISM devices only. Then also set ARCH_GENERIC_PCI_MMAP_RESOURCE to take advantage of the generic implementation of pci_mmap_resource_range() enabling only the newer sysfs mmap() interface. This follows the recommendation in Documentation/PCI/sysfs-pci.rst.
--- arch/s390/Kconfig | 4 +--- arch/s390/include/asm/pci.h | 3 +++ arch/s390/pci/Makefile | 2 +- arch/s390/pci/pci_fixup.c | 23 +++++++++++++++++++++++ drivers/s390/net/ism_drv.c | 1 - include/linux/pci_ids.h | 1 + 6 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 arch/s390/pci/pci_fixup.c
arch/s390/Kconfig +1 -3
@@ -41,9 +41,6 @@ config AUDIT_ARCH config NO_IOPORT_MAP def_bool y -config PCI_QUIRKS - def_bool n - config ARCH_SUPPORTS_UPROBES def_bool y
@@ -258,6 +255,7 @@ config S390 select PCI_DOMAINS if PCI select PCI_MSI if PCI select PCI_MSI_ARCH_FALLBACKS if PCI_MSI + select PCI_QUIRKS if PCI select SPARSE_IRQ select SWIOTLB select SYSCTL_EXCEPTION_TRACE
arch/s390/include/asm/pci.h +3 -0
@@ -11,6 +11,9 @@#include <asm/pci_insn.h> #include <asm/sclp.h> +#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1 +#define arch_can_pci_mmap_wc () 1 +#define PCIBIOS_MIN_IO 0x1000#define PCIBIOS_MIN_MEM 0x10000000
arch/s390/pci/Makefile +1 -1
@@ -5,6 +5,6 @@ obj-$(CONFIG_PCI) += pci.o pci_irq.o pci_clp.o \ pci_event.o pci_debug.o pci_insn.o pci_mmio.o \ - pci_bus.o pci_kvm_hook.o pci_report.o + pci_bus.o pci_kvm_hook.o pci_report.o pci_fixup.o obj-$(CONFIG_PCI_IOV) += pci_iov.o obj-$(CONFIG_SYSFS) += pci_sysfs.o
arch/s390/pci/pci_fixup.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Exceptions for specific devices, +* +* Copyright IBM Corp. 2025 +* +* Author(s): +* Niklas Schnelle <[email protected]> +*/ +#include <linux/pci.h> + +static void zpci_ism_bar_no_mmap (struct pci_dev *pdev) +{ +/* +* ISM's BAR is special. Drivers written for ISM know +* how to handle this but others need to be aware of their +* special nature e.g. to prevent attempts to mmap() it. +*/ + pdev->non_mappable_bars =1 ; +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_IBM , +PCI_DEVICE_ID_IBM_ISM , + zpci_ism_bar_no_mmap);
drivers/s390/net/ism_drv.c +0 -1
@@ -20,7 +20,6 @@MODULE_DESCRIPTION ("ISM driver for s390" );MODULE_LICENSE ("GPL" ); -#define PCI_DEVICE_ID_IBM_ISM 0x04ED#define DRV_NAME "ism"static const struct pci_device_id ism_device_table[] = {
include/linux/pci_ids.h +1 -0
@@ -518,6 +518,7 @@#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM 0x0251#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 +#define PCI_DEVICE_ID_IBM_ISM 0x04ed#define PCI_SUBVENDOR_ID_IBM 0x1014#define PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT 0x03d4
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/449 fbdev: omapfb: Add plane value check
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leonid Arapov <[email protected]>
[ Upstream commit 3e411827f31db7f938a30a3c7a7599839401ec30 ]
Function dispc_ovl_setup is not intended to work with the value OMAP_DSS_WB of the enum parameter plane.
The value of this parameter is initialized in dss_init_overlays and in the current state of the code it cannot take this value so it's not a real problem.
For the purposes of defensive coding it wouldn't be superfluous to check the parameter value, because some functions down the call stack process this value correctly and some not.
For example, in dispc_ovl_setup_global_alpha it may lead to buffer overflow.
Add check for this value.
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
--- drivers/video/fbdev/omap2/omapfb/dss/dispc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/video/fbdev/omap2/omapfb/dss/dispc.c +5 -1
@@ -2738,9 +2738,13 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi, bool mem_to_mem) {int r; -enum omap_overlay_caps caps =dss_feat_get_overlay_caps (plane); +enum omap_overlay_caps caps;enum omap_channel channel; +if (plane ==OMAP_DSS_WB ) +return -EINVAL ; + + caps =dss_feat_get_overlay_caps (plane); channel =dispc_ovl_get_channel_out (plane); DSSDBG("dispc_ovl_setup %d, pa %pad, pa_uv %pad, sw %d, %d,%d, %dx%d ->"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/449 tracing: probe-events: Log error for exceeding the number of arguments
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit 57faaa04804ccbf16582f7fc7a6b986fd0c0e78c ]
Add error message when the number of arguments exceeds the limitation.
--- kernel/trace/trace_eprobe.c | 2 ++ kernel/trace/trace_fprobe.c | 5 ++++- kernel/trace/trace_kprobe.c | 5 ++++- kernel/trace/trace_probe.h | 1 + kernel/trace/trace_uprobe.c | 9 +++++++-- 5 files changed, 18 insertions(+), 4 deletions(-)
kernel/trace/trace_eprobe.c +2 -0
@@ -913,6 +913,8 @@ static int __trace_eprobe_create(int argc, const char *argv[]) }if (argc -2 >MAX_TRACE_ARGS ) { +trace_probe_log_set_index (2 ); +trace_probe_log_err (0 ,TOO_MANY_ARGS ); ret = -E2BIG ; goto error; }
kernel/trace/trace_fprobe.c +4 -1
@@ -1199,8 +1199,11 @@ static int trace_fprobe_create_internal(int argc, const char *argv[], argc = new_argc; argv = new_argv; } -if (argc >MAX_TRACE_ARGS ) +if (argc >MAX_TRACE_ARGS ) { +trace_probe_log_set_index (2 ); +trace_probe_log_err (0 ,TOO_MANY_ARGS );return -E2BIG ; + } ret =traceprobe_expand_dentry_args (argc, argv, &dbuf);if (ret)
kernel/trace/trace_kprobe.c +4 -1
@@ -1007,8 +1007,11 @@ static int trace_kprobe_create_internal(int argc, const char *argv[], argc = new_argc; argv = new_argv; } -if (argc >MAX_TRACE_ARGS ) +if (argc >MAX_TRACE_ARGS ) { +trace_probe_log_set_index (2 ); +trace_probe_log_err (0 ,TOO_MANY_ARGS );return -E2BIG ; + } ret =traceprobe_expand_dentry_args (argc, argv, &dbuf);if (ret)
kernel/trace/trace_probe.h +1 -0
@@ -545,6 +545,7 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,C (BAD_BTF_TID ,"Failed to get BTF type info." ),\C (BAD_TYPE4STR ,"This type does not fit for string." ),\C (NEED_STRING_TYPE ,"$comm and immediate-string only accepts string type" ),\ +C (TOO_MANY_ARGS ,"Too many arguments are specified" ), \C (TOO_MANY_EARGS ,"Too many entry arguments specified" ), #undef C
kernel/trace/trace_uprobe.c +7 -2
@@ -562,8 +562,14 @@ static int __trace_uprobe_create(int argc, const char **argv)if (argc <2 )return -ECANCELED ; -if (argc -2 >MAX_TRACE_ARGS ) + +trace_probe_log_init ("trace_uprobe" , argc, argv); + +if (argc -2 >MAX_TRACE_ARGS ) { +trace_probe_log_set_index (2 ); +trace_probe_log_err (0 ,TOO_MANY_ARGS );return -E2BIG ; + }if (argv[0 ][1 ] ==':' ) event = &argv[0 ][2 ];
@@ -582,7 +588,6 @@ static int __trace_uprobe_create(int argc, const char **argv)return -ECANCELED ; } -trace_probe_log_init ("trace_uprobe" , argc, argv);trace_probe_log_set_index (1 );/* filename is the 2nd argument */ *arg++ ='\0' ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/449 tracing: probe-events: Add comments about entry data storing code
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit bb9c6020f4c3a07a90dc36826cb5fbe83f09efd5 ]
Add comments about entry data storing code to __store_entry_arg() and traceprobe_get_entry_data_size(). These are a bit complicated because of building the entry data storing code and scanning it.
This just add comments, no behavior change.
--- kernel/trace/trace_probe.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
kernel/trace/trace_probe.c +28 -0
@@ -770,6 +770,10 @@ static int check_prepare_btf_string_fetch(char *typename,#ifdef CONFIG_HAVE_FUNCTION_ARG_ACCESS_API +/* +* Add the entry code to store the 'argnum'th parameter and return the offset +* in the entry data buffer where the data will be stored. +*/ static int __store_entry_arg (struct trace_probe *tp,int argnum) {struct probe_entry_arg *earg = tp->entry_arg;
@@ -793,6 +797,20 @@ static int __store_entry_arg(struct trace_probe *tp, int argnum) tp->entry_arg = earg; } +/* +* The entry code array is repeating the pair of +* [FETCH_OP_ARG(argnum)][FETCH_OP_ST_EDATA(offset of entry data buffer)] +* and the rest of entries are filled with [FETCH_OP_END]. +* +* To reduce the redundant function parameter fetching, we scan the entry +* code array to find the FETCH_OP_ARG which already fetches the 'argnum' +* parameter. If it doesn't match, update 'offset' to find the last +* offset. +* If we find the FETCH_OP_END without matching FETCH_OP_ARG entry, we +* will save the entry with FETCH_OP_ARG and FETCH_OP_ST_EDATA, and +* return data offset so that caller can find the data offset in the entry +* data buffer. +*/ offset =0 ;for (i =0 ; i < earg->size -1 ; i++) {switch (earg->code[i].op) {
@@ -826,6 +844,16 @@ int traceprobe_get_entry_data_size(struct trace_probe *tp)if (!earg)return 0 ; +/* +* earg->code[] array has an operation sequence which is run in +* the entry handler. +* The sequence stopped by FETCH_OP_END and each data stored in +* the entry data buffer by FETCH_OP_ST_EDATA. The FETCH_OP_ST_EDATA +* stores the data at the data buffer + its offset, and all data are +* "unsigned long" size. The offset must be increased when a data is +* stored. Thus we need to find the last FETCH_OP_ST_EDATA in the +* code array. +*/ for (i =0 ; i < earg->size; i++) {switch (earg->code[i].op) {case FETCH_OP_END :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/449 ktest: Fix Test Failures Due to Missing LOG_FILE Directories
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ayush Jain <[email protected]>
[ Upstream commit 5a1bed232781d356f842576daacc260f0d0c8d2e ]
Handle missing parent directories for LOG_FILE path to prevent test failures. If the parent directories don't exist, create them to ensure the tests proceed successfully.
--- tools/testing/ktest/ktest.pl | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/testing/ktest/ktest.pl +8 -0
@@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) { if ($opt{"CLEAR_LOG"}) { unlink $opt{"LOG_FILE"}; } + + if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) { + my $dir = $1; + if (! -d $dir) { + mkpath($dir) or die "Failed to create directories '$dir': $!"; + print "\nThe log directory $dir did not exist, so it was created.\n"; + } + } open(LOG, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}"; LOG->autoflush(1); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/449 tpm, tpm_tis: Workaround failed command reception on Infineon devices
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan McDowell <[email protected]>
[ Upstream commit de9e33df7762abbfc2a1568291f2c3a3154c6a9d ]
Some Infineon devices have a issue where the status register will get stuck with a quick REQUEST_USE / COMMAND_READY sequence. This is not simply a matter of requiring a longer timeout; the work around is to retry the command submission. Add appropriate logic to do this in the send path.
This is fixed in later firmware revisions, but those are not always available, and cannot generally be easily updated from outside a firmware environment.
Testing has been performed with a simple repeated loop of doing a TPM2_CC_GET_CAPABILITY for TPM_CAP_PROP_MANUFACTURER using the Go code at:
https://the.earth.li/~noodles/tpm-stuff/timeout-reproducer-simple.go
It can take several hours to reproduce, and several million operations.
--- drivers/char/tpm/tpm_tis_core.c | 17 ++++++++++++++--- drivers/char/tpm/tpm_tis_core.h | 1 + include/linux/tpm.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/char/tpm/tpm_tis_core.c +14 -3
@@ -464,7 +464,10 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)if (wait_for_tpm_stat (chip,TPM_STS_VALID , chip->timeout_c, &priv->int_queue, false) <0 ) { - rc = -ETIME ; +if (test_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags)) + rc = -EAGAIN ; +else + rc = -ETIME ; goto out_err; } status =tpm_tis_status (chip);
@@ -481,7 +484,10 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)if (wait_for_tpm_stat (chip,TPM_STS_VALID , chip->timeout_c, &priv->int_queue, false) <0 ) { - rc = -ETIME ; +if (test_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags)) + rc = -EAGAIN ; +else + rc = -ETIME ; goto out_err; } status =tpm_tis_status (chip);
@@ -546,9 +552,11 @@ static int tpm_tis_send_main(struct tpm_chip *chip, const u8 *buf, size_t len)if (rc >=0 )/* Data transfer done successfully */ break ; -else if (rc != -EIO ) +else if (rc != -EAGAIN && rc != -EIO )/* Data transfer failed, not recoverable */ return rc; + +usleep_range (priv->timeout_min, priv->timeout_max); }/* go and do it */
@@ -1144,6 +1152,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, priv->timeout_max =TIS_TIMEOUT_MAX_ATML ; } +if (priv->manufacturer_id ==TPM_VID_IFX ) +set_bit (TPM_TIS_STATUS_VALID_RETRY , &priv->flags); +if (is_bsw ()) { priv->ilb_base_addr =ioremap (INTEL_LEGACY_BLK_BASE_ADDR ,ILB_REMAP_SIZE );
drivers/char/tpm/tpm_tis_core.h +1 -0
@@ -89,6 +89,7 @@ enum tpm_tis_flags {TPM_TIS_INVALID_STATUS =1 ,TPM_TIS_DEFAULT_CANCELLATION =2 ,TPM_TIS_IRQ_TESTED =3 , + TPM_TIS_STATUS_VALID_RETRY = 4, }; struct tpm_tis_data {
include/linux/tpm.h +1 -0
@@ -335,6 +335,7 @@ enum tpm2_cc_attrs {#define TPM_VID_WINBOND 0x1050#define TPM_VID_STM 0x104A#define TPM_VID_ATML 0x1114 +#define TPM_VID_IFX 0x15D1enum tpm_chip_flags {TPM_CHIP_FLAG_BOOTSTRAPPED =BIT (0 ),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/449 tpm: End any active auth session before shutdown
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan McDowell <[email protected]>
[ Upstream commit 1dbf74e00a5f882b04b398399b6def65cd51ef21 ]
Lazy flushing of TPM auth sessions can interact badly with IMA + kexec, resulting in loaded session handles being leaked across the kexec and not cleaned up. Fix by ensuring any active auth session is ended before the TPM is told about the shutdown, matching what is done when suspending.
Before:
root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session root@debian-qemu-efi:~# tpm2_getcap handles-saved-session root@debian-qemu-efi:~# kexec --load --kexec-file-syscall … root@debian-qemu-efi:~# systemctl kexec … root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session - 0x2000000 root@debian-qemu-efi:~# tpm2_getcap handles-saved-session root@debian-qemu-efi:~# (repeat kexec steps) root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session - 0x2000000 - 0x2000001 root@debian-qemu-efi:~# tpm2_getcap handles-saved-session root@debian-qemu-efi:~#
After:
root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session root@debian-qemu-efi:~# tpm2_getcap handles-saved-session root@debian-qemu-efi:~# kexec --load --kexec-file-syscall … root@debian-qemu-efi:~# systemctl kexec … root@debian-qemu-efi:~# tpm2_getcap handles-loaded-session root@debian-qemu-efi:~# tpm2_getcap handles-saved-session root@debian-qemu-efi:~#
--- drivers/char/tpm/tpm-chip.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/tpm/tpm-chip.c +1 -0
@@ -300,6 +300,7 @@ int tpm_class_shutdown(struct device *dev)down_write (&chip->ops_sem);if (chip->flags &TPM_CHIP_FLAG_TPM2 ) {if (!tpm_chip_start (chip)) { +tpm2_end_auth_session (chip);tpm2_shutdown (chip,TPM2_SU_CLEAR );tpm_chip_stop (chip); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/449 pwm: mediatek: Prevent divide-by-zero in pwm_mediatek_config()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
[ Upstream commit 7ca59947b5fcf94e7ea4029d1bd0f7c41500a161 ]
With CONFIG_COMPILE_TEST && !CONFIG_HAVE_CLK, pwm_mediatek_config() has a divide-by-zero in the following line:
do_div(resolution, clk_get_rate(pc->clk_pwms[pwm->hwpwm]));
due to the fact that the !CONFIG_HAVE_CLK version of clk_get_rate() returns zero.
This is presumably just a theoretical problem: COMPILE_TEST overrides the dependency on RALINK which would select COMMON_CLK. Regardless it's a good idea to check for the error explicitly to avoid divide-by-zero.
Fixes the following warning:
drivers/pwm/pwm-mediatek.o: warning: objtool: .text: unexpected end of section
--- drivers/pwm/pwm-mediatek.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pwm/pwm-mediatek.c +6 -2
@@ -121,21 +121,25 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,struct pwm_mediatek_chip *pc =to_pwm_mediatek_chip (chip);u32 clkdiv =0 , cnt_period, cnt_duty, reg_width =PWMDWIDTH , reg_thres =PWMTHRES ; +unsigned long clk_rate;u64 resolution;int ret; ret =pwm_mediatek_clk_enable (chip, pwm); -if (ret <0 )return ret; + clk_rate =clk_get_rate (pc->clk_pwms[pwm->hwpwm]); +if (!clk_rate) +return -EINVAL ; +/* Make sure we use the bus clock and not the 26MHz clock */ if (pc->soc->has_ck_26m_sel)writel (0 , pc->regs +PWM_CK_26M_SEL );/* Using resolution in picosecond gets accuracy higher */ resolution = (u64 )NSEC_PER_SEC *1000 ; -do_div (resolution,clk_get_rate (pc->clk_pwms[pwm->hwpwm])); +do_div (resolution, clk_rate); cnt_period =DIV_ROUND_CLOSEST_ULL ((u64 )period_ns *1000 , resolution);while (cnt_period >8191 ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/449 pwm: rcar: Improve register calculation
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit e7327c193014a4d8666e9c1cda09cf2c060518e8 ]
There were several issues in the function rcar_pwm_set_counter():
- The u64 values period_ns and duty_ns were cast to int on function call which might loose bits on 32 bit architectures.
Fix: Make parameters to rcar_pwm_set_counter() u64
- The algorithm divided by the result of a division which looses precision.
Fix: Make use of mul_u64_u64_div_u64()
- The calculated values were just masked to fit the respective register fields which again might loose bits.
Fix: Explicitly check for overlow
Implement the respective fixes.
A side effect of fixing the 2nd issue is that there is no division by 0 if clk_get_rate() returns 0.
[ukleinek: Added an explicit #include <linux/bitfield.h> to please the 0day build bot]
--- drivers/pwm/pwm-rcar.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/pwm/pwm-rcar.c +13 -11
@@ -8,6 +8,7 @@* - The hardware cannot generate a 0% duty cycle. */ +#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/io.h>
@@ -102,23 +103,24 @@ static void rcar_pwm_set_clock_control(struct rcar_pwm_chip *rp,rcar_pwm_write (rp, value,RCAR_PWMCR ); } -static int rcar_pwm_set_counter (struct rcar_pwm_chip *rp,int div,int duty_ns, -int period_ns) +static int rcar_pwm_set_counter (struct rcar_pwm_chip *rp,int div,u64 duty_ns, +u64 period_ns) { -unsigned long long one_cycle, tmp;/* 0.01 nanoseconds */ +unsigned long long tmp;unsigned long clk_rate =clk_get_rate (rp->clk);u32 cyc, ph; - one_cycle =NSEC_PER_SEC *100ULL << div; -do_div (one_cycle, clk_rate); +/* div <= 24 == RCAR_PWM_MAX_DIVISION, so the shift doesn't overflow. */ + tmp =mul_u64_u64_div_u64 (period_ns, clk_rate, (u64 )NSEC_PER_SEC << div); +if (tmp >FIELD_MAX (RCAR_PWMCNT_CYC0_MASK )) + tmp =FIELD_MAX (RCAR_PWMCNT_CYC0_MASK ); - tmp = period_ns *100ULL ; -do_div (tmp, one_cycle); - cyc = (tmp <<RCAR_PWMCNT_CYC0_SHIFT ) &RCAR_PWMCNT_CYC0_MASK ; + cyc =FIELD_PREP (RCAR_PWMCNT_CYC0_MASK , tmp); - tmp = duty_ns *100ULL ; -do_div (tmp, one_cycle); - ph = tmp &RCAR_PWMCNT_PH0_MASK ; + tmp =mul_u64_u64_div_u64 (duty_ns, clk_rate, (u64 )NSEC_PER_SEC << div); +if (tmp >FIELD_MAX (RCAR_PWMCNT_PH0_MASK )) + tmp =FIELD_MAX (RCAR_PWMCNT_PH0_MASK ); + ph =FIELD_PREP (RCAR_PWMCNT_PH0_MASK , tmp);/* Avoid prohibited setting */ if (cyc ==0 || ph ==0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/449 pwm: fsl-ftm: Handle clk_get_rate() returning 0
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 928446a5302eee30ebb32075c0db5dda5a138fb7 ]
Considering that the driver doesn't enable the used clocks (and also that clk_get_rate() returns 0 if CONFIG_HAVE_CLK is unset) better check the return value of clk_get_rate() for being non-zero before dividing by it.
--- drivers/pwm/pwm-fsl-ftm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/pwm/pwm-fsl-ftm.c +6 -0
@@ -118,6 +118,9 @@ static unsigned int fsl_pwm_ticks_to_ns(struct fsl_pwm_chip *fpc,unsigned long long exval; rate =clk_get_rate (fpc->clk[fpc->period.clk_select]); +if (rate >> fpc->period.clk_ps ==0 ) +return 0 ; + exval = ticks; exval *=1000000000UL ;do_div (exval, rate >> fpc->period.clk_ps);
@@ -190,6 +193,9 @@ static unsigned int fsl_pwm_calculate_duty(struct fsl_pwm_chip *fpc,unsigned int period = fpc->period.mod_period +1 ;unsigned int period_ns =fsl_pwm_ticks_to_ns (fpc, period); +if (!period_ns) +return 0 ; + duty = (unsigned long long )duty_ns * period;do_div (duty, period_ns);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/449 pwm: stm32: Search an appropriate duty_cycle if period cannot be modified
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit fda6e0034e9da64e1cec31f4539b6c7abd9ed8be ]
If another channel is already enabled period must not be modified. If the requested period is smaller than this unchangable period the driver is still supposed to search a duty_cycle according to the usual rounding rules.
So don't set the duty_cycle to 0 but continue to determine an appropriate value for ccr.
--- drivers/pwm/pwm-stm32.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/pwm/pwm-stm32.c +3 -9
@@ -103,22 +103,16 @@ static int stm32_pwm_round_waveform_tohw(struct pwm_chip *chip,if (ret) goto out; -/* -* calculate the best value for ARR for the given PSC, refuse if -* the resulting period gets bigger than the requested one. -*/ arr =mul_u64_u64_div_u64 (wf->period_length_ns, rate, (u64 )NSEC_PER_SEC * (wfhw->psc +1 ));if (arr <= wfhw->arr) {/* -* requested period is small than the currently +* requested period is smaller than the currently * configured and unchangable period, report back the smallest -* possible period, i.e. the current state; Initialize -* ccr to anything valid. +* possible period, i.e. the current state and return 1 +* to indicate the wrong rounding direction. */ - wfhw->ccr =0 ; ret =1 ; - goto out; } }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/449 erofs: set error to bio if file-backed IO fails
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sheng Yong <[email protected]>
[ Upstream commit 1595f15391b81815e4ef91c339991913d556c1b6 ]
If a file-backed IO fails before submitting the bio to the lower filesystem, an error is returned, but the bio->bi_status is not marked as an error. However, the error information should be passed to the end_io handler. Otherwise, the IO request will be treated as successful.
--- fs/erofs/fileio.c | 2 ++ 1 file changed, 2 insertions(+)
fs/erofs/fileio.c +2 -0
@@ -32,6 +32,8 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret) ret =0 ; }if (rq->bio.bi_end_io) { +if (ret <0 && !rq->bio.bi_status) + rq->bio.bi_status =errno_to_blk_status (ret); rq->bio.bi_end_io (&rq->bio); }else {bio_for_each_folio_all (fi, &rq->bio) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/449 bpf: support SKF_NET_OFF and SKF_LL_OFF on skb frags
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit d4bac0288a2b444e468e6df9cb4ed69479ddf14a ]
Classic BPF socket filters with SKB_NET_OFF and SKB_LL_OFF fail to read when these offsets extend into frags.
This has been observed with iwlwifi and reproduced with tun with IFF_NAPI_FRAGS. The below straightforward socket filter on UDP port, applied to a RAW socket, will silently miss matching packets.
const int offset_proto = offsetof(struct ip6_hdr, ip6_nxt);
const int offset_dport = sizeof(struct ip6_hdr) + offsetof(struct udphdr, dest);
struct sock_filter filter_code[] = {
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_AD_OFF + SKF_AD_PKTTYPE),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, PACKET_HOST, 0, 4),
BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_NET_OFF + offset_proto),
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 2),
BPF_STMT(BPF_LD + BPF_H + BPF_ABS, SKF_NET_OFF + offset_dport),This is unexpected behavior. Socket filter programs should be consistent regardless of environment. Silent misses are particularly concerning as hard to detect.
Use skb_copy_bits for offsets outside linear, same as done for non-SKF_(LL|NET) offsets.
Offset is always positive after subtracting the reference threshold SKB_(LL|NET)_OFF, so is always >= skb_(mac|network)_offset. The sum of the two is an offset against skb->data, and may be negative, but it cannot point before skb->head, as skb_(mac|network)_offset would too.
This appears to go back to when frag support was introduced to sk_run_filter in linux-2.4.4, before the introduction of git.
The amount of code change and 8/16/32 bit duplication are unfortunate. But any attempt I made to be smarter saved very few LoC while complicating the code.
--- net/core/filter.c | 80 ++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 36 deletions(-)
net/core/filter.c +44 -36
@@ -218,24 +218,36 @@ BPF_CALL_3(bpf_skb_get_nlattr_nest, struct sk_buff *, skb, u32, a, u32, x)return 0 ; } +static int bpf_skb_load_helper_convert_offset (const struct sk_buff *skb,int offset) +{ +if (likely (offset >=0 )) +return offset; + +if (offset >=SKF_NET_OFF ) +return offset -SKF_NET_OFF +skb_network_offset (skb); + +if (offset >=SKF_LL_OFF &&skb_mac_header_was_set (skb)) +return offset -SKF_LL_OFF +skb_mac_offset (skb); + +return INT_MIN ; +} + BPF_CALL_4(bpf_skb_load_helper_8, const struct sk_buff *, skb, const void *, data, int, headlen, int, offset) { -u8 tmp, *ptr; +u8 tmp;const int len =sizeof (tmp); -if (offset >=0 ) { -if (headlen - offset >= len) -return *(u8 *)(data + offset); -if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) -return tmp; - }else { - ptr =bpf_internal_load_pointer_neg_helper (skb, offset, len); -if (likely (ptr)) -return *(u8 *)ptr; - } + offset =bpf_skb_load_helper_convert_offset (skb, offset); +if (offset ==INT_MIN ) +return -EFAULT ; -return -EFAULT ; +if (headlen - offset >= len) +return *(u8 *)(data + offset); +if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) +return tmp; +else +return -EFAULT ; } BPF_CALL_2(bpf_skb_load_helper_8_no_cache, const struct sk_buff *, skb,
@@ -248,21 +260,19 @@ BPF_CALL_2(bpf_skb_load_helper_8_no_cache, const struct sk_buff *, skb, BPF_CALL_4(bpf_skb_load_helper_16, const struct sk_buff *, skb, const void *, data, int, headlen, int, offset) { -__be16 tmp, *ptr; +__be16 tmp;const int len =sizeof (tmp); -if (offset >=0 ) { -if (headlen - offset >= len) -return get_unaligned_be16 (data + offset); -if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) -return be16_to_cpu (tmp); - }else { - ptr =bpf_internal_load_pointer_neg_helper (skb, offset, len); -if (likely (ptr)) -return get_unaligned_be16 (ptr); - } + offset =bpf_skb_load_helper_convert_offset (skb, offset); +if (offset ==INT_MIN ) +return -EFAULT ; -return -EFAULT ; +if (headlen - offset >= len) +return get_unaligned_be16 (data + offset); +if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) +return be16_to_cpu (tmp); +else +return -EFAULT ; } BPF_CALL_2(bpf_skb_load_helper_16_no_cache, const struct sk_buff *, skb,
@@ -275,21 +285,19 @@ BPF_CALL_2(bpf_skb_load_helper_16_no_cache, const struct sk_buff *, skb, BPF_CALL_4(bpf_skb_load_helper_32, const struct sk_buff *, skb, const void *, data, int, headlen, int, offset) { -__be32 tmp, *ptr; +__be32 tmp;const int len =sizeof (tmp); -if (likely (offset >=0 )) { -if (headlen - offset >= len) -return get_unaligned_be32 (data + offset); -if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) -return be32_to_cpu (tmp); - }else { - ptr =bpf_internal_load_pointer_neg_helper (skb, offset, len); -if (likely (ptr)) -return get_unaligned_be32 (ptr); - } + offset =bpf_skb_load_helper_convert_offset (skb, offset); +if (offset ==INT_MIN ) +return -EFAULT ; -return -EFAULT ; +if (headlen - offset >= len) +return get_unaligned_be32 (data + offset); +if (!skb_copy_bits (skb, offset, &tmp,sizeof (tmp))) +return be32_to_cpu (tmp); +else +return -EFAULT ; } BPF_CALL_2(bpf_skb_load_helper_32_no_cache, const struct sk_buff *, skb,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/449 ext4: dont treat fhandle lookup of ea_inode as FS corruption
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
[ Upstream commit 642335f3ea2b3fd6dba03e57e01fa9587843a497 ]
A file handle that userspace provides to open_by_handle_at() can legitimately contain an outdated inode number that has since been reused for another purpose - that's why the file handle also contains a generation number.
But if the inode number has been reused for an ea_inode, check_igot_inode() will notice, __ext4_iget() will go through ext4_error_inode(), and if the inode was newly created, it will also be marked as bad by iget_failed(). This all happens before the point where the inode generation is checked.
ext4_error_inode() is supposed to only be used on filesystem corruption; it should not be used when userspace just got unlucky with a stale file handle. So when this happens, let __ext4_iget() just return an error.
--- fs/ext4/inode.c | 68 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 20 deletions(-)
fs/ext4/inode.c +48 -20
@@ -4710,22 +4710,43 @@ static inline void ext4_inode_set_iversion_queried(struct inode *inode, u64 val)inode_set_iversion_queried (inode, val); } -static const char *check_igot_inode (struct inode *inode,ext4_iget_flags flags) - +static int check_igot_inode (struct inode *inode,ext4_iget_flags flags, +const char *function,unsigned int line) { +const char *err_str; +if (flags &EXT4_IGET_EA_INODE ) { -if (!(EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL )) -return "missing EA_INODE flag" ; +if (!(EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL )) { + err_str ="missing EA_INODE flag" ; + goto error; + }if (ext4_test_inode_state (inode,EXT4_STATE_XATTR ) || -EXT4_I (inode)->i_file_acl) -return "ea_inode with extended attributes" ; +EXT4_I (inode)->i_file_acl) { + err_str ="ea_inode with extended attributes" ; + goto error; + } }else { -if ((EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL )) -return "unexpected EA_INODE flag" ; +if ((EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL )) { +/* +* open_by_handle_at() could provide an old inode number +* that has since been reused for an ea_inode; this does +* not indicate filesystem corruption +*/ +if (flags &EXT4_IGET_HANDLE ) +return -ESTALE ; + err_str ="unexpected EA_INODE flag" ; + goto error; + } + } +if (is_bad_inode (inode) && !(flags &EXT4_IGET_BAD )) { + err_str ="unexpected bad inode w/o EXT4_IGET_BAD" ; + goto error; } -if (is_bad_inode (inode) && !(flags &EXT4_IGET_BAD )) -return "unexpected bad inode w/o EXT4_IGET_BAD" ; -return NULL ; +return 0 ; + +error: +ext4_error_inode (inode, function, line,0 , err_str); +return -EFSCORRUPTED ; } struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
@@ -4737,7 +4758,6 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,struct ext4_inode_info *ei;struct ext4_super_block *es =EXT4_SB (sb)->s_es;struct inode *inode; -const char *err_str;journal_t *journal =EXT4_SB (sb)->s_journal;long ret;loff_t size;
@@ -4766,10 +4786,10 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,if (!inode)return ERR_PTR (-ENOMEM );if (!(inode->i_state &I_NEW )) { -if ((err_str =check_igot_inode (inode, flags)) !=NULL ) { -ext4_error_inode (inode, function, line,0 , err_str); + ret =check_igot_inode (inode, flags, function, line); +if (ret) {iput (inode); -return ERR_PTR (-EFSCORRUPTED ); +return ERR_PTR (ret); }return inode; }
@@ -5050,13 +5070,21 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, ret = -EFSCORRUPTED ; goto bad_inode; } -if ((err_str =check_igot_inode (inode, flags)) !=NULL ) { -ext4_error_inode (inode, function, line,0 , err_str); - ret = -EFSCORRUPTED ; - goto bad_inode; + ret =check_igot_inode (inode, flags, function, line); +/* +* -ESTALE here means there is nothing inherently wrong with the inode, +* it's just not an inode we can return for an fhandle lookup. +*/ +if (ret == -ESTALE ) { +brelse (iloc.bh); +unlock_new_inode (inode); +iput (inode); +return ERR_PTR (-ESTALE ); } - +if (ret) + goto bad_inode;brelse (iloc.bh); +unlock_new_inode (inode);return inode;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/449 s390/pci: Fix s390_mmio_read/write syscall page fault handling
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Schnelle <[email protected]>
[ Upstream commit 41a0926e82f4963046876ed9a1b5f681be8087a8 ]
The s390 MMIO syscalls when using the classic PCI instructions do not cause a page fault when follow_pfnmap_start() fails due to the page not being present. Besides being a general deficiency this breaks vfio-pci's mmap() handling once VFIO_PCI_MMAP gets enabled as this lazily maps on first access. Fix this by following a failed follow_pfnmap_start() with fixup_user_page() and retrying the follow_pfnmap_start(). Also fix a VM_READ vs VM_WRITE mixup in the read syscall.
--- arch/s390/pci/pci_mmio.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
arch/s390/pci/pci_mmio.c +13 -5
@@ -175,8 +175,12 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr, args.address = mmio_addr; args.vma = vma; ret =follow_pfnmap_start (&args); -if (ret) - goto out_unlock_mmap; +if (ret) { +fixup_user_fault (current->mm, mmio_addr,FAULT_FLAG_WRITE ,NULL ); + ret =follow_pfnmap_start (&args); +if (ret) + goto out_unlock_mmap; + } io_addr = (void __iomem *)((args.pfn <<PAGE_SHIFT ) | (mmio_addr & ~PAGE_MASK ));
@@ -315,14 +319,18 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,if (!(vma->vm_flags & (VM_IO |VM_PFNMAP ))) goto out_unlock_mmap; ret = -EACCES ; -if (!(vma->vm_flags &VM_WRITE )) +if (!(vma->vm_flags &VM_READ )) goto out_unlock_mmap; args.vma = vma; args.address = mmio_addr; ret =follow_pfnmap_start (&args); -if (ret) - goto out_unlock_mmap; +if (ret) { +fixup_user_fault (current->mm, mmio_addr,0 ,NULL ); + ret =follow_pfnmap_start (&args); +if (ret) + goto out_unlock_mmap; + } io_addr = (void __iomem *)((args.pfn <<PAGE_SHIFT ) | (mmio_addr & ~PAGE_MASK ));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/449 HID: pidff: Clamp PERIODIC effect period to devices logical range
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit f538183e997a9fb6087e94e71e372de967b9e56a ]
This ensures the effect can actually be played on the connected force feedback device. Adds clamping functions used instead of rescaling, as we don't want to change the characteristics of the periodic effects.
Fixes edge cases found on Moza Racing and some other hardware where the effects would not play if the period is outside the defined logical range.
Changes in v6:
- Use in-kernel clamp macro instead of a custom solution
--- drivers/hid/usbhid/hid-pidff.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/hid/usbhid/hid-pidff.c +16 -3
@@ -15,10 +15,9 @@#include <linux/input.h> #include <linux/slab.h> #include <linux/usb.h> -#include <linux/hid.h> +#include <linux/minmax.h> -#include "usbhid.h" #define PID_EFFECTS_MAX 64#define PID_INFINITE 0xffff
@@ -192,6 +191,16 @@ struct pidff_device {u32 quirks; }; +/* +* Clamp value for a given field +*/ +static s32 pidff_clamp (s32 i,struct hid_field *field) +{ +s32 clamped =clamp (i, field->logical_minimum, field->logical_maximum); +pr_debug ("clamped from %d to %d" , i, clamped); +return clamped; +} +/* * Scale an unsigned value with range 0..max for the given field */
@@ -372,7 +381,11 @@ static void pidff_set_periodic_report(struct pidff_device *pidff,pidff_set_signed (&pidff->set_periodic[PID_OFFSET ], effect->u.periodic.offset);pidff_set (&pidff->set_periodic[PID_PHASE ], effect->u.periodic.phase); - pidff->set_periodic[PID_PERIOD ].value[0 ] = effect->u.periodic.period; + +/* Clamp period to ensure the device can play the effect */ + pidff->set_periodic[PID_PERIOD ].value[0 ] = +pidff_clamp (effect->u.periodic.period, + pidff->set_periodic[PID_PERIOD ].field);hid_hw_request (pidff->hid, pidff->reports[PID_SET_PERIODIC ],HID_REQ_SET_REPORT );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/449 HID: pidff: Stop all effects before enabling actuators
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit ce52c0c939fcb568d1abe454821d5623de38b424 ]
Some PID compliant devices automatically play effects after boot (i.e. autocenter spring) that prevent the rendering of other effects since it is done outside the kernel driver.
This makes sure all the effects currently played are stopped after resetting the device.
It brings compatibility to the Brunner CLS-P joystick and others
--- drivers/hid/usbhid/hid-pidff.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/hid/usbhid/hid-pidff.c +7 -2
@@ -109,8 +109,9 @@ static const u8 pidff_pool[] = { 0x80, 0x83, 0xa9 };/* Special field key tables used to put special field keys into arrays */ #define PID_ENABLE_ACTUATORS 0 -#define PID_RESET 1 -static const u8 pidff_device_control[] = {0x97 ,0x9a }; +#define PID_STOP_ALL_EFFECTS 1 +#define PID_RESET 2 +static const u8 pidff_device_control[] = {0x97 ,0x99 ,0x9a };#define PID_CONSTANT 0#define PID_RAMP 1
@@ -1235,6 +1236,10 @@ static void pidff_reset(struct pidff_device *pidff)hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT );hid_hw_wait (hid); + pidff->device_control->value[0 ] = pidff->control_id[PID_STOP_ALL_EFFECTS ]; +hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); +hid_hw_wait (hid); + pidff->device_control->value[0 ] = pidff->control_id[PID_ENABLE_ACTUATORS ];hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT );
Signature · 1 line
2.39.5
A message that is not in the archive (sent off-list or not yet received): [email protected]
Greg Kroah-Hartman
maintainerRe: [PATCH 6.14 197/449] HID: pidff: Stop all effects before enabling actuators
Quoted 3 lines · Jules Noirant
Hi,
Thanks for the review. Technically, that patch should at least be Co-authored by me since it's a slightly reworded rebase of a patch I submitted last year: https://lore.kernel.org/lkml/[email protected]/t/
This is just a copy of what went into Linus's tree, sorry.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 198/449 HID: pidff: Completely rework and fix pidff_reset function
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit cb3fd788e3fa5358602a49809c4eb4911539c9d0 ]
Previously, it was assumed that DEVICE_CONTROL usage is always an array but a lot of devices implements it as a bitmask variable. This led to the pidff_reset function not working and causing errors in such cases.
Selectors can come in three types. One selection of a set, N selections and Any selection in form of bitmask as from USB Hid Usage Tables v1.5, subsection 3.4.2.1
Added pidff_send_device_control which handles usage flag check which decides whether DEVICE_CONTROL should be handled as "One selection of a set" or "Any selection of a set".
Reset was triggered once, on device initialization. Now, it's triggered every time when uploading an effect to an empty device (no currently stored effects), tracked by pidff->effect_count variable.
--- drivers/hid/usbhid/hid-pidff.c | 138 +++++++++++++++++++++------------ 1 file changed, 89 insertions(+), 49 deletions(-)
drivers/hid/usbhid/hid-pidff.c +89 -49
@@ -109,9 +109,10 @@ static const u8 pidff_pool[] = { 0x80, 0x83, 0xa9 };/* Special field key tables used to put special field keys into arrays */ #define PID_ENABLE_ACTUATORS 0 -#define PID_STOP_ALL_EFFECTS 1 -#define PID_RESET 2 -static const u8 pidff_device_control[] = {0x97 ,0x99 ,0x9a }; +#define PID_DISABLE_ACTUATORS 1 +#define PID_STOP_ALL_EFFECTS 2 +#define PID_RESET 3 +static const u8 pidff_device_control[] = {0x97 ,0x98 ,0x99 ,0x9a };#define PID_CONSTANT 0#define PID_RAMP 1
@@ -190,6 +191,7 @@ struct pidff_device {int pid_id[PID_EFFECTS_MAX ];u32 quirks; +u8 effect_count; };/*
@@ -490,9 +492,83 @@ static int pidff_needs_set_ramp(struct ff_effect *effect, struct ff_effect *old) effect->u.ramp.end_level != old->u.ramp.end_level; } +/* +* Clear device control report +*/ +static void pidff_send_device_control (struct pidff_device *pidff,int field) +{ +int i, tmp; +int field_index = pidff->control_id[field]; + +/* Detect if the field is a bitmask variable or an array */ +if (pidff->device_control->flags &HID_MAIN_ITEM_VARIABLE ) { +hid_dbg (pidff->hid,"DEVICE_CONTROL is a bitmask\n" ); +/* Clear current bitmask */ +for (i =0 ; i <sizeof (pidff_device_control); i++) { + tmp = pidff->control_id[i]; + pidff->device_control->value[tmp] =0 ; + } + pidff->device_control->value[field_index -1 ] =1 ; + }else { +hid_dbg (pidff->hid,"DEVICE_CONTROL is an array\n" ); + pidff->device_control->value[0 ] = field_index; + } + +hid_hw_request (pidff->hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); +hid_hw_wait (pidff->hid); +} + +/* +* Modify actuators state +*/ +static void pidff_modify_actuators_state (struct pidff_device *pidff,bool enable) +{ +hid_dbg (pidff->hid,"%s actuators\n" , enable ?"Enable" :"Disable" ); +pidff_send_device_control (pidff, + enable ?PID_ENABLE_ACTUATORS :PID_DISABLE_ACTUATORS ); +} + +/* +* Reset the device, stop all effects, enable actuators +* Refetch pool report +*/ +static void pidff_reset (struct pidff_device *pidff) +{ +int i =0 ; + +/* We reset twice as sometimes hid_wait_io isn't waiting long enough */ +pidff_send_device_control (pidff,PID_RESET ); +pidff_send_device_control (pidff,PID_RESET ); + pidff->effect_count =0 ; + +pidff_send_device_control (pidff,PID_STOP_ALL_EFFECTS ); +pidff_modify_actuators_state (pidff,1 ); + +/* pool report is sometimes messed up, refetch it */ +hid_hw_request (pidff->hid, pidff->reports[PID_POOL ],HID_REQ_GET_REPORT ); +hid_hw_wait (pidff->hid); + +if (pidff->pool[PID_SIMULTANEOUS_MAX ].value) { +while (pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ] <2 ) { +if (i++ >20 ) { +hid_warn (pidff->hid, +"device reports %d simultaneous effects\n" , + pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ]); +break ; + } +hid_dbg (pidff->hid,"pid_pool requested again\n" ); +hid_hw_request (pidff->hid, pidff->reports[PID_POOL ], +HID_REQ_GET_REPORT ); +hid_hw_wait (pidff->hid); + } + } +} +/* * Send a request for effect upload to the device * +* Reset and enable actuators if no effects were present on the device +* * Returns 0 if device reported success, -ENOSPC if the device reported memory * is full. Upon unknown response the function will retry for 60 times, if * still unsuccessful -EIO is returned.
@@ -501,6 +577,9 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) {int j; +if (!pidff->effect_count) +pidff_reset (pidff); + pidff->create_new_effect_type->value[0 ] = efnum;hid_hw_request (pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT ],HID_REQ_SET_REPORT );
@@ -520,6 +599,8 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum)hid_dbg (pidff->hid,"device reported free memory: %d bytes\n" , pidff->block_load[PID_RAM_POOL_AVAILABLE ].value ? pidff->block_load[PID_RAM_POOL_AVAILABLE ].value[0 ] :-1 ); + + pidff->effect_count++;return 0 ; } if (pidff->block_load_status->value[0] ==
@@ -568,12 +649,16 @@ static int pidff_playback(struct input_dev *dev, int effect_id, int value)/* * Erase effect with PID id +* Decrease the device effect counter */ static void pidff_erase_pid (struct pidff_device *pidff,int pid_id) { pidff->block_free[PID_EFFECT_BLOCK_INDEX ].value[0 ] = pid_id;hid_hw_request (pidff->hid, pidff->reports[PID_BLOCK_FREE ],HID_REQ_SET_REPORT ); + +if (pidff->effect_count >0 ) + pidff->effect_count--; }/*
@@ -1221,50 +1306,6 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)return 0 ; } -/* -* Reset the device -*/ -static void pidff_reset (struct pidff_device *pidff) -{ -struct hid_device *hid = pidff->hid; -int i =0 ; - - pidff->device_control->value[0 ] = pidff->control_id[PID_RESET ]; -/* We reset twice as sometimes hid_wait_io isn't waiting long enough */ -hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); -hid_hw_wait (hid); -hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); -hid_hw_wait (hid); - - pidff->device_control->value[0 ] = pidff->control_id[PID_STOP_ALL_EFFECTS ]; -hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); -hid_hw_wait (hid); - - pidff->device_control->value[0 ] = - pidff->control_id[PID_ENABLE_ACTUATORS ]; -hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); -hid_hw_wait (hid); - -/* pool report is sometimes messed up, refetch it */ -hid_hw_request (hid, pidff->reports[PID_POOL ],HID_REQ_GET_REPORT ); -hid_hw_wait (hid); - -if (pidff->pool[PID_SIMULTANEOUS_MAX ].value) { -while (pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ] <2 ) { -if (i++ >20 ) { -hid_warn (pidff->hid, -"device reports %d simultaneous effects\n" , - pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ]); -break ; - } -hid_dbg (pidff->hid,"pid_pool requested again\n" ); -hid_hw_request (hid, pidff->reports[PID_POOL ], -HID_REQ_GET_REPORT ); -hid_hw_wait (hid); - } - } -} -/* * Test if autocenter modification is using the supported method */
@@ -1330,6 +1371,7 @@ int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks) pidff->hid = hid; pidff->quirks = initial_quirks; + pidff->effect_count =0 ;hid_device_io_start (hid);
@@ -1346,8 +1388,6 @@ int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks)if (error) goto fail; -pidff_reset (pidff); -if (test_bit (FF_GAIN , dev->ffbit)) {pidff_set (&pidff->device_gain[PID_DEVICE_GAIN_FIELD ],0xffff ); hid_hw_request(hid, pidff->reports[PID_DEVICE_GAIN],
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/449 HID: pidff: Simplify pidff_upload_effect function
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit e4bdc80ef14272ef56c38d8ca2f365fdf59cd0ba ]
Merge a bit of code that reqeusts conditional effects upload. Makes it clear, that effect handling should be identical for SPRING, DAMPER, INERTIA and FRICTION.
--- drivers/hid/usbhid/hid-pidff.c | 54 ++++++++++------------------------ 1 file changed, 16 insertions(+), 38 deletions(-)
drivers/hid/usbhid/hid-pidff.c +16 -38
@@ -770,48 +770,26 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,break ;case FF_SPRING : -if (!old) { - error =pidff_request_effect_upload (pidff, - pidff->type_id[PID_SPRING ]); -if (error) -return error; - } -if (!old ||pidff_needs_set_effect (effect, old)) -pidff_set_effect_report (pidff, effect); -if (!old ||pidff_needs_set_condition (effect, old)) -pidff_set_condition_report (pidff, effect); -break ; - -case FF_FRICTION : -if (!old) { - error =pidff_request_effect_upload (pidff, - pidff->type_id[PID_FRICTION ]); -if (error) -return error; - } -if (!old ||pidff_needs_set_effect (effect, old)) -pidff_set_effect_report (pidff, effect); -if (!old ||pidff_needs_set_condition (effect, old)) -pidff_set_condition_report (pidff, effect); -break ; -case FF_DAMPER : -if (!old) { - error =pidff_request_effect_upload (pidff, - pidff->type_id[PID_DAMPER ]); -if (error) -return error; - } -if (!old ||pidff_needs_set_effect (effect, old)) -pidff_set_effect_report (pidff, effect); -if (!old ||pidff_needs_set_condition (effect, old)) -pidff_set_condition_report (pidff, effect); -break ; -case FF_INERTIA : +case FF_FRICTION :if (!old) { +switch (effect->type) { +case FF_SPRING : + type_id =PID_SPRING ; +break ; +case FF_DAMPER : + type_id =PID_DAMPER ; +break ; +case FF_INERTIA : + type_id =PID_INERTIA ; +break ; +case FF_FRICTION : + type_id =PID_FRICTION ; +break ; + } error =pidff_request_effect_upload (pidff, - pidff->type_id[PID_INERTIA ]); + pidff->type_id[type_id]);if (error)return error; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 200/449 HID: pidff: Define values used in pidff_find_special_fields
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 1c12f136891cf4d2d4e6aa202d671a9d2171a716 ]
Makes it clear where did these values came from
--- drivers/hid/usbhid/hid-pidff.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/hid/usbhid/hid-pidff.c +15 -6
@@ -48,6 +48,14 @@ static const u8 pidff_reports[] = {/* device_control is really 0x95, but 0x96 specified as it is the usage of the only field in that report */ +/* PID special fields */ + +#define PID_EFFECT_TYPE 0x25 +#define PID_DIRECTION 0x57 +#define PID_EFFECT_OPERATION_ARRAY 0x78 +#define PID_BLOCK_LOAD_STATUS 0x8b +#define PID_DEVICE_CONTROL_ARRAY 0x96 +/* Value usage tables used to put fields and values into arrays */ #define PID_EFFECT_BLOCK_INDEX 0
@@ -1056,23 +1064,24 @@ static int pidff_find_special_fields(struct pidff_device *pidff) pidff->create_new_effect_type =pidff_find_special_field (pidff->reports[PID_CREATE_NEW_EFFECT ], -0x25 ,1 ); +PID_EFFECT_TYPE ,1 ); pidff->set_effect_type =pidff_find_special_field (pidff->reports[PID_SET_EFFECT ], -0x25 ,1 ); +PID_EFFECT_TYPE ,1 ); pidff->effect_direction =pidff_find_special_field (pidff->reports[PID_SET_EFFECT ], -0x57 ,0 ); +PID_DIRECTION ,0 ); pidff->device_control =pidff_find_special_field (pidff->reports[PID_DEVICE_CONTROL ], -0x96 , !(pidff->quirks &HID_PIDFF_QUIRK_PERMISSIVE_CONTROL )); +PID_DEVICE_CONTROL_ARRAY , + !(pidff->quirks &HID_PIDFF_QUIRK_PERMISSIVE_CONTROL )); pidff->block_load_status =pidff_find_special_field (pidff->reports[PID_BLOCK_LOAD ], -0x8b ,1 ); +PID_BLOCK_LOAD_STATUS ,1 ); pidff->effect_operation_status =pidff_find_special_field (pidff->reports[PID_EFFECT_OPERATION ], -0x78 ,1 ); +PID_EFFECT_OPERATION_ARRAY ,1 );hid_dbg (pidff->hid,"search done\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/449 HID: pidff: Rescale time values to match field units
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 8713107221a8ce4021ec5fa12bb50ecc8165cf08 ]
PID devices can use different exponents for time fields, while Linux Force Feedback API only supports miliseconds.
Read the exponent of a given time field and scale its value accordingly.
Changes in v7:
- Rescale all time fields, not only period
changes in v9:
- Properly assign fade_lenght, not attack_length to PID_FADE_TIME
--- drivers/hid/usbhid/hid-pidff.c | 69 ++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 15 deletions(-)
drivers/hid/usbhid/hid-pidff.c +54 -15
@@ -22,6 +22,9 @@#define PID_EFFECTS_MAX 64#define PID_INFINITE 0xffff +/* Linux Force Feedback API uses miliseconds as time unit */ +#define FF_TIME_EXPONENT -3 +/* Report usage table used to put reports into an array */ #define PID_SET_EFFECT 0
@@ -231,6 +234,24 @@ static int pidff_rescale_signed(int i, struct hid_field *field) field->logical_minimum /-0x8000 ; } +/* +* Scale time value from Linux default (ms) to field units +*/ +static u32 pidff_rescale_time (u16 time,struct hid_field *field) +{ +u32 scaled_time = time; +int exponent = field->unit_exponent; +pr_debug ("time field exponent: %d\n" , exponent); + +for (;exponent <FF_TIME_EXPONENT ; exponent++) + scaled_time *=10 ; +for (;exponent >FF_TIME_EXPONENT ; exponent--) + scaled_time /=10 ; + +pr_debug ("time calculated from %d to %d\n" , time, scaled_time); +return scaled_time; +} +static void pidff_set (struct pidff_usage *usage,u16 value) { usage->value[0 ] =pidff_rescale (value,0xffff , usage->field);
@@ -252,6 +273,27 @@ static void pidff_set_signed(struct pidff_usage *usage, s16 value)pr_debug ("calculated from %d to %d\n" , value, usage->value[0 ]); } +static void pidff_set_time (struct pidff_usage *usage,u16 time) +{ +u32 modified_time =pidff_rescale_time (time, usage->field); + usage->value[0 ] =pidff_clamp (modified_time, usage->field); +} + +static void pidff_set_duration (struct pidff_usage *usage,u16 duration) +{ +/* Convert infinite length from Linux API (0) +to PID standard (NULL) if needed */ +if (duration ==0 ) + duration =PID_INFINITE ; + +if (duration ==PID_INFINITE ) { + usage->value[0 ] =PID_INFINITE ; +return ; + } + +pidff_set_time (usage, duration); +} +/* * Send envelope report to the device */
@@ -270,8 +312,10 @@ static void pidff_set_envelope_report(struct pidff_device *pidff,0x7fff ?0x7fff : envelope->fade_level,0x7fff , pidff->set_envelope[PID_FADE_LEVEL].field); - pidff->set_envelope[PID_ATTACK_TIME ].value[0 ] = envelope->attack_length; - pidff->set_envelope[PID_FADE_TIME ].value[0 ] = envelope->fade_length; +pidff_set_time (&pidff->set_envelope[PID_ATTACK_TIME ], + envelope->attack_length); +pidff_set_time (&pidff->set_envelope[PID_FADE_TIME ], + envelope->fade_length); hid_dbg(pidff->hid, "attack %u => %d\n", envelope->attack_level,
@@ -340,14 +384,12 @@ static void pidff_set_effect_report(struct pidff_device *pidff, pidff->set_effect_type->value[0 ] = pidff->create_new_effect_type->value[0 ]; -/* Convert infinite length from Linux API (0) -to PID standard (NULL) if needed */ - pidff->set_effect[PID_DURATION ].value[0 ] = - effect->replay.length ==0 ?PID_INFINITE : effect->replay.length; +pidff_set_duration (&pidff->set_effect[PID_DURATION ], + effect->replay.length); pidff->set_effect[PID_TRIGGER_BUTTON ].value[0 ] = effect->trigger.button; - pidff->set_effect[PID_TRIGGER_REPEAT_INT ].value[0 ] = - effect->trigger.interval; +pidff_set_time (&pidff->set_effect[PID_TRIGGER_REPEAT_INT ], + effect->trigger.interval); pidff->set_effect[PID_GAIN ].value[0 ] = pidff->set_effect[PID_GAIN ].field->logical_maximum; pidff->set_effect[PID_DIRECTION_ENABLE ].value[0 ] =1 ;
@@ -360,7 +402,8 @@ static void pidff_set_effect_report(struct pidff_device *pidff,/* Omit setting delay field if it's missing */ if (!(pidff->quirks &HID_PIDFF_QUIRK_MISSING_DELAY )) - pidff->set_effect[PID_START_DELAY ].value[0 ] = effect->replay.delay; +pidff_set_time (&pidff->set_effect[PID_START_DELAY ], + effect->replay.delay);hid_hw_request (pidff->hid, pidff->reports[PID_SET_EFFECT ],HID_REQ_SET_REPORT );
@@ -392,15 +435,11 @@ static void pidff_set_periodic_report(struct pidff_device *pidff,pidff_set_signed (&pidff->set_periodic[PID_OFFSET ], effect->u.periodic.offset);pidff_set (&pidff->set_periodic[PID_PHASE ], effect->u.periodic.phase); - -/* Clamp period to ensure the device can play the effect */ - pidff->set_periodic[PID_PERIOD ].value[0 ] = -pidff_clamp (effect->u.periodic.period, - pidff->set_periodic[PID_PERIOD ].field); +pidff_set_time (&pidff->set_periodic[PID_PERIOD ], + effect->u.periodic.period);hid_hw_request (pidff->hid, pidff->reports[PID_SET_PERIODIC ],HID_REQ_SET_REPORT ); - }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/449 HID: pidff: Factor out code for setting gain
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit f7ebf0b11b9e04bf59c438ad14f0115b12aa2f44 ]
Makes it possible to easily set gain from inside hid-pidff.c
Changes in v7:
- Check if device gain field exists before setting device gain
--- drivers/hid/usbhid/hid-pidff.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/hid/usbhid/hid-pidff.c +15 -11
@@ -539,6 +539,19 @@ static int pidff_needs_set_ramp(struct ff_effect *effect, struct ff_effect *old) effect->u.ramp.end_level != old->u.ramp.end_level; } +/* +* Set device gain +*/ +static void pidff_set_gain_report (struct pidff_device *pidff,u16 gain) +{ +if (!pidff->device_gain[PID_DEVICE_GAIN_FIELD ].field) +return ; + +pidff_set (&pidff->device_gain[PID_DEVICE_GAIN_FIELD ], gain); +hid_hw_request (pidff->hid, pidff->reports[PID_DEVICE_GAIN ], +HID_REQ_SET_REPORT ); +} +/* * Clear device control report */
@@ -865,11 +878,7 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,*/ static void pidff_set_gain (struct input_dev *dev,u16 gain) { -struct pidff_device *pidff = dev->ff->private; - -pidff_set (&pidff->device_gain[PID_DEVICE_GAIN_FIELD ], gain); -hid_hw_request (pidff->hid, pidff->reports[PID_DEVICE_GAIN ], -HID_REQ_SET_REPORT ); +pidff_set_gain_report (dev->ff->private, gain); }static void pidff_autocenter (struct pidff_device *pidff,u16 magnitude)
@@ -1414,12 +1423,7 @@ int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks)if (error) goto fail; -if (test_bit (FF_GAIN , dev->ffbit)) { -pidff_set (&pidff->device_gain[PID_DEVICE_GAIN_FIELD ],0xffff ); -hid_hw_request (hid, pidff->reports[PID_DEVICE_GAIN ], -HID_REQ_SET_REPORT ); - } - +pidff_set_gain_report (pidff,0xffff ); error =pidff_check_autocenter (pidff, dev);if (error) goto fail;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/449 HID: pidff: Move all hid-pidff definitions to a dedicated header
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 0d24d4b1da96df9fc5ff36966f40f980ef864d46 ]
Do not clutter hid includes with stuff not needed outside of the kernel.
--- drivers/hid/hid-universal-pidff.c | 3 ++- drivers/hid/usbhid/hid-core.c | 1 + drivers/hid/usbhid/hid-pidff.c | 3 ++- drivers/hid/usbhid/hid-pidff.h | 33 +++++++++++++++++++++++++++++++ include/linux/hid.h | 15 -------------- 5 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 drivers/hid/usbhid/hid-pidff.h
drivers/hid/hid-universal-pidff.c +2 -1
@@ -13,6 +13,7 @@#include <linux/module.h> #include <linux/input-event-codes.h> #include "hid-ids.h" +#include "usbhid/hid-pidff.h" #define JOY_RANGE (BTN_DEAD - BTN_JOYSTICK + 1)
@@ -89,7 +90,7 @@ static int universal_pidff_probe(struct hid_device *hdev, }/* Check if HID_PID support is enabled */ -int (*init_function)(struct hid_device *,__u32 ); +int (*init_function)(struct hid_device *,u32 ); init_function = hid_pidff_init_with_quirks;if (!init_function) {
drivers/hid/usbhid/hid-core.c +1 -0
@@ -35,6 +35,7 @@#include <linux/hid-debug.h> #include <linux/hidraw.h> #include "usbhid.h" +#include "hid-pidff.h" /* * Version Information
drivers/hid/usbhid/hid-pidff.c +2 -1
@@ -12,6 +12,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include "hid-pidff.h" #include <linux/input.h> #include <linux/slab.h> #include <linux/usb.h>
@@ -1383,7 +1384,7 @@ static int pidff_check_autocenter(struct pidff_device *pidff,* Check if the device is PID and initialize it * Set initial quirks */ -int hid_pidff_init_with_quirks (struct hid_device *hid,__u32 initial_quirks) +int hid_pidff_init_with_quirks (struct hid_device *hid,u32 initial_quirks) {struct pidff_device *pidff; struct hid_input *hidinput = list_entry(hid->inputs.next,
drivers/hid/usbhid/hid-pidff.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef __HID_PIDFF_H +#define __HID_PIDFF_H + +#include <linux/hid.h> + +/* HID PIDFF quirks */ + +/* Delay field (0xA7) missing. Skip it during set effect report upload */ +#define HID_PIDFF_QUIRK_MISSING_DELAY BIT(0) + +/* Missing Paramter block offset (0x23). Skip it during SET_CONDITION +report upload */ +#define HID_PIDFF_QUIRK_MISSING_PBO BIT(1) + +/* Initialise device control field even if logical_minimum != 1 */ +#define HID_PIDFF_QUIRK_PERMISSIVE_CONTROL BIT(2) + +/* Use fixed 0x4000 direction during SET_EFFECT report upload */ +#define HID_PIDFF_QUIRK_FIX_WHEEL_DIRECTION BIT(3) + +/* Force all periodic effects to be uploaded as SINE */ +#define HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY BIT(4) + +#ifdef CONFIG_HID_PID +int hid_pidff_init (struct hid_device *hid); +int hid_pidff_init_with_quirks (struct hid_device *hid,u32 initial_quirks); +#else +#define hid_pidff_init NULL +#define hid_pidff_init_with_quirks NULL +#endif + +#endif
include/linux/hid.h +0 -15
@@ -1222,21 +1222,6 @@ unsigned long hid_lookup_quirk(const struct hid_device *hdev);int hid_quirks_init (char **quirks_param,__u16 bus,int count);void hid_quirks_exit (__u16 bus); -#ifdef CONFIG_HID_PID -int hid_pidff_init (struct hid_device *hid); -int hid_pidff_init_with_quirks (struct hid_device *hid,__u32 initial_quirks); -#else -#define hid_pidff_init NULL -#define hid_pidff_init_with_quirks NULL -#endif - -/* HID PIDFF quirks */ -#define HID_PIDFF_QUIRK_MISSING_DELAY BIT(0) -#define HID_PIDFF_QUIRK_MISSING_PBO BIT(1) -#define HID_PIDFF_QUIRK_PERMISSIVE_CONTROL BIT(2) -#define HID_PIDFF_QUIRK_FIX_WHEEL_DIRECTION BIT(3) -#define HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY BIT(4) -#define dbg_hid (fmt, ...) pr_debug("%s: " fmt, __FILE__, ##__VA_ARGS__)#define hid_err (hid, fmt, ...) \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/449 HID: pidff: Simplify pidff_rescale_signed
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 4eb9c2ee538b62dc5dcae192297c3a4044b7ade5 ]
This function overrelies on ternary operators and makes it hard to parse it mentally. New version makes it very easy to understand.
--- drivers/hid/usbhid/hid-pidff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/usbhid/hid-pidff.c +3 -3
@@ -230,9 +230,9 @@ static int pidff_rescale(int i, int max, struct hid_field *field)*/ static int pidff_rescale_signed (int i,struct hid_field *field) { -return i ==0 ?0 : i > -0 ? i * field->logical_maximum /0x7fff : i * - field->logical_minimum /-0x8000 ; +if (i >0 )return i * field->logical_maximum /0x7fff ; +if (i <0 )return i * field->logical_minimum /-0x8000 ; +return 0 ; }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/449 HID: pidff: Use macros instead of hardcoded min/max values for shorts
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 21755162456902998f8d9897086b8c980c540df5 ]
Makes it obvious these magic values ARE in fact derived from min and max values for s16 and u16
--- drivers/hid/usbhid/hid-pidff.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/hid/usbhid/hid-pidff.c +12 -12
@@ -21,7 +21,7 @@#define PID_EFFECTS_MAX 64 -#define PID_INFINITE 0xffff +#define PID_INFINITE U16_MAX/* Linux Force Feedback API uses miliseconds as time unit */ #define FF_TIME_EXPONENT -3
@@ -226,12 +226,12 @@ static int pidff_rescale(int i, int max, struct hid_field *field) }/* -* Scale a signed value in range -0x8000..0x7fff for the given field +* Scale a signed value in range S16_MIN..S16_MAX for the given field */ static int pidff_rescale_signed (int i,struct hid_field *field) { -if (i >0 )return i * field->logical_maximum /0x7fff ; -if (i <0 )return i * field->logical_minimum /-0x8000 ; +if (i >0 )return i * field->logical_maximum /S16_MAX ; +if (i <0 )return i * field->logical_minimum /S16_MIN ;return 0 ; }
@@ -255,7 +255,7 @@ static u32 pidff_rescale_time(u16 time, struct hid_field *field)static void pidff_set (struct pidff_usage *usage,u16 value) { - usage->value[0 ] =pidff_rescale (value,0xffff , usage->field); + usage->value[0 ] =pidff_rescale (value,U16_MAX , usage->field);pr_debug ("calculated from %d to %d\n" , value, usage->value[0 ]); }
@@ -266,10 +266,10 @@ static void pidff_set_signed(struct pidff_usage *usage, s16 value)else {if (value <0 ) usage->value[0 ] = -pidff_rescale (-value,0x8000 , usage->field); +pidff_rescale (-value, -S16_MIN , usage->field);else usage->value[0 ] = -pidff_rescale (value,0x7fff , usage->field); +pidff_rescale (value,S16_MAX , usage->field); }pr_debug ("calculated from %d to %d\n" , value, usage->value[0 ]); }
@@ -306,11 +306,11 @@ static void pidff_set_envelope_report(struct pidff_device *pidff, pidff->set_envelope[PID_ATTACK_LEVEL ].value[0 ] =pidff_rescale (envelope->attack_level > -0x7fff ?0x7fff : envelope->attack_level,0x7fff , +S16_MAX ?S16_MAX : envelope->attack_level,S16_MAX , pidff->set_envelope[PID_ATTACK_LEVEL ].field); pidff->set_envelope[PID_FADE_LEVEL ].value[0 ] =pidff_rescale (envelope->fade_level > -0x7fff ?0x7fff : envelope->fade_level,0x7fff , +S16_MAX ?S16_MAX : envelope->fade_level,S16_MAX , pidff->set_envelope[PID_FADE_LEVEL ].field); pidff_set_time(&pidff->set_envelope[PID_ATTACK_TIME],
@@ -399,7 +399,7 @@ static void pidff_set_effect_report(struct pidff_device *pidff, pidff->effect_direction->value[0 ] =pidff_rescale ( pidff->quirks &HID_PIDFF_QUIRK_FIX_WHEEL_DIRECTION ?PIDFF_FIXED_WHEEL_DIRECTION : effect->direction, -0xffff , pidff->effect_direction); +U16_MAX , pidff->effect_direction);/* Omit setting delay field if it's missing */ if (!(pidff->quirks &HID_PIDFF_QUIRK_MISSING_DELAY ))
@@ -1366,7 +1366,7 @@ static int pidff_check_autocenter(struct pidff_device *pidff,if (pidff->block_load[PID_EFFECT_BLOCK_INDEX ].value[0 ] == pidff->block_load[PID_EFFECT_BLOCK_INDEX ].field->logical_minimum +1 ) { -pidff_autocenter (pidff,0xffff ); +pidff_autocenter (pidff,U16_MAX );set_bit (FF_AUTOCENTER , dev->ffbit); }else { hid_notice(pidff->hid,
@@ -1424,7 +1424,7 @@ int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks)if (error) goto fail; -pidff_set_gain_report (pidff,0xffff ); +pidff_set_gain_report (pidff,U16_MAX ); error =pidff_check_autocenter (pidff, dev);if (error) goto fail;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 206/449 HID: pidff: Factor out pool report fetch and remove excess declaration
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 5d98079b2d0186e1f586301a9c00144a669416a8 ]
We only want to refetch the pool report during device init. Reset function is now called when uploading effects to an empty device so extract pool fetch to separate function and call it from init before autocenter check (autocenter check triggered reset during init).
Remove a superfluous pointer declaration and assigment as well.
--- drivers/hid/usbhid/hid-pidff.c | 45 ++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 21 deletions(-)
drivers/hid/usbhid/hid-pidff.c +24 -21
@@ -591,12 +591,9 @@ static void pidff_modify_actuators_state(struct pidff_device *pidff, bool enable/* * Reset the device, stop all effects, enable actuators -* Refetch pool report */ static void pidff_reset (struct pidff_device *pidff) { -int i =0 ; -/* We reset twice as sometimes hid_wait_io isn't waiting long enough */ pidff_send_device_control (pidff,PID_RESET );pidff_send_device_control (pidff,PID_RESET );
@@ -604,23 +601,29 @@ static void pidff_reset(struct pidff_device *pidff)pidff_send_device_control (pidff,PID_STOP_ALL_EFFECTS );pidff_modify_actuators_state (pidff,1 ); +} -/* pool report is sometimes messed up, refetch it */ -hid_hw_request (pidff->hid, pidff->reports[PID_POOL ],HID_REQ_GET_REPORT ); -hid_hw_wait (pidff->hid); +/* +* Refetch pool report +*/ +static void pidff_fetch_pool (struct pidff_device *pidff) +{ +if (!pidff->pool[PID_SIMULTANEOUS_MAX ].value) +return ; -if (pidff->pool[PID_SIMULTANEOUS_MAX ].value) { -while (pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ] <2 ) { -if (i++ >20 ) { -hid_warn (pidff->hid, -"device reports %d simultaneous effects\n" , - pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ]); -break ; - } -hid_dbg (pidff->hid,"pid_pool requested again\n" ); -hid_hw_request (pidff->hid, pidff->reports[PID_POOL ], -HID_REQ_GET_REPORT ); -hid_hw_wait (pidff->hid); +int i =0 ; +while (pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ] <2 ) { +hid_dbg (pidff->hid,"pid_pool requested again\n" ); +hid_hw_request (pidff->hid, pidff->reports[PID_POOL ], +HID_REQ_GET_REPORT ); +hid_hw_wait (pidff->hid); + +/* break after 20 tries with SIMULTANEOUS_MAX < 2 */ +if (i++ >20 ) { +hid_warn (pidff->hid, +"device reports %d simultaneous effects\n" , + pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ]); +break ; } } }
@@ -916,9 +919,7 @@ static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude)*/ static void pidff_set_autocenter (struct input_dev *dev,u16 magnitude) { -struct pidff_device *pidff = dev->ff->private; - -pidff_autocenter (pidff, magnitude); +pidff_autocenter (dev->ff->private, magnitude); }/*
@@ -1424,6 +1425,8 @@ int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks)if (error) goto fail; +/* pool report is sometimes messed up, refetch it */ +pidff_fetch_pool (pidff);pidff_set_gain_report (pidff,U16_MAX ); error =pidff_check_autocenter (pidff, dev);if (error)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/449 HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 1f650dcec32d22deb1d6db12300a2b98483099a9 ]
As noted by Anssi some 20 years ago, pool report is sometimes messed up. This worked fine on many devices but casued oops on VRS DirectForce PRO.
Here, we're making sure pool report is refetched before trying to access any of it's fields. While loop was replaced with a for loop + exit conditions were moved aroud to decrease the possibility of creating an infinite loop scenario.
--- drivers/hid/usbhid/hid-pidff.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-)
drivers/hid/usbhid/hid-pidff.c +13 -16
@@ -604,28 +604,25 @@ static void pidff_reset(struct pidff_device *pidff) }/* -* Refetch pool report +* Fetch pool report */ static void pidff_fetch_pool (struct pidff_device *pidff) { -if (!pidff->pool[PID_SIMULTANEOUS_MAX ].value) -return ; +int i; +struct hid_device *hid = pidff->hid; -int i =0 ; -while (pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ] <2 ) { -hid_dbg (pidff->hid,"pid_pool requested again\n" ); -hid_hw_request (pidff->hid, pidff->reports[PID_POOL ], -HID_REQ_GET_REPORT ); -hid_hw_wait (pidff->hid); +/* Repeat if PID_SIMULTANEOUS_MAX < 2 to make sure it's correct */ +for (i =0 ; i <20 ; i++) { +hid_hw_request (hid, pidff->reports[PID_POOL ],HID_REQ_GET_REPORT ); +hid_hw_wait (hid); -/* break after 20 tries with SIMULTANEOUS_MAX < 2 */ -if (i++ >20 ) { -hid_warn (pidff->hid, -"device reports %d simultaneous effects\n" , - pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ]); -break ; - } +if (!pidff->pool[PID_SIMULTANEOUS_MAX ].value) +return ; +if (pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ] >=2 ) +return ; } +hid_warn (hid,"device reports %d simultaneous effects\n" , + pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ]); }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/449 HID: hid-universal-pidff: Add Asetek wheelbases support
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit c385f61108d403633e8cfbdae15b35ccf7cee686 ]
Adds Asetek vendor id and product ids for:
- Invicta
- Forte
- La Prima
- Tony Kanaan
v2:
- Misc spelling fix in driver loaded info
v3:
- Chanage Oleg's name order
--- drivers/hid/hid-ids.h | 6 ++++++ drivers/hid/hid-universal-pidff.c | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)
drivers/hid/hid-ids.h +6 -0
@@ -190,6 +190,12 @@#define USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT 0x8102#define USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY 0x8302 +#define USB_VENDOR_ID_ASETEK 0x2433 +#define USB_DEVICE_ID_ASETEK_INVICTA 0xf300 +#define USB_DEVICE_ID_ASETEK_FORTE 0xf301 +#define USB_DEVICE_ID_ASETEK_LA_PRIMA 0xf303 +#define USB_DEVICE_ID_ASETEK_TONY_KANAAN 0xf306 +#define USB_VENDOR_ID_ASUS 0x0486#define USB_DEVICE_ID_ASUS_T91MT 0x0185#define USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO 0x0186
drivers/hid/hid-universal-pidff.c +7 -3
@@ -4,7 +4,7 @@* hid-pidff wrapper for PID-enabled devices * Handles device reports, quirks and extends usable button range * -* Copyright (c) 2024, 2025 Makarenko Oleg +* Copyright (c) 2024, 2025 Oleg Makarenko * Copyright (c) 2024, 2025 Tomasz Pakuła */
@@ -104,7 +104,7 @@ static int universal_pidff_probe(struct hid_device *hdev, goto err; } -hid_info (hdev,"Universal pidff driver loaded sucesfully!" ); +hid_info (hdev,"Universal pidff driver loaded sucessfully!" );return 0 ; err:
@@ -179,6 +179,10 @@ static const struct hid_device_id universal_pidff_devices[] = { .driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY }, { HID_USB_DEVICE(USB_VENDOR_ID_LITE_STAR, USB_DEVICE_LITE_STAR_GT987_FF), .driver_data = HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_INVICTA) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_FORTE) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_LA_PRIMA) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_TONY_KANAAN) }, { } };MODULE_DEVICE_TABLE (hid, universal_pidff_devices);
@@ -194,5 +198,5 @@ module_hid_driver(universal_pidff);MODULE_DESCRIPTION ("Universal driver for USB PID Force Feedback devices" );MODULE_LICENSE ("GPL" ); -MODULE_AUTHOR ("Makarenko Oleg <[email protected]>" ); +MODULE_AUTHOR ("Oleg Makarenko <[email protected]>" );MODULE_AUTHOR ("Tomasz Pakuła <[email protected]>" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/449 HID: pidff: Comment and code style update
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit e19675c2477491401b236ed939ad5a43ddc339af ]
Update comments to fully conform to the Linux comment styling. Define Linux infinite effect duration (0) as FF_INFINITE
Chanage Oleg's name order
--- drivers/hid/usbhid/hid-pidff.c | 57 +++++++++++++++------------------- 1 file changed, 25 insertions(+), 32 deletions(-)
drivers/hid/usbhid/hid-pidff.c +25 -32
@@ -3,13 +3,9 @@* Force feedback driver for USB HID PID compliant devices * * Copyright (c) 2005, 2006 Anssi Hannula <[email protected]> +* Upgraded 2025 by Oleg Makarenko and Tomasz Pakuła */ -/* -*/ - -/* #define DEBUG */ -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include "hid-pidff.h"
@@ -25,9 +21,9 @@/* Linux Force Feedback API uses miliseconds as time unit */ #define FF_TIME_EXPONENT -3 +#define FF_INFINITE 0/* Report usage table used to put reports into an array */ -#define PID_SET_EFFECT 0#define PID_EFFECT_OPERATION 1#define PID_DEVICE_GAIN 2
@@ -48,12 +44,12 @@ static const u8 pidff_reports[] = {0x21 ,0x77 ,0x7d ,0x7f ,0x89 ,0x90 ,0x96 ,0xab ,0x5a ,0x5f ,0x6e ,0x73 ,0x74 }; - -/* device_control is really 0x95, but 0x96 specified as it is the usage of -the only field in that report */ +/* +* device_control is really 0x95, but 0x96 specified +* as it is the usage of the only field in that report. +*/ /* PID special fields */ -#define PID_EFFECT_TYPE 0x25#define PID_DIRECTION 0x57#define PID_EFFECT_OPERATION_ARRAY 0x78
@@ -61,7 +57,6 @@ the only field in that report */#define PID_DEVICE_CONTROL_ARRAY 0x96/* Value usage tables used to put fields and values into arrays */ -#define PID_EFFECT_BLOCK_INDEX 0#define PID_DURATION 1
@@ -119,7 +114,6 @@ static const u8 pidff_device_gain[] = { 0x7e };static const u8 pidff_pool[] = {0x80 ,0x83 ,0xa9 };/* Special field key tables used to put special field keys into arrays */ -#define PID_ENABLE_ACTUATORS 0#define PID_DISABLE_ACTUATORS 1#define PID_STOP_ALL_EFFECTS 2
@@ -176,8 +170,10 @@ struct pidff_device {struct pidff_usage effect_operation[sizeof (pidff_effect_operation)];struct pidff_usage block_free[sizeof (pidff_block_free)]; -/* Special field is a field that is not composed of -usage<->value pairs that pidff_usage values are */ +/* +* Special field is a field that is not composed of +* usage<->value pairs that pidff_usage values are +*/ /* Special field in create_new_effect */ struct hid_field *create_new_effect_type;
@@ -222,7 +218,7 @@ static s32 pidff_clamp(s32 i, struct hid_field *field)static int pidff_rescale (int i,int max,struct hid_field *field) {return i * (field->logical_maximum - field->logical_minimum) / max + - field->logical_minimum; + field->logical_minimum; }/*
@@ -282,9 +278,8 @@ static void pidff_set_time(struct pidff_usage *usage, u16 time)static void pidff_set_duration (struct pidff_usage *usage,u16 duration) { -/* Convert infinite length from Linux API (0) -to PID standard (NULL) if needed */ -if (duration ==0 ) +/* Infinite value conversion from Linux API -> PID */ +if (duration ==FF_INFINITE ) duration =PID_INFINITE ;if (duration ==PID_INFINITE ) {
@@ -302,16 +297,16 @@ static void pidff_set_envelope_report(struct pidff_device *pidff, struct ff_envelope *envelope) { pidff->set_envelope[PID_EFFECT_BLOCK_INDEX ].value[0 ] = - pidff->block_load[PID_EFFECT_BLOCK_INDEX ].value[0 ]; + pidff->block_load[PID_EFFECT_BLOCK_INDEX ].value[0 ]; pidff->set_envelope[PID_ATTACK_LEVEL ].value[0 ] = -pidff_rescale (envelope->attack_level > -S16_MAX ?S16_MAX : envelope->attack_level,S16_MAX , - pidff->set_envelope[PID_ATTACK_LEVEL ].field); +pidff_rescale (envelope->attack_level > +S16_MAX ?S16_MAX : envelope->attack_level,S16_MAX , + pidff->set_envelope[PID_ATTACK_LEVEL ].field); pidff->set_envelope[PID_FADE_LEVEL ].value[0 ] = -pidff_rescale (envelope->fade_level > -S16_MAX ?S16_MAX : envelope->fade_level,S16_MAX , - pidff->set_envelope[PID_FADE_LEVEL ].field); +pidff_rescale (envelope->fade_level > +S16_MAX ?S16_MAX : envelope->fade_level,S16_MAX , + pidff->set_envelope[PID_FADE_LEVEL ].field);pidff_set_time (&pidff->set_envelope[PID_ATTACK_TIME ], envelope->attack_length);
@@ -702,9 +697,7 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n)static int pidff_playback (struct input_dev *dev,int effect_id,int value) {struct pidff_device *pidff = dev->ff->private; -pidff_playback_pid (pidff, pidff->pid_id[effect_id], value); -return 0 ; }
@@ -732,8 +725,11 @@ static int pidff_erase_effect(struct input_dev *dev, int effect_id)hid_dbg (pidff->hid,"starting to erase %d/%d\n" , effect_id, pidff->pid_id[effect_id]); -/* Wait for the queue to clear. We do not want a full fifo to -prevent the effect removal. */ + +/* +* Wait for the queue to clear. We do not want +* a full fifo to prevent the effect removal. +*/ hid_hw_wait (pidff->hid);pidff_playback_pid (pidff, pid_id,0 );pidff_erase_pid (pidff, pid_id);
@@ -1239,7 +1235,6 @@ static int pidff_find_effects(struct pidff_device *pidff,set_bit (FF_FRICTION , dev->ffbit);return 0 ; - }#define PIDFF_FIND_FIELDS (name, report, strict) \
@@ -1370,12 +1365,10 @@ static int pidff_check_autocenter(struct pidff_device *pidff,hid_notice (pidff->hid,"device has unknown autocenter control method\n" ); } -pidff_erase_pid (pidff, pidff->block_load[PID_EFFECT_BLOCK_INDEX ].value[0 ]);return 0 ; - }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/449 HID: pidff: Support device error response from PID_BLOCK_LOAD
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 9d4174dc4a234408d91fd83725e1899766cd1731 ]
If an error happens on the device, the driver will no longer fall into the trap of reading this status 60 times before it decides that this reply won't change to success/memory full.
Greatly reduces communication overhead during device error situation.
--- drivers/hid/usbhid/hid-pidff.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hid/usbhid/hid-pidff.c +7 -1
@@ -138,7 +138,8 @@ static const u8 pidff_effect_types[] = {#define PID_BLOCK_LOAD_SUCCESS 0#define PID_BLOCK_LOAD_FULL 1 -static const u8 pidff_block_load_status[] = {0x8c ,0x8d }; +#define PID_BLOCK_LOAD_ERROR 2 +static const u8 pidff_block_load_status[] = {0x8c ,0x8d ,0x8e };#define PID_EFFECT_START 0#define PID_EFFECT_STOP 1
@@ -666,6 +667,11 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1);return -ENOSPC ; } +if (pidff->block_load_status->value[0 ] == + pidff->status_id[PID_BLOCK_LOAD_ERROR ]) { +hid_dbg (pidff->hid,"device error during effect creation\n" ); +return -EREMOTEIO ; + } }hid_err (pidff->hid,"pid_block_load failed 60 times\n" );return -EIO ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/449 HID: pidff: Remove redundant call to pidff_find_special_keys
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 1bd55e79cbc0ea2d6a65f51e06c891806359c2f2 ]
Probably left out as a mistake after Anssi created the helper macro
--- drivers/hid/usbhid/hid-pidff.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/hid/usbhid/hid-pidff.c +0 -4
@@ -1159,10 +1159,6 @@ static int pidff_find_special_fields(struct pidff_device *pidff)return -1 ; } -pidff_find_special_keys (pidff->control_id, pidff->device_control, - pidff_device_control, -sizeof (pidff_device_control)); -PIDFF_FIND_SPECIAL_KEYS (control_id, device_control, device_control); if (!PIDFF_FIND_SPECIAL_KEYS(type_id, create_new_effect_type,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/449 HID: pidff: Rename two functions to align them with naming convention
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit bbeface1051142bcb0473fdcc89102ea5b31607d ]
Driver uses "set" everywhere to indicate setting report values and requesting HID_REQ_SET_REPORT
--- drivers/hid/usbhid/hid-pidff.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/hid/usbhid/hid-pidff.c +7 -7
@@ -552,7 +552,7 @@ static void pidff_set_gain_report(struct pidff_device *pidff, u16 gain)/* * Clear device control report */ -static void pidff_send_device_control (struct pidff_device *pidff,int field) +static void pidff_set_device_control (struct pidff_device *pidff,int field) {int i, tmp;int field_index = pidff->control_id[field];
@@ -578,10 +578,10 @@ static void pidff_send_device_control(struct pidff_device *pidff, int field)/* * Modify actuators state */ -static void pidff_modify_actuators_state (struct pidff_device *pidff,bool enable) +static void pidff_set_actuators (struct pidff_device *pidff,bool enable) {hid_dbg (pidff->hid,"%s actuators\n" , enable ?"Enable" :"Disable" ); -pidff_send_device_control (pidff, +pidff_set_device_control (pidff, enable ?PID_ENABLE_ACTUATORS :PID_DISABLE_ACTUATORS ); }
@@ -591,12 +591,12 @@ static void pidff_modify_actuators_state(struct pidff_device *pidff, bool enablestatic void pidff_reset (struct pidff_device *pidff) {/* We reset twice as sometimes hid_wait_io isn't waiting long enough */ -pidff_send_device_control (pidff,PID_RESET ); -pidff_send_device_control (pidff,PID_RESET ); +pidff_set_device_control (pidff,PID_RESET ); +pidff_set_device_control (pidff,PID_RESET ); pidff->effect_count =0 ; -pidff_send_device_control (pidff,PID_STOP_ALL_EFFECTS ); -pidff_modify_actuators_state (pidff,1 ); +pidff_set_device_control (pidff,PID_STOP_ALL_EFFECTS ); +pidff_set_actuators (pidff,1 ); }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/449 HID: pidff: Clamp effect playback LOOP_COUNT value
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 0c6673e3d17b258b8c5c7331d28bf6c49f25ed30 ]
Ensures the loop count will never exceed the logical_maximum.
Fixes implementation errors happening when applications use the max value of int32/DWORD as the effect iterations. This could be observed when running software both native and in wine.
--- drivers/hid/usbhid/hid-pidff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/usbhid/hid-pidff.c +2 -1
@@ -690,7 +690,8 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n) }else { pidff->effect_operation_status->value[0 ] = pidff->operation_id[PID_EFFECT_START ]; - pidff->effect_operation[PID_LOOP_COUNT ].value[0 ] = n; + pidff->effect_operation[PID_LOOP_COUNT ].value[0 ] = +pidff_clamp (n, pidff->effect_operation[PID_LOOP_COUNT ].field); } hid_hw_request(pidff->hid, pidff->reports[PID_EFFECT_OPERATION],
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/449 HID: pidff: Compute INFINITE value instead of using hardcoded 0xffff
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit 1a575044d516972a1d036d54c0180b9085e21dc6 ]
As per USB PID standard:
INFINITE - Referrers to the maximum value of a range. i.e. if in an 8 bit unsigned field the value of 255 would indicate INFINITE.
Detecting 0xffff (U16_MAX) is still important as we MIGHT get this value as infinite from some native software as 0 was never actually defined in Linux' FF api as the infinite value. I'm working on it though.
--- drivers/hid/usbhid/hid-pidff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/usbhid/hid-pidff.c +2 -1
@@ -283,8 +283,9 @@ static void pidff_set_duration(struct pidff_usage *usage, u16 duration)if (duration ==FF_INFINITE ) duration =PID_INFINITE ; +/* PID defines INFINITE as the max possible value for duration field */ if (duration ==PID_INFINITE ) { - usage->value[0 ] =PID_INFINITE ; + usage->value[0 ] = (1U << usage->field->report_size) -1 ;return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/449 HID: pidff: Fix 90 degrees direction name North -> East
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit f98ecedbeca34a8df1460c3a03cce32639c99a9d ]
--- drivers/hid/usbhid/hid-pidff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/usbhid/hid-pidff.c +1 -1
@@ -145,7 +145,7 @@ static const u8 pidff_block_load_status[] = { 0x8c, 0x8d, 0x8e};#define PID_EFFECT_STOP 1static const u8 pidff_effect_operation_status[] = {0x79 ,0x7b }; -/* Polar direction 90 degrees (North) */ +/* Polar direction 90 degrees (East) */ #define PIDFF_FIXED_WHEEL_DIRECTION 0x4000struct pidff_usage {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/449 HID: pidff: Fix set_device_control()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Pakuła <[email protected]>
[ Upstream commit e2fa0bdf08a70623f24ed52f2037a330999d9800 ]
As the search for Device Control report is permissive, make sure the desired field was actually found, before trying to set it.
Fix bitmask clearing as it was erronously using index instead of index - 1 (HID arrays index is 1-based).
Add last two missing Device Control usages to the defined array. PID_PAUSE and PID_CONTINUE.
--- drivers/hid/usbhid/hid-pidff.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/hid/usbhid/hid-pidff.c +15 -5
@@ -118,7 +118,9 @@ static const u8 pidff_pool[] = { 0x80, 0x83, 0xa9 };#define PID_DISABLE_ACTUATORS 1#define PID_STOP_ALL_EFFECTS 2#define PID_RESET 3 -static const u8 pidff_device_control[] = {0x97 ,0x98 ,0x99 ,0x9a }; +#define PID_PAUSE 4 +#define PID_CONTINUE 5 +static const u8 pidff_device_control[] = {0x97 ,0x98 ,0x99 ,0x9a ,0x9b ,0x9c };#define PID_CONSTANT 0#define PID_RAMP 1
@@ -551,21 +553,29 @@ static void pidff_set_gain_report(struct pidff_device *pidff, u16 gain) }/* -* Clear device control report +* Send device control report to the device */ static void pidff_set_device_control (struct pidff_device *pidff,int field) { -int i, tmp; +int i, index;int field_index = pidff->control_id[field]; +if (field_index <1 ) +return ; +/* Detect if the field is a bitmask variable or an array */ if (pidff->device_control->flags &HID_MAIN_ITEM_VARIABLE ) {hid_dbg (pidff->hid,"DEVICE_CONTROL is a bitmask\n" ); +/* Clear current bitmask */ for (i =0 ; i <sizeof (pidff_device_control); i++) { - tmp = pidff->control_id[i]; - pidff->device_control->value[tmp] =0 ; + index = pidff->control_id[i]; +if (index <1 ) +continue ; + + pidff->device_control->value[index -1 ] =0 ; } + pidff->device_control->value[field_index -1 ] =1 ; }else {hid_dbg (pidff->hid,"DEVICE_CONTROL is an array\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/449 auxdisplay: hd44780: Fix an API misuse in hd44780.c
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 9b98a7d2e5f4e2beeff88f6571da0cdc5883c7fb upstream.
Variable allocated by charlcd_alloc() should be released by charlcd_free(). The following patch changed kfree() to charlcd_free() to fix an API misuse.
--- drivers/auxdisplay/hd44780.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/auxdisplay/hd44780.c +2 -2
@@ -313,7 +313,7 @@ static int hd44780_probe(struct platform fail3:kfree (hd); fail2: -kfree (lcd); +charlcd_free (lcd); fail1:kfree (hdc);return ret;
@@ -328,7 +328,7 @@ static void hd44780_remove(struct platfokfree (hdc->hd44780);kfree (lcd->drvdata); -kfree (lcd); +charlcd_free (lcd); }static const struct of_device_id hd44780_of_match[] = {
Greg Kroah-Hartman
maintainerPATCH 218/449 dt-bindings: media: st,stmipid02: correct lane-polarities maxItems
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alain Volmat <[email protected]>
commit 3a544a39e0a4c492e3026dfbed018321d2bd6caa upstream.
The MIPID02 can use up to 2 data lanes which leads to having a maximum item number of 3 for the lane-polarities since this also contains the clock lane.
--- Documentation/devicetree/bindings/media/i2c/st,st-mipid02.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/media/i2c/st,st-mipid02.yaml +1 -1
@@ -71,7 +71,7 @@ properties: description: Any lane can be inverted or not. minItems: 1 - maxItems: 2 + maxItems: 3 required: - data-lanes
Greg Kroah-Hartman
maintainerPATCH 219/449 media: mediatek: vcodec: Fix a resource leak related to the scp device in FW initialization
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 4936cd5817af35d23e4d283f48fa59a18ef481e4 upstream.
On Mediatek devices with a system companion processor (SCP) the mtk_scp structure has to be removed explicitly to avoid a resource leak. Free the structure in case the allocation of the firmware structure fails during the firmware initialization.
--- drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c +4 -1
@@ -79,8 +79,11 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_ } fw =devm_kzalloc (&plat_dev->dev,sizeof (*fw),GFP_KERNEL ); -if (!fw) +if (!fw) { +scp_put (scp);return ERR_PTR (-ENOMEM ); + } + fw->type =SCP ; fw->ops = &mtk_vcodec_rproc_msg; fw->scp = scp;
Greg Kroah-Hartman
maintainerPATCH 220/449 media: mtk-vcodec: venc: avoid -Wenum-compare-conditional warning
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 07df4f23ef3ffe6fee697cd2e03623ad27108843 upstream.
This is one of three clang warnings about incompatible enum types in a conditional expression:
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c:597:29: error: conditional expression between different enumeration types ('enum scp_ipi_id' and 'enum ipi_id') [-Werror,-Wenum-compare-conditional]
597 | inst->vpu_inst.id = is_ext ? SCP_IPI_VENC_H264 : IPI_VENC_H264;
| ^ ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~The code is correct, so just rework it to avoid the warning.
--- drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c +5 -1
@@ -594,7 +594,11 @@ static int h264_enc_init(struct mtk_vcod inst->ctx = ctx; inst->vpu_inst.ctx = ctx; - inst->vpu_inst.id = is_ext ?SCP_IPI_VENC_H264 :IPI_VENC_H264 ; +if (is_ext) + inst->vpu_inst.id =SCP_IPI_VENC_H264 ; +else + inst->vpu_inst.id =IPI_VENC_H264 ; + inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_SYS ); ret =vpu_enc_init (&inst->vpu_inst);
Greg Kroah-Hartman
maintainerPATCH 221/449 media: uapi: rkisp1-config: Fix typo in extensible params example
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Söderlund <[email protected]>
commit 7b0ee2de7c76e5518e2235a927fd211bc785d320 upstream.
The define used for the version in the example diagram does not match what is defined in enum rksip1_ext_param_buffer_version, nor the description above it. Correct the typo to make it clear which define to use.
--- include/uapi/linux/rkisp1-config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/rkisp1-config.h +1 -1
@@ -1528,7 +1528,7 @@ enum rksip1_ext_param_buffer_version {* The expected memory layout of the parameters buffer is:: * * +-------------------- struct rkisp1_ext_params_cfg -------------------+ -* | version = RKISP_EXT_PARAMS_BUFFER_V1; | +* | version = RKISP1_EXT_PARAM_BUFFER_V1; | * | data_size = sizeof(struct rkisp1_ext_params_bls_config) | * | + sizeof(struct rkisp1_ext_params_dpcc_config); | * | +------------------------- data ---------------------------------+ |
Greg Kroah-Hartman
maintainerPATCH 222/449 media: mgb4: Fix CMT registers update logic
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Tůma <[email protected]>
commit dd05443189f9ae175dd806594b67bf55ddb6539e upstream.
The CMT "magic values" registers must be updated while the CMT reset registers are active.
--- drivers/media/pci/mgb4/mgb4_cmt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/pci/mgb4/mgb4_cmt.c +4 -2
@@ -206,10 +206,11 @@ u32 mgb4_cmt_set_vout_freq(struct mgb4_vmgb4_write_reg (video, regs->config,0x1 | (config & ~0x3 )); +mgb4_mask_reg (video, regs->config,0x100 ,0x100 ); +for (i =0 ; i <ARRAY_SIZE (cmt_addrs_out[0 ]); i++)mgb4_write_reg (&voutdev->mgbdev->cmt, addr[i], reg_set[i]); -mgb4_mask_reg (video, regs->config,0x100 ,0x100 );mgb4_mask_reg (video, regs->config,0x100 ,0x0 );mgb4_write_reg (video, regs->config, config & ~0x1 );
@@ -236,10 +237,11 @@ void mgb4_cmt_set_vin_freq_range(structmgb4_write_reg (video, regs->config,0x1 | (config & ~0x3 )); +mgb4_mask_reg (video, regs->config,0x1000 ,0x1000 ); +for (i =0 ; i <ARRAY_SIZE (cmt_addrs_in[0 ]); i++)mgb4_write_reg (&vindev->mgbdev->cmt, addr[i], reg_set[i]); -mgb4_mask_reg (video, regs->config,0x1000 ,0x1000 );mgb4_mask_reg (video, regs->config,0x1000 ,0x0 );mgb4_write_reg (video, regs->config, config & ~0x1 );
Greg Kroah-Hartman
maintainerPATCH 223/449 media: i2c: adv748x: Fix test pattern selection mask
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Söderlund <[email protected]>
commit 9e38acacb9d809b97a0bdc5c76e725355a47158a upstream.
The mask to select the test-pattern in register ADV748X_SDP_FRP is incorrect, it's the lower 3 bits which controls the pattern. The GENMASK() macro is used incorrectly and the generated mask is 0x0e instead of 0x07.
The result is that not all test patterns are selectable, and that in some cases the wrong test pattern is activated. Fix this by correcting the GENMASK().
--- drivers/media/i2c/adv748x/adv748x.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv748x/adv748x.h +1 -1
@@ -320,7 +320,7 @@ struct adv748x_state {/* Free run pattern select */ #define ADV748X_SDP_FRP 0x14 -#define ADV748X_SDP_FRP_MASK GENMASK(3, 1) +#define ADV748X_SDP_FRP_MASK GENMASK(2, 0)/* Saturation */ #define ADV748X_SDP_SD_SAT_U 0xe3/* user_map_rw_reg_e3 */
Greg Kroah-Hartman
maintainerPATCH 224/449 media: mgb4: Fix switched CMT frequency range "magic values" sets
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Tůma <[email protected]>
commit 450acf0840232eaf6eb7a80da11cf492e57498e8 upstream.
The reason why this passed unnoticed is that most infotainment systems use frequencies near enough the middle (50MHz) where both sets work.
--- drivers/media/pci/mgb4/mgb4_cmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/mgb4/mgb4_cmt.c +1 -1
@@ -135,8 +135,8 @@ static const u16 cmt_vals_out[][15] = { };static const u16 cmt_vals_in[][13 ] = { - {0x1082 ,0x0000 ,0x5104 ,0x0000 ,0x11C7 ,0x0000 ,0x1041 ,0x02BC ,0x7C01 ,0xFFE9 ,0x9900 ,0x9908 ,0x8100 }, {0x1104 ,0x0000 ,0x9208 ,0x0000 ,0x138E ,0x0000 ,0x1041 ,0x015E ,0x7C01 ,0xFFE9 ,0x0100 ,0x0908 ,0x1000 }, + {0x1082 ,0x0000 ,0x5104 ,0x0000 ,0x11C7 ,0x0000 ,0x1041 ,0x02BC ,0x7C01 ,0xFFE9 ,0x9900 ,0x9908 ,0x8100 }, };static const u32 cmt_addrs_out[][15 ] = {
Greg Kroah-Hartman
maintainerPATCH 225/449 media: intel/ipu6: set the dev_parent of video device to pdev
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bingbu Cao <[email protected]>
commit 6f0ab5d3671f7cbb326c8cab6fb69cb7ab9901cc upstream.
The bus_info in v4l2_capability of IPU6 isys v4l2_dev is missing. The driver didn't set the dev_parent of v4l2_dev, its parent is set to its parent auxdev which is neither platform nor PCI device, thus media_set_bus_info() will not set the bus_info of v4l2_capability, then v4l2-ctl --all cannot show the bus_info.
This patch fixes it by setting the dev_parent of video_device and v4l2 framework can detect the device type and set the bus_info instead.
--- drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/intel/ipu6/ipu6-isys-video.c +1 -0
@@ -1296,6 +1296,7 @@ int ipu6_isys_video_init(struct ipu6_isy av->vdev.release = video_device_release_empty; av->vdev.fops = &isys_fops; av->vdev.v4l2_dev = &av->isys->v4l2_dev; + av->vdev.dev_parent = &av->isys->adev->isp->pdev->dev;if (!av->vdev.ioctl_ops) av->vdev.ioctl_ops = &ipu6_v4l2_ioctl_ops; av->vdev.queue = &av->aq.vbq;
Greg Kroah-Hartman
maintainerPATCH 226/449 media: venus: hfi: add a check to handle OOB in sfr region
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikash Garodia <[email protected]>
commit f4b211714bcc70effa60c34d9fa613d182e3ef1e upstream.
sfr->buf_size is in shared memory and can be modified by malicious user. OOB write is possible when the size is made higher than actual sfr data buffer. Cap the size to allocated size for such cases.
--- drivers/media/platform/qcom/venus/hfi_venus.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/hfi_venus.c +10 -2
@@ -1035,18 +1035,26 @@ static void venus_sfr_print(struct venus {struct device *dev = hdev->core->dev;struct hfi_sfr *sfr = hdev->sfr.kva; +u32 size;void *p;if (!sfr)return ; - p =memchr (sfr->data,'\0' , sfr->buf_size); + size = sfr->buf_size; +if (!size) +return ; + +if (size >ALIGNED_SFR_SIZE ) + size =ALIGNED_SFR_SIZE ; + + p =memchr (sfr->data,'\0' , size);/* * SFR isn't guaranteed to be NULL terminated since SYS_ERROR indicates * that Venus is in the process of crashing. */ if (!p) - sfr->data[sfr->buf_size -1 ] ='\0' ; + sfr->data[size -1 ] ='\0' ;dev_err_ratelimited (dev,"SFR message from FW: %s\n" , sfr->data); }
Greg Kroah-Hartman
maintainerPATCH 227/449 media: venus: hfi: add check to handle incorrect queue size
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikash Garodia <[email protected]>
commit 69baf245b23e20efda0079238b27fc63ecf13de1 upstream.
qsize represents size of shared queued between driver and video firmware. Firmware can modify this value to an invalid large value. In such situation, empty_space will be bigger than the space actually available. Since new_wr_idx is not checked, so the following code will result in an OOB write.
...
qsize = qhdr->q_size
if (wr_idx >= rd_idx)
empty_space = qsize - (wr_idx - rd_idx)
....
if (new_wr_idx < qsize) {
memcpy(wr_ptr, packet, dwords << 2) --> OOB write
Add check to ensure qsize is within the allocated size while reading and writing packets into the queue.
--- drivers/media/platform/qcom/venus/hfi_venus.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/platform/qcom/venus/hfi_venus.c +6 -0
@@ -187,6 +187,9 @@ static int venus_write_queue(struct venu/* ensure rd/wr indices's are read from memory */ rmb (); +if (qsize >IFACEQ_QUEUE_SIZE /4 ) +return -EINVAL ; +if (wr_idx >= rd_idx) empty_space = qsize - (wr_idx - rd_idx);else
@@ -255,6 +258,9 @@ static int venus_read_queue(struct venus wr_idx = qhdr->write_idx; qsize = qhdr->q_size; +if (qsize >IFACEQ_QUEUE_SIZE /4 ) +return -EINVAL ; +/* make sure data is valid before using it */ rmb ();
Greg Kroah-Hartman
maintainerPATCH 228/449 media: vim2m: print device name after registering device
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Majewski <[email protected]>
commit 143d75583f2427f3a97dba62413c4f0604867ebf upstream.
Move the v4l2_info() call displaying the video device name after the device is actually registered.
This fixes a bug where the driver was always displaying "/dev/video0" since it was reading from the vfd before it was registered.
--- drivers/media/test-drivers/vim2m.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/test-drivers/vim2m.c +3 -3
@@ -1314,9 +1314,6 @@ static int vim2m_probe(struct platform_d vfd->v4l2_dev = &dev->v4l2_dev;video_set_drvdata (vfd, dev); -v4l2_info (&dev->v4l2_dev, -"Device registered as /dev/video%d\n" , vfd->num); -platform_set_drvdata (pdev, dev); dev->m2m_dev =v4l2_m2m_init (&m2m_ops);
@@ -1343,6 +1340,9 @@ static int vim2m_probe(struct platform_d goto error_m2m; } +v4l2_info (&dev->v4l2_dev, +"Device registered as /dev/video%d\n" , vfd->num); +#ifdef CONFIG_MEDIA_CONTROLLER ret =v4l2_m2m_register_media_controller (dev->m2m_dev, vfd,MEDIA_ENT_F_PROC_VIDEO_SCALER );
Greg Kroah-Hartman
maintainerPATCH 229/449 media: siano: Fix error handling in smsdvb_module_init()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Can <[email protected]>
commit 734ac57e47b3bdd140a1119e2c4e8e6f8ef8b33d upstream.
The smsdvb_module_init() returns without checking the retval from smscore_register_hotplug().
If the smscore_register_hotplug() failed, the module failed to install, leaving the smsdvb_debugfs not unregistered.
--- drivers/media/common/siano/smsdvb-main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/common/siano/smsdvb-main.c +2 -0
@@ -1243,6 +1243,8 @@ static int __init smsdvb_module_init(voismsdvb_debugfs_register (); rc =smscore_register_hotplug (smsdvb_hotplug); +if (rc) +smsdvb_debugfs_unregister ();pr_debug ("\n" );
Greg Kroah-Hartman
maintainerPATCH 230/449 media: rockchip: rga: fix rga offset lookup
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Keeping <[email protected]>
commit 11de3582675cc0b7136e12f3971f1da3e5a05382 upstream.
The arguments to rga_lookup_draw_pos() are passed in the wrong order, rotate mode should be before mirror mode.
--- drivers/media/platform/rockchip/rga/rga-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rockchip/rga/rga-hw.c +1 -1
@@ -376,7 +376,7 @@ static void rga_cmd_set_dst_info(struct* Configure the dest framebuffer base address with pixel offset. */ offsets =rga_get_addr_offset (&ctx->out, offset, dst_x, dst_y, dst_w, dst_h); - dst_offset =rga_lookup_draw_pos (&offsets, mir_mode, rot_mode); + dst_offset =rga_lookup_draw_pos (&offsets, rot_mode, mir_mode); dest[(RGA_DST_Y_RGB_BASE_ADDR -RGA_MODE_BASE_REG ) >>2 ] = dst_offset->y_off;
Greg Kroah-Hartman
maintainerPATCH 231/449 xenfs/xensyms: respect hypervisors "next" indication
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 5c4e79e29a9fe4ea132118ac40c2bc97cfe23077 upstream.
The interface specifies the symnum field as an input and output; the hypervisor sets it to the next sequential symbol's index. xensyms_next() incrementing the position explicitly (and xensyms_next_sym() decrementing it to "rewind") is only correct as long as the sequence of symbol indexes is non-sparse. Use the hypervisor-supplied value instead to update the position in xensyms_next(), and use the saved incoming index in xensyms_next_sym().
Message-ID: <[email protected]>
--- drivers/xen/xenfs/xensyms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/xenfs/xensyms.c +2 -2
@@ -48,7 +48,7 @@ static int xensyms_next_sym(struct xensyreturn -ENOMEM ;set_xen_guest_handle (symdata->name, xs->name); - symdata->symnum--;/* Rewind */ + symdata->symnum = symnum;/* Rewind */ ret =HYPERVISOR_platform_op (&xs->op);if (ret <0 )
@@ -78,7 +78,7 @@ static void *xensyms_next(struct seq_fil {struct xensyms *xs = m->private; - xs->op.u.symdata.symnum = ++(*pos); + *pos = xs->op.u.symdata.symnum;if (xensyms_next_sym (xs))return NULL ;
Greg Kroah-Hartman
maintainerPATCH 232/449 KVM: arm64: PMU: Set raw values from user to PM{C,I}NTEN{SET,CLR}, PMOVS{SET,CLR}
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akihiko Odaki <[email protected]>
commit f2aeb7bbd5745fbcf7f0769e29a184e24924b9a9 upstream.
Commit a45f41d754e0 ("KVM: arm64: Add {get,set}_user for PM{C,I}NTEN{SET,CLR}, PMOVS{SET,CLR}") changed KVM_SET_ONE_REG to update the mentioned registers in a way matching with the behavior of guest register writes. This is a breaking change of a UAPI though the new semantics looks cleaner and VMMs are not prepared for this.
Firecracker, QEMU, and crosvm perform migration by listing registers with KVM_GET_REG_LIST, getting their values with KVM_GET_ONE_REG and setting them with KVM_SET_ONE_REG. This algorithm assumes KVM_SET_ONE_REG restores the values retrieved with KVM_GET_ONE_REG without any alteration. However, bit operations added by the earlier commit do not preserve the values retried with KVM_GET_ONE_REG and potentially break migration.
Remove the bit operations that alter the values retrieved with KVM_GET_ONE_REG.
--- arch/arm64/kvm/sys_regs.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
arch/arm64/kvm/sys_regs.c +2 -19
@@ -1051,26 +1051,9 @@ static bool access_pmu_evtyper(struct kvstatic int set_pmreg (struct kvm_vcpu *vcpu,const struct sys_reg_desc *r,u64 val) { -bool set; - - val &=kvm_pmu_accessible_counter_mask (vcpu); - -switch (r->reg) { -case PMOVSSET_EL0 : -/* CRm[1] being set indicates a SET register, and CLR otherwise */ - set = r->CRm &2 ; -break ; -default : -/* Op2[0] being set indicates a SET register, and CLR otherwise */ - set = r->Op2 &1 ; -break ; - } - -if (set) -__vcpu_sys_reg (vcpu, r->reg) |= val; -else -__vcpu_sys_reg (vcpu, r->reg) &= ~val; +u64 mask =kvm_pmu_accessible_counter_mask (vcpu); +__vcpu_sys_reg (vcpu, r->reg) = val & mask;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 233/449 arm64: cputype: Add MIDR_CORTEX_A76AE
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit a9b5bd81b294d30a747edd125e9f6aef2def7c79 upstream.
Quoted 1 line
From the TRM,
MIDR_CORTEX_A76AEhas a partnum of 0xDOE and an
implementor of 0x41 (ARM). Add the values.
--- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/include/asm/cputype.h +2 -0
@@ -75,6 +75,7 @@#define ARM_CPU_PART_CORTEX_A76 0xD0B#define ARM_CPU_PART_NEOVERSE_N1 0xD0C#define ARM_CPU_PART_CORTEX_A77 0xD0D +#define ARM_CPU_PART_CORTEX_A76AE 0xD0E#define ARM_CPU_PART_NEOVERSE_V1 0xD40#define ARM_CPU_PART_CORTEX_A78 0xD41#define ARM_CPU_PART_CORTEX_A78AE 0xD42
@@ -160,6 +161,7 @@#define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)#define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)#define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77) +#define MIDR_CORTEX_A76AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76AE)#define MIDR_NEOVERSE_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V1)#define MIDR_CORTEX_A78 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78)#define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
Greg Kroah-Hartman
maintainerPATCH 234/449 arm64: errata: Add QCOM_KRYO_4XX_GOLD to the spectre_bhb_k24_list
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit ed1ce841245d8febe3badf51c57e81c3619d0a1d upstream.
Qualcomm Kryo 400-series Gold cores have a derivative of an ARM Cortex A76 in them. Since A76 needs Spectre mitigation via looping then the Kyro 400-series Gold cores also need Spectre mitigation via looping.
Qualcomm has confirmed that the proper "k" value for Kryo 400-series Gold cores is 24.
--- arch/arm64/kernel/proton-pack.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/proton-pack.c +1 -0
@@ -866,6 +866,7 @@ u8 spectre_bhb_loop_affected(int scope)MIDR_ALL_VERSIONS (MIDR_CORTEX_A76 ),MIDR_ALL_VERSIONS (MIDR_CORTEX_A77 ),MIDR_ALL_VERSIONS (MIDR_NEOVERSE_N1 ), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_GOLD), {}, };static const struct midr_range spectre_bhb_k11_list[] = {
Greg Kroah-Hartman
maintainerPATCH 235/449 arm64: errata: Assume that unknown CPUs _are_ vulnerable to Spectre BHB
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit e403e8538359d8580cbee1976ff71813e947101e upstream.
The code for detecting CPUs that are vulnerable to Spectre BHB was based on a hardcoded list of CPU IDs that were known to be affected. Unfortunately, the list mostly only contained the IDs of standard ARM cores. The IDs for many cores that are minor variants of the standard ARM cores (like many Qualcomm Kyro CPUs) weren't listed. This led the code to assume that those variants were not affected.
Flip the code on its head and instead assume that a core is vulnerable if it doesn't have CSV2_3 but is unrecognized as being safe. This involves creating a "Spectre BHB safe" list.
As of right now, the only CPU IDs added to the "Spectre BHB safe" list are ARM Cortex A35, A53, A55, A510, and A520. This list was created by looking for cores that weren't listed in ARM's list [1] as per review feedback on v2 of this patch [2]. Additionally Brahma A53 is added as per mailing list feedback [3].
NOTE: this patch will not actually _mitigate_ anyone, it will simply cause them to report themselves as vulnerable. If any cores in the system are reported as vulnerable but not mitigated then the whole system will be reported as vulnerable though the system will attempt to mitigate with the information it has about the known cores.
[1] https://developer.arm.com/Arm%20Security%20Center/Spectre-BHB
[2] https://lore.kernel.org/r/20241219175128.GA25477@willie-the-truck
[3] https://lore.kernel.org/r/[email protected]
--- arch/arm64/include/asm/spectre.h | 1 arch/arm64/kernel/proton-pack.c | 201 +++++++++++++++++++-------------------- 2 files changed, 101 insertions(+), 101 deletions(-)
arch/arm64/include/asm/spectre.h +0 -1
@@ -97,7 +97,6 @@ enum mitigation_state arm64_get_meltdownenum mitigation_state arm64_get_spectre_bhb_state (void );bool is_spectre_bhb_affected (const struct arm64_cpu_capabilities *entry,int scope); -u8 spectre_bhb_loop_affected (int scope);void spectre_bhb_enable_mitigation (const struct arm64_cpu_capabilities *__unused);bool try_emulate_el1_ssbs (struct pt_regs *regs,u32 instr);
arch/arm64/kernel/proton-pack.c +101 -100
265 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 236/449 arm64: errata: Add KRYO 2XX/3XX/4XX silver cores to Spectre BHB safe list
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
commit 0c9fc6e652cd5aed48c5f700c32b7642bea7f453 upstream.
Qualcomm has confirmed that, much like Cortex A53 and A55, KRYO 2XX/3XX/4XX silver cores are unaffected by Spectre BHB. Add them to the safe list.
--- arch/arm64/kernel/proton-pack.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/kernel/proton-pack.c +3 -0
@@ -854,6 +854,9 @@ static bool is_spectre_bhb_safe(int scopMIDR_ALL_VERSIONS (MIDR_CORTEX_A510 ),MIDR_ALL_VERSIONS (MIDR_CORTEX_A520 ),MIDR_ALL_VERSIONS (MIDR_BRAHMA_B53 ), +MIDR_ALL_VERSIONS (MIDR_QCOM_KRYO_2XX_SILVER ), +MIDR_ALL_VERSIONS (MIDR_QCOM_KRYO_3XX_SILVER ), + MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_SILVER), {}, };static bool all_safe = true;
Greg Kroah-Hartman
maintainerPATCH 237/449 KVM: arm64: Tear down vGIC on failed vCPU creation
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 250f25367b58d8c65a1b060a2dda037eea09a672 upstream.
If kvm_arch_vcpu_create() fails to share the vCPU page with the hypervisor, we propagate the error back to the ioctl but leave the vGIC vCPU data initialised. Note only does this leak the corresponding memory when the vCPU is destroyed but it can also lead to use-after-free if the redistributor device handling tries to walk into the vCPU.
Add the missing cleanup to kvm_arch_vcpu_create(), ensuring that the vGIC vCPU structures are destroyed on error.
--- arch/arm64/kvm/arm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm64/kvm/arm.c +5 -1
@@ -466,7 +466,11 @@ int kvm_arch_vcpu_create(struct kvm_vcpuif (err)return err; -return kvm_share_hyp (vcpu, vcpu +1 ); + err =kvm_share_hyp (vcpu, vcpu +1 ); +if (err) +kvm_vgic_vcpu_destroy (vcpu); + +return err; }void kvm_arch_vcpu_postcreate (struct kvm_vcpu *vcpu)
Greg Kroah-Hartman
maintainerPATCH 238/449 KVM: arm64: Set HCR_EL2.TID1 unconditionally
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit 4cd48565b0e5df398e7253c0d2d8c0403d69e7bf upstream.
commit 90807748ca3a ("KVM: arm64: Hide SME system registers from guests") added trap handling for SMIDR_EL1, treating it as UNDEFINED as KVM does not support SME. This is right for the most part, however KVM needs to set HCR_EL2.TID1 to _actually_ trap the register.
Unfortunately, this comes with some collateral damage as TID1 forces REVIDR_EL1 and AIDR_EL1 to trap as well. KVM has long treated these registers as "invariant" which is an awful term for the following:
- Userspace sees the boot CPU values on all vCPUs
- The guest sees the hardware values of the CPU on which a vCPU is scheduled
Keep the plates spinning by adding trap handling for the affected registers and repaint all of the "invariant" crud into terms of identifying an implementation. Yes, at this point we only need to set TID1 on SME hardware, but REVIDR_EL1 and AIDR_EL1 are about to become mutable anyway.
--- arch/arm64/include/asm/kvm_arm.h | 4 arch/arm64/kvm/sys_regs.c | 183 ++++++++++++++++++++------------------- 2 files changed, 100 insertions(+), 87 deletions(-)
arch/arm64/include/asm/kvm_arm.h +2 -2
@@ -92,12 +92,12 @@* SWIO: Turn set/way invalidates into set/way clean+invalidate * PTW: Take a stage2 fault if a stage1 walk steps in device memory * TID3: Trap EL1 reads of group 3 ID registers -* TID2: Trap CTR_EL0, CCSIDR2_EL1, CLIDR_EL1, and CSSELR_EL1 +* TID1: Trap REVIDR_EL1, AIDR_EL1, and SMIDR_EL1 */ #define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | HCR_VM | \ HCR_BSU_IS | HCR_FB | HCR_TACR | \ HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | HCR_TLOR | \ - HCR_FMO | HCR_IMO | HCR_PTW | HCR_TID3) + HCR_FMO | HCR_IMO | HCR_PTW | HCR_TID3 | HCR_TID1)#define HCR_HOST_NVHE_FLAGS (HCR_RW | HCR_API | HCR_APK | HCR_ATA)#define HCR_HOST_NVHE_PROTECTED_FLAGS (HCR_HOST_NVHE_FLAGS | HCR_TSC)#define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H)
arch/arm64/kvm/sys_regs.c +98 -85
259 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 239/449 spi: cadence-qspi: Fix probe on AM62A LP SK
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
commit b8665a1b49f5498edb7b21d730030c06b7348a3c upstream.
In 2020, there's been an unnoticed change which rightfully attempted to report probe deferrals upon DMA absence by checking the return value of dma_request_chan_by_mask(). By doing so, it also reported errors which were simply ignored otherwise, likely on purpose.
This change actually turned a void return into an error code. Hence, not only the -EPROBE_DEFER error codes but all error codes got reported to the callers, now failing to probe in the absence of Rx DMA channel, despite the fact that DMA seems to not be supported natively by many implementations.
Looking at the history, this change probably led to:ad2775dc3fc5 ("spi: cadence-quadspi: Disable the DAC for Intel LGM SoC") f724c296f2f2 ("spi: cadence-quadspi: fix Direct Access Mode disable for SoCFPGA")
In my case, the AM62A LP SK core octo-SPI node from TI does not advertise any DMA channel, hinting that there is likely no support for it, but yet when the support for the am654 compatible was added, DMA seemed to be used, so just discarding its use with the CQSPI_DISABLE_DAC_MODE quirk for this compatible does not seem the correct approach.
Let's get change the return condition back to:
- return a probe deferral error if we get one
- ignore the return value otherwise
The "error" log level was however likely too high for something that is expected to fail, so let's lower it arbitrarily to the info level.
--- drivers/spi/spi-cadence-quadspi.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/spi/spi-cadence-quadspi.c +6 -0
@@ -1658,6 +1658,12 @@ static int cqspi_request_mmap_dma(structint ret =PTR_ERR (cqspi->rx_chan); cqspi->rx_chan =NULL ; +if (ret == -ENODEV ) { +/* DMA support is not mandatory */ +dev_info (&cqspi->pdev->dev,"No Rx DMA available\n" ); +return 0 ; + } +return dev_err_probe (&cqspi->pdev->dev, ret,"No Rx DMA available\n" ); }init_completion (&cqspi->rx_dma_complete);
Greg Kroah-Hartman
maintainerPATCH 240/449 mtd: rawnand: brcmnand: fix PM resume warning
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamal Dasu <[email protected]>
commit ddc210cf8b8a8be68051ad958bf3e2cef6b681c2 upstream.
Fixed warning on PM resume as shown below caused due to uninitialized struct nand_operation that checks chip select field :
WARN_ON(op->cs >= nanddev_ntargets(&chip->base)
[ 14.588522] ------------[ cut here ]------------ [ 14.588529] WARNING: CPU: 0 PID: 1392 at drivers/mtd/nand/raw/internals.h:139 nand_reset_op+0x1e0/0x1f8 [ 14.588553] Modules linked in: bdc udc_core [ 14.588579] CPU: 0 UID: 0 PID: 1392 Comm: rtcwake Tainted: G W 6.14.0-rc4-g5394eea10651 #16 [ 14.588590] Tainted: [W]=WARN [ 14.588593] Hardware name: Broadcom STB (Flattened Device Tree) [ 14.588598] Call trace: [ 14.588604] dump_backtrace from show_stack+0x18/0x1c [ 14.588622] r7:00000009 r6:0000008b r5:60000153 r4:c0fa558c [ 14.588625] show_stack from dump_stack_lvl+0x70/0x7c [ 14.588639] dump_stack_lvl from dump_stack+0x18/0x1c [ 14.588653] r5:c08d40b0 r4:c1003cb0 [ 14.588656] dump_stack from __warn+0x84/0xe4 [ 14.588668] __warn from warn_slowpath_fmt+0x18c/0x194 [ 14.588678] r7:c08d40b0 r6:c1003cb0 r5:00000000 r4:00000000 [ 14.588681] warn_slowpath_fmt from nand_reset_op+0x1e0/0x1f8 [ 14.588695] r8:70c40dff r7:89705f41 r6:36b4a597 r5:c26c9444 r4:c26b0048 [ 14.588697] nand_reset_op from brcmnand_resume+0x13c/0x150 [ 14.588714] r9:00000000 r8:00000000 r7:c24f8010 r6:c228a3f8 r5:c26c94bc r4:c26b0040 [ 14.588717] brcmnand_resume from platform_pm_resume+0x34/0x54 [ 14.588735] r5:00000010 r4:c0840a50 [ 14.588738] platform_pm_resume from dpm_run_callback+0x5c/0x14c [ 14.588757] dpm_run_callback from device_resume+0xc0/0x324 [ 14.588776] r9:c24f8054 r8:c24f80a0 r7:00000000 r6:00000000 r5:00000010 r4:c24f8010 [ 14.588779] device_resume from dpm_resume+0x130/0x160 [ 14.588799] r9:c22539e4 r8:00000010 r7:c22bebb0 r6:c24f8010 r5:c22539dc r4:c22539b0 [ 14.588802] dpm_resume from dpm_resume_end+0x14/0x20 [ 14.588822] r10:c2204e40 r9:00000000 r8:c228a3fc r7:00000000 r6:00000003 r5:c228a414 [ 14.588826] r4:00000010 [ 14.588828] dpm_resume_end from suspend_devices_and_enter+0x274/0x6f8 [ 14.588848] r5:c228a414 r4:00000000 [ 14.588851] suspend_devices_and_enter from pm_suspend+0x228/0x2bc [ 14.588868] r10:c3502910 r9:c3501f40 r8:00000004 r7:c228a438 r6:c0f95e18 r5:00000000 [ 14.588871] r4:00000003 [ 14.588874] pm_suspend from state_store+0x74/0xd0 [ 14.588889] r7:c228a438 r6:c0f934c8 r5:00000003 r4:00000003 [ 14.588892] state_store from kobj_attr_store+0x1c/0x28 [ 14.588913] r9:00000000 r8:00000000 r7:f09f9f08 r6:00000004 r5:c3502900 r4:c0283250 [ 14.588916] kobj_attr_store from sysfs_kf_write+0x40/0x4c [ 14.588936] r5:c3502900 r4:c0d92a48 [ 14.588939] sysfs_kf_write from kernfs_fop_write_iter+0x104/0x1f0 [ 14.588956] r5:c3502900 r4:c3501f40 [ 14.588960] kernfs_fop_write_iter from vfs_write+0x250/0x420 [ 14.588980] r10:c0e14b48 r9:00000000 r8:c25f5780 r7:00443398 r6:f09f9f68 r5:c34f7f00 [ 14.588983] r4:c042a88c [ 14.588987] vfs_write from ksys_write+0x74/0xe4 [ 14.589005] r10:00000004 r9:c25f5780 r8:c02002fA0 r7:00000000 r6:00000000 r5:c34f7f00 [ 14.589008] r4:c34f7f00 [ 14.589011] ksys_write from sys_write+0x10/0x14 [ 14.589029] r7:00000004 r6:004421c0 r5:00443398 r4:00000004 [ 14.589032] sys_write from ret_fast_syscall+0x0/0x5c [ 14.589044] Exception stack(0xf09f9fa8 to 0xf09f9ff0) [ 14.589050] 9fa0: 00000004 00443398 00000004 00443398 00000004 00000001 [ 14.589056] 9fc0: 00000004 00443398 004421c0 00000004 b6ecbd58 00000008 bebfbc38 0043eb78 [ 14.589062] 9fe0: 00440eb0 bebfbaf8 b6de18a0 b6e579e8 [ 14.589065] ---[ end trace 0000000000000000 ]---
The fix uses the higher level nand_reset(chip, chipnr); where chipnr = 0, when doing PM resume operation in compliance with the controller support for single die nand chip. Switching from nand_reset_op() to nand_reset() implies more than just setting the cs field op->cs, it also reconfigures the data interface (ie. the timings). Tested and confirmed the NAND chip is in sync timing wise with host after the fix.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 -1
@@ -3008,7 +3008,7 @@ static int brcmnand_resume(struct devicebrcmnand_save_restore_cs_config (host,1 );/* Reset the chip, required by some chips after power-up */ -nand_reset_op (chip); +nand_reset (chip,0 ); }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 241/449 tpm, tpm_tis: Fix timeout handling when waiting for TPM status
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan McDowell <[email protected]>
commit 7146dffa875cd00e7a7f918e1fce79c7593ac1fa upstream.
The change to only use interrupts to handle supported status changes introduced an issue when it is necessary to poll for the status. Rather than checking for the status after sleeping the code now sleeps after the check. This means a correct, but slower, status change on the part of the TPM can be missed, resulting in a spurious timeout error, especially on a more loaded system. Switch back to sleeping *then* checking. An up front check of the status has been done at the start of the function, so this does not cause an additional delay when the status is already what we're looking for.
--- drivers/char/tpm/tpm_tis_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_core.c +1 -2
@@ -114,11 +114,10 @@ again:return 0 ;/* process status changes without irq support */ do { +usleep_range (priv->timeout_min, priv->timeout_max); status = chip->ops->status (chip);if ((status & mask) == mask)return 0 ; -usleep_range (priv->timeout_min, - priv->timeout_max); }while (time_before (jiffies, stop));return -ETIME ; }
Greg Kroah-Hartman
maintainerPATCH 242/449 accel/ivpu: Fix PM related deadlocks in MS IOCTLs
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit d893da85e06edf54737bb80648bb58ba8fd56d9f upstream.
Prevent runtime resume/suspend while MS IOCTLs are in progress. Failed suspend will call ivpu_ms_cleanup() that would try to acquire file_priv->ms_lock, which is already held by the IOCTLs.
--- drivers/accel/ivpu/ivpu_debugfs.c | 4 ++-- drivers/accel/ivpu/ivpu_ms.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-)
drivers/accel/ivpu/ivpu_debugfs.c +2 -2
@@ -331,7 +331,7 @@ ivpu_force_recovery_fn(struct file *filereturn -EINVAL ; ret =ivpu_rpm_get (vdev); -if (ret) +if (ret <0 )return ret;ivpu_pm_trigger_recovery (vdev,"debugfs" );
@@ -382,7 +382,7 @@ static int dct_active_set(void *data, u6return -EINVAL ; ret =ivpu_rpm_get (vdev); -if (ret) +if (ret <0 )return ret;if (active_percent)
drivers/accel/ivpu/ivpu_ms.c +18 -0
@@ -44,6 +44,10 @@ int ivpu_ms_start_ioctl(struct drm_devic args->sampling_period_ns < MS_MIN_SAMPLE_PERIOD_NS)return -EINVAL ; + ret =ivpu_rpm_get (vdev); +if (ret <0 ) +return ret; +mutex_lock (&file_priv->ms_lock);if (get_instance_by_mask (file_priv, args->metric_group_mask)) {
@@ -96,6 +100,8 @@ err_free_ms:kfree (ms); unlock:mutex_unlock (&file_priv->ms_lock); + +ivpu_rpm_put (vdev);return ret; }
@@ -160,6 +166,10 @@ int ivpu_ms_get_data_ioctl(struct drm_deif (!args->metric_group_mask)return -EINVAL ; + ret =ivpu_rpm_get (vdev); +if (ret <0 ) +return ret; +mutex_lock (&file_priv->ms_lock); ms =get_instance_by_mask (file_priv, args->metric_group_mask);
@@ -187,6 +197,7 @@ int ivpu_ms_get_data_ioctl(struct drm_de unlock:mutex_unlock (&file_priv->ms_lock); +ivpu_rpm_put (vdev);return ret; }
@@ -204,11 +215,17 @@ int ivpu_ms_stop_ioctl(struct drm_device {struct ivpu_file_priv *file_priv = file->driver_priv;struct drm_ivpu_metric_streamer_stop *args = data; +struct ivpu_device *vdev = file_priv->vdev;struct ivpu_ms_instance *ms; +int ret;if (!args->metric_group_mask)return -EINVAL ; + ret =ivpu_rpm_get (vdev); +if (ret <0 ) +return ret; +mutex_lock (&file_priv->ms_lock); ms =get_instance_by_mask (file_priv, args->metric_group_mask);
@@ -217,6 +234,7 @@ int ivpu_ms_stop_ioctl(struct drm_devicemutex_unlock (&file_priv->ms_lock); +ivpu_rpm_put (vdev);return ms ?0 : -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 243/449 media: ov08x40: Properly turn sensor on/off when runtime-suspended
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 69dea0ed84611b2b83f4f5fb4f5a1ec4b6bc902d upstream.
Commit df1ae2251a50 ("media: ov08x40: Add OF probe support") added support for a reset GPIO, regulators and a clk provider controlled through new ov08x40_power_off() and ov08x40_power_on() functions.
But it missed adding a pm ops structure to call these functions on runtime suspend/resume. Add the missing pm ops and only call ov08x40_power_off() on remove() when not already runtime-suspended to avoid unbalanced regulator / clock disable calls.
--- drivers/media/i2c/ov08x40.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/i2c/ov08x40.c +6 -2
@@ -2324,11 +2324,14 @@ static void ov08x40_remove(struct i2c_clov08x40_free_controls (ov08x);pm_runtime_disable (&client->dev); +if (!pm_runtime_status_suspended (&client->dev)) +ov08x40_power_off (&client->dev);pm_runtime_set_suspended (&client->dev); - -ov08x40_power_off (&client->dev); } +static DEFINE_RUNTIME_DEV_PM_OPS(ov08x40_pm_ops, ov08x40_power_off, + ov08x40_power_on, NULL); +#ifdef CONFIG_ACPI static const struct acpi_device_id ov08x40_acpi_ids[] = { {"OVTI08F4"},
@@ -2349,6 +2352,7 @@ static struct i2c_driver ov08x40_i2c_dri .name = "ov08x40", .acpi_match_table = ACPI_PTR(ov08x40_acpi_ids), .of_match_table = ov08x40_of_match, + .pm = pm_sleep_ptr(&ov08x40_pm_ops), }, .probe = ov08x40_probe, .remove = ov08x40_remove,
Greg Kroah-Hartman
maintainerPATCH 244/449 media: streamzap: prevent processing IR data on URB failure
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
commit 549f6d348167fb2f7800ed7c8d4bce9630c74498 upstream.
If streamzap_callback() receives an urb with any non-critical error status, i.e. any error code other than -ECONNRESET, -ENOENT or -ESHUTDOWN, it will try to process IR data, ignoring a possible transfer failure.
Make streamzap_callback() process IR data only when urb->status is 0. Move processing logic to a separate function to make code cleaner and more similar to the URB completion handlers in other RC drivers.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/media/rc/streamzap.c | 68 ++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 30 deletions(-)
drivers/media/rc/streamzap.c +38 -30
@@ -138,39 +138,10 @@ static void sz_push_half_space(struct stsz_push_full_space (sz, value &SZ_SPACE_MASK ); } -/* -* streamzap_callback - usb IRQ handler callback -* -* This procedure is invoked on reception of data from -* the usb remote. -*/ -static void streamzap_callback (struct urb *urb) +static void sz_process_ir_data (struct streamzap_ir *sz,int len) { -struct streamzap_ir *sz;unsigned int i; -int len; - -if (!urb) -return ; - - sz = urb->context; - len = urb->actual_length; - -switch (urb->status) { -case -ECONNRESET : -case -ENOENT : -case -ESHUTDOWN : -/* -* this urb is terminated, clean up. -* sz might already be invalid at this point -*/ -dev_err (sz->dev,"urb terminated, status: %d\n" , urb->status); -return ; -default : -break ; - } -dev_dbg (sz->dev,"%s: received urb, len %d\n" , __func__, len);for (i =0 ; i < len; i++) {dev_dbg (sz->dev,"sz->buf_in[%d]: %x\n" , i, (unsigned char )sz->buf_in[i]);
@@ -219,6 +190,43 @@ static void streamzap_callback(struct ur }ir_raw_event_handle (sz->rdev); +} + +/* +* streamzap_callback - usb IRQ handler callback +* +* This procedure is invoked on reception of data from +* the usb remote. +*/ +static void streamzap_callback (struct urb *urb) +{ +struct streamzap_ir *sz; +int len; + +if (!urb) +return ; + + sz = urb->context; + len = urb->actual_length; + +switch (urb->status) { +case 0 : +dev_dbg (sz->dev,"%s: received urb, len %d\n" , __func__, len); +sz_process_ir_data (sz, len); +break ; +case -ECONNRESET : +case -ENOENT : +case -ESHUTDOWN : +/* +* this urb is terminated, clean up. +* sz might already be invalid at this point +*/ +dev_err (sz->dev,"urb terminated, status: %d\n" , urb->status); +return ; +default : +break ; + } +usb_submit_urb (urb,GFP_ATOMIC ); }
Greg Kroah-Hartman
maintainerPATCH 245/449 media: hi556: Fix memory leak (on error) in hi556_check_hwcfg()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit ed554da65abd0c561e40d35272d1a61d030fe977 upstream.
Commit 7d968b5badfc ("media: hi556: Return -EPROBE_DEFER if no endpoint is found") moved the v4l2_fwnode_endpoint_alloc_parse() call in hi556_check_hwcfg() up, but it did not make the error-exit paths between the old and new call-site use "goto check_hwcfg_error;" to free the bus_cfg on errors.
Add the missing "goto check_hwcfg_error;" statements to fix a memleak on early error-exits from hi556_check_hwcfg().
--- drivers/media/i2c/hi556.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/i2c/hi556.c +3 -2
@@ -1230,12 +1230,13 @@ static int hi556_check_hwcfg(struct devi ret =fwnode_property_read_u32 (fwnode,"clock-frequency" , &mclk);if (ret) {dev_err (dev,"can't get clock frequency" ); -return ret; + goto check_hwcfg_error; }if (mclk !=HI556_MCLK ) {dev_err (dev,"external clock %d is not supported" , mclk); -return -EINVAL ; + ret = -EINVAL ; + goto check_hwcfg_error; }if (bus_cfg.bus.mipi_csi2.num_data_lanes !=2 ) {
Greg Kroah-Hartman
maintainerPATCH 246/449 media: visl: Fix ERANGE error when setting enum controls
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dufresne <[email protected]>
commit d98e9213a768a3cc3a99f5e1abe09ad3baff2104 upstream.
The visl driver supports both frame and slice mode, with and without a start-code. But, the range and default for these enum controls was not set, which currently limits the decoder to enums with a value of 0. Fix this by setting the decoder mode and start code controls for both the H.264 and HEVC codecs.
--- drivers/media/test-drivers/visl/visl-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/media/test-drivers/visl/visl-core.c +12 -0
@@ -161,9 +161,15 @@ static const struct visl_ctrl_desc visl_ }, { .cfg.id = V4L2_CID_STATELESS_H264_DECODE_MODE, + .cfg.min = V4L2_STATELESS_H264_DECODE_MODE_SLICE_BASED, + .cfg.max = V4L2_STATELESS_H264_DECODE_MODE_FRAME_BASED, + .cfg.def = V4L2_STATELESS_H264_DECODE_MODE_SLICE_BASED, }, { .cfg.id = V4L2_CID_STATELESS_H264_START_CODE, + .cfg.min = V4L2_STATELESS_H264_START_CODE_NONE, + .cfg.max = V4L2_STATELESS_H264_START_CODE_ANNEX_B, + .cfg.def = V4L2_STATELESS_H264_START_CODE_NONE, }, { .cfg.id = V4L2_CID_STATELESS_H264_SLICE_PARAMS,
@@ -198,9 +204,15 @@ static const struct visl_ctrl_desc visl_ }, { .cfg.id = V4L2_CID_STATELESS_HEVC_DECODE_MODE, + .cfg.min = V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED, + .cfg.max = V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED, + .cfg.def = V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED, }, { .cfg.id = V4L2_CID_STATELESS_HEVC_START_CODE, + .cfg.min = V4L2_STATELESS_HEVC_START_CODE_NONE, + .cfg.max = V4L2_STATELESS_HEVC_START_CODE_ANNEX_B, + .cfg.def = V4L2_STATELESS_HEVC_START_CODE_NONE, }, { .cfg.id = V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS,
Greg Kroah-Hartman
maintainerPATCH 247/449 media: platform: stm32: Add check for clk_enable()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit f883f34b6a46b1a09d44d7f94c3cd72fe0e8f93b upstream.
Add check for the return value of clk_enable() to gurantee the success.
--- drivers/media/platform/st/stm32/dma2d/dma2d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/st/stm32/dma2d/dma2d.c +2 -1
@@ -490,7 +490,8 @@ static void device_run(void *prv) dst->sequence = frm_cap->sequence++;v4l2_m2m_buf_copy_metadata (src, dst, true); -clk_enable (dev->gate); +if (clk_enable (dev->gate)) + goto end;dma2d_config_fg (dev, frm_out,vb2_dma_contig_plane_dma_addr (&src->vb2_buf,0 ));
Greg Kroah-Hartman
maintainerPATCH 248/449 media: xilinx-tpg: fix double put in xtpg_parse_of()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 347d84833faac79a105e438168cedf0b9658445b upstream.
This loop was recently converted to use for_each_of_graph_port() which automatically does __cleanup__ on the "port" iterator variable. Delete the calls to of_node_put(port) to avoid a double put bug.
--- drivers/media/platform/xilinx/xilinx-tpg.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/platform/xilinx/xilinx-tpg.c +0 -2
@@ -722,7 +722,6 @@ static int xtpg_parse_of(struct xtpg_dev format =xvip_of_get_format (port);if (IS_ERR (format)) {dev_err (dev,"invalid format in DT" ); -of_node_put (port);return PTR_ERR (format); }
@@ -731,7 +730,6 @@ static int xtpg_parse_of(struct xtpg_dev xtpg->vip_format = format; }else if (xtpg->vip_format != format) {dev_err (dev,"in/out format mismatch in DT" ); -of_node_put (port);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 249/449 media: imx219: Adjust PLL settings based on the number of MIPI lanes
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
commit 591a07588c03437dbcc3addfff07675de95a461e upstream.
Commit ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation") added support for device tree to allow configuration of the sensor to use 4 lanes with a link frequency of 363MHz, and amended the advertised pixel rate to 280.8MPix/s.
However it didn't change any of the PLL settings, so actually it would have been running overclocked in the MIPI block, and with the frame rate and exposure calculations being wrong as the pixel rate was unchanged.
The pixel rate and link frequency advertised were taken from the "Clock Setting Example" section of the datasheet. However those are based on an external clock of 12MHz, and are unachievable with a clock of 24MHz - it seems PREPLLCLK_VT_DIV and PREPLLCK_OP_DIV can ONLY be set via the automatic configuration documented in "9-1-2 EXCK_FREQ setting depend on INCK frequency", not by writing the registers.
The closest we can get with a 24MHz clock is 281.6MPix/s and 364MHz.
Dropping all support for the 363MHz link frequency would cause problems for existing users, so allow it, but log a warning that the requested value is being changed to the supported one.
--- drivers/media/i2c/imx219.c | 93 +++++++++++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 24 deletions(-)
drivers/media/i2c/imx219.c +69 -24
@@ -133,10 +133,11 @@/* Pixel rate is fixed for all the modes */ #define IMX219_PIXEL_RATE 182400000 -#define IMX219_PIXEL_RATE_4LANE 280800000 +#define IMX219_PIXEL_RATE_4LANE 281600000#define IMX219_DEFAULT_LINK_FREQ 456000000 -#define IMX219_DEFAULT_LINK_FREQ_4LANE 363000000 +#define IMX219_DEFAULT_LINK_FREQ_4LANE_UNSUPPORTED 363000000 +#define IMX219_DEFAULT_LINK_FREQ_4LANE 364000000/* IMX219 native and active pixel array size. */ #define IMX219_NATIVE_WIDTH 3296U
@@ -168,15 +169,6 @@ static const struct cci_reg_sequence imx { CCI_REG8(0x30eb), 0x05 }, { CCI_REG8(0x30eb), 0x09 }, -/* PLL Clock Table */ - { IMX219_REG_VTPXCK_DIV, 5 }, - { IMX219_REG_VTSYCK_DIV, 1 }, - { IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */ - { IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */ - { IMX219_REG_PLL_VT_MPY, 57 }, - { IMX219_REG_OPSYCK_DIV, 1 }, - { IMX219_REG_PLL_OP_MPY, 114 }, -/* Undocumented registers */ { CCI_REG8(0x455e), 0x00 }, { CCI_REG8(0x471e), 0x4b },
@@ -201,12 +193,45 @@ static const struct cci_reg_sequence imx { IMX219_REG_EXCK_FREQ, IMX219_EXCK_FREQ(IMX219_XCLK_FREQ / 1000000) }, }; +static const struct cci_reg_sequence imx219_2lane_regs[] = { +/* PLL Clock Table */ + {IMX219_REG_VTPXCK_DIV ,5 }, + {IMX219_REG_VTSYCK_DIV ,1 }, + {IMX219_REG_PREPLLCK_VT_DIV ,3 },/* 0x03 = AUTO set */ + {IMX219_REG_PREPLLCK_OP_DIV ,3 },/* 0x03 = AUTO set */ + {IMX219_REG_PLL_VT_MPY ,57 }, + {IMX219_REG_OPSYCK_DIV ,1 }, + {IMX219_REG_PLL_OP_MPY ,114 }, + +/* 2-Lane CSI Mode */ + {IMX219_REG_CSI_LANE_MODE ,IMX219_CSI_2_LANE_MODE }, +}; + +static const struct cci_reg_sequence imx219_4lane_regs[] = { +/* PLL Clock Table */ + {IMX219_REG_VTPXCK_DIV ,5 }, + {IMX219_REG_VTSYCK_DIV ,1 }, + {IMX219_REG_PREPLLCK_VT_DIV ,3 },/* 0x03 = AUTO set */ + {IMX219_REG_PREPLLCK_OP_DIV ,3 },/* 0x03 = AUTO set */ + {IMX219_REG_PLL_VT_MPY ,88 }, + {IMX219_REG_OPSYCK_DIV ,1 }, + {IMX219_REG_PLL_OP_MPY ,91 }, + +/* 4-Lane CSI Mode */ + {IMX219_REG_CSI_LANE_MODE ,IMX219_CSI_4_LANE_MODE }, +}; +static const s64 imx219_link_freq_menu[] = {IMX219_DEFAULT_LINK_FREQ , };static const s64 imx219_link_freq_4lane_menu[] = {IMX219_DEFAULT_LINK_FREQ_4LANE , +/* +* This will never be advertised to userspace, but will be used for +* v4l2_link_freq_to_bitmap +*/ +IMX219_DEFAULT_LINK_FREQ_4LANE_UNSUPPORTED , }; static const char * const imx219_test_pattern_menu[] = {
@@ -662,9 +687,11 @@ static int imx219_set_framefmt(struct imstatic int imx219_configure_lanes (struct imx219 *imx219) { -return cci_write (imx219->regmap,IMX219_REG_CSI_LANE_MODE , - imx219->lanes ==2 ?IMX219_CSI_2_LANE_MODE : -IMX219_CSI_4_LANE_MODE ,NULL ); +/* Write the appropriate PLL settings for the number of MIPI lanes */ +return cci_multi_reg_write (imx219->regmap, + imx219->lanes ==2 ? imx219_2lane_regs : imx219_4lane_regs, + imx219->lanes ==2 ?ARRAY_SIZE (imx219_2lane_regs) : +ARRAY_SIZE (imx219_4lane_regs),NULL ); }; static int imx219_start_streaming(struct imx219 *imx219,
@@ -1035,6 +1062,7 @@ static int imx219_check_hwcfg(struct devstruct v4l2_fwnode_endpoint ep_cfg = { .bus_type =V4L2_MBUS_CSI2_DPHY }; +unsigned long link_freq_bitmap;int ret = -EINVAL ; endpoint =fwnode_graph_get_next_endpoint (dev_fwnode (dev),NULL );
@@ -1056,23 +1084,40 @@ static int imx219_check_hwcfg(struct dev imx219->lanes = ep_cfg.bus.mipi_csi2.num_data_lanes;/* Check the link frequency set in device tree */ -if (!ep_cfg.nr_of_link_frequencies) { -dev_err_probe (dev, -EINVAL , -"link-frequency property not found in DT\n" ); - goto error_out; +switch (imx219->lanes) { +case 2 : + ret =v4l2_link_freq_to_bitmap (dev, + ep_cfg.link_frequencies, + ep_cfg.nr_of_link_frequencies, + imx219_link_freq_menu, +ARRAY_SIZE (imx219_link_freq_menu), + &link_freq_bitmap); +break ; +case 4 : + ret =v4l2_link_freq_to_bitmap (dev, + ep_cfg.link_frequencies, + ep_cfg.nr_of_link_frequencies, + imx219_link_freq_4lane_menu, +ARRAY_SIZE (imx219_link_freq_4lane_menu), + &link_freq_bitmap); + +if (!ret && (link_freq_bitmap &BIT (1 ))) { +dev_warn (dev,"Link frequency of %d not supported, but has been incorrectly advertised previously\n" , +IMX219_DEFAULT_LINK_FREQ_4LANE_UNSUPPORTED ); +dev_warn (dev,"Using link frequency of %d\n" , +IMX219_DEFAULT_LINK_FREQ_4LANE ); + link_freq_bitmap |=BIT (0 ); + } +break ; } -if (ep_cfg.nr_of_link_frequencies !=1 || - (ep_cfg.link_frequencies[0 ] != ((imx219->lanes ==2 ) ? -IMX219_DEFAULT_LINK_FREQ :IMX219_DEFAULT_LINK_FREQ_4LANE ))) { +if (ret || !(link_freq_bitmap &BIT (0 ))) { + ret = -EINVAL ;dev_err_probe (dev, -EINVAL ,"Link frequency not supported: %lld\n" , ep_cfg.link_frequencies[0 ]); - goto error_out; } - ret =0 ; - error_out:v4l2_fwnode_endpoint_free (&ep_cfg);fwnode_handle_put (endpoint);
Greg Kroah-Hartman
maintainerPATCH 250/449 media: v4l2-dv-timings: prevent possible overflow in v4l2_detect_gtf()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karina Yankevich <[email protected]>
commit 3edd1fc48d2c045e8259561797c89fe78f01717e upstream.
In v4l2_detect_gtf(), it seems safer to cast the 32-bit image_width variable to the 64-bit type u64 before multiplying to avoid a possible overflow. The resulting object code even seems to look better, at least on x86_64.
Found by Linux Verification Center (linuxtesting.org) with Svace.
[Sergey: rewrote the patch subject/descripition]
--- drivers/media/v4l2-core/v4l2-dv-timings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/v4l2-dv-timings.c +2 -2
@@ -764,7 +764,7 @@ bool v4l2_detect_gtf(unsigned int frame_u64 num;u32 den; - num = ((image_width *GTF_D_C_PRIME * (u64 )hfreq) - + num = (((u64 )image_width *GTF_D_C_PRIME * hfreq) - ((u64 )image_width *GTF_D_M_PRIME *1000 )); den = (hfreq * (100 -GTF_D_C_PRIME ) +GTF_D_M_PRIME *1000 ) * (2 *GTF_CELL_GRAN );
@@ -774,7 +774,7 @@ bool v4l2_detect_gtf(unsigned int frame_u64 num;u32 den; - num = ((image_width *GTF_S_C_PRIME * (u64 )hfreq) - + num = (((u64 )image_width *GTF_S_C_PRIME * hfreq) - ((u64 )image_width *GTF_S_M_PRIME *1000 )); den = (hfreq * (100 -GTF_S_C_PRIME ) +GTF_S_M_PRIME *1000 ) * (2 *GTF_CELL_GRAN );
Greg Kroah-Hartman
maintainerPATCH 251/449 Revert "media: imx214: Fix the error handling in imx214_probe()"
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit abd88757252c2a2cea7909f3922de1f0e9e04002 upstream.
This reverts commit 9bc92332cc3f06fda3c6e2423995ca2da0a7ec9a.
Revert this "fix" as it's not really helpful but makes backporting a proper fix harder.
--- drivers/media/i2c/imx214.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/i2c/imx214.c +0 -1
@@ -1114,7 +1114,6 @@ free_ctrl:v4l2_ctrl_handler_free (&imx214->ctrls); error_power_off:pm_runtime_disable (imx214->dev); -regulator_bulk_disable (IMX214_NUM_SUPPLIES , imx214->supplies);return ret; }
Greg Kroah-Hartman
maintainerPATCH 252/449 media: i2c: ccs: Set the devices runtime PM status correctly in remove
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit e04604583095faf455b3490b004254a225fd60d4 upstream.
Set the device's runtime PM status to suspended in device removal only if it wasn't suspended already.
--- drivers/media/i2c/ccs/ccs-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/i2c/ccs/ccs-core.c +3 -2
@@ -3595,9 +3595,10 @@ static void ccs_remove(struct i2c_clientv4l2_async_unregister_subdev (subdev);pm_runtime_disable (&client->dev); -if (!pm_runtime_status_suspended (&client->dev)) +if (!pm_runtime_status_suspended (&client->dev)) {ccs_power_off (&client->dev); -pm_runtime_set_suspended (&client->dev); +pm_runtime_set_suspended (&client->dev); + }for (i =0 ; i < sensor->ssds_used; i++)v4l2_device_unregister_subdev (&sensor->ssds[i].sd);
Greg Kroah-Hartman
maintainerPATCH 253/449 media: i2c: ccs: Set the devices runtime PM status correctly in probe
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 80704d14f1bd3628f578510e0a88b66824990ef6 upstream.
Set the device's runtime PM status to suspended in probe error paths where it was previously set to active.
--- drivers/media/i2c/ccs/ccs-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ccs/ccs-core.c +1 -0
@@ -3566,6 +3566,7 @@ static int ccs_probe(struct i2c_client * out_disable_runtime_pm:pm_runtime_put_noidle (&client->dev);pm_runtime_disable (&client->dev); +pm_runtime_set_suspended (&client->dev); out_cleanup:ccs_cleanup (sensor);
Greg Kroah-Hartman
maintainerPATCH 254/449 media: i2c: ov7251: Set enable GPIO low in probe
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit a1963698d59cec83df640ded343af08b76c8e9c5 upstream.
Set the enable GPIO low when acquiring it.
--- drivers/media/i2c/ov7251.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov7251.c +1 -1
@@ -1696,7 +1696,7 @@ static int ov7251_probe(struct i2c_clienreturn PTR_ERR (ov7251->analog_regulator); } - ov7251->enable_gpio =devm_gpiod_get (dev,"enable" ,GPIOD_OUT_HIGH ); + ov7251->enable_gpio =devm_gpiod_get (dev,"enable" ,GPIOD_OUT_LOW );if (IS_ERR (ov7251->enable_gpio)) {dev_err (dev,"cannot get enable gpio\n" );return PTR_ERR (ov7251->enable_gpio);
Greg Kroah-Hartman
maintainerPATCH 255/449 media: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIO
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 3d391292cdd53984ec1b9a1f6182a62a62751e03 upstream.
Lift the xshutdown (enable) GPIO 1 ms after enabling the regulators, as required by the sensor's power-up sequence.
--- drivers/media/i2c/ov7251.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ov7251.c +2 -0
@@ -922,6 +922,8 @@ static int ov7251_set_power_on(struct dereturn ret; } +usleep_range (1000 ,1100 ); +gpiod_set_value_cansleep (ov7251->enable_gpio,1 );/* wait at least 65536 external clock cycles */
Greg Kroah-Hartman
maintainerPATCH 256/449 media: nuvoton: Fix reference handling of ece_node
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 8ba4ef40ad6ca62368292a69855324213181abfb upstream.
Make sure all the code paths call of_node_put().
Instead of manually calling of_node_put, use the __free macros/helpers.
--- drivers/media/platform/nuvoton/npcm-video.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/nuvoton/npcm-video.c +1 -2
@@ -1648,8 +1648,8 @@ rel_ctrl_handler:static int npcm_video_ece_init (struct npcm_video *video) { + struct device_node *ece_node __free(device_node) = NULL;struct device *dev = video->dev; -struct device_node *ece_node;struct platform_device *ece_pdev;void __iomem *regs;
@@ -1669,7 +1669,6 @@ static int npcm_video_ece_init(struct npdev_err (dev,"Failed to find ECE device\n" );return -ENODEV ; } -of_node_put (ece_node); regs =devm_platform_ioremap_resource (ece_pdev,0 );if (IS_ERR (regs)) {
Greg Kroah-Hartman
maintainerPATCH 257/449 media: nuvoton: Fix reference handling of ece_pdev
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 453d5cadab1bde8e6fdd5bd05f4200338cb21e72 upstream.
When we obtain a reference to of a platform_device, we need to release it via put_device.
Found by cocci:
./platform/nuvoton/npcm-video.c:1677:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. ./platform/nuvoton/npcm-video.c:1684:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. ./platform/nuvoton/npcm-video.c:1690:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. ./platform/nuvoton/npcm-video.c:1694:1-7: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function.
Instead of manually calling put_device, use the __free macros.
--- drivers/media/platform/nuvoton/npcm-video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/nuvoton/npcm-video.c +2 -1
@@ -1669,6 +1669,7 @@ static int npcm_video_ece_init(struct npdev_err (dev,"Failed to find ECE device\n" );return -ENODEV ; } + struct device *ece_dev __free(put_device) = &ece_pdev->dev; regs =devm_platform_ioremap_resource (ece_pdev,0 );if (IS_ERR (regs)) {
@@ -1683,7 +1684,7 @@ static int npcm_video_ece_init(struct npreturn PTR_ERR (video->ece.regmap); } - video->ece.reset =devm_reset_control_get (&ece_pdev->dev,NULL ); + video->ece.reset =devm_reset_control_get (ece_dev,NULL );if (IS_ERR (video->ece.reset)) {dev_err (dev,"Failed to get ECE reset control in DTS\n" );return PTR_ERR (video->ece.reset);
Greg Kroah-Hartman
maintainerPATCH 258/449 media: venus: hfi_parser: add check to avoid out of bound access
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikash Garodia <[email protected]>
commit 172bf5a9ef70a399bb227809db78442dc01d9e48 upstream.
There is a possibility that init_codecs is invoked multiple times during manipulated payload from video firmware. In such case, if codecs_count can get incremented to value more than MAX_CODEC_NUM, there can be OOB access. Reset the count so that it always starts from beginning.
--- drivers/media/platform/qcom/venus/hfi_parser.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/qcom/venus/hfi_parser.c +2 -0
@@ -19,6 +19,8 @@ static void init_codecs(struct venus_corstruct hfi_plat_caps *caps = core->caps, *cap;unsigned long bit; + core->codecs_count =0 ; +if (hweight_long (core->dec_codecs) +hweight_long (core->enc_codecs) >MAX_CODEC_NUM )return ;
Greg Kroah-Hartman
maintainerPATCH 259/449 media: venus: hfi_parser: refactor hfi packet parsing logic
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vikash Garodia <[email protected]>
commit 9edaaa8e3e15aab1ca413ab50556de1975bcb329 upstream.
words_count denotes the number of words in total payload, while data points to payload of various property within it. When words_count reaches last word, data can access memory beyond the total payload. This can lead to OOB access. With this patch, the utility api for handling individual properties now returns the size of data consumed. Accordingly remaining bytes are calculated before parsing the payload, thereby eliminates the OOB access possibilities.
--- drivers/media/platform/qcom/venus/hfi_parser.c | 98 ++++++++++++++++++------- 1 file changed, 72 insertions(+), 26 deletions(-)
drivers/media/platform/qcom/venus/hfi_parser.c +72 -26
@@ -64,7 +64,7 @@ fill_buf_mode(struct hfi_plat_caps *cap, cap->cap_bufs_mode_dynamic = true; } -static void +static int parse_alloc_mode (struct venus_core *core,u32 codecs,u32 domain,void *data) {struct hfi_buffer_alloc_mode_supported *mode = data;
@@ -72,7 +72,7 @@ parse_alloc_mode(struct venus_core *coreu32 *type;if (num_entries >MAX_ALLOC_MODE_ENTRIES ) -return ; +return -EINVAL ; type = mode->data;
@@ -84,6 +84,8 @@ parse_alloc_mode(struct venus_core *core type++; } + +return sizeof (*mode); } static void fill_profile_level(struct hfi_plat_caps *cap, const void *data,
@@ -98,7 +100,7 @@ static void fill_profile_level(struct hf cap->num_pl += num; } -static void +static int parse_profile_level (struct venus_core *core,u32 codecs,u32 domain,void *data) {struct hfi_profile_level_supported *pl = data;
@@ -106,12 +108,14 @@ parse_profile_level(struct venus_core *cstruct hfi_profile_level pl_arr[HFI_MAX_PROFILE_COUNT ] = {};if (pl->profile_count >HFI_MAX_PROFILE_COUNT ) -return ; +return -EINVAL ;memcpy (pl_arr, proflevel, pl->profile_count *sizeof (*proflevel));for_each_codec (core->caps,ARRAY_SIZE (core->caps), codecs, domain, fill_profile_level, pl_arr, pl->profile_count); + +return pl->profile_count *sizeof (*proflevel) +sizeof (u32); } static void
@@ -126,7 +130,7 @@ fill_caps(struct hfi_plat_caps *cap, con cap->num_caps += num; } -static void +static int parse_caps (struct venus_core *core,u32 codecs,u32 domain,void *data) {struct hfi_capabilities *caps = data;
@@ -135,12 +139,14 @@ parse_caps(struct venus_core *core, u32struct hfi_capability caps_arr[MAX_CAP_ENTRIES ] = {};if (num_caps >MAX_CAP_ENTRIES ) -return ; +return -EINVAL ;memcpy (caps_arr, cap, num_caps *sizeof (*cap));for_each_codec (core->caps,ARRAY_SIZE (core->caps), codecs, domain, fill_caps, caps_arr, num_caps); + +return sizeof (*caps); } static void fill_raw_fmts(struct hfi_plat_caps *cap, const void *fmts,
@@ -155,7 +161,7 @@ static void fill_raw_fmts(struct hfi_pla cap->num_fmts += num_fmts; } -static void +static int parse_raw_formats (struct venus_core *core,u32 codecs,u32 domain,void *data) {struct hfi_uncompressed_format_supported *fmt = data;
@@ -164,7 +170,8 @@ parse_raw_formats(struct venus_core *corstruct raw_formats rawfmts[MAX_FMT_ENTRIES ] = {};u32 entries = fmt->format_entries;unsigned int i =0 ; -u32 num_planes; +u32 num_planes =0 ; +u32 size;while (entries) { num_planes = pinfo->num_planes;
@@ -174,7 +181,7 @@ parse_raw_formats(struct venus_core *cor i++;if (i >=MAX_FMT_ENTRIES ) -return ; +return -EINVAL ;if (pinfo->num_planes >MAX_PLANES )break ;
@@ -186,9 +193,13 @@ parse_raw_formats(struct venus_core *corfor_each_codec (core->caps,ARRAY_SIZE (core->caps), codecs, domain, fill_raw_fmts, rawfmts, i); + size = fmt->format_entries * (sizeof (*constr) * num_planes +2 *sizeof (u32)) + +2 *sizeof (u32); + +return size; } -static void parse_codecs (struct venus_core *core,void *data) +static int parse_codecs (struct venus_core *core,void *data) {struct hfi_codec_supported *codecs = data;
@@ -200,21 +211,27 @@ static void parse_codecs(struct venus_co core->dec_codecs &= ~HFI_VIDEO_CODEC_SPARK ; core->enc_codecs &= ~HFI_VIDEO_CODEC_HEVC ; } + +return sizeof (*codecs); } -static void parse_max_sessions (struct venus_core *core,const void *data) +static int parse_max_sessions (struct venus_core *core,const void *data) {const struct hfi_max_sessions_supported *sessions = data; core->max_sessions_supported = sessions->max_sessions; + +return sizeof (*sessions); } -static void parse_codecs_mask (u32 *codecs,u32 *domain,void *data) +static int parse_codecs_mask (u32 *codecs,u32 *domain,void *data) {struct hfi_codec_mask_supported *mask = data; *codecs = mask->codecs; *domain = mask->video_domains; + +return sizeof (*mask); }static void parser_init (struct venus_inst *inst,u32 *codecs,u32 *domain)
@@ -283,8 +300,9 @@ static int hfi_platform_parser(struct veu32 hfi_parser (struct venus_core *core,struct venus_inst *inst,void *buf,u32 size) { -unsigned int words_count = size >>2 ; -u32 *word = buf, *data, codecs =0 , domain =0 ; +u32 *words = buf, *payload, codecs =0 , domain =0 ; +u32 *frame_size = buf + size; +u32 rem_bytes = size;int ret; ret =hfi_platform_parser (core, inst);
@@ -301,38 +319,66 @@ u32 hfi_parser(struct venus_core *core,memset (core->caps,0 ,sizeof (core->caps)); } -while (words_count) { - data = word +1 ; +while (words < frame_size) { + payload = words +1 ; -switch (*word) { +switch (*words) {case HFI_PROPERTY_PARAM_CODEC_SUPPORTED : -parse_codecs (core, data); +if (rem_bytes <=sizeof (struct hfi_codec_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_codecs (core, payload); +if (ret <0 ) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; +init_codecs (core);break ;case HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED : -parse_max_sessions (core, data); +if (rem_bytes <=sizeof (struct hfi_max_sessions_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_max_sessions (core, payload);break ;case HFI_PROPERTY_PARAM_CODEC_MASK_SUPPORTED : -parse_codecs_mask (&codecs, &domain, data); +if (rem_bytes <=sizeof (struct hfi_codec_mask_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_codecs_mask (&codecs, &domain, payload);break ;case HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SUPPORTED : -parse_raw_formats (core, codecs, domain, data); +if (rem_bytes <=sizeof (struct hfi_uncompressed_format_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_raw_formats (core, codecs, domain, payload);break ;case HFI_PROPERTY_PARAM_CAPABILITY_SUPPORTED : -parse_caps (core, codecs, domain, data); +if (rem_bytes <=sizeof (struct hfi_capabilities )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_caps (core, codecs, domain, payload);break ;case HFI_PROPERTY_PARAM_PROFILE_LEVEL_SUPPORTED : -parse_profile_level (core, codecs, domain, data); +if (rem_bytes <=sizeof (struct hfi_profile_level_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_profile_level (core, codecs, domain, payload);break ;case HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE_SUPPORTED : -parse_alloc_mode (core, codecs, domain, data); +if (rem_bytes <=sizeof (struct hfi_buffer_alloc_mode_supported )) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + ret =parse_alloc_mode (core, codecs, domain, payload);break ;default : + ret =sizeof (u32);break ; } - word++; - words_count--; +if (ret <0 ) +return HFI_ERR_SYS_INSUFFICIENT_RESOURCES ; + + words += ret /sizeof (u32); + rem_bytes -= ret; }if (!core->max_sessions_supported)
Greg Kroah-Hartman
maintainerPATCH 260/449 media: i2c: imx319: Rectify runtime PM handling probe and remove
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 5f5ffd3bc62b2e6c478061918b10473d8b90ac2d upstream.
Idle the device only after the async sub-device has been successfully registered. In error handling, set the device's runtime PM status to suspended only if it has been set to active previously in probe.
Also set the device's runtime PM status to suspended in remove only if it wasn't so already.
--- drivers/media/i2c/imx319.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/i2c/imx319.c +6 -3
@@ -2442,17 +2442,19 @@ static int imx319_probe(struct i2c_clienif (full_power)pm_runtime_set_active (&client->dev);pm_runtime_enable (&client->dev); -pm_runtime_idle (&client->dev); ret =v4l2_async_register_subdev_sensor (&imx319->sd);if (ret <0 ) goto error_media_entity_pm; +pm_runtime_idle (&client->dev); +return 0 ; error_media_entity_pm:pm_runtime_disable (&client->dev); -pm_runtime_set_suspended (&client->dev); +if (full_power) +pm_runtime_set_suspended (&client->dev);media_entity_cleanup (&imx319->sd.entity); error_handler_free:
@@ -2474,7 +2476,8 @@ static void imx319_remove(struct i2c_cliv4l2_ctrl_handler_free (sd->ctrl_handler);pm_runtime_disable (&client->dev); -pm_runtime_set_suspended (&client->dev); +if (!pm_runtime_status_suspended (&client->dev)) +pm_runtime_set_suspended (&client->dev);mutex_destroy (&imx319->mutex); }
Greg Kroah-Hartman
maintainerPATCH 261/449 media: i2c: imx219: Rectify runtime PM handling in probe and remove
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 42eceae9793566d0df53d509be3e416465c347f5 upstream.
Set the device's runtime PM status and enable runtime PM before registering the async sub-device. This is needed to avoid the case where the device is runtime PM resumed while runtime PM has not been enabled yet.
Also set the device's runtime PM status to suspended in remove only if it wasn't so already.
--- drivers/media/i2c/imx219.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/media/i2c/imx219.c +8 -5
@@ -1223,6 +1223,9 @@ static int imx219_probe(struct i2c_clien goto error_media_entity; } +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + ret =v4l2_async_register_subdev_sensor (&imx219->sd);if (ret <0 ) { dev_err_probe(dev, ret,
@@ -1230,15 +1233,14 @@ static int imx219_probe(struct i2c_clien goto error_subdev_cleanup; } -/* Enable runtime PM and turn off the device */ -pm_runtime_set_active (dev); -pm_runtime_enable (dev);pm_runtime_idle (dev);return 0 ; error_subdev_cleanup:v4l2_subdev_cleanup (&imx219->sd); +pm_runtime_disable (dev); +pm_runtime_set_suspended (dev); error_media_entity:media_entity_cleanup (&imx219->sd.entity);
@@ -1263,9 +1265,10 @@ static void imx219_remove(struct i2c_cliimx219_free_controls (imx219);pm_runtime_disable (&client->dev); -if (!pm_runtime_status_suspended (&client->dev)) +if (!pm_runtime_status_suspended (&client->dev)) {imx219_power_off (&client->dev); -pm_runtime_set_suspended (&client->dev); +pm_runtime_set_suspended (&client->dev); + } }static const struct of_device_id imx219_dt_ids[] = {
Greg Kroah-Hartman
maintainerPATCH 262/449 media: i2c: imx214: Rectify probe error handling related to runtime PM
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit ccc888d1698b6f42d52ddf5cecfe50fe925c95e5 upstream.
There were multiple issues in the driver's probe function related to error handling:
- Device's PM runtime status wasn't reverted to suspended on some errors in probe.
- Runtime PM was left enabled for the device on some probe errors.
- Device was left powered on if a probe failure happened or when it was removed when it was powered on.
- An extra pm_runtime_set_suspended() was issued in driver's remove function when the device was suspended.
Fix these bugs.
--- drivers/media/i2c/imx214.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/media/i2c/imx214.c +15 -9
@@ -1075,10 +1075,6 @@ static int imx214_probe(struct i2c_clien*/ imx214_power_on (imx214->dev); -pm_runtime_set_active (imx214->dev); -pm_runtime_enable (imx214->dev); -pm_runtime_idle (imx214->dev); - ret =imx214_ctrls_init (imx214);if (ret <0 ) goto error_power_off;
@@ -1099,21 +1095,30 @@ static int imx214_probe(struct i2c_clienimx214_entity_init_state (&imx214->sd,NULL ); +pm_runtime_set_active (imx214->dev); +pm_runtime_enable (imx214->dev); + ret =v4l2_async_register_subdev_sensor (&imx214->sd);if (ret <0 ) {dev_err (dev,"could not register v4l2 device\n" ); goto free_entity; } +pm_runtime_idle (imx214->dev); +return 0 ; free_entity: +pm_runtime_disable (imx214->dev); +pm_runtime_set_suspended (&client->dev);media_entity_cleanup (&imx214->sd.entity); + free_ctrl:mutex_destroy (&imx214->mutex);v4l2_ctrl_handler_free (&imx214->ctrls); + error_power_off: -pm_runtime_disable (imx214->dev); +imx214_power_off (imx214->dev);return ret; }
@@ -1126,11 +1131,12 @@ static void imx214_remove(struct i2c_cliv4l2_async_unregister_subdev (&imx214->sd);media_entity_cleanup (&imx214->sd.entity);v4l2_ctrl_handler_free (&imx214->ctrls); - -pm_runtime_disable (&client->dev); -pm_runtime_set_suspended (&client->dev); -mutex_destroy (&imx214->mutex); +pm_runtime_disable (&client->dev); +if (!pm_runtime_status_suspended (&client->dev)) { +imx214_power_off (imx214->dev); +pm_runtime_set_suspended (&client->dev); + } }static const struct of_device_id imx214_of_match[] = {
Greg Kroah-Hartman
maintainerPATCH 263/449 media: chips-media: wave5: Fix gray color on screen
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jackson.lee <[email protected]>
commit 6bae4d5053da634eecb611118e7cd91a677a4bbf upstream.
When a decoder instance is created, the W5_CMD_ERR_CONCEAL register should be initialized to 0. Otherwise, gray color is occasionally displayed on the screen while decoding.
--- drivers/media/platform/chips-media/wave5/wave5-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/chips-media/wave5/wave5-hw.c +1 -1
@@ -585,7 +585,7 @@ int wave5_vpu_build_up_dec_param(structvpu_write_reg (inst->dev,W5_CMD_NUM_CQ_DEPTH_M1 ,WAVE521_COMMAND_QUEUE_DEPTH -1 ); } - +vpu_write_reg (inst->dev,W5_CMD_ERR_CONCEAL ,0 ); ret =send_firmware_command (inst,W5_CREATE_INSTANCE , true,NULL ,NULL );if (ret) {wave5_vdi_free_dma_memory (vpu_dev, &p_dec_info->vb_work);
Greg Kroah-Hartman
maintainerPATCH 264/449 media: chips-media: wave5: Avoid race condition in the interrupt handler
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jackson.lee <[email protected]>
commit ac35f768986610480a1c01323d9cf9f5eaf3ee9b upstream.
In case of multiple active instances, new interrupts can occur as soon as the current interrupt is cleared. If the driver reads the instance_info after clearing the interrupt, then there is no guarantee, that the instance_info is still valid for the current interrupt.
Read the instance_info register for each interrupt before clearing the interrupt.
--- drivers/media/platform/chips-media/wave5/wave5-vpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/chips-media/wave5/wave5-vpu.c +2 -2
@@ -55,12 +55,12 @@ static void wave5_vpu_handle_irq(void *dstruct vpu_device *dev = dev_id; irq_reason =wave5_vdi_read_register (dev,W5_VPU_VINT_REASON ); + seq_done =wave5_vdi_read_register (dev,W5_RET_SEQ_DONE_INSTANCE_INFO ); + cmd_done =wave5_vdi_read_register (dev,W5_RET_QUEUE_CMD_DONE_INST );wave5_vdi_write_register (dev,W5_VPU_VINT_REASON_CLR , irq_reason);wave5_vdi_write_register (dev,W5_VPU_VINT_CLEAR ,0x1 );list_for_each_entry (inst, &dev->instances, list) { - seq_done =wave5_vdi_read_register (dev,W5_RET_SEQ_DONE_INSTANCE_INFO ); - cmd_done =wave5_vdi_read_register (dev,W5_RET_QUEUE_CMD_DONE_INST );if (irq_reason &BIT (INT_WAVE5_INIT_SEQ ) || irq_reason &BIT (INT_WAVE5_ENC_SET_PARAM )) {
Greg Kroah-Hartman
maintainerPATCH 265/449 media: chips-media: wave5: Fix a hang after seeking
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jackson.lee <[email protected]>
commit a2c75e964e51b096e9fe6adfa3eaed53594a668b upstream.
While seeking, the driver calls the flush command. Before the flush command is sent to the VPU, the driver should handle the display buffer flags and should get all decoded information from the VPU if the VCORE is running.
--- drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c | 17 ++++++++++++++- drivers/media/platform/chips-media/wave5/wave5-vpuapi.c | 10 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +16 -1
@@ -1369,6 +1369,16 @@ static int streamoff_output(struct vb2_qstruct vb2_v4l2_buffer *buf;int ret;dma_addr_t new_rd_ptr; +struct dec_output_info dec_info; +unsigned int i; + +for (i =0 ; i <v4l2_m2m_num_dst_bufs_ready (m2m_ctx); i++) { + ret =wave5_vpu_dec_set_disp_flag (inst, i); +if (ret) +dev_dbg (inst->dev->dev, +"%s: Setting display flag of buf index: %u, fail: %d\n" , + __func__, i, ret); + }while ((buf =v4l2_m2m_src_buf_remove (m2m_ctx))) { dev_dbg(inst->dev->dev, "%s: (Multiplanar) buf type %4u | index %4u\n",
@@ -1376,6 +1386,11 @@ static int streamoff_output(struct vb2_qv4l2_m2m_buf_done (buf,VB2_BUF_STATE_ERROR ); } +while (wave5_vpu_dec_get_output_info (inst, &dec_info) ==0 ) { +if (dec_info.index_frame_display >=0 ) +wave5_vpu_dec_set_disp_flag (inst, dec_info.index_frame_display); + } + ret =wave5_vpu_flush_instance (inst);if (ret)return ret;
@@ -1459,7 +1474,7 @@ static void wave5_vpu_dec_stop_streamingbreak ;if (wave5_vpu_dec_get_output_info (inst, &dec_output_info)) -dev_dbg (inst->dev->dev,"Getting decoding results from fw, fail\n" ); +dev_dbg (inst->dev->dev,"there is no output info\n" ); }v4l2_m2m_update_stop_streaming_state (m2m_ctx, q);
drivers/media/platform/chips-media/wave5/wave5-vpuapi.c +10 -0
@@ -75,6 +75,16 @@ int wave5_vpu_flush_instance(struct vpu_ inst->type == VPU_INST_TYPE_DEC ? "DECODER" : "ENCODER", inst->id);mutex_unlock (&inst->dev->hw_lock);return -ETIMEDOUT ; + }else if (ret == -EBUSY ) { +struct dec_output_info dec_info; + +mutex_unlock (&inst->dev->hw_lock); +wave5_vpu_dec_get_output_info (inst, &dec_info); + ret =mutex_lock_interruptible (&inst->dev->hw_lock); +if (ret) +return ret; +if (dec_info.index_frame_display >0 ) +wave5_vpu_dec_set_disp_flag (inst, dec_info.index_frame_display); } }while (ret !=0 );mutex_unlock (&inst->dev->hw_lock);
Greg Kroah-Hartman
maintainerPATCH 266/449 media: chips-media: wave5: Fix timeout while testing 10bit hevc fluster
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jackson.lee <[email protected]>
commit 035371c9e5098018b8512efc6a8812912469480c upstream.
The Wave5 521C variant does not support 10 bit decoding. When 10 bit decoding support was added for the 515 variant, a section of the code was removed which returned an error. This removal causes a timeout for the 521 variant, which was discovered during HEVC 10-bit decoding tests.
--- drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +14 -0
@@ -1345,10 +1345,24 @@ static int wave5_vpu_dec_start_streamingif (ret) goto free_bitstream_vbuf; }else if (q->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) { +struct dec_initial_info *initial_info = + &inst->codec_info->dec_info.initial_info; +if (inst->state ==VPU_INST_STATE_STOP ) ret =switch_state (inst,VPU_INST_STATE_INIT_SEQ );if (ret) goto return_buffers; + +if (inst->state ==VPU_INST_STATE_INIT_SEQ && + inst->dev->product_code ==WAVE521C_CODE ) { +if (initial_info->luma_bitdepth !=8 ) { +dev_info (inst->dev->dev,"%s: no support for %d bit depth" , + __func__, initial_info->luma_bitdepth); + ret = -EINVAL ; + goto return_buffers; + } + } + }pm_runtime_mark_last_busy (inst->dev->dev);pm_runtime_put_autosuspend (inst->dev->dev);
Greg Kroah-Hartman
maintainerPATCH 267/449 irqchip/renesas-rzv2h: Fix wrong variable usage in rzv2h_tint_set_type()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biju Das <[email protected]>
commit 72310650788ad3d3afe3810735656dd291fea885 upstream.
The variable tssel_n is used for selecting TINT source and titsel_n for setting the interrupt type. The variable titsel_n is wrongly used for enabling the TINT interrupt in rzv2h_tint_set_type(). Fix this issue by using the correct variable tssel_n.
While at it, move the tien variable assignment near to tssr.
--- drivers/irqchip/irq-renesas-rzv2h.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-renesas-rzv2h.c +1 -1
@@ -301,10 +301,10 @@ static int rzv2h_tint_set_type(struct ir tssr_k =ICU_TSSR_K (tint_nr); tssel_n =ICU_TSSR_TSSEL_N (tint_nr); + tien =ICU_TSSR_TIEN (tssel_n); titsr_k =ICU_TITSR_K (tint_nr); titsel_n =ICU_TITSR_TITSEL_N (tint_nr); - tien =ICU_TSSR_TIEN (titsel_n);guard (raw_spinlock)(&priv->lock);
Greg Kroah-Hartman
maintainerPATCH 268/449 gve: unlink old napi only if page pool exists
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshitha Ramamurthy <[email protected]>
commit 81273eb87af86d4a43244b553762348e364b2df7 upstream.
Commit de70981f295e ("gve: unlink old napi when stopping a queue using queue API") unlinks the old napi when stopping a queue. But this breaks QPL mode of the driver which does not use page pool. Fix this by checking that there's a page pool associated with the ring.
--- drivers/net/ethernet/google/gve/gve_rx_dqo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/google/gve/gve_rx_dqo.c +2 -1
@@ -114,7 +114,8 @@ void gve_rx_stop_ring_dqo(struct gve_priif (!gve_rx_was_added_to_block (priv, idx))return ; -page_pool_disable_direct_recycling (rx->dqo.page_pool); +if (rx->dqo.page_pool) +page_pool_disable_direct_recycling (rx->dqo.page_pool);gve_remove_napi (priv, ntfy_idx);gve_rx_remove_from_block (priv, idx);gve_rx_reset_ring_dqo (priv, idx);
Greg Kroah-Hartman
maintainerPATCH 269/449 mptcp: sockopt: fix getting IPV6_V6ONLY
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 8c39633759885b6ff85f6d96cf445560e74df5e8 upstream.
When adding a socket option support in MPTCP, both the get and set parts are supposed to be implemented.
IPV6_V6ONLY support for the setsockopt part has been added a while ago, but it looks like the get part got forgotten. It should have been present as a way to verify a setting has been set as expected, and not to act differently from TCP or any other socket types.
Not supporting this getsockopt(IPV6_V6ONLY) blocks some apps which want to check the default value, before doing extra actions. On Linux, the default value is 0, but this can be changed with the net.ipv6.bindv6only sysctl knob. On Windows, it is set to 1 by default. So supporting the get part, like for all other socket options, is important.
Everything was in place to expose it, just the last step was missing. Only new code is added to cover this specific getsockopt(), that seems safe.
--- net/mptcp/sockopt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/mptcp/sockopt.c +16 -0
@@ -1430,6 +1430,20 @@ static int mptcp_getsockopt_v4(struct mpreturn -EOPNOTSUPP ; } +static int mptcp_getsockopt_v6 (struct mptcp_sock *msk,int optname, +char __user *optval,int __user *optlen) +{ +struct sock *sk = (void *)msk; + +switch (optname) { +case IPV6_V6ONLY : +return mptcp_put_int_option (msk, optval, optlen, + sk->sk_ipv6only); + } + +return -EOPNOTSUPP ; +} +static int mptcp_getsockopt_sol_mptcp (struct mptcp_sock *msk,int optname,char __user *optval,int __user *optlen) {
@@ -1469,6 +1483,8 @@ int mptcp_getsockopt(struct sock *sk, inif (level ==SOL_IP )return mptcp_getsockopt_v4 (msk, optname, optval, option); +if (level ==SOL_IPV6 ) +return mptcp_getsockopt_v6 (msk, optname, optval, option);if (level ==SOL_TCP )return mptcp_getsockopt_sol_tcp (msk, optname, optval, option);if (level ==SOL_MPTCP )
Greg Kroah-Hartman
maintainerPATCH 270/449 mptcp: sockopt: fix getting freebind & transparent
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit e2f4ac7bab2205d3c4dd9464e6ffd82502177c51 upstream.
When adding a socket option support in MPTCP, both the get and set parts are supposed to be implemented.
IP(V6)_FREEBIND and IP(V6)_TRANSPARENT support for the setsockopt part has been added a while ago, but it looks like the get part got forgotten. It should have been present as a way to verify a setting has been set as expected, and not to act differently from TCP or any other socket types.
Everything was in place to expose it, just the last step was missing. Only new code is added to cover these specific getsockopt(), that seems safe.
--- net/mptcp/sockopt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/mptcp/sockopt.c +12 -0
@@ -1419,6 +1419,12 @@ static int mptcp_getsockopt_v4(struct mpswitch (optname) {case IP_TOS :return mptcp_put_int_option (msk, optval, optlen,READ_ONCE (inet_sk (sk)->tos)); +case IP_FREEBIND : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (FREEBIND , sk)); +case IP_TRANSPARENT : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (TRANSPARENT , sk));case IP_BIND_ADDRESS_NO_PORT :return mptcp_put_int_option (msk, optval, optlen,inet_test_bit (BIND_ADDRESS_NO_PORT , sk));
@@ -1439,6 +1445,12 @@ static int mptcp_getsockopt_v6(struct mpcase IPV6_V6ONLY :return mptcp_put_int_option (msk, optval, optlen, sk->sk_ipv6only); +case IPV6_TRANSPARENT : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (TRANSPARENT , sk)); +case IPV6_FREEBIND : +return mptcp_put_int_option (msk, optval, optlen, +inet_test_bit (FREEBIND , sk)); }return -EOPNOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 271/449 block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit fc0e982b8a3a169b1c654d9a1aa45bf292943ef2 upstream.
Make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone(), otherwise requests cloned by device-mapper multipath will not have the proper nr_integrity_segments values set, then BUG() is hit from sg_alloc_table_chained().
--- block/blk-mq.c | 1 + 1 file changed, 1 insertion(+)
block/blk-mq.c +1 -0
@@ -3314,6 +3314,7 @@ int blk_rq_prep_clone(struct request *rq rq->special_vec = rq_src->special_vec; } rq->nr_phys_segments = rq_src->nr_phys_segments; + rq->nr_integrity_segments = rq_src->nr_integrity_segments;if (rq->bio &&blk_crypto_rq_bio_prep (rq, rq->bio, gfp_mask) <0 ) goto free_and_out;
Greg Kroah-Hartman
maintainerPATCH 272/449 mtd: Add check for devm_kcalloc()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 2aee30bb10d7bad0a60255059c9ce1b84cf0130e upstream.
Add a check for devm_kcalloc() to ensure successful allocation.
--- drivers/mtd/mtdpstore.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/mtdpstore.c +3 -0
@@ -423,6 +423,9 @@ static void mtdpstore_notify_add(struct longcnt =BITS_TO_LONGS (div_u64 (mtd->size, mtd->erasesize)); cxt->badmap =kcalloc (longcnt,sizeof (long ),GFP_KERNEL ); +if (!cxt->rmmap || !cxt->usedmap || !cxt->badmap) +return ; +/* just support dmesg right now */ cxt->dev.flags =PSTORE_FLAGS_DMESG ; cxt->dev.zone.read = mtdpstore_read;
Greg Kroah-Hartman
maintainerPATCH 273/449 net: dsa: mv88e6xxx: workaround RGMII transmit delay erratum for 6320 family
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
commit 1ebc8e1ef906db9c08e9abe9776d85ddec837725 upstream.
Implement the workaround for erratum
3.3 RGMII timing may be out of spec when transmit delay is enabled
for the 6320 family, which says:
When transmit delay is enabled via Port register 1 bit 14 = 1, duty cycle may be out of spec. Under very rare conditions this may cause the attached device receive CRC errors.
--- drivers/net/dsa/mv88e6xxx/chip.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +17 -0
@@ -3674,6 +3674,21 @@ static int mv88e6xxx_stats_setup(structreturn mv88e6xxx_g1_stats_clear (chip); } +static int mv88e6320_setup_errata (struct mv88e6xxx_chip *chip) +{ +u16 dummy; +int err; + +/* Workaround for erratum +* 3.3 RGMII timing may be out of spec when transmit delay is enabled +*/ + err =mv88e6xxx_port_hidden_write (chip,0 ,0xf ,0x7 ,0xe000 ); +if (err) +return err; + +return mv88e6xxx_port_hidden_read (chip,0 ,0xf ,0x7 , &dummy); +} +/* Check if the errata has already been applied. */ static bool mv88e6390_setup_errata_applied (struct mv88e6xxx_chip *chip) {
@@ -5130,6 +5145,7 @@ static const struct mv88e6xxx_ops mv88e6static const struct mv88e6xxx_ops mv88e6320_ops = {/* MV88E6XXX_FAMILY_6320 */ + .setup_errata = mv88e6320_setup_errata, .ieee_pri_map = mv88e6085_g1_ieee_pri_map, .ip_pri_map = mv88e6085_g1_ip_pri_map, .irl_init_all = mv88e6352_g2_irl_init_all,
@@ -5182,6 +5198,7 @@ static const struct mv88e6xxx_ops mv88e6static const struct mv88e6xxx_ops mv88e6321_ops = {/* MV88E6XXX_FAMILY_6320 */ + .setup_errata = mv88e6320_setup_errata, .ieee_pri_map = mv88e6085_g1_ieee_pri_map, .ip_pri_map = mv88e6085_g1_ip_pri_map, .irl_init_all = mv88e6352_g2_irl_init_all,
Greg Kroah-Hartman
maintainerPATCH 274/449 net: dsa: mv88e6xxx: fix internal PHYs for 6320 family
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
commit 52fdc41c3278c981066a461d03d5477ebfcf270c upstream.
Fix internal PHYs definition for the 6320 family, which has only 2 internal PHYs (on ports 3 and 4).
--- drivers/net/dsa/mv88e6xxx/chip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +4 -2
@@ -6259,7 +6259,8 @@ static const struct mv88e6xxx_info mv88e .num_databases = 4096, .num_macs = 8192, .num_ports = 7, - .num_internal_phys = 5, + .num_internal_phys = 2, + .internal_phys_offset = 3, .num_gpio = 15, .max_vid = 4095, .max_sid = 63,
@@ -6286,7 +6287,8 @@ static const struct mv88e6xxx_info mv88e .num_databases = 4096, .num_macs = 8192, .num_ports = 7, - .num_internal_phys = 5, + .num_internal_phys = 2, + .internal_phys_offset = 3, .num_gpio = 15, .max_vid = 4095, .max_sid = 63,
Greg Kroah-Hartman
maintainerPATCH 275/449 mtd: Replace kcalloc() with devm_kcalloc()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
commit 1b61a59876f0eafc19b23007c522ee407f55dbec upstream.
Replace kcalloc() with devm_kcalloc() to prevent memory leaks in case of errors.
--- drivers/mtd/mtdpstore.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mtd/mtdpstore.c +3 -6
@@ -417,11 +417,11 @@ static void mtdpstore_notify_add(struct } longcnt =BITS_TO_LONGS (div_u64 (mtd->size, info->kmsg_size)); - cxt->rmmap =kcalloc (longcnt,sizeof (long ),GFP_KERNEL ); - cxt->usedmap =kcalloc (longcnt,sizeof (long ),GFP_KERNEL ); + cxt->rmmap =devm_kcalloc (&mtd->dev, longcnt,sizeof (long ),GFP_KERNEL ); + cxt->usedmap =devm_kcalloc (&mtd->dev, longcnt,sizeof (long ),GFP_KERNEL ); longcnt =BITS_TO_LONGS (div_u64 (mtd->size, mtd->erasesize)); - cxt->badmap =kcalloc (longcnt,sizeof (long ),GFP_KERNEL ); + cxt->badmap =devm_kcalloc (&mtd->dev, longcnt,sizeof (long ),GFP_KERNEL );if (!cxt->rmmap || !cxt->usedmap || !cxt->badmap)return ;
@@ -530,9 +530,6 @@ static void mtdpstore_notify_remove(strumtdpstore_flush_removed (cxt);unregister_pstore_device (&cxt->dev); -kfree (cxt->badmap); -kfree (cxt->usedmap); -kfree (cxt->rmmap); cxt->mtd =NULL ; cxt->index =-1 ; }
Greg Kroah-Hartman
maintainerPATCH 276/449 clocksource/drivers/stm32-lptimer: Use wakeup capable instead of init wakeup
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Torgue <[email protected]>
commit 96bf4b89a6ab22426ad83ef76e66c72a5a8daca0 upstream.
"wakeup-source" property describes a device which has wakeup capability but should not force this device as a wakeup source.
Rule: add
--- drivers/clocksource/timer-stm32-lp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clocksource/timer-stm32-lp.c +1 -3
@@ -168,9 +168,7 @@ static int stm32_clkevent_lp_probe(struc }if (of_property_read_bool (pdev->dev.parent->of_node,"wakeup-source" )) { - ret =device_init_wakeup (&pdev->dev, true); -if (ret) - goto out_clk_disable; +device_set_wakeup_capable (&pdev->dev, true); ret =dev_pm_set_wake_irq (&pdev->dev, irq);if (ret)
Greg Kroah-Hartman
maintainerPATCH 277/449 Revert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO"
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Wang <[email protected]>
commit 766ea2cf5a398c7eed519b12c6c6cf1631143ea2 upstream.
For MLO, mac80211 will send the BA action for each link to the driver, so the driver does not need to handle it itself. Therefore, revert this patch.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 10 ++-- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 52 ++++----------------- drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h | 2 3 files changed, 15 insertions(+), 49 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +5 -5
@@ -1289,22 +1289,22 @@ mt7925_ampdu_action(struct ieee80211_hwcase IEEE80211_AMPDU_RX_START :mt76_rx_aggr_start (&dev->mt76, &msta->deflink.wcid, tid, ssn, params->buf_size); -mt7925_mcu_uni_rx_ba (dev, vif, params, true); +mt7925_mcu_uni_rx_ba (dev, params, true);break ;case IEEE80211_AMPDU_RX_STOP :mt76_rx_aggr_stop (&dev->mt76, &msta->deflink.wcid, tid); -mt7925_mcu_uni_rx_ba (dev, vif, params, false); +mt7925_mcu_uni_rx_ba (dev, params, false);break ;case IEEE80211_AMPDU_TX_OPERATIONAL : mtxq->aggr = true; mtxq->send_bar = false; -mt7925_mcu_uni_tx_ba (dev, vif, params, true); +mt7925_mcu_uni_tx_ba (dev, params, true);break ;case IEEE80211_AMPDU_TX_STOP_FLUSH :case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT : mtxq->aggr = false;clear_bit (tid, &msta->deflink.wcid.ampdu_state); -mt7925_mcu_uni_tx_ba (dev, vif, params, false); +mt7925_mcu_uni_tx_ba (dev, params, false);break ;case IEEE80211_AMPDU_TX_START :set_bit (tid, &msta->deflink.wcid.ampdu_state);
@@ -1313,7 +1313,7 @@ mt7925_ampdu_action(struct ieee80211_hwcase IEEE80211_AMPDU_TX_STOP_CONT : mtxq->aggr = false;clear_bit (tid, &msta->deflink.wcid.ampdu_state); -mt7925_mcu_uni_tx_ba (dev, vif, params, false); +mt7925_mcu_uni_tx_ba (dev, params, false);ieee80211_stop_tx_ba_cb_irqsafe (vif, sta->addr, tid);break ; }
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +10 -42
80 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +0 -2
@@ -263,11 +263,9 @@ int mt7925_mcu_set_beacon_filter(structstruct ieee80211_vif *vif, bool enable);int mt7925_mcu_uni_tx_ba (struct mt792x_dev *dev, -struct ieee80211_vif *vif,struct ieee80211_ampdu_params *params,bool enable);int mt7925_mcu_uni_rx_ba (struct mt792x_dev *dev, -struct ieee80211_vif *vif,struct ieee80211_ampdu_params *params,bool enable);void mt7925_scan_work (struct work_struct *work);
Greg Kroah-Hartman
maintainerPATCH 278/449 wifi: mt76: Add check for devm_kstrdup()
In reply to Greg Kroah-Hartman6.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 4bc1da524b502999da28d287de4286c986a1af57 upstream.
Add check for the return value of devm_kstrdup() in mt76_get_of_data_from_mtd() to catch potential exception.
--- drivers/net/wireless/mediatek/mt76/eeprom.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/mediatek/mt76/eeprom.c +4 -0
@@ -95,6 +95,10 @@ int mt76_get_of_data_from_mtd(struct mt7#ifdef CONFIG_NL80211_TESTMODE dev->test_mtd.name =devm_kstrdup (dev->dev, part,GFP_KERNEL ); +if (!dev->test_mtd.name) { + ret = -ENOMEM ; + goto out_put_node; + } dev->test_mtd.offset = offset;#endif