6.3.3-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 136/246 btrfs: fix space cache inconsistency after error loading it from disk
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 0004ff15ea26015a0a3a6182dca3b9d1df32e2b7 upstream.
When loading a free space cache from disk, at __load_free_space_cache(), if we fail to insert a bitmap entry, we still increment the number of total bitmaps in the btrfs_free_space_ctl structure, which is incorrect since we failed to add the bitmap entry. On error we then empty the cache by calling __btrfs_remove_free_space_cache(), which will result in getting the total bitmaps counter set to 1.
A failure to load a free space cache is not critical, so if a failure happens we just rebuild the cache by scanning the extent tree, which happens at block-group.c:caching_thread(). Yet the failure will result in having the total bitmaps of the btrfs_free_space_ctl always bigger by 1 then the number of bitmap entries we have. So fix this by having the total bitmaps counter be incremented only if we successfully added the bitmap entry.
--- fs/btrfs/free-space-cache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/btrfs/free-space-cache.c +4 -3
@@ -870,15 +870,16 @@ static int __load_free_space_cache(struc }spin_lock (&ctl->tree_lock); ret =link_free_space (ctl, e); - ctl->total_bitmaps++; -recalculate_thresholds (ctl); -spin_unlock (&ctl->tree_lock);if (ret) { +spin_unlock (&ctl->tree_lock);btrfs_err (fs_info,"Duplicate entries in free space cache, dumping" );kmem_cache_free (btrfs_free_space_cachep, e); goto free_cache; } + ctl->total_bitmaps++; +recalculate_thresholds (ctl); +spin_unlock (&ctl->tree_lock);list_add_tail (&e->list, &bitmaps); }
Greg Kroah-Hartman
maintainerPATCH 137/246 btrfs: zoned: zone finish data relocation BG with last IO
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
commit f84353c7c20536ea7e01eca79430eccdf3cc7348 upstream.
For data block groups, we zone finish a zone (or, just deactivate it) when seeing the last IO in btrfs_finish_ordered_io(). That is only called for IOs using ZONE_APPEND, but we use a regular WRITE command for data relocation IOs. Detect it and call btrfs_zone_finish_endio() properly.
--- fs/btrfs/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/inode.c +3 -0
@@ -3167,6 +3167,9 @@ int btrfs_finish_ordered_io(struct btrfsbtrfs_rewrite_logical_zoned (ordered_extent);btrfs_zone_finish_endio (fs_info, ordered_extent->disk_bytenr, ordered_extent->disk_num_bytes); + }else if (btrfs_is_data_reloc_root (inode->root)) { +btrfs_zone_finish_endio (fs_info, ordered_extent->disk_bytenr, + ordered_extent->disk_num_bytes); }if (test_bit (BTRFS_ORDERED_TRUNCATED , &ordered_extent->flags)) {
Greg Kroah-Hartman
maintainerPATCH 138/246 btrfs: zoned: fix full zone super block reading on ZNS
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
commit 02ca9e6fb5f66a031df4fac508b8e477ca69e918 upstream.
When both of the superblock zones are full, we need to check which superblock is newer. The calculation of last superblock position is wrong as it does not consider zone_capacity and uses the length.
--- fs/btrfs/zoned.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/btrfs/zoned.c +3 -4
@@ -122,10 +122,9 @@ static int sb_write_pointer(struct blockint i;for (i =0 ; i <BTRFS_NR_SB_LOG_ZONES ; i++) { -u64 bytenr; - - bytenr = ((zones[i].start + zones[i].len) - <<SECTOR_SHIFT ) -BTRFS_SUPER_INFO_SIZE ; +u64 zone_end = (zones[i].start + zones[i].capacity) <<SECTOR_SHIFT ; +u64 bytenr =ALIGN_DOWN (zone_end,BTRFS_SUPER_INFO_SIZE ) - +BTRFS_SUPER_INFO_SIZE ; page[i] =read_cache_page_gfp (mapping, bytenr >>PAGE_SHIFT ,GFP_NOFS );
Greg Kroah-Hartman
maintainerPATCH 139/246 btrfs: fix backref walking not returning all inode refs
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 0cad8f14d70cfeb5173dce93cafeba665a95430e upstream.
When using the logical to ino ioctl v2, if the flag to ignore offsets of file extent items (BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET) is given, the backref walking code ends up not returning references for all file offsets of an inode that point to the given logical bytenr. This happens since kernel 6.2, commit 6ce6ba534418 ("btrfs: use a single argument for extent offset in backref walking functions") because:
1) It mistakenly skipped the search for file extent items in a leaf that point to the target extent if that flag is given. Instead it should only skip the filtering done by check_extent_in_eb() - that is, it should not avoid the calls to that function (or find_extent_in_eb(), which uses it).
2) It was also not building a list of inode extent elements (struct extent_inode_elem) if we have multiple inode references for an extent when the ignore offset flag is given to the logical to ino ioctl - it would leave a single element, only the last one that was found.
These stem from the confusing old interface for backref walking functions where we had an extent item offset argument that was a pointer to a u64 and another boolean argument that indicated if the offset should be ignored, but the pointer could be NULL. That NULL case is used by relocation, qgroup extent accounting and fiemap, simply to avoid building the inode extent list for each reference, as it's not necessary for those use cases and therefore avoids memory allocations and some computations.
Fix this by adding a boolean argument to the backref walk context structure to indicate that the inode extent list should not be built, make relocation set that argument to true and fix the backref walking logic to skip the calls to check_extent_in_eb() and find_extent_in_eb() only if this new argument is true, instead of 'ignore_extent_item_pos' being true.
A test case for fstests will be added soon, to provide cover not only for these cases but to the logical to ino ioctl in general as well, as currently we do not have a test case for it.
--- fs/btrfs/backref.c | 19 ++++++++++--------- fs/btrfs/backref.h | 6 ++++++ fs/btrfs/relocation.c | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-)
fs/btrfs/backref.c +10 -9
@@ -45,7 +45,8 @@ static int check_extent_in_eb(struct btrint root_count;bool cached; -if (!btrfs_file_extent_compression (eb, fi) && +if (!ctx->ignore_extent_item_pos && + !btrfs_file_extent_compression (eb, fi) && !btrfs_file_extent_encryption (eb, fi) && !btrfs_file_extent_other_encoding (eb, fi)) {u64 data_offset;
@@ -552,7 +553,7 @@ static int add_all_parents(struct btrfs_ count++; else goto next; -if (!ctx->ignore_extent_item_pos) { +if (!ctx->skip_inode_ref_list) { ret =check_extent_in_eb (ctx, &key, eb, fi, &eie);if (ret ==BTRFS_ITERATE_EXTENT_INODES_STOP || ret <0 )
@@ -564,7 +565,7 @@ static int add_all_parents(struct btrfs_ eie, (void **)&old, GFP_NOFS);if (ret <0 )break ; -if (!ret && !ctx->ignore_extent_item_pos) { +if (!ret && !ctx->skip_inode_ref_list) {while (old->next) old = old->next; old->next = eie;
@@ -1606,7 +1607,7 @@ again: goto out; }if (ref->count && ref->parent) { -if (!ctx->ignore_extent_item_pos && !ref->inode_list && +if (!ctx->skip_inode_ref_list && !ref->inode_list && ref->level ==0 ) {struct btrfs_tree_parent_check check = {0 };struct extent_buffer *eb;
@@ -1647,7 +1648,7 @@ again: (void **)&eie, GFP_NOFS);if (ret <0 ) goto out; -if (!ret && !ctx->ignore_extent_item_pos) { +if (!ret && !ctx->skip_inode_ref_list) {/* * We've recorded that parent, so we must extend * its inode list here.
@@ -1743,7 +1744,7 @@ int btrfs_find_all_leafs(struct btrfs_bastatic int btrfs_find_all_roots_safe (struct btrfs_backref_walk_ctx *ctx) {const u64 orig_bytenr = ctx->bytenr; -const bool orig_ignore_extent_item_pos = ctx->ignore_extent_item_pos; +const bool orig_skip_inode_ref_list = ctx->skip_inode_ref_list;bool roots_ulist_allocated = false;struct ulist_iterator uiter;int ret =0 ;
@@ -1764,7 +1765,7 @@ static int btrfs_find_all_roots_safe(str roots_ulist_allocated = true; } - ctx->ignore_extent_item_pos = true; + ctx->skip_inode_ref_list = true;ULIST_ITER_INIT (&uiter);while (1 ) {
@@ -1789,7 +1790,7 @@ static int btrfs_find_all_roots_safe(strulist_free (ctx->refs); ctx->refs =NULL ; ctx->bytenr = orig_bytenr; - ctx->ignore_extent_item_pos = orig_ignore_extent_item_pos; + ctx->skip_inode_ref_list = orig_skip_inode_ref_list;return ret; }
@@ -1912,7 +1913,7 @@ int btrfs_is_data_extent_shared(struct b goto out_trans; } - walk_ctx.ignore_extent_item_pos = true; + walk_ctx.skip_inode_ref_list = true; walk_ctx.trans = trans; walk_ctx.fs_info = fs_info; walk_ctx.refs = &ctx->refs;
fs/btrfs/backref.h +6 -0
@@ -60,6 +60,12 @@ struct btrfs_backref_walk_ctx {* @extent_item_pos is ignored. */ bool ignore_extent_item_pos; +/* +* If true and bytenr corresponds to a data extent, then the inode list +* (each member describing inode number, file offset and root) is not +* added to each reference added to the @refs ulist. +*/ +bool skip_inode_ref_list;/* A valid transaction handle or NULL. */ struct btrfs_trans_handle *trans;/*
fs/btrfs/relocation.c +1 -1
@@ -3422,7 +3422,7 @@ int add_data_references(struct reloc_conbtrfs_release_path (path); ctx.bytenr = extent_key->objectid; - ctx.ignore_extent_item_pos = true; + ctx.skip_inode_ref_list = true; ctx.fs_info = rc->extent_root->fs_info; ret =btrfs_find_all_leafs (&ctx);
Greg Kroah-Hartman
maintainerPATCH 140/246 cifs: fix pcchunk length type in smb2_copychunk_range
In reply to Greg Kroah-HartmanFrom: Pawel Witek <[email protected]>
commit d66cde50c3c868af7abddafce701bb86e4a93039 upstream.
Change type of pcchunk->Length from u32 to u64 to match smb2_copychunk_range arguments type. Fixes the problem where performing server-side copy with CIFS_IOC_COPYCHUNK_FILE ioctl resulted in incomplete copy of large files while returning -EINVAL.
--- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2ops.c +1 -1
@@ -1682,7 +1682,7 @@ smb2_copychunk_range(const unsigned int pcchunk->SourceOffset =cpu_to_le64 (src_off); pcchunk->TargetOffset =cpu_to_le64 (dest_off); pcchunk->Length = -cpu_to_le32 (min_t (u32, len, tcon->max_bytes_chunk)); +cpu_to_le32 (min_t (u64, len, tcon->max_bytes_chunk));/* Request server copy to target from src identified by key */ kfree (retbuf);
Greg Kroah-Hartman
maintainerPATCH 141/246 cifs: release leases for deferred close handles when freezing
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit d39fc592ef8ae9a89c5e85c8d9f760937a57d5ba upstream.
We should not be caching closed files when freeze is invoked on an fs (so we can release resources more gracefully).
Fixes xfstests generic/068 generic/390 generic/491
--- fs/cifs/cifsfs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
fs/cifs/cifsfs.c +15 -0
@@ -759,6 +759,20 @@ static void cifs_umount_begin(struct supreturn ; } +static int cifs_freeze (struct super_block *sb) +{ +struct cifs_sb_info *cifs_sb =CIFS_SB (sb); +struct cifs_tcon *tcon; + +if (cifs_sb ==NULL ) +return 0 ; + + tcon =cifs_sb_master_tcon (cifs_sb); + +cifs_close_all_deferred_files (tcon); +return 0 ; +} +#ifdef CONFIG_CIFS_STATS2 static int cifs_show_stats (struct seq_file *s,struct dentry *root) {
@@ -797,6 +811,7 @@ static const struct super_operations cifas opens */ .show_options = cifs_show_options, .umount_begin = cifs_umount_begin, + .freeze_fs = cifs_freeze,#ifdef CONFIG_CIFS_STATS2 .show_stats = cifs_show_stats,#endif
Greg Kroah-Hartman
maintainerPATCH 142/246 platform/x86/intel-uncore-freq: Return error on write frequency
In reply to Greg Kroah-HartmanFrom: Srinivas Pandruvada <[email protected]>
commit 75e406b540c3eca67625d97bbefd4e3787eafbfe upstream.
Currently when the uncore_write() returns error, it is silently ignored. Return error to user space when uncore_write() fails.
--- drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c +5 -1
@@ -44,14 +44,18 @@ static ssize_t store_min_max_freq_khz(st int min_max) {unsigned int input; +int ret;if (kstrtouint (buf,10 , &input))return -EINVAL ;mutex_lock (&uncore_lock); -uncore_write (data, input, min_max); + ret =uncore_write (data, input, min_max);mutex_unlock (&uncore_lock); +if (ret) +return ret; +return count; }
Greg Kroah-Hartman
maintainerPATCH 143/246 platform/x86: touchscreen_dmi: Add upside-down quirk for GDIX1002 ts on the Juno Tablet
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 6abfa99ce52f61a31bcfc2aaaae09006f5665495 upstream.
The Juno Computers Juno Tablet has an upside-down mounted Goodix touchscreen. Add a quirk to invert both axis to correct for this.
--- drivers/platform/x86/touchscreen_dmi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +17 -0
@@ -378,6 +378,11 @@ static const struct ts_dmi_data gdix1001 .properties = gdix1001_upside_down_props, }; +static const struct ts_dmi_data gdix1002_00_upside_down_data = { + .acpi_name ="GDIX1002:00" , + .properties = gdix1001_upside_down_props, +}; +static const struct property_entry gp_electronic_t701_props[] = {PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,960 ),PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,640 ),
@@ -1296,6 +1301,18 @@ const struct dmi_system_id touchscreen_d }, }, { +/* Juno Tablet */ + .driver_data = (void *)&gdix1002_00_upside_down_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Default string" ), +/* Both product- and board-name being "Default string" is somewhat rare */ +DMI_MATCH (DMI_PRODUCT_NAME ,"Default string" ), +DMI_MATCH (DMI_BOARD_NAME ,"Default string" ), +/* Above matches are too generic, add partial bios-version match */ + DMI_MATCH(DMI_BIOS_VERSION, "JP2V1."), + }, + }, + {/* Mediacom WinPad 7.0 W700 (same hw as Wintron surftab 7") */ .driver_data = (void *)&trekstor_surftab_wintron70_data, .matches = {
Greg Kroah-Hartman
maintainerPATCH 144/246 platform/x86: thinkpad_acpi: Fix platform profiles on T490
In reply to Greg Kroah-HartmanFrom: Mark Pearson <[email protected]>
commit 0c0cd3e25a5b64b541dd83ba6e032475a9d77432 upstream.
I had incorrectly thought that PSC profiles were not usable on Intel platforms so had blocked them in the driver initialistion. This broke platform profiles on the T490.
After discussion with the FW team PSC does work on Intel platforms and should be allowed.
Note - it's possible this may impact other platforms where it is advertised but special driver support that only Windows has is needed. But if it does then they will need fixing via quirks. Please report any issues to me so I can get them addressed - but I haven't found any problems in testing...yet
--- drivers/platform/x86/thinkpad_acpi.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +0 -5
@@ -10593,11 +10593,6 @@ static int tpacpi_dytc_profile_init(stru dytc_mmc_get_available = true; } }else if (dytc_capabilities &BIT (DYTC_FC_PSC )) {/* PSC MODE */ -/* Support for this only works on AMD platforms */ -if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) { -dbg_printk (TPACPI_DBG_INIT ,"PSC not support on Intel platforms\n" ); -return -ENODEV ; - }pr_debug ("PSC is supported\n" ); }else {dbg_printk (TPACPI_DBG_INIT ,"No DYTC support available\n" );
Greg Kroah-Hartman
maintainerPATCH 145/246 platform/x86: hp-wmi: add micmute to hp_wmi_keymap struct
In reply to Greg Kroah-HartmanFrom: Fae <[email protected]>
commit decab2825c3ef9b154c6f76bce40872ffb41c36f upstream.
Fixes micmute key of HP Envy X360 ey0xxx.
--- drivers/platform/x86/hp/hp-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/hp/hp-wmi.c +1 -0
@@ -211,6 +211,7 @@ struct bios_rfkill2_state {static const struct key_entry hp_wmi_keymap[] = { {KE_KEY ,0x02 , {KEY_BRIGHTNESSUP } }, {KE_KEY ,0x03 , {KEY_BRIGHTNESSDOWN } }, + {KE_KEY ,0x270 , {KEY_MICMUTE } }, {KE_KEY ,0x20e6 , {KEY_PROG1 } }, {KE_KEY ,0x20e8 , {KEY_MEDIA } }, {KE_KEY ,0x2142 , {KEY_MEDIA } },
Greg Kroah-Hartman
maintainerPATCH 146/246 platform/x86: touchscreen_dmi: Add info for the Dexp Ursus KX210i
In reply to Greg Kroah-HartmanFrom: Andrey Avdeev <[email protected]>
commit 4b65f95c87c35699bc6ad540d6b9dd7f950d0924 upstream.
Add touchscreen info for the Dexp Ursus KX210i
--- drivers/platform/x86/touchscreen_dmi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +24 -0
@@ -336,6 +336,22 @@ static const struct ts_dmi_data dexp_urs .properties = dexp_ursus_7w_props, }; +static const struct property_entry dexp_ursus_kx210i_props[] = { +PROPERTY_ENTRY_U32 ("touchscreen-min-x" ,5 ), +PROPERTY_ENTRY_U32 ("touchscreen-min-y" ,2 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1720 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,1137 ), +PROPERTY_ENTRY_STRING ("firmware-name" ,"gsl1680-dexp-ursus-kx210i.fw" ), +PROPERTY_ENTRY_U32 ("silead,max-fingers" ,10 ), +PROPERTY_ENTRY_BOOL ("silead,home-button" ), + { } +}; + +static const struct ts_dmi_data dexp_ursus_kx210i_data = { + .acpi_name ="MSSL1680:00" , + .properties = dexp_ursus_kx210i_props, +}; +static const struct property_entry digma_citi_e200_props[] = {PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1980 ),PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,1500 ),
@@ -1191,6 +1207,14 @@ const struct dmi_system_id touchscreen_d }, }, { +/* DEXP Ursus KX210i */ + .driver_data = (void *)&dexp_ursus_kx210i_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"INSYDE Corp." ), + DMI_MATCH(DMI_PRODUCT_NAME, "S107I"), + }, + }, + {/* Digma Citi E200 */ .driver_data = (void *)&digma_citi_e200_data, .matches = {
Greg Kroah-Hartman
maintainerPATCH 147/246 platform/x86: thinkpad_acpi: Add profile force ability
In reply to Greg Kroah-HartmanFrom: Mark Pearson <[email protected]>
commit 1684878952929e20a864af5df7b498941c750f45 upstream.
There has been a lot of confusion around which platform profiles are supported on various platforms and it would be useful to have a debug method to be able to override the profile mode that is selected.
I don't expect this to be used in anything other than debugging in conjunction with Lenovo engineers - but it does give a way to get a system working whilst we wait for either FW fixes, or a driver fix to land upstream, if something is wonky in the mode detection logic
--- drivers/platform/x86/thinkpad_acpi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +19 -0
@@ -10318,6 +10318,7 @@ static atomic_t dytc_ignore_event = ATOMstatic DEFINE_MUTEX (dytc_mutex);static int dytc_capabilities;static bool dytc_mmc_get_available; +static int profile_force;static int convert_dytc_to_profile (int funcmode,int dytcmode,enum platform_profile_option *profile)
@@ -10580,6 +10581,21 @@ static int tpacpi_dytc_profile_init(struif (err)return err; +/* Check if user wants to override the profile selection */ +if (profile_force) { +switch (profile_force) { +case -1 : + dytc_capabilities =0 ; +break ; +case 1 : + dytc_capabilities =BIT (DYTC_FC_MMC ); +break ; +case 2 : + dytc_capabilities =BIT (DYTC_FC_PSC ); +break ; + } +pr_debug ("Profile selection forced: 0x%x\n" , dytc_capabilities); + }if (dytc_capabilities &BIT (DYTC_FC_MMC )) {/* MMC MODE */ pr_debug ("MMC is supported\n" );/*
@@ -11641,6 +11657,9 @@ MODULE_PARM_DESC(uwb_state, "Initial state of the emulated UWB switch");#endif +module_param (profile_force, int,0444 ); +MODULE_PARM_DESC (profile_force,"Force profile mode. -1=off, 1=MMC, 2=PSC" ); +static void thinkpad_acpi_module_exit (void ) {struct ibm_struct *ibm, *itmp;
Greg Kroah-Hartman
maintainerPATCH 148/246 inotify: Avoid reporting event with invalid wd
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit c915d8f5918bea7c3962b09b8884ca128bfd9b0c upstream.
When inotify_freeing_mark() races with inotify_handle_inode_event() it can happen that inotify_handle_inode_event() sees that i_mark->wd got already reset to -1 and reports this value to userspace which can confuse the inotify listener. Avoid the problem by validating that wd is sensible (and pretend the mark got removed before the event got generated otherwise).
Message-Id: <[email protected]>
--- fs/notify/inotify/inotify_fsnotify.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/notify/inotify/inotify_fsnotify.c +9 -2
@@ -65,7 +65,7 @@ int inotify_handle_inode_event(struct fsstruct fsnotify_event *fsn_event;struct fsnotify_group *group = inode_mark->group;int ret; -int len =0 ; +int len =0 , wd;int alloc_len =sizeof (struct inotify_event_info );struct mem_cgroup *old_memcg;
@@ -81,6 +81,13 @@ int inotify_handle_inode_event(struct fs fsn_mark);/* +* We can be racing with mark being detached. Don't report event with +* invalid wd. +*/ + wd =READ_ONCE (i_mark->wd); +if (wd ==-1 ) +return 0 ; +/* * Whoever is interested in the event, pays for the allocation. Do not * trigger OOM killer in the target monitoring memcg as it may have * security repercussion.
@@ -110,7 +117,7 @@ int inotify_handle_inode_event(struct fs fsn_event = &event->fse;fsnotify_init_event (fsn_event); event->mask = mask; - event->wd = i_mark->wd; + event->wd = wd; event->sync_cookie = cookie; event->name_len = len;if (len)
Greg Kroah-Hartman
maintainerPATCH 149/246 smb3: fix problem remounting a share after shutdown
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit 716a3cf317456fa01d54398bb14ab354f50ed6a2 upstream.
xfstests generic/392 showed a problem where even after a shutdown call was made on a mount, we would still attempt to use the (now inaccessible) superblock if another mount was attempted for the same share.
--- fs/cifs/connect.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/cifs/connect.c +7 -0
@@ -2705,6 +2705,13 @@ cifs_match_super(struct super_block *sb,spin_lock (&cifs_tcp_ses_lock); cifs_sb =CIFS_SB (sb); + +/* We do not want to use a superblock that has been shutdown */ +if (CIFS_MOUNT_SHUTDOWN & cifs_sb->mnt_cifs_flags) { +spin_unlock (&cifs_tcp_ses_lock); +return 0 ; + } + tlink =cifs_get_tlink (cifs_sb_master_tlink (cifs_sb));if (tlink ==NULL ) {/* can not match superblock if tlink were ever null */
Greg Kroah-Hartman
maintainerPATCH 150/246 SMB3: force unmount was failing to close deferred close files
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit 2cb6f968775a9fd60c90a6042b9550bcec3ea087 upstream.
In investigating a failure with xfstest generic/392 it was noticed that mounts were reusing a superblock that should already have been freed. This turned out to be related to deferred close files keeping a reference count until the closetimeo expired.
Currently the only way an fs knows that mount is beginning is when force unmount is called, but when this, ie umount_begin(), is called all deferred close files on the share (tree connection) should be closed immediately (unless shared by another mount) to avoid using excess resources on the server and to avoid reusing a superblock which should already be freed.
In umount_begin, close all deferred close handles for that share if this is the last mount using that share on this client (ie send the SMB3 close request over the wire for those that have been already closed by the app but that we have kept a handle lease open for and have not sent closes to the server for yet).
--- fs/cifs/cifsfs.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/cifsfs.c +1 -0
@@ -744,6 +744,7 @@ static void cifs_umount_begin(struct supspin_unlock (&tcon->tc_lock);spin_unlock (&cifs_tcp_ses_lock); +cifs_close_all_deferred_files (tcon);/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */ /* cancel_notify_requests(tcon); */ if (tcon->ses && tcon->ses->server) {
Greg Kroah-Hartman
maintainerPATCH 151/246 sh: math-emu: fix macro redefined warning
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 58a49ad90939386a8682e842c474a0d2c00ec39c upstream.
Fix a warning that was reported by the kernel test robot:
In file included from ../include/math-emu/soft-fp.h:27,
from ../arch/sh/math-emu/math.c:22:
../arch/sh/include/asm/sfp-machine.h:17: warning: "__BYTE_ORDER" redefined
17 | #define __BYTE_ORDER __BIG_ENDIAN
In file included from ../arch/sh/math-emu/math.c:21:../arch/sh/math-emu/sfp-util.h:71: note: this is the location of the previous definition
71 | #define __BYTE_ORDER __LITTLE_ENDIAN
--- arch/sh/math-emu/sfp-util.h | 4 ---- 1 file changed, 4 deletions(-)
arch/sh/math-emu/sfp-util.h +0 -4
@@ -67,7 +67,3 @@ } while (0)#define abort () return 0 - -#define __BYTE_ORDER __LITTLE_ENDIAN - -
Greg Kroah-Hartman
maintainerPATCH 152/246 sh: mcount.S: fix build error when PRINTK is not enabled
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit c2bd1e18c6f85c0027da2e5e7753b9bfd9f8e6dc upstream.
Fix a build error in mcount.S when CONFIG_PRINTK is not enabled. Fixes this build error:
sh2-linux-ld: arch/sh/lib/mcount.o: in function `stack_panic':
(.text+0xec): undefined reference to `dump_stack'
--- arch/sh/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/Kconfig.debug +1 -1
@@ -15,7 +15,7 @@ config SH_STANDARD_BIOS config STACK_DEBUG bool "Check for stack overflows" - depends on DEBUG_KERNEL + depends on DEBUG_KERNEL && PRINTK help This option will cause messages to be printed if free stack space drops below a certain limit. Saying Y here will add overhead to
Greg Kroah-Hartman
maintainerPATCH 153/246 sh: init: use OF_EARLY_FLATTREE for early init
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 6cba655543c7959f8a6d2979b9d40a6a66b7ed4f upstream.
When CONFIG_OF_EARLY_FLATTREE and CONFIG_SH_DEVICE_TREE are not set, SH3 build fails with a call to early_init_dt_scan(), so in arch/sh/kernel/setup.c and arch/sh/kernel/head_32.S, use CONFIG_OF_EARLY_FLATTREE instead of CONFIG_OF_FLATTREE.
Fixes this build error:../arch/sh/kernel/setup.c: In function 'sh_fdt_init':../arch/sh/kernel/setup.c:262:26: error: implicit declaration of function 'early_init_dt_scan' [-Werror=implicit-function-declaration]
262 | if (!dt_virt || !early_init_dt_scan(dt_virt)) {
--- arch/sh/kernel/head_32.S | 6 +++--- arch/sh/kernel/setup.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
arch/sh/kernel/head_32.S +3 -3
@@ -64,7 +64,7 @@ ENTRY(_stext) ldc r0, r6_bank #endif -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE mov r4, r12 ! Store device tree blob pointer in r12 #endif
@@ -315,7 +315,7 @@ ENTRY(_stext) 10: #endif -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE mov.l 8f, r0 ! Make flat device tree available early. jsr @r0 mov r12, r4
@@ -346,7 +346,7 @@ ENTRY(stack_start) 5: .long start_kernel 6: .long cpu_init 7: .long init_thread_union -#if defined(CONFIG_OF_FLATTREE) +#if defined(CONFIG_OF_EARLY_FLATTREE) 8: .long sh_fdt_init #endif
arch/sh/kernel/setup.c +2 -2
@@ -244,7 +244,7 @@ void __init __weak plat_early_device_set { } -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE void __ref sh_fdt_init (phys_addr_t dt_phys) {static int done =0 ;
@@ -326,7 +326,7 @@ void __init setup_arch(char **cmdline_p)/* Let earlyprintk output early console messages */ sh_early_platform_driver_probe ("earlyprintk" ,1 ,1 ); -#ifdef CONFIG_OF_FLATTREE +#ifdef CONFIG_OF_EARLY_FLATTREE #ifdef CONFIG_USE_BUILTIN_DTB unflatten_and_copy_device_tree ();#else
Greg Kroah-Hartman
maintainerPATCH 154/246 sh: nmi_debug: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit d1155e4132de712a9d3066e2667ceaad39a539c5 upstream.
__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) argument or environment strings. Also, error return codes don't mean anything to obsolete_checksetup() -- only non-zero (usually 1) or zero. So return 1 from nmi_debug_setup().
--- arch/sh/kernel/nmi_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sh/kernel/nmi_debug.c +2 -2
@@ -49,7 +49,7 @@ static int __init nmi_debug_setup(char *register_die_notifier (&nmi_debug_nb);if (*str !='=' ) -return 0 ; +return 1 ;for (p = str +1 ; *p; p = sep +1 ) { sep =strchr (p,',' );
@@ -70,6 +70,6 @@ static int __init nmi_debug_setup(char *break ; } -return 0 ; +return 1 ; }__setup ("nmi_debug" , nmi_debug_setup);
Greg Kroah-Hartman
maintainerPATCH 155/246 proc_sysctl: update docs for __register_sysctl_table()
In reply to Greg Kroah-HartmanFrom: Luis Chamberlain <[email protected]>
commit 67ff32289acad9ed338cd9f2351b44939e55163e upstream.
Update the docs for __register_sysctl_table() to make it clear no child entries can be passed. When the child is true these are non-leaf entries on the ctl table and sysctl treats these as directories. The point to __register_sysctl_table() is to deal only with directories not part of the ctl table where thay may riside, to be simple and avoid recursion.
While at it, hint towards using long on extra1 and extra2 later.
--- fs/proc/proc_sysctl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/proc/proc_sysctl.c +11 -3
@@ -1287,7 +1287,7 @@ out:* __register_sysctl_table - register a leaf sysctl table * @set: Sysctl tree to register on * @path: The path to the directory the sysctl table is in. -* @table: the top-level table structure +* @table: the top-level table structure without any child * * Register a sysctl table hierarchy. @table should be a filled in ctl_table * array. A completely 0 filled entry terminates the table.
@@ -1308,9 +1308,12 @@ out:* proc_handler - the text handler routine (described below) * * extra1, extra2 - extra pointers usable by the proc handler routines +* XXX: we should eventually modify these to use long min / max [0] +* [0] https://lkml.kernel.org/[email protected] * * Leaf nodes in the sysctl tree will be represented by a single file -* under /proc; non-leaf nodes will be represented by directories. +* under /proc; non-leaf nodes (where child is not NULL) are not allowed, +* sysctl_check_table() verifies this. * * There must be a proc_handler routine for any terminal nodes. * Several default handlers are available to cover common cases -
@@ -1352,7 +1355,7 @@ struct ctl_table_header *__register_syscspin_lock (&sysctl_lock); dir = &set->dir; -/* Reference moved down the diretory tree get_subdir */ +/* Reference moved down the directory tree get_subdir */ dir->header.nreg++;spin_unlock (&sysctl_lock);
@@ -1369,6 +1372,11 @@ struct ctl_table_header *__register_syscif (namelen ==0 )continue ; +/* +* namelen ensures if name is "foo/bar/yay" only foo is +* registered first. We traverse as if using mkdir -p and +* return a ctl_dir for the last directory entry. +*/ dir =get_subdir (dir, name, namelen);if (IS_ERR (dir)) goto fail;
Greg Kroah-Hartman
maintainerPATCH 156/246 proc_sysctl: enhance documentation
In reply to Greg Kroah-HartmanFrom: Luis Chamberlain <[email protected]>
commit 1dc8689e4cc651e21566e10206a84c4006e81fb1 upstream.
Expand documentation to clarify:
o that paths don't need to exist for the new API callers
o clarify that we *require* callers to keep the memory of the table around during the lifetime of the sysctls
o annotate routines we are trying to deprecate and later remove
--- fs/proc/proc_sysctl.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
fs/proc/proc_sysctl.c +20 -5
@@ -1287,7 +1287,10 @@ out:* __register_sysctl_table - register a leaf sysctl table * @set: Sysctl tree to register on * @path: The path to the directory the sysctl table is in. -* @table: the top-level table structure without any child +* @table: the top-level table structure without any child. This table +* should not be free'd after registration. So it should not be +* used on stack. It can either be a global or dynamically allocated +* by the caller and free'd later after sysctl unregistration. * * Register a sysctl table hierarchy. @table should be a filled in ctl_table * array. A completely 0 filled entry terminates the table.
@@ -1402,8 +1405,15 @@ fail:/** * register_sysctl - register a sysctl table -* @path: The path to the directory the sysctl table is in. -* @table: the table structure +* @path: The path to the directory the sysctl table is in. If the path +* doesn't exist we will create it for you. +* @table: the table structure. The calller must ensure the life of the @table +* will be kept during the lifetime use of the syctl. It must not be freed +* until unregister_sysctl_table() is called with the given returned table +* with this registration. If your code is non modular then you don't need +* to call unregister_sysctl_table() and can instead use something like +* register_sysctl_init() which does not care for the result of the syctl +* registration. * * Register a sysctl table. @table should be a filled in ctl_table * array. A completely 0 filled entry terminates the table.
@@ -1419,8 +1429,11 @@ EXPORT_SYMBOL(register_sysctl);/** * __register_sysctl_init() - register sysctl table to path -* @path: path name for sysctl base -* @table: This is the sysctl table that needs to be registered to the path +* @path: path name for sysctl base. If that path doesn't exist we will create +* it for you. +* @table: This is the sysctl table that needs to be registered to the path. +* The caller must ensure the life of the @table will be kept during the +* lifetime use of the sysctl. * @table_name: The name of sysctl table, only used for log printing when * registration fails *
@@ -1565,6 +1578,7 @@ out:* * Register a sysctl table hierarchy. @table should be a filled in ctl_table * array. A completely 0 filled entry terminates the table. +* We are slowly deprecating this call so avoid its use. * * See __register_sysctl_table for more details. */
@@ -1636,6 +1650,7 @@ err_register_leaves:* * Register a sysctl table hierarchy. @table should be a filled in ctl_table * array. A completely 0 filled entry terminates the table. +* We are slowly deprecating this caller so avoid future uses of it. * * See __register_sysctl_paths for more details. */
Greg Kroah-Hartman
maintainerPATCH 157/246 remoteproc: stm32: Call of_node_put() on iteration error
In reply to Greg Kroah-HartmanFrom: Mathieu Poirier <[email protected]>
commit ccadca5baf5124a880f2bb50ed1ec265415f025b upstream.
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly.
--- drivers/remoteproc/stm32_rproc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/remoteproc/stm32_rproc.c +5 -1
@@ -223,11 +223,13 @@ static int stm32_rproc_prepare(struct rpwhile (of_phandle_iterator_next (&it) ==0 ) { rmem =of_reserved_mem_lookup (it.node);if (!rmem) { +of_node_put (it.node);dev_err (dev,"unable to acquire memory-region\n" );return -EINVAL ; }if (stm32_rproc_pa_to_da (rproc, rmem->base, &da) <0 ) { +of_node_put (it.node);dev_err (dev,"memory region not valid %pa\n" , &rmem->base);return -EINVAL ;
@@ -254,8 +256,10 @@ static int stm32_rproc_prepare(struct rp it.node->name); } -if (!mem) +if (!mem) { +of_node_put (it.node);return -ENOMEM ; + }rproc_add_carveout (rproc, mem); index++;
Greg Kroah-Hartman
maintainerPATCH 158/246 remoteproc: st: Call of_node_put() on iteration error
In reply to Greg Kroah-HartmanFrom: Mathieu Poirier <[email protected]>
commit 8a74918948b40317a5b5bab9739d13dcb5de2784 upstream.
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly.
--- drivers/remoteproc/st_remoteproc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/remoteproc/st_remoteproc.c +4 -1
@@ -129,6 +129,7 @@ static int st_rproc_parse_fw(struct rprowhile (of_phandle_iterator_next (&it) ==0 ) { rmem =of_reserved_mem_lookup (it.node);if (!rmem) { +of_node_put (it.node);dev_err (dev,"unable to acquire memory-region\n" );return -EINVAL ; }
@@ -150,8 +151,10 @@ static int st_rproc_parse_fw(struct rpro it.node->name); } -if (!mem) +if (!mem) { +of_node_put (it.node);return -ENOMEM ; + }rproc_add_carveout (rproc, mem); index++;
Greg Kroah-Hartman
maintainerPATCH 159/246 remoteproc: imx_dsp_rproc: Call of_node_put() on iteration error
In reply to Greg Kroah-HartmanFrom: Mathieu Poirier <[email protected]>
commit e0e01de8ee146986872e54e8365f4b4654819412 upstream.
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly.
--- drivers/remoteproc/imx_dsp_rproc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/remoteproc/imx_dsp_rproc.c +9 -3
@@ -627,15 +627,19 @@ static int imx_dsp_rproc_add_carveout(st rmem =of_reserved_mem_lookup (it.node);if (!rmem) { +of_node_put (it.node);dev_err (dev,"unable to acquire memory-region\n" );return -EINVAL ; } -if (imx_dsp_rproc_sys_to_da (priv, rmem->base, rmem->size, &da)) +if (imx_dsp_rproc_sys_to_da (priv, rmem->base, rmem->size, &da)) { +of_node_put (it.node);return -EINVAL ; + } cpu_addr =devm_ioremap_wc (dev, rmem->base, rmem->size);if (!cpu_addr) { +of_node_put (it.node);dev_err (dev,"failed to map memory %p\n" , &rmem->base);return -ENOMEM ; }
@@ -644,10 +648,12 @@ static int imx_dsp_rproc_add_carveout(st mem =rproc_mem_entry_init (dev, (void __force *)cpu_addr, (dma_addr_t )rmem->base, rmem->size, da,NULL ,NULL , it.node->name); -if (mem) +if (mem) {rproc_coredump_add_segment (rproc, da, rmem->size); -else + }else { +of_node_put (it.node);return -ENOMEM ; + }rproc_add_carveout (rproc, mem); }
Greg Kroah-Hartman
maintainerPATCH 160/246 remoteproc: imx_rproc: Call of_node_put() on iteration error
In reply to Greg Kroah-HartmanFrom: Mathieu Poirier <[email protected]>
commit 5ef074e805ecfd9a16dbb7b6b88bbfa8abad7054 upstream.
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly.
--- drivers/remoteproc/imx_rproc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/remoteproc/imx_rproc.c +5 -2
@@ -541,6 +541,7 @@ static int imx_rproc_prepare(struct rpro rmem =of_reserved_mem_lookup (it.node);if (!rmem) { +of_node_put (it.node);dev_err (priv->dev,"unable to acquire memory-region\n" );return -EINVAL ; }
@@ -553,10 +554,12 @@ static int imx_rproc_prepare(struct rpro imx_rproc_mem_alloc, imx_rproc_mem_release, it.node->name); -if (mem) +if (mem) {rproc_coredump_add_segment (rproc, da, rmem->size); -else + }else { +of_node_put (it.node);return -ENOMEM ; + }rproc_add_carveout (rproc, mem); }
Greg Kroah-Hartman
maintainerPATCH 161/246 remoteproc: rcar_rproc: Call of_node_put() on iteration error
In reply to Greg Kroah-HartmanFrom: Mathieu Poirier <[email protected]>
commit f8bae637d3d5e082b4ced71e28b16eb3ee0683c1 upstream.
Function of_phandle_iterator_next() calls of_node_put() on the last device_node it iterated over, but when the loop exits prematurely it has to be called explicitly.
--- drivers/remoteproc/rcar_rproc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/remoteproc/rcar_rproc.c +7 -2
@@ -62,13 +62,16 @@ static int rcar_rproc_prepare(struct rpr rmem =of_reserved_mem_lookup (it.node);if (!rmem) { +of_node_put (it.node);dev_err (&rproc->dev,"unable to acquire memory-region\n" );return -EINVAL ; } -if (rmem->base >U32_MAX ) +if (rmem->base >U32_MAX ) { +of_node_put (it.node);return -EINVAL ; + }/* No need to translate pa to da, R-Car use same map */ da = rmem->base;
@@ -79,8 +82,10 @@ static int rcar_rproc_prepare(struct rpr rcar_rproc_mem_release, it.node->name); -if (!mem) +if (!mem) { +of_node_put (it.node);return -ENOMEM ; + }rproc_add_carveout (rproc, mem); }
Greg Kroah-Hartman
maintainerPATCH 162/246 sysctl: clarify register_sysctl_init() base directory order
In reply to Greg Kroah-HartmanFrom: Luis Chamberlain <[email protected]>
commit 228b09de936395ddd740df3522ea35ae934830d8 upstream.
Relatively new docs which I added which hinted the base directories needed to be created before is wrong, remove that incorrect comment. This has been hinted before by Eric twice already [0] [1], I had just not verified that until now. Now that I've verified that updates the docs to relax the context described.
[0] https://lkml.kernel.org/r/[email protected]
[1] https://lkml.kernel.org/r/[email protected]
--- fs/proc/proc_sysctl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/proc/proc_sysctl.c +1 -4
@@ -1445,10 +1445,7 @@ EXPORT_SYMBOL(register_sysctl);* register_sysctl() failing on init are extremely low, and so for both reasons * this function does not return any error as it is used by initialization code. * -* Context: Can only be called after your respective sysctl base path has been -* registered. So for instance, most base directories are registered early on -* init before init levels are processed through proc_sys_init() and -* sysctl_init_bases(). +* Context: if your base directory does not exist it will be created for you. */ void __init __register_sysctl_init (const char *path,struct ctl_table *table,const char *table_name)
Greg Kroah-Hartman
maintainerPATCH 163/246 ARM: dts: aspeed: asrock: Correct firmware flash SPI clocks
In reply to Greg Kroah-HartmanFrom: Zev Weiss <[email protected]>
commit 9dedb724446913ea7b1591b4b3d2e3e909090980 upstream.
While I'm not aware of any problems that have occurred running these at 100 MHz, the official word from ASRock is that 50 MHz is the correct speed to use, so let's be safe and use that instead.
--- arch/arm/boot/dts/aspeed-bmc-asrock-e3c246d4i.dts | 2 +- arch/arm/boot/dts/aspeed-bmc-asrock-romed8hm3.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/aspeed-bmc-asrock-e3c246d4i.dts +1 -1
@@ -63,7 +63,7 @@ status = "okay"; m25p,fast-read; label = "bmc"; - spi-max-frequency = <100000000>; /* 100 MHz */ + spi-max-frequency = <50000000>; /* 50 MHz */ #include "openbmc-flash-layout.dtsi" }; };
arch/arm/boot/dts/aspeed-bmc-asrock-romed8hm3.dts +1 -1
@@ -51,7 +51,7 @@ status = "okay"; m25p,fast-read; label = "bmc"; - spi-max-frequency = <100000000>; /* 100 MHz */ + spi-max-frequency = <50000000>; /* 50 MHz */ #include "openbmc-flash-layout-64.dtsi" }; };
Greg Kroah-Hartman
maintainerPATCH 164/246 ARM: dts: exynos: fix WM8960 clock name in Itop Elite
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 6c950c20da38debf1ed531e0b972bd8b53d1c11f upstream.
The WM8960 Linux driver expects the clock to be named "mclk". Otherwise the clock will be ignored and not prepared/enabled by the driver.
--- arch/arm/boot/dts/exynos4412-itop-elite.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-itop-elite.dts +1 -1
@@ -182,7 +182,7 @@ compatible = "wlf,wm8960"; reg = <0x1a>; clocks = <&pmu_system_controller 0>; - clock-names = "MCLK1"; + clock-names = "mclk"; wlf,shared-lrclk; #sound-dai-cells = <0>; };
Greg Kroah-Hartman
maintainerPATCH 165/246 ARM: dts: s5pv210: correct MIPI CSIS clock name
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 665b9459bb53b8f19bd1541567e1fe9782c83c4b upstream.
The Samsung S5P/Exynos MIPI CSIS bindings and Linux driver expect first clock name to be "csis". Otherwise the driver fails to probe.
--- arch/arm/boot/dts/s5pv210.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/s5pv210.dtsi +1 -1
@@ -566,7 +566,7 @@ interrupts = <29>; clocks = <&clocks CLK_CSIS>, <&clocks SCLK_CSIS>; - clock-names = "clk_csis", + clock-names = "csis", "sclk_csis"; bus-width = <4>; status = "disabled";
Greg Kroah-Hartman
maintainerPATCH 166/246 ARM: dts: aspeed: romed8hm3: Fix GPIO polarity of system-fault LED
In reply to Greg Kroah-HartmanFrom: Zev Weiss <[email protected]>
commit a3fd10732d276d7cf372c6746a78a1c8b6aa7541 upstream.
Turns out it's in fact not the same as the heartbeat LED.
--- arch/arm/boot/dts/aspeed-bmc-asrock-romed8hm3.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/aspeed-bmc-asrock-romed8hm3.dts +1 -1
@@ -31,7 +31,7 @@ }; system-fault { - gpios = <&gpio ASPEED_GPIO(Z, 2) GPIO_ACTIVE_LOW>; + gpios = <&gpio ASPEED_GPIO(Z, 2) GPIO_ACTIVE_HIGH>; panic-indicator; }; };
Greg Kroah-Hartman
maintainerPATCH 167/246 drm/msm/adreno: fix runtime PM imbalance at gpu load
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 0d997f95b70f98987ae031a89677c13e0e223670 upstream.
A recent commit moved enabling of runtime PM to GPU load time (first open()) but failed to update the error paths so that runtime PM is disabled if initialisation of the GPU fails. This would trigger a warning about the unbalanced disable count on the next open() attempt.
Note that pm_runtime_put_noidle() is sufficient to balance the usage count when pm_runtime_put_sync() fails (and is chosen over pm_runtime_resume_and_get() for consistency reasons).
Patchwork: https://patchwork.freedesktop.org/patch/524971/
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +12 -4
@@ -440,20 +440,21 @@ struct msm_gpu *adreno_load_gpu(struct d ret =pm_runtime_get_sync (&pdev->dev);if (ret <0 ) { -pm_runtime_put_sync (&pdev->dev); +pm_runtime_put_noidle (&pdev->dev);DRM_DEV_ERROR (dev->dev,"Couldn't power up the GPU: %d\n" , ret); -return NULL ; + goto err_disable_rpm; }mutex_lock (&gpu->lock); ret =msm_gpu_hw_init (gpu);mutex_unlock (&gpu->lock); -pm_runtime_put_autosuspend (&pdev->dev);if (ret) {DRM_DEV_ERROR (dev->dev,"gpu hw init failed: %d\n" , ret); -return NULL ; + goto err_put_rpm; } +pm_runtime_put_autosuspend (&pdev->dev); +#ifdef CONFIG_DEBUG_FS if (gpu->funcs->debugfs_init) { gpu->funcs->debugfs_init (gpu, dev->primary);
@@ -462,6 +463,13 @@ struct msm_gpu *adreno_load_gpu(struct d#endif return gpu; + +err_put_rpm: +pm_runtime_put_sync (&pdev->dev); +err_disable_rpm: +pm_runtime_disable (&pdev->dev); + +return NULL ; }static int find_chipid (struct device *dev,struct adreno_rev *rev)
Greg Kroah-Hartman
maintainerPATCH 168/246 drm/bridge: lt8912b: Fix DSI Video Mode
In reply to Greg Kroah-HartmanFrom: Francesco Dolcini <[email protected]>
commit f435b7ef3b360d689df2ffa8326352cd07940d92 upstream.
LT8912 DSI port supports only Non-Burst mode video operation with Sync Events and continuous clock on clock lane, correct dsi mode flags according to that removing MIPI_DSI_MODE_VIDEO_BURST flag.
--- drivers/gpu/drm/bridge/lontium-lt8912b.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/bridge/lontium-lt8912b.c +0 -1
@@ -504,7 +504,6 @@ static int lt8912_attach_dsi(struct lt89 dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->mode_flags =MIPI_DSI_MODE_VIDEO | -MIPI_DSI_MODE_VIDEO_BURST |MIPI_DSI_MODE_LPM |MIPI_DSI_MODE_NO_EOT_PACKET ;
Greg Kroah-Hartman
maintainerPATCH 169/246 drm/i915/color: Fix typo for Plane CSC indexes
In reply to Greg Kroah-HartmanFrom: Chaitanya Kumar Borah <[email protected]>
commit 2efc8e1001acfdc143cf2d25a08a4974c322e2a8 upstream.
Replace _PLANE_INPUT_CSC_RY_GY_2_* with _PLANE_CSC_RY_GY_2_* for Plane CSC
--- drivers/gpu/drm/i915/i915_reg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +2 -2
@@ -7596,8 +7596,8 @@ enum skl_power_gate {#define _PLANE_CSC_RY_GY_1 (pipe) _PIPE(pipe, _PLANE_CSC_RY_GY_1_A, \ _PLANE_CSC_RY_GY_1_B) -#define _PLANE_CSC_RY_GY_2 (pipe) _PIPE(pipe, _PLANE_INPUT_CSC_RY_GY_2_A, \ - _PLANE_INPUT_CSC_RY_GY_2_B) +#define _PLANE_CSC_RY_GY_2 (pipe) _PIPE(pipe, _PLANE_CSC_RY_GY_2_A, \ + _PLANE_CSC_RY_GY_2_B)#define PLANE_CSC_COEFF (pipe, plane, index) _MMIO_PLANE(plane, \ _PLANE_CSC_RY_GY_1(pipe) + (index) * 4, \ _PLANE_CSC_RY_GY_2(pipe) + (index) * 4)
Greg Kroah-Hartman
maintainerPATCH 170/246 drm/msm: fix NULL-deref on snapshot tear down
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit a465353b9250802f87b97123e33a17f51277f0b1 upstream.
In case of early initialisation errors and on platforms that do not use the DPU controller, the deinitilisation code can be called with the kms pointer set to NULL.
Patchwork: https://patchwork.freedesktop.org/patch/525099/
--- drivers/gpu/drm/msm/msm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +2 -1
@@ -242,7 +242,8 @@ static int msm_drm_uninit(struct devicemsm_fbdev_free (ddev);#endif -msm_disp_snapshot_destroy (ddev); +if (kms) +msm_disp_snapshot_destroy (ddev);drm_mode_config_cleanup (ddev);
Greg Kroah-Hartman
maintainerPATCH 171/246 drm/msm: fix NULL-deref on irq uninstall
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit cd459c005de3e2b855a8cc7768e633ce9d018e9f upstream.
In case of early initialisation errors and on platforms that do not use the DPU controller, the deinitilisation code can be called with the kms pointer set to NULL.
Patchwork: https://patchwork.freedesktop.org/patch/525104/
--- drivers/gpu/drm/msm/msm_drv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +5 -3
@@ -251,9 +251,11 @@ static int msm_drm_uninit(struct devicedrm_bridge_remove (priv->bridges[i]); priv->num_bridges =0 ; -pm_runtime_get_sync (dev); -msm_irq_uninstall (ddev); -pm_runtime_put_sync (dev); +if (kms) { +pm_runtime_get_sync (dev); +msm_irq_uninstall (ddev); +pm_runtime_put_sync (dev); + }if (kms && kms->funcs) kms->funcs->destroy (kms);
Greg Kroah-Hartman
maintainerPATCH 172/246 drm/msm: fix drm device leak on bind errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 214b09db61978497df24efcb3959616814bca46b upstream.
Make sure to free the DRM device also in case of early errors during bind().
Patchwork: https://patchwork.freedesktop.org/patch/525097/
--- drivers/gpu/drm/msm/msm_drv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +8 -2
@@ -444,12 +444,12 @@ static int msm_drm_init(struct device *d ret =msm_init_vram (ddev);if (ret) -return ret; + goto err_put_dev;/* Bind all our sub-components: */ ret =component_bind_all (dev, ddev);if (ret) -return ret; + goto err_put_dev;dma_set_max_seg_size (dev,UINT_MAX );
@@ -544,6 +544,12 @@ static int msm_drm_init(struct device *d err_msm_uninit:msm_drm_uninit (dev); + +return ret; + +err_put_dev: +drm_dev_put (ddev); +return ret; }
Greg Kroah-Hartman
maintainerPATCH 173/246 drm/msm: fix vram leak on bind errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 60d476af96015891c7959f30838ae7a9749932bf upstream.
Make sure to release the VRAM buffer also in a case a subcomponent fails to bind.
Patchwork: https://patchwork.freedesktop.org/patch/525094/
--- drivers/gpu/drm/msm/msm_drv.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +19 -7
@@ -51,6 +51,8 @@#define MSM_VERSION_MINOR 10#define MSM_VERSION_PATCHLEVEL 0 +static void msm_deinit_vram (struct drm_device *ddev); +static const struct drm_mode_config_funcs mode_config_funcs = { .fb_create = msm_framebuffer_create, .output_poll_changed = drm_fb_helper_output_poll_changed,
@@ -260,12 +262,7 @@ static int msm_drm_uninit(struct deviceif (kms && kms->funcs) kms->funcs->destroy (kms); -if (priv->vram.paddr) { -unsigned long attrs =DMA_ATTR_NO_KERNEL_MAPPING ; -drm_mm_takedown (&priv->vram.mm); -dma_free_attrs (dev, priv->vram.size,NULL , - priv->vram.paddr, attrs); - } +msm_deinit_vram (ddev);component_unbind_all (dev, ddev);
@@ -403,6 +400,19 @@ static int msm_init_vram(struct drm_devireturn ret; } +static void msm_deinit_vram (struct drm_device *ddev) +{ +struct msm_drm_private *priv = ddev->dev_private; +unsigned long attrs =DMA_ATTR_NO_KERNEL_MAPPING ; + +if (!priv->vram.paddr) +return ; + +drm_mm_takedown (&priv->vram.mm); +dma_free_attrs (ddev->dev, priv->vram.size,NULL , priv->vram.paddr, + attrs); +} +static int msm_drm_init (struct device *dev,const struct drm_driver *drv) {struct msm_drm_private *priv =dev_get_drvdata (dev);
@@ -449,7 +459,7 @@ static int msm_drm_init(struct device *d/* Bind all our sub-components: */ ret =component_bind_all (dev, ddev);if (ret) - goto err_put_dev; + goto err_deinit_vram;dma_set_max_seg_size (dev,UINT_MAX );
@@ -547,6 +557,8 @@ err_msm_uninit:return ret; +err_deinit_vram: +msm_deinit_vram (ddev); err_put_dev:drm_dev_put (ddev);
Greg Kroah-Hartman
maintainerPATCH 174/246 drm/msm: fix missing wq allocation error handling
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit ca090c837b430752038b24e56dd182010d77f6f6 upstream.
Add the missing sanity check to handle workqueue allocation failures.
Patchwork: https://patchwork.freedesktop.org/patch/525102/
--- drivers/gpu/drm/msm/msm_drv.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/msm_drv.c +4 -0
@@ -432,6 +432,10 @@ static int msm_drm_init(struct device *d priv->dev = ddev; priv->wq =alloc_ordered_workqueue ("msm" ,0 ); +if (!priv->wq) { + ret = -ENOMEM ; + goto err_put_dev; + }INIT_LIST_HEAD (&priv->objects);mutex_init (&priv->obj_lock);
Greg Kroah-Hartman
maintainerPATCH 175/246 drm/msm: fix workqueue leak on bind errors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit a75b49db6529b2af049eafd938fae888451c3685 upstream.
Make sure to destroy the workqueue also in case of early errors during bind (e.g. a subcomponent failing to bind).
Since commit c3b790ea07a1 ("drm: Manage drm_mode_config_init with drmm_") the mode config will be freed when the drm device is released also when using the legacy interface, but add an explicit cleanup for consistency and to facilitate backporting.
Patchwork: https://patchwork.freedesktop.org/patch/525093/
--- drivers/gpu/drm/msm/msm_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +4 -1
@@ -458,7 +458,7 @@ static int msm_drm_init(struct device *d ret =msm_init_vram (ddev);if (ret) - goto err_put_dev; + goto err_cleanup_mode_config;/* Bind all our sub-components: */ ret =component_bind_all (dev, ddev);
@@ -563,6 +563,9 @@ err_msm_uninit: err_deinit_vram:msm_deinit_vram (ddev); +err_cleanup_mode_config: +drm_mode_config_cleanup (ddev); +destroy_workqueue (priv->wq); err_put_dev:drm_dev_put (ddev);
Greg Kroah-Hartman
maintainerPATCH 176/246 drm/i915: Check pipe source size when using skl+ scalers
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit d944eafed618a8507270b324ad9d5405bb7f0b3e upstream.
The skl+ scalers only sample 12 bits of PIPESRC so we can't do any plane scaling at all when the pipe source size is >4k.
Make sure the pipe source size is also below the scaler's src size limits. Might not be 100% accurate, but should at least be safe. We can refine the limits later if we discover that recent hw is less restricted.
--- drivers/gpu/drm/i915/display/skl_scaler.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/i915/display/skl_scaler.c +17 -0
@@ -111,6 +111,8 @@ skl_update_scaler(struct intel_crtc_statstruct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; +int pipe_src_w =drm_rect_width (&crtc_state->pipe_src); +int pipe_src_h =drm_rect_height (&crtc_state->pipe_src);int min_src_w, min_src_h, min_dst_w, min_dst_h;int max_src_w, max_src_h, max_dst_w, max_dst_h;
@@ -207,6 +209,21 @@ skl_update_scaler(struct intel_crtc_statreturn -EINVAL ; } +/* +* The pipe scaler does not use all the bits of PIPESRC, at least +* on the earlier platforms. So even when we're scaling a plane +* the *pipe* source size must not be too large. For simplicity +* we assume the limits match the scaler source size limits. Might +* not be 100% accurate on all platforms, but good enough for now. +*/ +if (pipe_src_w > max_src_w || pipe_src_h > max_src_h) { +drm_dbg_kms (&dev_priv->drm, +"scaler_user index %u.%u: pipe src size %ux%u " +"is out of scaler range\n" , + crtc->pipe, scaler_user, pipe_src_w, pipe_src_h); +return -EINVAL ; + } +/* mark this plane as a scaler user in crtc_state */ scaler_state->scaler_users |= (1 << scaler_user); drm_dbg_kms(&dev_priv->drm, "scaler_user index %u.%u: "
Greg Kroah-Hartman
maintainerPATCH 177/246 drm/i915/dsi: Use unconditional msleep() instead of intel_dsi_msleep()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit c8c2969bfcba5fcba3a5b078315c1b586d927d9f upstream.
The intel_dsi_msleep() helper skips sleeping if the MIPI-sequences have a version of 3 or newer and the panel is in vid-mode.
This is based on the big comment around line 730 which starts with "Panel enable/disable sequences from the VBT spec.", where the "v3 video mode seq" column does not have any wait t# entries.
Checking the Windows driver shows that it does always honor the VBT delays independent of the version of the VBT sequences.
Commit 6fdb335f1c9c ("drm/i915/dsi: Use unconditional msleep for the panel_on_delay when there is no reset-deassert MIPI-sequence") switched to a direct msleep() instead of intel_dsi_msleep() when there is no MIPI_SEQ_DEASSERT_RESET sequence, to fix the panel on an Acer Aspire Switch 10 E SW3-016 not turning on.
And now testing on a Nextbook Ares 8A shows that panel_on_delay must always be honored otherwise the panel will not turn on.
Instead of only always using regular msleep() for panel_on_delay do as Windows does and always use regular msleep() everywhere were intel_dsi_msleep() is used and drop the intel_dsi_msleep() helper.
Changes in v2:
- Replace all intel_dsi_msleep() calls instead of just the intel_dsi_msleep(panel_on_delay) call
--- drivers/gpu/drm/i915/display/icl_dsi.c | 2 +- drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 11 ----------- drivers/gpu/drm/i915/display/intel_dsi_vbt.h | 1 - drivers/gpu/drm/i915/display/vlv_dsi.c | 22 +++++----------------- 4 files changed, 6 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/display/icl_dsi.c +1 -1
@@ -1211,7 +1211,7 @@ static void gen11_dsi_powerup_panel(stru/* panel power on related mipi dsi vbt sequences */ intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_POWER_ON ); -intel_dsi_msleep (intel_dsi, intel_dsi->panel_on_delay); +msleep (intel_dsi->panel_on_delay);intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_DEASSERT_RESET );intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_INIT_OTP );intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_DISPLAY_ON );
drivers/gpu/drm/i915/display/intel_dsi_vbt.c +0 -11
@@ -762,17 +762,6 @@ void intel_dsi_vbt_exec_sequence(structgpiod_set_value_cansleep (intel_dsi->gpio_backlight,0 ); } -void intel_dsi_msleep (struct intel_dsi *intel_dsi,int msec) -{ -struct intel_connector *connector = intel_dsi->attached_connector; - -/* For v3 VBTs in vid-mode the delays are part of the VBT sequences */ -if (is_vid_mode (intel_dsi) && connector->panel.vbt.dsi.seq_version >=3 ) -return ; - -msleep (msec); -} -void intel_dsi_log_params (struct intel_dsi *intel_dsi) {struct drm_i915_private *i915 =to_i915 (intel_dsi->base.base.dev);
drivers/gpu/drm/i915/display/intel_dsi_vbt.h +0 -1
@@ -16,7 +16,6 @@ void intel_dsi_vbt_gpio_init(struct intevoid intel_dsi_vbt_gpio_cleanup (struct intel_dsi *intel_dsi);void intel_dsi_vbt_exec_sequence (struct intel_dsi *intel_dsi,enum mipi_seq seq_id); -void intel_dsi_msleep (struct intel_dsi *intel_dsi,int msec);void intel_dsi_log_params (struct intel_dsi *intel_dsi);#endif /* __INTEL_DSI_VBT_H__ */
drivers/gpu/drm/i915/display/vlv_dsi.c +5 -17
@@ -783,7 +783,6 @@ static void intel_dsi_pre_enable(struct {struct intel_dsi *intel_dsi =enc_to_intel_dsi (encoder);struct intel_crtc *crtc =to_intel_crtc (pipe_config->uapi.crtc); -struct intel_connector *connector =to_intel_connector (conn_state->connector);struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);enum pipe pipe = crtc->pipe;enum port port;
@@ -831,21 +830,10 @@ static void intel_dsi_pre_enable(structif (!IS_GEMINILAKE (dev_priv))intel_dsi_prepare (encoder, pipe_config); +/* Give the panel time to power-on and then deassert its reset */ intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_POWER_ON ); - -/* -* Give the panel time to power-on and then deassert its reset. -* Depending on the VBT MIPI sequences version the deassert-seq -* may contain the necessary delay, intel_dsi_msleep() will skip -* the delay in that case. If there is no deassert-seq, then an -* unconditional msleep is used to give the panel time to power-on. -*/ -if (connector->panel.vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET ]) { -intel_dsi_msleep (intel_dsi, intel_dsi->panel_on_delay); -intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_DEASSERT_RESET ); - }else { -msleep (intel_dsi->panel_on_delay); - } +msleep (intel_dsi->panel_on_delay); +intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_DEASSERT_RESET );if (IS_GEMINILAKE (dev_priv)) { glk_cold_boot =glk_dsi_enable_io (encoder);
@@ -879,7 +867,7 @@ static void intel_dsi_pre_enable(structmsleep (20 );/* XXX */ for_each_dsi_port (port, intel_dsi->ports)dpi_send_cmd (intel_dsi,TURN_ON , false, port); -intel_dsi_msleep (intel_dsi,100 ); +msleep (100 );intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_DISPLAY_ON );
@@ -1007,7 +995,7 @@ static void intel_dsi_post_disable(struc/* Assert reset */ intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_ASSERT_RESET ); -intel_dsi_msleep (intel_dsi, intel_dsi->panel_off_delay); +msleep (intel_dsi->panel_off_delay);intel_dsi_vbt_exec_sequence (intel_dsi,MIPI_SEQ_POWER_OFF ); intel_dsi->panel_power_off_time =ktime_get_boottime ();
Greg Kroah-Hartman
maintainerPATCH 178/246 drm/dsc: fix drm_edp_dsc_sink_output_bpp() DPCD high byte usage
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
commit 13525645e2246ebc8a21bd656248d86022a6ee8f upstream.
The operator precedence between << and & is wrong, leading to the high byte being completely ignored. For example, with the 6.4 format, 32 becomes 0 and 24 becomes 8. Fix it, and remove the slightly confusing and unnecessary DP_DSC_MAX_BITS_PER_PIXEL_HI_SHIFT macro while at it.
--- include/drm/display/drm_dp.h | 1 - include/drm/display/drm_dp_helper.h | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)
include/drm/display/drm_dp.h +0 -1
@@ -286,7 +286,6 @@#define DP_DSC_MAX_BITS_PER_PIXEL_HI 0x068/* eDP 1.4 */ # define DP_DSC_MAX_BITS_PER_PIXEL_HI_MASK (0x3 << 0) -# define DP_DSC_MAX_BITS_PER_PIXEL_HI_SHIFT 8# define DP_DSC_MAX_BPP_DELTA_VERSION_MASK 0x06# define DP_DSC_MAX_BPP_DELTA_AVAILABILITY 0x08
include/drm/display/drm_dp_helper.h +2 -3
@@ -181,9 +181,8 @@ static inline u16 drm_edp_dsc_sink_output_bpp(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) {return dsc_dpcd[DP_DSC_MAX_BITS_PER_PIXEL_LOW -DP_DSC_SUPPORT ] | - (dsc_dpcd[DP_DSC_MAX_BITS_PER_PIXEL_HI -DP_DSC_SUPPORT ] & -DP_DSC_MAX_BITS_PER_PIXEL_HI_MASK << -DP_DSC_MAX_BITS_PER_PIXEL_HI_SHIFT ); + ((dsc_dpcd[DP_DSC_MAX_BITS_PER_PIXEL_HI -DP_DSC_SUPPORT ] & +DP_DSC_MAX_BITS_PER_PIXEL_HI_MASK ) <<8 ); } static inline u32
Greg Kroah-Hartman
maintainerPATCH 179/246 f2fs: factor out victim_entry usage from general rb_tree use
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit 043d2d00b44310f84c0593c63e51fae88c829cdd upstream.
Let's reduce the complexity of mixed use of rb_tree in victim_entry from extent_cache and discard_cmd.
This should fix arm32 memory alignment issue caused by shared rb_entry.
[struct victim_entry] [struct rb_entry]
[0] struct rb_node rb_node; [0] struct rb_node rb_node;
union {
struct {
unsigned int ofs;
unsigned int len;
};
[16] unsigned long long mtime; [12] unsigned long long key;
} __packed;--- fs/f2fs/extent_cache.c | 36 ------------ fs/f2fs/f2fs.h | 15 +---- fs/f2fs/gc.c | 139 +++++++++++++++++++++++++++++-------------------- fs/f2fs/gc.h | 14 ---- fs/f2fs/segment.c | 4 - 5 files changed, 93 insertions(+), 115 deletions(-)
fs/f2fs/extent_cache.c +1 -35
@@ -204,29 +204,6 @@ struct rb_entry *f2fs_lookup_rb_tree(strreturn re; } -struct rb_node **f2fs_lookup_rb_tree_ext (struct f2fs_sb_info *sbi, -struct rb_root_cached *root, -struct rb_node **parent, -unsigned long long key,bool *leftmost) -{ -struct rb_node **p = &root->rb_root.rb_node; -struct rb_entry *re; - -while (*p) { - *parent = *p; - re = rb_entry(*parent, struct rb_entry, rb_node); - -if (key < re->key) { - p = &(*p)->rb_left; - }else { - p = &(*p)->rb_right; - *leftmost = false; - } - } - -return p; -} - struct rb_node **f2fs_lookup_rb_tree_for_insert(struct f2fs_sb_info *sbi, struct rb_root_cached *root, struct rb_node **parent,
@@ -335,7 +312,7 @@ lookup_neighbors: }bool f2fs_check_rb_tree_consistence (struct f2fs_sb_info *sbi, -struct rb_root_cached *root,bool check_key) +struct rb_root_cached *root) {#ifdef CONFIG_F2FS_CHECK_FS struct rb_node *cur =rb_first_cached (root), *next;
@@ -352,23 +329,12 @@ bool f2fs_check_rb_tree_consistence(stru cur_re = rb_entry(cur, struct rb_entry, rb_node); next_re = rb_entry(next, struct rb_entry, rb_node); -if (check_key) { -if (cur_re->key > next_re->key) { -f2fs_info (sbi,"inconsistent rbtree, " -"cur(%llu) next(%llu)" , - cur_re->key, next_re->key); -return false; - } - goto next; - } -if (cur_re->ofs + cur_re->len > next_re->ofs) {f2fs_info (sbi,"inconsistent rbtree, cur(%u, %u) next(%u, %u)" , cur_re->ofs, cur_re->len, next_re->ofs, next_re->len);return false; } -next: cur = next; }#endif
fs/f2fs/f2fs.h +3 -12
@@ -630,13 +630,8 @@ enum extent_type {struct rb_entry {struct rb_node rb_node;/* rb node located in rb-tree */ -union { -struct { -unsigned int ofs;/* start offset of the entry */ -unsigned int len;/* length of the entry */ - }; -unsigned long long key;/* 64-bits key */ - } __packed; +unsigned int ofs;/* start offset of the entry */ +unsigned int len;/* length of the entry */ };struct extent_info {
@@ -4141,10 +4136,6 @@ void f2fs_leave_shrinker(struct f2fs_sb_bool sanity_check_extent_cache (struct inode *inode);struct rb_entry *f2fs_lookup_rb_tree (struct rb_root_cached *root,struct rb_entry *cached_re,unsigned int ofs); -struct rb_node **f2fs_lookup_rb_tree_ext (struct f2fs_sb_info *sbi, -struct rb_root_cached *root, -struct rb_node **parent, -unsigned long long key,bool *left_most); struct rb_node **f2fs_lookup_rb_tree_for_insert(struct f2fs_sb_info *sbi, struct rb_root_cached *root, struct rb_node **parent,
@@ -4155,7 +4146,7 @@ struct rb_entry *f2fs_lookup_rb_tree_ret struct rb_node ***insert_p, struct rb_node **insert_parent, bool force, bool *leftmost);bool f2fs_check_rb_tree_consistence (struct f2fs_sb_info *sbi, -struct rb_root_cached *root,bool check_key); +struct rb_root_cached *root);void f2fs_init_extent_tree (struct inode *inode);void f2fs_drop_extent_tree (struct inode *inode);void f2fs_destroy_extent_node (struct inode *inode);
fs/f2fs/gc.c +85 -54
220 lines not on this page · raw message
fs/f2fs/gc.h +2 -12
@@ -55,20 +55,10 @@ struct gc_inode_list {struct radix_tree_root iroot; }; -struct victim_info { -unsigned long long mtime;/* mtime of section */ -unsigned int segno;/* section No. */ -}; -struct victim_entry {struct rb_node rb_node;/* rb node located in rb-tree */ -union { -struct { -unsigned long long mtime;/* mtime of section */ -unsigned int segno;/* segment No. */ - }; -struct victim_info vi;/* victim info */ - }; +unsigned long long mtime;/* mtime of section */ +unsigned int segno;/* segment No. */ struct list_head list; };
fs/f2fs/segment.c +2 -2
@@ -1484,7 +1484,7 @@ retry: goto next;if (unlikely (dcc->rbtree_check))f2fs_bug_on (sbi, !f2fs_check_rb_tree_consistence (sbi, - &dcc->root, false)); + &dcc->root));blk_start_plug (&plug);list_for_each_entry_safe (dc, tmp, pend_list, list) {f2fs_bug_on (sbi, dc->state !=D_PREP );
@@ -2971,7 +2971,7 @@ next:mutex_lock (&dcc->cmd_lock);if (unlikely (dcc->rbtree_check))f2fs_bug_on (sbi, !f2fs_check_rb_tree_consistence (sbi, - &dcc->root, false)); + &dcc->root)); dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root, NULL, start,
Greg Kroah-Hartman
maintainerPATCH 180/246 f2fs: factor out discard_cmd usage from general rb_tree use
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit f69475dd4878e5f2e316a6573044d55f294baa51 upstream.
This is a second part to remove the mixed use of rb_tree in discard_cmd from extent_cache.
This should also fix arm32 memory alignment issue caused by shared rb_entry.
[struct discard_cmd] [struct rb_entry]
[0] struct rb_node rb_node; [0] struct rb_node rb_node;
union { union {
struct { struct {
[16] block_t lstart; [12] unsigned int ofs;
block_t len; unsigned int len;
};
unsigned long long key;
} __packed;--- fs/f2fs/extent_cache.c | 36 ------- fs/f2fs/f2fs.h | 23 ---- fs/f2fs/segment.c | 247 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 168 insertions(+), 138 deletions(-)
fs/f2fs/extent_cache.c +3 -33
@@ -192,7 +192,7 @@ static struct rb_entry *__lookup_rb_treereturn NULL ; } -struct rb_entry *f2fs_lookup_rb_tree (struct rb_root_cached *root, +static struct rb_entry *f2fs_lookup_rb_tree (struct rb_root_cached *root,struct rb_entry *cached_re,unsigned int ofs) {struct rb_entry *re;
@@ -204,7 +204,7 @@ struct rb_entry *f2fs_lookup_rb_tree(strreturn re; } -struct rb_node **f2fs_lookup_rb_tree_for_insert (struct f2fs_sb_info *sbi, +static struct rb_node **f2fs_lookup_rb_tree_for_insert (struct f2fs_sb_info *sbi,struct rb_root_cached *root,struct rb_node **parent,unsigned int ofs,bool *leftmost)
@@ -238,7 +238,7 @@ struct rb_node **f2fs_lookup_rb_tree_for* in order to simplify the insertion after. * tree must stay unchanged between lookup and insertion. */ -struct rb_entry *f2fs_lookup_rb_tree_ret(struct rb_root_cached *root, +static struct rb_entry *f2fs_lookup_rb_tree_ret(struct rb_root_cached *root, struct rb_entry *cached_re, unsigned int ofs, struct rb_entry **prev_entry,
@@ -311,36 +311,6 @@ lookup_neighbors:return re; } -bool f2fs_check_rb_tree_consistence (struct f2fs_sb_info *sbi, -struct rb_root_cached *root) -{ -#ifdef CONFIG_F2FS_CHECK_FS -struct rb_node *cur =rb_first_cached (root), *next; -struct rb_entry *cur_re, *next_re; - -if (!cur) -return true; - -while (cur) { - next =rb_next (cur); -if (!next) -return true; - - cur_re = rb_entry(cur, struct rb_entry, rb_node); - next_re = rb_entry(next, struct rb_entry, rb_node); - -if (cur_re->ofs + cur_re->len > next_re->ofs) { -f2fs_info (sbi,"inconsistent rbtree, cur(%u, %u) next(%u, %u)" , - cur_re->ofs, cur_re->len, - next_re->ofs, next_re->len); -return false; - } - cur = next; - } -#endif -return true; -} -static struct kmem_cache *extent_tree_slab;static struct kmem_cache *extent_node_slab;
fs/f2fs/f2fs.h +1 -22
@@ -353,15 +353,7 @@ struct discard_info {struct discard_cmd {struct rb_node rb_node;/* rb node located in rb-tree */ -union { -struct { -block_t lstart;/* logical start address */ -block_t len;/* length */ -block_t start;/* actual start address in dev */ - }; -struct discard_info di;/* discard info */ - - }; +struct discard_info di;/* discard info */ struct list_head list;/* command list */ struct completion wait;/* compleation */ struct block_device *bdev;/* bdev */
@@ -4134,19 +4126,6 @@ void f2fs_leave_shrinker(struct f2fs_sb_* extent_cache.c */ bool sanity_check_extent_cache (struct inode *inode); -struct rb_entry *f2fs_lookup_rb_tree (struct rb_root_cached *root, -struct rb_entry *cached_re,unsigned int ofs); -struct rb_node **f2fs_lookup_rb_tree_for_insert (struct f2fs_sb_info *sbi, -struct rb_root_cached *root, -struct rb_node **parent, -unsigned int ofs,bool *leftmost); -struct rb_entry *f2fs_lookup_rb_tree_ret (struct rb_root_cached *root, -struct rb_entry *cached_re,unsigned int ofs, -struct rb_entry **prev_entry,struct rb_entry **next_entry, -struct rb_node ***insert_p,struct rb_node **insert_parent, -bool force,bool *leftmost); -bool f2fs_check_rb_tree_consistence (struct f2fs_sb_info *sbi, -struct rb_root_cached *root);void f2fs_init_extent_tree (struct inode *inode);void f2fs_drop_extent_tree (struct inode *inode);void f2fs_destroy_extent_node (struct inode *inode);
fs/f2fs/segment.c +164 -83
432 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 181/246 f2fs: remove entire rb_entry sharing
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit bf21acf9959a48d90dd32869a0649525eb21be56 upstream.
This is a last part to remove the memory sharing for rb_tree in extent_cache.
This should also fix arm32 memory alignment issue.
[struct extent_node] [struct rb_entry]
[0] struct rb_node rb_node; [0] struct rb_node rb_node;
union { union {
struct { struct {
[16] unsigned int fofs; [12] unsigned int ofs;
unsigned int len; unsigned int len;
};
unsigned long long key;
} __packed;--- fs/f2fs/extent_cache.c | 177 +++++++++++++++++++------------------------------ fs/f2fs/f2fs.h | 6 - 2 files changed, 71 insertions(+), 112 deletions(-)
fs/f2fs/extent_cache.c +71 -106
@@ -161,95 +161,52 @@ static bool __is_front_mergeable(structreturn __is_extent_mergeable (cur, front, type); } -static struct rb_entry *__lookup_rb_tree_fast (struct rb_entry *cached_re, -unsigned int ofs) -{ -if (cached_re) { -if (cached_re->ofs <= ofs && - cached_re->ofs + cached_re->len > ofs) { -return cached_re; - } - } -return NULL ; -} - -static struct rb_entry *__lookup_rb_tree_slow (struct rb_root_cached *root, -unsigned int ofs) +static struct extent_node *__lookup_extent_node (struct rb_root_cached *root, +struct extent_node *cached_en,unsigned int fofs) {struct rb_node *node = root->rb_root.rb_node; -struct rb_entry *re; +struct extent_node *en; + +/* check a cached entry */ +if (cached_en && cached_en->ei.fofs <= fofs && + cached_en->ei.fofs + cached_en->ei.len > fofs) +return cached_en; +/* check rb_tree */ while (node) { - re = rb_entry(node, struct rb_entry, rb_node); + en = rb_entry(node, struct extent_node, rb_node); -if (ofs < re->ofs) +if (fofs < en->ei.fofs) node = node->rb_left; -else if (ofs >= re->ofs + re->len) +else if (fofs >= en->ei.fofs + en->ei.len) node = node->rb_right;else -return re; +return en; }return NULL ; } -static struct rb_entry *f2fs_lookup_rb_tree (struct rb_root_cached *root, -struct rb_entry *cached_re,unsigned int ofs) -{ -struct rb_entry *re; - - re =__lookup_rb_tree_fast (cached_re, ofs); -if (!re) -return __lookup_rb_tree_slow (root, ofs); - -return re; -} - -static struct rb_node **f2fs_lookup_rb_tree_for_insert (struct f2fs_sb_info *sbi, -struct rb_root_cached *root, -struct rb_node **parent, -unsigned int ofs,bool *leftmost) -{ -struct rb_node **p = &root->rb_root.rb_node; -struct rb_entry *re; - -while (*p) { - *parent = *p; - re = rb_entry(*parent, struct rb_entry, rb_node); - -if (ofs < re->ofs) { - p = &(*p)->rb_left; - }else if (ofs >= re->ofs + re->len) { - p = &(*p)->rb_right; - *leftmost = false; - }else { -f2fs_bug_on (sbi,1 ); - } - } - -return p; -} -/* -* lookup rb entry in position of @ofs in rb-tree, +* lookup rb entry in position of @fofs in rb-tree, * if hit, return the entry, otherwise, return NULL -* @prev_ex: extent before ofs -* @next_ex: extent after ofs -* @insert_p: insert point for new extent at ofs +* @prev_ex: extent before fofs +* @next_ex: extent after fofs +* @insert_p: insert point for new extent at fofs * in order to simplify the insertion after. * tree must stay unchanged between lookup and insertion. */ -static struct rb_entry *f2fs_lookup_rb_tree_ret (struct rb_root_cached *root, -struct rb_entry *cached_re, -unsigned int ofs, -struct rb_entry **prev_entry, -struct rb_entry **next_entry, +static struct extent_node *__lookup_extent_node_ret (struct rb_root_cached *root, +struct extent_node *cached_en, +unsigned int fofs, +struct extent_node **prev_entry, +struct extent_node **next_entry,struct rb_node ***insert_p,struct rb_node **insert_parent, -bool force,bool *leftmost) +bool *leftmost) {struct rb_node **pnode = &root->rb_root.rb_node;struct rb_node *parent =NULL , *tmp_node; -struct rb_entry *re = cached_re; +struct extent_node *en = cached_en; *insert_p =NULL ; *insert_parent =NULL ;
@@ -259,24 +216,20 @@ static struct rb_entry *f2fs_lookup_rb_tif (RB_EMPTY_ROOT (&root->rb_root))return NULL ; -if (re) { -if (re->ofs <= ofs && re->ofs + re->len > ofs) - goto lookup_neighbors; - } +if (en && en->ei.fofs <= fofs && en->ei.fofs + en->ei.len > fofs) + goto lookup_neighbors; -if (leftmost) - *leftmost = true; + *leftmost = true;while (*pnode) { parent = *pnode; - re = rb_entry(*pnode, struct rb_entry, rb_node); + en = rb_entry(*pnode, struct extent_node, rb_node); -if (ofs < re->ofs) { +if (fofs < en->ei.fofs) { pnode = &(*pnode)->rb_left; - }else if (ofs >= re->ofs + re->len) { + }else if (fofs >= en->ei.fofs + en->ei.len) { pnode = &(*pnode)->rb_right; -if (leftmost) - *leftmost = false; + *leftmost = false; }else { goto lookup_neighbors; }
@@ -285,30 +238,32 @@ static struct rb_entry *f2fs_lookup_rb_t *insert_p = pnode; *insert_parent = parent; - re = rb_entry(parent, struct rb_entry, rb_node); + en = rb_entry(parent, struct extent_node, rb_node); tmp_node = parent; -if (parent && ofs > re->ofs) +if (parent && fofs > en->ei.fofs) tmp_node =rb_next (parent); - *next_entry = rb_entry_safe(tmp_node, struct rb_entry, rb_node); + *next_entry = rb_entry_safe(tmp_node, struct extent_node, rb_node); tmp_node = parent; -if (parent && ofs < re->ofs) +if (parent && fofs < en->ei.fofs) tmp_node =rb_prev (parent); - *prev_entry = rb_entry_safe(tmp_node, struct rb_entry, rb_node); + *prev_entry = rb_entry_safe(tmp_node, struct extent_node, rb_node);return NULL ; lookup_neighbors: -if (ofs == re->ofs || force) { +if (fofs == en->ei.fofs) {/* lookup prev node for merging backward later */ - tmp_node =rb_prev (&re->rb_node); - *prev_entry = rb_entry_safe(tmp_node, struct rb_entry, rb_node); + tmp_node =rb_prev (&en->rb_node); + *prev_entry =rb_entry_safe (tmp_node, + struct extent_node, rb_node); } -if (ofs == re->ofs + re->len -1 || force) { +if (fofs == en->ei.fofs + en->ei.len -1 ) {/* lookup next node for merging frontward later */ - tmp_node =rb_next (&re->rb_node); - *next_entry = rb_entry_safe(tmp_node, struct rb_entry, rb_node); + tmp_node =rb_next (&en->rb_node); + *next_entry =rb_entry_safe (tmp_node, + struct extent_node, rb_node); } -return re; +return en; }static struct kmem_cache *extent_tree_slab;
@@ -523,8 +478,7 @@ static bool __lookup_extent_tree(struct goto out; } - en = (struct extent_node *)f2fs_lookup_rb_tree (&et->root, - (struct rb_entry *)et->cached_en, pgofs); + en =__lookup_extent_node (&et->root, et->cached_en, pgofs);if (!en) goto out;
@@ -598,7 +552,7 @@ static struct extent_node *__insert_exte bool leftmost) {struct extent_tree_info *eti = &sbi->extent_tree[et->type]; -struct rb_node **p; +struct rb_node **p = &et->root.rb_root.rb_node;struct rb_node *parent =NULL ;struct extent_node *en =NULL ;
@@ -610,8 +564,21 @@ static struct extent_node *__insert_exte leftmost = true; - p =f2fs_lookup_rb_tree_for_insert (sbi, &et->root, &parent, - ei->fofs, &leftmost); +/* look up extent_node in the rb tree */ +while (*p) { + parent = *p; + en = rb_entry(parent, struct extent_node, rb_node); + +if (ei->fofs < en->ei.fofs) { + p = &(*p)->rb_left; + }else if (ei->fofs >= en->ei.fofs + en->ei.len) { + p = &(*p)->rb_right; + leftmost = false; + }else { +f2fs_bug_on (sbi,1 ); + } + } + do_insert: en =__attach_extent_node (sbi, et, ei, parent, p, leftmost);if (!en)
@@ -670,11 +637,10 @@ static void __update_extent_tree_range(s }/* 1. lookup first extent node in range [fofs, fofs + len - 1] */ - en = (struct extent_node *)f2fs_lookup_rb_tree_ret (&et->root, - (struct rb_entry *)et->cached_en, fofs, - (struct rb_entry **)&prev_en, - (struct rb_entry **)&next_en, - &insert_p, &insert_parent, false, + en =__lookup_extent_node_ret (&et->root, + et->cached_en, fofs, + &prev_en, &next_en, + &insert_p, &insert_parent, &leftmost);if (!en) en = next_en;
@@ -812,12 +778,11 @@ void f2fs_update_read_extent_tree_range_write_lock (&et->lock); - en = (struct extent_node *)f2fs_lookup_rb_tree_ret (&et->root, - (struct rb_entry *)et->cached_en, fofs, - (struct rb_entry **)&prev_en, - (struct rb_entry **)&next_en, - &insert_p, &insert_parent, false, - &leftmost); + en =__lookup_extent_node_ret (&et->root, + et->cached_en, fofs, + &prev_en, &next_en, + &insert_p, &insert_parent, + &leftmost);if (en) goto unlock_out;
fs/f2fs/f2fs.h +0 -6
@@ -620,12 +620,6 @@ enum extent_type { NR_EXTENT_CACHES, }; -struct rb_entry { -struct rb_node rb_node;/* rb node located in rb-tree */ -unsigned int ofs;/* start offset of the entry */ -unsigned int len;/* length of the entry */ -}; -struct extent_info {unsigned int fofs;/* start offset in a file */ unsigned int len;/* length of the extent */
Greg Kroah-Hartman
maintainerPATCH 182/246 f2fs: fix null pointer panic in tracepoint in __replace_atomic_write_block
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit da6ea0b050fa720302b56fbb59307e7c7531a342 upstream.
We got a kernel panic if old_addr is NULL.
https://bugzilla.kernel.org/show_bug.cgi?id=217266
BUG: kernel NULL pointer dereference, address: 0000000000000000 Call Trace: <TASK> f2fs_commit_atomic_write+0x619/0x990 [f2fs a1b985b80f5babd6f3ea778384908880812bfa43] __f2fs_ioctl+0xd8e/0x4080 [f2fs a1b985b80f5babd6f3ea778384908880812bfa43] ? vfs_write+0x2ae/0x3f0 ? vfs_write+0x2ae/0x3f0 __x64_sys_ioctl+0x91/0xd0 do_syscall_64+0x5c/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f69095fe53f
--- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +1 -1
@@ -263,7 +263,7 @@ retry:f2fs_put_dnode (&dn);trace_f2fs_replace_atomic_write_block (inode,F2FS_I (inode)->cow_inode, - index, *old_addr, new_addr, recover); + index, old_addr ? *old_addr :0 , new_addr, recover);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 183/246 f2fs: fix potential corruption when moving a directory
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit d94772154e524b329a168678836745d2773a6e02 upstream.
F2FS has the same issue in ext4_rename causing crash revealed by xfstests/generic/707.
See also commit 0813299c586b ("ext4: Fix possible corruption when moving a directory")
--- fs/f2fs/namei.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
fs/f2fs/namei.c +15 -1
@@ -995,12 +995,20 @@ static int f2fs_rename(struct mnt_idmap goto out; } +/* +* Copied from ext4_rename: we need to protect against old.inode +* directory getting converted from inline directory format into +* a normal one. +*/ +if (S_ISDIR (old_inode->i_mode)) +inode_lock_nested (old_inode,I_MUTEX_NONDIR2 ); + err = -ENOENT ; old_entry =f2fs_find_entry (old_dir, &old_dentry->d_name, &old_page);if (!old_entry) {if (IS_ERR (old_page)) err =PTR_ERR (old_page); - goto out; + goto out_unlock_old; }if (S_ISDIR (old_inode->i_mode)) {
@@ -1108,6 +1116,9 @@ static int f2fs_rename(struct mnt_idmapf2fs_unlock_op (sbi); +if (S_ISDIR (old_inode->i_mode)) +inode_unlock (old_inode); +if (IS_DIRSYNC (old_dir) ||IS_DIRSYNC (new_dir))f2fs_sync_fs (sbi->sb,1 );
@@ -1122,6 +1133,9 @@ out_dir:f2fs_put_page (old_dir_page,0 ); out_old:f2fs_put_page (old_page,0 ); +out_unlock_old: +if (S_ISDIR (old_inode->i_mode)) +inode_unlock (old_inode); out:iput (whiteout);return err;
Greg Kroah-Hartman
maintainerPATCH 184/246 irqchip/loongson-pch-pic: Fix pch_pic_acpi_init calling
In reply to Greg Kroah-HartmanFrom: Jianmin Lv <[email protected]>
commit 48ce2d722f7f108f27bedddf54bee3423a57ce57 upstream.
For dual-bridges scenario, pch_pic_acpi_init() will be called in following path:
cpuintc_acpi_init
acpi_cascade_irqdomain_init(in cpuintc driver)
acpi_table_parse_madt
eiointc_parse_madt
eiointc_acpi_init /* this will be called two times
correspondingto parsing two eiointc entries in MADT under dual-bridges scenario*/
acpi_cascade_irqdomain_init(in eiointc driver)
acpi_table_parse_madt
pch_pic_parse_madt
pch_pic_acpi_init /* this will be called depend
on valid parent IRQ domain handle for one or two times corresponding to parsing two pchpic entries in MADT druring calling eiointc_acpi_init() under dual-bridges scenario*/
During the first eiointc_acpi_init() calling, the pch_pic_acpi_init() will be called just one time since only one valid parent IRQ domain handle will be found for current eiointc IRQ domain.
During the second eiointc_acpi_init() calling, the pch_pic_acpi_init() will be called two times since two valid parent IRQ domain handles will be found. So in pch_pic_acpi_init(), we must have a reasonable way to prevent from creating second same pch_pic IRQ domain.
The patch matches gsi base information in created pch_pic IRQ domains to check if the target domain has been created to avoid the bug mentioned above.
--- drivers/irqchip/irq-loongson-pch-pic.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/irqchip/irq-loongson-pch-pic.c +3 -0
@@ -403,6 +403,9 @@ int __init pch_pic_acpi_init(struct irq_int ret, vec_base;struct fwnode_handle *domain_handle; +if (find_pch_pic (acpi_pchpic->gsi_base) >=0 ) +return 0 ; + vec_base = acpi_pchpic->gsi_base -GSI_MIN_PCH_IRQ ; domain_handle =irq_domain_alloc_fwnode (&acpi_pchpic->address);
Greg Kroah-Hartman
maintainerPATCH 185/246 irqchip/loongson-pch-pic: Fix registration of syscore_ops
In reply to Greg Kroah-HartmanFrom: Jianmin Lv <[email protected]>
commit c84efbba46901b187994558ee0edb15f7076c9a7 upstream.
When support suspend/resume for loongson-pch-pic, the syscore_ops is registered twice in dual-bridges machines where there are two pch-pic IRQ domains. Repeated registration of an same syscore_ops broke syscore_ops_list, so the patch will corret it.
--- drivers/irqchip/irq-loongson-pch-pic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/irq-loongson-pch-pic.c +2 -1
@@ -311,7 +311,8 @@ static int pch_pic_init(phys_addr_t addr pch_pic_handle[nr_pics] = domain_handle; pch_pic_priv[nr_pics++] = priv; -register_syscore_ops (&pch_pic_syscore_ops); +if (nr_pics ==1 ) +register_syscore_ops (&pch_pic_syscore_ops);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 186/246 irqchip/loongson-eiointc: Fix returned value on parsing MADT
In reply to Greg Kroah-HartmanFrom: Jianmin Lv <[email protected]>
commit 112eaa8fec5ea75f1be003ec55760b09a86799f8 upstream.
In pch_pic_parse_madt(), a NULL parent pointer will be returned from acpi_get_vec_parent() for second pch-pic domain related to second bridge while calling eiointc_acpi_init() at first time, where the parent of it has not been initialized yet, and will be initialized during second time calling eiointc_acpi_init(). So, it's reasonable to return zero so that failure of acpi_table_parse_madt() will be avoided, or else acpi_cascade_irqdomain_init() will return and initialization of followed pch_msi domain will be skipped.
Although it does not matter when pch_msi_parse_madt() returns -EINVAL if no invalid parent is found, it's also reasonable to return zero for that.
--- drivers/irqchip/irq-loongson-eiointc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-loongson-eiointc.c +2 -2
@@ -343,7 +343,7 @@ static int __init pch_pic_parse_madt(uniif (parent)return pch_pic_acpi_init (parent, pchpic_entry); -return -EINVAL ; +return 0 ; } static int __init pch_msi_parse_madt(union acpi_subtable_headers *header,
@@ -355,7 +355,7 @@ static int __init pch_msi_parse_madt(uniif (parent)return pch_msi_acpi_init (parent, pchmsi_entry); -return -EINVAL ; +return 0 ; }static int __init acpi_cascade_irqdomain_init (void )
Greg Kroah-Hartman
maintainerPATCH 187/246 irqchip/loongson-eiointc: Fix incorrect use of acpi_get_vec_parent
In reply to Greg Kroah-HartmanFrom: Jianmin Lv <[email protected]>
commit 64cc451e45e146b2140211b4f45f278b93b24ac0 upstream.
In eiointc_acpi_init(), a *eiointc* node is passed into acpi_get_vec_parent() instead of a required *NUMA* node (on some chip like 3C5000L, a *NUMA* node means a *eiointc* node, but on some chip like 3C5000, a *NUMA* node contains 4 *eiointc* nodes), and node in struct acpi_vector_group is essentially a *NUMA* node, which will lead to no parent matched for passed *eiointc* node. so the patch adjusts code to use *NUMA* node for parameter node of acpi_set_vec_parent/acpi_get_vec_parent.
--- drivers/irqchip/irq-loongson-eiointc.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/irqchip/irq-loongson-eiointc.c +16 -6
@@ -280,9 +280,6 @@ static void acpi_set_vec_parent(int node {int i; -if (cpu_has_flatmode) - node =cpu_to_node (node *CORES_PER_EIO_NODE ); -for (i =0 ; i <MAX_IO_PICS ; i++) {if (node == vec_group[i].node) { vec_group[i].parent = parent;
@@ -349,8 +346,16 @@ static int __init pch_pic_parse_madt(unistatic int __init pch_msi_parse_madt (union acpi_subtable_headers *header,const unsigned long end) { +struct irq_domain *parent;struct acpi_madt_msi_pic *pchmsi_entry = (struct acpi_madt_msi_pic *)header; -struct irq_domain *parent =acpi_get_vec_parent (eiointc_priv[nr_pics -1 ]->node, msi_group); +int node; + +if (cpu_has_flatmode) + node =cpu_to_node (eiointc_priv[nr_pics -1 ]->node *CORES_PER_EIO_NODE ); +else + node = eiointc_priv[nr_pics -1 ]->node; + + parent =acpi_get_vec_parent (node, msi_group);if (parent)return pch_msi_acpi_init (parent, pchmsi_entry);
@@ -379,6 +384,7 @@ int __init eiointc_acpi_init(struct irq_int i, ret, parent_irq;unsigned long node_map;struct eiointc_priv *priv; +int node; priv =kzalloc (sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -421,8 +427,12 @@ int __init eiointc_acpi_init(struct irq_"irqchip/loongarch/intc:starting" , eiointc_router_init, NULL); -acpi_set_vec_parent (acpi_eiointc->node, priv->eiointc_domain, pch_group); -acpi_set_vec_parent (acpi_eiointc->node, priv->eiointc_domain, msi_group); +if (cpu_has_flatmode) + node =cpu_to_node (acpi_eiointc->node *CORES_PER_EIO_NODE ); +else + node = acpi_eiointc->node; +acpi_set_vec_parent (node, priv->eiointc_domain, pch_group); +acpi_set_vec_parent (node, priv->eiointc_domain, msi_group); ret =acpi_cascade_irqdomain_init ();return ret;
Greg Kroah-Hartman
maintainerPATCH 188/246 irqchip/loongson-eiointc: Fix registration of syscore_ops
In reply to Greg Kroah-HartmanFrom: Jianmin Lv <[email protected]>
commit bdd60211eebb43ba1c4c14704965f4d4b628b931 upstream.
When support suspend/resume for loongson-eiointc, the syscore_ops is registered twice in dual-bridges machines where there are two eiointc IRQ domains. Repeated registration of an same syscore_ops broke syscore_ops_list. Also, cpuhp_setup_state_nocalls is only needed to call for once. So the patch will corret them.
--- drivers/irqchip/irq-loongson-eiointc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/irqchip/irq-loongson-eiointc.c +4 -2
@@ -422,10 +422,12 @@ int __init eiointc_acpi_init(struct irq_ parent_irq =irq_create_mapping (parent, acpi_eiointc->cascade);irq_set_chained_handler_and_data (parent_irq, eiointc_irq_dispatch, priv); -register_syscore_ops (&eiointc_syscore_ops); -cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_LOONGARCH_STARTING , +if (nr_pics ==1 ) { +register_syscore_ops (&eiointc_syscore_ops); +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_LOONGARCH_STARTING ,"irqchip/loongarch/intc:starting" , eiointc_router_init,NULL ); + }if (cpu_has_flatmode) node =cpu_to_node (acpi_eiointc->node *CORES_PER_EIO_NODE );
Greg Kroah-Hartman
maintainerPATCH 189/246 drm/panel: otm8009a: Set backlight parent to panel device
In reply to Greg Kroah-HartmanFrom: James Cowgill <[email protected]>
commit ab4f869fba6119997f7630d600049762a2b014fa upstream.
This is the logical place to put the backlight device, and it also fixes a kernel crash if the MIPI host is removed. Previously the backlight device would be unregistered twice when this happened - once as a child of the MIPI host through mipi_dsi_host_unregister, and once when the panel device is destroyed.
--- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +1 -1
@@ -471,7 +471,7 @@ static int otm8009a_probe(struct mipi_ds DRM_MODE_CONNECTOR_DSI); ctx->bl_dev =devm_backlight_device_register (dev,dev_name (dev), - dsi->host->dev, ctx, + dev, ctx, &otm8009a_backlight_ops,NULL );if (IS_ERR (ctx->bl_dev)) {
Greg Kroah-Hartman
maintainerPATCH 190/246 drm/amd/display: Add NULL plane_state check for cursor disable logic
In reply to Greg Kroah-HartmanFrom: Nicholas Kazlauskas <[email protected]>
commit d29fb7baab09b6a1dc484c9c67933253883e770a upstream.
[Why]
While scanning the top_pipe connections we can run into a case where the bottom pipe is still connected to a top_pipe but with a NULL plane_state.
[How]
Treat a NULL plane_state the same as the plane being invisible for pipe cursor disable logic.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +3 -1
@@ -3385,7 +3385,9 @@ static bool dcn10_can_pipe_disable_cursofor (test_pipe = pipe_ctx->top_pipe; test_pipe; test_pipe = test_pipe->top_pipe) {// Skip invisible layer and pipe-split plane on same layer -if (!test_pipe->plane_state->visible || test_pipe->plane_state->layer_index == cur_layer) +if (!test_pipe->plane_state || + !test_pipe->plane_state->visible || + test_pipe->plane_state->layer_index == cur_layer)continue ; r2 = test_pipe->plane_res.scl_data.recout;
Greg Kroah-Hartman
maintainerPATCH 191/246 drm/amd/display: Fix 4to1 MPC black screen with DPP RCO
In reply to Greg Kroah-HartmanFrom: Nicholas Kazlauskas <[email protected]>
commit bf224e00a9f54e2bf14b4d720a09c3d2f4aa4aa8 upstream.
[Why]
DPP Root clock optimization when combined with 4to1 MPC combine results in the screen turning black.
This is because the DPPCLK is stopped during the middle of an optimize_bandwidth sequence during commit_minimal_transition without going through plane power down/power up.
[How]
The intent of a 0Hz DPP clock through update_clocks is to disable the DTO. This differs from the behavior of stopping the DPPCLK entirely (utilizing a 0Hz clock on some ASIC) so it's better to move this logic to reside next to plane power up/power down where we gate the HUBP/DPP DOMAIN.
The new sequence should be:
Power down: PG enabled -> RCO on
Power up: RCO off -> PG disabled
Rename power_on_plane to power_on_plane_resources to reflect the actual operation that's occurring.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 12 ++++++- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 8 +++- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c | 13 +------ drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c | 23 ++++++++++++++ drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c | 10 ++++++ drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h | 2 + drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c | 1 drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 23 +++++++------- drivers/gpu/drm/amd/display/dc/inc/hw_sequencer_private.h | 4 ++ 9 files changed, 71 insertions(+), 25 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 -2
@@ -726,11 +726,15 @@ void dcn10_hubp_pg_control( } } -static void power_on_plane ( +static void power_on_plane_resources (struct dce_hwseq *hws,int plane_id) {DC_LOGGER_INIT (hws->ctx->logger); + +if (hws->funcs.dpp_root_clock_control) + hws->funcs.dpp_root_clock_control (hws, plane_id, true); +if (REG (DC_IP_REQUEST_CNTL )) {REG_SET (DC_IP_REQUEST_CNTL ,0 ,IP_REQUEST_EN ,1 );
@@ -1237,11 +1241,15 @@ void dcn10_plane_atomic_power_down(struc hws->funcs.hubp_pg_control (hws, hubp->inst, false); dpp->funcs->dpp_reset (dpp); +REG_SET (DC_IP_REQUEST_CNTL ,0 ,IP_REQUEST_EN ,0 );DC_LOG_DEBUG ("Power gated front end %d\n" , hubp->inst); } + +if (hws->funcs.dpp_root_clock_control) + hws->funcs.dpp_root_clock_control (hws, dpp->inst, false); }/* disable HW used by plane.
@@ -2462,7 +2470,7 @@ static void dcn10_enable_plane(undo_DEGVIDCN10_253_wa (dc); -power_on_plane (dc->hwseq, +power_on_plane_resources (dc->hwseq, pipe_ctx->plane_res.hubp->inst);/* enable DCFCLK current DCHUB */
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +6 -2
@@ -1121,11 +1121,15 @@ void dcn20_blank_pixel_data( } -static void dcn20_power_on_plane ( +static void dcn20_power_on_plane_resources (struct dce_hwseq *hws,struct pipe_ctx *pipe_ctx) {DC_LOGGER_INIT (hws->ctx->logger); + +if (hws->funcs.dpp_root_clock_control) + hws->funcs.dpp_root_clock_control (hws, pipe_ctx->plane_res.dpp->inst, true); +if (REG (DC_IP_REQUEST_CNTL )) {REG_SET (DC_IP_REQUEST_CNTL ,0 ,IP_REQUEST_EN ,1 );
@@ -1149,7 +1153,7 @@ static void dcn20_enable_plane(struct dc//if (dc->debug.sanity_checks) { // dcn10_verify_allow_pstate_change_high(dc); //} -dcn20_power_on_plane (dc->hwseq, pipe_ctx); +dcn20_power_on_plane_resources (dc->hwseq, pipe_ctx);/* enable DCFCLK current DCHUB */ pipe_ctx->plane_res.hubp->funcs->hubp_clk_cntl (pipe_ctx->plane_res.hubp, true);
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c +2 -11
@@ -66,17 +66,8 @@ void dccg31_update_dpp_dto(struct dccg *REG_UPDATE (DPPCLK_DTO_CTRL ,DPPCLK_DTO_ENABLE [dpp_inst],1 ); }else { -//DTO must be enabled to generate a 0Hz clock output -if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp) { -REG_UPDATE (DPPCLK_DTO_CTRL , -DPPCLK_DTO_ENABLE [dpp_inst],1 ); -REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 , -DPPCLK0_DTO_PHASE ,0 , -DPPCLK0_DTO_MODULO ,1 ); - }else { -REG_UPDATE (DPPCLK_DTO_CTRL , -DPPCLK_DTO_ENABLE [dpp_inst],0 ); - } +REG_UPDATE (DPPCLK_DTO_CTRL , +DPPCLK_DTO_ENABLE [dpp_inst],0 ); } dccg->pipe_dppclk_khz[dpp_inst] = req_dppclk; }
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c +23 -0
@@ -289,8 +289,31 @@ static void dccg314_set_valid_pixel_ratedccg314_set_dtbclk_dto (dccg, &dto_params); } +static void dccg314_dpp_root_clock_control ( +struct dccg *dccg, +unsigned int dpp_inst, +bool clock_on) +{ +struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg); + +if (clock_on) { +/* turn off the DTO and leave phase/modulo at max */ +REG_UPDATE (DPPCLK_DTO_CTRL ,DPPCLK_DTO_ENABLE [dpp_inst],0 ); +REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 , +DPPCLK0_DTO_PHASE ,0xFF , +DPPCLK0_DTO_MODULO ,0xFF ); + }else { +/* turn on the DTO to generate a 0hz clock */ +REG_UPDATE (DPPCLK_DTO_CTRL ,DPPCLK_DTO_ENABLE [dpp_inst],1 ); +REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 , +DPPCLK0_DTO_PHASE ,0 , +DPPCLK0_DTO_MODULO ,1 ); + } +} +static const struct dccg_funcs dccg314_funcs = { .update_dpp_dto = dccg31_update_dpp_dto, + .dpp_root_clock_control = dccg314_dpp_root_clock_control, .get_dccg_ref_freq = dccg31_get_dccg_ref_freq, .dccg_init = dccg31_init, .set_dpstreamclk = dccg314_set_dpstreamclk,
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c +10 -0
@@ -390,6 +390,16 @@ void dcn314_set_pixels_per_cycle(struct pix_per_cycle); } +void dcn314_dpp_root_clock_control (struct dce_hwseq *hws,unsigned int dpp_inst,bool clock_on) +{ +if (!hws->ctx->dc->debug.root_clock_optimization.bits.dpp) +return ; + +if (hws->ctx->dc->res_pool->dccg->funcs->dpp_root_clock_control) + hws->ctx->dc->res_pool->dccg->funcs->dpp_root_clock_control ( + hws->ctx->dc->res_pool->dccg, dpp_inst, clock_on); +} +void dcn314_hubp_pg_control (struct dce_hwseq *hws,unsigned int hubp_inst,bool power_on) {struct dc_context *ctx = hws->ctx;
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h +2 -0
@@ -43,4 +43,6 @@ void dcn314_set_pixels_per_cycle(structvoid dcn314_hubp_pg_control (struct dce_hwseq *hws,unsigned int hubp_inst,bool power_on); +void dcn314_dpp_root_clock_control (struct dce_hwseq *hws,unsigned int dpp_inst,bool clock_on); +#endif /* __DC_HWSS_DCN314_H__ */
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c +1 -0
@@ -137,6 +137,7 @@ static const struct hwseq_private_funcs .plane_atomic_disable = dcn20_plane_atomic_disable, .plane_atomic_power_down = dcn10_plane_atomic_power_down, .enable_power_gating_plane = dcn314_enable_power_gating_plane, + .dpp_root_clock_control = dcn314_dpp_root_clock_control, .hubp_pg_control = dcn314_hubp_pg_control, .program_all_writeback_pipes_in_tree = dcn30_program_all_writeback_pipes_in_tree, .update_odm = dcn314_update_odm,
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h +13 -10
@@ -148,18 +148,21 @@ struct dccg_funcs {struct dccg *dccg, int inst); -void (*set_pixel_rate_div)( -struct dccg *dccg, -uint32_t otg_inst, -enum pixel_rate_div k1, -enum pixel_rate_div k2); +void (*set_pixel_rate_div)(struct dccg *dccg, +uint32_t otg_inst, +enum pixel_rate_div k1, +enum pixel_rate_div k2); -void (*set_valid_pixel_rate)( -struct dccg *dccg, -int ref_dtbclk_khz, -int otg_inst, - int pixclk_khz); +void (*set_valid_pixel_rate)( +struct dccg *dccg, +int ref_dtbclk_khz, +int otg_inst, +int pixclk_khz); +void (*dpp_root_clock_control)( +struct dccg *dccg, +unsigned int dpp_inst, + bool clock_on); };#endif //__DAL_DCCG_H__
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer_private.h +4 -0
@@ -115,6 +115,10 @@ struct hwseq_private_funcs {void (*plane_atomic_disable)(struct dc *dc,struct pipe_ctx *pipe_ctx);void (*enable_power_gating_plane)(struct dce_hwseq *hws,bool enable); +void (*dpp_root_clock_control)( +struct dce_hwseq *hws, +unsigned int dpp_inst, +bool clock_on);void (*dpp_pg_control)(struct dce_hwseq *hws,unsigned int dpp_inst,bool power_on);
Greg Kroah-Hartman
maintainerPATCH 192/246 drm/amd/display: filter out invalid bits in pipe_fuses
In reply to Greg Kroah-HartmanFrom: Samson Tam <[email protected]>
commit 682439fffad9fa9a38d37dd1b1318e9374232213 upstream.
[Why]
Reading pipe_fuses from register may have invalid bits set, which may
affect the num_pipes erroneously.
[How]
Add read_pipes_fuses() call and filter bits based on expected number
of pipes.
--- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c | 10 +++++++++- drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +9 -1
@@ -2077,6 +2077,14 @@ static struct resource_funcs dcn32_res_p .restore_mall_state = dcn32_restore_mall_state, }; +static uint32_t read_pipe_fuses (struct dc_context *ctx) +{ +uint32_t value =REG_READ (CC_DC_PIPE_DIS ); +/* DCN32 support max 4 pipes */ + value = value &0xf ; +return value; +} + static bool dcn32_resource_construct( uint8_t num_virtual_links,
@@ -2119,7 +2127,7 @@ static bool dcn32_resource_construct( pool->base.res_cap = &res_cap_dcn32;/* max number of pipes for ASIC before checking for pipe fuses */ num_pipes = pool->base.res_cap->num_timing_generator; - pipe_fuses =REG_READ (CC_DC_PIPE_DIS ); + pipe_fuses =read_pipe_fuses (ctx);for (i =0 ; i < pool->base.res_cap->num_timing_generator; i++)if (pipe_fuses &1 << i)
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c +9 -1
@@ -1626,6 +1626,14 @@ static struct resource_funcs dcn321_res_ .restore_mall_state = dcn32_restore_mall_state, }; +static uint32_t read_pipe_fuses (struct dc_context *ctx) +{ +uint32_t value =REG_READ (CC_DC_PIPE_DIS ); +/* DCN321 support max 4 pipes */ + value = value &0xf ; +return value; +} + static bool dcn321_resource_construct( uint8_t num_virtual_links,
@@ -1668,7 +1676,7 @@ static bool dcn321_resource_construct( pool->base.res_cap = &res_cap_dcn321;/* max number of pipes for ASIC before checking for pipe fuses */ num_pipes = pool->base.res_cap->num_timing_generator; - pipe_fuses =REG_READ (CC_DC_PIPE_DIS ); + pipe_fuses =read_pipe_fuses (ctx);for (i =0 ; i < pool->base.res_cap->num_timing_generator; i++)if (pipe_fuses &1 << i)
Greg Kroah-Hartman
maintainerPATCH 193/246 drm/amd/display: fix access hdcp_workqueue assert
In reply to Greg Kroah-HartmanFrom: Hersen Wu <[email protected]>
commit 3cf7cd3f770a0b89dc5f06e19edb52e65b93b214 upstream.
[Why] hdcp are enabled for asics from raven. for old asics which hdcp are not enabled, hdcp_workqueue are null. some access to hdcp work queue are not guarded with pointer check.
[How] add hdcp_workqueue pointer check before access workqueue.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 16 +++++++----- 2 files changed, 16 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -0
@@ -8533,6 +8533,9 @@ static void amdgpu_dm_atomic_commit_tailstruct amdgpu_crtc *acrtc =to_amdgpu_crtc (dm_new_con_state->base.crtc);struct amdgpu_dm_connector *aconnector =to_amdgpu_dm_connector (connector); +if (!adev->dm.hdcp_workqueue) +continue ; +pr_debug ("[HDCP_DM] -------------- i : %x ----------\n" , i);if (!connector)
@@ -8581,6 +8584,9 @@ static void amdgpu_dm_atomic_commit_tailstruct amdgpu_crtc *acrtc =to_amdgpu_crtc (dm_new_con_state->base.crtc);struct amdgpu_dm_connector *aconnector =to_amdgpu_dm_connector (connector); +if (!adev->dm.hdcp_workqueue) +continue ; + new_crtc_state =NULL ; old_crtc_state =NULL ;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +10 -6
@@ -385,13 +385,17 @@ static int dm_dp_mst_get_modes(struct drif (aconnector->dc_sink && connector->state) {struct drm_device *dev = connector->dev;struct amdgpu_device *adev =drm_to_adev (dev); -struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue; -struct hdcp_workqueue *hdcp_w = &hdcp_work[aconnector->dc_link->link_index]; - connector->state->hdcp_content_type = - hdcp_w->hdcp_content_type[connector->index]; - connector->state->content_protection = - hdcp_w->content_protection[connector->index]; +if (adev->dm.hdcp_workqueue) { +struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue; +struct hdcp_workqueue *hdcp_w = + &hdcp_work[aconnector->dc_link->link_index]; + + connector->state->hdcp_content_type = + hdcp_w->hdcp_content_type[connector->index]; + connector->state->content_protection = + hdcp_w->content_protection[connector->index]; + } }#endif
Greg Kroah-Hartman
maintainerPATCH 194/246 drm/amd/display: fix flickering caused by S/G mode
In reply to Greg Kroah-HartmanFrom: Hamza Mahfooz <[email protected]>
commit 08da182175db4c7f80850354849d95f2670e8cd9 upstream.
Currently, on a handful of ASICs. We allow the framebuffer for a given plane to exist in either VRAM or GTT. However, if the plane's new framebuffer is in a different memory domain than it's previous framebuffer, flipping between them can cause the screen to flicker. So, to fix this, don't perform an immediate flip in the aforementioned case.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +11 -2
@@ -7876,6 +7876,13 @@ static void amdgpu_dm_commit_cursors(strhandle_cursor_update (plane, old_plane_state); } +static inline uint32_t get_mem_type (struct drm_framebuffer *fb) +{ +struct amdgpu_bo *abo =gem_to_amdgpu_bo (fb->obj[0 ]); + +return abo->tbo.resource ? abo->tbo.resource->mem_type :0 ; +} + static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, struct dc_state *dc_state, struct drm_device *dev,
@@ -8016,11 +8023,13 @@ static void amdgpu_dm_commit_planes(stru/* * Only allow immediate flips for fast updates that don't -* change FB pitch, DCC state, rotation or mirroing. +* change memory domain, FB pitch, DCC state, rotation or +* mirroring. */ bundle->flip_addrs[planes_count].flip_immediate = crtc->state->async_flip && - acrtc_state->update_type ==UPDATE_TYPE_FAST ; + acrtc_state->update_type ==UPDATE_TYPE_FAST && +get_mem_type (old_plane_state->fb) ==get_mem_type (fb); timestamp_ns =ktime_get_ns (); bundle->flip_addrs[planes_count].flip_timestamp_in_us =div_u64 (timestamp_ns,1000 );
Greg Kroah-Hartman
maintainerPATCH 195/246 drm/amdgpu: drop redundant sched job cleanup when cs is aborted
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
commit 1253685f0d3eb3eab0bfc4bf15ab341a5f3da0c8 upstream.
Once command submission failed due to userptr invalidation in amdgpu_cs_submit, legacy code will perform cleanup of scheduler job. However, it's not needed at all, as former commit has integrated job cleanup stuff into amdgpu_job_free. Otherwise, because of double free, a NULL pointer dereference will occur in such scenario.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -10
@@ -1276,7 +1276,7 @@ static int amdgpu_cs_submit(struct amdgp r =drm_sched_job_add_dependency (&leader->base, fence);if (r) {dma_fence_put (fence); - goto error_cleanup; +return r; } }
@@ -1303,7 +1303,8 @@ static int amdgpu_cs_submit(struct amdgp }if (r) { r = -EAGAIN ; - goto error_unlock; +mutex_unlock (&p->adev->notifier_lock); +return r; } p->fence =dma_fence_get (&leader->base.s_fence->finished);
@@ -1350,14 +1351,6 @@ static int amdgpu_cs_submit(struct amdgpmutex_unlock (&p->adev->notifier_lock);mutex_unlock (&p->bo_list->bo_list_mutex);return 0 ; - -error_unlock: -mutex_unlock (&p->adev->notifier_lock); - -error_cleanup: -for (i =0 ; i < p->gang_size; ++i) -drm_sched_job_cleanup (&p->jobs[i]->base); -return r; }/* Cleanup the parser structure */
Greg Kroah-Hartman
maintainerPATCH 196/246 drm/amd/display: Change default Z8 watermark values
In reply to Greg Kroah-HartmanFrom: Leo Chen <[email protected]>
commit 8f586cc16c1fc3c2202c9d54563db8c7ed365f82 upstream.
[Why & How]
Previous Z8 watermark values were causing flickering and OTC underflow. Updating Z8 watermark values based on the measurement.
--- drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c +2 -2
@@ -149,8 +149,8 @@ struct _vcs_dpi_soc_bounding_box_st dcn3 .num_states = 5, .sr_exit_time_us = 16.5, .sr_enter_plus_exit_time_us = 18.5, - .sr_exit_z8_time_us = 210.0, - .sr_enter_plus_exit_z8_time_us = 310.0, + .sr_exit_z8_time_us = 268.0, + .sr_enter_plus_exit_z8_time_us = 393.0, .writeback_latency_us = 12.0, .dram_channel_width_bytes = 4, .round_trip_ping_latency_dcfclk_cycles = 106,
Greg Kroah-Hartman
maintainerPATCH 197/246 drm/amdgpu: fix amdgpu_irq_put call trace in gmc_v10_0_hw_fini
In reply to Greg Kroah-HartmanFrom: Horatio Zhang <[email protected]>
commit 08c677cb0b436a96a836792bb35a8ec5de4999c2 upstream.
The gmc.ecc_irq is enabled by firmware per IFWI setting, and the host driver is not privileged to enable/disable the interrupt. So, it is meaningless to use the amdgpu_irq_put function in gmc_v10_0_hw_fini, which also leads to the call trace.
[ 82.340264] Call Trace: [ 82.340265] <TASK> [ 82.340269] gmc_v10_0_hw_fini+0x83/0xa0 [amdgpu] [ 82.340447] gmc_v10_0_suspend+0xe/0x20 [amdgpu] [ 82.340623] amdgpu_device_ip_suspend_phase2+0x127/0x1c0 [amdgpu] [ 82.340789] amdgpu_device_ip_suspend+0x3d/0x80 [amdgpu] [ 82.340955] amdgpu_device_pre_asic_reset+0xdd/0x2b0 [amdgpu] [ 82.341122] amdgpu_device_gpu_recover.cold+0x4dd/0xbb2 [amdgpu] [ 82.341359] amdgpu_debugfs_reset_work+0x4c/0x70 [amdgpu] [ 82.341529] process_one_work+0x21d/0x3f0 [ 82.341535] worker_thread+0x1fa/0x3c0 [ 82.341538] ? process_one_work+0x3f0/0x3f0 [ 82.341540] kthread+0xff/0x130 [ 82.341544] ? kthread_complete_and_exit+0x20/0x20 [ 82.341547] ret_from_fork+0x22/0x30
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -1
@@ -1161,7 +1161,6 @@ static int gmc_v10_0_hw_fini(void *handlreturn 0 ; } -amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 );amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 198/246 drm/amdgpu: fix an amdgpu_irq_put() issue in gmc_v9_0_hw_fini()
In reply to Greg Kroah-HartmanFrom: Hamza Mahfooz <[email protected]>
commit 922a76ba31adf84e72bc947267385be420c689ee upstream.
As made mention of in commit 08c677cb0b43 ("drm/amdgpu: fix amdgpu_irq_put call trace in gmc_v10_0_hw_fini") and commit 13af556104fa ("drm/amdgpu: fix amdgpu_irq_put call trace in gmc_v11_0_hw_fini"). It is meaningless to call amdgpu_irq_put() for gmc.ecc_irq. So, remove it from gmc_v9_0_hw_fini().
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -1
@@ -1987,7 +1987,6 @@ static int gmc_v9_0_hw_fini(void *handleif (adev->mmhub.funcs->update_power_gating) adev->mmhub.funcs->update_power_gating (adev, false); -amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 );amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 199/246 drm/amdgpu: fix amdgpu_irq_put call trace in gmc_v11_0_hw_fini
In reply to Greg Kroah-HartmanFrom: Horatio Zhang <[email protected]>
commit 13af556104fa93b1945c70bbf8a0a62cd2c92879 upstream.
The gmc.ecc_irq is enabled by firmware per IFWI setting, and the host driver is not privileged to enable/disable the interrupt. So, it is meaningless to use the amdgpu_irq_put function in gmc_v11_0_hw_fini, which also leads to the call trace.
[ 102.980303] Call Trace: [ 102.980303] <TASK> [ 102.980304] gmc_v11_0_hw_fini+0x54/0x90 [amdgpu] [ 102.980357] gmc_v11_0_suspend+0xe/0x20 [amdgpu] [ 102.980409] amdgpu_device_ip_suspend_phase2+0x240/0x460 [amdgpu] [ 102.980459] amdgpu_device_ip_suspend+0x3d/0x80 [amdgpu] [ 102.980520] amdgpu_device_pre_asic_reset+0xd9/0x490 [amdgpu] [ 102.980573] amdgpu_device_gpu_recover.cold+0x548/0xce6 [amdgpu] [ 102.980687] amdgpu_debugfs_reset_work+0x4c/0x70 [amdgpu] [ 102.980740] process_one_work+0x21f/0x3f0 [ 102.980741] worker_thread+0x200/0x3e0 [ 102.980742] ? process_one_work+0x3f0/0x3f0 [ 102.980743] kthread+0xfd/0x130 [ 102.980743] ? kthread_complete_and_exit+0x20/0x20 [ 102.980744] ret_from_fork+0x22/0x30
--- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +0 -1
@@ -954,7 +954,6 @@ static int gmc_v11_0_hw_fini(void *handlreturn 0 ; } -amdgpu_irq_put (adev, &adev->gmc.ecc_irq,0 );amdgpu_irq_put (adev, &adev->gmc.vm_fault,0 );gmc_v11_0_gart_disable (adev);
Greg Kroah-Hartman
maintainerPATCH 200/246 drm/amdgpu/gfx: disable gfx9 cp_ecc_error_irq only when enabling legacy gfx ras
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
commit 4a76680311330aefe5074bed8f06afa354b85c48 upstream.
gfx9 cp_ecc_error_irq is only enabled when legacy gfx ras is assert. So in gfx_v9_0_hw_fini, interrupt disablement for cp_ecc_error_irq should be executed under such condition, otherwise, an amdgpu_irq_put calltrace will occur.
[ 7283.170322] RIP: 0010:amdgpu_irq_put+0x45/0x70 [amdgpu] [ 7283.170964] RSP: 0018:ffff9a5fc3967d00 EFLAGS: 00010246 [ 7283.170967] RAX: ffff98d88afd3040 RBX: ffff98d89da20000 RCX: 0000000000000000 [ 7283.170969] RDX: 0000000000000000 RSI: ffff98d89da2bef8 RDI: ffff98d89da20000 [ 7283.170971] RBP: ffff98d89da20000 R08: ffff98d89da2ca18 R09: 0000000000000006 [ 7283.170973] R10: ffffd5764243c008 R11: 0000000000000000 R12: 0000000000001050 [ 7283.170975] R13: ffff98d89da38978 R14: ffffffff999ae15a R15: ffff98d880130105 [ 7283.170978] FS: 0000000000000000(0000) GS:ffff98d996f00000(0000) knlGS:0000000000000000 [ 7283.170981] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 7283.170983] CR2: 00000000f7a9d178 CR3: 00000001c42ea000 CR4: 00000000003506e0 [ 7283.170986] Call Trace: [ 7283.170988] <TASK> [ 7283.170989] gfx_v9_0_hw_fini+0x1c/0x6d0 [amdgpu] [ 7283.171655] amdgpu_device_ip_suspend_phase2+0x101/0x1a0 [amdgpu] [ 7283.172245] amdgpu_device_suspend+0x103/0x180 [amdgpu] [ 7283.172823] amdgpu_pmops_freeze+0x21/0x60 [amdgpu] [ 7283.173412] pci_pm_freeze+0x54/0xc0 [ 7283.173419] ? __pfx_pci_pm_freeze+0x10/0x10 [ 7283.173425] dpm_run_callback+0x98/0x200 [ 7283.173430] __device_suspend+0x164/0x5f0
v2: drop gfx11 as it's fixed in a different solution by retiring cp_ecc_irq funcs(Hawking)
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -3751,7 +3751,8 @@ static int gfx_v9_0_hw_fini(void *handle {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 ); +if (amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__GFX )) +amdgpu_irq_put (adev, &adev->gfx.cp_ecc_error_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );amdgpu_irq_put (adev, &adev->gfx.priv_inst_irq,0 );
Greg Kroah-Hartman
maintainerPATCH 201/246 drm/amdgpu/jpeg: Remove harvest checking for JPEG3
In reply to Greg Kroah-HartmanFrom: Saleemkhan Jamadar <[email protected]>
commit 5b94db73e45e2e6c2840f39c022fd71dfa47fc58 upstream.
Register CC_UVD_HARVESTING is obsolete for JPEG 3.1.2
--- drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c +1 -0
@@ -54,6 +54,7 @@ static int jpeg_v3_0_early_init(void *haswitch (adev->ip_versions[UVD_HWIP ][0 ]) {case IP_VERSION (3 ,1 ,1 ): +case IP_VERSION (3 ,1 ,2 ):break ;default : harvest =RREG32_SOC15 (JPEG ,0 , mmCC_UVD_HARVESTING);
Greg Kroah-Hartman
maintainerPATCH 202/246 drm/amdgpu: change gfx 11.0.4 external_id range
In reply to Greg Kroah-HartmanFrom: Yifan Zhang <[email protected]>
commit 996e93a3fe74dcf9d467ae3020aea42cc3ff65e3 upstream.
gfx 11.0.4 range starts from 0x80.
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -1
@@ -778,7 +778,7 @@ static int soc21_common_early_init(voidAMD_PG_SUPPORT_VCN_DPG |AMD_PG_SUPPORT_GFX_PG |AMD_PG_SUPPORT_JPEG ; - adev->external_rev_id = adev->rev_id +0x1 ; + adev->external_rev_id = adev->rev_id +0x80 ;break ;default :
Greg Kroah-Hartman
maintainerPATCH 203/246 drm/amdgpu: Fix vram recover doesnt work after whole GPU reset (v2)
In reply to Greg Kroah-HartmanFrom: Lin.Cao <[email protected]>
commit 6c032c37ac3ef3b7df30937c785ecc4da428edc0 upstream.
v1: Vmbo->shadow is used to back vram bo up when vram lost. So that we should set shadow as vmbo->shadow to recover vmbo->bo
v2: Modify if(vmbo->shadow) shadow = vmbo->shadow as if(!vmbo->shadow) continue;
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -1
@@ -4482,7 +4482,11 @@ static int amdgpu_device_recover_vram(stdev_info (adev->dev,"recover vram bo from shadow start\n" );mutex_lock (&adev->shadow_list_lock);list_for_each_entry (vmbo, &adev->shadow_list, shadow_list) { - shadow = &vmbo->bo; +/* If vm is compute context or adev is APU, shadow will be NULL */ +if (!vmbo->shadow) +continue ; + shadow = vmbo->shadow; +/* No need to recover an evicted BO */ if (shadow->tbo.resource->mem_type != TTM_PL_TT || shadow->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET ||
Greg Kroah-Hartman
maintainerPATCH 204/246 drm/amd/display: Enforce 60us prefetch for 200Mhz DCFCLK modes
In reply to Greg Kroah-HartmanFrom: Alvin Lee <[email protected]>
commit b504f99ccaa64da364443431e388ecf30b604e38 upstream.
[Description]
- Due to bandwidth / arbitration issues at 200Mhz DCFCLK, we want to enforce minimum 60us of prefetch to avoid intermittent underflow issues
- Since 60us prefetch is already enforced for UCLK DPM0, and many DCFCLK's > 200Mhz are mapped to UCLK DPM1, in theory there should not be any UCLK DPM regressions by enforcing greater prefetch
--- drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c | 5 +++-- drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +3 -2
@@ -810,7 +810,8 @@ static void DISPCLKDPPCLKDCFCLKDeepSleep v->SwathHeightY[k], v->SwathHeightC[k], TWait, - v->DRAMSpeedPerState[mode_lib->vba.VoltageLevel] <=MEM_STROBE_FREQ_MHZ ? + (v->DRAMSpeedPerState[mode_lib->vba.VoltageLevel] <=MEM_STROBE_FREQ_MHZ || + v->DCFCLKPerState[mode_lib->vba.VoltageLevel] <=MIN_DCFCLK_FREQ_MHZ ) ? mode_lib->vba.ip.min_prefetch_in_strobe_us :0 ,/* Output */ &v->DSTXAfterScaler[k],
@@ -3309,7 +3310,7 @@ void dml32_ModeSupportAndSystemConfigura v->swath_width_chroma_ub_this_state[k], v->SwathHeightYThisState[k], v->SwathHeightCThisState[k], v->TWait, - v->DRAMSpeedPerState[i] <=MEM_STROBE_FREQ_MHZ ? + (v->DRAMSpeedPerState[i] <=MEM_STROBE_FREQ_MHZ || v->DCFCLKState[i][j] <=MIN_DCFCLK_FREQ_MHZ ) ? mode_lib->vba.ip.min_prefetch_in_strobe_us : 0,/* Output */
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.h +1 -0
@@ -53,6 +53,7 @@#define BPP_BLENDED_PIPE 0xffffffff#define MEM_STROBE_FREQ_MHZ 1600 +#define MIN_DCFCLK_FREQ_MHZ 200#define MEM_STROBE_MAX_DELIVERY_TIME_US 60.0struct display_mode_lib ;
Greg Kroah-Hartman
maintainerPATCH 205/246 drm/amd/pm: parse pp_handle under appropriate conditions
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
commit 58d9b9a14b47c2a3da6effcbb01607ad7edc0275 upstream.
amdgpu_dpm_is_overdrive_supported is a common API across all asics, so we should cast pp_handle into correct structure under different power frameworks.
v2: using return directly to simplify code
v3: SI asic does not carry od_enabled member in pp_handle, and update Fixes tag
--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +13 -7
@@ -1432,15 +1432,21 @@ int amdgpu_dpm_get_smu_prv_buf_details(sint amdgpu_dpm_is_overdrive_supported (struct amdgpu_device *adev) { -struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; -struct smu_context *smu = adev->powerplay.pp_handle; +if (is_support_sw_smu (adev)) { +struct smu_context *smu = adev->powerplay.pp_handle; -if ((is_support_sw_smu (adev) && smu->od_enabled) || - (is_support_sw_smu (adev) && smu->is_apu) || - (!is_support_sw_smu (adev) && hwmgr->od_enabled)) -return true; +return (smu->od_enabled || smu->is_apu); + }else { +struct pp_hwmgr *hwmgr; -return false; +/* SI asic does not carry od_enabled */ +if (adev->family ==AMDGPU_FAMILY_SI ) +return false; + + hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle; + +return hwmgr->od_enabled; + } } int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
Greg Kroah-Hartman
maintainerPATCH 206/246 drm/amdgpu: drop gfx_v11_0_cp_ecc_error_irq_funcs
In reply to Greg Kroah-HartmanFrom: Horatio Zhang <[email protected]>
commit 720b47229a5b24061d1c2e29ddb6043a59178d79 upstream.
The gfx.cp_ecc_error_irq is retired in gfx11. In gfx_v11_0_hw_fini still use amdgpu_irq_put to disable this interrupt, which caused the call trace in this function.
[ 102.873958] Call Trace: [ 102.873959] <TASK> [ 102.873961] gfx_v11_0_hw_fini+0x23/0x1e0 [amdgpu] [ 102.874019] gfx_v11_0_suspend+0xe/0x20 [amdgpu] [ 102.874072] amdgpu_device_ip_suspend_phase2+0x240/0x460 [amdgpu] [ 102.874122] amdgpu_device_ip_suspend+0x3d/0x80 [amdgpu] [ 102.874172] amdgpu_device_pre_asic_reset+0xd9/0x490 [amdgpu] [ 102.874223] amdgpu_device_gpu_recover.cold+0x548/0xce6 [amdgpu] [ 102.874321] amdgpu_debugfs_reset_work+0x4c/0x70 [amdgpu] [ 102.874375] process_one_work+0x21f/0x3f0 [ 102.874377] worker_thread+0x200/0x3e0 [ 102.874378] ? process_one_work+0x3f0/0x3f0 [ 102.874379] kthread+0xfd/0x130 [ 102.874380] ? kthread_complete_and_exit+0x20/0x20 [ 102.874381] ret_from_fork+0x22/0x30
v2:
- Handle umc and gfx ras cases in separated patch
- Retired the gfx_v11_0_cp_ecc_error_irq_funcs in gfx11
v3:
- Improve the subject and code comments
- Add judgment on gfx11 in the function of amdgpu_gfx_ras_late_init
v4:
- Drop the define of CP_ME1_PIPE_INST_ADDR_INTERVAL and SET_ECC_ME_PIPE_STATE which using in gfx_v11_0_set_cp_ecc_error_state
- Check cp_ecc_error_irq.funcs rather than ip version for a more sustainable life
v5:
- Simplify judgment conditions
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 +++-- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 46 -------------------------------- 2 files changed, 5 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +5 -3
@@ -686,9 +686,11 @@ int amdgpu_gfx_ras_late_init(struct amdgif (r)return r; - r =amdgpu_irq_get (adev, &adev->gfx.cp_ecc_error_irq,0 ); -if (r) - goto late_fini; +if (adev->gfx.cp_ecc_error_irq.funcs) { + r =amdgpu_irq_get (adev, &adev->gfx.cp_ecc_error_irq,0 ); +if (r) + goto late_fini; + } }else {amdgpu_ras_feature_enable_on_boot (adev, ras_block,0 ); }
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -46
76 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 207/246 drm/amdgpu: disable sdma ecc irq only when sdma RAS is enabled in suspend
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
commit 8b229ada2669b74fdae06c83fbfda5a5a99fc253 upstream.
sdma_v4_0_ip is shared on a few asics, but in sdma_v4_0_hw_fini, driver unconditionally disables ecc_irq which is only enabled on those asics enabling sdma ecc. This will introduce a warning in suspend cycle on those chips with sdma ip v4.0, while without sdma ecc. So this patch correct this.
[ 7283.166354] RIP: 0010:amdgpu_irq_put+0x45/0x70 [amdgpu] [ 7283.167001] RSP: 0018:ffff9a5fc3967d08 EFLAGS: 00010246 [ 7283.167019] RAX: ffff98d88afd3770 RBX: 0000000000000001 RCX: 0000000000000000 [ 7283.167023] RDX: 0000000000000000 RSI: ffff98d89da30390 RDI: ffff98d89da20000 [ 7283.167025] RBP: ffff98d89da20000 R08: 0000000000036838 R09: 0000000000000006 [ 7283.167028] R10: ffffd5764243c008 R11: 0000000000000000 R12: ffff98d89da30390 [ 7283.167030] R13: ffff98d89da38978 R14: ffffffff999ae15a R15: ffff98d880130105 [ 7283.167032] FS: 0000000000000000(0000) GS:ffff98d996f00000(0000) knlGS:0000000000000000 [ 7283.167036] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 7283.167039] CR2: 00000000f7a9d178 CR3: 00000001c42ea000 CR4: 00000000003506e0 [ 7283.167041] Call Trace: [ 7283.167046] <TASK> [ 7283.167048] sdma_v4_0_hw_fini+0x38/0xa0 [amdgpu] [ 7283.167704] amdgpu_device_ip_suspend_phase2+0x101/0x1a0 [amdgpu] [ 7283.168296] amdgpu_device_suspend+0x103/0x180 [amdgpu] [ 7283.168875] amdgpu_pmops_freeze+0x21/0x60 [amdgpu] [ 7283.169464] pci_pm_freeze+0x54/0xc0
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +5 -3
@@ -1903,9 +1903,11 @@ static int sdma_v4_0_hw_fini(void *handlreturn 0 ; } -for (i =0 ; i < adev->sdma.num_instances; i++) { -amdgpu_irq_put (adev, &adev->sdma.ecc_irq, -AMDGPU_SDMA_IRQ_INSTANCE0 + i); +if (amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__SDMA )) { +for (i =0 ; i < adev->sdma.num_instances; i++) { +amdgpu_irq_put (adev, &adev->sdma.ecc_irq, +AMDGPU_SDMA_IRQ_INSTANCE0 + i); + } }sdma_v4_0_ctx_switch_enable (adev, false);
Greg Kroah-Hartman
maintainerPATCH 208/246 drm/amd/pm: avoid potential UBSAN issue on legacy asics
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
commit 5247f05eadf1081a74b2233f291cee2efed25e3a upstream.
Prevent further dpm casting on legacy asics without od_enabled in amdgpu_dpm_is_overdrive_supported. This can avoid UBSAN complain in init sequence.
v2: add a macro to check legacy dpm instead of checking asic family/type
v3: refine macro name for naming consistency
--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +7 -2
@@ -36,6 +36,8 @@#define amdgpu_dpm_enable_bapm (adev, e) \ ((adev)->powerplay.pp_funcs->enable_bapm((adev)->powerplay.pp_handle, (e))) +#define amdgpu_dpm_is_legacy_dpm (adev) ((adev)->powerplay.pp_handle == (adev)) +int amdgpu_dpm_get_sclk (struct amdgpu_device *adev,bool low) {const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
@@ -1439,8 +1441,11 @@ int amdgpu_dpm_is_overdrive_supported(st }else {struct pp_hwmgr *hwmgr; -/* SI asic does not carry od_enabled */ -if (adev->family ==AMDGPU_FAMILY_SI ) +/* +* dpm on some legacy asics don't carry od_enabled member +* as its pp_handle is casted directly from adev. +*/ +if (amdgpu_dpm_is_legacy_dpm (adev))return false; hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle;
Greg Kroah-Hartman
maintainerPATCH 209/246 firewire: net: fix unexpected release of object for asynchronous request packet
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
commit f7dcc5e33c1e4b0d278a30f7d2f0c9a63d7b40ca upstream.
The lifetime of object for asynchronous request packet is now maintained by reference counting, while current implementation of firewire-net releases the passed object in the handler.
This commit fixes the bug.
--- drivers/firewire/net.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/firewire/net.c +11 -10
@@ -706,21 +706,22 @@ static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r,int rcode;if (destination ==IEEE1394_ALL_NODES ) { -kfree (r); - -return ; - } - -if (offset != dev->handler.offset) +// Although the response to the broadcast packet is not necessarily required, the +// fw_send_response() function should still be called to maintain the reference +// counting of the object. In the case, the call of function just releases the +// object as a result to decrease the reference counting. + rcode =RCODE_COMPLETE ; + }else if (offset != dev->handler.offset) { rcode =RCODE_ADDRESS_ERROR ; -else if (tcode !=TCODE_WRITE_BLOCK_REQUEST ) + }else if (tcode !=TCODE_WRITE_BLOCK_REQUEST ) { rcode =RCODE_TYPE_ERROR ; -else if (fwnet_incoming_packet (dev, payload, length, - source, generation, false) !=0 ) { + }else if (fwnet_incoming_packet (dev, payload, length, + source, generation, false) !=0 ) {dev_err (&dev->netdev->dev,"incoming packet failure\n" ); rcode =RCODE_CONFLICT_ERROR ; - }else + }else { rcode =RCODE_COMPLETE ; + }fw_send_response (card, r, rcode); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 210/246 HID: wacom: Set a default resolution for older tablets
In reply to Greg Kroah-HartmanFrom: Ping Cheng <[email protected]>
commit 08a46b4190d345544d04ce4fe2e1844b772b8535 upstream.
Some older tablets may not report physical maximum for X/Y coordinates. Set a default to prevent undefined resolution.
--- drivers/hid/wacom_wac.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/hid/wacom_wac.c +10 -2
@@ -1895,6 +1895,7 @@ static void wacom_map_usage(struct inputint fmax = field->logical_maximum;unsigned int equivalent_usage =wacom_equivalent_usage (usage->hid);int resolution_code = code; +int resolution =hidinput_calc_abs_res (field, resolution_code);if (equivalent_usage ==HID_DG_TWIST ) { resolution_code =ABS_RZ ;
@@ -1915,8 +1916,15 @@ static void wacom_map_usage(struct inputswitch (type) {case EV_ABS :input_set_abs_params (input, code, fmin, fmax, fuzz,0 ); -input_abs_set_res (input, code, -hidinput_calc_abs_res (field, resolution_code)); + +/* older tablet may miss physical usage */ +if ((code ==ABS_X || code ==ABS_Y ) && !resolution) { + resolution =WACOM_INTUOS_RES ; +hid_warn (input, +"Wacom usage (%d) missing resolution \n" , + code); + } +input_abs_set_res (input, code, resolution);break ;case EV_KEY :case EV_MSC :
Greg Kroah-Hartman
maintainerPATCH 211/246 HID: wacom: insert timestamp to packed Bluetooth (BT) events
In reply to Greg Kroah-HartmanFrom: Ping Cheng <[email protected]>
commit 17d793f3ed53080dab6bbeabfc82de890c901001 upstream.
To fully utilize the BT polling/refresh rate, a few input events are sent together to reduce event delay. This causes issue to the timestamp generated by input_sync since all the events in the same packet would pretty much have the same timestamp. This patch inserts time interval to the events by averaging the total time used for sending the packet.
This decision was mainly based on observing the actual time interval between each BT polling. The interval doesn't seem to be constant, due to the network and system environment. So, using solutions other than averaging doesn't end up with valid timestamps.
--- drivers/hid/wacom_wac.c | 26 ++++++++++++++++++++++++++ drivers/hid/wacom_wac.h | 1 + 2 files changed, 27 insertions(+)
drivers/hid/wacom_wac.c +26 -0
@@ -1308,6 +1308,9 @@ static void wacom_intuos_pro2_bt_pen(strstruct input_dev *pen_input = wacom->pen_input;unsigned char *data = wacom->data; +int number_of_valid_frames =0 ; +int time_interval =15000000 ; +ktime_t time_packet_received =ktime_get ();int i; if (wacom->features.type == INTUOSP2_BT ||
@@ -1328,12 +1331,30 @@ static void wacom_intuos_pro2_bt_pen(str wacom->id[0 ] |= (wacom->serial[0 ] >>32 ) &0xFFFFF ; } +/* number of valid frames */ for (i =0 ; i < pen_frames; i++) {unsigned char *frame = &data[i*pen_frame_len +1 ];bool valid = frame[0 ] &0x80 ; + +if (valid) + number_of_valid_frames++; + } + +if (number_of_valid_frames) { +if (wacom->hid_data.time_delayed) + time_interval =ktime_get () - wacom->hid_data.time_delayed; + time_interval /= number_of_valid_frames; + wacom->hid_data.time_delayed = time_packet_received; + } + +for (i =0 ; i < number_of_valid_frames; i++) { +unsigned char *frame = &data[i*pen_frame_len +1 ]; +bool valid = frame[0 ] &0x80 ;bool prox = frame[0 ] &0x40 ;bool range = frame[0 ] &0x20 ;bool invert = frame[0 ] &0x10 ; +int frames_number_reversed = number_of_valid_frames - i -1 ; +int event_timestamp = time_packet_received - frames_number_reversed * time_interval;if (!valid)continue ;
@@ -1346,6 +1367,7 @@ static void wacom_intuos_pro2_bt_pen(str wacom->tool[0 ] =0 ; wacom->id[0 ] =0 ; wacom->serial[0 ] =0 ; + wacom->hid_data.time_delayed =0 ;return ; }
@@ -1382,6 +1404,7 @@ static void wacom_intuos_pro2_bt_pen(str get_unaligned_le16(&frame[11])); } } +if (wacom->tool[0 ]) {input_report_abs (pen_input,ABS_PRESSURE ,get_unaligned_le16 (&frame[5 ])); if (wacom->features.type == INTUOSP2_BT ||
@@ -1405,6 +1428,9 @@ static void wacom_intuos_pro2_bt_pen(str wacom->shared->stylus_in_proximity = prox; +/* add timestamp to unpack the frames */ +input_set_timestamp (pen_input, event_timestamp); +input_sync (pen_input); } }
drivers/hid/wacom_wac.h +1 -0
@@ -324,6 +324,7 @@ struct hid_data {int ps_connected;bool pad_input_event_flag;unsigned short sequence_number; +int time_delayed; };struct wacom_remote_data {
Greg Kroah-Hartman
maintainerPATCH 212/246 fs/ntfs3: Refactoring of various minor issues
In reply to Greg Kroah-HartmanFrom: Konstantin Komarov <[email protected]>
commit 6827d50b2c430c329af442b64c9176d174f56521 upstream.
Removed unused macro.
Changed null pointer checking.
Fixed inconsistent indenting.
--- fs/ntfs3/bitmap.c | 3 ++- fs/ntfs3/frecord.c | 2 +- fs/ntfs3/fsntfs.c | 6 ++++-- fs/ntfs3/namei.c | 2 +- fs/ntfs3/ntfs.h | 3 --- 5 files changed, 8 insertions(+), 8 deletions(-)
fs/ntfs3/bitmap.c +2 -1
@@ -658,7 +658,8 @@ int wnd_init(struct wnd_bitmap *wnd, strif (!wnd->bits_last) wnd->bits_last = wbits; - wnd->free_bits =kcalloc (wnd->nwnd,sizeof (u16),GFP_NOFS | __GFP_NOWARN); + wnd->free_bits = +kcalloc (wnd->nwnd,sizeof (u16),GFP_NOFS | __GFP_NOWARN);if (!wnd->free_bits)return -ENOMEM ;
fs/ntfs3/frecord.c +1 -1
@@ -1645,7 +1645,7 @@ struct ATTR_FILE_NAME *ni_fname_name(str {struct ATTRIB *attr =NULL ;struct ATTR_FILE_NAME *fname; -struct le_str *fns; +struct le_str *fns;if (le) *le =NULL ;
fs/ntfs3/fsntfs.c +4 -2
@@ -2594,8 +2594,10 @@ static inline bool is_reserved_name(struif (len ==4 || (len >4 &&le16_to_cpu (name[4 ]) =='.' )) { port_digit =le16_to_cpu (name[3 ]);if (port_digit >='1' && port_digit <='9' ) -if (!ntfs_cmp_names (name,3 ,COM_NAME ,3 , upcase, false) || - !ntfs_cmp_names (name,3 ,LPT_NAME ,3 , upcase, false)) +if (!ntfs_cmp_names (name,3 ,COM_NAME ,3 , upcase, + false) || + !ntfs_cmp_names (name,3 ,LPT_NAME ,3 , upcase, + false))return true; }
fs/ntfs3/namei.c +1 -1
@@ -93,7 +93,7 @@ static struct dentry *ntfs_lookup(struct* If the MFT record of ntfs inode is not a base record, inode->i_op can be NULL. * This causes null pointer dereference in d_splice_alias(). */ -if (!IS_ERR (inode) && inode->i_op ==NULL ) { +if (!IS_ERR_OR_NULL (inode) && !inode->i_op) {iput (inode); inode =ERR_PTR (-EINVAL ); }
fs/ntfs3/ntfs.h +0 -3
@@ -435,9 +435,6 @@ static inline u64 attr_svcn(const structreturn attr->non_res ?le64_to_cpu (attr->nres.svcn) :0 ; } -/* The size of resident attribute by its resident size. */ -#define BYTES_PER_RESIDENT (b) (0x18 + (b)) -static_assert (sizeof (struct ATTRIB ) ==0x48 );static_assert (sizeof (((struct ATTRIB *)NULL )->res) ==0x08 );static_assert (sizeof (((struct ATTRIB *)NULL )->nres) ==0x38 );
Greg Kroah-Hartman
maintainerPATCH 213/246 Revert "net/sched: flower: Fix wrong handle assignment during filter change"
In reply to Greg Kroah-HartmanFrom: Vlad Buslov <[email protected]>
commit 5110f3ff6d3c986df9575c8da86630578b7f0846 upstream.
This reverts commit 32eff6bacec2cb574677c15378169a9fa30043ef.
Superseded by the following commit in this series.
--- net/sched/cls_flower.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_flower.c +1 -1
@@ -2231,8 +2231,8 @@ static int fl_change(struct net *net, stkfree (fnew); goto errout_tb; } - fnew->handle = handle; } + fnew->handle = handle; err =tcf_exts_init_ex (&fnew->exts, net,TCA_FLOWER_ACT ,0 , tp, handle, !tc_skip_hw (fnew->flags));
Greg Kroah-Hartman
maintainerPATCH 214/246 drm/msm/adreno: adreno_gpu: Use suspend() instead of idle() on load error
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
commit 3eeca5e5f3100435b06a5b5d86daa3d135a8a4bd upstream.
The adreno_load_gpu() path is guarded by an error check on adreno_load_fw(). This function is responsible for loading Qualcomm-only-signed binaries (e.g. SQE and GMU FW for A6XX), but it does not take the vendor-signed ZAP blob into account.
By embedding the SQE (and GMU, if necessary) firmware into the initrd/kernel, we can trigger and unfortunate path that would not bail out early and proceed with gpu->hw_init(). That will fail, as the ZAP loader path will not find the firmware and return back to adreno_load_gpu().
This error path involves pm_runtime_put_sync() which then calls idle() instead of suspend(). This is suboptimal, as it means that we're not going through the clean shutdown sequence. With at least A619_holi, this makes the GPU not wake up until it goes through at least one more start-fail-stop cycle. The pm_runtime_put_sync that appears in the error path actually does not guarantee that because of the earlier enabling of runtime autosuspend.
Fix that by using pm_runtime_put_sync_suspend to force a clean shutdown.
Test cases:
1. All firmware baked into kernel
2. error loading ZAP fw in initrd -> load from rootfs at DE start
Both succeed on A619_holi (SM6375) and A630 (SDM845).
Patchwork: https://patchwork.freedesktop.org/patch/530001/
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +1 -1
@@ -465,7 +465,7 @@ struct msm_gpu *adreno_load_gpu(struct dreturn gpu; err_put_rpm: -pm_runtime_put_sync (&pdev->dev); +pm_runtime_put_sync_suspend (&pdev->dev); err_disable_rpm:pm_runtime_disable (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 215/246 drm/amd/display: merge dc_link.h into dc.h and dc_types.h
In reply to Greg Kroah-HartmanFrom: Wenjing Liu <[email protected]>
[ Upstream commit 7ae1dbe6547c39410d82156c96eaa9c8cf55e87a ]
[why]
Remove the need to include dc_link.h separately. dc.h should contain everything needed on DM side.
[How]
Merge dc_link.h into dc.h and dc_types.h so DM only needs to include dc.h to use all link public functions.
Stable-dep-of: eeefe7c4820b ("drm/amd/display: hpd rx irq not working with eDP interface")
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +- .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 4 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 156 +---- .../drm/amd/display/dc/core/dc_link_exports.c | 87 +++ drivers/gpu/drm/amd/display/dc/dc.h | 553 +++++++++++++++++- drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 107 ++++ drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 14 + drivers/gpu/drm/amd/display/dc/dc_types.h | 104 ++++ drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 2 +- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h | 5 +- .../display/dc/dce110/dce110_hw_sequencer.c | 2 +- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- .../dc/dcn30/dcn30_dio_stream_encoder.c | 1 + .../drm/amd/display/dc/dcn30/dcn30_hwseq.c | 2 +- .../dc/dcn31/dcn31_hpo_dp_link_encoder.c | 1 - .../dc/dcn31/dcn31_hpo_dp_stream_encoder.c | 2 +- .../dc/dcn32/dcn32_hpo_dp_link_encoder.c | 1 - .../drm/amd/display/dc/dcn32/dcn32_hwseq.c | 2 +- .../dc/dml/dcn30/display_mode_vba_30.c | 1 - .../dc/dml/dcn31/display_mode_vba_31.c | 1 - .../dc/dml/dcn314/display_mode_vba_314.c | 1 - .../dc/dml/dcn32/display_mode_vba_32.c | 1 - .../gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 14 - .../drm/amd/display/dc/inc/hw/link_encoder.h | 52 -- .../amd/display/dc/inc/hw/stream_encoder.h | 1 - drivers/gpu/drm/amd/display/dc/inc/link.h | 1 - .../display/dc/link/accessories/link_dp_cts.c | 17 - .../drm/amd/display/dc/link/link_detection.c | 99 ++++ .../display/dc/link/protocols/link_dp_dpia.c | 1 - .../dc/link/protocols/link_dp_dpia_bw.c | 1 - .../dc/link/protocols/link_dp_training_dpia.c | 1 - .../amd/display/include/link_service_types.h | 26 - 33 files changed, 978 insertions(+), 288 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -2274,7 +2274,7 @@ static int dm_late_init(void *handle)struct dc_link *edp_links[MAX_NUM_EDP ];int edp_num; -get_edp_links (adev->dm.dc, edp_links, &edp_num); +dc_get_edp_links (adev->dm.dc, edp_links, &edp_num);for (i =0 ; i < edp_num; i++) {if (!dmub_init_abm_config (adev->dm.dc->res_pool, params, i))return -EINVAL ;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1 -1
@@ -724,7 +724,7 @@ static ssize_t dp_phy_test_pattern_debugfs_write(struct file *f, const char __usfor (i =0 ; i < (unsigned int )(link_training_settings.link_settings.lane_count); i++) link_training_settings.hw_lane_settings[i] = link->cur_lane_setting[i]; - dc_link_set_test_pattern( + dc_link_dp_set_test_pattern( link, test_pattern, DP_TEST_PATTERN_COLOR_SPACE_RGB,
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +2 -2
@@ -104,7 +104,7 @@ void clk_mgr_exit_optimized_pwr_state(const struct dc *dc, struct clk_mgr *clk_mint edp_num;unsigned int panel_inst; -get_edp_links (dc, edp_links, &edp_num); +dc_get_edp_links (dc, edp_links, &edp_num);if (dc->hwss.exit_optimized_pwr_state) dc->hwss.exit_optimized_pwr_state (dc, dc->current_state);
@@ -129,7 +129,7 @@ void clk_mgr_optimize_pwr_state(const struct dc *dc, struct clk_mgr *clk_mgr)int edp_num;unsigned int panel_inst; -get_edp_links (dc, edp_links, &edp_num); +dc_get_edp_links (dc, edp_links, &edp_num);if (edp_num) {for (panel_inst =0 ; panel_inst < edp_num; panel_inst++) { edp_link = edp_links[panel_inst];
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -154
180 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +87 -0
96 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc.h +551 -2
586 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc_dp_types.h +107 -0
111 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +14 -0
@@ -1085,5 +1085,19 @@ struct tg_color { uint16_t color_b_cb; }; +enum symclk_state { +SYMCLK_OFF_TX_OFF , +SYMCLK_ON_TX_ON , +SYMCLK_ON_TX_OFF , +}; + +struct phy_state { +struct { +uint8_t otg :1 ; +uint8_t reserved :7 ; + } symclk_ref_cnts; +enum symclk_state symclk_state; +}; +#endif /* DC_HW_TYPES_H */
drivers/gpu/drm/amd/display/dc/dc_types.h +104 -0
114 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +1 -1
@@ -148,7 +148,7 @@ static bool dmub_abm_set_level(struct abm *abm, uint32_t level)int edp_num;uint8_t panel_mask =0 ; -get_edp_links (dc->dc, edp_links, &edp_num); +dc_get_edp_links (dc->dc, edp_links, &edp_num);for (i =0 ; i < edp_num; i++) {if (edp_links[i]->link_status.link_active)
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h +3 -2
@@ -26,8 +26,9 @@ #ifndef _DMUB_PSR_H_ #define _DMUB_PSR_H_ -#include "os_types.h" -#include "dc_link.h" +#include "dc_types.h" +struct dc_link; +struct dmub_psr_funcs; struct dmub_psr { struct dc_context *ctx;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -1
@@ -1739,7 +1739,7 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)get_edp_links_with_sink (dc, edp_links_with_sink, &edp_with_sink_num); -get_edp_links (dc, edp_links, &edp_num); +dc_get_edp_links (dc, edp_links, &edp_num);if (hws->funcs.init_pipes) hws->funcs.init_pipes (dc, context);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
@@ -1646,7 +1646,7 @@ void dcn10_power_down_on_boot(struct dc *dc)int edp_num;int i =0 ; -get_edp_links (dc, edp_links, &edp_num); +dc_get_edp_links (dc, edp_links, &edp_num);if (edp_num) edp_link = edp_links[0 ];
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dio_stream_encoder.c +1 -0
@@ -28,6 +28,7 @@#include "dcn30_dio_stream_encoder.h" #include "reg_helper.h" #include "hw_shared.h" +#include "dc.h" #include "core_types.h" #include <linux/delay.h>
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +1 -1
@@ -567,7 +567,7 @@ void dcn30_init_hw(struct dc *dc)struct dc_link *edp_links[MAX_NUM_EDP ];struct dc_link *edp_link =NULL ; -get_edp_links (dc, edp_links, &edp_num); +dc_get_edp_links (dc, edp_links, &edp_num);if (edp_num) edp_link = edp_links[0 ]; if (edp_link && edp_link->link_enc->funcs->is_dig_enabled &&
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_link_encoder.c +0 -1
@@ -26,7 +26,6 @@#include "dc_bios_types.h" #include "dcn31_hpo_dp_link_encoder.h" #include "reg_helper.h" -#include "dc_link.h" #include "stream_encoder.h" #define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c +1 -1
@@ -26,7 +26,7 @@#include "dc_bios_types.h" #include "dcn31_hpo_dp_stream_encoder.h" #include "reg_helper.h" -#include "dc_link.h" +#include "dc.h" #define DC_LOGGER \ enc3->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hpo_dp_link_encoder.c +0 -1
@@ -26,7 +26,6 @@#include "dcn31/dcn31_hpo_dp_link_encoder.h" #include "dcn32_hpo_dp_link_encoder.h" #include "reg_helper.h" -#include "dc_link.h" #include "stream_encoder.h" #define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +1 -1
@@ -828,7 +828,7 @@ void dcn32_init_hw(struct dc *dc)struct dc_link *edp_links[MAX_NUM_EDP ];struct dc_link *edp_link; -get_edp_links (dc, edp_links, &edp_num); +dc_get_edp_links (dc, edp_links, &edp_num);if (edp_num) {for (i =0 ; i < edp_num; i++) { edp_link = edp_links[i];
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +0 -1
@@ -25,7 +25,6 @@#ifdef CONFIG_DRM_AMD_DC_DCN #include "dc.h" -#include "dc_link.h" #include "../display_mode_lib.h" #include "display_mode_vba_30.h" #include "../dml_inline_defs.h"
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +0 -1
@@ -24,7 +24,6 @@*/ #include "dc.h" -#include "dc_link.h" #include "../display_mode_lib.h" #include "../dcn30/display_mode_vba_30.h" #include "display_mode_vba_31.h"
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +0 -1
@@ -27,7 +27,6 @@#define UNIT_TEST 0#if !UNIT_TEST #include "dc.h" -#include "dc_link.h" #endif #include "../display_mode_lib.h" #include "display_mode_vba_314.h"
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +0 -1
@@ -24,7 +24,6 @@*/ #include "dc.h" -#include "dc_link.h" #include "../display_mode_lib.h" #include "display_mode_vba_32.h" #include "../dml_inline_defs.h"
drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +0 -14
@@ -275,20 +275,6 @@ enum dc_lut_mode { LUT_RAM_B }; -enum symclk_state { -SYMCLK_OFF_TX_OFF , -SYMCLK_ON_TX_ON , -SYMCLK_ON_TX_OFF , -}; - -struct phy_state { -struct { -uint8_t otg :1 ; -uint8_t reserved :7 ; - } symclk_ref_cnts; -enum symclk_state symclk_state; -}; -/** * speakersToChannels *
drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h +0 -52
58 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +0 -1
@@ -30,7 +30,6 @@#include "audio_types.h" #include "hw_shared.h" -#include "dc_link.h" struct dc_bios ;struct dc_context ;
drivers/gpu/drm/amd/display/dc/inc/link.h +0 -1
@@ -38,7 +38,6 @@* into this file and prefix it with "link_". */ #include "core_types.h" -#include "dc_link.h" struct link_init_data {const struct dc *dc;
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c +0 -17
@@ -1027,20 +1027,3 @@ void dc_link_set_preferred_training_settings(struct dc *dc,if (skip_immediate_retrain == false)dc_link_set_preferred_link_settings (dc, &link->preferred_link_setting, link); } - -void dc_link_set_test_pattern (struct dc_link *link, -enum dp_test_pattern test_pattern, -enum dp_test_pattern_color_space test_pattern_color_space, -const struct link_training_settings *p_link_settings, -const unsigned char *p_custom_pattern, -unsigned int cust_pattern_size) -{ -if (link !=NULL ) -dc_link_dp_set_test_pattern ( - link, - test_pattern, - test_pattern_color_space, - p_link_settings, - p_custom_pattern, - cust_pattern_size); -}
drivers/gpu/drm/amd/display/dc/link/link_detection.c +99 -0
102 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia.c +0 -1
@@ -26,7 +26,6 @@#include "dc.h" #include "inc/core_status.h" -#include "dc_link.h" #include "dpcd_defs.h" #include "link_dp_dpia.h"
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +0 -1
@@ -27,7 +27,6 @@// USB4 DPIA BANDWIDTH ALLOCATION LOGIC /*********************************************************************/ #include "dc.h" -#include "dc_link.h" #include "link_dp_dpia_bw.h" #include "drm_dp_helper_dc.h" #include "link_dpcd.h"
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c +0 -1
@@ -29,7 +29,6 @@#include "link_dp_training_dpia.h" #include "dc.h" #include "inc/core_status.h" -#include "dc_link.h" #include "dpcd_defs.h" #include "link_dp_dpia.h"
drivers/gpu/drm/amd/display/include/link_service_types.h +0 -26
@@ -34,10 +34,6 @@struct ddc ;struct irq_manager ; -enum { -MAX_CONTROLLER_NUM =6 -}; -enum dp_power_state {DP_POWER_STATE_D0 =1 ,DP_POWER_STATE_D3
@@ -60,28 +56,6 @@ enum { DATA_EFFICIENCY_128b_132b_x10000 = 9646, /* 96.71% data efficiency x 99.75% downspread factor */ }; -enum link_training_result { -LINK_TRAINING_SUCCESS , -LINK_TRAINING_CR_FAIL_LANE0 , -LINK_TRAINING_CR_FAIL_LANE1 , -LINK_TRAINING_CR_FAIL_LANE23 , -/* CR DONE bit is cleared during EQ step */ -LINK_TRAINING_EQ_FAIL_CR , -/* CR DONE bit is cleared but LANE0_CR_DONE is set during EQ step */ -LINK_TRAINING_EQ_FAIL_CR_PARTIAL , -/* other failure during EQ step */ -LINK_TRAINING_EQ_FAIL_EQ , -LINK_TRAINING_LQA_FAIL , -/* one of the CR,EQ or symbol lock is dropped */ -LINK_TRAINING_LINK_LOSS , -/* Abort link training (because sink unplugged) */ -LINK_TRAINING_ABORT , - DP_128b_132b_LT_FAILED, - DP_128b_132b_MAX_LOOP_COUNT_REACHED, - DP_128b_132b_CHANNEL_EQ_DONE_TIMEOUT, - DP_128b_132b_CDS_DONE_TIMEOUT, -}; -enum lttpr_mode {LTTPR_MODE_UNKNOWN ,LTTPR_MODE_NON_LTTPR ,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 216/246 drm/amd/display: hpd rx irq not working with eDP interface
In reply to Greg Kroah-HartmanFrom: Robin Chen <[email protected]>
[ Upstream commit eeefe7c4820b6baa0462a8b723ea0a3b5846ccae ]
[Why]
This is the fix for the defect of commit ab144f0b4ad6 ("drm/amd/display: Allow individual control of eDP hotplug support").
[How]
To revise the default eDP hotplug setting and use the enum to git rid of the magic number for different options.
--- drivers/gpu/drm/amd/display/dc/dc_types.h | 7 +++++++ drivers/gpu/drm/amd/display/dc/link/link_factory.c | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_types.h +7 -0
@@ -1086,4 +1086,11 @@ struct dc_dpia_bw_alloc { };#define MAX_SINKS_PER_LINK 4 + +enum dc_hpd_enable_select { +HPD_EN_FOR_ALL_EDP =0 , +HPD_EN_FOR_PRIMARY_EDP_ONLY , +HPD_EN_FOR_SECONDARY_EDP_ONLY , +}; +#endif /* DC_TYPES_H_ */
drivers/gpu/drm/amd/display/dc/link/link_factory.c +7 -2
@@ -274,14 +274,18 @@ static bool dc_link_construct_phy(struct dc_link *link, link->irq_source_hpd =DC_IRQ_SOURCE_INVALID ;switch (link->dc->config.allow_edp_hotplug_detection) { -case 1 :// only the 1st eDP handles hotplug +case HPD_EN_FOR_ALL_EDP : + link->irq_source_hpd_rx = +dal_irq_get_rx_source (link->hpd_gpio); +break ; +case HPD_EN_FOR_PRIMARY_EDP_ONLY :if (link->link_index ==0 ) link->irq_source_hpd_rx =dal_irq_get_rx_source (link->hpd_gpio);else link->irq_source_hpd =DC_IRQ_SOURCE_INVALID ;break ; -case 2 :// only the 2nd eDP handles hotplug +case HPD_EN_FOR_SECONDARY_EDP_ONLY :if (link->link_index ==1 ) link->irq_source_hpd_rx =dal_irq_get_rx_source (link->hpd_gpio);
@@ -289,6 +293,7 @@ static bool dc_link_construct_phy(struct dc_link *link, link->irq_source_hpd =DC_IRQ_SOURCE_INVALID ;break ;default : + link->irq_source_hpd =DC_IRQ_SOURCE_INVALID ;break ; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 217/246 drm/i915: Add _PICK_EVEN_2RANGES()
In reply to Greg Kroah-HartmanFrom: Lucas De Marchi <[email protected]>
[ Upstream commit 357513233d6456c9f99e34794897efd4ae907e83 ]
It's a constant pattern in the driver to need to use 2 ranges of MMIOs based on port, phy, pll, etc. When that happens, instead of using _PICK_EVEN(), _PICK() needs to be used. Using _PICK() is discouraged due to some reasons like:
1) It increases the code size since the array is declared in each call site
2) Developers need to be careful not to incur an out-of-bounds array access
3) Developers need to be careful that the indexes match the table. For that it may be that the table needs to contain holes, making (1) even worse.
Add a variant of _PICK_EVEN() that works with 2 ranges and selects which one to use depending on the index value.
v2: Fix the address expansion in the example (Anusha)
v3: Also rename macro to _PICK_EVEN_2RANGES() in the documentation
and reword it to clarify what ranges are chosen based on the index (Jani)
Stable-dep-of: 214b09db6197 ("drm/msm: fix drm device leak on bind errors")
--- drivers/gpu/drm/i915/i915_reg_defs.h | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/gpu/drm/i915/i915_reg_defs.h +29 -0
@@ -119,6 +119,35 @@*/ #define _PICK_EVEN (__index, __a, __b) ((__a) + (__index) * ((__b) - (__a))) +/* +* Like _PICK_EVEN(), but supports 2 ranges of evenly spaced address offsets. +* @__c_index corresponds to the index in which the second range starts to be +* used. Using math interval notation, the first range is used for indexes [ 0, +* @__c_index), while the second range is used for [ @__c_index, ... ). Example: +* +* #define _FOO_A 0xf000 +* #define _FOO_B 0xf004 +* #define _FOO_C 0xf008 +* #define _SUPER_FOO_A 0xa000 +* #define _SUPER_FOO_B 0xa100 +* #define FOO(x) _MMIO(_PICK_EVEN_2RANGES(x, 3, \ +* _FOO_A, _FOO_B, \ +* _SUPER_FOO_A, _SUPER_FOO_B)) +* +* This expands to: +* 0: 0xf000, +* 1: 0xf004, +* 2: 0xf008, +* 3: 0xa000, +* 4: 0xa100, +* 5: 0xa200, +* ... +*/ +#define _PICK_EVEN_2RANGES (__index, __c_index, __a, __b, __c, __d) \ + (BUILD_BUG_ON_ZERO(!__is_constexpr(__c_index)) + \ + ((__index) < (__c_index) ? _PICK_EVEN(__index, __a, __b) : \ + _PICK_EVEN((__index) - (__c_index), __c, __d))) +/* * Given the arbitrary numbers in varargs, pick the 0-based __index'th number. *
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 218/246 drm/i915/mtl: Add workarounds Wa_14017066071 and Wa_14017654203
In reply to Greg Kroah-HartmanFrom: Radhakrishna Sripada <[email protected]>
[ Upstream commit 5fba65efa7cfb8cef227a2c555deb10327a5e27b ]
Both workarounds require the same implementation and apply to MTL P and M from stepping A0 to B0 (exclusive).
v2:
- Remove unrelated brace removal. (Matt)
Stable-dep-of: 81900e3a3775 ("drm/i915: disable sampler indirect state in bindless heap")
--- drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 + drivers/gpu/drm/i915/gt/intel_workarounds.c | 9 +++++++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/i915/gt/intel_gt_regs.h +1 -0
@@ -1145,6 +1145,7 @@#define ENABLE_SMALLPL REG_BIT(15)#define SC_DISABLE_POWER_OPTIMIZATION_EBB REG_BIT(9)#define GEN11_SAMPLER_ENABLE_HEADLESS_MSG REG_BIT(5) +#define MTL_DISABLE_SAMPLER_SC_OOO REG_BIT(3)#define GEN9_HALF_SLICE_CHICKEN7 MCR_REG(0xe194)#define DG2_DISABLE_ROUND_ENABLE_ALLOW_FOR_SSLA REG_BIT(15)
drivers/gpu/drm/i915/gt/intel_workarounds.c +9 -0
@@ -3015,6 +3015,15 @@ general_render_compute_wa_init(struct intel_engine_cs *engine, struct i915_wa_liadd_render_compute_tuning_settings (i915, wal); +if (IS_MTL_GRAPHICS_STEP (i915,M ,STEP_A0 ,STEP_B0 ) || +IS_MTL_GRAPHICS_STEP (i915,P ,STEP_A0 ,STEP_B0 )) +/* +* Wa_14017066071 +* Wa_14017654203 +*/ +wa_mcr_masked_en (wal,GEN10_SAMPLER_MODE , +MTL_DISABLE_SAMPLER_SC_OOO ); + if (IS_MTL_GRAPHICS_STEP(i915, M, STEP_A0, STEP_B0) || IS_MTL_GRAPHICS_STEP(i915, P, STEP_A0, STEP_B0) || IS_DG2_GRAPHICS_STEP(i915, G10, STEP_B0, STEP_FOREVER) ||
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 219/246 drm/i915/mtl: Add Wa_14017856879
In reply to Greg Kroah-HartmanFrom: Haridhar Kalvala <[email protected]>
[ Upstream commit 4b51210f98c2b89ce37aede5b8dc5105be0572c6 ]
Wa_14017856879 implementation for mtl.
Bspec: 46046
Stable-dep-of: 81900e3a3775 ("drm/i915: disable sampler indirect state in bindless heap")
--- drivers/gpu/drm/i915/gt/intel_gt_regs.h | 2 ++ drivers/gpu/drm/i915/gt/intel_workarounds.c | 5 +++++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/i915/gt/intel_gt_regs.h +2 -0
@@ -1172,7 +1172,9 @@#define THREAD_EX_ARB_MODE_RR_AFTER_DEP REG_FIELD_PREP(THREAD_EX_ARB_MODE, 0x2)#define HSW_ROW_CHICKEN3 _MMIO(0xe49c) +#define GEN9_ROW_CHICKEN3 MCR_REG(0xe49c)#define HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE (1 << 6) +#define MTL_DISABLE_FIX_FOR_EOT_FLUSH REG_BIT(9)#define GEN8_ROW_CHICKEN MCR_REG(0xe4f0)#define FLOW_CONTROL_ENABLE REG_BIT(15)
drivers/gpu/drm/i915/gt/intel_workarounds.c +5 -0
@@ -3015,6 +3015,11 @@ general_render_compute_wa_init(struct intel_engine_cs *engine, struct i915_wa_liadd_render_compute_tuning_settings (i915, wal); +if (IS_MTL_GRAPHICS_STEP (i915,M ,STEP_B0 ,STEP_FOREVER ) || +IS_MTL_GRAPHICS_STEP (i915,P ,STEP_B0 ,STEP_FOREVER )) +/* Wa_14017856879 */ +wa_mcr_masked_en (wal,GEN9_ROW_CHICKEN3 ,MTL_DISABLE_FIX_FOR_EOT_FLUSH ); +if (IS_MTL_GRAPHICS_STEP (i915,M ,STEP_A0 ,STEP_B0 ) ||IS_MTL_GRAPHICS_STEP (i915,P ,STEP_A0 ,STEP_B0 ))/*
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 220/246 drm/i915: disable sampler indirect state in bindless heap
In reply to Greg Kroah-HartmanFrom: Lionel Landwerlin <[email protected]>
[ Upstream commit 81900e3a37750d8c6ad705045310e002f6dd0356 ]
By default the indirect state sampler data (border colors) are stored in the same heap as the SAMPLER_STATE structure. For userspace drivers that can be 2 different heaps (dynamic state heap & bindless sampler state heap). This means that border colors have to copied in 2 different places so that the same SAMPLER_STATE structure find the right data.
This change is forcing the indirect state sampler data to only be in the dynamic state pool (more convenient for userspace drivers, they only have to have one copy of the border colors). This is reproducing the behavior of the Windows drivers.
BSpec: 46052
--- drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 + drivers/gpu/drm/i915/gt/intel_workarounds.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
drivers/gpu/drm/i915/gt/intel_gt_regs.h +1 -0
@@ -1146,6 +1146,7 @@#define SC_DISABLE_POWER_OPTIMIZATION_EBB REG_BIT(9)#define GEN11_SAMPLER_ENABLE_HEADLESS_MSG REG_BIT(5)#define MTL_DISABLE_SAMPLER_SC_OOO REG_BIT(3) +#define GEN11_INDIRECT_STATE_BASE_ADDR_OVERRIDE REG_BIT(0)#define GEN9_HALF_SLICE_CHICKEN7 MCR_REG(0xe194)#define DG2_DISABLE_ROUND_ENABLE_ALLOW_FOR_SSLA REG_BIT(15)
drivers/gpu/drm/i915/gt/intel_workarounds.c +19 -0
@@ -3015,6 +3015,25 @@ general_render_compute_wa_init(struct intel_engine_cs *engine, struct i915_wa_liadd_render_compute_tuning_settings (i915, wal); +if (GRAPHICS_VER (i915) >=11 ) { +/* This is not a Wa (although referred to as +* WaSetInidrectStateOverride in places), this allows +* applications that reference sampler states through +* the BindlessSamplerStateBaseAddress to have their +* border color relative to DynamicStateBaseAddress +* rather than BindlessSamplerStateBaseAddress. +* +* Otherwise SAMPLER_STATE border colors have to be +* copied in multiple heaps (DynamicStateBaseAddress & +* BindlessSamplerStateBaseAddress) +* +* BSpec: 46052 +*/ +wa_mcr_masked_en (wal, +GEN10_SAMPLER_MODE , +GEN11_INDIRECT_STATE_BASE_ADDR_OVERRIDE ); + } +if (IS_MTL_GRAPHICS_STEP (i915,M ,STEP_B0 ,STEP_FOREVER ) ||IS_MTL_GRAPHICS_STEP (i915,P ,STEP_B0 ,STEP_FOREVER ))/* Wa_14017856879 */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 221/246 drm/amd/display: Add minimum Z8 residency debug option
In reply to Greg Kroah-HartmanFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit 0db13eae41fcc67f408dbb3dfda59633c4fa03fb ]
[Why]
Allows finer control and tuning for debug and profiling.
[How]
Add the debug option into DC. The default remains the same as before for now.
Stable-dep-of: d893f39320e1 ("drm/amd/display: Lowering min Z8 residency time")
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 + drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 1 + drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -795,6 +795,7 @@ struct dc_debug_options {unsigned int force_odm_combine;//bit vector based on otg inst unsigned int seamless_boot_odm_combine;unsigned int force_odm_combine_4to1;//bit vector based on otg inst +int minimum_z8_residency_time;bool disable_z9_mpc;unsigned int force_fclk_khz;bool enable_tri_buf;
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +1 -0
@@ -887,6 +887,7 @@ static const struct dc_plane_cap plane_cap = {static const struct dc_debug_options debug_defaults_drv = { .disable_z10 = false, .enable_z9_disable_interface = true, + .minimum_z8_residency_time =1000 , .psr_skip_crtc_disable = true, .disable_dmcu = true, .force_abm_enable = false,
drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c +2 -1
@@ -973,7 +973,8 @@ static enum dcn_zstate_support_state decide_zstate_support(struct dc *dc, strucelse if (context->stream_count ==1 && context->streams[0 ]->signal ==SIGNAL_TYPE_EDP ) {struct dc_link *link = context->streams[0 ]->sink->link;struct dc_stream_status *stream_status = &context->stream_status[0 ]; -bool allow_z8 = context->bw_ctx.dml.vba.StutterPeriod >1000.0 ; +int minmum_z8_residency = dc->debug.minimum_z8_residency_time >0 ? dc->debug.minimum_z8_residency_time :1000 ; +bool allow_z8 = context->bw_ctx.dml.vba.StutterPeriod > (double )minmum_z8_residency;bool is_pwrseq0 = link->link_index ==0 ;if (dc_extended_blank_supported (dc)) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 222/246 drm/amd/display: Update minimum stutter residency for DCN314 Z8
In reply to Greg Kroah-HartmanFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit 0215ce9057edf69aff9c1a32f4254e1ec297db31 ]
[Why]
Block periods that are too short as they have the potential to currently cause hangs in other firmware components on the system.
[How]
Update the threshold, mostly targeting a block of 4k and downscaling.
Stable-dep-of: d893f39320e1 ("drm/amd/display: Lowering min Z8 residency time")
--- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +1 -1
@@ -887,7 +887,7 @@ static const struct dc_plane_cap plane_cap = {static const struct dc_debug_options debug_defaults_drv = { .disable_z10 = false, .enable_z9_disable_interface = true, - .minimum_z8_residency_time =1000 , + .minimum_z8_residency_time =3080 , .psr_skip_crtc_disable = true, .disable_dmcu = true, .force_abm_enable = false,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 223/246 drm/amd/display: Lowering min Z8 residency time
In reply to Greg Kroah-HartmanFrom: Leo Chen <[email protected]>
[ Upstream commit d893f39320e1248d1c97fde0d6e51e5ea008a76b ]
[Why & How]
Per HW team request, we're lowering the minimum Z8 residency time to 2000us. This enables Z8 support for additional modes we were previously blocking like 2k>60hz
--- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +1 -1
@@ -887,7 +887,7 @@ static const struct dc_plane_cap plane_cap = {static const struct dc_debug_options debug_defaults_drv = { .disable_z10 = false, .enable_z9_disable_interface = true, - .minimum_z8_residency_time =3080 , + .minimum_z8_residency_time =2000 , .psr_skip_crtc_disable = true, .disable_dmcu = true, .force_abm_enable = false,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 224/246 parisc: Fix encoding of swp_entry due to added SWP_EXCLUSIVE flag
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit 6f9e98849edaa8aefc4030ff3500e41556e83ff7 upstream.
Fix the __swp_offset() and __swp_entry() macros due to commit 6d239fc78c0b ("parisc/mm: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE") which introduced the SWP_EXCLUSIVE flag by reusing the _PAGE_ACCESSED flag.
--- arch/parisc/include/asm/pgtable.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/parisc/include/asm/pgtable.h +4 -4
@@ -413,12 +413,12 @@ extern void paging_init (void);* For the 64bit version, the offset is extended by 32bit. */ #define __swp_type (x) ((x).val & 0x1f) -#define __swp_offset (x) ( (((x).val >> 6) & 0x7) | \ - (((x).val >> 8) & ~0x7) ) +#define __swp_offset (x) ( (((x).val >> 5) & 0x7) | \ + (((x).val >> 10) << 3) )#define __swp_entry (type, offset) ((swp_entry_t) { \ ((type) & 0x1f) | \ - ((offset & 0x7) << 6) | \ - ((offset & ~0x7) << 8) }) + ((offset & 0x7) << 5) | \ + ((offset >> 3) << 10) })#define __pte_to_swp_entry (pte) ((swp_entry_t) { pte_val(pte) })#define __swp_entry_to_pte (x) ((pte_t) { (x).val })
Re: [PATCH 6.3 224/246] parisc: Fix encoding of swp_entry due to added SWP_EXCLUSIVE flag
Greg Kroah-Hartman wrote...
Quoted 5 lines
commit
6f9e98849edaa8aefc4030ff3500e41556e83ff7upstream.Fix the
__swp_offset()and__swp_entry()macros due to commit6d239fc78c0b("parisc/mm: support__HAVE_ARCH_PTE_SWP_EXCLUSIVE") which introduced theSWP_EXCLUSIVEflag by reusing the_PAGE_ACCESSEDflag.
Sucessfully re-tested for 6.3.3-rc1.
For the better-safe-than-sorry department,
Christoph
Greg Kroah-Hartman
maintainerPATCH 225/246 perf/x86: Fix missing sample size update on AMD BRS
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
commit 90befef5a9e820ccccc33181ec14c015980300cc upstream.
It missed to convert a PERF_SAMPLE_BRANCH_STACK user to call the new perf_sample_save_brstack() helper in order to update the dyn_size. This affects AMD Zen3 machines with the branch-brs event.
--- arch/x86/events/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/events/core.c +2 -4
@@ -1703,10 +1703,8 @@ int x86_pmu_handle_irq(struct pt_regs *regs)perf_sample_data_init (&data,0 , event->hw.last_period); -if (has_branch_stack (event)) { - data.br_stack = &cpuc->lbr_stack; - data.sample_flags |=PERF_SAMPLE_BRANCH_STACK ; - } +if (has_branch_stack (event)) +perf_sample_save_brstack (&data, event, &cpuc->lbr_stack);if (perf_event_overflow (event, &data, regs))x86_pmu_stop (event,0 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 226/246 locking/rwsem: Add __always_inline annotation to __down_read_common() and inlined callers
In reply to Greg Kroah-HartmanFrom: John Stultz <[email protected]>
commit 92cc5d00a431e96e5a49c0b97e5ad4fa7536bd4b upstream.
Apparently despite it being marked inline, the compiler may not inline __down_read_common() which makes it difficult to identify the cause of lock contention, as the blocked function in traceevents will always be listed as __down_read_common().
So this patch adds __always_inline annotation to the common function (as well as the inlined helper callers) to force it to be inlined so the blocking function will be listed (via Wchan) in traceevents.
--- kernel/locking/rwsem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/locking/rwsem.c +4 -4
@@ -1240,7 +1240,7 @@ static struct rw_semaphore *rwsem_downgr/* * lock for reading */ -static inline int __down_read_common (struct rw_semaphore *sem,int state) +static __always_inline int __down_read_common(struct rw_semaphore *sem, int state) {int ret =0 ;long count;
@@ -1258,17 +1258,17 @@ out:return ret; } -static inline void __down_read (struct rw_semaphore *sem) +static __always_inline void __down_read(struct rw_semaphore *sem) {__down_read_common (sem,TASK_UNINTERRUPTIBLE ); } -static inline int __down_read_interruptible (struct rw_semaphore *sem) +static __always_inline int __down_read_interruptible(struct rw_semaphore *sem) {return __down_read_common (sem,TASK_INTERRUPTIBLE ); } -static inline int __down_read_killable (struct rw_semaphore *sem) +static __always_inline int __down_read_killable(struct rw_semaphore *sem) {return __down_read_common (sem,TASK_KILLABLE ); }
Greg Kroah-Hartman
maintainerPATCH 227/246 ext4: fix WARNING in mb_find_extent
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit fa08a7b61dff8a4df11ff1e84abfc214b487caf7 upstream.
Syzbot found the following issue:
EXT4-fs: Warning: mounting with data=journal disables delayed allocation, dioread_nolock, O_DIRECT and fast_commit support! EXT4-fs (loop0): orphan cleanup on readonly fs
------------[ cut here ]------------ WARNING: CPU: 1 PID: 5067 at fs/ext4/mballoc.c:1869 mb_find_extent+0x8a1/0xe30 Modules linked in: CPU: 1 PID: 5067 Comm: syz-executor307 Not tainted 6.2.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 RIP: 0010:mb_find_extent+0x8a1/0xe30 fs/ext4/mballoc.c:1869 RSP: 0018:ffffc90003c9e098 EFLAGS: 00010293 RAX: ffffffff82405731 RBX: 0000000000000041 RCX: ffff8880783457c0 RDX: 0000000000000000 RSI: 0000000000000041 RDI: 0000000000000040 RBP: 0000000000000040 R08: ffffffff82405723 R09: ffffed10053c9402 R10: ffffed10053c9402 R11: 1ffff110053c9401 R12: 0000000000000000 R13: ffffc90003c9e538 R14: dffffc0000000000 R15: ffffc90003c9e2cc FS: 0000555556665300(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000056312f6796f8 CR3: 0000000022437000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ext4_mb_complex_scan_group+0x353/0x1100 fs/ext4/mballoc.c:2307 ext4_mb_regular_allocator+0x1533/0x3860 fs/ext4/mballoc.c:2735 ext4_mb_new_blocks+0xddf/0x3db0 fs/ext4/mballoc.c:5605 ext4_ext_map_blocks+0x1868/0x6880 fs/ext4/extents.c:4286 ext4_map_blocks+0xa49/0x1cc0 fs/ext4/inode.c:651 ext4_getblk+0x1b9/0x770 fs/ext4/inode.c:864 ext4_bread+0x2a/0x170 fs/ext4/inode.c:920 ext4_quota_write+0x225/0x570 fs/ext4/super.c:7105 write_blk fs/quota/quota_tree.c:64 [inline] get_free_dqblk+0x34a/0x6d0 fs/quota/quota_tree.c:130 do_insert_tree+0x26b/0x1aa0 fs/quota/quota_tree.c:340 do_insert_tree+0x722/0x1aa0 fs/quota/quota_tree.c:375 do_insert_tree+0x722/0x1aa0 fs/quota/quota_tree.c:375 do_insert_tree+0x722/0x1aa0 fs/quota/quota_tree.c:375 dq_insert_tree fs/quota/quota_tree.c:401 [inline] qtree_write_dquot+0x3b6/0x530 fs/quota/quota_tree.c:420 v2_write_dquot+0x11b/0x190 fs/quota/quota_v2.c:358 dquot_acquire+0x348/0x670 fs/quota/dquot.c:444 ext4_acquire_dquot+0x2dc/0x400 fs/ext4/super.c:6740 dqget+0x999/0xdc0 fs/quota/dquot.c:914 __dquot_initialize+0x3d0/0xcf0 fs/quota/dquot.c:1492 ext4_process_orphan+0x57/0x2d0 fs/ext4/orphan.c:329 ext4_orphan_cleanup+0xb60/0x1340 fs/ext4/orphan.c:474 __ext4_fill_super fs/ext4/super.c:5516 [inline] ext4_fill_super+0x81cd/0x8700 fs/ext4/super.c:5644 get_tree_bdev+0x400/0x620 fs/super.c:1282 vfs_get_tree+0x88/0x270 fs/super.c:1489 do_new_mount+0x289/0xad0 fs/namespace.c:3145 do_mount fs/namespace.c:3488 [inline] __do_sys_mount fs/namespace.c:3697 [inline] __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3674 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Add some debug information:mb_find_extent: mb_find_extent block=41, order=0 needed=64 next=0 ex=0/41/1@3735929054 64 64 7block_bitmap: ff 3f 0c 00 fc 01 00 00 d2 3d 00 00 00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Acctually, blocks per group is 64, but block bitmap indicate at least has 128 blocks. Now, ext4_validate_block_bitmap() didn't check invalid block's bitmap if set.
To resolve above issue, add check like fsck "Padding at end of block bitmap is not set".
--- fs/ext4/balloc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
fs/ext4/balloc.c +25 -0
@@ -303,6 +303,22 @@ struct ext4_group_desc * ext4_get_group_return desc; } +static ext4_fsblk_t ext4_valid_block_bitmap_padding (struct super_block *sb, +ext4_group_t block_group, +struct buffer_head *bh) +{ +ext4_grpblk_t next_zero_bit; +unsigned long bitmap_size = sb->s_blocksize *8 ; +unsigned int offset =num_clusters_in_group (sb, block_group); + +if (bitmap_size <= offset) +return 0 ; + + next_zero_bit =ext4_find_next_zero_bit (bh->b_data, bitmap_size, offset); + +return (next_zero_bit < bitmap_size ? next_zero_bit :0 ); +} +/* * Return the block number which was discovered to be invalid, or 0 if * the block bitmap is valid.
@@ -401,6 +417,15 @@ static int ext4_validate_block_bitmap(st EXT4_GROUP_INFO_BBITMAP_CORRUPT);return -EFSCORRUPTED ; } + blk =ext4_valid_block_bitmap_padding (sb, block_group, bh); +if (unlikely (blk !=0 )) { +ext4_unlock_group (sb, block_group); +ext4_error (sb,"bg %u: block %llu: padding at end of block bitmap is not set" , + block_group, blk); +ext4_mark_group_bitmap_corrupted (sb, block_group, +EXT4_GROUP_INFO_BBITMAP_CORRUPT ); +return -EFSCORRUPTED ; + }set_buffer_verified (bh); verified:ext4_unlock_group (sb, block_group);
Greg Kroah-Hartman
maintainerPATCH 228/246 ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 4f04351888a83e595571de672e0a4a8b74f4fb31 upstream.
When modifying the block device while it is mounted by the filesystem, syzbot reported the following:
BUG: KASAN: slab-out-of-bounds in crc16+0x206/0x280 lib/crc16.c:58 Read of size 1 at addr ffff888075f5c0a8 by task syz-executor.2/15586 CPU: 1 PID: 15586 Comm: syz-executor.2 Not tainted 6.2.0-rc5-syzkaller-00205-gc96618275234 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x290 lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:306 print_report+0x107/0x1f0 mm/kasan/report.c:417 kasan_report+0xcd/0x100 mm/kasan/report.c:517 crc16+0x206/0x280 lib/crc16.c:58 ext4_group_desc_csum+0x81b/0xb20 fs/ext4/super.c:3187 ext4_group_desc_csum_set+0x195/0x230 fs/ext4/super.c:3210 ext4_mb_clear_bb fs/ext4/mballoc.c:6027 [inline] ext4_free_blocks+0x191a/0x2810 fs/ext4/mballoc.c:6173 ext4_remove_blocks fs/ext4/extents.c:2527 [inline] ext4_ext_rm_leaf fs/ext4/extents.c:2710 [inline] ext4_ext_remove_space+0x24ef/0x46a0 fs/ext4/extents.c:2958 ext4_ext_truncate+0x177/0x220 fs/ext4/extents.c:4416 ext4_truncate+0xa6a/0xea0 fs/ext4/inode.c:4342 ext4_setattr+0x10c8/0x1930 fs/ext4/inode.c:5622 notify_change+0xe50/0x1100 fs/attr.c:482 do_truncate+0x200/0x2f0 fs/open.c:65 handle_truncate fs/namei.c:3216 [inline] do_open fs/namei.c:3561 [inline] path_openat+0x272b/0x2dd0 fs/namei.c:3714 do_filp_open+0x264/0x4f0 fs/namei.c:3741 do_sys_openat2+0x124/0x4e0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_creat fs/open.c:1402 [inline] __se_sys_creat fs/open.c:1396 [inline] __x64_sys_creat+0x11f/0x160 fs/open.c:1396 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f72f8a8c0c9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f72f97e3168 EFLAGS: 00000246 ORIG_RAX: 0000000000000055 RAX: ffffffffffffffda RBX: 00007f72f8bac050 RCX: 00007f72f8a8c0c9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000280 RBP: 00007f72f8ae7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd165348bf R14: 00007f72f97e3300 R15: 0000000000022000
Replace
le16_to_cpu(sbi->s_es->s_desc_size) with sbi->s_desc_size
It reduces ext4's compiled text size, and makes the code more efficient (we remove an extra indirect reference and a potential byte swap on big endian systems), and there is no downside. It also avoids the potential KASAN / syzkaller failure, as a bonus.
--- fs/ext4/super.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/ext4/super.c +2 -4
@@ -3184,11 +3184,9 @@ static __le16 ext4_group_desc_csum(struc crc =crc16 (crc, (__u8 *)gdp, offset); offset +=sizeof (gdp->bg_checksum);/* skip checksum */ /* for checksum of struct ext4_group_desc do the rest...*/ -if (ext4_has_feature_64bit (sb) && - offset <le16_to_cpu (sbi->s_es->s_desc_size)) +if (ext4_has_feature_64bit (sb) && offset < sbi->s_desc_size) crc =crc16 (crc, (__u8 *)gdp + offset, -le16_to_cpu (sbi->s_es->s_desc_size) - - offset); + sbi->s_desc_size - offset); out:return cpu_to_le16 (crc);
Greg Kroah-Hartman
maintainerPATCH 229/246 ext4: fix data races when using cached status extents
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 492888df0c7b42fc0843631168b0021bc4caee84 upstream.
When using cached extent stored in extent status tree in tree->cache_es another process holding ei->i_es_lock for reading can be racing with us setting new value of tree->cache_es. If the compiler would decide to refetch tree->cache_es at an unfortunate moment, it could result in a bogus in_range() check. Fix the possible race by using READ_ONCE() when using tree->cache_es only under ei->i_es_lock for reading.
--- fs/ext4/extents_status.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
fs/ext4/extents_status.c +13 -17
@@ -267,14 +267,12 @@ static void __es_find_extent_range(struc/* see if the extent has been cached */ es->es_lblk = es->es_len = es->es_pblk =0 ; -if (tree->cache_es) { - es1 = tree->cache_es; -if (in_range (lblk, es1->es_lblk, es1->es_len)) { -es_debug ("%u cached by [%u/%u) %llu %x\n" , - lblk, es1->es_lblk, es1->es_len, -ext4_es_pblock (es1),ext4_es_status (es1)); - goto out; - } + es1 =READ_ONCE (tree->cache_es); +if (es1 &&in_range (lblk, es1->es_lblk, es1->es_len)) { +es_debug ("%u cached by [%u/%u) %llu %x\n" , + lblk, es1->es_lblk, es1->es_len, +ext4_es_pblock (es1),ext4_es_status (es1)); + goto out; } es1 =__es_tree_search (&tree->root, lblk);
@@ -293,7 +291,7 @@ out: }if (es1 &&matching_fn (es1)) { - tree->cache_es = es1; +WRITE_ONCE (tree->cache_es, es1); es->es_lblk = es1->es_lblk; es->es_len = es1->es_len; es->es_pblk = es1->es_pblk;
@@ -931,14 +929,12 @@ int ext4_es_lookup_extent(struct inode */* find extent in cache firstly */ es->es_lblk = es->es_len = es->es_pblk =0 ; -if (tree->cache_es) { - es1 = tree->cache_es; -if (in_range (lblk, es1->es_lblk, es1->es_len)) { -es_debug ("%u cached by [%u/%u)\n" , - lblk, es1->es_lblk, es1->es_len); - found =1 ; - goto out; - } + es1 =READ_ONCE (tree->cache_es); +if (es1 &&in_range (lblk, es1->es_lblk, es1->es_len)) { +es_debug ("%u cached by [%u/%u)\n" , + lblk, es1->es_lblk, es1->es_len); + found =1 ; + goto out; } node = tree->root.rb_node;
Greg Kroah-Hartman
maintainerPATCH 230/246 ext4: avoid deadlock in fs reclaim with page writeback
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 00d873c17e29cc32d90ca852b82685f1673acaa5 upstream.
Ext4 has a filesystem wide lock protecting ext4_writepages() calls to avoid races with switching of journalled data flag or inode format. This lock can however cause a deadlock like:
CPU0 CPU1
ext4_writepages()
percpu_down_read(sbi->s_writepages_rwsem);
ext4_change_inode_journal_flag()
percpu_down_write(sbi->s_writepages_rwsem);
- blocks, all readers block from now on
ext4_do_writepages()
ext4_init_io_end()
kmem_cache_zalloc(io_end_cachep, GFP_KERNEL)
fs_reclaim frees dentry...
dentry_unlink_inode()
iput() - last ref =>
iput_final() - inode dirty =>
write_inode_now()...
ext4_writepages() tries to acquire sbi->s_writepages_rwsem
and blocks forever
Make sure we cannot recurse into filesystem reclaim from writeback code to avoid the deadlock.
--- fs/ext4/ext4.h | 24 ++++++++++++++++++++++++ fs/ext4/inode.c | 18 ++++++++++-------- fs/ext4/migrate.c | 11 ++++++----- 3 files changed, 40 insertions(+), 13 deletions(-)
fs/ext4/ext4.h +24 -0
@@ -1774,6 +1774,30 @@ static inline struct ext4_inode_info *EX return container_of(inode, struct ext4_inode_info, vfs_inode); } +static inline int ext4_writepages_down_read (struct super_block *sb) +{ +percpu_down_read (&EXT4_SB (sb)->s_writepages_rwsem); +return memalloc_nofs_save (); +} + +static inline void ext4_writepages_up_read (struct super_block *sb,int ctx) +{ +memalloc_nofs_restore (ctx); +percpu_up_read (&EXT4_SB (sb)->s_writepages_rwsem); +} + +static inline int ext4_writepages_down_write (struct super_block *sb) +{ +percpu_down_write (&EXT4_SB (sb)->s_writepages_rwsem); +return memalloc_nofs_save (); +} + +static inline void ext4_writepages_up_write (struct super_block *sb,int ctx) +{ +memalloc_nofs_restore (ctx); +percpu_up_write (&EXT4_SB (sb)->s_writepages_rwsem); +} +static inline int ext4_valid_inum (struct super_block *sb,unsigned long ino) { return ino == EXT4_ROOT_INO ||
fs/ext4/inode.c +10 -8
@@ -2956,13 +2956,14 @@ static int ext4_writepages(struct addres .can_map = 1, };int ret; +int alloc_ctx;if (unlikely (ext4_forced_shutdown (EXT4_SB (sb))))return -EIO ; -percpu_down_read (&EXT4_SB (sb)->s_writepages_rwsem); + alloc_ctx =ext4_writepages_down_read (sb); ret =ext4_do_writepages (&mpd); -percpu_up_read (&EXT4_SB (sb)->s_writepages_rwsem); +ext4_writepages_up_read (sb, alloc_ctx);return ret; }
@@ -2990,17 +2991,18 @@ static int ext4_dax_writepages(struct adlong nr_to_write = wbc->nr_to_write;struct inode *inode = mapping->host;struct ext4_sb_info *sbi =EXT4_SB (mapping->host->i_sb); +int alloc_ctx;if (unlikely (ext4_forced_shutdown (EXT4_SB (inode->i_sb))))return -EIO ; -percpu_down_read (&sbi->s_writepages_rwsem); + alloc_ctx =ext4_writepages_down_read (inode->i_sb);trace_ext4_writepages (inode, wbc); ret =dax_writeback_mapping_range (mapping, sbi->s_daxdev, wbc);trace_ext4_writepages_result (inode, wbc, ret, nr_to_write - wbc->nr_to_write); -percpu_up_read (&sbi->s_writepages_rwsem); +ext4_writepages_up_read (inode->i_sb, alloc_ctx);return ret; }
@@ -6122,7 +6124,7 @@ int ext4_change_inode_journal_flag(strucjournal_t *journal;handle_t *handle;int err; -struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb); +int alloc_ctx;/* * We have to be very careful here: changing a data block's
@@ -6160,7 +6162,7 @@ int ext4_change_inode_journal_flag(struc } } -percpu_down_write (&sbi->s_writepages_rwsem); + alloc_ctx =ext4_writepages_down_write (inode->i_sb);jbd2_journal_lock_updates (journal);/*
@@ -6177,7 +6179,7 @@ int ext4_change_inode_journal_flag(struc err =jbd2_journal_flush (journal,0 );if (err <0 ) {jbd2_journal_unlock_updates (journal); -percpu_up_write (&sbi->s_writepages_rwsem); +ext4_writepages_up_write (inode->i_sb, alloc_ctx);return err; }ext4_clear_inode_flag (inode,EXT4_INODE_JOURNAL_DATA );
@@ -6185,7 +6187,7 @@ int ext4_change_inode_journal_flag(strucext4_set_aops (inode);jbd2_journal_unlock_updates (journal); -percpu_up_write (&sbi->s_writepages_rwsem); +ext4_writepages_up_write (inode->i_sb, alloc_ctx);if (val)filemap_invalidate_unlock (inode->i_mapping);
fs/ext4/migrate.c +6 -5
@@ -408,7 +408,6 @@ static int free_ext_block(handle_t *handint ext4_ext_migrate (struct inode *inode) { -struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb);handle_t *handle;int retval =0 , i;__le32 *i_data;
@@ -418,6 +417,7 @@ int ext4_ext_migrate(struct inode *inodeunsigned long max_entries;__u32 goal, tmp_csum_seed;uid_t owner[2 ]; +int alloc_ctx;/* * If the filesystem does not support extents, or the inode
@@ -434,7 +434,7 @@ int ext4_ext_migrate(struct inode *inode*/ return retval; -percpu_down_write (&sbi->s_writepages_rwsem); + alloc_ctx =ext4_writepages_down_write (inode->i_sb);/* * Worst case we can touch the allocation bitmaps and a block
@@ -586,7 +586,7 @@ out_tmp_inode:unlock_new_inode (tmp_inode);iput (tmp_inode); out_unlock: -percpu_up_write (&sbi->s_writepages_rwsem); +ext4_writepages_up_write (inode->i_sb, alloc_ctx);return retval; }
@@ -605,6 +605,7 @@ int ext4_ind_migrate(struct inode *inodeext4_fsblk_t blk;handle_t *handle;int ret, ret2 =0 ; +int alloc_ctx;if (!ext4_has_feature_extents (inode->i_sb) || (!ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )))
@@ -621,7 +622,7 @@ int ext4_ind_migrate(struct inode *inodeif (test_opt (inode->i_sb,DELALLOC ))ext4_alloc_da_blocks (inode); -percpu_down_write (&sbi->s_writepages_rwsem); + alloc_ctx =ext4_writepages_down_write (inode->i_sb); handle =ext4_journal_start (inode,EXT4_HT_MIGRATE ,1 );if (IS_ERR (handle)) {
@@ -665,6 +666,6 @@ errout:ext4_journal_stop (handle);up_write (&EXT4_I (inode)->i_data_sem); out_unlock: -percpu_up_write (&sbi->s_writepages_rwsem); +ext4_writepages_up_write (inode->i_sb, alloc_ctx);return ret; }
Greg Kroah-Hartman
maintainerPATCH 231/246 ext4: check iomap type only if ext4_iomap_begin() does not fail
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit fa83c34e3e56b3c672af38059e066242655271b1 upstream.
When ext4_iomap_overwrite_begin() calls ext4_iomap_begin() map blocks may fail for some reason (e.g. memory allocation failure, bare disk write), and later because "iomap->type ! = IOMAP_MAPPED" triggers WARN_ON(). When ext4 iomap_begin() returns an error, it is normal that the type of iomap->type may not match the expectation. Therefore, we only determine if iomap->type is as expected when ext4_iomap_begin() is executed successfully.
--- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inode.c +1 -1
@@ -3576,7 +3576,7 @@ static int ext4_iomap_overwrite_begin(st*/ flags &= ~IOMAP_WRITE ; ret =ext4_iomap_begin (inode, offset, length, flags, iomap, srcmap); -WARN_ON_ONCE (iomap->type !=IOMAP_MAPPED ); +WARN_ON_ONCE (!ret && iomap->type !=IOMAP_MAPPED );return ret; }
Greg Kroah-Hartman
maintainerPATCH 232/246 ext4: improve error recovery code paths in __ext4_remount()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 4c0b4818b1f636bc96359f7817a2d8bab6370162 upstream.
If there are failures while changing the mount options in __ext4_remount(), we need to restore the old mount options.
This commit fixes two problem. The first is there is a chance that we will free the old quota file names before a potential failure leading to a use-after-free. The second problem addressed in this commit is if there is a failed read/write to read-only transition, if the quota has already been suspended, we need to renable quota handling.
--- fs/ext4/super.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/ext4/super.c +10 -3
@@ -6579,9 +6579,6 @@ static int __ext4_remount(struct fs_cont }#ifdef CONFIG_QUOTA -/* Release old quota file names */ -for (i =0 ; i <EXT4_MAXQUOTAS ; i++) -kfree (old_opts.s_qf_names[i]);if (enable_quota) {if (sb_any_quota_suspended (sb))dquot_resume (sb,-1 );
@@ -6591,6 +6588,9 @@ static int __ext4_remount(struct fs_cont goto restore_opts; } } +/* Release old quota file names */ +for (i =0 ; i <EXT4_MAXQUOTAS ; i++) +kfree (old_opts.s_qf_names[i]);#endif if (!test_opt (sb,BLOCK_VALIDITY ) && sbi->s_system_blks)ext4_release_system_zone (sb);
@@ -6601,6 +6601,13 @@ static int __ext4_remount(struct fs_contreturn 0 ; restore_opts: +/* +* If there was a failing r/w to ro transition, we may need to +* re-enable quota +*/ +if ((sb->s_flags &SB_RDONLY ) && !(old_sb_flags &SB_RDONLY ) && +sb_any_quota_suspended (sb)) +dquot_resume (sb,-1 ); sb->s_flags = old_sb_flags; sbi->s_mount_opt = old_opts.s_mount_opt; sbi->s_mount_opt2 = old_opts.s_mount_opt2;
Greg Kroah-Hartman
maintainerPATCH 233/246 ext4: improve error handling from ext4_dirhash()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 4b3cb1d108bfc2aebb0d7c8a52261a53cf7f5786 upstream.
The ext4_dirhash() will *almost* never fail, especially when the hash tree feature was first introduced. However, with the addition of support of encrypted, casefolded file names, that function can most certainly fail today.
So make sure the callers of ext4_dirhash() properly check for failures, and reflect the errors back up to their callers.
--- fs/ext4/hash.c | 6 +++++- fs/ext4/namei.c | 53 +++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 17 deletions(-)
fs/ext4/hash.c +5 -1
@@ -277,7 +277,11 @@ static int __ext4fs_dirhash(const struct }default : hinfo->hash =0 ; -return -1 ; + hinfo->minor_hash =0 ; +ext4_warning (dir->i_sb, +"invalid/unsupported hash tree version %u" , + hinfo->hash_version); +return -EINVAL ; } hash = hash & ~1 ;if (hash == (EXT4_HTREE_EOF_32BIT <<1 ))
fs/ext4/namei.c +37 -16
102 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 234/246 ext4: fix deadlock when converting an inline directory in nojournal mode
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit f4ce24f54d9cca4f09a395f3eecce20d6bec4663 upstream.
In no journal mode, ext4_finish_convert_inline_dir() can self-deadlock by calling ext4_handle_dirty_dirblock() when it already has taken the directory lock. There is a similar self-deadlock in ext4_incvert_inline_data_nolock() for data files which we'll fix at the same time.
A simple reproducer demonstrating the problem:
mke2fs -Fq -t ext2 -O inline_data -b 4k /dev/vdc 64 mount -t ext4 -o dirsync /dev/vdc /vdc
cd /vdc
mkdir file0
cd file0
touch file0
touch file1
attr -s BurnSpaceInEA -V abcde .
touch supercalifragilisticexpialidocious
--- fs/ext4/inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/inline.c +2 -1
@@ -1177,6 +1177,7 @@ static int ext4_finish_convert_inline_diext4_initialize_dirent_tail (dir_block, inode->i_sb->s_blocksize);set_buffer_uptodate (dir_block); +unlock_buffer (dir_block); err =ext4_handle_dirty_dirblock (handle, inode, dir_block);if (err)return err;
@@ -1251,6 +1252,7 @@ static int ext4_convert_inline_data_noloif (!S_ISDIR (inode->i_mode)) {memcpy (data_bh->b_data, buf, inline_size);set_buffer_uptodate (data_bh); +unlock_buffer (data_bh); error =ext4_handle_dirty_metadata (handle, inode, data_bh); }else {
@@ -1258,7 +1260,6 @@ static int ext4_convert_inline_data_nolo buf, inline_size); } -unlock_buffer (data_bh); out_restore:if (error)ext4_restore_inline_data (handle, inode, iloc, buf, inline_size);
Greg Kroah-Hartman
maintainerPATCH 235/246 ext4: add bounds checking in get_max_inline_xattr_value_size()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 2220eaf90992c11d888fe771055d4de330385f01 upstream.
Normally the extended attributes in the inode body would have been checked when the inode is first opened, but if someone is writing to the block device while the file system is mounted, it's possible for the inode table to get corrupted. Add bounds checking to avoid reading beyond the end of allocated memory if this happens.
--- fs/ext4/inline.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/ext4/inline.c +11 -1
@@ -34,6 +34,7 @@ static int get_max_inline_xattr_value_sistruct ext4_xattr_ibody_header *header;struct ext4_xattr_entry *entry;struct ext4_inode *raw_inode; +void *end;int free, min_offs;if (!EXT4_INODE_HAS_XATTR_SPACE (inode))
@@ -57,14 +58,23 @@ static int get_max_inline_xattr_value_si raw_inode =ext4_raw_inode (iloc); header =IHDR (inode, raw_inode); entry =IFIRST (header); + end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size;/* Compute min_offs. */ -for (; !IS_LAST_ENTRY (entry); entry =EXT4_XATTR_NEXT (entry)) { +while (!IS_LAST_ENTRY (entry)) { +void *next =EXT4_XATTR_NEXT (entry); + +if (next >= end) { +EXT4_ERROR_INODE (inode, +"corrupt xattr in inline inode" ); +return 0 ; + }if (!entry->e_value_inum && entry->e_value_size) {size_t offs =le16_to_cpu (entry->e_value_offs);if (offs < min_offs) min_offs = offs; } + entry = next; } free = min_offs - ((void *)entry - (void *)IFIRST (header)) -sizeof (__u32);
Greg Kroah-Hartman
maintainerPATCH 236/246 ext4: bail out of ext4_xattr_ibody_get() fails for any reason
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 2a534e1d0d1591e951f9ece2fb460b2ff92edabd upstream.
In ext4_update_inline_data(), if ext4_xattr_ibody_get() fails for any reason, it's best if we just fail as opposed to stumbling on, especially if the failure is EFSCORRUPTED.
--- fs/ext4/inline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inline.c +1 -1
@@ -360,7 +360,7 @@ static int ext4_update_inline_data(handl error =ext4_xattr_ibody_get (inode, i.name_index, i.name, value, len); -if (error == -ENODATA ) +if (error <0 ) goto out;BUFFER_TRACE (is.iloc.bh,"get_write_access" );
Greg Kroah-Hartman
maintainerPATCH 237/246 ext4: fix lockdep warning when enabling MMP
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 949f95ff39bf188e594e7ecd8e29b82eb108f5bf upstream.
When we enable MMP in ext4_multi_mount_protect() during mount or remount, we end up calling sb_start_write() from write_mmp_block(). This triggers lockdep warning because freeze protection ranks above s_umount semaphore we are holding during mount / remount. The problem is harmless because we are guaranteed the filesystem is not frozen during mount / remount but still let's fix the warning by not grabbing freeze protection from ext4_multi_mount_protect().
--- fs/ext4/mmp.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
fs/ext4/mmp.c +21 -9
@@ -39,28 +39,36 @@ static void ext4_mmp_csum_set(struct sup* Write the MMP block using REQ_SYNC to try to get the block on-disk * faster. */ -static int write_mmp_block (struct super_block *sb,struct buffer_head *bh) +static int write_mmp_block_thawed (struct super_block *sb, +struct buffer_head *bh) {struct mmp_struct *mmp = (struct mmp_struct *)(bh->b_data); -/* -* We protect against freezing so that we don't create dirty buffers -* on frozen filesystem. -*/ -sb_start_write (sb);ext4_mmp_csum_set (sb, mmp);lock_buffer (bh); bh->b_end_io = end_buffer_write_sync;get_bh (bh);submit_bh (REQ_OP_WRITE |REQ_SYNC |REQ_META |REQ_PRIO , bh);wait_on_buffer (bh); -sb_end_write (sb);if (unlikely (!buffer_uptodate (bh)))return -EIO ; -return 0 ; } +static int write_mmp_block (struct super_block *sb,struct buffer_head *bh) +{ +int err; + +/* +* We protect against freezing so that we don't create dirty buffers +* on frozen filesystem. +*/ +sb_start_write (sb); + err =write_mmp_block_thawed (sb, bh); +sb_end_write (sb); +return err; +} +/* * Read the MMP block. It _must_ be read from disk and hence we clear the * uptodate flag on the buffer.
@@ -340,7 +348,11 @@ skip: seq =mmp_new_seq (); mmp->mmp_seq =cpu_to_le32 (seq); - retval =write_mmp_block (sb, bh); +/* +* On mount / remount we are protected against fs freezing (by s_umount +* semaphore) and grabbing freeze protection upsets lockdep +*/ + retval =write_mmp_block_thawed (sb, bh);if (retval) goto failed;
Greg Kroah-Hartman
maintainerPATCH 238/246 ext4: remove a BUG_ON in ext4_mb_release_group_pa()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 463808f237cf73e98a1a45ff7460c2406a150a0b upstream.
If a malicious fuzzer overwrites the ext4 superblock while it is mounted such that the s_first_data_block is set to a very large number, the calculation of the block group can underflow, and trigger a BUG_ON check. Change this to be an ext4_warning so that we don't crash the kernel.
--- fs/ext4/mballoc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +5 -1
@@ -4820,7 +4820,11 @@ ext4_mb_release_group_pa(struct ext4_budtrace_ext4_mb_release_group_pa (sb, pa);BUG_ON (pa->pa_deleted ==0 );ext4_get_group_no_and_offset (sb, pa->pa_pstart, &group, &bit); -BUG_ON (group != e4b->bd_group && pa->pa_len !=0 ); +if (unlikely (group != e4b->bd_group && pa->pa_len !=0 )) { +ext4_warning (sb,"bad group: expected %u, group %u, pa_start %llu" , + e4b->bd_group, group, pa->pa_pstart); +return 0 ; + }mb_free_blocks (pa->pa_inode, e4b, bit, pa->pa_len);atomic_add (pa->pa_len, &EXT4_SB (sb)->s_mb_discarded);trace_ext4_mballoc_discard (sb,NULL , group, bit, pa->pa_len);
Greg Kroah-Hartman
maintainerPATCH 239/246 ext4: fix invalid free tracking in ext4_xattr_move_to_block()
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit b87c7cdf2bed4928b899e1ce91ef0d147017ba45 upstream.
In ext4_xattr_move_to_block(), the value of the extended attribute which we need to move to an external block may be allocated by kvmalloc() if the value is stored in an external inode. So at the end of the function the code tried to check if this was the case by testing entry->e_value_inum.
However, at this point, the pointer to the xattr entry is no longer valid, because it was removed from the original location where it had been stored. So we could end up calling kvfree() on a pointer which was not allocated by kvmalloc(); or we could also potentially leak memory by not freeing the buffer when it should be freed. Fix this by storing whether it should be freed in a separate variable.
--- fs/ext4/xattr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ext4/xattr.c +3 -2
@@ -2615,6 +2615,7 @@ static int ext4_xattr_move_to_block(hand .in_inode = !!entry->e_value_inum, };struct ext4_xattr_ibody_header *header =IHDR (inode, raw_inode); +int needs_kvfree =0 ;int error; is =kzalloc (sizeof (struct ext4_xattr_ibody_find ),GFP_NOFS );
@@ -2637,7 +2638,7 @@ static int ext4_xattr_move_to_block(hand error = -ENOMEM ; goto out; } - + needs_kvfree =1 ; error =ext4_xattr_inode_get (inode, entry, buffer, value_size);if (error) goto out;
@@ -2676,7 +2677,7 @@ static int ext4_xattr_move_to_block(hand out:kfree (b_entry_name); -if (entry->e_value_inum && buffer) +if (needs_kvfree && buffer)kvfree (buffer);if (is)brelse (is->iloc.bh);
Greg Kroah-Hartman
maintainerPATCH 240/246 x86/amd_nb: Add PCI ID for family 19h model 78h
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit 23a5b8bb022c1e071ca91b1a9c10f0ad6a0966e9 upstream.
Commit
310e782a99c7 ("platform/x86/amd: pmc: Utilize SMN index 0 for driver probe")
switched to using amd_smn_read() which relies upon the misc PCI ID used by DF function 3 being included in a table. The ID for model 78h is missing in that table, so amd_smn_read() doesn't work.
Add the missing ID into amd_nb, restoring s2idle on this system.
[ bp: Simplify commit message. ]
--- arch/x86/kernel/amd_nb.c | 2 ++ include/linux/pci_ids.h | 1 + 2 files changed, 3 insertions(+)
arch/x86/kernel/amd_nb.c +2 -0
@@ -36,6 +36,7 @@#define PCI_DEVICE_ID_AMD_19H_M50H_DF_F4 0x166e#define PCI_DEVICE_ID_AMD_19H_M60H_DF_F4 0x14e4#define PCI_DEVICE_ID_AMD_19H_M70H_DF_F4 0x14f4 +#define PCI_DEVICE_ID_AMD_19H_M78H_DF_F4 0x12fc/* Protect the PCI config register pairs used for SMN. */ static DEFINE_MUTEX (smn_mutex);
@@ -79,6 +80,7 @@ static const struct pci_device_id amd_nb { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M50H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M60H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M70H_DF_F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M78H_DF_F3) }, {} };
include/linux/pci_ids.h +1 -0
@@ -567,6 +567,7 @@#define PCI_DEVICE_ID_AMD_19H_M50H_DF_F3 0x166d#define PCI_DEVICE_ID_AMD_19H_M60H_DF_F3 0x14e3#define PCI_DEVICE_ID_AMD_19H_M70H_DF_F3 0x14f3 +#define PCI_DEVICE_ID_AMD_19H_M78H_DF_F3 0x12fb#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703#define PCI_DEVICE_ID_AMD_LANCE 0x2000#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
Greg Kroah-Hartman
maintainerPATCH 241/246 x86: fix clear_user_rep_good() exception handling annotation
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
This code no longer exists in mainline, because it was removed in commit d2c95f9d6802 ("x86: don't use REP_GOOD or ERMS for user memory clearing") upstream.
However, rather than backport the full range of x86 memory clearing and copying cleanups, fix the exception table annotation placement for the final 'rep movsb' in clear_user_rep_good(): rather than pointing at the actual instruction that did the user space access, it pointed to the register move just before it.
That made sense from a code flow standpoint, but not from an actual usage standpoint: it means that if user access takes an exception, the exception handler won't actually find the instruction in the exception tables.
As a result, rather than fixing it up and returning -EFAULT, it would then turn it into a kernel oops report instead, something like:
BUG: unable to handle page fault for address: 0000000020081000
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
...
RIP: 0010:clear_user_rep_good+0x1c/0x30 arch/x86/lib/clear_page_64.S:147
...
Call Trace:
__clear_user arch/x86/include/asm/uaccess_64.h:103 [inline]
clear_user arch/x86/include/asm/uaccess_64.h:124 [inline]
iov_iter_zero+0x709/0x1290 lib/iov_iter.c:800
iomap_dio_hole_iter fs/iomap/direct-io.c:389 [inline]
iomap_dio_iter fs/iomap/direct-io.c:440 [inline]
__iomap_dio_rw+0xe3d/0x1cd0 fs/iomap/direct-io.c:601
iomap_dio_rw+0x40/0xa0 fs/iomap/direct-io.c:689
ext4_dio_read_iter fs/ext4/file.c:94 [inline]
ext4_file_read_iter+0x4be/0x690 fs/ext4/file.c:145
call_read_iter include/linux/fs.h:2183 [inline]
do_iter_readv_writev+0x2e0/0x3b0 fs/read_write.c:733
do_iter_read+0x2f2/0x750 fs/read_write.c:796
vfs_readv+0xe5/0x150 fs/read_write.c:916
do_preadv+0x1b6/0x270 fs/read_write.c:1008
__do_sys_preadv2 fs/read_write.c:1070 [inline]
__se_sys_preadv2 fs/read_write.c:1061 [inline]
__x64_sys_preadv2+0xef/0x150 fs/read_write.c:1061
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcdwhich then looks like a filesystem bug rather than the incorrect exception annotation that it is.
[ The alternative to this one-liner fix is to take the upstream series
that cleans this all up:
68674f94ffc9 ("x86: don't use REP_GOOD or ERMS for small memory copies") 20f3337d350c ("x86: don't use REP_GOOD or ERMS for small memory clearing") adfcf4231b8c ("x86: don't use REP_GOOD or ERMS for user memory copies")
* d2c95f9d6802 ("x86: don't use REP_GOOD or ERMS for user memory clearing") 3639a535587d ("x86: move stac/clac from user copy routines into callers") 577e6a7fd50d ("x86: inline the 'rep movs' in user copies for the FSRM case") 8c9b6a88b7e2 ("x86: improve on the non-rep 'clear_user' function") 427fda2c8a49 ("x86: improve on the non-rep 'copy_user' function")
* e046fe5a36a9 ("x86: set FSRS automatically on AMD CPUs that have FSRM")
e1f2750edc4a ("x86: remove 'zerorest' argument from __copy_user_nocache()")
034ff37d3407 ("x86: rewrite '__copy_user_nocache' function")with either the whole series or at a minimum the two marked commits being needed to fix this issue ]
--- arch/x86/lib/clear_page_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/clear_page_64.S +1 -1
@@ -142,8 +142,8 @@ SYM_FUNC_START(clear_user_rep_good) and $7, %edx jz .Lrep_good_exit -.Lrep_good_bytes: mov %edx, %ecx +.Lrep_good_bytes: rep stosb .Lrep_good_exit:
Greg Kroah-Hartman
maintainerPATCH 242/246 spi: fsl-spi: Re-organise transfer bits_per_word adaptation
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 8a5299a1278eadf1e08a598a5345c376206f171e upstream.
For different reasons, fsl-spi driver performs bits_per_word modifications for different reasons:
- On CPU mode, to minimise amount of interrupts
- On CPM/QE mode to work around controller byte order
For CPU mode that's done in fsl_spi_prepare_message() while for CPM mode that's done in fsl_spi_setup_transfer().
Reunify all of it in fsl_spi_prepare_message(), and catch impossible cases early through master's bits_per_word_mask instead of returning EINVAL later.
--- drivers/spi/spi-fsl-spi.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-)
drivers/spi/spi-fsl-spi.c +21 -25
@@ -177,26 +177,6 @@ static int mspi_apply_cpu_mode_quirks(streturn bits_per_word; } -static int mspi_apply_qe_mode_quirks (struct spi_mpc8xxx_cs *cs, -struct spi_device *spi, -int bits_per_word) -{ -/* CPM/QE uses Little Endian for words > 8 -* so transform 16 and 32 bits words into 8 bits -* Unfortnatly that doesn't work for LSB so -* reject these for now */ -/* Note: 32 bits word, LSB works iff -* tfcr/rfcr is set to CPMFCR_GBL */ -if (spi->mode &SPI_LSB_FIRST && - bits_per_word >8 ) -return -EINVAL ; -if (bits_per_word <=8 ) -return bits_per_word; -if (bits_per_word ==16 || bits_per_word ==32 ) -return 8 ;/* pretend its 8 bits */ -return -EINVAL ; -} -static int fsl_spi_setup_transfer (struct spi_device *spi,struct spi_transfer *t) {
@@ -224,9 +204,6 @@ static int fsl_spi_setup_transfer(struct bits_per_word =mspi_apply_cpu_mode_quirks (cs, spi, mpc8xxx_spi, bits_per_word); - else - bits_per_word =mspi_apply_qe_mode_quirks (cs, spi, - bits_per_word);if (bits_per_word <0 )return bits_per_word;
@@ -361,6 +338,19 @@ static int fsl_spi_prepare_message(struc t->bits_per_word =32 ; else if ((t->len & 1) == 0) t->bits_per_word = 16; + }else { +/* +* CPM/QE uses Little Endian for words > 8 +* so transform 16 and 32 bits words into 8 bits +* Unfortnatly that doesn't work for LSB so +* reject these for now +* Note: 32 bits word, LSB works iff +* tfcr/rfcr is set to CPMFCR_GBL +*/ +if (m->spi->mode &SPI_LSB_FIRST && t->bits_per_word >8 ) +return -EINVAL ; +if (t->bits_per_word ==16 || t->bits_per_word ==32 ) + t->bits_per_word =8 ;/* pretend its 8 bits */ } }return fsl_spi_setup_transfer (m->spi, first);
@@ -594,8 +584,14 @@ static struct spi_master *fsl_spi_probe(if (mpc8xxx_spi->type ==TYPE_GRLIB )fsl_spi_grlib_probe (dev); - master->bits_per_word_mask = - (SPI_BPW_RANGE_MASK (4 ,16 ) |SPI_BPW_MASK (32 )) & +if (mpc8xxx_spi->flags &SPI_CPM_MODE ) + master->bits_per_word_mask = + (SPI_BPW_RANGE_MASK (4 ,8 ) |SPI_BPW_MASK (16 ) |SPI_BPW_MASK (32 )); +else + master->bits_per_word_mask = + (SPI_BPW_RANGE_MASK (4 ,16 ) |SPI_BPW_MASK (32 )); + + master->bits_per_word_mask &=SPI_BPW_RANGE_MASK (1 , mpc8xxx_spi->max_bits_per_word);if (mpc8xxx_spi->flags &SPI_QE_CPU_MODE )
Greg Kroah-Hartman
maintainerPATCH 243/246 spi: fsl-cpm: Use 16 bit mode for large transfers with even size
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit fc96ec826bced75cc6b9c07a4ac44bbf651337ab upstream.
On CPM, the RISC core is a lot more efficiant when doing transfers in 16-bits chunks than in 8-bits chunks, but unfortunately the words need to be byte swapped as seen in a previous commit.
So, for large tranfers with an even size, allocate a temporary tx buffer and byte-swap data before and after transfer.
This change allows setting higher speed for transfer. For instance on an MPC 8xx (CPM1 comms RISC processor), the documentation tells that transfer in byte mode at 1 kbit/s uses 0.200% of CPM load at 25 MHz while a word transfer at the same speed uses 0.032% of CPM load. This means the speed can be 6 times higher in word mode for the same CPM load.
For the time being, only do it on CPM1 as there must be a trade-off between the CPM load reduction and the CPU load required to byte swap the data.
--- drivers/spi/spi-fsl-cpm.c | 23 +++++++++++++++++++++++ drivers/spi/spi-fsl-spi.c | 3 +++ 2 files changed, 26 insertions(+)
drivers/spi/spi-fsl-cpm.c +23 -0
@@ -21,6 +21,7 @@#include <linux/spi/spi.h> #include <linux/types.h> #include <linux/platform_device.h> +#include <linux/byteorder/generic.h> #include "spi-fsl-cpm.h" #include "spi-fsl-lib.h"
@@ -120,6 +121,21 @@ int fsl_spi_cpm_bufs(struct mpc8xxx_spi mspi->rx_dma = mspi->dma_dummy_rx; mspi->map_rx_dma =0 ; } +if (t->bits_per_word ==16 && t->tx_buf) { +const u16 *src = t->tx_buf; +u16 *dst; +int i; + + dst =kmalloc (t->len,GFP_KERNEL ); +if (!dst) +return -ENOMEM ; + +for (i =0 ; i < t->len >>1 ; i++) + dst[i] =cpu_to_le16p (src + i); + + mspi->tx = dst; + mspi->map_tx_dma =1 ; + }if (mspi->map_tx_dma) {void *nonconst_tx = (void *)mspi->tx;/* shut up gcc */
@@ -173,6 +189,13 @@ void fsl_spi_cpm_bufs_complete(struct mpif (mspi->map_rx_dma)dma_unmap_single (dev, mspi->rx_dma, t->len,DMA_FROM_DEVICE ); mspi->xfer_in_progress =NULL ; + +if (t->bits_per_word ==16 && t->rx_buf) { +int i; + +for (i =0 ; i < t->len; i +=2 ) +le16_to_cpus (t->rx_buf + i); + } }EXPORT_SYMBOL_GPL (fsl_spi_cpm_bufs_complete);
drivers/spi/spi-fsl-spi.c +3 -0
@@ -351,6 +351,9 @@ static int fsl_spi_prepare_message(strucreturn -EINVAL ;if (t->bits_per_word ==16 || t->bits_per_word ==32 ) t->bits_per_word =8 ;/* pretend its 8 bits */ +if (t->bits_per_word ==8 && t->len >=256 && + (mpc8xxx_spi->flags &SPI_CPM1 )) + t->bits_per_word =16 ; } }return fsl_spi_setup_transfer (m->spi, first);
Greg Kroah-Hartman
maintainerPATCH 244/246 s390/mm: rename POPULATE_ONE2ONE to POPULATE_DIRECT
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit 07fdd6627f7f9c72ed68d531653b56df81da9996 ]
Architectures generally use the "direct map" wording for mapping the whole physical memory. Use that wording as well in arch/s390/boot/vmem.c, instead of "one to one" in order to avoid confusion.
This also matches what is already done in arch/s390/mm/vmem.c.
--- arch/s390/boot/vmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/boot/vmem.c +4 -4
@@ -29,7 +29,7 @@ unsigned long __bootdata(pgalloc_low);enum populate_mode {POPULATE_NONE , -POPULATE_ONE2ONE , +POPULATE_DIRECT ,POPULATE_ABS_LOWCORE , };
@@ -102,7 +102,7 @@ static unsigned long _pa(unsigned long aswitch (mode) {case POPULATE_NONE :return -1 ; -case POPULATE_ONE2ONE : +case POPULATE_DIRECT :return addr;case POPULATE_ABS_LOWCORE :return __abs_lowcore_pa (addr);
@@ -251,9 +251,9 @@ void setup_vmem(unsigned long asce_limit* the lowcore and create the identity mapping only afterwards. */ pgtable_populate_init (); -pgtable_populate (0 ,sizeof (struct lowcore ),POPULATE_ONE2ONE ); +pgtable_populate (0 ,sizeof (struct lowcore ),POPULATE_DIRECT );for_each_mem_detect_usable_block (i, &start, &end) -pgtable_populate (start, end,POPULATE_ONE2ONE ); +pgtable_populate (start, end,POPULATE_DIRECT );pgtable_populate (__abs_lowcore, __abs_lowcore +sizeof (struct lowcore ),POPULATE_ABS_LOWCORE ); pgtable_populate(__memcpy_real_area, __memcpy_real_area + PAGE_SIZE,
Greg Kroah-Hartman
maintainerPATCH 245/246 s390/mm: fix direct map accounting
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit 81e8479649853ffafc714aca4a9c0262efd3160a ]
Commit bb1520d581a3 ("s390/mm: start kernel with DAT enabled") did not implement direct map accounting in the early page table setup code. In result the reported values are bogus now:
$cat /proc/meminfo
...
DirectMap4k: 5120 kB DirectMap1M: 18446744073709546496 kB DirectMap2G: 0 kB
Fix this by adding the missing accounting. The result looks sane again:
$cat /proc/meminfo
...
DirectMap4k: 6156 kB DirectMap1M: 2091008 kB DirectMap2G: 6291456 kB
--- arch/s390/boot/vmem.c | 19 ++++++++++++++++--- arch/s390/include/asm/pgtable.h | 2 +- arch/s390/mm/pageattr.c | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-)
arch/s390/boot/vmem.c +16 -3
@@ -10,6 +10,10 @@#include "decompressor.h" #include "boot.h" +#ifdef CONFIG_PROC_FS +atomic_long_t __bootdata_preserved (direct_pages_count [PG_DIRECT_MAP_MAX ]); +#endif +#define init_mm (*(struct mm_struct *)vmlinux.init_mm_off)#define swapper_pg_dir vmlinux.swapper_pg_dir_off#define invalid_pg_dir vmlinux.invalid_pg_dir_off
@@ -126,7 +130,7 @@ static bool can_large_pmd(pmd_t *pm_dir,static void pgtable_pte_populate (pmd_t *pmd,unsigned long addr,unsigned long end,enum populate_mode mode) { -unsigned long next; +unsigned long pages =0 ;pte_t *pte, entry; pte =pte_offset_kernel (pmd, addr);
@@ -135,14 +139,17 @@ static void pgtable_pte_populate(pmd_t * entry =__pte (_pa (addr, mode)); entry =set_pte_bit (entry,PAGE_KERNEL_EXEC );set_pte (pte, entry); + pages++; } } +if (mode ==POPULATE_DIRECT ) +update_page_count (PG_DIRECT_MAP_4K , pages); }static void pgtable_pmd_populate (pud_t *pud,unsigned long addr,unsigned long end,enum populate_mode mode) { -unsigned long next; +unsigned long next, pages =0 ;pmd_t *pmd, entry;pte_t *pte;
@@ -154,6 +161,7 @@ static void pgtable_pmd_populate(pud_t * entry =__pmd (_pa (addr, mode)); entry =set_pmd_bit (entry,SEGMENT_KERNEL_EXEC );set_pmd (pmd, entry); + pages++;continue ; } pte =boot_pte_alloc ();
@@ -163,12 +171,14 @@ static void pgtable_pmd_populate(pud_t * }pgtable_pte_populate (pmd, addr, next, mode); } +if (mode ==POPULATE_DIRECT ) +update_page_count (PG_DIRECT_MAP_1M , pages); }static void pgtable_pud_populate (p4d_t *p4d,unsigned long addr,unsigned long end,enum populate_mode mode) { -unsigned long next; +unsigned long next, pages =0 ;pud_t *pud, entry;pmd_t *pmd;
@@ -180,6 +190,7 @@ static void pgtable_pud_populate(p4d_t * entry =__pud (_pa (addr, mode)); entry =set_pud_bit (entry,REGION3_KERNEL_EXEC );set_pud (pud, entry); + pages++;continue ; } pmd =boot_crst_alloc (_SEGMENT_ENTRY_EMPTY);
@@ -189,6 +200,8 @@ static void pgtable_pud_populate(p4d_t * }pgtable_pmd_populate (pud, addr, next, mode); } +if (mode ==POPULATE_DIRECT ) +update_page_count (PG_DIRECT_MAP_2G , pages); } static void pgtable_p4d_populate(pgd_t *pgd, unsigned long addr, unsigned long end,
arch/s390/include/asm/pgtable.h +1 -1
@@ -34,7 +34,7 @@ enum { PG_DIRECT_MAP_MAX }; -extern atomic_long_t direct_pages_count[PG_DIRECT_MAP_MAX ]; +extern atomic_long_t __bootdata_preserved (direct_pages_count [PG_DIRECT_MAP_MAX ]);static inline void update_page_count (int level,long count) {
arch/s390/mm/pageattr.c +1 -1
@@ -41,7 +41,7 @@ void __storage_key_init_range(unsigned l }#ifdef CONFIG_PROC_FS -atomic_long_t direct_pages_count[PG_DIRECT_MAP_MAX ]; +atomic_long_t __bootdata_preserved (direct_pages_count [PG_DIRECT_MAP_MAX ]);void arch_report_meminfo (struct seq_file *m) {
Greg Kroah-Hartman
maintainerPATCH 246/246 drm/amd/display: Fix hang when skipping modeset
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
commit da5e14909776edea4462672fb4a3007802d262e7 upstream.
[Why&How]
When skipping full modeset since the only state change was a front porch change, the DC commit sequence requires extra checks to handle non existant plane states being asked to be removed from context.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++++- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -1
@@ -7957,6 +7957,8 @@ static void amdgpu_dm_commit_planes(strucontinue ; dc_plane = dm_new_plane_state->dc_state; +if (!dc_plane) +continue ; bundle->surface_updates[planes_count].surface = dc_plane;if (new_pcrtc_state->color_mgmt_changed) {
@@ -9616,8 +9618,9 @@ static int dm_update_plane_state(structreturn -EINVAL ; } +if (dm_old_plane_state->dc_state) +dc_plane_state_release (dm_old_plane_state->dc_state); -dc_plane_state_release (dm_old_plane_state->dc_state); dm_new_plane_state->dc_state =NULL ; *lock_and_validation_needed = true;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +3 -0
@@ -1707,6 +1707,9 @@ bool dc_remove_plane_from_context(struct dc_stream_status *stream_status =NULL ;struct resource_pool *pool = dc->res_pool; +if (!plane_state) +return true; +for (i =0 ; i < context->stream_count; i++)if (context->streams[i] == stream) { stream_status = &context->stream_status[i];
Hello Greg,
Quoted 10 lines
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, May 15, 2023 5:24 PMThis is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
CIP configurations built and booted with Linux 6.3.3-rc1 (5a952cfef67c):
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/867957411
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/commits/linux-6.3.y
Kind regards, Chris
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Successfully compiled and installed bindeb-pkgs on my computer (Acer Aspire E15, Intel Core i3 Haswell). No noticeable regressions.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Build test (gcc version 12.2.1 20230511):
mips: 52 configs -> no failure
arm: 71 configs -> no failure
arm64: 3 configs -> no failurex86_64: 4 configs -> no failure alpha allmodconfig -> no failure csky allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failure
Boot test:x86_64: Booted on my test laptop. No regression.x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]
[1]. https://openqa.qa.codethink.co.uk/tests/3539
[2]. https://openqa.qa.codethink.co.uk/tests/3540
Signature · 2 lines
Regards Sudip
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.3.3-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.3.y
* git commit: 5a952cfef67ce264699425e499ad25cc5fb16730
* git describe: v6.3.2-247-g5a952cfef67c
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.3.y/build/v6.3.2-247-g5a952cfef67c
## Test Regressions (compared to v6.3.2)
## Metric Regressions (compared to v6.3.2)
## Test Fixes (compared to v6.3.2)
## Metric Fixes (compared to v6.3.2)
## Test result summary
total: 139910, pass: 123164, fail: 1983, skip: 14532, xfail: 231
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 145 total, 144 passed, 1 failed
* arm64: 54 total, 53 passed, 1 failed
* i386: 41 total, 40 passed, 1 failed
* mips: 30 total, 28 passed, 2 failed
* parisc: 8 total, 8 passed, 0 failed
* powerpc: 38 total, 36 passed, 2 failed
* riscv: 26 total, 25 passed, 1 failed
* s390: 16 total, 14 passed, 2 failed
* sh: 14 total, 12 passed, 2 failed
* sparc: 8 total, 7 passed, 1 failed
* x86_64: 46 total, 46 passed, 0 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Ditto here, nothing looks out of place.
Thanks,
Conor.
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
Hi Greg,
6.3.3-rc1 tested.
Run tested on:
- Allwinner H6 (Tanix TX6)
- Intel Alder Lake x86_64 (nuc12 i7-1260P)
In addition - build tested for:
- Allwinner A64
- Allwinner H3
- Allwinner H5
- NXP iMX6
- NXP iMX8
- Qualcomm Dragonboard
- Rockchip RK3288
- Rockchip RK3328
- Rockchip RK3399pro
- Samsung Exynos
--
Rudi
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
Hi Greg
6.3.3-rc1
compiles, boots and runs here on x86_64
(AMD Ryzen 5 PRO 4650G, Slackware64-15.0)
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
Build results:
total: 153 pass: 153 fail: 0 Qemu test results: total: 520 pass: 520 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.3.3 release. There are 246 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 May 2023 16:16:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.3.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.3.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.3:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
130 tests: 130 pass, 0 failLinux version: 6.3.3-rc1-g5a952cfef67c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Signature · 1 line
nvpublic