From: Greg Kroah-Hartman Date: Tue, 20 May 2025 11:44:23 +0000 (+0200) Subject: drop some 6.12 patches that were not needed X-Git-Tag: v5.15.184~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22b7444c4a27a360c9886eabb5a76ddd8e1e758e;p=thirdparty%2Fkernel%2Fstable-queue.git drop some 6.12 patches that were not needed --- diff --git a/queue-6.12/nvmem-core-calculate-bin_attribute-size-through-bin_.patch b/queue-6.12/nvmem-core-calculate-bin_attribute-size-through-bin_.patch deleted file mode 100644 index e9807766aa..0000000000 --- a/queue-6.12/nvmem-core-calculate-bin_attribute-size-through-bin_.patch +++ /dev/null @@ -1,62 +0,0 @@ -From cb126f4a1336cec586d6ed31748ad6e8c84bffcb Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 3 Nov 2024 17:03:33 +0000 -Subject: nvmem: core: calculate bin_attribute size through bin_size() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Thomas Weißschuh - -[ Upstream commit 00ab6e97de0071b21a548e0a823348b3309970ba ] - -Stop abusing the is_bin_visible() callback to calculate the attribute -size. Instead use the new, dedicated bin_size() one. - -Signed-off-by: Thomas Weißschuh -Acked-by: Krzysztof Wilczyński -Link: https://lore.kernel.org/r/20241103-sysfs-const-bin_attr-v2-4-71110628844c@weissschuh.net -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f31fe8165d36 ("uio_hv_generic: Fix sysfs creation path for ring buffer") -Signed-off-by: Sasha Levin ---- - drivers/nvmem/core.c | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c -index d00a3b015635c..e4775938b9d40 100644 ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -303,11 +303,19 @@ static umode_t nvmem_bin_attr_is_visible(struct kobject *kobj, - struct device *dev = kobj_to_dev(kobj); - struct nvmem_device *nvmem = to_nvmem_device(dev); - -- attr->size = nvmem->size; -- - return nvmem_bin_attr_get_umode(nvmem); - } - -+static size_t nvmem_bin_attr_size(struct kobject *kobj, -+ const struct bin_attribute *attr, -+ int i) -+{ -+ struct device *dev = kobj_to_dev(kobj); -+ struct nvmem_device *nvmem = to_nvmem_device(dev); -+ -+ return nvmem->size; -+} -+ - static umode_t nvmem_attr_is_visible(struct kobject *kobj, - struct attribute *attr, int i) - { -@@ -383,6 +391,7 @@ static const struct attribute_group nvmem_bin_group = { - .bin_attrs = nvmem_bin_attributes, - .attrs = nvmem_attrs, - .is_bin_visible = nvmem_bin_attr_is_visible, -+ .bin_size = nvmem_bin_attr_size, - .is_visible = nvmem_attr_is_visible, - }; - --- -2.39.5 - diff --git a/queue-6.12/pci-sysfs-calculate-bin_attribute-size-through-bin_s.patch b/queue-6.12/pci-sysfs-calculate-bin_attribute-size-through-bin_s.patch deleted file mode 100644 index b74bdb698b..0000000000 --- a/queue-6.12/pci-sysfs-calculate-bin_attribute-size-through-bin_s.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 393313393982448da3f49f75d27c513a876737bc Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 3 Nov 2024 17:03:32 +0000 -Subject: PCI/sysfs: Calculate bin_attribute size through bin_size() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Thomas Weißschuh - -[ Upstream commit a1ab720ee50686d9e9dcb6935995a75696ed2493 ] - -Stop abusing the is_bin_visible() callback to calculate the attribute -size. Instead use the new, dedicated bin_size() one. - -Signed-off-by: Thomas Weißschuh -Acked-by: Krzysztof Wilczyński -Link: https://lore.kernel.org/r/20241103-sysfs-const-bin_attr-v2-3-71110628844c@weissschuh.net -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f31fe8165d36 ("uio_hv_generic: Fix sysfs creation path for ring buffer") -Signed-off-by: Sasha Levin ---- - drivers/pci/pci-sysfs.c | 28 ++++++++++++++++------------ - 1 file changed, 16 insertions(+), 12 deletions(-) - -diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c -index 5af4a804a4f89..f62402bafc19b 100644 ---- a/drivers/pci/pci-sysfs.c -+++ b/drivers/pci/pci-sysfs.c -@@ -844,21 +844,20 @@ static struct bin_attribute *pci_dev_config_attrs[] = { - NULL, - }; - --static umode_t pci_dev_config_attr_is_visible(struct kobject *kobj, -- struct bin_attribute *a, int n) -+static size_t pci_dev_config_attr_bin_size(struct kobject *kobj, -+ const struct bin_attribute *a, -+ int n) - { - struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); - -- a->size = PCI_CFG_SPACE_SIZE; - if (pdev->cfg_size > PCI_CFG_SPACE_SIZE) -- a->size = PCI_CFG_SPACE_EXP_SIZE; -- -- return a->attr.mode; -+ return PCI_CFG_SPACE_EXP_SIZE; -+ return PCI_CFG_SPACE_SIZE; - } - - static const struct attribute_group pci_dev_config_attr_group = { - .bin_attrs = pci_dev_config_attrs, -- .is_bin_visible = pci_dev_config_attr_is_visible, -+ .bin_size = pci_dev_config_attr_bin_size, - }; - - /* -@@ -1356,21 +1355,26 @@ static umode_t pci_dev_rom_attr_is_visible(struct kobject *kobj, - struct bin_attribute *a, int n) - { - struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); -- size_t rom_size; - - /* If the device has a ROM, try to expose it in sysfs. */ -- rom_size = pci_resource_len(pdev, PCI_ROM_RESOURCE); -- if (!rom_size) -+ if (!pci_resource_end(pdev, PCI_ROM_RESOURCE)) - return 0; - -- a->size = rom_size; -- - return a->attr.mode; - } - -+static size_t pci_dev_rom_attr_bin_size(struct kobject *kobj, -+ const struct bin_attribute *a, int n) -+{ -+ struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); -+ -+ return pci_resource_len(pdev, PCI_ROM_RESOURCE); -+} -+ - static const struct attribute_group pci_dev_rom_attr_group = { - .bin_attrs = pci_dev_rom_attrs, - .is_bin_visible = pci_dev_rom_attr_is_visible, -+ .bin_size = pci_dev_rom_attr_bin_size, - }; - - static ssize_t reset_store(struct device *dev, struct device_attribute *attr, --- -2.39.5 - diff --git a/queue-6.12/series b/queue-6.12/series index dee969eda2..010773f122 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -10,12 +10,6 @@ arm64-dts-imx8mp-var-som-fix-ldo5-shutdown-causing-s.patch cgroup-cpuset-extend-kthread_is_per_cpu-check-to-all.patch tracing-probes-fix-a-possible-race-in-trace_probe_lo.patch tpm-tis-double-the-timeout-b-to-4s.patch -sysfs-explicitly-pass-size-to-sysfs_add_bin_file_mod.patch -sysfs-introduce-callback-attribute_group-bin_size.patch -pci-sysfs-calculate-bin_attribute-size-through-bin_s.patch -nvmem-core-calculate-bin_attribute-size-through-bin_.patch -sysfs-treewide-constify-attribute-callback-of-bin_is.patch -sysfs-treewide-constify-attribute-callback-of-bin_at.patch uio_hv_generic-fix-sysfs-creation-path-for-ring-buff.patch kvm-add-member-to-struct-kvm_gfn_range-to-indicate-p.patch kvm-x86-mmu-prevent-installing-hugepages-when-mem-at.patch diff --git a/queue-6.12/sysfs-explicitly-pass-size-to-sysfs_add_bin_file_mod.patch b/queue-6.12/sysfs-explicitly-pass-size-to-sysfs_add_bin_file_mod.patch deleted file mode 100644 index dce58757ff..0000000000 --- a/queue-6.12/sysfs-explicitly-pass-size-to-sysfs_add_bin_file_mod.patch +++ /dev/null @@ -1,99 +0,0 @@ -From a306c38bd23f3a59dbc618fc44a3a8ccb430185b Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 3 Nov 2024 17:03:30 +0000 -Subject: sysfs: explicitly pass size to sysfs_add_bin_file_mode_ns() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Thomas Weißschuh - -[ Upstream commit 0afcee132bbc9d7ef9c5bb4da9b6fe014a9afaa9 ] - -Upcoming changes to the sysfs core require the size of the created file -to be overridable by the caller. -Add a parameter to enable this. -For now keep using attr->size in all cases. - -Signed-off-by: Thomas Weißschuh -Acked-by: Krzysztof Wilczyński -Link: https://lore.kernel.org/r/20241103-sysfs-const-bin_attr-v2-1-71110628844c@weissschuh.net -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f31fe8165d36 ("uio_hv_generic: Fix sysfs creation path for ring buffer") -Signed-off-by: Sasha Levin ---- - fs/sysfs/file.c | 8 ++++---- - fs/sysfs/group.c | 3 ++- - fs/sysfs/sysfs.h | 2 +- - 3 files changed, 7 insertions(+), 6 deletions(-) - -diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c -index d1995e2d6c943..6d39696b43069 100644 ---- a/fs/sysfs/file.c -+++ b/fs/sysfs/file.c -@@ -315,7 +315,7 @@ int sysfs_add_file_mode_ns(struct kernfs_node *parent, - } - - int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent, -- const struct bin_attribute *battr, umode_t mode, -+ const struct bin_attribute *battr, umode_t mode, size_t size, - kuid_t uid, kgid_t gid, const void *ns) - { - const struct attribute *attr = &battr->attr; -@@ -340,7 +340,7 @@ int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent, - #endif - - kn = __kernfs_create_file(parent, attr->name, mode & 0777, uid, gid, -- battr->size, ops, (void *)attr, ns, key); -+ size, ops, (void *)attr, ns, key); - if (IS_ERR(kn)) { - if (PTR_ERR(kn) == -EEXIST) - sysfs_warn_dup(parent, attr->name); -@@ -580,8 +580,8 @@ int sysfs_create_bin_file(struct kobject *kobj, - return -EINVAL; - - kobject_get_ownership(kobj, &uid, &gid); -- return sysfs_add_bin_file_mode_ns(kobj->sd, attr, attr->attr.mode, uid, -- gid, NULL); -+ return sysfs_add_bin_file_mode_ns(kobj->sd, attr, attr->attr.mode, -+ attr->size, uid, gid, NULL); - } - EXPORT_SYMBOL_GPL(sysfs_create_bin_file); - -diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c -index d22ad67a0f329..45b2e92941da1 100644 ---- a/fs/sysfs/group.c -+++ b/fs/sysfs/group.c -@@ -87,6 +87,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, - if (grp->bin_attrs) { - for (i = 0, bin_attr = grp->bin_attrs; *bin_attr; i++, bin_attr++) { - umode_t mode = (*bin_attr)->attr.mode; -+ size_t size = (*bin_attr)->size; - - if (update) - kernfs_remove_by_name(parent, -@@ -104,7 +105,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, - - mode &= SYSFS_PREALLOC | 0664; - error = sysfs_add_bin_file_mode_ns(parent, *bin_attr, -- mode, uid, gid, -+ mode, size, uid, gid, - NULL); - if (error) - break; -diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h -index 3f28c9af57562..8e012f25e1c06 100644 ---- a/fs/sysfs/sysfs.h -+++ b/fs/sysfs/sysfs.h -@@ -31,7 +31,7 @@ int sysfs_add_file_mode_ns(struct kernfs_node *parent, - const struct attribute *attr, umode_t amode, kuid_t uid, - kgid_t gid, const void *ns); - int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent, -- const struct bin_attribute *battr, umode_t mode, -+ const struct bin_attribute *battr, umode_t mode, size_t size, - kuid_t uid, kgid_t gid, const void *ns); - - /* --- -2.39.5 - diff --git a/queue-6.12/sysfs-introduce-callback-attribute_group-bin_size.patch b/queue-6.12/sysfs-introduce-callback-attribute_group-bin_size.patch deleted file mode 100644 index 8dfaab034f..0000000000 --- a/queue-6.12/sysfs-introduce-callback-attribute_group-bin_size.patch +++ /dev/null @@ -1,78 +0,0 @@ -From f0551860dbe3ab315f1bfcff207a7359c8d905ea Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 3 Nov 2024 17:03:31 +0000 -Subject: sysfs: introduce callback attribute_group::bin_size -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Thomas Weißschuh - -[ Upstream commit bebf29b18f34620e25f7e2bd9e4e4d8e34a8977d ] - -Several drivers need to dynamically calculate the size of an binary -attribute. Currently this is done by assigning attr->size from the -is_bin_visible() callback. - -This has drawbacks: -* It is not documented. -* A single attribute can be instantiated multiple times, overwriting the - shared size field. -* It prevents the structure to be moved to read-only memory. - -Introduce a new dedicated callback to calculate the size of the -attribute. - -Signed-off-by: Thomas Weißschuh -Acked-by: Krzysztof Wilczyński -Link: https://lore.kernel.org/r/20241103-sysfs-const-bin_attr-v2-2-71110628844c@weissschuh.net -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f31fe8165d36 ("uio_hv_generic: Fix sysfs creation path for ring buffer") -Signed-off-by: Sasha Levin ---- - fs/sysfs/group.c | 2 ++ - include/linux/sysfs.h | 8 ++++++++ - 2 files changed, 10 insertions(+) - -diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c -index 45b2e92941da1..8b01a7eda5fb3 100644 ---- a/fs/sysfs/group.c -+++ b/fs/sysfs/group.c -@@ -98,6 +98,8 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, - if (!mode) - continue; - } -+ if (grp->bin_size) -+ size = grp->bin_size(kobj, *bin_attr, i); - - WARN(mode & ~(SYSFS_PREALLOC | 0664), - "Attribute %s: Invalid permissions 0%o\n", -diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h -index c4e64dc112063..4746cccb95898 100644 ---- a/include/linux/sysfs.h -+++ b/include/linux/sysfs.h -@@ -87,6 +87,11 @@ do { \ - * SYSFS_GROUP_VISIBLE() when assigning this callback to - * specify separate _group_visible() and _attr_visible() - * handlers. -+ * @bin_size: -+ * Optional: Function to return the size of a binary attribute -+ * of the group. Will be called repeatedly for each binary -+ * attribute in the group. Overwrites the size field embedded -+ * inside the attribute itself. - * @attrs: Pointer to NULL terminated list of attributes. - * @bin_attrs: Pointer to NULL terminated list of binary attributes. - * Either attrs or bin_attrs or both must be provided. -@@ -97,6 +102,9 @@ struct attribute_group { - struct attribute *, int); - umode_t (*is_bin_visible)(struct kobject *, - struct bin_attribute *, int); -+ size_t (*bin_size)(struct kobject *, -+ const struct bin_attribute *, -+ int); - struct attribute **attrs; - struct bin_attribute **bin_attrs; - }; --- -2.39.5 - diff --git a/queue-6.12/sysfs-treewide-constify-attribute-callback-of-bin_at.patch b/queue-6.12/sysfs-treewide-constify-attribute-callback-of-bin_at.patch deleted file mode 100644 index bac5fd18eb..0000000000 --- a/queue-6.12/sysfs-treewide-constify-attribute-callback-of-bin_at.patch +++ /dev/null @@ -1,196 +0,0 @@ -From b5282192aedfc2ea9b70a72626474c5d9fb8a422 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 3 Nov 2024 17:03:35 +0000 -Subject: sysfs: treewide: constify attribute callback of bin_attribute::mmap() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Thomas Weißschuh - -[ Upstream commit 94a20fb9af16417ab5fd17bcde3d906926f15ef6 ] - -The mmap() callbacks should not modify the struct -bin_attribute passed as argument. -Enforce this by marking the argument as const. - -As there are not many callback implementers perform this change -throughout the tree at once. - -Signed-off-by: Thomas Weißschuh -Acked-by: Andrew Donnellan # ocxl -Acked-by: Krzysztof Wilczyński -Link: https://lore.kernel.org/r/20241103-sysfs-const-bin_attr-v2-6-71110628844c@weissschuh.net -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f31fe8165d36 ("uio_hv_generic: Fix sysfs creation path for ring buffer") -Signed-off-by: Sasha Levin ---- - arch/alpha/kernel/pci-sysfs.c | 6 +++--- - drivers/cdx/cdx.c | 2 +- - drivers/misc/ocxl/sysfs.c | 2 +- - drivers/pci/p2pdma.c | 2 +- - drivers/pci/pci-sysfs.c | 10 +++++----- - drivers/platform/x86/intel/pmt/class.c | 2 +- - drivers/uio/uio_hv_generic.c | 2 +- - include/linux/sysfs.h | 2 +- - 8 files changed, 14 insertions(+), 14 deletions(-) - -diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c -index 5808a66e2a81f..3048758304b57 100644 ---- a/arch/alpha/kernel/pci-sysfs.c -+++ b/arch/alpha/kernel/pci-sysfs.c -@@ -64,7 +64,7 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num, - * Return: %0 on success, negative error code otherwise - */ - static int pci_mmap_resource(struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma, int sparse) - { - struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); -@@ -93,14 +93,14 @@ static int pci_mmap_resource(struct kobject *kobj, - } - - static int pci_mmap_resource_sparse(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma) - { - return pci_mmap_resource(kobj, attr, vma, 1); - } - - static int pci_mmap_resource_dense(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma) - { - return pci_mmap_resource(kobj, attr, vma, 0); -diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c -index 4af1901c9d524..8228b0d91629a 100644 ---- a/drivers/cdx/cdx.c -+++ b/drivers/cdx/cdx.c -@@ -711,7 +711,7 @@ static const struct vm_operations_struct cdx_phys_vm_ops = { - * Return: true on success, false otherwise. - */ - static int cdx_mmap_resource(struct file *fp, struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma) - { - struct cdx_device *cdx_dev = to_cdx_device(kobj_to_dev(kobj)); -diff --git a/drivers/misc/ocxl/sysfs.c b/drivers/misc/ocxl/sysfs.c -index 405180d47d9bf..07520d6e6dc55 100644 ---- a/drivers/misc/ocxl/sysfs.c -+++ b/drivers/misc/ocxl/sysfs.c -@@ -125,7 +125,7 @@ static const struct vm_operations_struct global_mmio_vmops = { - }; - - static int global_mmio_mmap(struct file *filp, struct kobject *kobj, -- struct bin_attribute *bin_attr, -+ const struct bin_attribute *bin_attr, - struct vm_area_struct *vma) - { - struct ocxl_afu *afu = to_afu(kobj_to_dev(kobj)); -diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c -index 4f47a13cb500f..7abd4f546d3c0 100644 ---- a/drivers/pci/p2pdma.c -+++ b/drivers/pci/p2pdma.c -@@ -90,7 +90,7 @@ static ssize_t published_show(struct device *dev, struct device_attribute *attr, - static DEVICE_ATTR_RO(published); - - static int p2pmem_alloc_mmap(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, struct vm_area_struct *vma) -+ const struct bin_attribute *attr, struct vm_area_struct *vma) - { - struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); - size_t len = vma->vm_end - vma->vm_start; -diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c -index c5725f5185620..f31eb80c1c38b 100644 ---- a/drivers/pci/pci-sysfs.c -+++ b/drivers/pci/pci-sysfs.c -@@ -936,7 +936,7 @@ static ssize_t pci_write_legacy_io(struct file *filp, struct kobject *kobj, - * memory space. - */ - static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma) - { - struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj)); -@@ -956,7 +956,7 @@ static int pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj, - * memory space. Returns -ENOSYS if the operation isn't supported - */ - static int pci_mmap_legacy_io(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma) - { - struct pci_bus *bus = to_pci_bus(kobj_to_dev(kobj)); -@@ -1060,7 +1060,7 @@ void pci_remove_legacy_files(struct pci_bus *b) - * - * Use the regular PCI mapping routines to map a PCI resource into userspace. - */ --static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, -+static int pci_mmap_resource(struct kobject *kobj, const struct bin_attribute *attr, - struct vm_area_struct *vma, int write_combine) - { - struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); -@@ -1085,14 +1085,14 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, - } - - static int pci_mmap_resource_uc(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma) - { - return pci_mmap_resource(kobj, attr, vma, 0); - } - - static int pci_mmap_resource_wc(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma) - { - return pci_mmap_resource(kobj, attr, vma, 1); -diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c -index c3ca2ac91b056..4cd46323001e0 100644 ---- a/drivers/platform/x86/intel/pmt/class.c -+++ b/drivers/platform/x86/intel/pmt/class.c -@@ -105,7 +105,7 @@ intel_pmt_read(struct file *filp, struct kobject *kobj, - - static int - intel_pmt_mmap(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, struct vm_area_struct *vma) -+ const struct bin_attribute *attr, struct vm_area_struct *vma) - { - struct intel_pmt_entry *entry = container_of(attr, - struct intel_pmt_entry, -diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c -index 8704095994118..3976360d0096d 100644 ---- a/drivers/uio/uio_hv_generic.c -+++ b/drivers/uio/uio_hv_generic.c -@@ -135,7 +135,7 @@ static void hv_uio_rescind(struct vmbus_channel *channel) - * The ring buffer is allocated as contiguous memory by vmbus_open - */ - static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - struct vm_area_struct *vma) - { - struct vmbus_channel *channel -diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h -index d1b22d56198b5..9fcdc8cd3118f 100644 ---- a/include/linux/sysfs.h -+++ b/include/linux/sysfs.h -@@ -309,7 +309,7 @@ struct bin_attribute { - char *, loff_t, size_t); - loff_t (*llseek)(struct file *, struct kobject *, struct bin_attribute *, - loff_t, int); -- int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, -+ int (*mmap)(struct file *, struct kobject *, const struct bin_attribute *attr, - struct vm_area_struct *vma); - }; - --- -2.39.5 - diff --git a/queue-6.12/sysfs-treewide-constify-attribute-callback-of-bin_is.patch b/queue-6.12/sysfs-treewide-constify-attribute-callback-of-bin_is.patch deleted file mode 100644 index 59687e1760..0000000000 --- a/queue-6.12/sysfs-treewide-constify-attribute-callback-of-bin_is.patch +++ /dev/null @@ -1,240 +0,0 @@ -From b1f4c72ffbd27e7d32208270d27af0e8a43de265 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Sun, 3 Nov 2024 17:03:34 +0000 -Subject: sysfs: treewide: constify attribute callback of bin_is_visible() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Thomas Weißschuh - -[ Upstream commit b626816fdd7f9beb841856ba049396cff46e99aa ] - -The is_bin_visible() callbacks should not modify the struct -bin_attribute passed as argument. -Enforce this by marking the argument as const. - -As there are not many callback implementers perform this change -throughout the tree at once. - -Signed-off-by: Thomas Weißschuh -Acked-by: Martin K. Petersen -Acked-by: Jason Gunthorpe -Acked-by: Ira Weiny -Acked-by: Krzysztof Wilczyński -Link: https://lore.kernel.org/r/20241103-sysfs-const-bin_attr-v2-5-71110628844c@weissschuh.net -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: f31fe8165d36 ("uio_hv_generic: Fix sysfs creation path for ring buffer") -Signed-off-by: Sasha Levin ---- - drivers/cxl/port.c | 2 +- - drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +- - drivers/infiniband/hw/qib/qib_sysfs.c | 2 +- - drivers/mtd/spi-nor/sysfs.c | 2 +- - drivers/nvmem/core.c | 3 ++- - drivers/pci/pci-sysfs.c | 2 +- - drivers/pci/vpd.c | 2 +- - drivers/platform/x86/amd/hsmp.c | 2 +- - drivers/platform/x86/intel/sdsi.c | 2 +- - drivers/scsi/scsi_sysfs.c | 2 +- - drivers/usb/core/sysfs.c | 2 +- - include/linux/sysfs.h | 30 ++++++++++++------------- - 12 files changed, 27 insertions(+), 26 deletions(-) - -diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c -index 9dc394295e1fc..24041cf85cfbe 100644 ---- a/drivers/cxl/port.c -+++ b/drivers/cxl/port.c -@@ -173,7 +173,7 @@ static ssize_t CDAT_read(struct file *filp, struct kobject *kobj, - static BIN_ATTR_ADMIN_RO(CDAT, 0); - - static umode_t cxl_port_bin_attr_is_visible(struct kobject *kobj, -- struct bin_attribute *attr, int i) -+ const struct bin_attribute *attr, int i) - { - struct device *dev = kobj_to_dev(kobj); - struct cxl_port *port = to_cxl_port(dev); -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c -index d70855d7c61c1..3c8ef0cb5e567 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c -@@ -4000,7 +4000,7 @@ static umode_t amdgpu_flash_attr_is_visible(struct kobject *kobj, struct attribu - } - - static umode_t amdgpu_bin_flash_attr_is_visible(struct kobject *kobj, -- struct bin_attribute *attr, -+ const struct bin_attribute *attr, - int idx) - { - struct device *dev = kobj_to_dev(kobj); -diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c -index 53ec7510e4ebf..ba2cd68b53e6c 100644 ---- a/drivers/infiniband/hw/qib/qib_sysfs.c -+++ b/drivers/infiniband/hw/qib/qib_sysfs.c -@@ -283,7 +283,7 @@ static struct bin_attribute *port_ccmgta_attributes[] = { - }; - - static umode_t qib_ccmgta_is_bin_visible(struct kobject *kobj, -- struct bin_attribute *attr, int n) -+ const struct bin_attribute *attr, int n) - { - struct qib_pportdata *ppd = qib_get_pportdata_kobj(kobj); - -diff --git a/drivers/mtd/spi-nor/sysfs.c b/drivers/mtd/spi-nor/sysfs.c -index 96064e4babf01..5e9eb268073d1 100644 ---- a/drivers/mtd/spi-nor/sysfs.c -+++ b/drivers/mtd/spi-nor/sysfs.c -@@ -87,7 +87,7 @@ static umode_t spi_nor_sysfs_is_visible(struct kobject *kobj, - } - - static umode_t spi_nor_sysfs_is_bin_visible(struct kobject *kobj, -- struct bin_attribute *attr, int n) -+ const struct bin_attribute *attr, int n) - { - struct spi_device *spi = to_spi_device(kobj_to_dev(kobj)); - struct spi_mem *spimem = spi_get_drvdata(spi); -diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c -index e4775938b9d40..026c0bfdad268 100644 ---- a/drivers/nvmem/core.c -+++ b/drivers/nvmem/core.c -@@ -298,7 +298,8 @@ static umode_t nvmem_bin_attr_get_umode(struct nvmem_device *nvmem) - } - - static umode_t nvmem_bin_attr_is_visible(struct kobject *kobj, -- struct bin_attribute *attr, int i) -+ const struct bin_attribute *attr, -+ int i) - { - struct device *dev = kobj_to_dev(kobj); - struct nvmem_device *nvmem = to_nvmem_device(dev); -diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c -index f62402bafc19b..c5725f5185620 100644 ---- a/drivers/pci/pci-sysfs.c -+++ b/drivers/pci/pci-sysfs.c -@@ -1352,7 +1352,7 @@ static struct bin_attribute *pci_dev_rom_attrs[] = { - }; - - static umode_t pci_dev_rom_attr_is_visible(struct kobject *kobj, -- struct bin_attribute *a, int n) -+ const struct bin_attribute *a, int n) - { - struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); - -diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c -index e4300f5f304f3..a469bcbc0da7f 100644 ---- a/drivers/pci/vpd.c -+++ b/drivers/pci/vpd.c -@@ -325,7 +325,7 @@ static struct bin_attribute *vpd_attrs[] = { - }; - - static umode_t vpd_attr_is_visible(struct kobject *kobj, -- struct bin_attribute *a, int n) -+ const struct bin_attribute *a, int n) - { - struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); - -diff --git a/drivers/platform/x86/amd/hsmp.c b/drivers/platform/x86/amd/hsmp.c -index 8fcf38eed7f00..8f00850c139fa 100644 ---- a/drivers/platform/x86/amd/hsmp.c -+++ b/drivers/platform/x86/amd/hsmp.c -@@ -620,7 +620,7 @@ static int hsmp_get_tbl_dram_base(u16 sock_ind) - } - - static umode_t hsmp_is_sock_attr_visible(struct kobject *kobj, -- struct bin_attribute *battr, int id) -+ const struct bin_attribute *battr, int id) - { - if (plat_dev.proto_ver == HSMP_PROTO_VER6) - return battr->attr.mode; -diff --git a/drivers/platform/x86/intel/sdsi.c b/drivers/platform/x86/intel/sdsi.c -index 9d137621f0e6e..33f33b1070fdc 100644 ---- a/drivers/platform/x86/intel/sdsi.c -+++ b/drivers/platform/x86/intel/sdsi.c -@@ -541,7 +541,7 @@ static struct bin_attribute *sdsi_bin_attrs[] = { - }; - - static umode_t --sdsi_battr_is_visible(struct kobject *kobj, struct bin_attribute *attr, int n) -+sdsi_battr_is_visible(struct kobject *kobj, const struct bin_attribute *attr, int n) - { - struct device *dev = kobj_to_dev(kobj); - struct sdsi_priv *priv = dev_get_drvdata(dev); -diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c -index 32f94db6d6bf5..f3a1ecb42128a 100644 ---- a/drivers/scsi/scsi_sysfs.c -+++ b/drivers/scsi/scsi_sysfs.c -@@ -1274,7 +1274,7 @@ static umode_t scsi_sdev_attr_is_visible(struct kobject *kobj, - } - - static umode_t scsi_sdev_bin_attr_is_visible(struct kobject *kobj, -- struct bin_attribute *attr, int i) -+ const struct bin_attribute *attr, int i) - { - struct device *dev = kobj_to_dev(kobj); - struct scsi_device *sdev = to_scsi_device(dev); -diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c -index 61b6d978892c7..b4cba23831acd 100644 ---- a/drivers/usb/core/sysfs.c -+++ b/drivers/usb/core/sysfs.c -@@ -925,7 +925,7 @@ static struct bin_attribute *dev_bin_attrs[] = { - }; - - static umode_t dev_bin_attrs_are_visible(struct kobject *kobj, -- struct bin_attribute *a, int n) -+ const struct bin_attribute *a, int n) - { - struct device *dev = kobj_to_dev(kobj); - struct usb_device *udev = to_usb_device(dev); -diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h -index 4746cccb95898..d1b22d56198b5 100644 ---- a/include/linux/sysfs.h -+++ b/include/linux/sysfs.h -@@ -101,7 +101,7 @@ struct attribute_group { - umode_t (*is_visible)(struct kobject *, - struct attribute *, int); - umode_t (*is_bin_visible)(struct kobject *, -- struct bin_attribute *, int); -+ const struct bin_attribute *, int); - size_t (*bin_size)(struct kobject *, - const struct bin_attribute *, - int); -@@ -199,22 +199,22 @@ struct attribute_group { - * attributes, the group visibility is determined by the function - * specified to is_visible() not is_bin_visible() - */ --#define DEFINE_SYSFS_BIN_GROUP_VISIBLE(name) \ -- static inline umode_t sysfs_group_visible_##name( \ -- struct kobject *kobj, struct bin_attribute *attr, int n) \ -- { \ -- if (n == 0 && !name##_group_visible(kobj)) \ -- return SYSFS_GROUP_INVISIBLE; \ -- return name##_attr_visible(kobj, attr, n); \ -+#define DEFINE_SYSFS_BIN_GROUP_VISIBLE(name) \ -+ static inline umode_t sysfs_group_visible_##name( \ -+ struct kobject *kobj, const struct bin_attribute *attr, int n) \ -+ { \ -+ if (n == 0 && !name##_group_visible(kobj)) \ -+ return SYSFS_GROUP_INVISIBLE; \ -+ return name##_attr_visible(kobj, attr, n); \ - } - --#define DEFINE_SIMPLE_SYSFS_BIN_GROUP_VISIBLE(name) \ -- static inline umode_t sysfs_group_visible_##name( \ -- struct kobject *kobj, struct bin_attribute *a, int n) \ -- { \ -- if (n == 0 && !name##_group_visible(kobj)) \ -- return SYSFS_GROUP_INVISIBLE; \ -- return a->mode; \ -+#define DEFINE_SIMPLE_SYSFS_BIN_GROUP_VISIBLE(name) \ -+ static inline umode_t sysfs_group_visible_##name( \ -+ struct kobject *kobj, const struct bin_attribute *a, int n) \ -+ { \ -+ if (n == 0 && !name##_group_visible(kobj)) \ -+ return SYSFS_GROUP_INVISIBLE; \ -+ return a->mode; \ - } - - #define SYSFS_GROUP_VISIBLE(fn) sysfs_group_visible_##fn --- -2.39.5 - diff --git a/queue-6.12/uio_hv_generic-fix-sysfs-creation-path-for-ring-buff.patch b/queue-6.12/uio_hv_generic-fix-sysfs-creation-path-for-ring-buff.patch index 90e770ffec..5debd3e17d 100644 --- a/queue-6.12/uio_hv_generic-fix-sysfs-creation-path-for-ring-buff.patch +++ b/queue-6.12/uio_hv_generic-fix-sysfs-creation-path-for-ring-buff.patch @@ -53,17 +53,15 @@ Link: https://lore.kernel.org/r/20250502074811.2022-2-namjain@linux.microsoft.co Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- - drivers/hv/hyperv_vmbus.h | 6 +++ - drivers/hv/vmbus_drv.c | 100 ++++++++++++++++++++++++++++++++++- - drivers/uio/uio_hv_generic.c | 39 ++++++-------- - include/linux/hyperv.h | 6 +++ + drivers/hv/hyperv_vmbus.h | 6 ++ + drivers/hv/vmbus_drv.c | 100 ++++++++++++++++++++++++++++++++++++++++++- + drivers/uio/uio_hv_generic.c | 39 +++++++--------- + include/linux/hyperv.h | 6 ++ 4 files changed, 128 insertions(+), 23 deletions(-) -diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h -index 52cb744b4d7fd..e4136cbaa4d40 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h -@@ -485,4 +485,10 @@ static inline int hv_debug_add_dev_dir(struct hv_device *dev) +@@ -485,4 +485,10 @@ static inline int hv_debug_add_dev_dir(s #endif /* CONFIG_HYPERV_TESTING */ @@ -74,16 +72,14 @@ index 52cb744b4d7fd..e4136cbaa4d40 100644 +int hv_remove_ring_sysfs(struct vmbus_channel *channel); + #endif /* _HYPERV_VMBUS_H */ -diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c -index 2b6749c9712ef..410df07ef983a 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c -@@ -1792,6 +1792,27 @@ static ssize_t subchannel_id_show(struct vmbus_channel *channel, +@@ -1792,6 +1792,27 @@ static ssize_t subchannel_id_show(struct } static VMBUS_CHAN_ATTR_RO(subchannel_id); +static int hv_mmap_ring_buffer_wrapper(struct file *filp, struct kobject *kobj, -+ const struct bin_attribute *attr, ++ struct bin_attribute *attr, + struct vm_area_struct *vma) +{ + struct vmbus_channel *channel = container_of(kobj, struct vmbus_channel, kobj); @@ -106,7 +102,7 @@ index 2b6749c9712ef..410df07ef983a 100644 static struct attribute *vmbus_chan_attrs[] = { &chan_attr_out_mask.attr, &chan_attr_in_mask.attr, -@@ -1811,6 +1832,11 @@ static struct attribute *vmbus_chan_attrs[] = { +@@ -1811,6 +1832,11 @@ static struct attribute *vmbus_chan_attr NULL }; @@ -118,12 +114,12 @@ index 2b6749c9712ef..410df07ef983a 100644 /* * Channel-level attribute_group callback function. Returns the permission for * each attribute, and returns 0 if an attribute is not visible. -@@ -1831,9 +1857,24 @@ static umode_t vmbus_chan_attr_is_visible(struct kobject *kobj, +@@ -1831,9 +1857,24 @@ static umode_t vmbus_chan_attr_is_visibl return attr->mode; } +static umode_t vmbus_chan_bin_attr_is_visible(struct kobject *kobj, -+ const struct bin_attribute *attr, int idx) ++ struct bin_attribute *attr, int idx) +{ + const struct vmbus_channel *channel = + container_of(kobj, struct vmbus_channel, kobj); @@ -144,7 +140,7 @@ index 2b6749c9712ef..410df07ef983a 100644 }; static const struct kobj_type vmbus_chan_ktype = { -@@ -1841,6 +1882,63 @@ static const struct kobj_type vmbus_chan_ktype = { +@@ -1841,6 +1882,63 @@ static const struct kobj_type vmbus_chan .release = vmbus_chan_release, }; @@ -208,11 +204,9 @@ index 2b6749c9712ef..410df07ef983a 100644 /* * vmbus_add_channel_kobj - setup a sub-directory under device/channels */ -diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c -index 3976360d0096d..c2759bbeed849 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c -@@ -131,15 +131,12 @@ static void hv_uio_rescind(struct vmbus_channel *channel) +@@ -131,15 +131,12 @@ static void hv_uio_rescind(struct vmbus_ vmbus_device_unregister(channel->device_obj); } @@ -221,7 +215,7 @@ index 3976360d0096d..c2759bbeed849 100644 * The ring buffer is allocated as contiguous memory by vmbus_open */ -static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj, -- const struct bin_attribute *attr, +- struct bin_attribute *attr, - struct vm_area_struct *vma) +static int +hv_uio_ring_mmap(struct vmbus_channel *channel, struct vm_area_struct *vma) @@ -231,7 +225,7 @@ index 3976360d0096d..c2759bbeed849 100644 void *ring_buffer = page_address(channel->ringbuffer_page); if (channel->state != CHANNEL_OPENED_STATE) -@@ -149,15 +146,6 @@ static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj, +@@ -149,15 +146,6 @@ static int hv_uio_ring_mmap(struct file channel->ringbuffer_pagecount << PAGE_SHIFT); } @@ -247,7 +241,7 @@ index 3976360d0096d..c2759bbeed849 100644 /* Callback from VMBUS subsystem when new channel created. */ static void hv_uio_new_channel(struct vmbus_channel *new_sc) -@@ -178,8 +166,7 @@ hv_uio_new_channel(struct vmbus_channel *new_sc) +@@ -178,8 +166,7 @@ hv_uio_new_channel(struct vmbus_channel /* Disable interrupts on sub channel */ new_sc->inbound.ring_buffer->interrupt_mask = 1; set_channel_read_mode(new_sc, HV_CALL_ISR); @@ -289,8 +283,6 @@ index 3976360d0096d..c2759bbeed849 100644 uio_unregister_device(&pdata->info); hv_uio_cleanup(dev, pdata); -diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h -index 02a226bcf0edc..6e331b7adfcd8 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1067,6 +1067,12 @@ struct vmbus_channel { @@ -306,6 +298,3 @@ index 02a226bcf0edc..6e331b7adfcd8 100644 }; #define lock_requestor(channel, flags) \ --- -2.39.5 -