mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
Merge 559089e0a9 ("vmalloc: replace VM_NO_HUGE_VMAP with VM_ALLOW_HUGE_VMAP") into android-mainline
Steps on the way to 5.18-rc4 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I899600bceae67e8146c42dfd62fb0bd45075e853
This commit is contained in:
@@ -854,10 +854,8 @@ config HAVE_ARCH_HUGE_VMAP
|
||||
|
||||
#
|
||||
# Archs that select this would be capable of PMD-sized vmaps (i.e.,
|
||||
# arch_vmap_pmd_supported() returns true), and they must make no assumptions
|
||||
# that vmalloc memory is mapped with PAGE_SIZE ptes. The VM_NO_HUGE_VMAP flag
|
||||
# can be used to prohibit arch-specific allocations from using hugepages to
|
||||
# help with this (e.g., modules may require it).
|
||||
# arch_vmap_pmd_supported() returns true). The VM_ALLOW_HUGE_VMAP flag
|
||||
# must be used to enable allocations to use hugepages.
|
||||
#
|
||||
config HAVE_ARCH_HUGE_VMALLOC
|
||||
depends on HAVE_ARCH_HUGE_VMAP
|
||||
|
||||
@@ -101,7 +101,7 @@ __module_alloc(unsigned long size, unsigned long start, unsigned long end, bool
|
||||
* too.
|
||||
*/
|
||||
return __vmalloc_node_range(size, 1, start, end, gfp, prot,
|
||||
VM_FLUSH_RESET_PERMS | VM_NO_HUGE_VMAP,
|
||||
VM_FLUSH_RESET_PERMS,
|
||||
NUMA_NO_NODE, __builtin_return_address(0));
|
||||
}
|
||||
|
||||
|
||||
@@ -137,12 +137,7 @@ static int kvm_s390_pv_alloc_vm(struct kvm *kvm)
|
||||
/* Allocate variable storage */
|
||||
vlen = ALIGN(virt * ((npages * PAGE_SIZE) / HPAGE_SIZE), PAGE_SIZE);
|
||||
vlen += uv_info.guest_virt_base_stor_len;
|
||||
/*
|
||||
* The Create Secure Configuration Ultravisor Call does not support
|
||||
* using large pages for the virtual memory area.
|
||||
* This is a hardware limitation.
|
||||
*/
|
||||
kvm->arch.pv.stor_var = vmalloc_no_huge(vlen);
|
||||
kvm->arch.pv.stor_var = vzalloc(vlen);
|
||||
if (!kvm->arch.pv.stor_var)
|
||||
goto out_err;
|
||||
return 0;
|
||||
|
||||
@@ -277,6 +277,9 @@ static int atmel_qspi_find_mode(const struct spi_mem_op *op)
|
||||
static bool atmel_qspi_supports_op(struct spi_mem *mem,
|
||||
const struct spi_mem_op *op)
|
||||
{
|
||||
if (!spi_mem_default_supports_op(mem, op))
|
||||
return false;
|
||||
|
||||
if (atmel_qspi_find_mode(op) < 0)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1415,9 +1415,24 @@ static bool cqspi_supports_mem_op(struct spi_mem *mem,
|
||||
all_false = !op->cmd.dtr && !op->addr.dtr && !op->dummy.dtr &&
|
||||
!op->data.dtr;
|
||||
|
||||
/* Mixed DTR modes not supported. */
|
||||
if (!(all_true || all_false))
|
||||
if (all_true) {
|
||||
/* Right now we only support 8-8-8 DTR mode. */
|
||||
if (op->cmd.nbytes && op->cmd.buswidth != 8)
|
||||
return false;
|
||||
if (op->addr.nbytes && op->addr.buswidth != 8)
|
||||
return false;
|
||||
if (op->data.nbytes && op->data.buswidth != 8)
|
||||
return false;
|
||||
} else if (all_false) {
|
||||
/* Only 1-1-X ops are supported without DTR */
|
||||
if (op->cmd.nbytes && op->cmd.buswidth > 1)
|
||||
return false;
|
||||
if (op->addr.nbytes && op->addr.buswidth > 1)
|
||||
return false;
|
||||
} else {
|
||||
/* Mixed DTR modes are not supported. */
|
||||
return false;
|
||||
}
|
||||
|
||||
return spi_mem_default_supports_op(mem, op);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x4da4), (unsigned long)&bxt_info },
|
||||
{ PCI_VDEVICE(INTEL, 0x51a4), (unsigned long)&cnl_info },
|
||||
{ PCI_VDEVICE(INTEL, 0x54a4), (unsigned long)&cnl_info },
|
||||
{ PCI_VDEVICE(INTEL, 0x7a24), (unsigned long)&cnl_info },
|
||||
{ PCI_VDEVICE(INTEL, 0x7aa4), (unsigned long)&cnl_info },
|
||||
{ PCI_VDEVICE(INTEL, 0xa0a4), (unsigned long)&bxt_info },
|
||||
{ PCI_VDEVICE(INTEL, 0xa1a4), (unsigned long)&bxt_info },
|
||||
|
||||
@@ -960,7 +960,17 @@ static int __maybe_unused mtk_nor_suspend(struct device *dev)
|
||||
|
||||
static int __maybe_unused mtk_nor_resume(struct device *dev)
|
||||
{
|
||||
return pm_runtime_force_resume(dev);
|
||||
struct spi_controller *ctlr = dev_get_drvdata(dev);
|
||||
struct mtk_nor *sp = spi_controller_get_devdata(ctlr);
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_force_resume(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mtk_nor_init(sp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops mtk_nor_pm_ops = {
|
||||
|
||||
@@ -759,9 +759,14 @@ static void posix_acl_fix_xattr_userns(
|
||||
}
|
||||
|
||||
void posix_acl_fix_xattr_from_user(struct user_namespace *mnt_userns,
|
||||
struct inode *inode,
|
||||
void *value, size_t size)
|
||||
{
|
||||
struct user_namespace *user_ns = current_user_ns();
|
||||
|
||||
/* Leave ids untouched on non-idmapped mounts. */
|
||||
if (no_idmapping(mnt_userns, i_user_ns(inode)))
|
||||
mnt_userns = &init_user_ns;
|
||||
if ((user_ns == &init_user_ns) && (mnt_userns == &init_user_ns))
|
||||
return;
|
||||
posix_acl_fix_xattr_userns(&init_user_ns, user_ns, mnt_userns, value,
|
||||
@@ -769,9 +774,14 @@ void posix_acl_fix_xattr_from_user(struct user_namespace *mnt_userns,
|
||||
}
|
||||
|
||||
void posix_acl_fix_xattr_to_user(struct user_namespace *mnt_userns,
|
||||
struct inode *inode,
|
||||
void *value, size_t size)
|
||||
{
|
||||
struct user_namespace *user_ns = current_user_ns();
|
||||
|
||||
/* Leave ids untouched on non-idmapped mounts. */
|
||||
if (no_idmapping(mnt_userns, i_user_ns(inode)))
|
||||
mnt_userns = &init_user_ns;
|
||||
if ((user_ns == &init_user_ns) && (mnt_userns == &init_user_ns))
|
||||
return;
|
||||
posix_acl_fix_xattr_userns(user_ns, &init_user_ns, mnt_userns, value,
|
||||
|
||||
@@ -569,7 +569,8 @@ setxattr(struct user_namespace *mnt_userns, struct dentry *d,
|
||||
}
|
||||
if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
|
||||
(strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
|
||||
posix_acl_fix_xattr_from_user(mnt_userns, kvalue, size);
|
||||
posix_acl_fix_xattr_from_user(mnt_userns, d_inode(d),
|
||||
kvalue, size);
|
||||
}
|
||||
|
||||
error = vfs_setxattr(mnt_userns, d, kname, kvalue, size, flags);
|
||||
@@ -667,7 +668,8 @@ getxattr(struct user_namespace *mnt_userns, struct dentry *d,
|
||||
if (error > 0) {
|
||||
if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
|
||||
(strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
|
||||
posix_acl_fix_xattr_to_user(mnt_userns, kvalue, error);
|
||||
posix_acl_fix_xattr_to_user(mnt_userns, d_inode(d),
|
||||
kvalue, error);
|
||||
if (size && copy_to_user(value, kvalue, error))
|
||||
error = -EFAULT;
|
||||
} else if (error == -ERANGE && size >= XATTR_SIZE_MAX) {
|
||||
|
||||
@@ -34,15 +34,19 @@ posix_acl_xattr_count(size_t size)
|
||||
|
||||
#ifdef CONFIG_FS_POSIX_ACL
|
||||
void posix_acl_fix_xattr_from_user(struct user_namespace *mnt_userns,
|
||||
struct inode *inode,
|
||||
void *value, size_t size);
|
||||
void posix_acl_fix_xattr_to_user(struct user_namespace *mnt_userns,
|
||||
struct inode *inode,
|
||||
void *value, size_t size);
|
||||
#else
|
||||
static inline void posix_acl_fix_xattr_from_user(struct user_namespace *mnt_userns,
|
||||
struct inode *inode,
|
||||
void *value, size_t size)
|
||||
{
|
||||
}
|
||||
static inline void posix_acl_fix_xattr_to_user(struct user_namespace *mnt_userns,
|
||||
struct inode *inode,
|
||||
void *value, size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ struct notifier_block; /* in notifier.h */
|
||||
#define VM_KASAN 0x00000080 /* has allocated kasan shadow memory */
|
||||
#define VM_FLUSH_RESET_PERMS 0x00000100 /* reset direct map and flush TLB on unmap, can't be freed in atomic context */
|
||||
#define VM_MAP_PUT_PAGES 0x00000200 /* put pages and free array in vfree */
|
||||
#define VM_NO_HUGE_VMAP 0x00000400 /* force PAGE_SIZE pte mapping */
|
||||
#define VM_ALLOW_HUGE_VMAP 0x00000400 /* Allow for huge pages on archs with HAVE_ARCH_HUGE_VMALLOC */
|
||||
|
||||
#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \
|
||||
!defined(CONFIG_KASAN_VMALLOC)
|
||||
@@ -153,7 +153,7 @@ extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
|
||||
const void *caller) __alloc_size(1);
|
||||
void *__vmalloc_node(unsigned long size, unsigned long align, gfp_t gfp_mask,
|
||||
int node, const void *caller) __alloc_size(1);
|
||||
void *vmalloc_no_huge(unsigned long size) __alloc_size(1);
|
||||
void *vmalloc_huge(unsigned long size, gfp_t gfp_mask) __alloc_size(1);
|
||||
|
||||
extern void *__vmalloc_array(size_t n, size_t size, gfp_t flags) __alloc_size(1, 2);
|
||||
extern void *vmalloc_array(size_t n, size_t size) __alloc_size(1, 2);
|
||||
|
||||
17
mm/vmalloc.c
17
mm/vmalloc.c
@@ -3095,7 +3095,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (vmap_allow_huge && !(vm_flags & VM_NO_HUGE_VMAP)) {
|
||||
if (vmap_allow_huge && (vm_flags & VM_ALLOW_HUGE_VMAP)) {
|
||||
unsigned long size_per_node;
|
||||
|
||||
/*
|
||||
@@ -3262,21 +3262,24 @@ void *vmalloc(unsigned long size)
|
||||
EXPORT_SYMBOL(vmalloc);
|
||||
|
||||
/**
|
||||
* vmalloc_no_huge - allocate virtually contiguous memory using small pages
|
||||
* @size: allocation size
|
||||
* vmalloc_huge - allocate virtually contiguous memory, allow huge pages
|
||||
* @size: allocation size
|
||||
* @gfp_mask: flags for the page level allocator
|
||||
*
|
||||
* Allocate enough non-huge pages to cover @size from the page level
|
||||
* Allocate enough pages to cover @size from the page level
|
||||
* allocator and map them into contiguous kernel virtual space.
|
||||
* If @size is greater than or equal to PMD_SIZE, allow using
|
||||
* huge pages for the memory
|
||||
*
|
||||
* Return: pointer to the allocated memory or %NULL on error
|
||||
*/
|
||||
void *vmalloc_no_huge(unsigned long size)
|
||||
void *vmalloc_huge(unsigned long size, gfp_t gfp_mask)
|
||||
{
|
||||
return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
|
||||
GFP_KERNEL, PAGE_KERNEL, VM_NO_HUGE_VMAP,
|
||||
gfp_mask, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP,
|
||||
NUMA_NO_NODE, __builtin_return_address(0));
|
||||
}
|
||||
EXPORT_SYMBOL(vmalloc_no_huge);
|
||||
EXPORT_SYMBOL_GPL(vmalloc_huge);
|
||||
|
||||
/**
|
||||
* vzalloc - allocate virtually contiguous memory with zero fill
|
||||
|
||||
Reference in New Issue
Block a user