From: Greg Kroah-Hartman Date: Mon, 3 Jul 2023 18:40:11 +0000 (+0200) Subject: 6.3-stable patches X-Git-Tag: v5.15.120~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7277c285bd451d5e615cfef59bde4991b28f329c;p=thirdparty%2Fkernel%2Fstable-queue.git 6.3-stable patches added patches: dm-ioctl-avoid-double-fetch-of-version.patch docs-set-minimal-gtags-gnu-global-version-to-6.6.5.patch drm-amdgpu-validate-vm-ioctl-flags.patch hugetlb-revert-use-of-page_cache_next_miss.patch nfs-don-t-report-statx_btime-in-getattr.patch nubus-partially-revert-proc_create_single_data-conversion.patch revert-cxl-port-enable-the-hdm-decoder-capability-for-switch-ports.patch scripts-tags.sh-resolve-gtags-empty-index-generation.patch --- diff --git a/queue-6.3/dm-ioctl-avoid-double-fetch-of-version.patch b/queue-6.3/dm-ioctl-avoid-double-fetch-of-version.patch new file mode 100644 index 00000000000..3497062eb99 --- /dev/null +++ b/queue-6.3/dm-ioctl-avoid-double-fetch-of-version.patch @@ -0,0 +1,99 @@ +From 249bed821b4db6d95a99160f7d6d236ea5fe6362 Mon Sep 17 00:00:00 2001 +From: Demi Marie Obenour +Date: Sat, 3 Jun 2023 10:52:42 -0400 +Subject: dm ioctl: Avoid double-fetch of version + +From: Demi Marie Obenour + +commit 249bed821b4db6d95a99160f7d6d236ea5fe6362 upstream. + +The version is fetched once in check_version(), which then does some +validation and then overwrites the version in userspace with the API +version supported by the kernel. copy_params() then fetches the version +from userspace *again*, and this time no validation is done. The result +is that the kernel's version number is completely controllable by +userspace, provided that userspace can win a race condition. + +Fix this flaw by not copying the version back to the kernel the second +time. This is not exploitable as the version is not further used in the +kernel. However, it could become a problem if future patches start +relying on the version field. + +Cc: stable@vger.kernel.org +Signed-off-by: Demi Marie Obenour +Signed-off-by: Mike Snitzer +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/dm-ioctl.c | 33 +++++++++++++++++++++------------ + 1 file changed, 21 insertions(+), 12 deletions(-) + +--- a/drivers/md/dm-ioctl.c ++++ b/drivers/md/dm-ioctl.c +@@ -1830,30 +1830,36 @@ static ioctl_fn lookup_ioctl(unsigned in + * As well as checking the version compatibility this always + * copies the kernel interface version out. + */ +-static int check_version(unsigned int cmd, struct dm_ioctl __user *user) ++static int check_version(unsigned int cmd, struct dm_ioctl __user *user, ++ struct dm_ioctl *kernel_params) + { +- uint32_t version[3]; + int r = 0; + +- if (copy_from_user(version, user->version, sizeof(version))) ++ /* Make certain version is first member of dm_ioctl struct */ ++ BUILD_BUG_ON(offsetof(struct dm_ioctl, version) != 0); ++ ++ if (copy_from_user(kernel_params->version, user->version, sizeof(kernel_params->version))) + return -EFAULT; + +- if ((version[0] != DM_VERSION_MAJOR) || +- (version[1] > DM_VERSION_MINOR)) { ++ if ((kernel_params->version[0] != DM_VERSION_MAJOR) || ++ (kernel_params->version[1] > DM_VERSION_MINOR)) { + DMERR("ioctl interface mismatch: kernel(%u.%u.%u), user(%u.%u.%u), cmd(%d)", + DM_VERSION_MAJOR, DM_VERSION_MINOR, + DM_VERSION_PATCHLEVEL, +- version[0], version[1], version[2], cmd); ++ kernel_params->version[0], ++ kernel_params->version[1], ++ kernel_params->version[2], ++ cmd); + r = -EINVAL; + } + + /* + * Fill in the kernel version. + */ +- version[0] = DM_VERSION_MAJOR; +- version[1] = DM_VERSION_MINOR; +- version[2] = DM_VERSION_PATCHLEVEL; +- if (copy_to_user(user->version, version, sizeof(version))) ++ kernel_params->version[0] = DM_VERSION_MAJOR; ++ kernel_params->version[1] = DM_VERSION_MINOR; ++ kernel_params->version[2] = DM_VERSION_PATCHLEVEL; ++ if (copy_to_user(user->version, kernel_params->version, sizeof(kernel_params->version))) + return -EFAULT; + + return r; +@@ -1879,7 +1885,10 @@ static int copy_params(struct dm_ioctl _ + const size_t minimum_data_size = offsetof(struct dm_ioctl, data); + unsigned int noio_flag; + +- if (copy_from_user(param_kernel, user, minimum_data_size)) ++ /* check_version() already copied version from userspace, avoid TOCTOU */ ++ if (copy_from_user((char *)param_kernel + sizeof(param_kernel->version), ++ (char __user *)user + sizeof(param_kernel->version), ++ minimum_data_size - sizeof(param_kernel->version))) + return -EFAULT; + + if (param_kernel->data_size < minimum_data_size) { +@@ -1991,7 +2000,7 @@ static int ctl_ioctl(struct file *file, + * Check the interface version passed in. This also + * writes out the kernel's interface version. + */ +- r = check_version(cmd, user); ++ r = check_version(cmd, user, ¶m_kernel); + if (r) + return r; + diff --git a/queue-6.3/docs-set-minimal-gtags-gnu-global-version-to-6.6.5.patch b/queue-6.3/docs-set-minimal-gtags-gnu-global-version-to-6.6.5.patch new file mode 100644 index 00000000000..4d92d1b670d --- /dev/null +++ b/queue-6.3/docs-set-minimal-gtags-gnu-global-version-to-6.6.5.patch @@ -0,0 +1,44 @@ +From b230235b386589d8f0d631b1c77a95ca79bb0732 Mon Sep 17 00:00:00 2001 +From: "Ahmed S. Darwish" +Date: Mon, 15 May 2023 19:32:17 +0200 +Subject: docs: Set minimal gtags / GNU GLOBAL version to 6.6.5 + +From: Ahmed S. Darwish + +commit b230235b386589d8f0d631b1c77a95ca79bb0732 upstream. + +Kernel build now uses the gtags "-C (--directory)" option, available +since GNU GLOBAL v6.6.5. Update the documentation accordingly. + +Signed-off-by: Ahmed S. Darwish +Cc: +Link: https://lists.gnu.org/archive/html/info-global/2020-09/msg00000.html +Signed-off-by: Masahiro Yamada +Signed-off-by: Greg Kroah-Hartman +--- + Documentation/process/changes.rst | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/Documentation/process/changes.rst ++++ b/Documentation/process/changes.rst +@@ -60,6 +60,7 @@ openssl & libcrypto 1.0.0 + bc 1.06.95 bc --version + Sphinx\ [#f1]_ 1.7 sphinx-build --version + cpio any cpio --version ++gtags (optional) 6.6.5 gtags --version + ====================== =============== ======================================== + + .. [#f1] Sphinx is needed only to build the Kernel documentation +@@ -174,6 +175,12 @@ You will need openssl to build kernels 3 + enabled. You will also need openssl development packages to build kernels 4.3 + and higher. + ++gtags / GNU GLOBAL (optional) ++----------------------------- ++ ++The kernel build requires GNU GLOBAL version 6.6.5 or later to generate ++tag files through ``make gtags``. This is due to its use of the gtags ++``-C (--directory)`` flag. + + System utilities + **************** diff --git a/queue-6.3/drm-amdgpu-validate-vm-ioctl-flags.patch b/queue-6.3/drm-amdgpu-validate-vm-ioctl-flags.patch new file mode 100644 index 00000000000..07a06cd9034 --- /dev/null +++ b/queue-6.3/drm-amdgpu-validate-vm-ioctl-flags.patch @@ -0,0 +1,33 @@ +From a2b308044dcaca8d3e580959a4f867a1d5c37fac Mon Sep 17 00:00:00 2001 +From: Bas Nieuwenhuizen +Date: Sat, 13 May 2023 14:51:00 +0200 +Subject: drm/amdgpu: Validate VM ioctl flags. + +From: Bas Nieuwenhuizen + +commit a2b308044dcaca8d3e580959a4f867a1d5c37fac upstream. + +None have been defined yet, so reject anybody setting any. Mesa sets +it to 0 anyway. + +Signed-off-by: Bas Nieuwenhuizen +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +@@ -2371,6 +2371,10 @@ int amdgpu_vm_ioctl(struct drm_device *d + struct amdgpu_fpriv *fpriv = filp->driver_priv; + int r; + ++ /* No valid flags defined yet */ ++ if (args->in.flags) ++ return -EINVAL; ++ + switch (args->in.op) { + case AMDGPU_VM_OP_RESERVE_VMID: + /* We only have requirement to reserve vmid from gfxhub */ diff --git a/queue-6.3/hugetlb-revert-use-of-page_cache_next_miss.patch b/queue-6.3/hugetlb-revert-use-of-page_cache_next_miss.patch new file mode 100644 index 00000000000..fa6c539ea44 --- /dev/null +++ b/queue-6.3/hugetlb-revert-use-of-page_cache_next_miss.patch @@ -0,0 +1,96 @@ +From fd4aed8d985a3236d0877ff6d0c80ad39d4ce81a Mon Sep 17 00:00:00 2001 +From: Mike Kravetz +Date: Wed, 21 Jun 2023 14:24:03 -0700 +Subject: hugetlb: revert use of page_cache_next_miss() + +From: Mike Kravetz + +commit fd4aed8d985a3236d0877ff6d0c80ad39d4ce81a upstream. + +Ackerley Tng reported an issue with hugetlbfs fallocate as noted in the +Closes tag. The issue showed up after the conversion of hugetlb page +cache lookup code to use page_cache_next_miss. User visible effects are: + +- hugetlbfs fallocate incorrectly returns -EEXIST if pages are presnet + in the file. +- hugetlb pages will not be included in core dumps if they need to be + brought in via GUP. +- userfaultfd UFFDIO_COPY will not notice pages already present in the + cache. It may try to allocate a new page and potentially return + ENOMEM as opposed to EEXIST. + +Revert the use page_cache_next_miss() in hugetlb code. + +IMPORTANT NOTE FOR STABLE BACKPORTS: +This patch will apply cleanly to v6.3. However, due to the change of +filemap_get_folio() return values, it will not function correctly. This +patch must be modified for stable backports. + +[dan.carpenter@linaro.org: fix hugetlbfs_pagecache_present()] + Link: https://lkml.kernel.org/r/efa86091-6a2c-4064-8f55-9b44e1313015@moroto.mountain +Link: https://lkml.kernel.org/r/20230621212403.174710-2-mike.kravetz@oracle.com +Fixes: d0ce0e47b323 ("mm/hugetlb: convert hugetlb fault paths to use alloc_hugetlb_folio()") +Signed-off-by: Mike Kravetz +Signed-off-by: Dan Carpenter +Reported-by: Ackerley Tng +Closes: https://lore.kernel.org/linux-mm/cover.1683069252.git.ackerleytng@google.com +Reviewed-by: Sidhartha Kumar +Cc: Erdem Aktas +Cc: Greg Kroah-Hartman +Cc: Matthew Wilcox +Cc: Muchun Song +Cc: Vishal Annapurve +Signed-off-by: Andrew Morton +Signed-off-by: Sidhartha Kumar +Signed-off-by: Greg Kroah-Hartman +--- + fs/hugetlbfs/inode.c | 8 +++----- + mm/hugetlb.c | 12 ++++++------ + 2 files changed, 9 insertions(+), 11 deletions(-) + +--- a/fs/hugetlbfs/inode.c ++++ b/fs/hugetlbfs/inode.c +@@ -821,7 +821,6 @@ static long hugetlbfs_fallocate(struct f + */ + struct folio *folio; + unsigned long addr; +- bool present; + + cond_resched(); + +@@ -845,10 +844,9 @@ static long hugetlbfs_fallocate(struct f + mutex_lock(&hugetlb_fault_mutex_table[hash]); + + /* See if already present in mapping to avoid alloc/free */ +- rcu_read_lock(); +- present = page_cache_next_miss(mapping, index, 1) != index; +- rcu_read_unlock(); +- if (present) { ++ folio = filemap_get_folio(mapping, index); ++ if (!IS_ERR(folio)) { ++ folio_put(folio); + mutex_unlock(&hugetlb_fault_mutex_table[hash]); + hugetlb_drop_vma_policy(&pseudo_vma); + continue; +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -5672,13 +5672,13 @@ static bool hugetlbfs_pagecache_present( + { + struct address_space *mapping = vma->vm_file->f_mapping; + pgoff_t idx = vma_hugecache_offset(h, vma, address); +- bool present; ++ struct folio *folio; + +- rcu_read_lock(); +- present = page_cache_next_miss(mapping, idx, 1) != idx; +- rcu_read_unlock(); +- +- return present; ++ folio = filemap_get_folio(mapping, idx); ++ if (IS_ERR(folio)) ++ return false; ++ folio_put(folio); ++ return true; + } + + int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping, diff --git a/queue-6.3/nfs-don-t-report-statx_btime-in-getattr.patch b/queue-6.3/nfs-don-t-report-statx_btime-in-getattr.patch new file mode 100644 index 00000000000..765b18e0fd2 --- /dev/null +++ b/queue-6.3/nfs-don-t-report-statx_btime-in-getattr.patch @@ -0,0 +1,41 @@ +From cded49ba366220ae7009d71c5804baa01acfb860 Mon Sep 17 00:00:00 2001 +From: Jeff Layton +Date: Mon, 12 Jun 2023 09:34:04 -0400 +Subject: nfs: don't report STATX_BTIME in ->getattr + +From: Jeff Layton + +commit cded49ba366220ae7009d71c5804baa01acfb860 upstream. + +NFS doesn't properly support reporting the btime in getattr (yet), but +61a968b4f05e mistakenly added it to the request_mask. This causes statx +for STATX_BTIME to report a zeroed out btime instead of properly +clearing the flag. + +Cc: stable@vger.kernel.org # v6.3+ +Fixes: 61a968b4f05e ("nfs: report the inode version in getattr if requested") +Signed-off-by: Jeff Layton +Link: https://bugzilla.redhat.com/show_bug.cgi?id=2214134 +Reported-by: Boyang Xue +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman +--- + fs/nfs/inode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c +index a910b9a638c5..8172dd4135a1 100644 +--- a/fs/nfs/inode.c ++++ b/fs/nfs/inode.c +@@ -845,7 +845,7 @@ int nfs_getattr(struct mnt_idmap *idmap, const struct path *path, + + request_mask &= STATX_TYPE | STATX_MODE | STATX_NLINK | STATX_UID | + STATX_GID | STATX_ATIME | STATX_MTIME | STATX_CTIME | +- STATX_INO | STATX_SIZE | STATX_BLOCKS | STATX_BTIME | ++ STATX_INO | STATX_SIZE | STATX_BLOCKS | + STATX_CHANGE_COOKIE; + + if ((query_flags & AT_STATX_DONT_SYNC) && !force_sync) { +-- +2.41.0 + diff --git a/queue-6.3/nubus-partially-revert-proc_create_single_data-conversion.patch b/queue-6.3/nubus-partially-revert-proc_create_single_data-conversion.patch new file mode 100644 index 00000000000..6aad374d0c1 --- /dev/null +++ b/queue-6.3/nubus-partially-revert-proc_create_single_data-conversion.patch @@ -0,0 +1,117 @@ +From 0e96647cff9224db564a1cee6efccb13dbe11ee2 Mon Sep 17 00:00:00 2001 +From: Finn Thain +Date: Tue, 14 Mar 2023 19:51:59 +1100 +Subject: nubus: Partially revert proc_create_single_data() conversion + +From: Finn Thain + +commit 0e96647cff9224db564a1cee6efccb13dbe11ee2 upstream. + +The conversion to proc_create_single_data() introduced a regression +whereby reading a file in /proc/bus/nubus results in a seg fault: + + # grep -r . /proc/bus/nubus/e/ + Data read fault at 0x00000020 in Super Data (pc=0x1074c2) + BAD KERNEL BUSERR + Oops: 00000000 + Modules linked in: + PC: [<001074c2>] PDE_DATA+0xc/0x16 + SR: 2010 SP: 38284958 a2: 01152370 + d0: 00000001 d1: 01013000 d2: 01002790 d3: 00000000 + d4: 00000001 d5: 0008ce2e a0: 00000000 a1: 00222a40 + Process grep (pid: 45, task=142f8727) + Frame format=B ssw=074d isc=2008 isb=4e5e daddr=00000020 dobuf=01199e70 + baddr=001074c8 dibuf=ffffffff ver=f + Stack from 01199e48: + 01199e70 00222a58 01002790 00000000 011a3000 01199eb0 015000c0 00000000 + 00000000 01199ec0 01199ec0 000d551a 011a3000 00000001 00000000 00018000 + d003f000 00000003 00000001 0002800d 01052840 01199fa8 c01f8000 00000000 + 00000029 0b532b80 00000000 00000000 00000029 0b532b80 01199ee4 00103640 + 011198c0 d003f000 00018000 01199fa8 00000000 011198c0 00000000 01199f4c + 000b3344 011198c0 d003f000 00018000 01199fa8 00000000 00018000 011198c0 + Call Trace: [<00222a58>] nubus_proc_rsrc_show+0x18/0xa0 + [<000d551a>] seq_read+0xc4/0x510 + [<00018000>] fp_fcos+0x2/0x82 + [<0002800d>] __sys_setreuid+0x115/0x1c6 + [<00103640>] proc_reg_read+0x5c/0xb0 + [<00018000>] fp_fcos+0x2/0x82 + [<000b3344>] __vfs_read+0x2c/0x13c + [<00018000>] fp_fcos+0x2/0x82 + [<00018000>] fp_fcos+0x2/0x82 + [<000b8aa2>] sys_statx+0x60/0x7e + [<000b34b6>] vfs_read+0x62/0x12a + [<00018000>] fp_fcos+0x2/0x82 + [<00018000>] fp_fcos+0x2/0x82 + [<000b39c2>] ksys_read+0x48/0xbe + [<00018000>] fp_fcos+0x2/0x82 + [<000b3a4e>] sys_read+0x16/0x1a + [<00018000>] fp_fcos+0x2/0x82 + [<00002b84>] syscall+0x8/0xc + [<00018000>] fp_fcos+0x2/0x82 + [<0000c016>] not_ext+0xa/0x18 + Code: 4e5e 4e75 4e56 0000 206e 0008 2068 ffe8 <2068> 0020 2008 4e5e 4e75 4e56 0000 2f0b 206e 0008 2068 0004 2668 0020 206b ffe8 + Disabling lock debugging due to kernel taint + + Segmentation fault + +The proc_create_single_data() conversion does not work because +single_open(file, nubus_proc_rsrc_show, PDE_DATA(inode)) is not +equivalent to the original code. + +Fixes: 3f3942aca6da ("proc: introduce proc_create_single{,_data}") +Cc: Christoph Hellwig +Cc: stable@vger.kernel.org # 5.6+ +Signed-off-by: Finn Thain +Reviewed-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/d4e2a586e793cc8d9442595684ab8a077c0fe726.1678783919.git.fthain@linux-m68k.org +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nubus/proc.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +--- a/drivers/nubus/proc.c ++++ b/drivers/nubus/proc.c +@@ -137,6 +137,18 @@ static int nubus_proc_rsrc_show(struct s + return 0; + } + ++static int nubus_rsrc_proc_open(struct inode *inode, struct file *file) ++{ ++ return single_open(file, nubus_proc_rsrc_show, inode); ++} ++ ++static const struct proc_ops nubus_rsrc_proc_ops = { ++ .proc_open = nubus_rsrc_proc_open, ++ .proc_read = seq_read, ++ .proc_lseek = seq_lseek, ++ .proc_release = single_release, ++}; ++ + void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir, + const struct nubus_dirent *ent, + unsigned int size) +@@ -152,8 +164,8 @@ void nubus_proc_add_rsrc_mem(struct proc + pded = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size); + else + pded = NULL; +- proc_create_single_data(name, S_IFREG | 0444, procdir, +- nubus_proc_rsrc_show, pded); ++ proc_create_data(name, S_IFREG | 0444, procdir, ++ &nubus_rsrc_proc_ops, pded); + } + + void nubus_proc_add_rsrc(struct proc_dir_entry *procdir, +@@ -166,9 +178,9 @@ void nubus_proc_add_rsrc(struct proc_dir + return; + + snprintf(name, sizeof(name), "%x", ent->type); +- proc_create_single_data(name, S_IFREG | 0444, procdir, +- nubus_proc_rsrc_show, +- nubus_proc_alloc_pde_data(data, 0)); ++ proc_create_data(name, S_IFREG | 0444, procdir, ++ &nubus_rsrc_proc_ops, ++ nubus_proc_alloc_pde_data(data, 0)); + } + + /* diff --git a/queue-6.3/revert-cxl-port-enable-the-hdm-decoder-capability-for-switch-ports.patch b/queue-6.3/revert-cxl-port-enable-the-hdm-decoder-capability-for-switch-ports.patch new file mode 100644 index 00000000000..61ed0124e9a --- /dev/null +++ b/queue-6.3/revert-cxl-port-enable-the-hdm-decoder-capability-for-switch-ports.patch @@ -0,0 +1,185 @@ +From 8f0220af58c3b73e9041377a23708d37600b33c1 Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Thu, 15 Jun 2023 12:53:40 -0700 +Subject: Revert "cxl/port: Enable the HDM decoder capability for switch ports" + +From: Dan Williams + +commit 8f0220af58c3b73e9041377a23708d37600b33c1 upstream. + +commit eb0764b822b9 ("cxl/port: Enable the HDM decoder capability for switch ports") + +...was added on the observation of CXL memory not being accessible after +setting up a region on a "cold-plugged" device. A "cold-plugged" CXL +device is one that was not present at boot, so platform-firmware/BIOS +has no chance to set it up. + +While it is true that the debug found the enable bit clear in the +host-bridge's instance of the global control register (CXL 3.0 +8.2.4.19.2 CXL HDM Decoder Global Control Register), that bit is +described as: + +"This bit is only applicable to CXL.mem devices and shall +return 0 on CXL Host Bridges and Upstream Switch Ports." + +So it is meant to be zero, and further testing confirmed that this "fix" +had no effect on the failure. Revert it, and be more vigilant about +proposed fixes in the future. Since the original copied stable@, flag +this revert for stable@ as well. + +Cc: +Fixes: eb0764b822b9 ("cxl/port: Enable the HDM decoder capability for switch ports") +Reviewed-by: Jonathan Cameron +Reviewed-by: Dave Jiang +Link: https://lore.kernel.org/r/168685882012.3475336.16733084892658264991.stgit@dwillia2-xfh.jf.intel.com +Signed-off-by: Dan Williams +Signed-off-by: Greg Kroah-Hartman +--- + drivers/cxl/core/pci.c | 27 ++++----------------------- + drivers/cxl/cxl.h | 1 - + drivers/cxl/port.c | 14 +++++--------- + tools/testing/cxl/Kbuild | 1 - + tools/testing/cxl/test/mock.c | 15 --------------- + 5 files changed, 9 insertions(+), 49 deletions(-) + +diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c +index 67f4ab6daa34..74962b18e3b2 100644 +--- a/drivers/cxl/core/pci.c ++++ b/drivers/cxl/core/pci.c +@@ -308,36 +308,17 @@ static void disable_hdm(void *_cxlhdm) + hdm + CXL_HDM_DECODER_CTRL_OFFSET); + } + +-int devm_cxl_enable_hdm(struct cxl_port *port, struct cxl_hdm *cxlhdm) ++static int devm_cxl_enable_hdm(struct device *host, struct cxl_hdm *cxlhdm) + { +- void __iomem *hdm; ++ void __iomem *hdm = cxlhdm->regs.hdm_decoder; + u32 global_ctrl; + +- /* +- * If the hdm capability was not mapped there is nothing to enable and +- * the caller is responsible for what happens next. For example, +- * emulate a passthrough decoder. +- */ +- if (IS_ERR(cxlhdm)) +- return 0; +- +- hdm = cxlhdm->regs.hdm_decoder; + global_ctrl = readl(hdm + CXL_HDM_DECODER_CTRL_OFFSET); +- +- /* +- * If the HDM decoder capability was enabled on entry, skip +- * registering disable_hdm() since this decode capability may be +- * owned by platform firmware. +- */ +- if (global_ctrl & CXL_HDM_DECODER_ENABLE) +- return 0; +- + writel(global_ctrl | CXL_HDM_DECODER_ENABLE, + hdm + CXL_HDM_DECODER_CTRL_OFFSET); + +- return devm_add_action_or_reset(&port->dev, disable_hdm, cxlhdm); ++ return devm_add_action_or_reset(host, disable_hdm, cxlhdm); + } +-EXPORT_SYMBOL_NS_GPL(devm_cxl_enable_hdm, CXL); + + int cxl_dvsec_rr_decode(struct device *dev, int d, + struct cxl_endpoint_dvsec_info *info) +@@ -511,7 +492,7 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm *cxlhdm, + if (info->mem_enabled) + return 0; + +- rc = devm_cxl_enable_hdm(port, cxlhdm); ++ rc = devm_cxl_enable_hdm(&port->dev, cxlhdm); + if (rc) + return rc; + +diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h +index f309b1387858..f0c428cb9a71 100644 +--- a/drivers/cxl/cxl.h ++++ b/drivers/cxl/cxl.h +@@ -710,7 +710,6 @@ struct cxl_endpoint_dvsec_info { + struct cxl_hdm; + struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port, + struct cxl_endpoint_dvsec_info *info); +-int devm_cxl_enable_hdm(struct cxl_port *port, struct cxl_hdm *cxlhdm); + int devm_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm, + struct cxl_endpoint_dvsec_info *info); + int devm_cxl_add_passthrough_decoder(struct cxl_port *port); +diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c +index c23b6164e1c0..07c5ac598da1 100644 +--- a/drivers/cxl/port.c ++++ b/drivers/cxl/port.c +@@ -60,17 +60,13 @@ static int discover_region(struct device *dev, void *root) + static int cxl_switch_port_probe(struct cxl_port *port) + { + struct cxl_hdm *cxlhdm; +- int rc, nr_dports; +- +- nr_dports = devm_cxl_port_enumerate_dports(port); +- if (nr_dports < 0) +- return nr_dports; ++ int rc; + +- cxlhdm = devm_cxl_setup_hdm(port, NULL); +- rc = devm_cxl_enable_hdm(port, cxlhdm); +- if (rc) ++ rc = devm_cxl_port_enumerate_dports(port); ++ if (rc < 0) + return rc; + ++ cxlhdm = devm_cxl_setup_hdm(port, NULL); + if (!IS_ERR(cxlhdm)) + return devm_cxl_enumerate_decoders(cxlhdm, NULL); + +@@ -79,7 +75,7 @@ static int cxl_switch_port_probe(struct cxl_port *port) + return PTR_ERR(cxlhdm); + } + +- if (nr_dports == 1) { ++ if (rc == 1) { + dev_dbg(&port->dev, "Fallback to passthrough decoder\n"); + return devm_cxl_add_passthrough_decoder(port); + } +diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild +index 6f9347ade82c..fba7bec96acd 100644 +--- a/tools/testing/cxl/Kbuild ++++ b/tools/testing/cxl/Kbuild +@@ -6,7 +6,6 @@ ldflags-y += --wrap=acpi_pci_find_root + ldflags-y += --wrap=nvdimm_bus_register + ldflags-y += --wrap=devm_cxl_port_enumerate_dports + ldflags-y += --wrap=devm_cxl_setup_hdm +-ldflags-y += --wrap=devm_cxl_enable_hdm + ldflags-y += --wrap=devm_cxl_add_passthrough_decoder + ldflags-y += --wrap=devm_cxl_enumerate_decoders + ldflags-y += --wrap=cxl_await_media_ready +diff --git a/tools/testing/cxl/test/mock.c b/tools/testing/cxl/test/mock.c +index 284416527644..de3933a776fd 100644 +--- a/tools/testing/cxl/test/mock.c ++++ b/tools/testing/cxl/test/mock.c +@@ -149,21 +149,6 @@ struct cxl_hdm *__wrap_devm_cxl_setup_hdm(struct cxl_port *port, + } + EXPORT_SYMBOL_NS_GPL(__wrap_devm_cxl_setup_hdm, CXL); + +-int __wrap_devm_cxl_enable_hdm(struct cxl_port *port, struct cxl_hdm *cxlhdm) +-{ +- int index, rc; +- struct cxl_mock_ops *ops = get_cxl_mock_ops(&index); +- +- if (ops && ops->is_mock_port(port->uport)) +- rc = 0; +- else +- rc = devm_cxl_enable_hdm(port, cxlhdm); +- put_cxl_mock_ops(index); +- +- return rc; +-} +-EXPORT_SYMBOL_NS_GPL(__wrap_devm_cxl_enable_hdm, CXL); +- + int __wrap_devm_cxl_add_passthrough_decoder(struct cxl_port *port) + { + int rc, index; +-- +2.41.0 + diff --git a/queue-6.3/scripts-tags.sh-resolve-gtags-empty-index-generation.patch b/queue-6.3/scripts-tags.sh-resolve-gtags-empty-index-generation.patch new file mode 100644 index 00000000000..c55dedd0a04 --- /dev/null +++ b/queue-6.3/scripts-tags.sh-resolve-gtags-empty-index-generation.patch @@ -0,0 +1,65 @@ +From e1b37563caffc410bb4b55f153ccb14dede66815 Mon Sep 17 00:00:00 2001 +From: "Ahmed S. Darwish" +Date: Mon, 15 May 2023 19:32:16 +0200 +Subject: scripts/tags.sh: Resolve gtags empty index generation + +From: Ahmed S. Darwish + +commit e1b37563caffc410bb4b55f153ccb14dede66815 upstream. + +gtags considers any file outside of its current working directory +"outside the source tree" and refuses to index it. For O= kernel builds, +or when "make" is invoked from a directory other then the kernel source +tree, gtags ignores the entire kernel source and generates an empty +index. + +Force-set gtags current working directory to the kernel source tree. + +Due to commit 9da0763bdd82 ("kbuild: Use relative path when building in +a subdir of the source tree"), if the kernel build is done in a +sub-directory of the kernel source tree, the kernel Makefile will set +the kernel's $srctree to ".." for shorter compile-time and run-time +warnings. Consequently, the list of files to be indexed will be in the +"../*" form, rendering all such paths invalid once gtags switches to the +kernel source tree as its current working directory. + +If gtags indexing is requested and the build directory is not the kernel +source tree, index all files in absolute-path form. + +Note, indexing in absolute-path form will not affect the generated +index, as paths in gtags indices are always relative to the gtags "root +directory" anyway (as evidenced by "gtags --dump"). + +Signed-off-by: Ahmed S. Darwish +Cc: +Signed-off-by: Masahiro Yamada +Signed-off-by: Greg Kroah-Hartman +--- + scripts/tags.sh | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/scripts/tags.sh ++++ b/scripts/tags.sh +@@ -32,6 +32,13 @@ else + tree=${srctree}/ + fi + ++# gtags(1) refuses to index any file outside of its current working dir. ++# If gtags indexing is requested and the build output directory is not ++# the kernel source tree, index all files in absolute-path form. ++if [[ "$1" == "gtags" && -n "${tree}" ]]; then ++ tree=$(realpath "$tree")/ ++fi ++ + # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH + if [ "${ALLSOURCE_ARCHS}" = "" ]; then + ALLSOURCE_ARCHS=${SRCARCH} +@@ -131,7 +138,7 @@ docscope() + + dogtags() + { +- all_target_sources | gtags -i -f - ++ all_target_sources | gtags -i -C "${tree:-.}" -f - "$PWD" + } + + # Basic regular expressions with an optional /kind-spec/ for ctags and diff --git a/queue-6.3/series b/queue-6.3/series index 990e2370aed..134ff7e7ea3 100644 --- a/queue-6.3/series +++ b/queue-6.3/series @@ -3,3 +3,11 @@ drm-amd-display-do-not-update-drr-while-bw-optimizations-pending.patch pci-acpi-validate-acpi_pci_set_power_state-parameter.patch pci-acpi-call-_reg-when-transitioning-d-states.patch execve-always-mark-stack-as-growing-down-during-early-stack-setup.patch +nfs-don-t-report-statx_btime-in-getattr.patch +revert-cxl-port-enable-the-hdm-decoder-capability-for-switch-ports.patch +nubus-partially-revert-proc_create_single_data-conversion.patch +hugetlb-revert-use-of-page_cache_next_miss.patch +scripts-tags.sh-resolve-gtags-empty-index-generation.patch +docs-set-minimal-gtags-gnu-global-version-to-6.6.5.patch +dm-ioctl-avoid-double-fetch-of-version.patch +drm-amdgpu-validate-vm-ioctl-flags.patch