From: Greg Kroah-Hartman Date: Tue, 8 Sep 2020 15:13:33 +0000 (+0200) Subject: 5.8-stable patches X-Git-Tag: v4.14.197~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d088cf9d66ddd6a2171364f8ecade8c3a7ca27b5;p=thirdparty%2Fkernel%2Fstable-queue.git 5.8-stable patches added patches: cfg80211-regulatory-reject-invalid-hints.patch checkpatch-fix-the-usage-of-capture-group.patch kconfig-streamline_config.pl-check-defined-env-variable-before-using-it.patch mm-hugetlb-fix-a-race-between-hugetlb-sysctl-handlers.patch mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch mm-khugepaged.c-fix-khugepaged-s-request-size-in-collapse_file.patch mm-migrate-fixup-setting-uffd_wp-flag.patch net-usb-fix-uninit-was-stored-issue-in-asix_read_phy_addr.patch perf-record-correct-the-help-info-of-option-no-bpf-event.patch sdhci-tegra-add-missing-tmclk-for-data-timeout.patch --- diff --git a/queue-5.8/cfg80211-regulatory-reject-invalid-hints.patch b/queue-5.8/cfg80211-regulatory-reject-invalid-hints.patch new file mode 100644 index 00000000000..58d98c04428 --- /dev/null +++ b/queue-5.8/cfg80211-regulatory-reject-invalid-hints.patch @@ -0,0 +1,34 @@ +From 47caf685a6854593348f216e0b489b71c10cbe03 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Wed, 19 Aug 2020 10:46:48 +0200 +Subject: cfg80211: regulatory: reject invalid hints + +From: Johannes Berg + +commit 47caf685a6854593348f216e0b489b71c10cbe03 upstream. + +Reject invalid hints early in order to not cause a kernel +WARN later if they're restored to or similar. + +Reported-by: syzbot+d451401ffd00a60677ee@syzkaller.appspotmail.com +Link: https://syzkaller.appspot.com/bug?extid=d451401ffd00a60677ee +Link: https://lore.kernel.org/r/20200819084648.13956-1-johannes@sipsolutions.net +Signed-off-by: Johannes Berg +Signed-off-by: Greg Kroah-Hartman + +--- + net/wireless/reg.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -2944,6 +2944,9 @@ int regulatory_hint_user(const char *alp + if (WARN_ON(!alpha2)) + return -EINVAL; + ++ if (!is_world_regdom(alpha2) && !is_an_alpha2(alpha2)) ++ return -EINVAL; ++ + request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); + if (!request) + return -ENOMEM; diff --git a/queue-5.8/checkpatch-fix-the-usage-of-capture-group.patch b/queue-5.8/checkpatch-fix-the-usage-of-capture-group.patch new file mode 100644 index 00000000000..36444fb66d1 --- /dev/null +++ b/queue-5.8/checkpatch-fix-the-usage-of-capture-group.patch @@ -0,0 +1,58 @@ +From 13e45417cedbfc44b1926124b1846f5ee8c6ba4a Mon Sep 17 00:00:00 2001 +From: Mrinal Pandey +Date: Fri, 4 Sep 2020 16:35:52 -0700 +Subject: checkpatch: fix the usage of capture group ( ... ) + +From: Mrinal Pandey + +commit 13e45417cedbfc44b1926124b1846f5ee8c6ba4a upstream. + +The usage of "capture group (...)" in the immediate condition after `&&` +results in `$1` being uninitialized. This issues a warning "Use of +uninitialized value $1 in regexp compilation at ./scripts/checkpatch.pl +line 2638". + +I noticed this bug while running checkpatch on the set of commits from +v5.7 to v5.8-rc1 of the kernel on the commits with a diff content in +their commit message. + +This bug was introduced in the script by commit e518e9a59ec3 +("checkpatch: emit an error when there's a diff in a changelog"). It +has been in the script since then. + +The author intended to store the match made by capture group in variable +`$1`. This should have contained the name of the file as `[\w/]+` +matched. However, this couldn't be accomplished due to usage of capture +group and `$1` in the same regular expression. + +Fix this by placing the capture group in the condition before `&&`. +Thus, `$1` can be initialized to the text that capture group matches +thereby setting it to the desired and required value. + +Fixes: e518e9a59ec3 ("checkpatch: emit an error when there's a diff in a changelog") +Signed-off-by: Mrinal Pandey +Signed-off-by: Andrew Morton +Tested-by: Lukas Bulwahn +Reviewed-by: Lukas Bulwahn +Cc: Joe Perches +Link: https://lkml.kernel.org/r/20200714032352.f476hanaj2dlmiot@mrinalpandey +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/checkpatch.pl | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/scripts/checkpatch.pl ++++ b/scripts/checkpatch.pl +@@ -2636,8 +2636,8 @@ sub process { + + # Check if the commit log has what seems like a diff which can confuse patch + if ($in_commit_log && !$commit_log_has_diff && +- (($line =~ m@^\s+diff\b.*a/[\w/]+@ && +- $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) || ++ (($line =~ m@^\s+diff\b.*a/([\w/]+)@ && ++ $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) || + $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ || + $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) { + ERROR("DIFF_IN_COMMIT_MSG", diff --git a/queue-5.8/kconfig-streamline_config.pl-check-defined-env-variable-before-using-it.patch b/queue-5.8/kconfig-streamline_config.pl-check-defined-env-variable-before-using-it.patch new file mode 100644 index 00000000000..0b9563c9e24 --- /dev/null +++ b/queue-5.8/kconfig-streamline_config.pl-check-defined-env-variable-before-using-it.patch @@ -0,0 +1,40 @@ +From a73fbfce2cc28883f659414d598e6e60ca2214b4 Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Wed, 26 Aug 2020 14:21:43 -0700 +Subject: kconfig: streamline_config.pl: check defined(ENV variable) before using it + +From: Randy Dunlap + +commit a73fbfce2cc28883f659414d598e6e60ca2214b4 upstream. + +A user reported: +'Use of uninitialized value $ENV{"LMC_KEEP"} in split at + ./scripts/kconfig/streamline_config.pl line 596.' + +so first check that $ENV{LMC_KEEP} is defined before trying +to use it. + +Fixes: c027b02d89fd ("streamline_config.pl: add LMC_KEEP to preserve some kconfigs") +Signed-off-by: Randy Dunlap +Acked-by: Steven Rostedt (VMware) +Signed-off-by: Masahiro Yamada +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/kconfig/streamline_config.pl | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/scripts/kconfig/streamline_config.pl ++++ b/scripts/kconfig/streamline_config.pl +@@ -593,7 +593,10 @@ while ($repeat) { + } + + my %setconfigs; +-my @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP}); ++my @preserved_kconfigs; ++if (defined($ENV{'LMC_KEEP'})) { ++ @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP}); ++} + + sub in_preserved_kconfigs { + my $kconfig = $config2kfile{$_[0]}; diff --git a/queue-5.8/mm-hugetlb-fix-a-race-between-hugetlb-sysctl-handlers.patch b/queue-5.8/mm-hugetlb-fix-a-race-between-hugetlb-sysctl-handlers.patch new file mode 100644 index 00000000000..f236bb8a794 --- /dev/null +++ b/queue-5.8/mm-hugetlb-fix-a-race-between-hugetlb-sysctl-handlers.patch @@ -0,0 +1,119 @@ +From 17743798d81238ab13050e8e2833699b54e15467 Mon Sep 17 00:00:00 2001 +From: Muchun Song +Date: Fri, 4 Sep 2020 16:36:13 -0700 +Subject: mm/hugetlb: fix a race between hugetlb sysctl handlers + +From: Muchun Song + +commit 17743798d81238ab13050e8e2833699b54e15467 upstream. + +There is a race between the assignment of `table->data` and write value +to the pointer of `table->data` in the __do_proc_doulongvec_minmax() on +the other thread. + + CPU0: CPU1: + proc_sys_write + hugetlb_sysctl_handler proc_sys_call_handler + hugetlb_sysctl_handler_common hugetlb_sysctl_handler + table->data = &tmp; hugetlb_sysctl_handler_common + table->data = &tmp; + proc_doulongvec_minmax + do_proc_doulongvec_minmax sysctl_head_finish + __do_proc_doulongvec_minmax unuse_table + i = table->data; + *i = val; // corrupt CPU1's stack + +Fix this by duplicating the `table`, and only update the duplicate of +it. And introduce a helper of proc_hugetlb_doulongvec_minmax() to +simplify the code. + +The following oops was seen: + + BUG: kernel NULL pointer dereference, address: 0000000000000000 + #PF: supervisor instruction fetch in kernel mode + #PF: error_code(0x0010) - not-present page + Code: Bad RIP value. + ... + Call Trace: + ? set_max_huge_pages+0x3da/0x4f0 + ? alloc_pool_huge_page+0x150/0x150 + ? proc_doulongvec_minmax+0x46/0x60 + ? hugetlb_sysctl_handler_common+0x1c7/0x200 + ? nr_hugepages_store+0x20/0x20 + ? copy_fd_bitmaps+0x170/0x170 + ? hugetlb_sysctl_handler+0x1e/0x20 + ? proc_sys_call_handler+0x2f1/0x300 + ? unregister_sysctl_table+0xb0/0xb0 + ? __fd_install+0x78/0x100 + ? proc_sys_write+0x14/0x20 + ? __vfs_write+0x4d/0x90 + ? vfs_write+0xef/0x240 + ? ksys_write+0xc0/0x160 + ? __ia32_sys_read+0x50/0x50 + ? __close_fd+0x129/0x150 + ? __x64_sys_write+0x43/0x50 + ? do_syscall_64+0x6c/0x200 + ? entry_SYSCALL_64_after_hwframe+0x44/0xa9 + +Fixes: e5ff215941d5 ("hugetlb: multiple hstates for multiple page sizes") +Signed-off-by: Muchun Song +Signed-off-by: Andrew Morton +Reviewed-by: Mike Kravetz +Cc: Andi Kleen +Link: http://lkml.kernel.org/r/20200828031146.43035-1-songmuchun@bytedance.com +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/hugetlb.c | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -3480,6 +3480,22 @@ static unsigned int cpuset_mems_nr(unsig + } + + #ifdef CONFIG_SYSCTL ++static int proc_hugetlb_doulongvec_minmax(struct ctl_table *table, int write, ++ void *buffer, size_t *length, ++ loff_t *ppos, unsigned long *out) ++{ ++ struct ctl_table dup_table; ++ ++ /* ++ * In order to avoid races with __do_proc_doulongvec_minmax(), we ++ * can duplicate the @table and alter the duplicate of it. ++ */ ++ dup_table = *table; ++ dup_table.data = out; ++ ++ return proc_doulongvec_minmax(&dup_table, write, buffer, length, ppos); ++} ++ + static int hugetlb_sysctl_handler_common(bool obey_mempolicy, + struct ctl_table *table, int write, + void *buffer, size_t *length, loff_t *ppos) +@@ -3491,9 +3507,8 @@ static int hugetlb_sysctl_handler_common + if (!hugepages_supported()) + return -EOPNOTSUPP; + +- table->data = &tmp; +- table->maxlen = sizeof(unsigned long); +- ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); ++ ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos, ++ &tmp); + if (ret) + goto out; + +@@ -3536,9 +3551,8 @@ int hugetlb_overcommit_handler(struct ct + if (write && hstate_is_gigantic(h)) + return -EINVAL; + +- table->data = &tmp; +- table->maxlen = sizeof(unsigned long); +- ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); ++ ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos, ++ &tmp); + if (ret) + goto out; + diff --git a/queue-5.8/mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch b/queue-5.8/mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch new file mode 100644 index 00000000000..cbc1dca928b --- /dev/null +++ b/queue-5.8/mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch @@ -0,0 +1,79 @@ +From 953f064aa6b29debcc211869b60bd59f26d19c34 Mon Sep 17 00:00:00 2001 +From: Li Xinhai +Date: Fri, 4 Sep 2020 16:36:10 -0700 +Subject: mm/hugetlb: try preferred node first when alloc gigantic page from cma + +From: Li Xinhai + +commit 953f064aa6b29debcc211869b60bd59f26d19c34 upstream. + +Since commit cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic +hugepages using cma"), the gigantic page would be allocated from node +which is not the preferred node, although there are pages available from +that node. The reason is that the nid parameter has been ignored in +alloc_gigantic_page(). + +Besides, the __GFP_THISNODE also need be checked if user required to +alloc only from the preferred node. + +After this patch, the preferred node is tried first before other allowed +nodes, and don't try to allocate from other nodes if __GFP_THISNODE is +specified. If user don't specify the preferred node, the current node +will be used as preferred node, which makes sure consistent behavior of +allocating gigantic and non-gigantic hugetlb page. + +Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages using cma") +Signed-off-by: Li Xinhai +Signed-off-by: Andrew Morton +Reviewed-by: Mike Kravetz +Acked-by: Michal Hocko +Cc: Roman Gushchin +Link: https://lkml.kernel.org/r/20200902025016.697260-1-lixinhai.lxh@gmail.com +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/hugetlb.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -1251,21 +1251,32 @@ static struct page *alloc_gigantic_page( + int nid, nodemask_t *nodemask) + { + unsigned long nr_pages = 1UL << huge_page_order(h); ++ if (nid == NUMA_NO_NODE) ++ nid = numa_mem_id(); + + #ifdef CONFIG_CMA + { + struct page *page; + int node; + +- for_each_node_mask(node, *nodemask) { +- if (!hugetlb_cma[node]) +- continue; +- +- page = cma_alloc(hugetlb_cma[node], nr_pages, +- huge_page_order(h), true); ++ if (hugetlb_cma[nid]) { ++ page = cma_alloc(hugetlb_cma[nid], nr_pages, ++ huge_page_order(h), true); + if (page) + return page; + } ++ ++ if (!(gfp_mask & __GFP_THISNODE)) { ++ for_each_node_mask(node, *nodemask) { ++ if (node == nid || !hugetlb_cma[node]) ++ continue; ++ ++ page = cma_alloc(hugetlb_cma[node], nr_pages, ++ huge_page_order(h), true); ++ if (page) ++ return page; ++ } ++ } + } + #endif + diff --git a/queue-5.8/mm-khugepaged.c-fix-khugepaged-s-request-size-in-collapse_file.patch b/queue-5.8/mm-khugepaged.c-fix-khugepaged-s-request-size-in-collapse_file.patch new file mode 100644 index 00000000000..48424816c2c --- /dev/null +++ b/queue-5.8/mm-khugepaged.c-fix-khugepaged-s-request-size-in-collapse_file.patch @@ -0,0 +1,42 @@ +From e5a59d308f52bb0052af5790c22173651b187465 Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Fri, 4 Sep 2020 16:36:16 -0700 +Subject: mm/khugepaged.c: fix khugepaged's request size in collapse_file + +From: David Howells + +commit e5a59d308f52bb0052af5790c22173651b187465 upstream. + +collapse_file() in khugepaged passes PAGE_SIZE as the number of pages to +be read to page_cache_sync_readahead(). The intent was probably to read +a single page. Fix it to use the number of pages to the end of the +window instead. + +Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") +Signed-off-by: David Howells +Signed-off-by: Matthew Wilcox (Oracle) +Signed-off-by: Andrew Morton +Reviewed-by: Matthew Wilcox (Oracle) +Acked-by: Song Liu +Acked-by: Yang Shi +Acked-by: Pankaj Gupta +Cc: Eric Biggers +Link: https://lkml.kernel.org/r/20200903140844.14194-2-willy@infradead.org +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/khugepaged.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/mm/khugepaged.c ++++ b/mm/khugepaged.c +@@ -1709,7 +1709,7 @@ static void collapse_file(struct mm_stru + xas_unlock_irq(&xas); + page_cache_sync_readahead(mapping, &file->f_ra, + file, index, +- PAGE_SIZE); ++ end - index); + /* drain pagevecs to help isolate_lru_page() */ + lru_add_drain(); + page = find_lock_page(mapping, index); diff --git a/queue-5.8/mm-migrate-fixup-setting-uffd_wp-flag.patch b/queue-5.8/mm-migrate-fixup-setting-uffd_wp-flag.patch new file mode 100644 index 00000000000..6ebc8d9c5cb --- /dev/null +++ b/queue-5.8/mm-migrate-fixup-setting-uffd_wp-flag.patch @@ -0,0 +1,46 @@ +From ebdf8321eeeb623aed60f7ed16f7445363230118 Mon Sep 17 00:00:00 2001 +From: Alistair Popple +Date: Fri, 4 Sep 2020 16:35:58 -0700 +Subject: mm/migrate: fixup setting UFFD_WP flag +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alistair Popple + +commit ebdf8321eeeb623aed60f7ed16f7445363230118 upstream. + +Commit f45ec5ff16a75 ("userfaultfd: wp: support swap and page migration") +introduced support for tracking the uffd wp bit during page migration. +However the non-swap PTE variant was used to set the flag for zone device +private pages which are a type of swap page. + +This leads to corruption of the swap offset if the original PTE has the +uffd_wp flag set. + +Fixes: f45ec5ff16a75 ("userfaultfd: wp: support swap and page migration") +Signed-off-by: Alistair Popple +Signed-off-by: Andrew Morton +Reviewed-by: Peter Xu +Cc: Jérôme Glisse +Cc: John Hubbard +Cc: Ralph Campbell +Link: https://lkml.kernel.org/r/20200825064232.10023-1-alistair@popple.id.au +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/migrate.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/mm/migrate.c ++++ b/mm/migrate.c +@@ -251,7 +251,7 @@ static bool remove_migration_pte(struct + entry = make_device_private_entry(new, pte_write(pte)); + pte = swp_entry_to_pte(entry); + if (pte_swp_uffd_wp(*pvmw.pte)) +- pte = pte_mkuffd_wp(pte); ++ pte = pte_swp_mkuffd_wp(pte); + } + } + diff --git a/queue-5.8/net-usb-fix-uninit-was-stored-issue-in-asix_read_phy_addr.patch b/queue-5.8/net-usb-fix-uninit-was-stored-issue-in-asix_read_phy_addr.patch new file mode 100644 index 00000000000..da3b16c7e53 --- /dev/null +++ b/queue-5.8/net-usb-fix-uninit-was-stored-issue-in-asix_read_phy_addr.patch @@ -0,0 +1,34 @@ +From a092b7233f0e000cc6f2c71a49e2ecc6f917a5fc Mon Sep 17 00:00:00 2001 +From: Himadri Pandya +Date: Thu, 27 Aug 2020 12:23:55 +0530 +Subject: net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() + +From: Himadri Pandya + +commit a092b7233f0e000cc6f2c71a49e2ecc6f917a5fc upstream. + +The buffer size is 2 Bytes and we expect to receive the same amount of +data. But sometimes we receive less data and run into uninit-was-stored +issue upon read. Hence modify the error check on the return value to match +with the buffer size as a prevention. + +Reported-and-tested by: syzbot+a7e220df5a81d1ab400e@syzkaller.appspotmail.com +Signed-off-by: Himadri Pandya +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/usb/asix_common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/usb/asix_common.c ++++ b/drivers/net/usb/asix_common.c +@@ -296,7 +296,7 @@ int asix_read_phy_addr(struct usbnet *de + + netdev_dbg(dev->net, "asix_get_phy_addr()\n"); + +- if (ret < 0) { ++ if (ret < 2) { + netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret); + goto out; + } diff --git a/queue-5.8/perf-record-correct-the-help-info-of-option-no-bpf-event.patch b/queue-5.8/perf-record-correct-the-help-info-of-option-no-bpf-event.patch new file mode 100644 index 00000000000..bd7c334bfe8 --- /dev/null +++ b/queue-5.8/perf-record-correct-the-help-info-of-option-no-bpf-event.patch @@ -0,0 +1,56 @@ +From a060c1f12b525ba828f871eff3127dabf8daa1e6 Mon Sep 17 00:00:00 2001 +From: Wei Li +Date: Wed, 19 Aug 2020 11:19:47 +0800 +Subject: perf record: Correct the help info of option "--no-bpf-event" + +From: Wei Li + +commit a060c1f12b525ba828f871eff3127dabf8daa1e6 upstream. + +The help info of option "--no-bpf-event" is wrongly described as "record +bpf events", correct it. + +Committer testing: + + $ perf record -h bpf + + Usage: perf record [] [] + or: perf record [] -- [] + + --clang-opt + options passed to clang when compiling BPF scriptlets + --clang-path + clang binary to use for compiling BPF scriptlets + --no-bpf-event do not record bpf events + + $ + +Fixes: 71184c6ab7e6 ("perf record: Replace option --bpf-event with --no-bpf-event") +Signed-off-by: Wei Li +Acked-by: Song Liu +Tested-by: Arnaldo Carvalho de Melo +Cc: Alexander Shishkin +Cc: Hanjun Guo +Cc: Jiri Olsa +Cc: Li Bin +Cc: Mark Rutland +Cc: Namhyung Kim +Link: http://lore.kernel.org/lkml/20200819031947.12115-1-liwei391@huawei.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/builtin-record.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/builtin-record.c ++++ b/tools/perf/builtin-record.c +@@ -2417,7 +2417,7 @@ static struct option __record_options[] + OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize, + "synthesize non-sample events at the end of output"), + OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"), +- OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "record bpf events"), ++ OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "do not record bpf events"), + OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq, + "Fail if the specified frequency can't be used"), + OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'", diff --git a/queue-5.8/sdhci-tegra-add-missing-tmclk-for-data-timeout.patch b/queue-5.8/sdhci-tegra-add-missing-tmclk-for-data-timeout.patch new file mode 100644 index 00000000000..925d4e02e13 --- /dev/null +++ b/queue-5.8/sdhci-tegra-add-missing-tmclk-for-data-timeout.patch @@ -0,0 +1,151 @@ +From 8048822bac01936fda2c7b924a52131da81e6198 Mon Sep 17 00:00:00 2001 +From: Sowjanya Komatineni +Date: Thu, 27 Aug 2020 10:21:01 -0700 +Subject: sdhci: tegra: Add missing TMCLK for data timeout + +From: Sowjanya Komatineni + +commit 8048822bac01936fda2c7b924a52131da81e6198 upstream. + +commit b5a84ecf025a ("mmc: tegra: Add Tegra210 support") + +Tegra210 and later has a separate sdmmc_legacy_tm (TMCLK) used by Tegra +SDMMC hawdware for data timeout to achive better timeout than using +SDCLK and using TMCLK is recommended. + +USE_TMCLK_FOR_DATA_TIMEOUT bit in Tegra SDMMC register +SDHCI_TEGRA_VENDOR_SYS_SW_CTRL can be used to choose either TMCLK or +SDCLK for data timeout. + +Default USE_TMCLK_FOR_DATA_TIMEOUT bit is set to 1 and TMCLK is used +for data timeout by Tegra SDMMC hardware and having TMCLK not enabled +is not recommended. + +So, this patch adds quirk NVQUIRK_HAS_TMCLK for SoC having separate +timeout clock and keeps TMCLK enabled all the time. + +Fixes: b5a84ecf025a ("mmc: tegra: Add Tegra210 support") +Cc: stable # 5.4 +Tested-by: Jon Hunter +Reviewed-by: Jon Hunter +Acked-by: Adrian Hunter +Signed-off-by: Sowjanya Komatineni +Link: https://lore.kernel.org/r/1598548861-32373-8-git-send-email-skomatineni@nvidia.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/sdhci-tegra.c | 53 +++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 51 insertions(+), 2 deletions(-) + +--- a/drivers/mmc/host/sdhci-tegra.c ++++ b/drivers/mmc/host/sdhci-tegra.c +@@ -101,6 +101,12 @@ + #define NVQUIRK_DIS_CARD_CLK_CONFIG_TAP BIT(8) + #define NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING BIT(9) + ++/* ++ * NVQUIRK_HAS_TMCLK is for SoC's having separate timeout clock for Tegra ++ * SDMMC hardware data timeout. ++ */ ++#define NVQUIRK_HAS_TMCLK BIT(10) ++ + /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */ + #define SDHCI_TEGRA_CQE_BASE_ADDR 0xF000 + +@@ -131,6 +137,7 @@ struct sdhci_tegra_autocal_offsets { + struct sdhci_tegra { + const struct sdhci_tegra_soc_data *soc_data; + struct gpio_desc *power_gpio; ++ struct clk *tmclk; + bool ddr_signaling; + bool pad_calib_required; + bool pad_control_available; +@@ -1424,7 +1431,8 @@ static const struct sdhci_tegra_soc_data + NVQUIRK_HAS_PADCALIB | + NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | + NVQUIRK_ENABLE_SDR50 | +- NVQUIRK_ENABLE_SDR104, ++ NVQUIRK_ENABLE_SDR104 | ++ NVQUIRK_HAS_TMCLK, + .min_tap_delay = 106, + .max_tap_delay = 185, + }; +@@ -1462,6 +1470,7 @@ static const struct sdhci_tegra_soc_data + NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | + NVQUIRK_ENABLE_SDR50 | + NVQUIRK_ENABLE_SDR104 | ++ NVQUIRK_HAS_TMCLK | + NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING, + .min_tap_delay = 84, + .max_tap_delay = 136, +@@ -1474,7 +1483,8 @@ static const struct sdhci_tegra_soc_data + NVQUIRK_HAS_PADCALIB | + NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | + NVQUIRK_ENABLE_SDR50 | +- NVQUIRK_ENABLE_SDR104, ++ NVQUIRK_ENABLE_SDR104 | ++ NVQUIRK_HAS_TMCLK, + .min_tap_delay = 96, + .max_tap_delay = 139, + }; +@@ -1602,6 +1612,43 @@ static int sdhci_tegra_probe(struct plat + goto err_power_req; + } + ++ /* ++ * Tegra210 has a separate SDMMC_LEGACY_TM clock used for host ++ * timeout clock and SW can choose TMCLK or SDCLK for hardware ++ * data timeout through the bit USE_TMCLK_FOR_DATA_TIMEOUT of ++ * the register SDHCI_TEGRA_VENDOR_SYS_SW_CTRL. ++ * ++ * USE_TMCLK_FOR_DATA_TIMEOUT bit default is set to 1 and SDMMC uses ++ * 12Mhz TMCLK which is advertised in host capability register. ++ * With TMCLK of 12Mhz provides maximum data timeout period that can ++ * be achieved is 11s better than using SDCLK for data timeout. ++ * ++ * So, TMCLK is set to 12Mhz and kept enabled all the time on SoC's ++ * supporting separate TMCLK. ++ */ ++ ++ if (soc_data->nvquirks & NVQUIRK_HAS_TMCLK) { ++ clk = devm_clk_get(&pdev->dev, "tmclk"); ++ if (IS_ERR(clk)) { ++ rc = PTR_ERR(clk); ++ if (rc == -EPROBE_DEFER) ++ goto err_power_req; ++ ++ dev_warn(&pdev->dev, "failed to get tmclk: %d\n", rc); ++ clk = NULL; ++ } ++ ++ clk_set_rate(clk, 12000000); ++ rc = clk_prepare_enable(clk); ++ if (rc) { ++ dev_err(&pdev->dev, ++ "failed to enable tmclk: %d\n", rc); ++ goto err_power_req; ++ } ++ ++ tegra_host->tmclk = clk; ++ } ++ + clk = devm_clk_get(mmc_dev(host->mmc), NULL); + if (IS_ERR(clk)) { + rc = PTR_ERR(clk); +@@ -1645,6 +1692,7 @@ err_add_host: + err_rst_get: + clk_disable_unprepare(pltfm_host->clk); + err_clk_get: ++ clk_disable_unprepare(tegra_host->tmclk); + err_power_req: + err_parse_dt: + sdhci_pltfm_free(pdev); +@@ -1662,6 +1710,7 @@ static int sdhci_tegra_remove(struct pla + reset_control_assert(tegra_host->rst); + usleep_range(2000, 4000); + clk_disable_unprepare(pltfm_host->clk); ++ clk_disable_unprepare(tegra_host->tmclk); + + sdhci_pltfm_free(pdev); + diff --git a/queue-5.8/series b/queue-5.8/series index 855127a5dd9..cd32193ec7c 100644 --- a/queue-5.8/series +++ b/queue-5.8/series @@ -174,3 +174,13 @@ mm-track-page-table-modifications-in-__apply_to_page_range.patch mm-madvise-fix-vma-user-after-free.patch mm-rmap-fixup-copying-of-soft-dirty-and-uffd-ptes.patch io_uring-no-read-write-retry-on-eagain-error-and-o_nonblock-marked-file.patch +perf-record-correct-the-help-info-of-option-no-bpf-event.patch +kconfig-streamline_config.pl-check-defined-env-variable-before-using-it.patch +sdhci-tegra-add-missing-tmclk-for-data-timeout.patch +checkpatch-fix-the-usage-of-capture-group.patch +mm-migrate-fixup-setting-uffd_wp-flag.patch +mm-hugetlb-try-preferred-node-first-when-alloc-gigantic-page-from-cma.patch +mm-hugetlb-fix-a-race-between-hugetlb-sysctl-handlers.patch +mm-khugepaged.c-fix-khugepaged-s-request-size-in-collapse_file.patch +cfg80211-regulatory-reject-invalid-hints.patch +net-usb-fix-uninit-was-stored-issue-in-asix_read_phy_addr.patch