diff options
Diffstat (limited to 'drivers')
360 files changed, 2851 insertions, 1859 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5c093ce01bcd..147f6c7ea59c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -1029,6 +1029,9 @@ void __init acpi_early_init(void) | |||
| 1029 | 1029 | ||
| 1030 | acpi_permanent_mmap = true; | 1030 | acpi_permanent_mmap = true; |
| 1031 | 1031 | ||
| 1032 | /* Initialize debug output. Linux does not use ACPICA defaults */ | ||
| 1033 | acpi_dbg_level = ACPI_LV_INFO | ACPI_LV_REPAIR; | ||
| 1034 | |||
| 1032 | #ifdef CONFIG_X86 | 1035 | #ifdef CONFIG_X86 |
| 1033 | /* | 1036 | /* |
| 1034 | * If the machine falls into the DMI check table, | 1037 | * If the machine falls into the DMI check table, |
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 5143e11e3b0f..e18ade5d74e9 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
| @@ -409,6 +409,32 @@ static bool payload_dumpable(struct nvdimm *nvdimm, unsigned int func) | |||
| 409 | return true; | 409 | return true; |
| 410 | } | 410 | } |
| 411 | 411 | ||
| 412 | static int cmd_to_func(struct nfit_mem *nfit_mem, unsigned int cmd, | ||
| 413 | struct nd_cmd_pkg *call_pkg) | ||
| 414 | { | ||
| 415 | if (call_pkg) { | ||
| 416 | int i; | ||
| 417 | |||
| 418 | if (nfit_mem->family != call_pkg->nd_family) | ||
| 419 | return -ENOTTY; | ||
| 420 | |||
| 421 | for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++) | ||
| 422 | if (call_pkg->nd_reserved2[i]) | ||
| 423 | return -EINVAL; | ||
| 424 | return call_pkg->nd_command; | ||
| 425 | } | ||
| 426 | |||
| 427 | /* Linux ND commands == NVDIMM_FAMILY_INTEL function numbers */ | ||
| 428 | if (nfit_mem->family == NVDIMM_FAMILY_INTEL) | ||
| 429 | return cmd; | ||
| 430 | |||
| 431 | /* | ||
| 432 | * Force function number validation to fail since 0 is never | ||
| 433 | * published as a valid function in dsm_mask. | ||
| 434 | */ | ||
| 435 | return 0; | ||
| 436 | } | ||
| 437 | |||
| 412 | int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, | 438 | int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, |
| 413 | unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc) | 439 | unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc) |
| 414 | { | 440 | { |
| @@ -422,30 +448,23 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, | |||
| 422 | unsigned long cmd_mask, dsm_mask; | 448 | unsigned long cmd_mask, dsm_mask; |
| 423 | u32 offset, fw_status = 0; | 449 | u32 offset, fw_status = 0; |
| 424 | acpi_handle handle; | 450 | acpi_handle handle; |
| 425 | unsigned int func; | ||
| 426 | const guid_t *guid; | 451 | const guid_t *guid; |
| 427 | int rc, i; | 452 | int func, rc, i; |
| 428 | 453 | ||
| 429 | if (cmd_rc) | 454 | if (cmd_rc) |
| 430 | *cmd_rc = -EINVAL; | 455 | *cmd_rc = -EINVAL; |
| 431 | func = cmd; | ||
| 432 | if (cmd == ND_CMD_CALL) { | ||
| 433 | call_pkg = buf; | ||
| 434 | func = call_pkg->nd_command; | ||
| 435 | |||
| 436 | for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++) | ||
| 437 | if (call_pkg->nd_reserved2[i]) | ||
| 438 | return -EINVAL; | ||
| 439 | } | ||
| 440 | 456 | ||
| 441 | if (nvdimm) { | 457 | if (nvdimm) { |
| 442 | struct acpi_device *adev = nfit_mem->adev; | 458 | struct acpi_device *adev = nfit_mem->adev; |
| 443 | 459 | ||
| 444 | if (!adev) | 460 | if (!adev) |
| 445 | return -ENOTTY; | 461 | return -ENOTTY; |
| 446 | if (call_pkg && nfit_mem->family != call_pkg->nd_family) | ||
| 447 | return -ENOTTY; | ||
| 448 | 462 | ||
| 463 | if (cmd == ND_CMD_CALL) | ||
| 464 | call_pkg = buf; | ||
| 465 | func = cmd_to_func(nfit_mem, cmd, call_pkg); | ||
| 466 | if (func < 0) | ||
| 467 | return func; | ||
| 449 | dimm_name = nvdimm_name(nvdimm); | 468 | dimm_name = nvdimm_name(nvdimm); |
| 450 | cmd_name = nvdimm_cmd_name(cmd); | 469 | cmd_name = nvdimm_cmd_name(cmd); |
| 451 | cmd_mask = nvdimm_cmd_mask(nvdimm); | 470 | cmd_mask = nvdimm_cmd_mask(nvdimm); |
| @@ -456,6 +475,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, | |||
| 456 | } else { | 475 | } else { |
| 457 | struct acpi_device *adev = to_acpi_dev(acpi_desc); | 476 | struct acpi_device *adev = to_acpi_dev(acpi_desc); |
| 458 | 477 | ||
| 478 | func = cmd; | ||
| 459 | cmd_name = nvdimm_bus_cmd_name(cmd); | 479 | cmd_name = nvdimm_bus_cmd_name(cmd); |
| 460 | cmd_mask = nd_desc->cmd_mask; | 480 | cmd_mask = nd_desc->cmd_mask; |
| 461 | dsm_mask = cmd_mask; | 481 | dsm_mask = cmd_mask; |
| @@ -470,7 +490,13 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, | |||
| 470 | if (!desc || (cmd && (desc->out_num + desc->in_num == 0))) | 490 | if (!desc || (cmd && (desc->out_num + desc->in_num == 0))) |
| 471 | return -ENOTTY; | 491 | return -ENOTTY; |
| 472 | 492 | ||
| 473 | if (!test_bit(cmd, &cmd_mask) || !test_bit(func, &dsm_mask)) | 493 | /* |
| 494 | * Check for a valid command. For ND_CMD_CALL, we also have to | ||
| 495 | * make sure that the DSM function is supported. | ||
| 496 | */ | ||
| 497 | if (cmd == ND_CMD_CALL && !test_bit(func, &dsm_mask)) | ||
| 498 | return -ENOTTY; | ||
| 499 | else if (!test_bit(cmd, &cmd_mask)) | ||
| 474 | return -ENOTTY; | 500 | return -ENOTTY; |
| 475 | 501 | ||
| 476 | in_obj.type = ACPI_TYPE_PACKAGE; | 502 | in_obj.type = ACPI_TYPE_PACKAGE; |
| @@ -1867,6 +1893,13 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc, | |||
| 1867 | return 0; | 1893 | return 0; |
| 1868 | } | 1894 | } |
| 1869 | 1895 | ||
| 1896 | /* | ||
| 1897 | * Function 0 is the command interrogation function, don't | ||
| 1898 | * export it to potential userspace use, and enable it to be | ||
| 1899 | * used as an error value in acpi_nfit_ctl(). | ||
| 1900 | */ | ||
| 1901 | dsm_mask &= ~1UL; | ||
| 1902 | |||
| 1870 | guid = to_nfit_uuid(nfit_mem->family); | 1903 | guid = to_nfit_uuid(nfit_mem->family); |
| 1871 | for_each_set_bit(i, &dsm_mask, BITS_PER_LONG) | 1904 | for_each_set_bit(i, &dsm_mask, BITS_PER_LONG) |
| 1872 | if (acpi_check_dsm(adev_dimm->handle, guid, | 1905 | if (acpi_check_dsm(adev_dimm->handle, guid, |
| @@ -2042,11 +2075,6 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) | |||
| 2042 | if (!nvdimm) | 2075 | if (!nvdimm) |
| 2043 | continue; | 2076 | continue; |
| 2044 | 2077 | ||
| 2045 | rc = nvdimm_security_setup_events(nvdimm); | ||
| 2046 | if (rc < 0) | ||
| 2047 | dev_warn(acpi_desc->dev, | ||
| 2048 | "security event setup failed: %d\n", rc); | ||
| 2049 | |||
| 2050 | nfit_kernfs = sysfs_get_dirent(nvdimm_kobj(nvdimm)->sd, "nfit"); | 2078 | nfit_kernfs = sysfs_get_dirent(nvdimm_kobj(nvdimm)->sd, "nfit"); |
| 2051 | if (nfit_kernfs) | 2079 | if (nfit_kernfs) |
| 2052 | nfit_mem->flags_attr = sysfs_get_dirent(nfit_kernfs, | 2080 | nfit_mem->flags_attr = sysfs_get_dirent(nfit_kernfs, |
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index cdfc87629efb..4d2b2ad1ee0e 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
| @@ -5854,9 +5854,10 @@ static int __init init_binder_device(const char *name) | |||
| 5854 | static int __init binder_init(void) | 5854 | static int __init binder_init(void) |
| 5855 | { | 5855 | { |
| 5856 | int ret; | 5856 | int ret; |
| 5857 | char *device_name, *device_names, *device_tmp; | 5857 | char *device_name, *device_tmp; |
| 5858 | struct binder_device *device; | 5858 | struct binder_device *device; |
| 5859 | struct hlist_node *tmp; | 5859 | struct hlist_node *tmp; |
| 5860 | char *device_names = NULL; | ||
| 5860 | 5861 | ||
| 5861 | ret = binder_alloc_shrinker_init(); | 5862 | ret = binder_alloc_shrinker_init(); |
| 5862 | if (ret) | 5863 | if (ret) |
| @@ -5898,23 +5899,29 @@ static int __init binder_init(void) | |||
| 5898 | &transaction_log_fops); | 5899 | &transaction_log_fops); |
| 5899 | } | 5900 | } |
| 5900 | 5901 | ||
| 5901 | /* | 5902 | if (strcmp(binder_devices_param, "") != 0) { |
| 5902 | * Copy the module_parameter string, because we don't want to | 5903 | /* |
| 5903 | * tokenize it in-place. | 5904 | * Copy the module_parameter string, because we don't want to |
| 5904 | */ | 5905 | * tokenize it in-place. |
| 5905 | device_names = kstrdup(binder_devices_param, GFP_KERNEL); | 5906 | */ |
| 5906 | if (!device_names) { | 5907 | device_names = kstrdup(binder_devices_param, GFP_KERNEL); |
| 5907 | ret = -ENOMEM; | 5908 | if (!device_names) { |
| 5908 | goto err_alloc_device_names_failed; | 5909 | ret = -ENOMEM; |
| 5909 | } | 5910 | goto err_alloc_device_names_failed; |
| 5911 | } | ||
| 5910 | 5912 | ||
| 5911 | device_tmp = device_names; | 5913 | device_tmp = device_names; |
| 5912 | while ((device_name = strsep(&device_tmp, ","))) { | 5914 | while ((device_name = strsep(&device_tmp, ","))) { |
| 5913 | ret = init_binder_device(device_name); | 5915 | ret = init_binder_device(device_name); |
| 5914 | if (ret) | 5916 | if (ret) |
| 5915 | goto err_init_binder_device_failed; | 5917 | goto err_init_binder_device_failed; |
| 5918 | } | ||
| 5916 | } | 5919 | } |
| 5917 | 5920 | ||
| 5921 | ret = init_binderfs(); | ||
| 5922 | if (ret) | ||
| 5923 | goto err_init_binder_device_failed; | ||
| 5924 | |||
| 5918 | return ret; | 5925 | return ret; |
| 5919 | 5926 | ||
| 5920 | err_init_binder_device_failed: | 5927 | err_init_binder_device_failed: |
diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 7fb97f503ef2..045b3e42d98b 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h | |||
| @@ -46,4 +46,13 @@ static inline bool is_binderfs_device(const struct inode *inode) | |||
| 46 | } | 46 | } |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | #ifdef CONFIG_ANDROID_BINDERFS | ||
| 50 | extern int __init init_binderfs(void); | ||
| 51 | #else | ||
| 52 | static inline int __init init_binderfs(void) | ||
| 53 | { | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | #endif | ||
| 57 | |||
| 49 | #endif /* _LINUX_BINDER_INTERNAL_H */ | 58 | #endif /* _LINUX_BINDER_INTERNAL_H */ |
diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index 7496b10532aa..e773f45d19d9 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/kdev_t.h> | 11 | #include <linux/kdev_t.h> |
| 12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
| 13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
| 14 | #include <linux/namei.h> | ||
| 14 | #include <linux/magic.h> | 15 | #include <linux/magic.h> |
| 15 | #include <linux/major.h> | 16 | #include <linux/major.h> |
| 16 | #include <linux/miscdevice.h> | 17 | #include <linux/miscdevice.h> |
| @@ -20,6 +21,7 @@ | |||
| 20 | #include <linux/parser.h> | 21 | #include <linux/parser.h> |
| 21 | #include <linux/radix-tree.h> | 22 | #include <linux/radix-tree.h> |
| 22 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
| 24 | #include <linux/seq_file.h> | ||
| 23 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 24 | #include <linux/spinlock_types.h> | 26 | #include <linux/spinlock_types.h> |
| 25 | #include <linux/stddef.h> | 27 | #include <linux/stddef.h> |
| @@ -30,7 +32,7 @@ | |||
| 30 | #include <linux/xarray.h> | 32 | #include <linux/xarray.h> |
| 31 | #include <uapi/asm-generic/errno-base.h> | 33 | #include <uapi/asm-generic/errno-base.h> |
| 32 | #include <uapi/linux/android/binder.h> | 34 | #include <uapi/linux/android/binder.h> |
| 33 | #include <uapi/linux/android/binder_ctl.h> | 35 | #include <uapi/linux/android/binderfs.h> |
| 34 | 36 | ||
| 35 | #include "binder_internal.h" | 37 | #include "binder_internal.h" |
| 36 | 38 | ||
| @@ -39,14 +41,32 @@ | |||
| 39 | #define INODE_OFFSET 3 | 41 | #define INODE_OFFSET 3 |
| 40 | #define INTSTRLEN 21 | 42 | #define INTSTRLEN 21 |
| 41 | #define BINDERFS_MAX_MINOR (1U << MINORBITS) | 43 | #define BINDERFS_MAX_MINOR (1U << MINORBITS) |
| 42 | 44 | /* Ensure that the initial ipc namespace always has devices available. */ | |
| 43 | static struct vfsmount *binderfs_mnt; | 45 | #define BINDERFS_MAX_MINOR_CAPPED (BINDERFS_MAX_MINOR - 4) |
| 44 | 46 | ||
| 45 | static dev_t binderfs_dev; | 47 | static dev_t binderfs_dev; |
| 46 | static DEFINE_MUTEX(binderfs_minors_mutex); | 48 | static DEFINE_MUTEX(binderfs_minors_mutex); |
| 47 | static DEFINE_IDA(binderfs_minors); | 49 | static DEFINE_IDA(binderfs_minors); |
| 48 | 50 | ||
| 49 | /** | 51 | /** |
| 52 | * binderfs_mount_opts - mount options for binderfs | ||
| 53 | * @max: maximum number of allocatable binderfs binder devices | ||
| 54 | */ | ||
| 55 | struct binderfs_mount_opts { | ||
| 56 | int max; | ||
| 57 | }; | ||
| 58 | |||
| 59 | enum { | ||
| 60 | Opt_max, | ||
| 61 | Opt_err | ||
| 62 | }; | ||
| 63 | |||
| 64 | static const match_table_t tokens = { | ||
| 65 | { Opt_max, "max=%d" }, | ||
| 66 | { Opt_err, NULL } | ||
| 67 | }; | ||
| 68 | |||
| 69 | /** | ||
| 50 | * binderfs_info - information about a binderfs mount | 70 | * binderfs_info - information about a binderfs mount |
| 51 | * @ipc_ns: The ipc namespace the binderfs mount belongs to. | 71 | * @ipc_ns: The ipc namespace the binderfs mount belongs to. |
| 52 | * @control_dentry: This records the dentry of this binderfs mount | 72 | * @control_dentry: This records the dentry of this binderfs mount |
| @@ -55,13 +75,16 @@ static DEFINE_IDA(binderfs_minors); | |||
| 55 | * created. | 75 | * created. |
| 56 | * @root_gid: gid that needs to be used when a new binder device is | 76 | * @root_gid: gid that needs to be used when a new binder device is |
| 57 | * created. | 77 | * created. |
| 78 | * @mount_opts: The mount options in use. | ||
| 79 | * @device_count: The current number of allocated binder devices. | ||
| 58 | */ | 80 | */ |
| 59 | struct binderfs_info { | 81 | struct binderfs_info { |
| 60 | struct ipc_namespace *ipc_ns; | 82 | struct ipc_namespace *ipc_ns; |
| 61 | struct dentry *control_dentry; | 83 | struct dentry *control_dentry; |
| 62 | kuid_t root_uid; | 84 | kuid_t root_uid; |
| 63 | kgid_t root_gid; | 85 | kgid_t root_gid; |
| 64 | 86 | struct binderfs_mount_opts mount_opts; | |
| 87 | int device_count; | ||
| 65 | }; | 88 | }; |
| 66 | 89 | ||
| 67 | static inline struct binderfs_info *BINDERFS_I(const struct inode *inode) | 90 | static inline struct binderfs_info *BINDERFS_I(const struct inode *inode) |
| @@ -84,7 +107,7 @@ bool is_binderfs_device(const struct inode *inode) | |||
| 84 | * @userp: buffer to copy information about new device for userspace to | 107 | * @userp: buffer to copy information about new device for userspace to |
| 85 | * @req: struct binderfs_device as copied from userspace | 108 | * @req: struct binderfs_device as copied from userspace |
| 86 | * | 109 | * |
| 87 | * This function allocated a new binder_device and reserves a new minor | 110 | * This function allocates a new binder_device and reserves a new minor |
| 88 | * number for it. | 111 | * number for it. |
| 89 | * Minor numbers are limited and tracked globally in binderfs_minors. The | 112 | * Minor numbers are limited and tracked globally in binderfs_minors. The |
| 90 | * function will stash a struct binder_device for the specific binder | 113 | * function will stash a struct binder_device for the specific binder |
| @@ -100,20 +123,34 @@ static int binderfs_binder_device_create(struct inode *ref_inode, | |||
| 100 | struct binderfs_device *req) | 123 | struct binderfs_device *req) |
| 101 | { | 124 | { |
| 102 | int minor, ret; | 125 | int minor, ret; |
| 103 | struct dentry *dentry, *dup, *root; | 126 | struct dentry *dentry, *root; |
| 104 | struct binder_device *device; | 127 | struct binder_device *device; |
| 105 | size_t name_len = BINDERFS_MAX_NAME + 1; | ||
| 106 | char *name = NULL; | 128 | char *name = NULL; |
| 129 | size_t name_len; | ||
| 107 | struct inode *inode = NULL; | 130 | struct inode *inode = NULL; |
| 108 | struct super_block *sb = ref_inode->i_sb; | 131 | struct super_block *sb = ref_inode->i_sb; |
| 109 | struct binderfs_info *info = sb->s_fs_info; | 132 | struct binderfs_info *info = sb->s_fs_info; |
| 133 | #if defined(CONFIG_IPC_NS) | ||
| 134 | bool use_reserve = (info->ipc_ns == &init_ipc_ns); | ||
| 135 | #else | ||
| 136 | bool use_reserve = true; | ||
| 137 | #endif | ||
| 110 | 138 | ||
| 111 | /* Reserve new minor number for the new device. */ | 139 | /* Reserve new minor number for the new device. */ |
| 112 | mutex_lock(&binderfs_minors_mutex); | 140 | mutex_lock(&binderfs_minors_mutex); |
| 113 | minor = ida_alloc_max(&binderfs_minors, BINDERFS_MAX_MINOR, GFP_KERNEL); | 141 | if (++info->device_count <= info->mount_opts.max) |
| 114 | mutex_unlock(&binderfs_minors_mutex); | 142 | minor = ida_alloc_max(&binderfs_minors, |
| 115 | if (minor < 0) | 143 | use_reserve ? BINDERFS_MAX_MINOR : |
| 144 | BINDERFS_MAX_MINOR_CAPPED, | ||
| 145 | GFP_KERNEL); | ||
| 146 | else | ||
| 147 | minor = -ENOSPC; | ||
| 148 | if (minor < 0) { | ||
| 149 | --info->device_count; | ||
| 150 | mutex_unlock(&binderfs_minors_mutex); | ||
| 116 | return minor; | 151 | return minor; |
| 152 | } | ||
| 153 | mutex_unlock(&binderfs_minors_mutex); | ||
| 117 | 154 | ||
| 118 | ret = -ENOMEM; | 155 | ret = -ENOMEM; |
| 119 | device = kzalloc(sizeof(*device), GFP_KERNEL); | 156 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
| @@ -132,12 +169,13 @@ static int binderfs_binder_device_create(struct inode *ref_inode, | |||
| 132 | inode->i_uid = info->root_uid; | 169 | inode->i_uid = info->root_uid; |
| 133 | inode->i_gid = info->root_gid; | 170 | inode->i_gid = info->root_gid; |
| 134 | 171 | ||
| 135 | name = kmalloc(name_len, GFP_KERNEL); | 172 | req->name[BINDERFS_MAX_NAME] = '\0'; /* NUL-terminate */ |
| 173 | name_len = strlen(req->name); | ||
| 174 | /* Make sure to include terminating NUL byte */ | ||
| 175 | name = kmemdup(req->name, name_len + 1, GFP_KERNEL); | ||
| 136 | if (!name) | 176 | if (!name) |
| 137 | goto err; | 177 | goto err; |
| 138 | 178 | ||
| 139 | strscpy(name, req->name, name_len); | ||
| 140 | |||
| 141 | device->binderfs_inode = inode; | 179 | device->binderfs_inode = inode; |
| 142 | device->context.binder_context_mgr_uid = INVALID_UID; | 180 | device->context.binder_context_mgr_uid = INVALID_UID; |
| 143 | device->context.name = name; | 181 | device->context.name = name; |
| @@ -156,28 +194,25 @@ static int binderfs_binder_device_create(struct inode *ref_inode, | |||
| 156 | 194 | ||
| 157 | root = sb->s_root; | 195 | root = sb->s_root; |
| 158 | inode_lock(d_inode(root)); | 196 | inode_lock(d_inode(root)); |
| 159 | dentry = d_alloc_name(root, name); | 197 | |
| 160 | if (!dentry) { | 198 | /* look it up */ |
| 199 | dentry = lookup_one_len(name, root, name_len); | ||
| 200 | if (IS_ERR(dentry)) { | ||
| 161 | inode_unlock(d_inode(root)); | 201 | inode_unlock(d_inode(root)); |
| 162 | ret = -ENOMEM; | 202 | ret = PTR_ERR(dentry); |
| 163 | goto err; | 203 | goto err; |
| 164 | } | 204 | } |
| 165 | 205 | ||
| 166 | /* Verify that the name userspace gave us is not already in use. */ | 206 | if (d_really_is_positive(dentry)) { |
| 167 | dup = d_lookup(root, &dentry->d_name); | 207 | /* already exists */ |
| 168 | if (dup) { | 208 | dput(dentry); |
| 169 | if (d_really_is_positive(dup)) { | 209 | inode_unlock(d_inode(root)); |
| 170 | dput(dup); | 210 | ret = -EEXIST; |
| 171 | dput(dentry); | 211 | goto err; |
| 172 | inode_unlock(d_inode(root)); | ||
| 173 | ret = -EEXIST; | ||
| 174 | goto err; | ||
| 175 | } | ||
| 176 | dput(dup); | ||
| 177 | } | 212 | } |
| 178 | 213 | ||
| 179 | inode->i_private = device; | 214 | inode->i_private = device; |
| 180 | d_add(dentry, inode); | 215 | d_instantiate(dentry, inode); |
| 181 | fsnotify_create(root->d_inode, dentry); | 216 | fsnotify_create(root->d_inode, dentry); |
| 182 | inode_unlock(d_inode(root)); | 217 | inode_unlock(d_inode(root)); |
| 183 | 218 | ||
| @@ -187,6 +222,7 @@ err: | |||
| 187 | kfree(name); | 222 | kfree(name); |
| 188 | kfree(device); | 223 | kfree(device); |
| 189 | mutex_lock(&binderfs_minors_mutex); | 224 | mutex_lock(&binderfs_minors_mutex); |
| 225 | --info->device_count; | ||
| 190 | ida_free(&binderfs_minors, minor); | 226 | ida_free(&binderfs_minors, minor); |
| 191 | mutex_unlock(&binderfs_minors_mutex); | 227 | mutex_unlock(&binderfs_minors_mutex); |
| 192 | iput(inode); | 228 | iput(inode); |
| @@ -232,6 +268,7 @@ static long binder_ctl_ioctl(struct file *file, unsigned int cmd, | |||
| 232 | static void binderfs_evict_inode(struct inode *inode) | 268 | static void binderfs_evict_inode(struct inode *inode) |
| 233 | { | 269 | { |
| 234 | struct binder_device *device = inode->i_private; | 270 | struct binder_device *device = inode->i_private; |
| 271 | struct binderfs_info *info = BINDERFS_I(inode); | ||
| 235 | 272 | ||
| 236 | clear_inode(inode); | 273 | clear_inode(inode); |
| 237 | 274 | ||
| @@ -239,6 +276,7 @@ static void binderfs_evict_inode(struct inode *inode) | |||
| 239 | return; | 276 | return; |
| 240 | 277 | ||
| 241 | mutex_lock(&binderfs_minors_mutex); | 278 | mutex_lock(&binderfs_minors_mutex); |
| 279 | --info->device_count; | ||
| 242 | ida_free(&binderfs_minors, device->miscdev.minor); | 280 | ida_free(&binderfs_minors, device->miscdev.minor); |
| 243 | mutex_unlock(&binderfs_minors_mutex); | 281 | mutex_unlock(&binderfs_minors_mutex); |
| 244 | 282 | ||
| @@ -246,43 +284,87 @@ static void binderfs_evict_inode(struct inode *inode) | |||
| 246 | kfree(device); | 284 | kfree(device); |
| 247 | } | 285 | } |
| 248 | 286 | ||
| 287 | /** | ||
| 288 | * binderfs_parse_mount_opts - parse binderfs mount options | ||
| 289 | * @data: options to set (can be NULL in which case defaults are used) | ||
| 290 | */ | ||
| 291 | static int binderfs_parse_mount_opts(char *data, | ||
| 292 | struct binderfs_mount_opts *opts) | ||
| 293 | { | ||
| 294 | char *p; | ||
| 295 | opts->max = BINDERFS_MAX_MINOR; | ||
| 296 | |||
| 297 | while ((p = strsep(&data, ",")) != NULL) { | ||
| 298 | substring_t args[MAX_OPT_ARGS]; | ||
| 299 | int token; | ||
| 300 | int max_devices; | ||
| 301 | |||
| 302 | if (!*p) | ||
| 303 | continue; | ||
| 304 | |||
| 305 | token = match_token(p, tokens, args); | ||
| 306 | switch (token) { | ||
| 307 | case Opt_max: | ||
| 308 | if (match_int(&args[0], &max_devices) || | ||
| 309 | (max_devices < 0 || | ||
| 310 | (max_devices > BINDERFS_MAX_MINOR))) | ||
| 311 | return -EINVAL; | ||
| 312 | |||
| 313 | opts->max = max_devices; | ||
| 314 | break; | ||
| 315 | default: | ||
| 316 | pr_err("Invalid mount options\n"); | ||
| 317 | return -EINVAL; | ||
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | return 0; | ||
| 322 | } | ||
| 323 | |||
| 324 | static int binderfs_remount(struct super_block *sb, int *flags, char *data) | ||
| 325 | { | ||
| 326 | struct binderfs_info *info = sb->s_fs_info; | ||
| 327 | return binderfs_parse_mount_opts(data, &info->mount_opts); | ||
| 328 | } | ||
| 329 | |||
| 330 | static int binderfs_show_mount_opts(struct seq_file *seq, struct dentry *root) | ||
| 331 | { | ||
| 332 | struct binderfs_info *info; | ||
| 333 | |||
| 334 | info = root->d_sb->s_fs_info; | ||
| 335 | if (info->mount_opts.max <= BINDERFS_MAX_MINOR) | ||
| 336 | seq_printf(seq, ",max=%d", info->mount_opts.max); | ||
| 337 | |||
| 338 | return 0; | ||
| 339 | } | ||
| 340 | |||
| 249 | static const struct super_operations binderfs_super_ops = { | 341 | static const struct super_operations binderfs_super_ops = { |
| 250 | .statfs = simple_statfs, | 342 | .evict_inode = binderfs_evict_inode, |
| 251 | .evict_inode = binderfs_evict_inode, | 343 | .remount_fs = binderfs_remount, |
| 344 | .show_options = binderfs_show_mount_opts, | ||
| 345 | .statfs = simple_statfs, | ||
| 252 | }; | 346 | }; |
| 253 | 347 | ||
| 348 | static inline bool is_binderfs_control_device(const struct dentry *dentry) | ||
| 349 | { | ||
| 350 | struct binderfs_info *info = dentry->d_sb->s_fs_info; | ||
| 351 | return info->control_dentry == dentry; | ||
| 352 | } | ||
| 353 | |||
| 254 | static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 354 | static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 255 | struct inode *new_dir, struct dentry *new_dentry, | 355 | struct inode *new_dir, struct dentry *new_dentry, |
| 256 | unsigned int flags) | 356 | unsigned int flags) |
| 257 | { | 357 | { |
| 258 | struct inode *inode = d_inode(old_dentry); | 358 | if (is_binderfs_control_device(old_dentry) || |
| 259 | 359 | is_binderfs_control_device(new_dentry)) | |
| 260 | /* binderfs doesn't support directories. */ | ||
| 261 | if (d_is_dir(old_dentry)) | ||
| 262 | return -EPERM; | 360 | return -EPERM; |
| 263 | 361 | ||
| 264 | if (flags & ~RENAME_NOREPLACE) | 362 | return simple_rename(old_dir, old_dentry, new_dir, new_dentry, flags); |
| 265 | return -EINVAL; | ||
| 266 | |||
| 267 | if (!simple_empty(new_dentry)) | ||
| 268 | return -ENOTEMPTY; | ||
| 269 | |||
| 270 | if (d_really_is_positive(new_dentry)) | ||
| 271 | simple_unlink(new_dir, new_dentry); | ||
| 272 | |||
| 273 | old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = | ||
| 274 | new_dir->i_mtime = inode->i_ctime = current_time(old_dir); | ||
| 275 | |||
| 276 | return 0; | ||
| 277 | } | 363 | } |
| 278 | 364 | ||
| 279 | static int binderfs_unlink(struct inode *dir, struct dentry *dentry) | 365 | static int binderfs_unlink(struct inode *dir, struct dentry *dentry) |
| 280 | { | 366 | { |
| 281 | /* | 367 | if (is_binderfs_control_device(dentry)) |
| 282 | * The control dentry is only ever touched during mount so checking it | ||
| 283 | * here should not require us to take lock. | ||
| 284 | */ | ||
| 285 | if (BINDERFS_I(dir)->control_dentry == dentry) | ||
| 286 | return -EPERM; | 368 | return -EPERM; |
| 287 | 369 | ||
| 288 | return simple_unlink(dir, dentry); | 370 | return simple_unlink(dir, dentry); |
| @@ -313,13 +395,16 @@ static int binderfs_binder_ctl_create(struct super_block *sb) | |||
| 313 | struct inode *inode = NULL; | 395 | struct inode *inode = NULL; |
| 314 | struct dentry *root = sb->s_root; | 396 | struct dentry *root = sb->s_root; |
| 315 | struct binderfs_info *info = sb->s_fs_info; | 397 | struct binderfs_info *info = sb->s_fs_info; |
| 398 | #if defined(CONFIG_IPC_NS) | ||
| 399 | bool use_reserve = (info->ipc_ns == &init_ipc_ns); | ||
| 400 | #else | ||
| 401 | bool use_reserve = true; | ||
| 402 | #endif | ||
| 316 | 403 | ||
| 317 | device = kzalloc(sizeof(*device), GFP_KERNEL); | 404 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
| 318 | if (!device) | 405 | if (!device) |
| 319 | return -ENOMEM; | 406 | return -ENOMEM; |
| 320 | 407 | ||
| 321 | inode_lock(d_inode(root)); | ||
| 322 | |||
| 323 | /* If we have already created a binder-control node, return. */ | 408 | /* If we have already created a binder-control node, return. */ |
| 324 | if (info->control_dentry) { | 409 | if (info->control_dentry) { |
| 325 | ret = 0; | 410 | ret = 0; |
| @@ -333,7 +418,10 @@ static int binderfs_binder_ctl_create(struct super_block *sb) | |||
| 333 | 418 | ||
| 334 | /* Reserve a new minor number for the new device. */ | 419 | /* Reserve a new minor number for the new device. */ |
| 335 | mutex_lock(&binderfs_minors_mutex); | 420 | mutex_lock(&binderfs_minors_mutex); |
| 336 | minor = ida_alloc_max(&binderfs_minors, BINDERFS_MAX_MINOR, GFP_KERNEL); | 421 | minor = ida_alloc_max(&binderfs_minors, |
| 422 | use_reserve ? BINDERFS_MAX_MINOR : | ||
| 423 | BINDERFS_MAX_MINOR_CAPPED, | ||
| 424 | GFP_KERNEL); | ||
| 337 | mutex_unlock(&binderfs_minors_mutex); | 425 | mutex_unlock(&binderfs_minors_mutex); |
| 338 | if (minor < 0) { | 426 | if (minor < 0) { |
| 339 | ret = minor; | 427 | ret = minor; |
| @@ -358,12 +446,10 @@ static int binderfs_binder_ctl_create(struct super_block *sb) | |||
| 358 | inode->i_private = device; | 446 | inode->i_private = device; |
| 359 | info->control_dentry = dentry; | 447 | info->control_dentry = dentry; |
| 360 | d_add(dentry, inode); | 448 | d_add(dentry, inode); |
| 361 | inode_unlock(d_inode(root)); | ||
| 362 | 449 | ||
| 363 | return 0; | 450 | return 0; |
| 364 | 451 | ||
| 365 | out: | 452 | out: |
| 366 | inode_unlock(d_inode(root)); | ||
| 367 | kfree(device); | 453 | kfree(device); |
| 368 | iput(inode); | 454 | iput(inode); |
| 369 | 455 | ||
| @@ -378,12 +464,9 @@ static const struct inode_operations binderfs_dir_inode_operations = { | |||
| 378 | 464 | ||
| 379 | static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | 465 | static int binderfs_fill_super(struct super_block *sb, void *data, int silent) |
| 380 | { | 466 | { |
| 467 | int ret; | ||
| 381 | struct binderfs_info *info; | 468 | struct binderfs_info *info; |
| 382 | int ret = -ENOMEM; | ||
| 383 | struct inode *inode = NULL; | 469 | struct inode *inode = NULL; |
| 384 | struct ipc_namespace *ipc_ns = sb->s_fs_info; | ||
| 385 | |||
| 386 | get_ipc_ns(ipc_ns); | ||
| 387 | 470 | ||
| 388 | sb->s_blocksize = PAGE_SIZE; | 471 | sb->s_blocksize = PAGE_SIZE; |
| 389 | sb->s_blocksize_bits = PAGE_SHIFT; | 472 | sb->s_blocksize_bits = PAGE_SHIFT; |
| @@ -405,11 +488,17 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 405 | sb->s_op = &binderfs_super_ops; | 488 | sb->s_op = &binderfs_super_ops; |
| 406 | sb->s_time_gran = 1; | 489 | sb->s_time_gran = 1; |
| 407 | 490 | ||
| 408 | info = kzalloc(sizeof(struct binderfs_info), GFP_KERNEL); | 491 | sb->s_fs_info = kzalloc(sizeof(struct binderfs_info), GFP_KERNEL); |
| 409 | if (!info) | 492 | if (!sb->s_fs_info) |
| 410 | goto err_without_dentry; | 493 | return -ENOMEM; |
| 494 | info = sb->s_fs_info; | ||
| 495 | |||
| 496 | info->ipc_ns = get_ipc_ns(current->nsproxy->ipc_ns); | ||
| 497 | |||
| 498 | ret = binderfs_parse_mount_opts(data, &info->mount_opts); | ||
| 499 | if (ret) | ||
| 500 | return ret; | ||
| 411 | 501 | ||
| 412 | info->ipc_ns = ipc_ns; | ||
| 413 | info->root_gid = make_kgid(sb->s_user_ns, 0); | 502 | info->root_gid = make_kgid(sb->s_user_ns, 0); |
| 414 | if (!gid_valid(info->root_gid)) | 503 | if (!gid_valid(info->root_gid)) |
| 415 | info->root_gid = GLOBAL_ROOT_GID; | 504 | info->root_gid = GLOBAL_ROOT_GID; |
| @@ -417,11 +506,9 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 417 | if (!uid_valid(info->root_uid)) | 506 | if (!uid_valid(info->root_uid)) |
| 418 | info->root_uid = GLOBAL_ROOT_UID; | 507 | info->root_uid = GLOBAL_ROOT_UID; |
| 419 | 508 | ||
| 420 | sb->s_fs_info = info; | ||
| 421 | |||
| 422 | inode = new_inode(sb); | 509 | inode = new_inode(sb); |
| 423 | if (!inode) | 510 | if (!inode) |
| 424 | goto err_without_dentry; | 511 | return -ENOMEM; |
| 425 | 512 | ||
| 426 | inode->i_ino = FIRST_INODE; | 513 | inode->i_ino = FIRST_INODE; |
| 427 | inode->i_fop = &simple_dir_operations; | 514 | inode->i_fop = &simple_dir_operations; |
| @@ -432,79 +519,28 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 432 | 519 | ||
| 433 | sb->s_root = d_make_root(inode); | 520 | sb->s_root = d_make_root(inode); |
| 434 | if (!sb->s_root) | 521 | if (!sb->s_root) |
| 435 | goto err_without_dentry; | 522 | return -ENOMEM; |
| 436 | |||
| 437 | ret = binderfs_binder_ctl_create(sb); | ||
| 438 | if (ret) | ||
| 439 | goto err_with_dentry; | ||
| 440 | |||
| 441 | return 0; | ||
| 442 | |||
| 443 | err_with_dentry: | ||
| 444 | dput(sb->s_root); | ||
| 445 | sb->s_root = NULL; | ||
| 446 | |||
| 447 | err_without_dentry: | ||
| 448 | put_ipc_ns(ipc_ns); | ||
| 449 | iput(inode); | ||
| 450 | kfree(info); | ||
| 451 | |||
| 452 | return ret; | ||
| 453 | } | ||
| 454 | |||
| 455 | static int binderfs_test_super(struct super_block *sb, void *data) | ||
| 456 | { | ||
| 457 | struct binderfs_info *info = sb->s_fs_info; | ||
| 458 | |||
| 459 | if (info) | ||
| 460 | return info->ipc_ns == data; | ||
| 461 | |||
| 462 | return 0; | ||
| 463 | } | ||
| 464 | 523 | ||
| 465 | static int binderfs_set_super(struct super_block *sb, void *data) | 524 | return binderfs_binder_ctl_create(sb); |
| 466 | { | ||
| 467 | sb->s_fs_info = data; | ||
| 468 | return set_anon_super(sb, NULL); | ||
| 469 | } | 525 | } |
| 470 | 526 | ||
| 471 | static struct dentry *binderfs_mount(struct file_system_type *fs_type, | 527 | static struct dentry *binderfs_mount(struct file_system_type *fs_type, |
| 472 | int flags, const char *dev_name, | 528 | int flags, const char *dev_name, |
| 473 | void *data) | 529 | void *data) |
| 474 | { | 530 | { |
| 475 | struct super_block *sb; | 531 | return mount_nodev(fs_type, flags, data, binderfs_fill_super); |
| 476 | struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; | ||
| 477 | |||
| 478 | if (!ns_capable(ipc_ns->user_ns, CAP_SYS_ADMIN)) | ||
| 479 | return ERR_PTR(-EPERM); | ||
| 480 | |||
| 481 | sb = sget_userns(fs_type, binderfs_test_super, binderfs_set_super, | ||
| 482 | flags, ipc_ns->user_ns, ipc_ns); | ||
| 483 | if (IS_ERR(sb)) | ||
| 484 | return ERR_CAST(sb); | ||
| 485 | |||
| 486 | if (!sb->s_root) { | ||
| 487 | int ret = binderfs_fill_super(sb, data, flags & SB_SILENT ? 1 : 0); | ||
| 488 | if (ret) { | ||
| 489 | deactivate_locked_super(sb); | ||
| 490 | return ERR_PTR(ret); | ||
| 491 | } | ||
| 492 | |||
| 493 | sb->s_flags |= SB_ACTIVE; | ||
| 494 | } | ||
| 495 | |||
| 496 | return dget(sb->s_root); | ||
| 497 | } | 532 | } |
| 498 | 533 | ||
| 499 | static void binderfs_kill_super(struct super_block *sb) | 534 | static void binderfs_kill_super(struct super_block *sb) |
| 500 | { | 535 | { |
| 501 | struct binderfs_info *info = sb->s_fs_info; | 536 | struct binderfs_info *info = sb->s_fs_info; |
| 502 | 537 | ||
| 538 | kill_litter_super(sb); | ||
| 539 | |||
| 503 | if (info && info->ipc_ns) | 540 | if (info && info->ipc_ns) |
| 504 | put_ipc_ns(info->ipc_ns); | 541 | put_ipc_ns(info->ipc_ns); |
| 505 | 542 | ||
| 506 | kfree(info); | 543 | kfree(info); |
| 507 | kill_litter_super(sb); | ||
| 508 | } | 544 | } |
| 509 | 545 | ||
| 510 | static struct file_system_type binder_fs_type = { | 546 | static struct file_system_type binder_fs_type = { |
| @@ -514,7 +550,7 @@ static struct file_system_type binder_fs_type = { | |||
| 514 | .fs_flags = FS_USERNS_MOUNT, | 550 | .fs_flags = FS_USERNS_MOUNT, |
| 515 | }; | 551 | }; |
| 516 | 552 | ||
| 517 | static int __init init_binderfs(void) | 553 | int __init init_binderfs(void) |
| 518 | { | 554 | { |
| 519 | int ret; | 555 | int ret; |
| 520 | 556 | ||
| @@ -530,15 +566,5 @@ static int __init init_binderfs(void) | |||
| 530 | return ret; | 566 | return ret; |
| 531 | } | 567 | } |
| 532 | 568 | ||
| 533 | binderfs_mnt = kern_mount(&binder_fs_type); | ||
| 534 | if (IS_ERR(binderfs_mnt)) { | ||
| 535 | ret = PTR_ERR(binderfs_mnt); | ||
| 536 | binderfs_mnt = NULL; | ||
| 537 | unregister_filesystem(&binder_fs_type); | ||
| 538 | unregister_chrdev_region(binderfs_dev, BINDERFS_MAX_MINOR); | ||
| 539 | } | ||
| 540 | |||
| 541 | return ret; | 569 | return ret; |
| 542 | } | 570 | } |
| 543 | |||
| 544 | device_initcall(init_binderfs); | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b8c3f9e6af89..adf28788cab5 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4554,6 +4554,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4554 | { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, | 4554 | { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, |
| 4555 | { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, | 4555 | { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, |
| 4556 | { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, | 4556 | { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, |
| 4557 | { "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM, }, | ||
| 4557 | 4558 | ||
| 4558 | /* devices that don't properly handle queued TRIM commands */ | 4559 | /* devices that don't properly handle queued TRIM commands */ |
| 4559 | { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | | 4560 | { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c index 8cc9c429ad95..9e7fc302430f 100644 --- a/drivers/ata/pata_macio.c +++ b/drivers/ata/pata_macio.c | |||
| @@ -915,6 +915,10 @@ static struct scsi_host_template pata_macio_sht = { | |||
| 915 | .sg_tablesize = MAX_DCMDS, | 915 | .sg_tablesize = MAX_DCMDS, |
| 916 | /* We may not need that strict one */ | 916 | /* We may not need that strict one */ |
| 917 | .dma_boundary = ATA_DMA_BOUNDARY, | 917 | .dma_boundary = ATA_DMA_BOUNDARY, |
| 918 | /* Not sure what the real max is but we know it's less than 64K, let's | ||
| 919 | * use 64K minus 256 | ||
| 920 | */ | ||
| 921 | .max_segment_size = MAX_DBDMA_SEG, | ||
| 918 | .slave_configure = pata_macio_slave_config, | 922 | .slave_configure = pata_macio_slave_config, |
| 919 | }; | 923 | }; |
| 920 | 924 | ||
| @@ -1044,11 +1048,6 @@ static int pata_macio_common_init(struct pata_macio_priv *priv, | |||
| 1044 | /* Make sure we have sane initial timings in the cache */ | 1048 | /* Make sure we have sane initial timings in the cache */ |
| 1045 | pata_macio_default_timings(priv); | 1049 | pata_macio_default_timings(priv); |
| 1046 | 1050 | ||
| 1047 | /* Not sure what the real max is but we know it's less than 64K, let's | ||
| 1048 | * use 64K minus 256 | ||
| 1049 | */ | ||
| 1050 | dma_set_max_seg_size(priv->dev, MAX_DBDMA_SEG); | ||
| 1051 | |||
| 1052 | /* Allocate libata host for 1 port */ | 1051 | /* Allocate libata host for 1 port */ |
| 1053 | memset(&pinfo, 0, sizeof(struct ata_port_info)); | 1052 | memset(&pinfo, 0, sizeof(struct ata_port_info)); |
| 1054 | pmac_macio_calc_timing_masks(priv, &pinfo); | 1053 | pmac_macio_calc_timing_masks(priv, &pinfo); |
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index e0bcf9b2dab0..174e84ce4379 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
| @@ -245,8 +245,15 @@ struct inic_port_priv { | |||
| 245 | 245 | ||
| 246 | static struct scsi_host_template inic_sht = { | 246 | static struct scsi_host_template inic_sht = { |
| 247 | ATA_BASE_SHT(DRV_NAME), | 247 | ATA_BASE_SHT(DRV_NAME), |
| 248 | .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */ | 248 | .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */ |
| 249 | .dma_boundary = INIC_DMA_BOUNDARY, | 249 | |
| 250 | /* | ||
| 251 | * This controller is braindamaged. dma_boundary is 0xffff like others | ||
| 252 | * but it will lock up the whole machine HARD if 65536 byte PRD entry | ||
| 253 | * is fed. Reduce maximum segment size. | ||
| 254 | */ | ||
| 255 | .dma_boundary = INIC_DMA_BOUNDARY, | ||
| 256 | .max_segment_size = 65536 - 512, | ||
| 250 | }; | 257 | }; |
| 251 | 258 | ||
| 252 | static const int scr_map[] = { | 259 | static const int scr_map[] = { |
| @@ -868,17 +875,6 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 868 | return rc; | 875 | return rc; |
| 869 | } | 876 | } |
| 870 | 877 | ||
| 871 | /* | ||
| 872 | * This controller is braindamaged. dma_boundary is 0xffff | ||
| 873 | * like others but it will lock up the whole machine HARD if | ||
| 874 | * 65536 byte PRD entry is fed. Reduce maximum segment size. | ||
| 875 | */ | ||
| 876 | rc = dma_set_max_seg_size(&pdev->dev, 65536 - 512); | ||
| 877 | if (rc) { | ||
| 878 | dev_err(&pdev->dev, "failed to set the maximum segment size\n"); | ||
| 879 | return rc; | ||
| 880 | } | ||
| 881 | |||
| 882 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); | 878 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); |
| 883 | if (rc) { | 879 | if (rc) { |
| 884 | dev_err(&pdev->dev, "failed to initialize controller\n"); | 880 | dev_err(&pdev->dev, "failed to initialize controller\n"); |
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index cf78fa6d470d..a7359535caf5 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c | |||
| @@ -79,8 +79,7 @@ static void cache_size(struct cacheinfo *this_leaf, struct device_node *np) | |||
| 79 | ct_idx = get_cacheinfo_idx(this_leaf->type); | 79 | ct_idx = get_cacheinfo_idx(this_leaf->type); |
| 80 | propname = cache_type_info[ct_idx].size_prop; | 80 | propname = cache_type_info[ct_idx].size_prop; |
| 81 | 81 | ||
| 82 | if (of_property_read_u32(np, propname, &this_leaf->size)) | 82 | of_property_read_u32(np, propname, &this_leaf->size); |
| 83 | this_leaf->size = 0; | ||
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | /* not cache_line_size() because that's a macro in include/linux/cache.h */ | 85 | /* not cache_line_size() because that's a macro in include/linux/cache.h */ |
| @@ -114,8 +113,7 @@ static void cache_nr_sets(struct cacheinfo *this_leaf, struct device_node *np) | |||
| 114 | ct_idx = get_cacheinfo_idx(this_leaf->type); | 113 | ct_idx = get_cacheinfo_idx(this_leaf->type); |
| 115 | propname = cache_type_info[ct_idx].nr_sets_prop; | 114 | propname = cache_type_info[ct_idx].nr_sets_prop; |
| 116 | 115 | ||
| 117 | if (of_property_read_u32(np, propname, &this_leaf->number_of_sets)) | 116 | of_property_read_u32(np, propname, &this_leaf->number_of_sets); |
| 118 | this_leaf->number_of_sets = 0; | ||
| 119 | } | 117 | } |
| 120 | 118 | ||
| 121 | static void cache_associativity(struct cacheinfo *this_leaf) | 119 | static void cache_associativity(struct cacheinfo *this_leaf) |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 457be03b744d..0ea2139c50d8 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
| @@ -130,7 +130,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev) | |||
| 130 | { | 130 | { |
| 131 | int autosuspend_delay; | 131 | int autosuspend_delay; |
| 132 | u64 last_busy, expires = 0; | 132 | u64 last_busy, expires = 0; |
| 133 | u64 now = ktime_to_ns(ktime_get()); | 133 | u64 now = ktime_get_mono_fast_ns(); |
| 134 | 134 | ||
| 135 | if (!dev->power.use_autosuspend) | 135 | if (!dev->power.use_autosuspend) |
| 136 | goto out; | 136 | goto out; |
| @@ -909,7 +909,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) | |||
| 909 | * If 'expires' is after the current time, we've been called | 909 | * If 'expires' is after the current time, we've been called |
| 910 | * too early. | 910 | * too early. |
| 911 | */ | 911 | */ |
| 912 | if (expires > 0 && expires < ktime_to_ns(ktime_get())) { | 912 | if (expires > 0 && expires < ktime_get_mono_fast_ns()) { |
| 913 | dev->power.timer_expires = 0; | 913 | dev->power.timer_expires = 0; |
| 914 | rpm_suspend(dev, dev->power.timer_autosuspends ? | 914 | rpm_suspend(dev, dev->power.timer_autosuspends ? |
| 915 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); | 915 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); |
| @@ -928,7 +928,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) | |||
| 928 | int pm_schedule_suspend(struct device *dev, unsigned int delay) | 928 | int pm_schedule_suspend(struct device *dev, unsigned int delay) |
| 929 | { | 929 | { |
| 930 | unsigned long flags; | 930 | unsigned long flags; |
| 931 | ktime_t expires; | 931 | u64 expires; |
| 932 | int retval; | 932 | int retval; |
| 933 | 933 | ||
| 934 | spin_lock_irqsave(&dev->power.lock, flags); | 934 | spin_lock_irqsave(&dev->power.lock, flags); |
| @@ -945,8 +945,8 @@ int pm_schedule_suspend(struct device *dev, unsigned int delay) | |||
| 945 | /* Other scheduled or pending requests need to be canceled. */ | 945 | /* Other scheduled or pending requests need to be canceled. */ |
| 946 | pm_runtime_cancel_pending(dev); | 946 | pm_runtime_cancel_pending(dev); |
| 947 | 947 | ||
| 948 | expires = ktime_add(ktime_get(), ms_to_ktime(delay)); | 948 | expires = ktime_get_mono_fast_ns() + (u64)delay * NSEC_PER_MSEC; |
| 949 | dev->power.timer_expires = ktime_to_ns(expires); | 949 | dev->power.timer_expires = expires; |
| 950 | dev->power.timer_autosuspends = 0; | 950 | dev->power.timer_autosuspends = 0; |
| 951 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); | 951 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); |
| 952 | 952 | ||
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index a74ce885b541..c518659b4d9f 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
| 33 | #include <linux/workqueue.h> | 33 | #include <linux/workqueue.h> |
| 34 | #include <linux/uuid.h> | 34 | #include <linux/uuid.h> |
| 35 | #include <linux/nospec.h> | ||
| 35 | 36 | ||
| 36 | #define IPMI_DRIVER_VERSION "39.2" | 37 | #define IPMI_DRIVER_VERSION "39.2" |
| 37 | 38 | ||
| @@ -62,7 +63,8 @@ static void ipmi_debug_msg(const char *title, unsigned char *data, | |||
| 62 | { } | 63 | { } |
| 63 | #endif | 64 | #endif |
| 64 | 65 | ||
| 65 | static int initialized; | 66 | static bool initialized; |
| 67 | static bool drvregistered; | ||
| 66 | 68 | ||
| 67 | enum ipmi_panic_event_op { | 69 | enum ipmi_panic_event_op { |
| 68 | IPMI_SEND_PANIC_EVENT_NONE, | 70 | IPMI_SEND_PANIC_EVENT_NONE, |
| @@ -612,7 +614,7 @@ static DEFINE_MUTEX(ipmidriver_mutex); | |||
| 612 | 614 | ||
| 613 | static LIST_HEAD(ipmi_interfaces); | 615 | static LIST_HEAD(ipmi_interfaces); |
| 614 | static DEFINE_MUTEX(ipmi_interfaces_mutex); | 616 | static DEFINE_MUTEX(ipmi_interfaces_mutex); |
| 615 | DEFINE_STATIC_SRCU(ipmi_interfaces_srcu); | 617 | struct srcu_struct ipmi_interfaces_srcu; |
| 616 | 618 | ||
| 617 | /* | 619 | /* |
| 618 | * List of watchers that want to know when smi's are added and deleted. | 620 | * List of watchers that want to know when smi's are added and deleted. |
| @@ -720,7 +722,15 @@ struct watcher_entry { | |||
| 720 | int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) | 722 | int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) |
| 721 | { | 723 | { |
| 722 | struct ipmi_smi *intf; | 724 | struct ipmi_smi *intf; |
| 723 | int index; | 725 | int index, rv; |
| 726 | |||
| 727 | /* | ||
| 728 | * Make sure the driver is actually initialized, this handles | ||
| 729 | * problems with initialization order. | ||
| 730 | */ | ||
| 731 | rv = ipmi_init_msghandler(); | ||
| 732 | if (rv) | ||
| 733 | return rv; | ||
| 724 | 734 | ||
| 725 | mutex_lock(&smi_watchers_mutex); | 735 | mutex_lock(&smi_watchers_mutex); |
| 726 | 736 | ||
| @@ -884,7 +894,7 @@ static int deliver_response(struct ipmi_smi *intf, struct ipmi_recv_msg *msg) | |||
| 884 | 894 | ||
| 885 | if (user) { | 895 | if (user) { |
| 886 | user->handler->ipmi_recv_hndl(msg, user->handler_data); | 896 | user->handler->ipmi_recv_hndl(msg, user->handler_data); |
| 887 | release_ipmi_user(msg->user, index); | 897 | release_ipmi_user(user, index); |
| 888 | } else { | 898 | } else { |
| 889 | /* User went away, give up. */ | 899 | /* User went away, give up. */ |
| 890 | ipmi_free_recv_msg(msg); | 900 | ipmi_free_recv_msg(msg); |
| @@ -1076,7 +1086,7 @@ int ipmi_create_user(unsigned int if_num, | |||
| 1076 | { | 1086 | { |
| 1077 | unsigned long flags; | 1087 | unsigned long flags; |
| 1078 | struct ipmi_user *new_user; | 1088 | struct ipmi_user *new_user; |
| 1079 | int rv = 0, index; | 1089 | int rv, index; |
| 1080 | struct ipmi_smi *intf; | 1090 | struct ipmi_smi *intf; |
| 1081 | 1091 | ||
| 1082 | /* | 1092 | /* |
| @@ -1094,18 +1104,9 @@ int ipmi_create_user(unsigned int if_num, | |||
| 1094 | * Make sure the driver is actually initialized, this handles | 1104 | * Make sure the driver is actually initialized, this handles |
| 1095 | * problems with initialization order. | 1105 | * problems with initialization order. |
| 1096 | */ | 1106 | */ |
| 1097 | if (!initialized) { | 1107 | rv = ipmi_init_msghandler(); |
| 1098 | rv = ipmi_init_msghandler(); | 1108 | if (rv) |
| 1099 | if (rv) | 1109 | return rv; |
| 1100 | return rv; | ||
| 1101 | |||
| 1102 | /* | ||
| 1103 | * The init code doesn't return an error if it was turned | ||
| 1104 | * off, but it won't initialize. Check that. | ||
| 1105 | */ | ||
| 1106 | if (!initialized) | ||
| 1107 | return -ENODEV; | ||
| 1108 | } | ||
| 1109 | 1110 | ||
| 1110 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); | 1111 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
| 1111 | if (!new_user) | 1112 | if (!new_user) |
| @@ -1183,6 +1184,7 @@ EXPORT_SYMBOL(ipmi_get_smi_info); | |||
| 1183 | static void free_user(struct kref *ref) | 1184 | static void free_user(struct kref *ref) |
| 1184 | { | 1185 | { |
| 1185 | struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); | 1186 | struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); |
| 1187 | cleanup_srcu_struct(&user->release_barrier); | ||
| 1186 | kfree(user); | 1188 | kfree(user); |
| 1187 | } | 1189 | } |
| 1188 | 1190 | ||
| @@ -1259,7 +1261,6 @@ int ipmi_destroy_user(struct ipmi_user *user) | |||
| 1259 | { | 1261 | { |
| 1260 | _ipmi_destroy_user(user); | 1262 | _ipmi_destroy_user(user); |
| 1261 | 1263 | ||
| 1262 | cleanup_srcu_struct(&user->release_barrier); | ||
| 1263 | kref_put(&user->refcount, free_user); | 1264 | kref_put(&user->refcount, free_user); |
| 1264 | 1265 | ||
| 1265 | return 0; | 1266 | return 0; |
| @@ -1298,10 +1299,12 @@ int ipmi_set_my_address(struct ipmi_user *user, | |||
| 1298 | if (!user) | 1299 | if (!user) |
| 1299 | return -ENODEV; | 1300 | return -ENODEV; |
| 1300 | 1301 | ||
| 1301 | if (channel >= IPMI_MAX_CHANNELS) | 1302 | if (channel >= IPMI_MAX_CHANNELS) { |
| 1302 | rv = -EINVAL; | 1303 | rv = -EINVAL; |
| 1303 | else | 1304 | } else { |
| 1305 | channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | ||
| 1304 | user->intf->addrinfo[channel].address = address; | 1306 | user->intf->addrinfo[channel].address = address; |
| 1307 | } | ||
| 1305 | release_ipmi_user(user, index); | 1308 | release_ipmi_user(user, index); |
| 1306 | 1309 | ||
| 1307 | return rv; | 1310 | return rv; |
| @@ -1318,10 +1321,12 @@ int ipmi_get_my_address(struct ipmi_user *user, | |||
| 1318 | if (!user) | 1321 | if (!user) |
| 1319 | return -ENODEV; | 1322 | return -ENODEV; |
| 1320 | 1323 | ||
| 1321 | if (channel >= IPMI_MAX_CHANNELS) | 1324 | if (channel >= IPMI_MAX_CHANNELS) { |
| 1322 | rv = -EINVAL; | 1325 | rv = -EINVAL; |
| 1323 | else | 1326 | } else { |
| 1327 | channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | ||
| 1324 | *address = user->intf->addrinfo[channel].address; | 1328 | *address = user->intf->addrinfo[channel].address; |
| 1329 | } | ||
| 1325 | release_ipmi_user(user, index); | 1330 | release_ipmi_user(user, index); |
| 1326 | 1331 | ||
| 1327 | return rv; | 1332 | return rv; |
| @@ -1338,10 +1343,12 @@ int ipmi_set_my_LUN(struct ipmi_user *user, | |||
| 1338 | if (!user) | 1343 | if (!user) |
| 1339 | return -ENODEV; | 1344 | return -ENODEV; |
| 1340 | 1345 | ||
| 1341 | if (channel >= IPMI_MAX_CHANNELS) | 1346 | if (channel >= IPMI_MAX_CHANNELS) { |
| 1342 | rv = -EINVAL; | 1347 | rv = -EINVAL; |
| 1343 | else | 1348 | } else { |
| 1349 | channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | ||
| 1344 | user->intf->addrinfo[channel].lun = LUN & 0x3; | 1350 | user->intf->addrinfo[channel].lun = LUN & 0x3; |
| 1351 | } | ||
| 1345 | release_ipmi_user(user, index); | 1352 | release_ipmi_user(user, index); |
| 1346 | 1353 | ||
| 1347 | return rv; | 1354 | return rv; |
| @@ -1358,10 +1365,12 @@ int ipmi_get_my_LUN(struct ipmi_user *user, | |||
| 1358 | if (!user) | 1365 | if (!user) |
| 1359 | return -ENODEV; | 1366 | return -ENODEV; |
| 1360 | 1367 | ||
| 1361 | if (channel >= IPMI_MAX_CHANNELS) | 1368 | if (channel >= IPMI_MAX_CHANNELS) { |
| 1362 | rv = -EINVAL; | 1369 | rv = -EINVAL; |
| 1363 | else | 1370 | } else { |
| 1371 | channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | ||
| 1364 | *address = user->intf->addrinfo[channel].lun; | 1372 | *address = user->intf->addrinfo[channel].lun; |
| 1373 | } | ||
| 1365 | release_ipmi_user(user, index); | 1374 | release_ipmi_user(user, index); |
| 1366 | 1375 | ||
| 1367 | return rv; | 1376 | return rv; |
| @@ -2184,6 +2193,7 @@ static int check_addr(struct ipmi_smi *intf, | |||
| 2184 | { | 2193 | { |
| 2185 | if (addr->channel >= IPMI_MAX_CHANNELS) | 2194 | if (addr->channel >= IPMI_MAX_CHANNELS) |
| 2186 | return -EINVAL; | 2195 | return -EINVAL; |
| 2196 | addr->channel = array_index_nospec(addr->channel, IPMI_MAX_CHANNELS); | ||
| 2187 | *lun = intf->addrinfo[addr->channel].lun; | 2197 | *lun = intf->addrinfo[addr->channel].lun; |
| 2188 | *saddr = intf->addrinfo[addr->channel].address; | 2198 | *saddr = intf->addrinfo[addr->channel].address; |
| 2189 | return 0; | 2199 | return 0; |
| @@ -3291,17 +3301,9 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, | |||
| 3291 | * Make sure the driver is actually initialized, this handles | 3301 | * Make sure the driver is actually initialized, this handles |
| 3292 | * problems with initialization order. | 3302 | * problems with initialization order. |
| 3293 | */ | 3303 | */ |
| 3294 | if (!initialized) { | 3304 | rv = ipmi_init_msghandler(); |
| 3295 | rv = ipmi_init_msghandler(); | 3305 | if (rv) |
| 3296 | if (rv) | 3306 | return rv; |
| 3297 | return rv; | ||
| 3298 | /* | ||
| 3299 | * The init code doesn't return an error if it was turned | ||
| 3300 | * off, but it won't initialize. Check that. | ||
| 3301 | */ | ||
| 3302 | if (!initialized) | ||
| 3303 | return -ENODEV; | ||
| 3304 | } | ||
| 3305 | 3307 | ||
| 3306 | intf = kzalloc(sizeof(*intf), GFP_KERNEL); | 3308 | intf = kzalloc(sizeof(*intf), GFP_KERNEL); |
| 3307 | if (!intf) | 3309 | if (!intf) |
| @@ -5017,6 +5019,22 @@ static int panic_event(struct notifier_block *this, | |||
| 5017 | return NOTIFY_DONE; | 5019 | return NOTIFY_DONE; |
| 5018 | } | 5020 | } |
| 5019 | 5021 | ||
| 5022 | /* Must be called with ipmi_interfaces_mutex held. */ | ||
| 5023 | static int ipmi_register_driver(void) | ||
| 5024 | { | ||
| 5025 | int rv; | ||
| 5026 | |||
| 5027 | if (drvregistered) | ||
| 5028 | return 0; | ||
| 5029 | |||
| 5030 | rv = driver_register(&ipmidriver.driver); | ||
| 5031 | if (rv) | ||
| 5032 | pr_err("Could not register IPMI driver\n"); | ||
| 5033 | else | ||
| 5034 | drvregistered = true; | ||
| 5035 | return rv; | ||
| 5036 | } | ||
| 5037 | |||
| 5020 | static struct notifier_block panic_block = { | 5038 | static struct notifier_block panic_block = { |
| 5021 | .notifier_call = panic_event, | 5039 | .notifier_call = panic_event, |
| 5022 | .next = NULL, | 5040 | .next = NULL, |
| @@ -5027,66 +5045,75 @@ static int ipmi_init_msghandler(void) | |||
| 5027 | { | 5045 | { |
| 5028 | int rv; | 5046 | int rv; |
| 5029 | 5047 | ||
| 5048 | mutex_lock(&ipmi_interfaces_mutex); | ||
| 5049 | rv = ipmi_register_driver(); | ||
| 5050 | if (rv) | ||
| 5051 | goto out; | ||
| 5030 | if (initialized) | 5052 | if (initialized) |
| 5031 | return 0; | 5053 | goto out; |
| 5032 | |||
| 5033 | rv = driver_register(&ipmidriver.driver); | ||
| 5034 | if (rv) { | ||
| 5035 | pr_err("Could not register IPMI driver\n"); | ||
| 5036 | return rv; | ||
| 5037 | } | ||
| 5038 | 5054 | ||
| 5039 | pr_info("version " IPMI_DRIVER_VERSION "\n"); | 5055 | init_srcu_struct(&ipmi_interfaces_srcu); |
| 5040 | 5056 | ||
| 5041 | timer_setup(&ipmi_timer, ipmi_timeout, 0); | 5057 | timer_setup(&ipmi_timer, ipmi_timeout, 0); |
| 5042 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); | 5058 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); |
| 5043 | 5059 | ||
| 5044 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); | 5060 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); |
| 5045 | 5061 | ||
| 5046 | initialized = 1; | 5062 | initialized = true; |
| 5047 | 5063 | ||
| 5048 | return 0; | 5064 | out: |
| 5065 | mutex_unlock(&ipmi_interfaces_mutex); | ||
| 5066 | return rv; | ||
| 5049 | } | 5067 | } |
| 5050 | 5068 | ||
| 5051 | static int __init ipmi_init_msghandler_mod(void) | 5069 | static int __init ipmi_init_msghandler_mod(void) |
| 5052 | { | 5070 | { |
| 5053 | ipmi_init_msghandler(); | 5071 | int rv; |
| 5054 | return 0; | 5072 | |
| 5073 | pr_info("version " IPMI_DRIVER_VERSION "\n"); | ||
| 5074 | |||
| 5075 | mutex_lock(&ipmi_interfaces_mutex); | ||
| 5076 | rv = ipmi_register_driver(); | ||
| 5077 | mutex_unlock(&ipmi_interfaces_mutex); | ||
| 5078 | |||
| 5079 | return rv; | ||
| 5055 | } | 5080 | } |
| 5056 | 5081 | ||
| 5057 | static void __exit cleanup_ipmi(void) | 5082 | static void __exit cleanup_ipmi(void) |
| 5058 | { | 5083 | { |
| 5059 | int count; | 5084 | int count; |
| 5060 | 5085 | ||
| 5061 | if (!initialized) | 5086 | if (initialized) { |
| 5062 | return; | 5087 | atomic_notifier_chain_unregister(&panic_notifier_list, |
| 5063 | 5088 | &panic_block); | |
| 5064 | atomic_notifier_chain_unregister(&panic_notifier_list, &panic_block); | ||
| 5065 | 5089 | ||
| 5066 | /* | 5090 | /* |
| 5067 | * This can't be called if any interfaces exist, so no worry | 5091 | * This can't be called if any interfaces exist, so no worry |
| 5068 | * about shutting down the interfaces. | 5092 | * about shutting down the interfaces. |
| 5069 | */ | 5093 | */ |
| 5070 | 5094 | ||
| 5071 | /* | 5095 | /* |
| 5072 | * Tell the timer to stop, then wait for it to stop. This | 5096 | * Tell the timer to stop, then wait for it to stop. This |
| 5073 | * avoids problems with race conditions removing the timer | 5097 | * avoids problems with race conditions removing the timer |
| 5074 | * here. | 5098 | * here. |
| 5075 | */ | 5099 | */ |
| 5076 | atomic_inc(&stop_operation); | 5100 | atomic_inc(&stop_operation); |
| 5077 | del_timer_sync(&ipmi_timer); | 5101 | del_timer_sync(&ipmi_timer); |
| 5078 | 5102 | ||
| 5079 | driver_unregister(&ipmidriver.driver); | 5103 | initialized = false; |
| 5080 | 5104 | ||
| 5081 | initialized = 0; | 5105 | /* Check for buffer leaks. */ |
| 5106 | count = atomic_read(&smi_msg_inuse_count); | ||
| 5107 | if (count != 0) | ||
| 5108 | pr_warn("SMI message count %d at exit\n", count); | ||
| 5109 | count = atomic_read(&recv_msg_inuse_count); | ||
| 5110 | if (count != 0) | ||
| 5111 | pr_warn("recv message count %d at exit\n", count); | ||
| 5082 | 5112 | ||
| 5083 | /* Check for buffer leaks. */ | 5113 | cleanup_srcu_struct(&ipmi_interfaces_srcu); |
| 5084 | count = atomic_read(&smi_msg_inuse_count); | 5114 | } |
| 5085 | if (count != 0) | 5115 | if (drvregistered) |
| 5086 | pr_warn("SMI message count %d at exit\n", count); | 5116 | driver_unregister(&ipmidriver.driver); |
| 5087 | count = atomic_read(&recv_msg_inuse_count); | ||
| 5088 | if (count != 0) | ||
| 5089 | pr_warn("recv message count %d at exit\n", count); | ||
| 5090 | } | 5117 | } |
| 5091 | module_exit(cleanup_ipmi); | 5118 | module_exit(cleanup_ipmi); |
| 5092 | 5119 | ||
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index ca9528c4f183..b7a1ae2afaea 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c | |||
| @@ -632,8 +632,9 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, | |||
| 632 | 632 | ||
| 633 | /* Remove the multi-part read marker. */ | 633 | /* Remove the multi-part read marker. */ |
| 634 | len -= 2; | 634 | len -= 2; |
| 635 | data += 2; | ||
| 635 | for (i = 0; i < len; i++) | 636 | for (i = 0; i < len; i++) |
| 636 | ssif_info->data[i] = data[i+2]; | 637 | ssif_info->data[i] = data[i]; |
| 637 | ssif_info->multi_len = len; | 638 | ssif_info->multi_len = len; |
| 638 | ssif_info->multi_pos = 1; | 639 | ssif_info->multi_pos = 1; |
| 639 | 640 | ||
| @@ -661,8 +662,19 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, | |||
| 661 | } | 662 | } |
| 662 | 663 | ||
| 663 | blocknum = data[0]; | 664 | blocknum = data[0]; |
| 665 | len--; | ||
| 666 | data++; | ||
| 667 | |||
| 668 | if (blocknum != 0xff && len != 31) { | ||
| 669 | /* All blocks but the last must have 31 data bytes. */ | ||
| 670 | result = -EIO; | ||
| 671 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | ||
| 672 | pr_info("Received middle message <31\n"); | ||
| 664 | 673 | ||
| 665 | if (ssif_info->multi_len + len - 1 > IPMI_MAX_MSG_LENGTH) { | 674 | goto continue_op; |
| 675 | } | ||
| 676 | |||
| 677 | if (ssif_info->multi_len + len > IPMI_MAX_MSG_LENGTH) { | ||
| 666 | /* Received message too big, abort the operation. */ | 678 | /* Received message too big, abort the operation. */ |
| 667 | result = -E2BIG; | 679 | result = -E2BIG; |
| 668 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | 680 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) |
| @@ -671,16 +683,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, | |||
| 671 | goto continue_op; | 683 | goto continue_op; |
| 672 | } | 684 | } |
| 673 | 685 | ||
| 674 | /* Remove the blocknum from the data. */ | ||
| 675 | len--; | ||
| 676 | for (i = 0; i < len; i++) | 686 | for (i = 0; i < len; i++) |
| 677 | ssif_info->data[i + ssif_info->multi_len] = data[i + 1]; | 687 | ssif_info->data[i + ssif_info->multi_len] = data[i]; |
| 678 | ssif_info->multi_len += len; | 688 | ssif_info->multi_len += len; |
| 679 | if (blocknum == 0xff) { | 689 | if (blocknum == 0xff) { |
| 680 | /* End of read */ | 690 | /* End of read */ |
| 681 | len = ssif_info->multi_len; | 691 | len = ssif_info->multi_len; |
| 682 | data = ssif_info->data; | 692 | data = ssif_info->data; |
| 683 | } else if (blocknum + 1 != ssif_info->multi_pos) { | 693 | } else if (blocknum != ssif_info->multi_pos) { |
| 684 | /* | 694 | /* |
| 685 | * Out of sequence block, just abort. Block | 695 | * Out of sequence block, just abort. Block |
| 686 | * numbers start at zero for the second block, | 696 | * numbers start at zero for the second block, |
| @@ -707,6 +717,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, | |||
| 707 | } | 717 | } |
| 708 | } | 718 | } |
| 709 | 719 | ||
| 720 | continue_op: | ||
| 710 | if (result < 0) { | 721 | if (result < 0) { |
| 711 | ssif_inc_stat(ssif_info, receive_errors); | 722 | ssif_inc_stat(ssif_info, receive_errors); |
| 712 | } else { | 723 | } else { |
| @@ -714,8 +725,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, | |||
| 714 | ssif_inc_stat(ssif_info, received_message_parts); | 725 | ssif_inc_stat(ssif_info, received_message_parts); |
| 715 | } | 726 | } |
| 716 | 727 | ||
| 717 | |||
| 718 | continue_op: | ||
| 719 | if (ssif_info->ssif_debug & SSIF_DEBUG_STATE) | 728 | if (ssif_info->ssif_debug & SSIF_DEBUG_STATE) |
| 720 | pr_info("DONE 1: state = %d, result=%d\n", | 729 | pr_info("DONE 1: state = %d, result=%d\n", |
| 721 | ssif_info->ssif_state, result); | 730 | ssif_info->ssif_state, result); |
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index b5e3103c1175..e43c876a9223 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #include <linux/mutex.h> | 59 | #include <linux/mutex.h> |
| 60 | #include <linux/delay.h> | 60 | #include <linux/delay.h> |
| 61 | #include <linux/serial_8250.h> | 61 | #include <linux/serial_8250.h> |
| 62 | #include <linux/nospec.h> | ||
| 62 | #include "smapi.h" | 63 | #include "smapi.h" |
| 63 | #include "mwavedd.h" | 64 | #include "mwavedd.h" |
| 64 | #include "3780i.h" | 65 | #include "3780i.h" |
| @@ -289,6 +290,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 289 | ipcnum); | 290 | ipcnum); |
| 290 | return -EINVAL; | 291 | return -EINVAL; |
| 291 | } | 292 | } |
| 293 | ipcnum = array_index_nospec(ipcnum, | ||
| 294 | ARRAY_SIZE(pDrvData->IPCs)); | ||
| 292 | PRINTK_3(TRACE_MWAVE, | 295 | PRINTK_3(TRACE_MWAVE, |
| 293 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" | 296 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" |
| 294 | " ipcnum %x entry usIntCount %x\n", | 297 | " ipcnum %x entry usIntCount %x\n", |
| @@ -317,6 +320,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 317 | " Invalid ipcnum %x\n", ipcnum); | 320 | " Invalid ipcnum %x\n", ipcnum); |
| 318 | return -EINVAL; | 321 | return -EINVAL; |
| 319 | } | 322 | } |
| 323 | ipcnum = array_index_nospec(ipcnum, | ||
| 324 | ARRAY_SIZE(pDrvData->IPCs)); | ||
| 320 | PRINTK_3(TRACE_MWAVE, | 325 | PRINTK_3(TRACE_MWAVE, |
| 321 | "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC" | 326 | "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC" |
| 322 | " ipcnum %x, usIntCount %x\n", | 327 | " ipcnum %x, usIntCount %x\n", |
| @@ -383,6 +388,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 383 | ipcnum); | 388 | ipcnum); |
| 384 | return -EINVAL; | 389 | return -EINVAL; |
| 385 | } | 390 | } |
| 391 | ipcnum = array_index_nospec(ipcnum, | ||
| 392 | ARRAY_SIZE(pDrvData->IPCs)); | ||
| 386 | mutex_lock(&mwave_mutex); | 393 | mutex_lock(&mwave_mutex); |
| 387 | if (pDrvData->IPCs[ipcnum].bIsEnabled == true) { | 394 | if (pDrvData->IPCs[ipcnum].bIsEnabled == true) { |
| 388 | pDrvData->IPCs[ipcnum].bIsEnabled = false; | 395 | pDrvData->IPCs[ipcnum].bIsEnabled = false; |
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index e5b2fe80eab4..d2f0bb5ba47e 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig | |||
| @@ -293,7 +293,6 @@ config COMMON_CLK_BD718XX | |||
| 293 | source "drivers/clk/actions/Kconfig" | 293 | source "drivers/clk/actions/Kconfig" |
| 294 | source "drivers/clk/bcm/Kconfig" | 294 | source "drivers/clk/bcm/Kconfig" |
| 295 | source "drivers/clk/hisilicon/Kconfig" | 295 | source "drivers/clk/hisilicon/Kconfig" |
| 296 | source "drivers/clk/imx/Kconfig" | ||
| 297 | source "drivers/clk/imgtec/Kconfig" | 296 | source "drivers/clk/imgtec/Kconfig" |
| 298 | source "drivers/clk/imx/Kconfig" | 297 | source "drivers/clk/imx/Kconfig" |
| 299 | source "drivers/clk/ingenic/Kconfig" | 298 | source "drivers/clk/ingenic/Kconfig" |
diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c index 5b393e711e94..7d16ab0784ec 100644 --- a/drivers/clk/clk-versaclock5.c +++ b/drivers/clk/clk-versaclock5.c | |||
| @@ -262,8 +262,10 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index) | |||
| 262 | 262 | ||
| 263 | if (vc5->clk_mux_ins == VC5_MUX_IN_XIN) | 263 | if (vc5->clk_mux_ins == VC5_MUX_IN_XIN) |
| 264 | src = VC5_PRIM_SRC_SHDN_EN_XTAL; | 264 | src = VC5_PRIM_SRC_SHDN_EN_XTAL; |
| 265 | if (vc5->clk_mux_ins == VC5_MUX_IN_CLKIN) | 265 | else if (vc5->clk_mux_ins == VC5_MUX_IN_CLKIN) |
| 266 | src = VC5_PRIM_SRC_SHDN_EN_CLKIN; | 266 | src = VC5_PRIM_SRC_SHDN_EN_CLKIN; |
| 267 | else /* Invalid; should have been caught by vc5_probe() */ | ||
| 268 | return -EINVAL; | ||
| 267 | } | 269 | } |
| 268 | 270 | ||
| 269 | return regmap_update_bits(vc5->regmap, VC5_PRIM_SRC_SHDN, mask, src); | 271 | return regmap_update_bits(vc5->regmap, VC5_PRIM_SRC_SHDN, mask, src); |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 75d13c0eff12..d2477a5058ac 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
| @@ -1513,9 +1513,19 @@ static int clk_fetch_parent_index(struct clk_core *core, | |||
| 1513 | if (!parent) | 1513 | if (!parent) |
| 1514 | return -EINVAL; | 1514 | return -EINVAL; |
| 1515 | 1515 | ||
| 1516 | for (i = 0; i < core->num_parents; i++) | 1516 | for (i = 0; i < core->num_parents; i++) { |
| 1517 | if (clk_core_get_parent_by_index(core, i) == parent) | 1517 | if (core->parents[i] == parent) |
| 1518 | return i; | ||
| 1519 | |||
| 1520 | if (core->parents[i]) | ||
| 1521 | continue; | ||
| 1522 | |||
| 1523 | /* Fallback to comparing globally unique names */ | ||
| 1524 | if (!strcmp(parent->name, core->parent_names[i])) { | ||
| 1525 | core->parents[i] = parent; | ||
| 1518 | return i; | 1526 | return i; |
| 1527 | } | ||
| 1528 | } | ||
| 1519 | 1529 | ||
| 1520 | return -EINVAL; | 1530 | return -EINVAL; |
| 1521 | } | 1531 | } |
| @@ -2779,7 +2789,7 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) | |||
| 2779 | seq_printf(s, "\"protect_count\": %d,", c->protect_count); | 2789 | seq_printf(s, "\"protect_count\": %d,", c->protect_count); |
| 2780 | seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c)); | 2790 | seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c)); |
| 2781 | seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); | 2791 | seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); |
| 2782 | seq_printf(s, "\"phase\": %d", clk_core_get_phase(c)); | 2792 | seq_printf(s, "\"phase\": %d,", clk_core_get_phase(c)); |
| 2783 | seq_printf(s, "\"duty_cycle\": %u", | 2793 | seq_printf(s, "\"duty_cycle\": %u", |
| 2784 | clk_core_get_scaled_duty_cycle(c, 100000)); | 2794 | clk_core_get_scaled_duty_cycle(c, 100000)); |
| 2785 | } | 2795 | } |
diff --git a/drivers/clk/imx/clk-frac-pll.c b/drivers/clk/imx/clk-frac-pll.c index 0026c3969b1e..76b9eb15604e 100644 --- a/drivers/clk/imx/clk-frac-pll.c +++ b/drivers/clk/imx/clk-frac-pll.c | |||
| @@ -155,13 +155,14 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
| 155 | { | 155 | { |
| 156 | struct clk_frac_pll *pll = to_clk_frac_pll(hw); | 156 | struct clk_frac_pll *pll = to_clk_frac_pll(hw); |
| 157 | u32 val, divfi, divff; | 157 | u32 val, divfi, divff; |
| 158 | u64 temp64 = parent_rate; | 158 | u64 temp64; |
| 159 | int ret; | 159 | int ret; |
| 160 | 160 | ||
| 161 | parent_rate *= 8; | 161 | parent_rate *= 8; |
| 162 | rate *= 2; | 162 | rate *= 2; |
| 163 | divfi = rate / parent_rate; | 163 | divfi = rate / parent_rate; |
| 164 | temp64 *= rate - divfi; | 164 | temp64 = parent_rate * divfi; |
| 165 | temp64 = rate - temp64; | ||
| 165 | temp64 *= PLL_FRAC_DENOM; | 166 | temp64 *= PLL_FRAC_DENOM; |
| 166 | do_div(temp64, parent_rate); | 167 | do_div(temp64, parent_rate); |
| 167 | divff = temp64; | 168 | divff = temp64; |
diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c index 99c2508de8e5..fb6edf1b8aa2 100644 --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c | |||
| @@ -169,6 +169,8 @@ static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev) | |||
| 169 | return -ENODEV; | 169 | return -ENODEV; |
| 170 | 170 | ||
| 171 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 171 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 172 | if (!res) | ||
| 173 | return -EINVAL; | ||
| 172 | base = devm_ioremap(dev, res->start, resource_size(res)); | 174 | base = devm_ioremap(dev, res->start, resource_size(res)); |
| 173 | if (!base) | 175 | if (!base) |
| 174 | return -ENOMEM; | 176 | return -ENOMEM; |
diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c index 61fefc046ec5..d083b860f083 100644 --- a/drivers/clk/mmp/clk-of-mmp2.c +++ b/drivers/clk/mmp/clk-of-mmp2.c | |||
| @@ -53,7 +53,6 @@ | |||
| 53 | #define APMU_DISP1 0x110 | 53 | #define APMU_DISP1 0x110 |
| 54 | #define APMU_CCIC0 0x50 | 54 | #define APMU_CCIC0 0x50 |
| 55 | #define APMU_CCIC1 0xf4 | 55 | #define APMU_CCIC1 0xf4 |
| 56 | #define APMU_SP 0x68 | ||
| 57 | #define MPMU_UART_PLL 0x14 | 56 | #define MPMU_UART_PLL 0x14 |
| 58 | 57 | ||
| 59 | struct mmp2_clk_unit { | 58 | struct mmp2_clk_unit { |
| @@ -210,8 +209,6 @@ static struct mmp_clk_mix_config ccic1_mix_config = { | |||
| 210 | .reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32), | 209 | .reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32), |
| 211 | }; | 210 | }; |
| 212 | 211 | ||
| 213 | static DEFINE_SPINLOCK(sp_lock); | ||
| 214 | |||
| 215 | static struct mmp_param_mux_clk apmu_mux_clks[] = { | 212 | static struct mmp_param_mux_clk apmu_mux_clks[] = { |
| 216 | {MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock}, | 213 | {MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock}, |
| 217 | {MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock}, | 214 | {MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock}, |
| @@ -242,7 +239,6 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = { | |||
| 242 | {MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock}, | 239 | {MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock}, |
| 243 | {MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock}, | 240 | {MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock}, |
| 244 | {MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock}, | 241 | {MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock}, |
| 245 | {MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock}, | ||
| 246 | }; | 242 | }; |
| 247 | 243 | ||
| 248 | static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit) | 244 | static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit) |
diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 1b1ba54e33dd..1c04575c118f 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig | |||
| @@ -215,6 +215,7 @@ config MSM_MMCC_8996 | |||
| 215 | 215 | ||
| 216 | config MSM_GCC_8998 | 216 | config MSM_GCC_8998 |
| 217 | tristate "MSM8998 Global Clock Controller" | 217 | tristate "MSM8998 Global Clock Controller" |
| 218 | select QCOM_GDSC | ||
| 218 | help | 219 | help |
| 219 | Support for the global clock controller on msm8998 devices. | 220 | Support for the global clock controller on msm8998 devices. |
| 220 | Say Y if you want to use peripheral devices such as UART, SPI, | 221 | Say Y if you want to use peripheral devices such as UART, SPI, |
diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c index c782e62dd98b..58fa5c247af1 100644 --- a/drivers/clk/qcom/gcc-sdm845.c +++ b/drivers/clk/qcom/gcc-sdm845.c | |||
| @@ -115,8 +115,8 @@ static const char * const gcc_parent_names_6[] = { | |||
| 115 | "core_bi_pll_test_se", | 115 | "core_bi_pll_test_se", |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | static const char * const gcc_parent_names_7[] = { | 118 | static const char * const gcc_parent_names_7_ao[] = { |
| 119 | "bi_tcxo", | 119 | "bi_tcxo_ao", |
| 120 | "gpll0", | 120 | "gpll0", |
| 121 | "gpll0_out_even", | 121 | "gpll0_out_even", |
| 122 | "core_bi_pll_test_se", | 122 | "core_bi_pll_test_se", |
| @@ -128,6 +128,12 @@ static const char * const gcc_parent_names_8[] = { | |||
| 128 | "core_bi_pll_test_se", | 128 | "core_bi_pll_test_se", |
| 129 | }; | 129 | }; |
| 130 | 130 | ||
| 131 | static const char * const gcc_parent_names_8_ao[] = { | ||
| 132 | "bi_tcxo_ao", | ||
| 133 | "gpll0", | ||
| 134 | "core_bi_pll_test_se", | ||
| 135 | }; | ||
| 136 | |||
| 131 | static const struct parent_map gcc_parent_map_10[] = { | 137 | static const struct parent_map gcc_parent_map_10[] = { |
| 132 | { P_BI_TCXO, 0 }, | 138 | { P_BI_TCXO, 0 }, |
| 133 | { P_GPLL0_OUT_MAIN, 1 }, | 139 | { P_GPLL0_OUT_MAIN, 1 }, |
| @@ -210,7 +216,7 @@ static struct clk_rcg2 gcc_cpuss_ahb_clk_src = { | |||
| 210 | .freq_tbl = ftbl_gcc_cpuss_ahb_clk_src, | 216 | .freq_tbl = ftbl_gcc_cpuss_ahb_clk_src, |
| 211 | .clkr.hw.init = &(struct clk_init_data){ | 217 | .clkr.hw.init = &(struct clk_init_data){ |
| 212 | .name = "gcc_cpuss_ahb_clk_src", | 218 | .name = "gcc_cpuss_ahb_clk_src", |
| 213 | .parent_names = gcc_parent_names_7, | 219 | .parent_names = gcc_parent_names_7_ao, |
| 214 | .num_parents = 4, | 220 | .num_parents = 4, |
| 215 | .ops = &clk_rcg2_ops, | 221 | .ops = &clk_rcg2_ops, |
| 216 | }, | 222 | }, |
| @@ -229,7 +235,7 @@ static struct clk_rcg2 gcc_cpuss_rbcpr_clk_src = { | |||
| 229 | .freq_tbl = ftbl_gcc_cpuss_rbcpr_clk_src, | 235 | .freq_tbl = ftbl_gcc_cpuss_rbcpr_clk_src, |
| 230 | .clkr.hw.init = &(struct clk_init_data){ | 236 | .clkr.hw.init = &(struct clk_init_data){ |
| 231 | .name = "gcc_cpuss_rbcpr_clk_src", | 237 | .name = "gcc_cpuss_rbcpr_clk_src", |
| 232 | .parent_names = gcc_parent_names_8, | 238 | .parent_names = gcc_parent_names_8_ao, |
| 233 | .num_parents = 3, | 239 | .num_parents = 3, |
| 234 | .ops = &clk_rcg2_ops, | 240 | .ops = &clk_rcg2_ops, |
| 235 | }, | 241 | }, |
diff --git a/drivers/clk/socfpga/clk-pll-s10.c b/drivers/clk/socfpga/clk-pll-s10.c index 2d5d8b43727e..c4d0b6f6abf2 100644 --- a/drivers/clk/socfpga/clk-pll-s10.c +++ b/drivers/clk/socfpga/clk-pll-s10.c | |||
| @@ -43,7 +43,7 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hwclk, | |||
| 43 | /* Read mdiv and fdiv from the fdbck register */ | 43 | /* Read mdiv and fdiv from the fdbck register */ |
| 44 | reg = readl(socfpgaclk->hw.reg + 0x4); | 44 | reg = readl(socfpgaclk->hw.reg + 0x4); |
| 45 | mdiv = (reg & SOCFPGA_PLL_MDIV_MASK) >> SOCFPGA_PLL_MDIV_SHIFT; | 45 | mdiv = (reg & SOCFPGA_PLL_MDIV_MASK) >> SOCFPGA_PLL_MDIV_SHIFT; |
| 46 | vco_freq = (unsigned long long)parent_rate * (mdiv + 6); | 46 | vco_freq = (unsigned long long)vco_freq * (mdiv + 6); |
| 47 | 47 | ||
| 48 | return (unsigned long)vco_freq; | 48 | return (unsigned long)vco_freq; |
| 49 | } | 49 | } |
diff --git a/drivers/clk/socfpga/clk-s10.c b/drivers/clk/socfpga/clk-s10.c index 5b238fc314ac..8281dfbf38c2 100644 --- a/drivers/clk/socfpga/clk-s10.c +++ b/drivers/clk/socfpga/clk-s10.c | |||
| @@ -12,17 +12,17 @@ | |||
| 12 | 12 | ||
| 13 | #include "stratix10-clk.h" | 13 | #include "stratix10-clk.h" |
| 14 | 14 | ||
| 15 | static const char * const pll_mux[] = { "osc1", "cb_intosc_hs_div2_clk", | 15 | static const char * const pll_mux[] = { "osc1", "cb-intosc-hs-div2-clk", |
| 16 | "f2s_free_clk",}; | 16 | "f2s-free-clk",}; |
| 17 | static const char * const cntr_mux[] = { "main_pll", "periph_pll", | 17 | static const char * const cntr_mux[] = { "main_pll", "periph_pll", |
| 18 | "osc1", "cb_intosc_hs_div2_clk", | 18 | "osc1", "cb-intosc-hs-div2-clk", |
| 19 | "f2s_free_clk"}; | 19 | "f2s-free-clk"}; |
| 20 | static const char * const boot_mux[] = { "osc1", "cb_intosc_hs_div2_clk",}; | 20 | static const char * const boot_mux[] = { "osc1", "cb-intosc-hs-div2-clk",}; |
| 21 | 21 | ||
| 22 | static const char * const noc_free_mux[] = {"main_noc_base_clk", | 22 | static const char * const noc_free_mux[] = {"main_noc_base_clk", |
| 23 | "peri_noc_base_clk", | 23 | "peri_noc_base_clk", |
| 24 | "osc1", "cb_intosc_hs_div2_clk", | 24 | "osc1", "cb-intosc-hs-div2-clk", |
| 25 | "f2s_free_clk"}; | 25 | "f2s-free-clk"}; |
| 26 | 26 | ||
| 27 | static const char * const emaca_free_mux[] = {"peri_emaca_clk", "boot_clk"}; | 27 | static const char * const emaca_free_mux[] = {"peri_emaca_clk", "boot_clk"}; |
| 28 | static const char * const emacb_free_mux[] = {"peri_emacb_clk", "boot_clk"}; | 28 | static const char * const emacb_free_mux[] = {"peri_emacb_clk", "boot_clk"}; |
| @@ -33,14 +33,14 @@ static const char * const s2f_usr1_free_mux[] = {"peri_s2f_usr1_clk", "boot_clk" | |||
| 33 | static const char * const psi_ref_free_mux[] = {"peri_psi_ref_clk", "boot_clk"}; | 33 | static const char * const psi_ref_free_mux[] = {"peri_psi_ref_clk", "boot_clk"}; |
| 34 | static const char * const mpu_mux[] = { "mpu_free_clk", "boot_clk",}; | 34 | static const char * const mpu_mux[] = { "mpu_free_clk", "boot_clk",}; |
| 35 | 35 | ||
| 36 | static const char * const s2f_usr0_mux[] = {"f2s_free_clk", "boot_clk"}; | 36 | static const char * const s2f_usr0_mux[] = {"f2s-free-clk", "boot_clk"}; |
| 37 | static const char * const emac_mux[] = {"emaca_free_clk", "emacb_free_clk"}; | 37 | static const char * const emac_mux[] = {"emaca_free_clk", "emacb_free_clk"}; |
| 38 | static const char * const noc_mux[] = {"noc_free_clk", "boot_clk"}; | 38 | static const char * const noc_mux[] = {"noc_free_clk", "boot_clk"}; |
| 39 | 39 | ||
| 40 | static const char * const mpu_free_mux[] = {"main_mpu_base_clk", | 40 | static const char * const mpu_free_mux[] = {"main_mpu_base_clk", |
| 41 | "peri_mpu_base_clk", | 41 | "peri_mpu_base_clk", |
| 42 | "osc1", "cb_intosc_hs_div2_clk", | 42 | "osc1", "cb-intosc-hs-div2-clk", |
| 43 | "f2s_free_clk"}; | 43 | "f2s-free-clk"}; |
| 44 | 44 | ||
| 45 | /* clocks in AO (always on) controller */ | 45 | /* clocks in AO (always on) controller */ |
| 46 | static const struct stratix10_pll_clock s10_pll_clks[] = { | 46 | static const struct stratix10_pll_clock s10_pll_clks[] = { |
diff --git a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c index 269d3595758b..edc31bb56674 100644 --- a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c +++ b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | |||
| @@ -133,9 +133,11 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev) | |||
| 133 | struct tegra_dfll_soc_data *soc; | 133 | struct tegra_dfll_soc_data *soc; |
| 134 | 134 | ||
| 135 | soc = tegra_dfll_unregister(pdev); | 135 | soc = tegra_dfll_unregister(pdev); |
| 136 | if (IS_ERR(soc)) | 136 | if (IS_ERR(soc)) { |
| 137 | dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n", | 137 | dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n", |
| 138 | PTR_ERR(soc)); | 138 | PTR_ERR(soc)); |
| 139 | return PTR_ERR(soc); | ||
| 140 | } | ||
| 139 | 141 | ||
| 140 | tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq); | 142 | tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq); |
| 141 | 143 | ||
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index 8d77090ad94a..0241450f3eb3 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c | |||
| @@ -403,8 +403,10 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div, | |||
| 403 | num_dividers = i; | 403 | num_dividers = i; |
| 404 | 404 | ||
| 405 | tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); | 405 | tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); |
| 406 | if (!tmp) | 406 | if (!tmp) { |
| 407 | *table = ERR_PTR(-ENOMEM); | ||
| 407 | return -ENOMEM; | 408 | return -ENOMEM; |
| 409 | } | ||
| 408 | 410 | ||
| 409 | valid_div = 0; | 411 | valid_div = 0; |
| 410 | *width = 0; | 412 | *width = 0; |
| @@ -439,6 +441,7 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) | |||
| 439 | { | 441 | { |
| 440 | struct clk_omap_divider *div; | 442 | struct clk_omap_divider *div; |
| 441 | struct clk_omap_reg *reg; | 443 | struct clk_omap_reg *reg; |
| 444 | int ret; | ||
| 442 | 445 | ||
| 443 | if (!setup) | 446 | if (!setup) |
| 444 | return NULL; | 447 | return NULL; |
| @@ -458,6 +461,12 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) | |||
| 458 | div->flags |= CLK_DIVIDER_POWER_OF_TWO; | 461 | div->flags |= CLK_DIVIDER_POWER_OF_TWO; |
| 459 | 462 | ||
| 460 | div->table = _get_div_table_from_setup(setup, &div->width); | 463 | div->table = _get_div_table_from_setup(setup, &div->width); |
| 464 | if (IS_ERR(div->table)) { | ||
| 465 | ret = PTR_ERR(div->table); | ||
| 466 | kfree(div); | ||
| 467 | return ERR_PTR(ret); | ||
| 468 | } | ||
| 469 | |||
| 461 | 470 | ||
| 462 | div->shift = setup->bit_shift; | 471 | div->shift = setup->bit_shift; |
| 463 | div->latch = -EINVAL; | 472 | div->latch = -EINVAL; |
diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c index f65cc0ff76ab..b0908ec62f73 100644 --- a/drivers/clk/zynqmp/clkc.c +++ b/drivers/clk/zynqmp/clkc.c | |||
| @@ -669,8 +669,8 @@ static int zynqmp_clk_setup(struct device_node *np) | |||
| 669 | if (ret) | 669 | if (ret) |
| 670 | return ret; | 670 | return ret; |
| 671 | 671 | ||
| 672 | zynqmp_data = kzalloc(sizeof(*zynqmp_data) + sizeof(*zynqmp_data) * | 672 | zynqmp_data = kzalloc(struct_size(zynqmp_data, hws, clock_max_idx), |
| 673 | clock_max_idx, GFP_KERNEL); | 673 | GFP_KERNEL); |
| 674 | if (!zynqmp_data) | 674 | if (!zynqmp_data) |
| 675 | return -ENOMEM; | 675 | return -ENOMEM; |
| 676 | 676 | ||
diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c index b17d153e724f..23a1b27579a5 100644 --- a/drivers/cpuidle/poll_state.c +++ b/drivers/cpuidle/poll_state.c | |||
| @@ -21,7 +21,7 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev, | |||
| 21 | local_irq_enable(); | 21 | local_irq_enable(); |
| 22 | if (!current_set_polling_and_test()) { | 22 | if (!current_set_polling_and_test()) { |
| 23 | unsigned int loop_count = 0; | 23 | unsigned int loop_count = 0; |
| 24 | u64 limit = TICK_USEC; | 24 | u64 limit = TICK_NSEC; |
| 25 | int i; | 25 | int i; |
| 26 | 26 | ||
| 27 | for (i = 1; i < drv->state_count; i++) { | 27 | for (i = 1; i < drv->state_count; i++) { |
diff --git a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c index fe070d75c842..4c97478d44bd 100644 --- a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c +++ b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c | |||
| @@ -537,6 +537,8 @@ static void process_response_list(struct nitrox_cmdq *cmdq) | |||
| 537 | struct nitrox_device *ndev = cmdq->ndev; | 537 | struct nitrox_device *ndev = cmdq->ndev; |
| 538 | struct nitrox_softreq *sr; | 538 | struct nitrox_softreq *sr; |
| 539 | int req_completed = 0, err = 0, budget; | 539 | int req_completed = 0, err = 0, budget; |
| 540 | completion_t callback; | ||
| 541 | void *cb_arg; | ||
| 540 | 542 | ||
| 541 | /* check all pending requests */ | 543 | /* check all pending requests */ |
| 542 | budget = atomic_read(&cmdq->pending_count); | 544 | budget = atomic_read(&cmdq->pending_count); |
| @@ -564,13 +566,13 @@ static void process_response_list(struct nitrox_cmdq *cmdq) | |||
| 564 | smp_mb__after_atomic(); | 566 | smp_mb__after_atomic(); |
| 565 | /* remove from response list */ | 567 | /* remove from response list */ |
| 566 | response_list_del(sr, cmdq); | 568 | response_list_del(sr, cmdq); |
| 567 | |||
| 568 | /* ORH error code */ | 569 | /* ORH error code */ |
| 569 | err = READ_ONCE(*sr->resp.orh) & 0xff; | 570 | err = READ_ONCE(*sr->resp.orh) & 0xff; |
| 570 | 571 | callback = sr->callback; | |
| 571 | if (sr->callback) | 572 | cb_arg = sr->cb_arg; |
| 572 | sr->callback(sr->cb_arg, err); | ||
| 573 | softreq_destroy(sr); | 573 | softreq_destroy(sr); |
| 574 | if (callback) | ||
| 575 | callback(cb_arg, err); | ||
| 574 | 576 | ||
| 575 | req_completed++; | 577 | req_completed++; |
| 576 | } | 578 | } |
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 4e557684f792..fe69dccfa0c0 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c | |||
| @@ -203,6 +203,7 @@ struct at_xdmac_chan { | |||
| 203 | u32 save_cim; | 203 | u32 save_cim; |
| 204 | u32 save_cnda; | 204 | u32 save_cnda; |
| 205 | u32 save_cndc; | 205 | u32 save_cndc; |
| 206 | u32 irq_status; | ||
| 206 | unsigned long status; | 207 | unsigned long status; |
| 207 | struct tasklet_struct tasklet; | 208 | struct tasklet_struct tasklet; |
| 208 | struct dma_slave_config sconfig; | 209 | struct dma_slave_config sconfig; |
| @@ -1580,8 +1581,8 @@ static void at_xdmac_tasklet(unsigned long data) | |||
| 1580 | struct at_xdmac_desc *desc; | 1581 | struct at_xdmac_desc *desc; |
| 1581 | u32 error_mask; | 1582 | u32 error_mask; |
| 1582 | 1583 | ||
| 1583 | dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08lx\n", | 1584 | dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08x\n", |
| 1584 | __func__, atchan->status); | 1585 | __func__, atchan->irq_status); |
| 1585 | 1586 | ||
| 1586 | error_mask = AT_XDMAC_CIS_RBEIS | 1587 | error_mask = AT_XDMAC_CIS_RBEIS |
| 1587 | | AT_XDMAC_CIS_WBEIS | 1588 | | AT_XDMAC_CIS_WBEIS |
| @@ -1589,15 +1590,15 @@ static void at_xdmac_tasklet(unsigned long data) | |||
| 1589 | 1590 | ||
| 1590 | if (at_xdmac_chan_is_cyclic(atchan)) { | 1591 | if (at_xdmac_chan_is_cyclic(atchan)) { |
| 1591 | at_xdmac_handle_cyclic(atchan); | 1592 | at_xdmac_handle_cyclic(atchan); |
| 1592 | } else if ((atchan->status & AT_XDMAC_CIS_LIS) | 1593 | } else if ((atchan->irq_status & AT_XDMAC_CIS_LIS) |
| 1593 | || (atchan->status & error_mask)) { | 1594 | || (atchan->irq_status & error_mask)) { |
| 1594 | struct dma_async_tx_descriptor *txd; | 1595 | struct dma_async_tx_descriptor *txd; |
| 1595 | 1596 | ||
| 1596 | if (atchan->status & AT_XDMAC_CIS_RBEIS) | 1597 | if (atchan->irq_status & AT_XDMAC_CIS_RBEIS) |
| 1597 | dev_err(chan2dev(&atchan->chan), "read bus error!!!"); | 1598 | dev_err(chan2dev(&atchan->chan), "read bus error!!!"); |
| 1598 | if (atchan->status & AT_XDMAC_CIS_WBEIS) | 1599 | if (atchan->irq_status & AT_XDMAC_CIS_WBEIS) |
| 1599 | dev_err(chan2dev(&atchan->chan), "write bus error!!!"); | 1600 | dev_err(chan2dev(&atchan->chan), "write bus error!!!"); |
| 1600 | if (atchan->status & AT_XDMAC_CIS_ROIS) | 1601 | if (atchan->irq_status & AT_XDMAC_CIS_ROIS) |
| 1601 | dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); | 1602 | dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); |
| 1602 | 1603 | ||
| 1603 | spin_lock(&atchan->lock); | 1604 | spin_lock(&atchan->lock); |
| @@ -1652,7 +1653,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) | |||
| 1652 | atchan = &atxdmac->chan[i]; | 1653 | atchan = &atxdmac->chan[i]; |
| 1653 | chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); | 1654 | chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); |
| 1654 | chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); | 1655 | chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); |
| 1655 | atchan->status = chan_status & chan_imr; | 1656 | atchan->irq_status = chan_status & chan_imr; |
| 1656 | dev_vdbg(atxdmac->dma.dev, | 1657 | dev_vdbg(atxdmac->dma.dev, |
| 1657 | "%s: chan%d: imr=0x%x, status=0x%x\n", | 1658 | "%s: chan%d: imr=0x%x, status=0x%x\n", |
| 1658 | __func__, i, chan_imr, chan_status); | 1659 | __func__, i, chan_imr, chan_status); |
| @@ -1666,7 +1667,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) | |||
| 1666 | at_xdmac_chan_read(atchan, AT_XDMAC_CDA), | 1667 | at_xdmac_chan_read(atchan, AT_XDMAC_CDA), |
| 1667 | at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); | 1668 | at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); |
| 1668 | 1669 | ||
| 1669 | if (atchan->status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) | 1670 | if (atchan->irq_status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) |
| 1670 | at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); | 1671 | at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); |
| 1671 | 1672 | ||
| 1672 | tasklet_schedule(&atchan->tasklet); | 1673 | tasklet_schedule(&atchan->tasklet); |
diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 1a44c8086d77..ae10f5614f95 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c | |||
| @@ -406,38 +406,32 @@ static void bcm2835_dma_fill_cb_chain_with_sg( | |||
| 406 | } | 406 | } |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | static int bcm2835_dma_abort(void __iomem *chan_base) | 409 | static int bcm2835_dma_abort(struct bcm2835_chan *c) |
| 410 | { | 410 | { |
| 411 | unsigned long cs; | 411 | void __iomem *chan_base = c->chan_base; |
| 412 | long int timeout = 10000; | 412 | long int timeout = 10000; |
| 413 | 413 | ||
| 414 | cs = readl(chan_base + BCM2835_DMA_CS); | 414 | /* |
| 415 | if (!(cs & BCM2835_DMA_ACTIVE)) | 415 | * A zero control block address means the channel is idle. |
| 416 | * (The ACTIVE flag in the CS register is not a reliable indicator.) | ||
| 417 | */ | ||
| 418 | if (!readl(chan_base + BCM2835_DMA_ADDR)) | ||
| 416 | return 0; | 419 | return 0; |
| 417 | 420 | ||
| 418 | /* Write 0 to the active bit - Pause the DMA */ | 421 | /* Write 0 to the active bit - Pause the DMA */ |
| 419 | writel(0, chan_base + BCM2835_DMA_CS); | 422 | writel(0, chan_base + BCM2835_DMA_CS); |
| 420 | 423 | ||
| 421 | /* Wait for any current AXI transfer to complete */ | 424 | /* Wait for any current AXI transfer to complete */ |
| 422 | while ((cs & BCM2835_DMA_ISPAUSED) && --timeout) { | 425 | while ((readl(chan_base + BCM2835_DMA_CS) & |
| 426 | BCM2835_DMA_WAITING_FOR_WRITES) && --timeout) | ||
| 423 | cpu_relax(); | 427 | cpu_relax(); |
| 424 | cs = readl(chan_base + BCM2835_DMA_CS); | ||
| 425 | } | ||
| 426 | 428 | ||
| 427 | /* We'll un-pause when we set of our next DMA */ | 429 | /* Peripheral might be stuck and fail to signal AXI write responses */ |
| 428 | if (!timeout) | 430 | if (!timeout) |
| 429 | return -ETIMEDOUT; | 431 | dev_err(c->vc.chan.device->dev, |
| 430 | 432 | "failed to complete outstanding writes\n"); | |
| 431 | if (!(cs & BCM2835_DMA_ACTIVE)) | ||
| 432 | return 0; | ||
| 433 | |||
| 434 | /* Terminate the control block chain */ | ||
| 435 | writel(0, chan_base + BCM2835_DMA_NEXTCB); | ||
| 436 | |||
| 437 | /* Abort the whole DMA */ | ||
| 438 | writel(BCM2835_DMA_ABORT | BCM2835_DMA_ACTIVE, | ||
| 439 | chan_base + BCM2835_DMA_CS); | ||
| 440 | 433 | ||
| 434 | writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS); | ||
| 441 | return 0; | 435 | return 0; |
| 442 | } | 436 | } |
| 443 | 437 | ||
| @@ -476,8 +470,15 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) | |||
| 476 | 470 | ||
| 477 | spin_lock_irqsave(&c->vc.lock, flags); | 471 | spin_lock_irqsave(&c->vc.lock, flags); |
| 478 | 472 | ||
| 479 | /* Acknowledge interrupt */ | 473 | /* |
| 480 | writel(BCM2835_DMA_INT, c->chan_base + BCM2835_DMA_CS); | 474 | * Clear the INT flag to receive further interrupts. Keep the channel |
| 475 | * active in case the descriptor is cyclic or in case the client has | ||
| 476 | * already terminated the descriptor and issued a new one. (May happen | ||
| 477 | * if this IRQ handler is threaded.) If the channel is finished, it | ||
| 478 | * will remain idle despite the ACTIVE flag being set. | ||
| 479 | */ | ||
| 480 | writel(BCM2835_DMA_INT | BCM2835_DMA_ACTIVE, | ||
| 481 | c->chan_base + BCM2835_DMA_CS); | ||
| 481 | 482 | ||
| 482 | d = c->desc; | 483 | d = c->desc; |
| 483 | 484 | ||
| @@ -485,11 +486,7 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) | |||
| 485 | if (d->cyclic) { | 486 | if (d->cyclic) { |
| 486 | /* call the cyclic callback */ | 487 | /* call the cyclic callback */ |
| 487 | vchan_cyclic_callback(&d->vd); | 488 | vchan_cyclic_callback(&d->vd); |
| 488 | 489 | } else if (!readl(c->chan_base + BCM2835_DMA_ADDR)) { | |
| 489 | /* Keep the DMA engine running */ | ||
| 490 | writel(BCM2835_DMA_ACTIVE, | ||
| 491 | c->chan_base + BCM2835_DMA_CS); | ||
| 492 | } else { | ||
| 493 | vchan_cookie_complete(&c->desc->vd); | 490 | vchan_cookie_complete(&c->desc->vd); |
| 494 | bcm2835_dma_start_desc(c); | 491 | bcm2835_dma_start_desc(c); |
| 495 | } | 492 | } |
| @@ -779,7 +776,6 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) | |||
| 779 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); | 776 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); |
| 780 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); | 777 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); |
| 781 | unsigned long flags; | 778 | unsigned long flags; |
| 782 | int timeout = 10000; | ||
| 783 | LIST_HEAD(head); | 779 | LIST_HEAD(head); |
| 784 | 780 | ||
| 785 | spin_lock_irqsave(&c->vc.lock, flags); | 781 | spin_lock_irqsave(&c->vc.lock, flags); |
| @@ -789,27 +785,11 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) | |||
| 789 | list_del_init(&c->node); | 785 | list_del_init(&c->node); |
| 790 | spin_unlock(&d->lock); | 786 | spin_unlock(&d->lock); |
| 791 | 787 | ||
| 792 | /* | 788 | /* stop DMA activity */ |
| 793 | * Stop DMA activity: we assume the callback will not be called | ||
| 794 | * after bcm_dma_abort() returns (even if it does, it will see | ||
| 795 | * c->desc is NULL and exit.) | ||
| 796 | */ | ||
| 797 | if (c->desc) { | 789 | if (c->desc) { |
| 798 | vchan_terminate_vdesc(&c->desc->vd); | 790 | vchan_terminate_vdesc(&c->desc->vd); |
| 799 | c->desc = NULL; | 791 | c->desc = NULL; |
| 800 | bcm2835_dma_abort(c->chan_base); | 792 | bcm2835_dma_abort(c); |
| 801 | |||
| 802 | /* Wait for stopping */ | ||
| 803 | while (--timeout) { | ||
| 804 | if (!(readl(c->chan_base + BCM2835_DMA_CS) & | ||
| 805 | BCM2835_DMA_ACTIVE)) | ||
| 806 | break; | ||
| 807 | |||
| 808 | cpu_relax(); | ||
| 809 | } | ||
| 810 | |||
| 811 | if (!timeout) | ||
| 812 | dev_err(d->ddev.dev, "DMA transfer could not be terminated\n"); | ||
| 813 | } | 793 | } |
| 814 | 794 | ||
| 815 | vchan_get_all_descriptors(&c->vc, &head); | 795 | vchan_get_all_descriptors(&c->vc, &head); |
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 2eea4ef72915..6511928b4cdf 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
| @@ -711,11 +711,9 @@ static int dmatest_func(void *data) | |||
| 711 | srcs[i] = um->addr[i] + src_off; | 711 | srcs[i] = um->addr[i] + src_off; |
| 712 | ret = dma_mapping_error(dev->dev, um->addr[i]); | 712 | ret = dma_mapping_error(dev->dev, um->addr[i]); |
| 713 | if (ret) { | 713 | if (ret) { |
| 714 | dmaengine_unmap_put(um); | ||
| 715 | result("src mapping error", total_tests, | 714 | result("src mapping error", total_tests, |
| 716 | src_off, dst_off, len, ret); | 715 | src_off, dst_off, len, ret); |
| 717 | failed_tests++; | 716 | goto error_unmap_continue; |
| 718 | continue; | ||
| 719 | } | 717 | } |
| 720 | um->to_cnt++; | 718 | um->to_cnt++; |
| 721 | } | 719 | } |
| @@ -730,11 +728,9 @@ static int dmatest_func(void *data) | |||
| 730 | DMA_BIDIRECTIONAL); | 728 | DMA_BIDIRECTIONAL); |
| 731 | ret = dma_mapping_error(dev->dev, dsts[i]); | 729 | ret = dma_mapping_error(dev->dev, dsts[i]); |
| 732 | if (ret) { | 730 | if (ret) { |
| 733 | dmaengine_unmap_put(um); | ||
| 734 | result("dst mapping error", total_tests, | 731 | result("dst mapping error", total_tests, |
| 735 | src_off, dst_off, len, ret); | 732 | src_off, dst_off, len, ret); |
| 736 | failed_tests++; | 733 | goto error_unmap_continue; |
| 737 | continue; | ||
| 738 | } | 734 | } |
| 739 | um->bidi_cnt++; | 735 | um->bidi_cnt++; |
| 740 | } | 736 | } |
| @@ -762,12 +758,10 @@ static int dmatest_func(void *data) | |||
| 762 | } | 758 | } |
| 763 | 759 | ||
| 764 | if (!tx) { | 760 | if (!tx) { |
| 765 | dmaengine_unmap_put(um); | ||
| 766 | result("prep error", total_tests, src_off, | 761 | result("prep error", total_tests, src_off, |
| 767 | dst_off, len, ret); | 762 | dst_off, len, ret); |
| 768 | msleep(100); | 763 | msleep(100); |
| 769 | failed_tests++; | 764 | goto error_unmap_continue; |
| 770 | continue; | ||
| 771 | } | 765 | } |
| 772 | 766 | ||
| 773 | done->done = false; | 767 | done->done = false; |
| @@ -776,12 +770,10 @@ static int dmatest_func(void *data) | |||
| 776 | cookie = tx->tx_submit(tx); | 770 | cookie = tx->tx_submit(tx); |
| 777 | 771 | ||
| 778 | if (dma_submit_error(cookie)) { | 772 | if (dma_submit_error(cookie)) { |
| 779 | dmaengine_unmap_put(um); | ||
| 780 | result("submit error", total_tests, src_off, | 773 | result("submit error", total_tests, src_off, |
| 781 | dst_off, len, ret); | 774 | dst_off, len, ret); |
| 782 | msleep(100); | 775 | msleep(100); |
| 783 | failed_tests++; | 776 | goto error_unmap_continue; |
| 784 | continue; | ||
| 785 | } | 777 | } |
| 786 | dma_async_issue_pending(chan); | 778 | dma_async_issue_pending(chan); |
| 787 | 779 | ||
| @@ -790,22 +782,20 @@ static int dmatest_func(void *data) | |||
| 790 | 782 | ||
| 791 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); | 783 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); |
| 792 | 784 | ||
| 793 | dmaengine_unmap_put(um); | ||
| 794 | |||
| 795 | if (!done->done) { | 785 | if (!done->done) { |
| 796 | result("test timed out", total_tests, src_off, dst_off, | 786 | result("test timed out", total_tests, src_off, dst_off, |
| 797 | len, 0); | 787 | len, 0); |
| 798 | failed_tests++; | 788 | goto error_unmap_continue; |
| 799 | continue; | ||
| 800 | } else if (status != DMA_COMPLETE) { | 789 | } else if (status != DMA_COMPLETE) { |
| 801 | result(status == DMA_ERROR ? | 790 | result(status == DMA_ERROR ? |
| 802 | "completion error status" : | 791 | "completion error status" : |
| 803 | "completion busy status", total_tests, src_off, | 792 | "completion busy status", total_tests, src_off, |
| 804 | dst_off, len, ret); | 793 | dst_off, len, ret); |
| 805 | failed_tests++; | 794 | goto error_unmap_continue; |
| 806 | continue; | ||
| 807 | } | 795 | } |
| 808 | 796 | ||
| 797 | dmaengine_unmap_put(um); | ||
| 798 | |||
| 809 | if (params->noverify) { | 799 | if (params->noverify) { |
| 810 | verbose_result("test passed", total_tests, src_off, | 800 | verbose_result("test passed", total_tests, src_off, |
| 811 | dst_off, len, 0); | 801 | dst_off, len, 0); |
| @@ -846,6 +836,12 @@ static int dmatest_func(void *data) | |||
| 846 | verbose_result("test passed", total_tests, src_off, | 836 | verbose_result("test passed", total_tests, src_off, |
| 847 | dst_off, len, 0); | 837 | dst_off, len, 0); |
| 848 | } | 838 | } |
| 839 | |||
| 840 | continue; | ||
| 841 | |||
| 842 | error_unmap_continue: | ||
| 843 | dmaengine_unmap_put(um); | ||
| 844 | failed_tests++; | ||
| 849 | } | 845 | } |
| 850 | ktime = ktime_sub(ktime_get(), ktime); | 846 | ktime = ktime_sub(ktime_get(), ktime); |
| 851 | ktime = ktime_sub(ktime, comparetime); | 847 | ktime = ktime_sub(ktime, comparetime); |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index c2fff3f6c9ca..4a09af3cd546 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
| @@ -618,7 +618,7 @@ static void imxdma_tasklet(unsigned long data) | |||
| 618 | { | 618 | { |
| 619 | struct imxdma_channel *imxdmac = (void *)data; | 619 | struct imxdma_channel *imxdmac = (void *)data; |
| 620 | struct imxdma_engine *imxdma = imxdmac->imxdma; | 620 | struct imxdma_engine *imxdma = imxdmac->imxdma; |
| 621 | struct imxdma_desc *desc; | 621 | struct imxdma_desc *desc, *next_desc; |
| 622 | unsigned long flags; | 622 | unsigned long flags; |
| 623 | 623 | ||
| 624 | spin_lock_irqsave(&imxdma->lock, flags); | 624 | spin_lock_irqsave(&imxdma->lock, flags); |
| @@ -648,10 +648,10 @@ static void imxdma_tasklet(unsigned long data) | |||
| 648 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); | 648 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); |
| 649 | 649 | ||
| 650 | if (!list_empty(&imxdmac->ld_queue)) { | 650 | if (!list_empty(&imxdmac->ld_queue)) { |
| 651 | desc = list_first_entry(&imxdmac->ld_queue, struct imxdma_desc, | 651 | next_desc = list_first_entry(&imxdmac->ld_queue, |
| 652 | node); | 652 | struct imxdma_desc, node); |
| 653 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); | 653 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); |
| 654 | if (imxdma_xfer_desc(desc) < 0) | 654 | if (imxdma_xfer_desc(next_desc) < 0) |
| 655 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", | 655 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", |
| 656 | __func__, imxdmac->channel); | 656 | __func__, imxdmac->channel); |
| 657 | } | 657 | } |
diff --git a/drivers/edac/altera_edac.h b/drivers/edac/altera_edac.h index 4213cb0bb2a7..f8664bac9fa8 100644 --- a/drivers/edac/altera_edac.h +++ b/drivers/edac/altera_edac.h | |||
| @@ -295,8 +295,8 @@ struct altr_sdram_mc_data { | |||
| 295 | #define S10_SYSMGR_ECC_INTSTAT_DERR_OFST 0xA0 | 295 | #define S10_SYSMGR_ECC_INTSTAT_DERR_OFST 0xA0 |
| 296 | 296 | ||
| 297 | /* Sticky registers for Uncorrected Errors */ | 297 | /* Sticky registers for Uncorrected Errors */ |
| 298 | #define S10_SYSMGR_UE_VAL_OFST 0x120 | 298 | #define S10_SYSMGR_UE_VAL_OFST 0x220 |
| 299 | #define S10_SYSMGR_UE_ADDR_OFST 0x124 | 299 | #define S10_SYSMGR_UE_ADDR_OFST 0x224 |
| 300 | 300 | ||
| 301 | #define S10_DDR0_IRQ_MASK BIT(16) | 301 | #define S10_DDR0_IRQ_MASK BIT(16) |
| 302 | 302 | ||
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 09b845e90114..a785ffd5af89 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
| @@ -1144,10 +1144,6 @@ static int sbp2_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) | |||
| 1144 | if (device->is_local) | 1144 | if (device->is_local) |
| 1145 | return -ENODEV; | 1145 | return -ENODEV; |
| 1146 | 1146 | ||
| 1147 | if (dma_get_max_seg_size(device->card->device) > SBP2_MAX_SEG_SIZE) | ||
| 1148 | WARN_ON(dma_set_max_seg_size(device->card->device, | ||
| 1149 | SBP2_MAX_SEG_SIZE)); | ||
| 1150 | |||
| 1151 | shost = scsi_host_alloc(&scsi_driver_template, sizeof(*tgt)); | 1147 | shost = scsi_host_alloc(&scsi_driver_template, sizeof(*tgt)); |
| 1152 | if (shost == NULL) | 1148 | if (shost == NULL) |
| 1153 | return -ENOMEM; | 1149 | return -ENOMEM; |
| @@ -1610,6 +1606,7 @@ static struct scsi_host_template scsi_driver_template = { | |||
| 1610 | .eh_abort_handler = sbp2_scsi_abort, | 1606 | .eh_abort_handler = sbp2_scsi_abort, |
| 1611 | .this_id = -1, | 1607 | .this_id = -1, |
| 1612 | .sg_tablesize = SG_ALL, | 1608 | .sg_tablesize = SG_ALL, |
| 1609 | .max_segment_size = SBP2_MAX_SEG_SIZE, | ||
| 1613 | .can_queue = 1, | 1610 | .can_queue = 1, |
| 1614 | .sdev_attrs = sbp2_scsi_sysfs_attrs, | 1611 | .sdev_attrs = sbp2_scsi_sysfs_attrs, |
| 1615 | }; | 1612 | }; |
diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 472c88ae1c0f..92f843eaf1e0 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c | |||
| @@ -119,6 +119,11 @@ void scmi_driver_unregister(struct scmi_driver *driver) | |||
| 119 | } | 119 | } |
| 120 | EXPORT_SYMBOL_GPL(scmi_driver_unregister); | 120 | EXPORT_SYMBOL_GPL(scmi_driver_unregister); |
| 121 | 121 | ||
| 122 | static void scmi_device_release(struct device *dev) | ||
| 123 | { | ||
| 124 | kfree(to_scmi_dev(dev)); | ||
| 125 | } | ||
| 126 | |||
| 122 | struct scmi_device * | 127 | struct scmi_device * |
| 123 | scmi_device_create(struct device_node *np, struct device *parent, int protocol) | 128 | scmi_device_create(struct device_node *np, struct device *parent, int protocol) |
| 124 | { | 129 | { |
| @@ -138,6 +143,7 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol) | |||
| 138 | scmi_dev->dev.parent = parent; | 143 | scmi_dev->dev.parent = parent; |
| 139 | scmi_dev->dev.of_node = np; | 144 | scmi_dev->dev.of_node = np; |
| 140 | scmi_dev->dev.bus = &scmi_bus_type; | 145 | scmi_dev->dev.bus = &scmi_bus_type; |
| 146 | scmi_dev->dev.release = scmi_device_release; | ||
| 141 | dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); | 147 | dev_set_name(&scmi_dev->dev, "scmi_dev.%d", id); |
| 142 | 148 | ||
| 143 | retval = device_register(&scmi_dev->dev); | 149 | retval = device_register(&scmi_dev->dev); |
| @@ -156,9 +162,8 @@ free_mem: | |||
| 156 | void scmi_device_destroy(struct scmi_device *scmi_dev) | 162 | void scmi_device_destroy(struct scmi_device *scmi_dev) |
| 157 | { | 163 | { |
| 158 | scmi_handle_put(scmi_dev->handle); | 164 | scmi_handle_put(scmi_dev->handle); |
| 159 | device_unregister(&scmi_dev->dev); | ||
| 160 | ida_simple_remove(&scmi_bus_id, scmi_dev->id); | 165 | ida_simple_remove(&scmi_bus_id, scmi_dev->id); |
| 161 | kfree(scmi_dev); | 166 | device_unregister(&scmi_dev->dev); |
| 162 | } | 167 | } |
| 163 | 168 | ||
| 164 | void scmi_set_handle(struct scmi_device *scmi_dev) | 169 | void scmi_set_handle(struct scmi_device *scmi_dev) |
diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 23ea1ed409d1..352bd2473162 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c | |||
| @@ -37,8 +37,9 @@ extern u64 efi_system_table; | |||
| 37 | static struct ptdump_info efi_ptdump_info = { | 37 | static struct ptdump_info efi_ptdump_info = { |
| 38 | .mm = &efi_mm, | 38 | .mm = &efi_mm, |
| 39 | .markers = (struct addr_marker[]){ | 39 | .markers = (struct addr_marker[]){ |
| 40 | { 0, "UEFI runtime start" }, | 40 | { 0, "UEFI runtime start" }, |
| 41 | { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" } | 41 | { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" }, |
| 42 | { -1, NULL } | ||
| 42 | }, | 43 | }, |
| 43 | .base_addr = 0, | 44 | .base_addr = 0, |
| 44 | }; | 45 | }; |
diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c index a1a09e04fab8..13851b3d1c56 100644 --- a/drivers/fpga/stratix10-soc.c +++ b/drivers/fpga/stratix10-soc.c | |||
| @@ -508,14 +508,11 @@ static int __init s10_init(void) | |||
| 508 | return -ENODEV; | 508 | return -ENODEV; |
| 509 | 509 | ||
| 510 | np = of_find_matching_node(fw_np, s10_of_match); | 510 | np = of_find_matching_node(fw_np, s10_of_match); |
| 511 | if (!np) { | 511 | if (!np) |
| 512 | of_node_put(fw_np); | ||
| 513 | return -ENODEV; | 512 | return -ENODEV; |
| 514 | } | ||
| 515 | 513 | ||
| 516 | of_node_put(np); | 514 | of_node_put(np); |
| 517 | ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL); | 515 | ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL); |
| 518 | of_node_put(fw_np); | ||
| 519 | if (ret) | 516 | if (ret) |
| 520 | return ret; | 517 | return ret; |
| 521 | 518 | ||
diff --git a/drivers/gpio/gpio-altera-a10sr.c b/drivers/gpio/gpio-altera-a10sr.c index 6b11f1314248..7f9e0304b510 100644 --- a/drivers/gpio/gpio-altera-a10sr.c +++ b/drivers/gpio/gpio-altera-a10sr.c | |||
| @@ -66,8 +66,10 @@ static int altr_a10sr_gpio_direction_input(struct gpio_chip *gc, | |||
| 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, | 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, |
| 67 | unsigned int nr, int value) | 67 | unsigned int nr, int value) |
| 68 | { | 68 | { |
| 69 | if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) | 69 | if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) { |
| 70 | altr_a10sr_gpio_set(gc, nr, value); | ||
| 70 | return 0; | 71 | return 0; |
| 72 | } | ||
| 71 | return -EINVAL; | 73 | return -EINVAL; |
| 72 | } | 74 | } |
| 73 | 75 | ||
diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c index e0d6a0a7bc69..e41223c05f6e 100644 --- a/drivers/gpio/gpio-eic-sprd.c +++ b/drivers/gpio/gpio-eic-sprd.c | |||
| @@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset) | |||
| 180 | 180 | ||
| 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) | 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) |
| 182 | { | 182 | { |
| 183 | return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | 183 | struct sprd_eic *sprd_eic = gpiochip_get_data(chip); |
| 184 | |||
| 185 | switch (sprd_eic->type) { | ||
| 186 | case SPRD_EIC_DEBOUNCE: | ||
| 187 | return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | ||
| 188 | case SPRD_EIC_ASYNC: | ||
| 189 | return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA); | ||
| 190 | case SPRD_EIC_SYNC: | ||
| 191 | return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA); | ||
| 192 | default: | ||
| 193 | return -ENOTSUPP; | ||
| 194 | } | ||
| 184 | } | 195 | } |
| 185 | 196 | ||
| 186 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) | 197 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) |
| @@ -368,6 +379,7 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) | |||
| 368 | irq_set_handler_locked(data, handle_edge_irq); | 379 | irq_set_handler_locked(data, handle_edge_irq); |
| 369 | break; | 380 | break; |
| 370 | case IRQ_TYPE_EDGE_BOTH: | 381 | case IRQ_TYPE_EDGE_BOTH: |
| 382 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); | ||
| 371 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); | 383 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); |
| 372 | irq_set_handler_locked(data, handle_edge_irq); | 384 | irq_set_handler_locked(data, handle_edge_irq); |
| 373 | break; | 385 | break; |
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index adf72dda25a2..68a35b65925a 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c | |||
| @@ -84,6 +84,7 @@ MODULE_DEVICE_TABLE(of, pcf857x_of_table); | |||
| 84 | */ | 84 | */ |
| 85 | struct pcf857x { | 85 | struct pcf857x { |
| 86 | struct gpio_chip chip; | 86 | struct gpio_chip chip; |
| 87 | struct irq_chip irqchip; | ||
| 87 | struct i2c_client *client; | 88 | struct i2c_client *client; |
| 88 | struct mutex lock; /* protect 'out' */ | 89 | struct mutex lock; /* protect 'out' */ |
| 89 | unsigned out; /* software latch */ | 90 | unsigned out; /* software latch */ |
| @@ -252,18 +253,6 @@ static void pcf857x_irq_bus_sync_unlock(struct irq_data *data) | |||
| 252 | mutex_unlock(&gpio->lock); | 253 | mutex_unlock(&gpio->lock); |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | static struct irq_chip pcf857x_irq_chip = { | ||
| 256 | .name = "pcf857x", | ||
| 257 | .irq_enable = pcf857x_irq_enable, | ||
| 258 | .irq_disable = pcf857x_irq_disable, | ||
| 259 | .irq_ack = noop, | ||
| 260 | .irq_mask = noop, | ||
| 261 | .irq_unmask = noop, | ||
| 262 | .irq_set_wake = pcf857x_irq_set_wake, | ||
| 263 | .irq_bus_lock = pcf857x_irq_bus_lock, | ||
| 264 | .irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | ||
| 265 | }; | ||
| 266 | |||
| 267 | /*-------------------------------------------------------------------------*/ | 256 | /*-------------------------------------------------------------------------*/ |
| 268 | 257 | ||
| 269 | static int pcf857x_probe(struct i2c_client *client, | 258 | static int pcf857x_probe(struct i2c_client *client, |
| @@ -376,8 +365,17 @@ static int pcf857x_probe(struct i2c_client *client, | |||
| 376 | 365 | ||
| 377 | /* Enable irqchip if we have an interrupt */ | 366 | /* Enable irqchip if we have an interrupt */ |
| 378 | if (client->irq) { | 367 | if (client->irq) { |
| 368 | gpio->irqchip.name = "pcf857x", | ||
| 369 | gpio->irqchip.irq_enable = pcf857x_irq_enable, | ||
| 370 | gpio->irqchip.irq_disable = pcf857x_irq_disable, | ||
| 371 | gpio->irqchip.irq_ack = noop, | ||
| 372 | gpio->irqchip.irq_mask = noop, | ||
| 373 | gpio->irqchip.irq_unmask = noop, | ||
| 374 | gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake, | ||
| 375 | gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock, | ||
| 376 | gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | ||
| 379 | status = gpiochip_irqchip_add_nested(&gpio->chip, | 377 | status = gpiochip_irqchip_add_nested(&gpio->chip, |
| 380 | &pcf857x_irq_chip, | 378 | &gpio->irqchip, |
| 381 | 0, handle_level_irq, | 379 | 0, handle_level_irq, |
| 382 | IRQ_TYPE_NONE); | 380 | IRQ_TYPE_NONE); |
| 383 | if (status) { | 381 | if (status) { |
| @@ -392,7 +390,7 @@ static int pcf857x_probe(struct i2c_client *client, | |||
| 392 | if (status) | 390 | if (status) |
| 393 | goto fail; | 391 | goto fail; |
| 394 | 392 | ||
| 395 | gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip, | 393 | gpiochip_set_nested_irqchip(&gpio->chip, &gpio->irqchip, |
| 396 | client->irq); | 394 | client->irq); |
| 397 | gpio->irq_parent = client->irq; | 395 | gpio->irq_parent = client->irq; |
| 398 | } | 396 | } |
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 1b79ebcfce3e..541fa6ac399d 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c | |||
| @@ -253,6 +253,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) | |||
| 253 | struct vf610_gpio_port *port; | 253 | struct vf610_gpio_port *port; |
| 254 | struct resource *iores; | 254 | struct resource *iores; |
| 255 | struct gpio_chip *gc; | 255 | struct gpio_chip *gc; |
| 256 | int i; | ||
| 256 | int ret; | 257 | int ret; |
| 257 | 258 | ||
| 258 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); | 259 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); |
| @@ -319,6 +320,10 @@ static int vf610_gpio_probe(struct platform_device *pdev) | |||
| 319 | if (ret < 0) | 320 | if (ret < 0) |
| 320 | return ret; | 321 | return ret; |
| 321 | 322 | ||
| 323 | /* Mask all GPIO interrupts */ | ||
| 324 | for (i = 0; i < gc->ngpio; i++) | ||
| 325 | vf610_gpio_writel(0, port->base + PORT_PCR(i)); | ||
| 326 | |||
| 322 | /* Clear the interrupt status register for all GPIO's */ | 327 | /* Clear the interrupt status register for all GPIO's */ |
| 323 | vf610_gpio_writel(~0, port->base + PORT_ISFR); | 328 | vf610_gpio_writel(~0, port->base + PORT_ISFR); |
| 324 | 329 | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 1651d7f0a303..d1adfdf50fb3 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -828,7 +828,14 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p) | |||
| 828 | /* Do not leak kernel stack to userspace */ | 828 | /* Do not leak kernel stack to userspace */ |
| 829 | memset(&ge, 0, sizeof(ge)); | 829 | memset(&ge, 0, sizeof(ge)); |
| 830 | 830 | ||
| 831 | ge.timestamp = le->timestamp; | 831 | /* |
| 832 | * We may be running from a nested threaded interrupt in which case | ||
| 833 | * we didn't get the timestamp from lineevent_irq_handler(). | ||
| 834 | */ | ||
| 835 | if (!le->timestamp) | ||
| 836 | ge.timestamp = ktime_get_real_ns(); | ||
| 837 | else | ||
| 838 | ge.timestamp = le->timestamp; | ||
| 832 | 839 | ||
| 833 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE | 840 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE |
| 834 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { | 841 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index a028661d9e20..92b11de19581 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | |||
| @@ -576,6 +576,7 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = { | |||
| 576 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 576 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 577 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 577 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 578 | { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 578 | { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 579 | { 0x1002, 0x6900, 0x17AA, 0x3806, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
| 579 | { 0, 0, 0, 0, 0 }, | 580 | { 0, 0, 0, 0, 0 }, |
| 580 | }; | 581 | }; |
| 581 | 582 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 6896dec97fc7..0ed41a9d2d77 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |||
| @@ -1686,7 +1686,8 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, | |||
| 1686 | effective_mode &= ~S_IWUSR; | 1686 | effective_mode &= ~S_IWUSR; |
| 1687 | 1687 | ||
| 1688 | if ((adev->flags & AMD_IS_APU) && | 1688 | if ((adev->flags & AMD_IS_APU) && |
| 1689 | (attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr || | 1689 | (attr == &sensor_dev_attr_power1_average.dev_attr.attr || |
| 1690 | attr == &sensor_dev_attr_power1_cap_max.dev_attr.attr || | ||
| 1690 | attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr|| | 1691 | attr == &sensor_dev_attr_power1_cap_min.dev_attr.attr|| |
| 1691 | attr == &sensor_dev_attr_power1_cap.dev_attr.attr)) | 1692 | attr == &sensor_dev_attr_power1_cap.dev_attr.attr)) |
| 1692 | return 0; | 1693 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c index 71913a18d142..a38e0fb4a6fe 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include "amdgpu_gem.h" | 38 | #include "amdgpu_gem.h" |
| 39 | #include <drm/amdgpu_drm.h> | 39 | #include <drm/amdgpu_drm.h> |
| 40 | #include <linux/dma-buf.h> | 40 | #include <linux/dma-buf.h> |
| 41 | #include <linux/dma-fence-array.h> | ||
| 41 | 42 | ||
| 42 | /** | 43 | /** |
| 43 | * amdgpu_gem_prime_get_sg_table - &drm_driver.gem_prime_get_sg_table | 44 | * amdgpu_gem_prime_get_sg_table - &drm_driver.gem_prime_get_sg_table |
| @@ -187,6 +188,48 @@ error: | |||
| 187 | return ERR_PTR(ret); | 188 | return ERR_PTR(ret); |
| 188 | } | 189 | } |
| 189 | 190 | ||
| 191 | static int | ||
| 192 | __reservation_object_make_exclusive(struct reservation_object *obj) | ||
| 193 | { | ||
| 194 | struct dma_fence **fences; | ||
| 195 | unsigned int count; | ||
| 196 | int r; | ||
| 197 | |||
| 198 | if (!reservation_object_get_list(obj)) /* no shared fences to convert */ | ||
| 199 | return 0; | ||
| 200 | |||
| 201 | r = reservation_object_get_fences_rcu(obj, NULL, &count, &fences); | ||
| 202 | if (r) | ||
| 203 | return r; | ||
| 204 | |||
| 205 | if (count == 0) { | ||
| 206 | /* Now that was unexpected. */ | ||
| 207 | } else if (count == 1) { | ||
| 208 | reservation_object_add_excl_fence(obj, fences[0]); | ||
| 209 | dma_fence_put(fences[0]); | ||
| 210 | kfree(fences); | ||
| 211 | } else { | ||
| 212 | struct dma_fence_array *array; | ||
| 213 | |||
| 214 | array = dma_fence_array_create(count, fences, | ||
| 215 | dma_fence_context_alloc(1), 0, | ||
| 216 | false); | ||
| 217 | if (!array) | ||
| 218 | goto err_fences_put; | ||
| 219 | |||
| 220 | reservation_object_add_excl_fence(obj, &array->base); | ||
| 221 | dma_fence_put(&array->base); | ||
| 222 | } | ||
| 223 | |||
| 224 | return 0; | ||
| 225 | |||
| 226 | err_fences_put: | ||
| 227 | while (count--) | ||
| 228 | dma_fence_put(fences[count]); | ||
| 229 | kfree(fences); | ||
| 230 | return -ENOMEM; | ||
| 231 | } | ||
| 232 | |||
| 190 | /** | 233 | /** |
| 191 | * amdgpu_gem_map_attach - &dma_buf_ops.attach implementation | 234 | * amdgpu_gem_map_attach - &dma_buf_ops.attach implementation |
| 192 | * @dma_buf: Shared DMA buffer | 235 | * @dma_buf: Shared DMA buffer |
| @@ -218,16 +261,16 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, | |||
| 218 | 261 | ||
| 219 | if (attach->dev->driver != adev->dev->driver) { | 262 | if (attach->dev->driver != adev->dev->driver) { |
| 220 | /* | 263 | /* |
| 221 | * Wait for all shared fences to complete before we switch to future | 264 | * We only create shared fences for internal use, but importers |
| 222 | * use of exclusive fence on this prime shared bo. | 265 | * of the dmabuf rely on exclusive fences for implicitly |
| 266 | * tracking write hazards. As any of the current fences may | ||
| 267 | * correspond to a write, we need to convert all existing | ||
| 268 | * fences on the reservation object into a single exclusive | ||
| 269 | * fence. | ||
| 223 | */ | 270 | */ |
| 224 | r = reservation_object_wait_timeout_rcu(bo->tbo.resv, | 271 | r = __reservation_object_make_exclusive(bo->tbo.resv); |
| 225 | true, false, | 272 | if (r) |
| 226 | MAX_SCHEDULE_TIMEOUT); | ||
| 227 | if (unlikely(r < 0)) { | ||
| 228 | DRM_DEBUG_PRIME("Fence wait failed: %li\n", r); | ||
| 229 | goto error_unreserve; | 273 | goto error_unreserve; |
| 230 | } | ||
| 231 | } | 274 | } |
| 232 | 275 | ||
| 233 | /* pin buffer into GTT */ | 276 | /* pin buffer into GTT */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index d2ea5ce2cefb..7c108e687683 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
| @@ -3363,14 +3363,15 @@ void amdgpu_vm_get_task_info(struct amdgpu_device *adev, unsigned int pasid, | |||
| 3363 | struct amdgpu_task_info *task_info) | 3363 | struct amdgpu_task_info *task_info) |
| 3364 | { | 3364 | { |
| 3365 | struct amdgpu_vm *vm; | 3365 | struct amdgpu_vm *vm; |
| 3366 | unsigned long flags; | ||
| 3366 | 3367 | ||
| 3367 | spin_lock(&adev->vm_manager.pasid_lock); | 3368 | spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags); |
| 3368 | 3369 | ||
| 3369 | vm = idr_find(&adev->vm_manager.pasid_idr, pasid); | 3370 | vm = idr_find(&adev->vm_manager.pasid_idr, pasid); |
| 3370 | if (vm) | 3371 | if (vm) |
| 3371 | *task_info = vm->task_info; | 3372 | *task_info = vm->task_info; |
| 3372 | 3373 | ||
| 3373 | spin_unlock(&adev->vm_manager.pasid_lock); | 3374 | spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags); |
| 3374 | } | 3375 | } |
| 3375 | 3376 | ||
| 3376 | /** | 3377 | /** |
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c index 4cd31a276dcd..186db182f924 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | |||
| @@ -93,7 +93,20 @@ static void nbio_v7_4_enable_doorbell_aperture(struct amdgpu_device *adev, | |||
| 93 | static void nbio_v7_4_enable_doorbell_selfring_aperture(struct amdgpu_device *adev, | 93 | static void nbio_v7_4_enable_doorbell_selfring_aperture(struct amdgpu_device *adev, |
| 94 | bool enable) | 94 | bool enable) |
| 95 | { | 95 | { |
| 96 | u32 tmp = 0; | ||
| 96 | 97 | ||
| 98 | if (enable) { | ||
| 99 | tmp = REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_EN, 1) | | ||
| 100 | REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_MODE, 1) | | ||
| 101 | REG_SET_FIELD(tmp, DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_SIZE, 0); | ||
| 102 | |||
| 103 | WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_BASE_LOW, | ||
| 104 | lower_32_bits(adev->doorbell.base)); | ||
| 105 | WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_BASE_HIGH, | ||
| 106 | upper_32_bits(adev->doorbell.base)); | ||
| 107 | } | ||
| 108 | |||
| 109 | WREG32_SOC15(NBIO, 0, mmDOORBELL_SELFRING_GPA_APER_CNTL, tmp); | ||
| 97 | } | 110 | } |
| 98 | 111 | ||
| 99 | static void nbio_v7_4_ih_doorbell_range(struct amdgpu_device *adev, | 112 | static void nbio_v7_4_ih_doorbell_range(struct amdgpu_device *adev, |
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 8849b74078d6..9b639974c70c 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c | |||
| @@ -729,11 +729,13 @@ static int soc15_common_early_init(void *handle) | |||
| 729 | case CHIP_RAVEN: | 729 | case CHIP_RAVEN: |
| 730 | adev->asic_funcs = &soc15_asic_funcs; | 730 | adev->asic_funcs = &soc15_asic_funcs; |
| 731 | if (adev->rev_id >= 0x8) | 731 | if (adev->rev_id >= 0x8) |
| 732 | adev->external_rev_id = adev->rev_id + 0x81; | 732 | adev->external_rev_id = adev->rev_id + 0x79; |
| 733 | else if (adev->pdev->device == 0x15d8) | 733 | else if (adev->pdev->device == 0x15d8) |
| 734 | adev->external_rev_id = adev->rev_id + 0x41; | 734 | adev->external_rev_id = adev->rev_id + 0x41; |
| 735 | else if (adev->rev_id == 1) | ||
| 736 | adev->external_rev_id = adev->rev_id + 0x20; | ||
| 735 | else | 737 | else |
| 736 | adev->external_rev_id = 0x1; | 738 | adev->external_rev_id = adev->rev_id + 0x01; |
| 737 | 739 | ||
| 738 | if (adev->rev_id >= 0x8) { | 740 | if (adev->rev_id >= 0x8) { |
| 739 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | | 741 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c index 5d85ff341385..2e7c44955f43 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c | |||
| @@ -863,7 +863,7 @@ static int kfd_fill_mem_info_for_cpu(int numa_node_id, int *avail_size, | |||
| 863 | return 0; | 863 | return 0; |
| 864 | } | 864 | } |
| 865 | 865 | ||
| 866 | #if CONFIG_X86_64 | 866 | #ifdef CONFIG_X86_64 |
| 867 | static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size, | 867 | static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size, |
| 868 | uint32_t *num_entries, | 868 | uint32_t *num_entries, |
| 869 | struct crat_subtype_iolink *sub_type_hdr) | 869 | struct crat_subtype_iolink *sub_type_hdr) |
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index f4fa40c387d3..0b392bfca284 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
| @@ -4082,7 +4082,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, | |||
| 4082 | } | 4082 | } |
| 4083 | 4083 | ||
| 4084 | if (connector_type == DRM_MODE_CONNECTOR_HDMIA || | 4084 | if (connector_type == DRM_MODE_CONNECTOR_HDMIA || |
| 4085 | connector_type == DRM_MODE_CONNECTOR_DisplayPort) { | 4085 | connector_type == DRM_MODE_CONNECTOR_DisplayPort || |
| 4086 | connector_type == DRM_MODE_CONNECTOR_eDP) { | ||
| 4086 | drm_connector_attach_vrr_capable_property( | 4087 | drm_connector_attach_vrr_capable_property( |
| 4087 | &aconnector->base); | 4088 | &aconnector->base); |
| 4088 | } | 4089 | } |
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c index afd287f08bc9..19801bdba0d2 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c | |||
| @@ -591,7 +591,15 @@ static void dce11_pplib_apply_display_requirements( | |||
| 591 | dc, | 591 | dc, |
| 592 | context->bw.dce.sclk_khz); | 592 | context->bw.dce.sclk_khz); |
| 593 | 593 | ||
| 594 | pp_display_cfg->min_dcfclock_khz = pp_display_cfg->min_engine_clock_khz; | 594 | /* |
| 595 | * As workaround for >4x4K lightup set dcfclock to min_engine_clock value. | ||
| 596 | * This is not required for less than 5 displays, | ||
| 597 | * thus don't request decfclk in dc to avoid impact | ||
| 598 | * on power saving. | ||
| 599 | * | ||
| 600 | */ | ||
| 601 | pp_display_cfg->min_dcfclock_khz = (context->stream_count > 4)? | ||
| 602 | pp_display_cfg->min_engine_clock_khz : 0; | ||
| 595 | 603 | ||
| 596 | pp_display_cfg->min_engine_clock_deep_sleep_khz | 604 | pp_display_cfg->min_engine_clock_deep_sleep_khz |
| 597 | = context->bw.dce.sclk_deep_sleep_khz; | 605 | = context->bw.dce.sclk_deep_sleep_khz; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c index f95c5f50eb0f..5273de3c5b98 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | |||
| @@ -1033,6 +1033,7 @@ static int smu10_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr, | |||
| 1033 | break; | 1033 | break; |
| 1034 | case amd_pp_dpp_clock: | 1034 | case amd_pp_dpp_clock: |
| 1035 | pclk_vol_table = pinfo->vdd_dep_on_dppclk; | 1035 | pclk_vol_table = pinfo->vdd_dep_on_dppclk; |
| 1036 | break; | ||
| 1036 | default: | 1037 | default: |
| 1037 | return -EINVAL; | 1038 | return -EINVAL; |
| 1038 | } | 1039 | } |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c index b8747a5c9204..99d596dc0e89 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include "vega10_pptable.h" | 32 | #include "vega10_pptable.h" |
| 33 | 33 | ||
| 34 | #define NUM_DSPCLK_LEVELS 8 | 34 | #define NUM_DSPCLK_LEVELS 8 |
| 35 | #define VEGA10_ENGINECLOCK_HARDMAX 198000 | ||
| 35 | 36 | ||
| 36 | static void set_hw_cap(struct pp_hwmgr *hwmgr, bool enable, | 37 | static void set_hw_cap(struct pp_hwmgr *hwmgr, bool enable, |
| 37 | enum phm_platform_caps cap) | 38 | enum phm_platform_caps cap) |
| @@ -258,7 +259,26 @@ static int init_over_drive_limits( | |||
| 258 | struct pp_hwmgr *hwmgr, | 259 | struct pp_hwmgr *hwmgr, |
| 259 | const ATOM_Vega10_POWERPLAYTABLE *powerplay_table) | 260 | const ATOM_Vega10_POWERPLAYTABLE *powerplay_table) |
| 260 | { | 261 | { |
| 261 | hwmgr->platform_descriptor.overdriveLimit.engineClock = | 262 | const ATOM_Vega10_GFXCLK_Dependency_Table *gfxclk_dep_table = |
| 263 | (const ATOM_Vega10_GFXCLK_Dependency_Table *) | ||
| 264 | (((unsigned long) powerplay_table) + | ||
| 265 | le16_to_cpu(powerplay_table->usGfxclkDependencyTableOffset)); | ||
| 266 | bool is_acg_enabled = false; | ||
| 267 | ATOM_Vega10_GFXCLK_Dependency_Record_V2 *patom_record_v2; | ||
| 268 | |||
| 269 | if (gfxclk_dep_table->ucRevId == 1) { | ||
| 270 | patom_record_v2 = | ||
| 271 | (ATOM_Vega10_GFXCLK_Dependency_Record_V2 *)gfxclk_dep_table->entries; | ||
| 272 | is_acg_enabled = | ||
| 273 | (bool)patom_record_v2[gfxclk_dep_table->ucNumEntries-1].ucACGEnable; | ||
| 274 | } | ||
| 275 | |||
| 276 | if (powerplay_table->ulMaxODEngineClock > VEGA10_ENGINECLOCK_HARDMAX && | ||
| 277 | !is_acg_enabled) | ||
| 278 | hwmgr->platform_descriptor.overdriveLimit.engineClock = | ||
| 279 | VEGA10_ENGINECLOCK_HARDMAX; | ||
| 280 | else | ||
| 281 | hwmgr->platform_descriptor.overdriveLimit.engineClock = | ||
| 262 | le32_to_cpu(powerplay_table->ulMaxODEngineClock); | 282 | le32_to_cpu(powerplay_table->ulMaxODEngineClock); |
| 263 | hwmgr->platform_descriptor.overdriveLimit.memoryClock = | 283 | hwmgr->platform_descriptor.overdriveLimit.memoryClock = |
| 264 | le32_to_cpu(powerplay_table->ulMaxODMemoryClock); | 284 | le32_to_cpu(powerplay_table->ulMaxODMemoryClock); |
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 24a750436559..f91e02c87fd8 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
| @@ -758,7 +758,7 @@ int drm_mode_hsync(const struct drm_display_mode *mode) | |||
| 758 | if (mode->hsync) | 758 | if (mode->hsync) |
| 759 | return mode->hsync; | 759 | return mode->hsync; |
| 760 | 760 | ||
| 761 | if (mode->htotal < 0) | 761 | if (mode->htotal <= 0) |
| 762 | return 0; | 762 | return 0; |
| 763 | 763 | ||
| 764 | calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */ | 764 | calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */ |
diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c index 5567ddc7760f..55bb7885e228 100644 --- a/drivers/gpu/drm/i915/gvt/scheduler.c +++ b/drivers/gpu/drm/i915/gvt/scheduler.c | |||
| @@ -332,6 +332,9 @@ static void release_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) | |||
| 332 | 332 | ||
| 333 | i915_gem_object_unpin_map(wa_ctx->indirect_ctx.obj); | 333 | i915_gem_object_unpin_map(wa_ctx->indirect_ctx.obj); |
| 334 | i915_gem_object_put(wa_ctx->indirect_ctx.obj); | 334 | i915_gem_object_put(wa_ctx->indirect_ctx.obj); |
| 335 | |||
| 336 | wa_ctx->indirect_ctx.obj = NULL; | ||
| 337 | wa_ctx->indirect_ctx.shadow_va = NULL; | ||
| 335 | } | 338 | } |
| 336 | 339 | ||
| 337 | static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, | 340 | static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, |
| @@ -911,11 +914,6 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) | |||
| 911 | 914 | ||
| 912 | list_del_init(&workload->list); | 915 | list_del_init(&workload->list); |
| 913 | 916 | ||
| 914 | if (!workload->status) { | ||
| 915 | release_shadow_batch_buffer(workload); | ||
| 916 | release_shadow_wa_ctx(&workload->wa_ctx); | ||
| 917 | } | ||
| 918 | |||
| 919 | if (workload->status || (vgpu->resetting_eng & ENGINE_MASK(ring_id))) { | 917 | if (workload->status || (vgpu->resetting_eng & ENGINE_MASK(ring_id))) { |
| 920 | /* if workload->status is not successful means HW GPU | 918 | /* if workload->status is not successful means HW GPU |
| 921 | * has occurred GPU hang or something wrong with i915/GVT, | 919 | * has occurred GPU hang or something wrong with i915/GVT, |
| @@ -1283,6 +1281,9 @@ void intel_vgpu_destroy_workload(struct intel_vgpu_workload *workload) | |||
| 1283 | { | 1281 | { |
| 1284 | struct intel_vgpu_submission *s = &workload->vgpu->submission; | 1282 | struct intel_vgpu_submission *s = &workload->vgpu->submission; |
| 1285 | 1283 | ||
| 1284 | release_shadow_batch_buffer(workload); | ||
| 1285 | release_shadow_wa_ctx(&workload->wa_ctx); | ||
| 1286 | |||
| 1286 | if (workload->shadow_mm) | 1287 | if (workload->shadow_mm) |
| 1287 | intel_vgpu_mm_put(workload->shadow_mm); | 1288 | intel_vgpu_mm_put(workload->shadow_mm); |
| 1288 | 1289 | ||
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index f3e1d6a0b7dd..4079050f9d6c 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
| @@ -1086,7 +1086,7 @@ static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder, | |||
| 1086 | return DDI_CLK_SEL_TBT_810; | 1086 | return DDI_CLK_SEL_TBT_810; |
| 1087 | default: | 1087 | default: |
| 1088 | MISSING_CASE(clock); | 1088 | MISSING_CASE(clock); |
| 1089 | break; | 1089 | return DDI_CLK_SEL_NONE; |
| 1090 | } | 1090 | } |
| 1091 | case DPLL_ID_ICL_MGPLL1: | 1091 | case DPLL_ID_ICL_MGPLL1: |
| 1092 | case DPLL_ID_ICL_MGPLL2: | 1092 | case DPLL_ID_ICL_MGPLL2: |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3da9c0f9e948..248128126422 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -15415,16 +15415,45 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, | |||
| 15415 | } | 15415 | } |
| 15416 | } | 15416 | } |
| 15417 | 15417 | ||
| 15418 | static bool has_bogus_dpll_config(const struct intel_crtc_state *crtc_state) | ||
| 15419 | { | ||
| 15420 | struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev); | ||
| 15421 | |||
| 15422 | /* | ||
| 15423 | * Some SNB BIOSen (eg. ASUS K53SV) are known to misprogram | ||
| 15424 | * the hardware when a high res displays plugged in. DPLL P | ||
| 15425 | * divider is zero, and the pipe timings are bonkers. We'll | ||
| 15426 | * try to disable everything in that case. | ||
| 15427 | * | ||
| 15428 | * FIXME would be nice to be able to sanitize this state | ||
| 15429 | * without several WARNs, but for now let's take the easy | ||
| 15430 | * road. | ||
| 15431 | */ | ||
| 15432 | return IS_GEN6(dev_priv) && | ||
| 15433 | crtc_state->base.active && | ||
| 15434 | crtc_state->shared_dpll && | ||
| 15435 | crtc_state->port_clock == 0; | ||
| 15436 | } | ||
| 15437 | |||
| 15418 | static void intel_sanitize_encoder(struct intel_encoder *encoder) | 15438 | static void intel_sanitize_encoder(struct intel_encoder *encoder) |
| 15419 | { | 15439 | { |
| 15420 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); | 15440 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 15421 | struct intel_connector *connector; | 15441 | struct intel_connector *connector; |
| 15442 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); | ||
| 15443 | struct intel_crtc_state *crtc_state = crtc ? | ||
| 15444 | to_intel_crtc_state(crtc->base.state) : NULL; | ||
| 15422 | 15445 | ||
| 15423 | /* We need to check both for a crtc link (meaning that the | 15446 | /* We need to check both for a crtc link (meaning that the |
| 15424 | * encoder is active and trying to read from a pipe) and the | 15447 | * encoder is active and trying to read from a pipe) and the |
| 15425 | * pipe itself being active. */ | 15448 | * pipe itself being active. */ |
| 15426 | bool has_active_crtc = encoder->base.crtc && | 15449 | bool has_active_crtc = crtc_state && |
| 15427 | to_intel_crtc(encoder->base.crtc)->active; | 15450 | crtc_state->base.active; |
| 15451 | |||
| 15452 | if (crtc_state && has_bogus_dpll_config(crtc_state)) { | ||
| 15453 | DRM_DEBUG_KMS("BIOS has misprogrammed the hardware. Disabling pipe %c\n", | ||
| 15454 | pipe_name(crtc->pipe)); | ||
| 15455 | has_active_crtc = false; | ||
| 15456 | } | ||
| 15428 | 15457 | ||
| 15429 | connector = intel_encoder_find_connector(encoder); | 15458 | connector = intel_encoder_find_connector(encoder); |
| 15430 | if (connector && !has_active_crtc) { | 15459 | if (connector && !has_active_crtc) { |
| @@ -15435,16 +15464,25 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) | |||
| 15435 | /* Connector is active, but has no active pipe. This is | 15464 | /* Connector is active, but has no active pipe. This is |
| 15436 | * fallout from our resume register restoring. Disable | 15465 | * fallout from our resume register restoring. Disable |
| 15437 | * the encoder manually again. */ | 15466 | * the encoder manually again. */ |
| 15438 | if (encoder->base.crtc) { | 15467 | if (crtc_state) { |
| 15439 | struct drm_crtc_state *crtc_state = encoder->base.crtc->state; | 15468 | struct drm_encoder *best_encoder; |
| 15440 | 15469 | ||
| 15441 | DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n", | 15470 | DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n", |
| 15442 | encoder->base.base.id, | 15471 | encoder->base.base.id, |
| 15443 | encoder->base.name); | 15472 | encoder->base.name); |
| 15473 | |||
| 15474 | /* avoid oopsing in case the hooks consult best_encoder */ | ||
| 15475 | best_encoder = connector->base.state->best_encoder; | ||
| 15476 | connector->base.state->best_encoder = &encoder->base; | ||
| 15477 | |||
| 15444 | if (encoder->disable) | 15478 | if (encoder->disable) |
| 15445 | encoder->disable(encoder, to_intel_crtc_state(crtc_state), connector->base.state); | 15479 | encoder->disable(encoder, crtc_state, |
| 15480 | connector->base.state); | ||
| 15446 | if (encoder->post_disable) | 15481 | if (encoder->post_disable) |
| 15447 | encoder->post_disable(encoder, to_intel_crtc_state(crtc_state), connector->base.state); | 15482 | encoder->post_disable(encoder, crtc_state, |
| 15483 | connector->base.state); | ||
| 15484 | |||
| 15485 | connector->base.state->best_encoder = best_encoder; | ||
| 15448 | } | 15486 | } |
| 15449 | encoder->base.crtc = NULL; | 15487 | encoder->base.crtc = NULL; |
| 15450 | 15488 | ||
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 4796f40a6d4f..eab9341a5152 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
| @@ -303,6 +303,7 @@ static void __unwind_incomplete_requests(struct intel_engine_cs *engine) | |||
| 303 | */ | 303 | */ |
| 304 | if (!(prio & I915_PRIORITY_NEWCLIENT)) { | 304 | if (!(prio & I915_PRIORITY_NEWCLIENT)) { |
| 305 | prio |= I915_PRIORITY_NEWCLIENT; | 305 | prio |= I915_PRIORITY_NEWCLIENT; |
| 306 | active->sched.attr.priority = prio; | ||
| 306 | list_move_tail(&active->sched.link, | 307 | list_move_tail(&active->sched.link, |
| 307 | i915_sched_lookup_priolist(engine, prio)); | 308 | i915_sched_lookup_priolist(engine, prio)); |
| 308 | } | 309 | } |
| @@ -645,6 +646,9 @@ static void execlists_dequeue(struct intel_engine_cs *engine) | |||
| 645 | int i; | 646 | int i; |
| 646 | 647 | ||
| 647 | priolist_for_each_request_consume(rq, rn, p, i) { | 648 | priolist_for_each_request_consume(rq, rn, p, i) { |
| 649 | GEM_BUG_ON(last && | ||
| 650 | need_preempt(engine, last, rq_prio(rq))); | ||
| 651 | |||
| 648 | /* | 652 | /* |
| 649 | * Can we combine this request with the current port? | 653 | * Can we combine this request with the current port? |
| 650 | * It has to be the same context/ringbuffer and not | 654 | * It has to be the same context/ringbuffer and not |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index d2e003d8f3db..5170a0f5fe7b 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
| @@ -494,7 +494,7 @@ skl_program_plane(struct intel_plane *plane, | |||
| 494 | 494 | ||
| 495 | keymax = (key->max_value & 0xffffff) | PLANE_KEYMAX_ALPHA(alpha); | 495 | keymax = (key->max_value & 0xffffff) | PLANE_KEYMAX_ALPHA(alpha); |
| 496 | 496 | ||
| 497 | keymsk = key->channel_mask & 0x3ffffff; | 497 | keymsk = key->channel_mask & 0x7ffffff; |
| 498 | if (alpha < 0xff) | 498 | if (alpha < 0xff) |
| 499 | keymsk |= PLANE_KEYMSK_ALPHA_ENABLE; | 499 | keymsk |= PLANE_KEYMSK_ALPHA_ENABLE; |
| 500 | 500 | ||
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 5beb83d1cf87..ce1b3cc4bf6d 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c | |||
| @@ -944,7 +944,7 @@ static u32 a6xx_gmu_get_arc_level(struct device *dev, unsigned long freq) | |||
| 944 | np = dev_pm_opp_get_of_node(opp); | 944 | np = dev_pm_opp_get_of_node(opp); |
| 945 | 945 | ||
| 946 | if (np) { | 946 | if (np) { |
| 947 | of_property_read_u32(np, "qcom,level", &val); | 947 | of_property_read_u32(np, "opp-level", &val); |
| 948 | of_node_put(np); | 948 | of_node_put(np); |
| 949 | } | 949 | } |
| 950 | 950 | ||
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index 2e4372ef17a3..2cfee1a4fe0b 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c | |||
| @@ -765,7 +765,6 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, | |||
| 765 | adreno_gpu->rev = config->rev; | 765 | adreno_gpu->rev = config->rev; |
| 766 | 766 | ||
| 767 | adreno_gpu_config.ioname = "kgsl_3d0_reg_memory"; | 767 | adreno_gpu_config.ioname = "kgsl_3d0_reg_memory"; |
| 768 | adreno_gpu_config.irqname = "kgsl_3d0_irq"; | ||
| 769 | 768 | ||
| 770 | adreno_gpu_config.va_start = SZ_16M; | 769 | adreno_gpu_config.va_start = SZ_16M; |
| 771 | adreno_gpu_config.va_end = 0xffffffff; | 770 | adreno_gpu_config.va_end = 0xffffffff; |
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index fd75870eb17f..6aefcd6db46b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | |||
| @@ -365,19 +365,6 @@ static void _dpu_plane_set_qos_ctrl(struct drm_plane *plane, | |||
| 365 | &pdpu->pipe_qos_cfg); | 365 | &pdpu->pipe_qos_cfg); |
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) | ||
| 369 | { | ||
| 370 | struct dpu_plane *pdpu = to_dpu_plane(plane); | ||
| 371 | struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); | ||
| 372 | |||
| 373 | if (!pdpu->is_rt_pipe) | ||
| 374 | return; | ||
| 375 | |||
| 376 | pm_runtime_get_sync(&dpu_kms->pdev->dev); | ||
| 377 | _dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL); | ||
| 378 | pm_runtime_put_sync(&dpu_kms->pdev->dev); | ||
| 379 | } | ||
| 380 | |||
| 381 | /** | 368 | /** |
| 382 | * _dpu_plane_set_ot_limit - set OT limit for the given plane | 369 | * _dpu_plane_set_ot_limit - set OT limit for the given plane |
| 383 | * @plane: Pointer to drm plane | 370 | * @plane: Pointer to drm plane |
| @@ -1248,6 +1235,19 @@ static void dpu_plane_reset(struct drm_plane *plane) | |||
| 1248 | } | 1235 | } |
| 1249 | 1236 | ||
| 1250 | #ifdef CONFIG_DEBUG_FS | 1237 | #ifdef CONFIG_DEBUG_FS |
| 1238 | static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) | ||
| 1239 | { | ||
| 1240 | struct dpu_plane *pdpu = to_dpu_plane(plane); | ||
| 1241 | struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); | ||
| 1242 | |||
| 1243 | if (!pdpu->is_rt_pipe) | ||
| 1244 | return; | ||
| 1245 | |||
| 1246 | pm_runtime_get_sync(&dpu_kms->pdev->dev); | ||
| 1247 | _dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL); | ||
| 1248 | pm_runtime_put_sync(&dpu_kms->pdev->dev); | ||
| 1249 | } | ||
| 1250 | |||
| 1251 | static ssize_t _dpu_plane_danger_read(struct file *file, | 1251 | static ssize_t _dpu_plane_danger_read(struct file *file, |
| 1252 | char __user *buff, size_t count, loff_t *ppos) | 1252 | char __user *buff, size_t count, loff_t *ppos) |
| 1253 | { | 1253 | { |
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 9cd6a96c6bf2..927e5d86f7c1 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h | |||
| @@ -250,7 +250,8 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace, | |||
| 250 | void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, | 250 | void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, |
| 251 | struct msm_gem_vma *vma); | 251 | struct msm_gem_vma *vma); |
| 252 | int msm_gem_map_vma(struct msm_gem_address_space *aspace, | 252 | int msm_gem_map_vma(struct msm_gem_address_space *aspace, |
| 253 | struct msm_gem_vma *vma, struct sg_table *sgt, int npages); | 253 | struct msm_gem_vma *vma, int prot, |
| 254 | struct sg_table *sgt, int npages); | ||
| 254 | void msm_gem_close_vma(struct msm_gem_address_space *aspace, | 255 | void msm_gem_close_vma(struct msm_gem_address_space *aspace, |
| 255 | struct msm_gem_vma *vma); | 256 | struct msm_gem_vma *vma); |
| 256 | 257 | ||
| @@ -333,6 +334,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo, | |||
| 333 | struct drm_gem_object *msm_gem_import(struct drm_device *dev, | 334 | struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
| 334 | struct dma_buf *dmabuf, struct sg_table *sgt); | 335 | struct dma_buf *dmabuf, struct sg_table *sgt); |
| 335 | 336 | ||
| 337 | __printf(2, 3) | ||
| 336 | void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...); | 338 | void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...); |
| 337 | 339 | ||
| 338 | int msm_framebuffer_prepare(struct drm_framebuffer *fb, | 340 | int msm_framebuffer_prepare(struct drm_framebuffer *fb, |
| @@ -396,12 +398,14 @@ void msm_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m); | |||
| 396 | int msm_debugfs_late_init(struct drm_device *dev); | 398 | int msm_debugfs_late_init(struct drm_device *dev); |
| 397 | int msm_rd_debugfs_init(struct drm_minor *minor); | 399 | int msm_rd_debugfs_init(struct drm_minor *minor); |
| 398 | void msm_rd_debugfs_cleanup(struct msm_drm_private *priv); | 400 | void msm_rd_debugfs_cleanup(struct msm_drm_private *priv); |
| 401 | __printf(3, 4) | ||
| 399 | void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, | 402 | void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, |
| 400 | const char *fmt, ...); | 403 | const char *fmt, ...); |
| 401 | int msm_perf_debugfs_init(struct drm_minor *minor); | 404 | int msm_perf_debugfs_init(struct drm_minor *minor); |
| 402 | void msm_perf_debugfs_cleanup(struct msm_drm_private *priv); | 405 | void msm_perf_debugfs_cleanup(struct msm_drm_private *priv); |
| 403 | #else | 406 | #else |
| 404 | static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; } | 407 | static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; } |
| 408 | __printf(3, 4) | ||
| 405 | static inline void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, | 409 | static inline void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, |
| 406 | const char *fmt, ...) {} | 410 | const char *fmt, ...) {} |
| 407 | static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {} | 411 | static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {} |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 51a95da694d8..c8886d3071fa 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
| @@ -391,6 +391,10 @@ static int msm_gem_pin_iova(struct drm_gem_object *obj, | |||
| 391 | struct msm_gem_object *msm_obj = to_msm_bo(obj); | 391 | struct msm_gem_object *msm_obj = to_msm_bo(obj); |
| 392 | struct msm_gem_vma *vma; | 392 | struct msm_gem_vma *vma; |
| 393 | struct page **pages; | 393 | struct page **pages; |
| 394 | int prot = IOMMU_READ; | ||
| 395 | |||
| 396 | if (!(msm_obj->flags & MSM_BO_GPU_READONLY)) | ||
| 397 | prot |= IOMMU_WRITE; | ||
| 394 | 398 | ||
| 395 | WARN_ON(!mutex_is_locked(&msm_obj->lock)); | 399 | WARN_ON(!mutex_is_locked(&msm_obj->lock)); |
| 396 | 400 | ||
| @@ -405,8 +409,8 @@ static int msm_gem_pin_iova(struct drm_gem_object *obj, | |||
| 405 | if (IS_ERR(pages)) | 409 | if (IS_ERR(pages)) |
| 406 | return PTR_ERR(pages); | 410 | return PTR_ERR(pages); |
| 407 | 411 | ||
| 408 | return msm_gem_map_vma(aspace, vma, msm_obj->sgt, | 412 | return msm_gem_map_vma(aspace, vma, prot, |
| 409 | obj->size >> PAGE_SHIFT); | 413 | msm_obj->sgt, obj->size >> PAGE_SHIFT); |
| 410 | } | 414 | } |
| 411 | 415 | ||
| 412 | /* get iova and pin it. Should have a matching put */ | 416 | /* get iova and pin it. Should have a matching put */ |
diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c index 557360788084..49c04829cf34 100644 --- a/drivers/gpu/drm/msm/msm_gem_vma.c +++ b/drivers/gpu/drm/msm/msm_gem_vma.c | |||
| @@ -68,7 +68,8 @@ void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, | |||
| 68 | 68 | ||
| 69 | int | 69 | int |
| 70 | msm_gem_map_vma(struct msm_gem_address_space *aspace, | 70 | msm_gem_map_vma(struct msm_gem_address_space *aspace, |
| 71 | struct msm_gem_vma *vma, struct sg_table *sgt, int npages) | 71 | struct msm_gem_vma *vma, int prot, |
| 72 | struct sg_table *sgt, int npages) | ||
| 72 | { | 73 | { |
| 73 | unsigned size = npages << PAGE_SHIFT; | 74 | unsigned size = npages << PAGE_SHIFT; |
| 74 | int ret = 0; | 75 | int ret = 0; |
| @@ -86,7 +87,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace, | |||
| 86 | 87 | ||
| 87 | if (aspace->mmu) | 88 | if (aspace->mmu) |
| 88 | ret = aspace->mmu->funcs->map(aspace->mmu, vma->iova, sgt, | 89 | ret = aspace->mmu->funcs->map(aspace->mmu, vma->iova, sgt, |
| 89 | size, IOMMU_READ | IOMMU_WRITE); | 90 | size, prot); |
| 90 | 91 | ||
| 91 | if (ret) | 92 | if (ret) |
| 92 | vma->mapped = false; | 93 | vma->mapped = false; |
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 5f3eff304355..10babd18e286 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c | |||
| @@ -900,7 +900,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, | |||
| 900 | } | 900 | } |
| 901 | 901 | ||
| 902 | /* Get Interrupt: */ | 902 | /* Get Interrupt: */ |
| 903 | gpu->irq = platform_get_irq_byname(pdev, config->irqname); | 903 | gpu->irq = platform_get_irq(pdev, 0); |
| 904 | if (gpu->irq < 0) { | 904 | if (gpu->irq < 0) { |
| 905 | ret = gpu->irq; | 905 | ret = gpu->irq; |
| 906 | DRM_DEV_ERROR(drm->dev, "failed to get irq: %d\n", ret); | 906 | DRM_DEV_ERROR(drm->dev, "failed to get irq: %d\n", ret); |
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index efb49bb64191..ca17086f72c9 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h | |||
| @@ -31,7 +31,6 @@ struct msm_gpu_state; | |||
| 31 | 31 | ||
| 32 | struct msm_gpu_config { | 32 | struct msm_gpu_config { |
| 33 | const char *ioname; | 33 | const char *ioname; |
| 34 | const char *irqname; | ||
| 35 | uint64_t va_start; | 34 | uint64_t va_start; |
| 36 | uint64_t va_end; | 35 | uint64_t va_end; |
| 37 | unsigned int nr_rings; | 36 | unsigned int nr_rings; |
| @@ -63,7 +62,7 @@ struct msm_gpu_funcs { | |||
| 63 | struct msm_ringbuffer *(*active_ring)(struct msm_gpu *gpu); | 62 | struct msm_ringbuffer *(*active_ring)(struct msm_gpu *gpu); |
| 64 | void (*recover)(struct msm_gpu *gpu); | 63 | void (*recover)(struct msm_gpu *gpu); |
| 65 | void (*destroy)(struct msm_gpu *gpu); | 64 | void (*destroy)(struct msm_gpu *gpu); |
| 66 | #ifdef CONFIG_DEBUG_FS | 65 | #if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP) |
| 67 | /* show GPU status in debugfs: */ | 66 | /* show GPU status in debugfs: */ |
| 68 | void (*show)(struct msm_gpu *gpu, struct msm_gpu_state *state, | 67 | void (*show)(struct msm_gpu *gpu, struct msm_gpu_state *state, |
| 69 | struct drm_printer *p); | 68 | struct drm_printer *p); |
diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c index 90e9d0a48dc0..d21172933d92 100644 --- a/drivers/gpu/drm/msm/msm_rd.c +++ b/drivers/gpu/drm/msm/msm_rd.c | |||
| @@ -115,7 +115,9 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz) | |||
| 115 | char *fptr = &fifo->buf[fifo->head]; | 115 | char *fptr = &fifo->buf[fifo->head]; |
| 116 | int n; | 116 | int n; |
| 117 | 117 | ||
| 118 | wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0); | 118 | wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0 || !rd->open); |
| 119 | if (!rd->open) | ||
| 120 | return; | ||
| 119 | 121 | ||
| 120 | /* Note that smp_load_acquire() is not strictly required | 122 | /* Note that smp_load_acquire() is not strictly required |
| 121 | * as CIRC_SPACE_TO_END() does not access the tail more | 123 | * as CIRC_SPACE_TO_END() does not access the tail more |
| @@ -213,7 +215,10 @@ out: | |||
| 213 | static int rd_release(struct inode *inode, struct file *file) | 215 | static int rd_release(struct inode *inode, struct file *file) |
| 214 | { | 216 | { |
| 215 | struct msm_rd_state *rd = inode->i_private; | 217 | struct msm_rd_state *rd = inode->i_private; |
| 218 | |||
| 216 | rd->open = false; | 219 | rd->open = false; |
| 220 | wake_up_all(&rd->fifo_event); | ||
| 221 | |||
| 217 | return 0; | 222 | return 0; |
| 218 | } | 223 | } |
| 219 | 224 | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index 00a9c2ab9e6c..64fb788b6647 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c | |||
| @@ -1406,7 +1406,7 @@ static void dsi_pll_disable(struct dss_pll *pll) | |||
| 1406 | 1406 | ||
| 1407 | static int dsi_dump_dsi_clocks(struct seq_file *s, void *p) | 1407 | static int dsi_dump_dsi_clocks(struct seq_file *s, void *p) |
| 1408 | { | 1408 | { |
| 1409 | struct dsi_data *dsi = p; | 1409 | struct dsi_data *dsi = s->private; |
| 1410 | struct dss_pll_clock_info *cinfo = &dsi->pll.cinfo; | 1410 | struct dss_pll_clock_info *cinfo = &dsi->pll.cinfo; |
| 1411 | enum dss_clk_source dispc_clk_src, dsi_clk_src; | 1411 | enum dss_clk_source dispc_clk_src, dsi_clk_src; |
| 1412 | int dsi_module = dsi->module_id; | 1412 | int dsi_module = dsi->module_id; |
| @@ -1467,7 +1467,7 @@ static int dsi_dump_dsi_clocks(struct seq_file *s, void *p) | |||
| 1467 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 1467 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
| 1468 | static int dsi_dump_dsi_irqs(struct seq_file *s, void *p) | 1468 | static int dsi_dump_dsi_irqs(struct seq_file *s, void *p) |
| 1469 | { | 1469 | { |
| 1470 | struct dsi_data *dsi = p; | 1470 | struct dsi_data *dsi = s->private; |
| 1471 | unsigned long flags; | 1471 | unsigned long flags; |
| 1472 | struct dsi_irq_stats stats; | 1472 | struct dsi_irq_stats stats; |
| 1473 | 1473 | ||
| @@ -1558,7 +1558,7 @@ static int dsi_dump_dsi_irqs(struct seq_file *s, void *p) | |||
| 1558 | 1558 | ||
| 1559 | static int dsi_dump_dsi_regs(struct seq_file *s, void *p) | 1559 | static int dsi_dump_dsi_regs(struct seq_file *s, void *p) |
| 1560 | { | 1560 | { |
| 1561 | struct dsi_data *dsi = p; | 1561 | struct dsi_data *dsi = s->private; |
| 1562 | 1562 | ||
| 1563 | if (dsi_runtime_get(dsi)) | 1563 | if (dsi_runtime_get(dsi)) |
| 1564 | return 0; | 1564 | return 0; |
| @@ -4751,6 +4751,17 @@ static int dsi_set_config(struct omap_dss_device *dssdev, | |||
| 4751 | dsi->vm.flags |= DISPLAY_FLAGS_HSYNC_HIGH; | 4751 | dsi->vm.flags |= DISPLAY_FLAGS_HSYNC_HIGH; |
| 4752 | dsi->vm.flags &= ~DISPLAY_FLAGS_VSYNC_LOW; | 4752 | dsi->vm.flags &= ~DISPLAY_FLAGS_VSYNC_LOW; |
| 4753 | dsi->vm.flags |= DISPLAY_FLAGS_VSYNC_HIGH; | 4753 | dsi->vm.flags |= DISPLAY_FLAGS_VSYNC_HIGH; |
| 4754 | /* | ||
| 4755 | * HACK: These flags should be handled through the omap_dss_device bus | ||
| 4756 | * flags, but this will only be possible when the DSI encoder will be | ||
| 4757 | * converted to the omapdrm-managed encoder model. | ||
| 4758 | */ | ||
| 4759 | dsi->vm.flags &= ~DISPLAY_FLAGS_PIXDATA_NEGEDGE; | ||
| 4760 | dsi->vm.flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE; | ||
| 4761 | dsi->vm.flags &= ~DISPLAY_FLAGS_DE_LOW; | ||
| 4762 | dsi->vm.flags |= DISPLAY_FLAGS_DE_HIGH; | ||
| 4763 | dsi->vm.flags &= ~DISPLAY_FLAGS_SYNC_POSEDGE; | ||
| 4764 | dsi->vm.flags |= DISPLAY_FLAGS_SYNC_NEGEDGE; | ||
| 4754 | 4765 | ||
| 4755 | dss_mgr_set_timings(&dsi->output, &dsi->vm); | 4766 | dss_mgr_set_timings(&dsi->output, &dsi->vm); |
| 4756 | 4767 | ||
| @@ -5083,15 +5094,15 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) | |||
| 5083 | 5094 | ||
| 5084 | snprintf(name, sizeof(name), "dsi%u_regs", dsi->module_id + 1); | 5095 | snprintf(name, sizeof(name), "dsi%u_regs", dsi->module_id + 1); |
| 5085 | dsi->debugfs.regs = dss_debugfs_create_file(dss, name, | 5096 | dsi->debugfs.regs = dss_debugfs_create_file(dss, name, |
| 5086 | dsi_dump_dsi_regs, &dsi); | 5097 | dsi_dump_dsi_regs, dsi); |
| 5087 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 5098 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
| 5088 | snprintf(name, sizeof(name), "dsi%u_irqs", dsi->module_id + 1); | 5099 | snprintf(name, sizeof(name), "dsi%u_irqs", dsi->module_id + 1); |
| 5089 | dsi->debugfs.irqs = dss_debugfs_create_file(dss, name, | 5100 | dsi->debugfs.irqs = dss_debugfs_create_file(dss, name, |
| 5090 | dsi_dump_dsi_irqs, &dsi); | 5101 | dsi_dump_dsi_irqs, dsi); |
| 5091 | #endif | 5102 | #endif |
| 5092 | snprintf(name, sizeof(name), "dsi%u_clks", dsi->module_id + 1); | 5103 | snprintf(name, sizeof(name), "dsi%u_clks", dsi->module_id + 1); |
| 5093 | dsi->debugfs.clks = dss_debugfs_create_file(dss, name, | 5104 | dsi->debugfs.clks = dss_debugfs_create_file(dss, name, |
| 5094 | dsi_dump_dsi_clocks, &dsi); | 5105 | dsi_dump_dsi_clocks, dsi); |
| 5095 | 5106 | ||
| 5096 | return 0; | 5107 | return 0; |
| 5097 | } | 5108 | } |
| @@ -5104,8 +5115,6 @@ static void dsi_unbind(struct device *dev, struct device *master, void *data) | |||
| 5104 | dss_debugfs_remove_file(dsi->debugfs.irqs); | 5115 | dss_debugfs_remove_file(dsi->debugfs.irqs); |
| 5105 | dss_debugfs_remove_file(dsi->debugfs.regs); | 5116 | dss_debugfs_remove_file(dsi->debugfs.regs); |
| 5106 | 5117 | ||
| 5107 | of_platform_depopulate(dev); | ||
| 5108 | |||
| 5109 | WARN_ON(dsi->scp_clk_refcount > 0); | 5118 | WARN_ON(dsi->scp_clk_refcount > 0); |
| 5110 | 5119 | ||
| 5111 | dss_pll_unregister(&dsi->pll); | 5120 | dss_pll_unregister(&dsi->pll); |
| @@ -5457,6 +5466,8 @@ static int dsi_remove(struct platform_device *pdev) | |||
| 5457 | 5466 | ||
| 5458 | dsi_uninit_output(dsi); | 5467 | dsi_uninit_output(dsi); |
| 5459 | 5468 | ||
| 5469 | of_platform_depopulate(&pdev->dev); | ||
| 5470 | |||
| 5460 | pm_runtime_disable(&pdev->dev); | 5471 | pm_runtime_disable(&pdev->dev); |
| 5461 | 5472 | ||
| 5462 | if (dsi->vdds_dsi_reg != NULL && dsi->vdds_dsi_enabled) { | 5473 | if (dsi->vdds_dsi_reg != NULL && dsi->vdds_dsi_enabled) { |
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index d587779a80b4..a97294ac96d5 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
| @@ -5676,7 +5676,7 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
| 5676 | u16 data_offset, size; | 5676 | u16 data_offset, size; |
| 5677 | u8 frev, crev; | 5677 | u8 frev, crev; |
| 5678 | struct ci_power_info *pi; | 5678 | struct ci_power_info *pi; |
| 5679 | enum pci_bus_speed speed_cap; | 5679 | enum pci_bus_speed speed_cap = PCI_SPEED_UNKNOWN; |
| 5680 | struct pci_dev *root = rdev->pdev->bus->self; | 5680 | struct pci_dev *root = rdev->pdev->bus->self; |
| 5681 | int ret; | 5681 | int ret; |
| 5682 | 5682 | ||
| @@ -5685,7 +5685,8 @@ int ci_dpm_init(struct radeon_device *rdev) | |||
| 5685 | return -ENOMEM; | 5685 | return -ENOMEM; |
| 5686 | rdev->pm.dpm.priv = pi; | 5686 | rdev->pm.dpm.priv = pi; |
| 5687 | 5687 | ||
| 5688 | speed_cap = pcie_get_speed_cap(root); | 5688 | if (!pci_is_root_bus(rdev->pdev->bus)) |
| 5689 | speed_cap = pcie_get_speed_cap(root); | ||
| 5689 | if (speed_cap == PCI_SPEED_UNKNOWN) { | 5690 | if (speed_cap == PCI_SPEED_UNKNOWN) { |
| 5690 | pi->sys_pcie_mask = 0; | 5691 | pi->sys_pcie_mask = 0; |
| 5691 | } else { | 5692 | } else { |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 8fb60b3af015..0a785ef0ab66 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
| @@ -6899,7 +6899,7 @@ int si_dpm_init(struct radeon_device *rdev) | |||
| 6899 | struct ni_power_info *ni_pi; | 6899 | struct ni_power_info *ni_pi; |
| 6900 | struct si_power_info *si_pi; | 6900 | struct si_power_info *si_pi; |
| 6901 | struct atom_clock_dividers dividers; | 6901 | struct atom_clock_dividers dividers; |
| 6902 | enum pci_bus_speed speed_cap; | 6902 | enum pci_bus_speed speed_cap = PCI_SPEED_UNKNOWN; |
| 6903 | struct pci_dev *root = rdev->pdev->bus->self; | 6903 | struct pci_dev *root = rdev->pdev->bus->self; |
| 6904 | int ret; | 6904 | int ret; |
| 6905 | 6905 | ||
| @@ -6911,7 +6911,8 @@ int si_dpm_init(struct radeon_device *rdev) | |||
| 6911 | eg_pi = &ni_pi->eg; | 6911 | eg_pi = &ni_pi->eg; |
| 6912 | pi = &eg_pi->rv7xx; | 6912 | pi = &eg_pi->rv7xx; |
| 6913 | 6913 | ||
| 6914 | speed_cap = pcie_get_speed_cap(root); | 6914 | if (!pci_is_root_bus(rdev->pdev->bus)) |
| 6915 | speed_cap = pcie_get_speed_cap(root); | ||
| 6915 | if (speed_cap == PCI_SPEED_UNKNOWN) { | 6916 | if (speed_cap == PCI_SPEED_UNKNOWN) { |
| 6916 | si_pi->sys_pcie_mask = 0; | 6917 | si_pi->sys_pcie_mask = 0; |
| 6917 | } else { | 6918 | } else { |
diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c index 37f93022a106..c0351abf83a3 100644 --- a/drivers/gpu/drm/rockchip/rockchip_rgb.c +++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c | |||
| @@ -1,17 +1,8 @@ | |||
| 1 | //SPDX-License-Identifier: GPL-2.0+ | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd | 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd |
| 4 | * Author: | 4 | * Author: |
| 5 | * Sandy Huang <hjc@rock-chips.com> | 5 | * Sandy Huang <hjc@rock-chips.com> |
| 6 | * | ||
| 7 | * This software is licensed under the terms of the GNU General Public | ||
| 8 | * License version 2, as published by the Free Software Foundation, and | ||
| 9 | * may be copied, distributed, and modified under those terms. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | */ | 6 | */ |
| 16 | 7 | ||
| 17 | #include <drm/drmP.h> | 8 | #include <drm/drmP.h> |
diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.h b/drivers/gpu/drm/rockchip/rockchip_rgb.h index 38b52e63b2b0..27b9635124bc 100644 --- a/drivers/gpu/drm/rockchip/rockchip_rgb.h +++ b/drivers/gpu/drm/rockchip/rockchip_rgb.h | |||
| @@ -1,17 +1,8 @@ | |||
| 1 | //SPDX-License-Identifier: GPL-2.0+ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd | 3 | * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd |
| 4 | * Author: | 4 | * Author: |
| 5 | * Sandy Huang <hjc@rock-chips.com> | 5 | * Sandy Huang <hjc@rock-chips.com> |
| 6 | * | ||
| 7 | * This software is licensed under the terms of the GNU General Public | ||
| 8 | * License version 2, as published by the Free Software Foundation, and | ||
| 9 | * may be copied, distributed, and modified under those terms. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | */ | 6 | */ |
| 16 | 7 | ||
| 17 | #ifdef CONFIG_ROCKCHIP_RGB | 8 | #ifdef CONFIG_ROCKCHIP_RGB |
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 061d2e0d9011..416da5376701 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | |||
| @@ -92,6 +92,8 @@ static void sun4i_hdmi_disable(struct drm_encoder *encoder) | |||
| 92 | val = readl(hdmi->base + SUN4I_HDMI_VID_CTRL_REG); | 92 | val = readl(hdmi->base + SUN4I_HDMI_VID_CTRL_REG); |
| 93 | val &= ~SUN4I_HDMI_VID_CTRL_ENABLE; | 93 | val &= ~SUN4I_HDMI_VID_CTRL_ENABLE; |
| 94 | writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); | 94 | writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); |
| 95 | |||
| 96 | clk_disable_unprepare(hdmi->tmds_clk); | ||
| 95 | } | 97 | } |
| 96 | 98 | ||
| 97 | static void sun4i_hdmi_enable(struct drm_encoder *encoder) | 99 | static void sun4i_hdmi_enable(struct drm_encoder *encoder) |
| @@ -102,6 +104,8 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder) | |||
| 102 | 104 | ||
| 103 | DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); | 105 | DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); |
| 104 | 106 | ||
| 107 | clk_prepare_enable(hdmi->tmds_clk); | ||
| 108 | |||
| 105 | sun4i_hdmi_setup_avi_infoframes(hdmi, mode); | 109 | sun4i_hdmi_setup_avi_infoframes(hdmi, mode); |
| 106 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI); | 110 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI); |
| 107 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END); | 111 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END); |
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 0420f5c978b9..cf45d0f940f9 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c | |||
| @@ -761,6 +761,7 @@ static int sun4i_tcon_init_clocks(struct device *dev, | |||
| 761 | return PTR_ERR(tcon->sclk0); | 761 | return PTR_ERR(tcon->sclk0); |
| 762 | } | 762 | } |
| 763 | } | 763 | } |
| 764 | clk_prepare_enable(tcon->sclk0); | ||
| 764 | 765 | ||
| 765 | if (tcon->quirks->has_channel_1) { | 766 | if (tcon->quirks->has_channel_1) { |
| 766 | tcon->sclk1 = devm_clk_get(dev, "tcon-ch1"); | 767 | tcon->sclk1 = devm_clk_get(dev, "tcon-ch1"); |
| @@ -775,6 +776,7 @@ static int sun4i_tcon_init_clocks(struct device *dev, | |||
| 775 | 776 | ||
| 776 | static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon) | 777 | static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon) |
| 777 | { | 778 | { |
| 779 | clk_disable_unprepare(tcon->sclk0); | ||
| 778 | clk_disable_unprepare(tcon->clk); | 780 | clk_disable_unprepare(tcon->clk); |
| 779 | } | 781 | } |
| 780 | 782 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 25afb1d594e3..7ef5dcb06104 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | **************************************************************************/ | 26 | **************************************************************************/ |
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/console.h> | 28 | #include <linux/console.h> |
| 29 | #include <linux/dma-mapping.h> | ||
| 29 | 30 | ||
| 30 | #include <drm/drmP.h> | 31 | #include <drm/drmP.h> |
| 31 | #include "vmwgfx_drv.h" | 32 | #include "vmwgfx_drv.h" |
| @@ -34,7 +35,6 @@ | |||
| 34 | #include <drm/ttm/ttm_placement.h> | 35 | #include <drm/ttm/ttm_placement.h> |
| 35 | #include <drm/ttm/ttm_bo_driver.h> | 36 | #include <drm/ttm/ttm_bo_driver.h> |
| 36 | #include <drm/ttm/ttm_module.h> | 37 | #include <drm/ttm/ttm_module.h> |
| 37 | #include <linux/intel-iommu.h> | ||
| 38 | 38 | ||
| 39 | #define VMWGFX_DRIVER_DESC "Linux drm driver for VMware graphics devices" | 39 | #define VMWGFX_DRIVER_DESC "Linux drm driver for VMware graphics devices" |
| 40 | #define VMWGFX_CHIP_SVGAII 0 | 40 | #define VMWGFX_CHIP_SVGAII 0 |
| @@ -546,6 +546,21 @@ static void vmw_get_initial_size(struct vmw_private *dev_priv) | |||
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | /** | 548 | /** |
| 549 | * vmw_assume_iommu - Figure out whether coherent dma-remapping might be | ||
| 550 | * taking place. | ||
| 551 | * @dev: Pointer to the struct drm_device. | ||
| 552 | * | ||
| 553 | * Return: true if iommu present, false otherwise. | ||
| 554 | */ | ||
| 555 | static bool vmw_assume_iommu(struct drm_device *dev) | ||
| 556 | { | ||
| 557 | const struct dma_map_ops *ops = get_dma_ops(dev->dev); | ||
| 558 | |||
| 559 | return !dma_is_direct(ops) && ops && | ||
| 560 | ops->map_page != dma_direct_map_page; | ||
| 561 | } | ||
| 562 | |||
| 563 | /** | ||
| 549 | * vmw_dma_select_mode - Determine how DMA mappings should be set up for this | 564 | * vmw_dma_select_mode - Determine how DMA mappings should be set up for this |
| 550 | * system. | 565 | * system. |
| 551 | * | 566 | * |
| @@ -565,55 +580,27 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) | |||
| 565 | [vmw_dma_alloc_coherent] = "Using coherent TTM pages.", | 580 | [vmw_dma_alloc_coherent] = "Using coherent TTM pages.", |
| 566 | [vmw_dma_map_populate] = "Keeping DMA mappings.", | 581 | [vmw_dma_map_populate] = "Keeping DMA mappings.", |
| 567 | [vmw_dma_map_bind] = "Giving up DMA mappings early."}; | 582 | [vmw_dma_map_bind] = "Giving up DMA mappings early."}; |
| 568 | #ifdef CONFIG_X86 | ||
| 569 | const struct dma_map_ops *dma_ops = get_dma_ops(dev_priv->dev->dev); | ||
| 570 | 583 | ||
| 571 | #ifdef CONFIG_INTEL_IOMMU | 584 | if (vmw_force_coherent) |
| 572 | if (intel_iommu_enabled) { | 585 | dev_priv->map_mode = vmw_dma_alloc_coherent; |
| 586 | else if (vmw_assume_iommu(dev_priv->dev)) | ||
| 573 | dev_priv->map_mode = vmw_dma_map_populate; | 587 | dev_priv->map_mode = vmw_dma_map_populate; |
| 574 | goto out_fixup; | 588 | else if (!vmw_force_iommu) |
| 575 | } | ||
| 576 | #endif | ||
| 577 | |||
| 578 | if (!(vmw_force_iommu || vmw_force_coherent)) { | ||
| 579 | dev_priv->map_mode = vmw_dma_phys; | 589 | dev_priv->map_mode = vmw_dma_phys; |
| 580 | DRM_INFO("DMA map mode: %s\n", names[dev_priv->map_mode]); | 590 | else if (IS_ENABLED(CONFIG_SWIOTLB) && swiotlb_nr_tbl()) |
| 581 | return 0; | ||
| 582 | } | ||
| 583 | |||
| 584 | dev_priv->map_mode = vmw_dma_map_populate; | ||
| 585 | |||
| 586 | if (dma_ops && dma_ops->sync_single_for_cpu) | ||
| 587 | dev_priv->map_mode = vmw_dma_alloc_coherent; | 591 | dev_priv->map_mode = vmw_dma_alloc_coherent; |
| 588 | #ifdef CONFIG_SWIOTLB | 592 | else |
| 589 | if (swiotlb_nr_tbl() == 0) | ||
| 590 | dev_priv->map_mode = vmw_dma_map_populate; | 593 | dev_priv->map_mode = vmw_dma_map_populate; |
| 591 | #endif | ||
| 592 | 594 | ||
| 593 | #ifdef CONFIG_INTEL_IOMMU | 595 | if (dev_priv->map_mode == vmw_dma_map_populate && vmw_restrict_iommu) |
| 594 | out_fixup: | ||
| 595 | #endif | ||
| 596 | if (dev_priv->map_mode == vmw_dma_map_populate && | ||
| 597 | vmw_restrict_iommu) | ||
| 598 | dev_priv->map_mode = vmw_dma_map_bind; | 596 | dev_priv->map_mode = vmw_dma_map_bind; |
| 599 | 597 | ||
| 600 | if (vmw_force_coherent) | 598 | /* No TTM coherent page pool? FIXME: Ask TTM instead! */ |
| 601 | dev_priv->map_mode = vmw_dma_alloc_coherent; | 599 | if (!(IS_ENABLED(CONFIG_SWIOTLB) || IS_ENABLED(CONFIG_INTEL_IOMMU)) && |
| 602 | 600 | (dev_priv->map_mode == vmw_dma_alloc_coherent)) | |
| 603 | #if !defined(CONFIG_SWIOTLB) && !defined(CONFIG_INTEL_IOMMU) | ||
| 604 | /* | ||
| 605 | * No coherent page pool | ||
| 606 | */ | ||
| 607 | if (dev_priv->map_mode == vmw_dma_alloc_coherent) | ||
| 608 | return -EINVAL; | 601 | return -EINVAL; |
| 609 | #endif | ||
| 610 | |||
| 611 | #else /* CONFIG_X86 */ | ||
| 612 | dev_priv->map_mode = vmw_dma_map_populate; | ||
| 613 | #endif /* CONFIG_X86 */ | ||
| 614 | 602 | ||
| 615 | DRM_INFO("DMA map mode: %s\n", names[dev_priv->map_mode]); | 603 | DRM_INFO("DMA map mode: %s\n", names[dev_priv->map_mode]); |
| 616 | |||
| 617 | return 0; | 604 | return 0; |
| 618 | } | 605 | } |
| 619 | 606 | ||
| @@ -625,24 +612,20 @@ out_fixup: | |||
| 625 | * With 32-bit we can only handle 32 bit PFNs. Optionally set that | 612 | * With 32-bit we can only handle 32 bit PFNs. Optionally set that |
| 626 | * restriction also for 64-bit systems. | 613 | * restriction also for 64-bit systems. |
| 627 | */ | 614 | */ |
| 628 | #ifdef CONFIG_INTEL_IOMMU | ||
| 629 | static int vmw_dma_masks(struct vmw_private *dev_priv) | 615 | static int vmw_dma_masks(struct vmw_private *dev_priv) |
| 630 | { | 616 | { |
| 631 | struct drm_device *dev = dev_priv->dev; | 617 | struct drm_device *dev = dev_priv->dev; |
| 618 | int ret = 0; | ||
| 632 | 619 | ||
| 633 | if (intel_iommu_enabled && | 620 | ret = dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64)); |
| 621 | if (dev_priv->map_mode != vmw_dma_phys && | ||
| 634 | (sizeof(unsigned long) == 4 || vmw_restrict_dma_mask)) { | 622 | (sizeof(unsigned long) == 4 || vmw_restrict_dma_mask)) { |
| 635 | DRM_INFO("Restricting DMA addresses to 44 bits.\n"); | 623 | DRM_INFO("Restricting DMA addresses to 44 bits.\n"); |
| 636 | return dma_set_mask(dev->dev, DMA_BIT_MASK(44)); | 624 | return dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(44)); |
| 637 | } | 625 | } |
| 638 | return 0; | 626 | |
| 639 | } | 627 | return ret; |
| 640 | #else | ||
| 641 | static int vmw_dma_masks(struct vmw_private *dev_priv) | ||
| 642 | { | ||
| 643 | return 0; | ||
| 644 | } | 628 | } |
| 645 | #endif | ||
| 646 | 629 | ||
| 647 | static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | 630 | static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) |
| 648 | { | 631 | { |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index f2d13a72c05d..88b8178d4687 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
| @@ -3570,7 +3570,7 @@ int vmw_execbuf_fence_commands(struct drm_file *file_priv, | |||
| 3570 | *p_fence = NULL; | 3570 | *p_fence = NULL; |
| 3571 | } | 3571 | } |
| 3572 | 3572 | ||
| 3573 | return 0; | 3573 | return ret; |
| 3574 | } | 3574 | } |
| 3575 | 3575 | ||
| 3576 | /** | 3576 | /** |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index b351fb5214d3..ed2f67822f45 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
| @@ -1646,7 +1646,7 @@ static int vmw_kms_check_topology(struct drm_device *dev, | |||
| 1646 | struct drm_connector_state *conn_state; | 1646 | struct drm_connector_state *conn_state; |
| 1647 | struct vmw_connector_state *vmw_conn_state; | 1647 | struct vmw_connector_state *vmw_conn_state; |
| 1648 | 1648 | ||
| 1649 | if (!du->pref_active) { | 1649 | if (!du->pref_active && new_crtc_state->enable) { |
| 1650 | ret = -EINVAL; | 1650 | ret = -EINVAL; |
| 1651 | goto clean; | 1651 | goto clean; |
| 1652 | } | 1652 | } |
| @@ -2554,8 +2554,8 @@ void vmw_kms_helper_validation_finish(struct vmw_private *dev_priv, | |||
| 2554 | user_fence_rep) | 2554 | user_fence_rep) |
| 2555 | { | 2555 | { |
| 2556 | struct vmw_fence_obj *fence = NULL; | 2556 | struct vmw_fence_obj *fence = NULL; |
| 2557 | uint32_t handle; | 2557 | uint32_t handle = 0; |
| 2558 | int ret; | 2558 | int ret = 0; |
| 2559 | 2559 | ||
| 2560 | if (file_priv || user_fence_rep || vmw_validation_has_bos(ctx) || | 2560 | if (file_priv || user_fence_rep || vmw_validation_has_bos(ctx) || |
| 2561 | out_fence) | 2561 | out_fence) |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index f41d5fe51abe..9993b692598f 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -125,6 +125,7 @@ static int open_collection(struct hid_parser *parser, unsigned type) | |||
| 125 | { | 125 | { |
| 126 | struct hid_collection *collection; | 126 | struct hid_collection *collection; |
| 127 | unsigned usage; | 127 | unsigned usage; |
| 128 | int collection_index; | ||
| 128 | 129 | ||
| 129 | usage = parser->local.usage[0]; | 130 | usage = parser->local.usage[0]; |
| 130 | 131 | ||
| @@ -167,13 +168,13 @@ static int open_collection(struct hid_parser *parser, unsigned type) | |||
| 167 | parser->collection_stack[parser->collection_stack_ptr++] = | 168 | parser->collection_stack[parser->collection_stack_ptr++] = |
| 168 | parser->device->maxcollection; | 169 | parser->device->maxcollection; |
| 169 | 170 | ||
| 170 | collection = parser->device->collection + | 171 | collection_index = parser->device->maxcollection++; |
| 171 | parser->device->maxcollection++; | 172 | collection = parser->device->collection + collection_index; |
| 172 | collection->type = type; | 173 | collection->type = type; |
| 173 | collection->usage = usage; | 174 | collection->usage = usage; |
| 174 | collection->level = parser->collection_stack_ptr - 1; | 175 | collection->level = parser->collection_stack_ptr - 1; |
| 175 | collection->parent = parser->active_collection; | 176 | collection->parent_idx = (collection->level == 0) ? -1 : |
| 176 | parser->active_collection = collection; | 177 | parser->collection_stack[collection->level - 1]; |
| 177 | 178 | ||
| 178 | if (type == HID_COLLECTION_APPLICATION) | 179 | if (type == HID_COLLECTION_APPLICATION) |
| 179 | parser->device->maxapplication++; | 180 | parser->device->maxapplication++; |
| @@ -192,8 +193,6 @@ static int close_collection(struct hid_parser *parser) | |||
| 192 | return -EINVAL; | 193 | return -EINVAL; |
| 193 | } | 194 | } |
| 194 | parser->collection_stack_ptr--; | 195 | parser->collection_stack_ptr--; |
| 195 | if (parser->active_collection) | ||
| 196 | parser->active_collection = parser->active_collection->parent; | ||
| 197 | return 0; | 196 | return 0; |
| 198 | } | 197 | } |
| 199 | 198 | ||
| @@ -1006,10 +1005,12 @@ static void hid_apply_multiplier_to_field(struct hid_device *hid, | |||
| 1006 | usage = &field->usage[i]; | 1005 | usage = &field->usage[i]; |
| 1007 | 1006 | ||
| 1008 | collection = &hid->collection[usage->collection_index]; | 1007 | collection = &hid->collection[usage->collection_index]; |
| 1009 | while (collection && collection != multiplier_collection) | 1008 | while (collection->parent_idx != -1 && |
| 1010 | collection = collection->parent; | 1009 | collection != multiplier_collection) |
| 1010 | collection = &hid->collection[collection->parent_idx]; | ||
| 1011 | 1011 | ||
| 1012 | if (collection || multiplier_collection == NULL) | 1012 | if (collection->parent_idx != -1 || |
| 1013 | multiplier_collection == NULL) | ||
| 1013 | usage->resolution_multiplier = effective_multiplier; | 1014 | usage->resolution_multiplier = effective_multiplier; |
| 1014 | 1015 | ||
| 1015 | } | 1016 | } |
| @@ -1044,9 +1045,9 @@ static void hid_apply_multiplier(struct hid_device *hid, | |||
| 1044 | * applicable fields later. | 1045 | * applicable fields later. |
| 1045 | */ | 1046 | */ |
| 1046 | multiplier_collection = &hid->collection[multiplier->usage->collection_index]; | 1047 | multiplier_collection = &hid->collection[multiplier->usage->collection_index]; |
| 1047 | while (multiplier_collection && | 1048 | while (multiplier_collection->parent_idx != -1 && |
| 1048 | multiplier_collection->type != HID_COLLECTION_LOGICAL) | 1049 | multiplier_collection->type != HID_COLLECTION_LOGICAL) |
| 1049 | multiplier_collection = multiplier_collection->parent; | 1050 | multiplier_collection = &hid->collection[multiplier_collection->parent_idx]; |
| 1050 | 1051 | ||
| 1051 | effective_multiplier = hid_calculate_multiplier(hid, multiplier); | 1052 | effective_multiplier = hid_calculate_multiplier(hid, multiplier); |
| 1052 | 1053 | ||
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index c530476edba6..ac9fda1b5a72 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | #include <linux/debugfs.h> | 31 | #include <linux/debugfs.h> |
| 32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
| 33 | #include <linux/kfifo.h> | ||
| 33 | #include <linux/sched/signal.h> | 34 | #include <linux/sched/signal.h> |
| 34 | #include <linux/export.h> | 35 | #include <linux/export.h> |
| 35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
| @@ -661,17 +662,12 @@ EXPORT_SYMBOL_GPL(hid_dump_device); | |||
| 661 | /* enqueue string to 'events' ring buffer */ | 662 | /* enqueue string to 'events' ring buffer */ |
| 662 | void hid_debug_event(struct hid_device *hdev, char *buf) | 663 | void hid_debug_event(struct hid_device *hdev, char *buf) |
| 663 | { | 664 | { |
| 664 | unsigned i; | ||
| 665 | struct hid_debug_list *list; | 665 | struct hid_debug_list *list; |
| 666 | unsigned long flags; | 666 | unsigned long flags; |
| 667 | 667 | ||
| 668 | spin_lock_irqsave(&hdev->debug_list_lock, flags); | 668 | spin_lock_irqsave(&hdev->debug_list_lock, flags); |
| 669 | list_for_each_entry(list, &hdev->debug_list, node) { | 669 | list_for_each_entry(list, &hdev->debug_list, node) |
| 670 | for (i = 0; buf[i]; i++) | 670 | kfifo_in(&list->hid_debug_fifo, buf, strlen(buf)); |
| 671 | list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] = | ||
| 672 | buf[i]; | ||
| 673 | list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE; | ||
| 674 | } | ||
| 675 | spin_unlock_irqrestore(&hdev->debug_list_lock, flags); | 671 | spin_unlock_irqrestore(&hdev->debug_list_lock, flags); |
| 676 | 672 | ||
| 677 | wake_up_interruptible(&hdev->debug_wait); | 673 | wake_up_interruptible(&hdev->debug_wait); |
| @@ -722,8 +718,7 @@ void hid_dump_input(struct hid_device *hdev, struct hid_usage *usage, __s32 valu | |||
| 722 | hid_debug_event(hdev, buf); | 718 | hid_debug_event(hdev, buf); |
| 723 | 719 | ||
| 724 | kfree(buf); | 720 | kfree(buf); |
| 725 | wake_up_interruptible(&hdev->debug_wait); | 721 | wake_up_interruptible(&hdev->debug_wait); |
| 726 | |||
| 727 | } | 722 | } |
| 728 | EXPORT_SYMBOL_GPL(hid_dump_input); | 723 | EXPORT_SYMBOL_GPL(hid_dump_input); |
| 729 | 724 | ||
| @@ -1083,8 +1078,8 @@ static int hid_debug_events_open(struct inode *inode, struct file *file) | |||
| 1083 | goto out; | 1078 | goto out; |
| 1084 | } | 1079 | } |
| 1085 | 1080 | ||
| 1086 | if (!(list->hid_debug_buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_KERNEL))) { | 1081 | err = kfifo_alloc(&list->hid_debug_fifo, HID_DEBUG_FIFOSIZE, GFP_KERNEL); |
| 1087 | err = -ENOMEM; | 1082 | if (err) { |
| 1088 | kfree(list); | 1083 | kfree(list); |
| 1089 | goto out; | 1084 | goto out; |
| 1090 | } | 1085 | } |
| @@ -1104,77 +1099,57 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, | |||
| 1104 | size_t count, loff_t *ppos) | 1099 | size_t count, loff_t *ppos) |
| 1105 | { | 1100 | { |
| 1106 | struct hid_debug_list *list = file->private_data; | 1101 | struct hid_debug_list *list = file->private_data; |
| 1107 | int ret = 0, len; | 1102 | int ret = 0, copied; |
| 1108 | DECLARE_WAITQUEUE(wait, current); | 1103 | DECLARE_WAITQUEUE(wait, current); |
| 1109 | 1104 | ||
| 1110 | mutex_lock(&list->read_mutex); | 1105 | mutex_lock(&list->read_mutex); |
| 1111 | while (ret == 0) { | 1106 | if (kfifo_is_empty(&list->hid_debug_fifo)) { |
| 1112 | if (list->head == list->tail) { | 1107 | add_wait_queue(&list->hdev->debug_wait, &wait); |
| 1113 | add_wait_queue(&list->hdev->debug_wait, &wait); | 1108 | set_current_state(TASK_INTERRUPTIBLE); |
| 1114 | set_current_state(TASK_INTERRUPTIBLE); | 1109 | |
| 1115 | 1110 | while (kfifo_is_empty(&list->hid_debug_fifo)) { | |
| 1116 | while (list->head == list->tail) { | 1111 | if (file->f_flags & O_NONBLOCK) { |
| 1117 | if (file->f_flags & O_NONBLOCK) { | 1112 | ret = -EAGAIN; |
| 1118 | ret = -EAGAIN; | 1113 | break; |
| 1119 | break; | 1114 | } |
| 1120 | } | ||
| 1121 | if (signal_pending(current)) { | ||
| 1122 | ret = -ERESTARTSYS; | ||
| 1123 | break; | ||
| 1124 | } | ||
| 1125 | 1115 | ||
| 1126 | if (!list->hdev || !list->hdev->debug) { | 1116 | if (signal_pending(current)) { |
| 1127 | ret = -EIO; | 1117 | ret = -ERESTARTSYS; |
| 1128 | set_current_state(TASK_RUNNING); | 1118 | break; |
| 1129 | goto out; | 1119 | } |
| 1130 | } | ||
| 1131 | 1120 | ||
| 1132 | /* allow O_NONBLOCK from other threads */ | 1121 | /* if list->hdev is NULL we cannot remove_wait_queue(). |
| 1133 | mutex_unlock(&list->read_mutex); | 1122 | * if list->hdev->debug is 0 then hid_debug_unregister() |
| 1134 | schedule(); | 1123 | * was already called and list->hdev is being destroyed. |
| 1135 | mutex_lock(&list->read_mutex); | 1124 | * if we add remove_wait_queue() here we can hit a race. |
| 1136 | set_current_state(TASK_INTERRUPTIBLE); | 1125 | */ |
| 1126 | if (!list->hdev || !list->hdev->debug) { | ||
| 1127 | ret = -EIO; | ||
| 1128 | set_current_state(TASK_RUNNING); | ||
| 1129 | goto out; | ||
| 1137 | } | 1130 | } |
| 1138 | 1131 | ||
| 1139 | set_current_state(TASK_RUNNING); | 1132 | /* allow O_NONBLOCK from other threads */ |
| 1140 | remove_wait_queue(&list->hdev->debug_wait, &wait); | 1133 | mutex_unlock(&list->read_mutex); |
| 1134 | schedule(); | ||
| 1135 | mutex_lock(&list->read_mutex); | ||
| 1136 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 1141 | } | 1137 | } |
| 1142 | 1138 | ||
| 1143 | if (ret) | 1139 | __set_current_state(TASK_RUNNING); |
| 1144 | goto out; | 1140 | remove_wait_queue(&list->hdev->debug_wait, &wait); |
| 1145 | 1141 | ||
| 1146 | /* pass the ringbuffer contents to userspace */ | 1142 | if (ret) |
| 1147 | copy_rest: | ||
| 1148 | if (list->tail == list->head) | ||
| 1149 | goto out; | 1143 | goto out; |
| 1150 | if (list->tail > list->head) { | ||
| 1151 | len = list->tail - list->head; | ||
| 1152 | if (len > count) | ||
| 1153 | len = count; | ||
| 1154 | |||
| 1155 | if (copy_to_user(buffer + ret, &list->hid_debug_buf[list->head], len)) { | ||
| 1156 | ret = -EFAULT; | ||
| 1157 | goto out; | ||
| 1158 | } | ||
| 1159 | ret += len; | ||
| 1160 | list->head += len; | ||
| 1161 | } else { | ||
| 1162 | len = HID_DEBUG_BUFSIZE - list->head; | ||
| 1163 | if (len > count) | ||
| 1164 | len = count; | ||
| 1165 | |||
| 1166 | if (copy_to_user(buffer, &list->hid_debug_buf[list->head], len)) { | ||
| 1167 | ret = -EFAULT; | ||
| 1168 | goto out; | ||
| 1169 | } | ||
| 1170 | list->head = 0; | ||
| 1171 | ret += len; | ||
| 1172 | count -= len; | ||
| 1173 | if (count > 0) | ||
| 1174 | goto copy_rest; | ||
| 1175 | } | ||
| 1176 | |||
| 1177 | } | 1144 | } |
| 1145 | |||
| 1146 | /* pass the fifo content to userspace, locking is not needed with only | ||
| 1147 | * one concurrent reader and one concurrent writer | ||
| 1148 | */ | ||
| 1149 | ret = kfifo_to_user(&list->hid_debug_fifo, buffer, count, &copied); | ||
| 1150 | if (ret) | ||
| 1151 | goto out; | ||
| 1152 | ret = copied; | ||
| 1178 | out: | 1153 | out: |
| 1179 | mutex_unlock(&list->read_mutex); | 1154 | mutex_unlock(&list->read_mutex); |
| 1180 | return ret; | 1155 | return ret; |
| @@ -1185,7 +1160,7 @@ static __poll_t hid_debug_events_poll(struct file *file, poll_table *wait) | |||
| 1185 | struct hid_debug_list *list = file->private_data; | 1160 | struct hid_debug_list *list = file->private_data; |
| 1186 | 1161 | ||
| 1187 | poll_wait(file, &list->hdev->debug_wait, wait); | 1162 | poll_wait(file, &list->hdev->debug_wait, wait); |
| 1188 | if (list->head != list->tail) | 1163 | if (!kfifo_is_empty(&list->hid_debug_fifo)) |
| 1189 | return EPOLLIN | EPOLLRDNORM; | 1164 | return EPOLLIN | EPOLLRDNORM; |
| 1190 | if (!list->hdev->debug) | 1165 | if (!list->hdev->debug) |
| 1191 | return EPOLLERR | EPOLLHUP; | 1166 | return EPOLLERR | EPOLLHUP; |
| @@ -1200,7 +1175,7 @@ static int hid_debug_events_release(struct inode *inode, struct file *file) | |||
| 1200 | spin_lock_irqsave(&list->hdev->debug_list_lock, flags); | 1175 | spin_lock_irqsave(&list->hdev->debug_list_lock, flags); |
| 1201 | list_del(&list->node); | 1176 | list_del(&list->node); |
| 1202 | spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); | 1177 | spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); |
| 1203 | kfree(list->hid_debug_buf); | 1178 | kfifo_free(&list->hid_debug_fifo); |
| 1204 | kfree(list); | 1179 | kfree(list); |
| 1205 | 1180 | ||
| 1206 | return 0; | 1181 | return 0; |
| @@ -1246,4 +1221,3 @@ void hid_debug_exit(void) | |||
| 1246 | { | 1221 | { |
| 1247 | debugfs_remove_recursive(hid_debug_root); | 1222 | debugfs_remove_recursive(hid_debug_root); |
| 1248 | } | 1223 | } |
| 1249 | |||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 518fa76414f5..24f846d67478 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -461,6 +461,9 @@ | |||
| 461 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a | 461 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a |
| 462 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 | 462 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 |
| 463 | 463 | ||
| 464 | #define I2C_VENDOR_ID_GOODIX 0x27c6 | ||
| 465 | #define I2C_DEVICE_ID_GOODIX_01F0 0x01f0 | ||
| 466 | |||
| 464 | #define USB_VENDOR_ID_GOODTOUCH 0x1aad | 467 | #define USB_VENDOR_ID_GOODTOUCH 0x1aad |
| 465 | #define USB_DEVICE_ID_GOODTOUCH_000f 0x000f | 468 | #define USB_DEVICE_ID_GOODTOUCH_000f 0x000f |
| 466 | 469 | ||
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index 8555ce7e737b..c5edfa966343 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c | |||
| @@ -179,6 +179,8 @@ static const struct i2c_hid_quirks { | |||
| 179 | I2C_HID_QUIRK_DELAY_AFTER_SLEEP }, | 179 | I2C_HID_QUIRK_DELAY_AFTER_SLEEP }, |
| 180 | { USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001, | 180 | { USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001, |
| 181 | I2C_HID_QUIRK_NO_RUNTIME_PM }, | 181 | I2C_HID_QUIRK_NO_RUNTIME_PM }, |
| 182 | { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01F0, | ||
| 183 | I2C_HID_QUIRK_NO_RUNTIME_PM }, | ||
| 182 | { 0, 0 } | 184 | { 0, 0 } |
| 183 | }; | 185 | }; |
| 184 | 186 | ||
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index ce0ba2062723..bea4c9850247 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c | |||
| @@ -701,19 +701,12 @@ static int vmbus_close_internal(struct vmbus_channel *channel) | |||
| 701 | int vmbus_disconnect_ring(struct vmbus_channel *channel) | 701 | int vmbus_disconnect_ring(struct vmbus_channel *channel) |
| 702 | { | 702 | { |
| 703 | struct vmbus_channel *cur_channel, *tmp; | 703 | struct vmbus_channel *cur_channel, *tmp; |
| 704 | unsigned long flags; | ||
| 705 | LIST_HEAD(list); | ||
| 706 | int ret; | 704 | int ret; |
| 707 | 705 | ||
| 708 | if (channel->primary_channel != NULL) | 706 | if (channel->primary_channel != NULL) |
| 709 | return -EINVAL; | 707 | return -EINVAL; |
| 710 | 708 | ||
| 711 | /* Snapshot the list of subchannels */ | 709 | list_for_each_entry_safe(cur_channel, tmp, &channel->sc_list, sc_list) { |
| 712 | spin_lock_irqsave(&channel->lock, flags); | ||
| 713 | list_splice_init(&channel->sc_list, &list); | ||
| 714 | spin_unlock_irqrestore(&channel->lock, flags); | ||
| 715 | |||
| 716 | list_for_each_entry_safe(cur_channel, tmp, &list, sc_list) { | ||
| 717 | if (cur_channel->rescind) | 710 | if (cur_channel->rescind) |
| 718 | wait_for_completion(&cur_channel->rescind_event); | 711 | wait_for_completion(&cur_channel->rescind_event); |
| 719 | 712 | ||
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 5301fef16c31..7c6349a50ef1 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c | |||
| @@ -888,12 +888,14 @@ static unsigned long handle_pg_range(unsigned long pg_start, | |||
| 888 | pfn_cnt -= pgs_ol; | 888 | pfn_cnt -= pgs_ol; |
| 889 | /* | 889 | /* |
| 890 | * Check if the corresponding memory block is already | 890 | * Check if the corresponding memory block is already |
| 891 | * online by checking its last previously backed page. | 891 | * online. It is possible to observe struct pages still |
| 892 | * In case it is we need to bring rest (which was not | 892 | * being uninitialized here so check section instead. |
| 893 | * backed previously) online too. | 893 | * In case the section is online we need to bring the |
| 894 | * rest of pfns (which were not backed previously) | ||
| 895 | * online too. | ||
| 894 | */ | 896 | */ |
| 895 | if (start_pfn > has->start_pfn && | 897 | if (start_pfn > has->start_pfn && |
| 896 | !PageReserved(pfn_to_page(start_pfn - 1))) | 898 | online_section_nr(pfn_to_section_nr(start_pfn))) |
| 897 | hv_bring_pgs_online(has, start_pfn, pgs_ol); | 899 | hv_bring_pgs_online(has, start_pfn, pgs_ol); |
| 898 | 900 | ||
| 899 | } | 901 | } |
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 64d0c85d5161..1f1a55e07733 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c | |||
| @@ -164,26 +164,25 @@ hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi, | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | /* Get various debug metrics for the specified ring buffer. */ | 166 | /* Get various debug metrics for the specified ring buffer. */ |
| 167 | void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, | 167 | int hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, |
| 168 | struct hv_ring_buffer_debug_info *debug_info) | 168 | struct hv_ring_buffer_debug_info *debug_info) |
| 169 | { | 169 | { |
| 170 | u32 bytes_avail_towrite; | 170 | u32 bytes_avail_towrite; |
| 171 | u32 bytes_avail_toread; | 171 | u32 bytes_avail_toread; |
| 172 | 172 | ||
| 173 | if (ring_info->ring_buffer) { | 173 | if (!ring_info->ring_buffer) |
| 174 | hv_get_ringbuffer_availbytes(ring_info, | 174 | return -EINVAL; |
| 175 | &bytes_avail_toread, | 175 | |
| 176 | &bytes_avail_towrite); | 176 | hv_get_ringbuffer_availbytes(ring_info, |
| 177 | 177 | &bytes_avail_toread, | |
| 178 | debug_info->bytes_avail_toread = bytes_avail_toread; | 178 | &bytes_avail_towrite); |
| 179 | debug_info->bytes_avail_towrite = bytes_avail_towrite; | 179 | debug_info->bytes_avail_toread = bytes_avail_toread; |
| 180 | debug_info->current_read_index = | 180 | debug_info->bytes_avail_towrite = bytes_avail_towrite; |
| 181 | ring_info->ring_buffer->read_index; | 181 | debug_info->current_read_index = ring_info->ring_buffer->read_index; |
| 182 | debug_info->current_write_index = | 182 | debug_info->current_write_index = ring_info->ring_buffer->write_index; |
| 183 | ring_info->ring_buffer->write_index; | 183 | debug_info->current_interrupt_mask |
| 184 | debug_info->current_interrupt_mask = | 184 | = ring_info->ring_buffer->interrupt_mask; |
| 185 | ring_info->ring_buffer->interrupt_mask; | 185 | return 0; |
| 186 | } | ||
| 187 | } | 186 | } |
| 188 | EXPORT_SYMBOL_GPL(hv_ringbuffer_get_debuginfo); | 187 | EXPORT_SYMBOL_GPL(hv_ringbuffer_get_debuginfo); |
| 189 | 188 | ||
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index d0ff65675292..403fee01572c 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c | |||
| @@ -313,12 +313,16 @@ static ssize_t out_intr_mask_show(struct device *dev, | |||
| 313 | { | 313 | { |
| 314 | struct hv_device *hv_dev = device_to_hv_device(dev); | 314 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 315 | struct hv_ring_buffer_debug_info outbound; | 315 | struct hv_ring_buffer_debug_info outbound; |
| 316 | int ret; | ||
| 316 | 317 | ||
| 317 | if (!hv_dev->channel) | 318 | if (!hv_dev->channel) |
| 318 | return -ENODEV; | 319 | return -ENODEV; |
| 319 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 320 | |
| 320 | return -EINVAL; | 321 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 321 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 322 | &outbound); |
| 323 | if (ret < 0) | ||
| 324 | return ret; | ||
| 325 | |||
| 322 | return sprintf(buf, "%d\n", outbound.current_interrupt_mask); | 326 | return sprintf(buf, "%d\n", outbound.current_interrupt_mask); |
| 323 | } | 327 | } |
| 324 | static DEVICE_ATTR_RO(out_intr_mask); | 328 | static DEVICE_ATTR_RO(out_intr_mask); |
| @@ -328,12 +332,15 @@ static ssize_t out_read_index_show(struct device *dev, | |||
| 328 | { | 332 | { |
| 329 | struct hv_device *hv_dev = device_to_hv_device(dev); | 333 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 330 | struct hv_ring_buffer_debug_info outbound; | 334 | struct hv_ring_buffer_debug_info outbound; |
| 335 | int ret; | ||
| 331 | 336 | ||
| 332 | if (!hv_dev->channel) | 337 | if (!hv_dev->channel) |
| 333 | return -ENODEV; | 338 | return -ENODEV; |
| 334 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 339 | |
| 335 | return -EINVAL; | 340 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 336 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 341 | &outbound); |
| 342 | if (ret < 0) | ||
| 343 | return ret; | ||
| 337 | return sprintf(buf, "%d\n", outbound.current_read_index); | 344 | return sprintf(buf, "%d\n", outbound.current_read_index); |
| 338 | } | 345 | } |
| 339 | static DEVICE_ATTR_RO(out_read_index); | 346 | static DEVICE_ATTR_RO(out_read_index); |
| @@ -344,12 +351,15 @@ static ssize_t out_write_index_show(struct device *dev, | |||
| 344 | { | 351 | { |
| 345 | struct hv_device *hv_dev = device_to_hv_device(dev); | 352 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 346 | struct hv_ring_buffer_debug_info outbound; | 353 | struct hv_ring_buffer_debug_info outbound; |
| 354 | int ret; | ||
| 347 | 355 | ||
| 348 | if (!hv_dev->channel) | 356 | if (!hv_dev->channel) |
| 349 | return -ENODEV; | 357 | return -ENODEV; |
| 350 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 358 | |
| 351 | return -EINVAL; | 359 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 352 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 360 | &outbound); |
| 361 | if (ret < 0) | ||
| 362 | return ret; | ||
| 353 | return sprintf(buf, "%d\n", outbound.current_write_index); | 363 | return sprintf(buf, "%d\n", outbound.current_write_index); |
| 354 | } | 364 | } |
| 355 | static DEVICE_ATTR_RO(out_write_index); | 365 | static DEVICE_ATTR_RO(out_write_index); |
| @@ -360,12 +370,15 @@ static ssize_t out_read_bytes_avail_show(struct device *dev, | |||
| 360 | { | 370 | { |
| 361 | struct hv_device *hv_dev = device_to_hv_device(dev); | 371 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 362 | struct hv_ring_buffer_debug_info outbound; | 372 | struct hv_ring_buffer_debug_info outbound; |
| 373 | int ret; | ||
| 363 | 374 | ||
| 364 | if (!hv_dev->channel) | 375 | if (!hv_dev->channel) |
| 365 | return -ENODEV; | 376 | return -ENODEV; |
| 366 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 377 | |
| 367 | return -EINVAL; | 378 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 368 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 379 | &outbound); |
| 380 | if (ret < 0) | ||
| 381 | return ret; | ||
| 369 | return sprintf(buf, "%d\n", outbound.bytes_avail_toread); | 382 | return sprintf(buf, "%d\n", outbound.bytes_avail_toread); |
| 370 | } | 383 | } |
| 371 | static DEVICE_ATTR_RO(out_read_bytes_avail); | 384 | static DEVICE_ATTR_RO(out_read_bytes_avail); |
| @@ -376,12 +389,15 @@ static ssize_t out_write_bytes_avail_show(struct device *dev, | |||
| 376 | { | 389 | { |
| 377 | struct hv_device *hv_dev = device_to_hv_device(dev); | 390 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 378 | struct hv_ring_buffer_debug_info outbound; | 391 | struct hv_ring_buffer_debug_info outbound; |
| 392 | int ret; | ||
| 379 | 393 | ||
| 380 | if (!hv_dev->channel) | 394 | if (!hv_dev->channel) |
| 381 | return -ENODEV; | 395 | return -ENODEV; |
| 382 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 396 | |
| 383 | return -EINVAL; | 397 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, |
| 384 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | 398 | &outbound); |
| 399 | if (ret < 0) | ||
| 400 | return ret; | ||
| 385 | return sprintf(buf, "%d\n", outbound.bytes_avail_towrite); | 401 | return sprintf(buf, "%d\n", outbound.bytes_avail_towrite); |
| 386 | } | 402 | } |
| 387 | static DEVICE_ATTR_RO(out_write_bytes_avail); | 403 | static DEVICE_ATTR_RO(out_write_bytes_avail); |
| @@ -391,12 +407,15 @@ static ssize_t in_intr_mask_show(struct device *dev, | |||
| 391 | { | 407 | { |
| 392 | struct hv_device *hv_dev = device_to_hv_device(dev); | 408 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 393 | struct hv_ring_buffer_debug_info inbound; | 409 | struct hv_ring_buffer_debug_info inbound; |
| 410 | int ret; | ||
| 394 | 411 | ||
| 395 | if (!hv_dev->channel) | 412 | if (!hv_dev->channel) |
| 396 | return -ENODEV; | 413 | return -ENODEV; |
| 397 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 414 | |
| 398 | return -EINVAL; | 415 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 399 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 416 | if (ret < 0) |
| 417 | return ret; | ||
| 418 | |||
| 400 | return sprintf(buf, "%d\n", inbound.current_interrupt_mask); | 419 | return sprintf(buf, "%d\n", inbound.current_interrupt_mask); |
| 401 | } | 420 | } |
| 402 | static DEVICE_ATTR_RO(in_intr_mask); | 421 | static DEVICE_ATTR_RO(in_intr_mask); |
| @@ -406,12 +425,15 @@ static ssize_t in_read_index_show(struct device *dev, | |||
| 406 | { | 425 | { |
| 407 | struct hv_device *hv_dev = device_to_hv_device(dev); | 426 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 408 | struct hv_ring_buffer_debug_info inbound; | 427 | struct hv_ring_buffer_debug_info inbound; |
| 428 | int ret; | ||
| 409 | 429 | ||
| 410 | if (!hv_dev->channel) | 430 | if (!hv_dev->channel) |
| 411 | return -ENODEV; | 431 | return -ENODEV; |
| 412 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 432 | |
| 413 | return -EINVAL; | 433 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 414 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 434 | if (ret < 0) |
| 435 | return ret; | ||
| 436 | |||
| 415 | return sprintf(buf, "%d\n", inbound.current_read_index); | 437 | return sprintf(buf, "%d\n", inbound.current_read_index); |
| 416 | } | 438 | } |
| 417 | static DEVICE_ATTR_RO(in_read_index); | 439 | static DEVICE_ATTR_RO(in_read_index); |
| @@ -421,12 +443,15 @@ static ssize_t in_write_index_show(struct device *dev, | |||
| 421 | { | 443 | { |
| 422 | struct hv_device *hv_dev = device_to_hv_device(dev); | 444 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 423 | struct hv_ring_buffer_debug_info inbound; | 445 | struct hv_ring_buffer_debug_info inbound; |
| 446 | int ret; | ||
| 424 | 447 | ||
| 425 | if (!hv_dev->channel) | 448 | if (!hv_dev->channel) |
| 426 | return -ENODEV; | 449 | return -ENODEV; |
| 427 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 450 | |
| 428 | return -EINVAL; | 451 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 429 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 452 | if (ret < 0) |
| 453 | return ret; | ||
| 454 | |||
| 430 | return sprintf(buf, "%d\n", inbound.current_write_index); | 455 | return sprintf(buf, "%d\n", inbound.current_write_index); |
| 431 | } | 456 | } |
| 432 | static DEVICE_ATTR_RO(in_write_index); | 457 | static DEVICE_ATTR_RO(in_write_index); |
| @@ -437,12 +462,15 @@ static ssize_t in_read_bytes_avail_show(struct device *dev, | |||
| 437 | { | 462 | { |
| 438 | struct hv_device *hv_dev = device_to_hv_device(dev); | 463 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 439 | struct hv_ring_buffer_debug_info inbound; | 464 | struct hv_ring_buffer_debug_info inbound; |
| 465 | int ret; | ||
| 440 | 466 | ||
| 441 | if (!hv_dev->channel) | 467 | if (!hv_dev->channel) |
| 442 | return -ENODEV; | 468 | return -ENODEV; |
| 443 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 469 | |
| 444 | return -EINVAL; | 470 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 445 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 471 | if (ret < 0) |
| 472 | return ret; | ||
| 473 | |||
| 446 | return sprintf(buf, "%d\n", inbound.bytes_avail_toread); | 474 | return sprintf(buf, "%d\n", inbound.bytes_avail_toread); |
| 447 | } | 475 | } |
| 448 | static DEVICE_ATTR_RO(in_read_bytes_avail); | 476 | static DEVICE_ATTR_RO(in_read_bytes_avail); |
| @@ -453,12 +481,15 @@ static ssize_t in_write_bytes_avail_show(struct device *dev, | |||
| 453 | { | 481 | { |
| 454 | struct hv_device *hv_dev = device_to_hv_device(dev); | 482 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 455 | struct hv_ring_buffer_debug_info inbound; | 483 | struct hv_ring_buffer_debug_info inbound; |
| 484 | int ret; | ||
| 456 | 485 | ||
| 457 | if (!hv_dev->channel) | 486 | if (!hv_dev->channel) |
| 458 | return -ENODEV; | 487 | return -ENODEV; |
| 459 | if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | 488 | |
| 460 | return -EINVAL; | 489 | ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); |
| 461 | hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | 490 | if (ret < 0) |
| 491 | return ret; | ||
| 492 | |||
| 462 | return sprintf(buf, "%d\n", inbound.bytes_avail_towrite); | 493 | return sprintf(buf, "%d\n", inbound.bytes_avail_towrite); |
| 463 | } | 494 | } |
| 464 | static DEVICE_ATTR_RO(in_write_bytes_avail); | 495 | static DEVICE_ATTR_RO(in_write_bytes_avail); |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index b1086bfb0465..cd9c65f3d404 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
| @@ -1500,8 +1500,7 @@ static int omap_i2c_remove(struct platform_device *pdev) | |||
| 1500 | return 0; | 1500 | return 0; |
| 1501 | } | 1501 | } |
| 1502 | 1502 | ||
| 1503 | #ifdef CONFIG_PM | 1503 | static int __maybe_unused omap_i2c_runtime_suspend(struct device *dev) |
| 1504 | static int omap_i2c_runtime_suspend(struct device *dev) | ||
| 1505 | { | 1504 | { |
| 1506 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); | 1505 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
| 1507 | 1506 | ||
| @@ -1527,7 +1526,7 @@ static int omap_i2c_runtime_suspend(struct device *dev) | |||
| 1527 | return 0; | 1526 | return 0; |
| 1528 | } | 1527 | } |
| 1529 | 1528 | ||
| 1530 | static int omap_i2c_runtime_resume(struct device *dev) | 1529 | static int __maybe_unused omap_i2c_runtime_resume(struct device *dev) |
| 1531 | { | 1530 | { |
| 1532 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); | 1531 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
| 1533 | 1532 | ||
| @@ -1542,20 +1541,18 @@ static int omap_i2c_runtime_resume(struct device *dev) | |||
| 1542 | } | 1541 | } |
| 1543 | 1542 | ||
| 1544 | static const struct dev_pm_ops omap_i2c_pm_ops = { | 1543 | static const struct dev_pm_ops omap_i2c_pm_ops = { |
| 1544 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | ||
| 1545 | pm_runtime_force_resume) | ||
| 1545 | SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, | 1546 | SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, |
| 1546 | omap_i2c_runtime_resume, NULL) | 1547 | omap_i2c_runtime_resume, NULL) |
| 1547 | }; | 1548 | }; |
| 1548 | #define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops) | ||
| 1549 | #else | ||
| 1550 | #define OMAP_I2C_PM_OPS NULL | ||
| 1551 | #endif /* CONFIG_PM */ | ||
| 1552 | 1549 | ||
| 1553 | static struct platform_driver omap_i2c_driver = { | 1550 | static struct platform_driver omap_i2c_driver = { |
| 1554 | .probe = omap_i2c_probe, | 1551 | .probe = omap_i2c_probe, |
| 1555 | .remove = omap_i2c_remove, | 1552 | .remove = omap_i2c_remove, |
| 1556 | .driver = { | 1553 | .driver = { |
| 1557 | .name = "omap_i2c", | 1554 | .name = "omap_i2c", |
| 1558 | .pm = OMAP_I2C_PM_OPS, | 1555 | .pm = &omap_i2c_pm_ops, |
| 1559 | .of_match_table = of_match_ptr(omap_i2c_of_match), | 1556 | .of_match_table = of_match_ptr(omap_i2c_of_match), |
| 1560 | }, | 1557 | }, |
| 1561 | }; | 1558 | }; |
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index c39f89d2deba..2dc628d4f1ae 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c | |||
| @@ -1828,7 +1828,7 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, | |||
| 1828 | 1828 | ||
| 1829 | ret = i3c_master_retrieve_dev_info(newdev); | 1829 | ret = i3c_master_retrieve_dev_info(newdev); |
| 1830 | if (ret) | 1830 | if (ret) |
| 1831 | goto err_free_dev; | 1831 | goto err_detach_dev; |
| 1832 | 1832 | ||
| 1833 | olddev = i3c_master_search_i3c_dev_duplicate(newdev); | 1833 | olddev = i3c_master_search_i3c_dev_duplicate(newdev); |
| 1834 | if (olddev) { | 1834 | if (olddev) { |
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c index f8c00b94817f..bb03079fbade 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c | |||
| @@ -419,12 +419,9 @@ static void dw_i3c_master_enqueue_xfer(struct dw_i3c_master *master, | |||
| 419 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); | 419 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | 422 | static void dw_i3c_master_dequeue_xfer_locked(struct dw_i3c_master *master, |
| 423 | struct dw_i3c_xfer *xfer) | 423 | struct dw_i3c_xfer *xfer) |
| 424 | { | 424 | { |
| 425 | unsigned long flags; | ||
| 426 | |||
| 427 | spin_lock_irqsave(&master->xferqueue.lock, flags); | ||
| 428 | if (master->xferqueue.cur == xfer) { | 425 | if (master->xferqueue.cur == xfer) { |
| 429 | u32 status; | 426 | u32 status; |
| 430 | 427 | ||
| @@ -439,6 +436,15 @@ static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | |||
| 439 | } else { | 436 | } else { |
| 440 | list_del_init(&xfer->node); | 437 | list_del_init(&xfer->node); |
| 441 | } | 438 | } |
| 439 | } | ||
| 440 | |||
| 441 | static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | ||
| 442 | struct dw_i3c_xfer *xfer) | ||
| 443 | { | ||
| 444 | unsigned long flags; | ||
| 445 | |||
| 446 | spin_lock_irqsave(&master->xferqueue.lock, flags); | ||
| 447 | dw_i3c_master_dequeue_xfer_locked(master, xfer); | ||
| 442 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); | 448 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); |
| 443 | } | 449 | } |
| 444 | 450 | ||
| @@ -494,7 +500,7 @@ static void dw_i3c_master_end_xfer_locked(struct dw_i3c_master *master, u32 isr) | |||
| 494 | complete(&xfer->comp); | 500 | complete(&xfer->comp); |
| 495 | 501 | ||
| 496 | if (ret < 0) { | 502 | if (ret < 0) { |
| 497 | dw_i3c_master_dequeue_xfer(master, xfer); | 503 | dw_i3c_master_dequeue_xfer_locked(master, xfer); |
| 498 | writel(readl(master->regs + DEVICE_CTRL) | DEV_CTRL_RESUME, | 504 | writel(readl(master->regs + DEVICE_CTRL) | DEV_CTRL_RESUME, |
| 499 | master->regs + DEVICE_CTRL); | 505 | master->regs + DEVICE_CTRL); |
| 500 | } | 506 | } |
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index da58020a144e..33a28cde126c 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
| @@ -235,21 +235,28 @@ EXPORT_SYMBOL_GPL(ide_prep_sense); | |||
| 235 | 235 | ||
| 236 | int ide_queue_sense_rq(ide_drive_t *drive, void *special) | 236 | int ide_queue_sense_rq(ide_drive_t *drive, void *special) |
| 237 | { | 237 | { |
| 238 | struct request *sense_rq = drive->sense_rq; | 238 | ide_hwif_t *hwif = drive->hwif; |
| 239 | struct request *sense_rq; | ||
| 240 | unsigned long flags; | ||
| 241 | |||
| 242 | spin_lock_irqsave(&hwif->lock, flags); | ||
| 239 | 243 | ||
| 240 | /* deferred failure from ide_prep_sense() */ | 244 | /* deferred failure from ide_prep_sense() */ |
| 241 | if (!drive->sense_rq_armed) { | 245 | if (!drive->sense_rq_armed) { |
| 242 | printk(KERN_WARNING PFX "%s: error queuing a sense request\n", | 246 | printk(KERN_WARNING PFX "%s: error queuing a sense request\n", |
| 243 | drive->name); | 247 | drive->name); |
| 248 | spin_unlock_irqrestore(&hwif->lock, flags); | ||
| 244 | return -ENOMEM; | 249 | return -ENOMEM; |
| 245 | } | 250 | } |
| 246 | 251 | ||
| 252 | sense_rq = drive->sense_rq; | ||
| 247 | ide_req(sense_rq)->special = special; | 253 | ide_req(sense_rq)->special = special; |
| 248 | drive->sense_rq_armed = false; | 254 | drive->sense_rq_armed = false; |
| 249 | 255 | ||
| 250 | drive->hwif->rq = NULL; | 256 | drive->hwif->rq = NULL; |
| 251 | 257 | ||
| 252 | ide_insert_request_head(drive, sense_rq); | 258 | ide_insert_request_head(drive, sense_rq); |
| 259 | spin_unlock_irqrestore(&hwif->lock, flags); | ||
| 253 | return 0; | 260 | return 0; |
| 254 | } | 261 | } |
| 255 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); | 262 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 8445b484ae69..b137f27a34d5 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
| @@ -68,8 +68,10 @@ int ide_end_rq(ide_drive_t *drive, struct request *rq, blk_status_t error, | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | if (!blk_update_request(rq, error, nr_bytes)) { | 70 | if (!blk_update_request(rq, error, nr_bytes)) { |
| 71 | if (rq == drive->sense_rq) | 71 | if (rq == drive->sense_rq) { |
| 72 | drive->sense_rq = NULL; | 72 | drive->sense_rq = NULL; |
| 73 | drive->sense_rq_active = false; | ||
| 74 | } | ||
| 73 | 75 | ||
| 74 | __blk_mq_end_request(rq, error); | 76 | __blk_mq_end_request(rq, error); |
| 75 | return 0; | 77 | return 0; |
| @@ -451,16 +453,11 @@ void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq) | |||
| 451 | blk_mq_delay_run_hw_queue(q->queue_hw_ctx[0], 3); | 453 | blk_mq_delay_run_hw_queue(q->queue_hw_ctx[0], 3); |
| 452 | } | 454 | } |
| 453 | 455 | ||
| 454 | /* | 456 | blk_status_t ide_issue_rq(ide_drive_t *drive, struct request *rq, |
| 455 | * Issue a new request to a device. | 457 | bool local_requeue) |
| 456 | */ | ||
| 457 | blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, | ||
| 458 | const struct blk_mq_queue_data *bd) | ||
| 459 | { | 458 | { |
| 460 | ide_drive_t *drive = hctx->queue->queuedata; | 459 | ide_hwif_t *hwif = drive->hwif; |
| 461 | ide_hwif_t *hwif = drive->hwif; | ||
| 462 | struct ide_host *host = hwif->host; | 460 | struct ide_host *host = hwif->host; |
| 463 | struct request *rq = bd->rq; | ||
| 464 | ide_startstop_t startstop; | 461 | ide_startstop_t startstop; |
| 465 | 462 | ||
| 466 | if (!blk_rq_is_passthrough(rq) && !(rq->rq_flags & RQF_DONTPREP)) { | 463 | if (!blk_rq_is_passthrough(rq) && !(rq->rq_flags & RQF_DONTPREP)) { |
| @@ -474,8 +471,6 @@ blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
| 474 | if (ide_lock_host(host, hwif)) | 471 | if (ide_lock_host(host, hwif)) |
| 475 | return BLK_STS_DEV_RESOURCE; | 472 | return BLK_STS_DEV_RESOURCE; |
| 476 | 473 | ||
| 477 | blk_mq_start_request(rq); | ||
| 478 | |||
| 479 | spin_lock_irq(&hwif->lock); | 474 | spin_lock_irq(&hwif->lock); |
| 480 | 475 | ||
| 481 | if (!ide_lock_port(hwif)) { | 476 | if (!ide_lock_port(hwif)) { |
| @@ -511,18 +506,6 @@ repeat: | |||
| 511 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); | 506 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); |
| 512 | 507 | ||
| 513 | /* | 508 | /* |
| 514 | * we know that the queue isn't empty, but this can happen | ||
| 515 | * if ->prep_rq() decides to kill a request | ||
| 516 | */ | ||
| 517 | if (!rq) { | ||
| 518 | rq = bd->rq; | ||
| 519 | if (!rq) { | ||
| 520 | ide_unlock_port(hwif); | ||
| 521 | goto out; | ||
| 522 | } | ||
| 523 | } | ||
| 524 | |||
| 525 | /* | ||
| 526 | * Sanity: don't accept a request that isn't a PM request | 509 | * Sanity: don't accept a request that isn't a PM request |
| 527 | * if we are currently power managed. This is very important as | 510 | * if we are currently power managed. This is very important as |
| 528 | * blk_stop_queue() doesn't prevent the blk_fetch_request() | 511 | * blk_stop_queue() doesn't prevent the blk_fetch_request() |
| @@ -560,9 +543,12 @@ repeat: | |||
| 560 | } | 543 | } |
| 561 | } else { | 544 | } else { |
| 562 | plug_device: | 545 | plug_device: |
| 546 | if (local_requeue) | ||
| 547 | list_add(&rq->queuelist, &drive->rq_list); | ||
| 563 | spin_unlock_irq(&hwif->lock); | 548 | spin_unlock_irq(&hwif->lock); |
| 564 | ide_unlock_host(host); | 549 | ide_unlock_host(host); |
| 565 | ide_requeue_and_plug(drive, rq); | 550 | if (!local_requeue) |
| 551 | ide_requeue_and_plug(drive, rq); | ||
| 566 | return BLK_STS_OK; | 552 | return BLK_STS_OK; |
| 567 | } | 553 | } |
| 568 | 554 | ||
| @@ -573,6 +559,26 @@ out: | |||
| 573 | return BLK_STS_OK; | 559 | return BLK_STS_OK; |
| 574 | } | 560 | } |
| 575 | 561 | ||
| 562 | /* | ||
| 563 | * Issue a new request to a device. | ||
| 564 | */ | ||
| 565 | blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, | ||
| 566 | const struct blk_mq_queue_data *bd) | ||
| 567 | { | ||
| 568 | ide_drive_t *drive = hctx->queue->queuedata; | ||
| 569 | ide_hwif_t *hwif = drive->hwif; | ||
| 570 | |||
| 571 | spin_lock_irq(&hwif->lock); | ||
| 572 | if (drive->sense_rq_active) { | ||
| 573 | spin_unlock_irq(&hwif->lock); | ||
| 574 | return BLK_STS_DEV_RESOURCE; | ||
| 575 | } | ||
| 576 | spin_unlock_irq(&hwif->lock); | ||
| 577 | |||
| 578 | blk_mq_start_request(bd->rq); | ||
| 579 | return ide_issue_rq(drive, bd->rq, false); | ||
| 580 | } | ||
| 581 | |||
| 576 | static int drive_is_ready(ide_drive_t *drive) | 582 | static int drive_is_ready(ide_drive_t *drive) |
| 577 | { | 583 | { |
| 578 | ide_hwif_t *hwif = drive->hwif; | 584 | ide_hwif_t *hwif = drive->hwif; |
| @@ -893,13 +899,8 @@ EXPORT_SYMBOL_GPL(ide_pad_transfer); | |||
| 893 | 899 | ||
| 894 | void ide_insert_request_head(ide_drive_t *drive, struct request *rq) | 900 | void ide_insert_request_head(ide_drive_t *drive, struct request *rq) |
| 895 | { | 901 | { |
| 896 | ide_hwif_t *hwif = drive->hwif; | 902 | drive->sense_rq_active = true; |
| 897 | unsigned long flags; | ||
| 898 | |||
| 899 | spin_lock_irqsave(&hwif->lock, flags); | ||
| 900 | list_add_tail(&rq->queuelist, &drive->rq_list); | 903 | list_add_tail(&rq->queuelist, &drive->rq_list); |
| 901 | spin_unlock_irqrestore(&hwif->lock, flags); | ||
| 902 | |||
| 903 | kblockd_schedule_work(&drive->rq_work); | 904 | kblockd_schedule_work(&drive->rq_work); |
| 904 | } | 905 | } |
| 905 | EXPORT_SYMBOL_GPL(ide_insert_request_head); | 906 | EXPORT_SYMBOL_GPL(ide_insert_request_head); |
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index 102aa3bc3e7f..8af7af6001eb 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c | |||
| @@ -54,7 +54,9 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) | |||
| 54 | scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; | 54 | scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; |
| 55 | scsi_req(rq)->cmd_len = 1; | 55 | scsi_req(rq)->cmd_len = 1; |
| 56 | ide_req(rq)->type = ATA_PRIV_MISC; | 56 | ide_req(rq)->type = ATA_PRIV_MISC; |
| 57 | spin_lock_irq(&hwif->lock); | ||
| 57 | ide_insert_request_head(drive, rq); | 58 | ide_insert_request_head(drive, rq); |
| 59 | spin_unlock_irq(&hwif->lock); | ||
| 58 | 60 | ||
| 59 | out: | 61 | out: |
| 60 | return; | 62 | return; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 63627be0811a..5aeaca24a28f 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -1159,18 +1159,27 @@ static void drive_rq_insert_work(struct work_struct *work) | |||
| 1159 | ide_drive_t *drive = container_of(work, ide_drive_t, rq_work); | 1159 | ide_drive_t *drive = container_of(work, ide_drive_t, rq_work); |
| 1160 | ide_hwif_t *hwif = drive->hwif; | 1160 | ide_hwif_t *hwif = drive->hwif; |
| 1161 | struct request *rq; | 1161 | struct request *rq; |
| 1162 | blk_status_t ret; | ||
| 1162 | LIST_HEAD(list); | 1163 | LIST_HEAD(list); |
| 1163 | 1164 | ||
| 1164 | spin_lock_irq(&hwif->lock); | 1165 | blk_mq_quiesce_queue(drive->queue); |
| 1165 | if (!list_empty(&drive->rq_list)) | ||
| 1166 | list_splice_init(&drive->rq_list, &list); | ||
| 1167 | spin_unlock_irq(&hwif->lock); | ||
| 1168 | 1166 | ||
| 1169 | while (!list_empty(&list)) { | 1167 | ret = BLK_STS_OK; |
| 1170 | rq = list_first_entry(&list, struct request, queuelist); | 1168 | spin_lock_irq(&hwif->lock); |
| 1169 | while (!list_empty(&drive->rq_list)) { | ||
| 1170 | rq = list_first_entry(&drive->rq_list, struct request, queuelist); | ||
| 1171 | list_del_init(&rq->queuelist); | 1171 | list_del_init(&rq->queuelist); |
| 1172 | blk_execute_rq_nowait(drive->queue, rq->rq_disk, rq, true, NULL); | 1172 | |
| 1173 | spin_unlock_irq(&hwif->lock); | ||
| 1174 | ret = ide_issue_rq(drive, rq, true); | ||
| 1175 | spin_lock_irq(&hwif->lock); | ||
| 1173 | } | 1176 | } |
| 1177 | spin_unlock_irq(&hwif->lock); | ||
| 1178 | |||
| 1179 | blk_mq_unquiesce_queue(drive->queue); | ||
| 1180 | |||
| 1181 | if (ret != BLK_STS_OK) | ||
| 1182 | kblockd_schedule_work(&drive->rq_work); | ||
| 1174 | } | 1183 | } |
| 1175 | 1184 | ||
| 1176 | static const u8 ide_hwif_to_major[] = | 1185 | static const u8 ide_hwif_to_major[] = |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 4c8c7a620d08..a5dc13576394 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
| @@ -544,7 +544,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) | |||
| 544 | drive->proc = proc_mkdir(drive->name, parent); | 544 | drive->proc = proc_mkdir(drive->name, parent); |
| 545 | if (drive->proc) { | 545 | if (drive->proc) { |
| 546 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); | 546 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); |
| 547 | proc_create_data("setting", S_IFREG|S_IRUSR|S_IWUSR, | 547 | proc_create_data("settings", S_IFREG|S_IRUSR|S_IWUSR, |
| 548 | drive->proc, &ide_settings_proc_fops, | 548 | drive->proc, &ide_settings_proc_fops, |
| 549 | drive); | 549 | drive); |
| 550 | } | 550 | } |
diff --git a/drivers/iio/adc/axp288_adc.c b/drivers/iio/adc/axp288_adc.c index 031d568b4972..4e339cfd0c54 100644 --- a/drivers/iio/adc/axp288_adc.c +++ b/drivers/iio/adc/axp288_adc.c | |||
| @@ -27,9 +27,18 @@ | |||
| 27 | #include <linux/iio/machine.h> | 27 | #include <linux/iio/machine.h> |
| 28 | #include <linux/iio/driver.h> | 28 | #include <linux/iio/driver.h> |
| 29 | 29 | ||
| 30 | #define AXP288_ADC_EN_MASK 0xF1 | 30 | /* |
| 31 | #define AXP288_ADC_TS_PIN_GPADC 0xF2 | 31 | * This mask enables all ADCs except for the battery temp-sensor (TS), that is |
| 32 | #define AXP288_ADC_TS_PIN_ON 0xF3 | 32 | * left as-is to avoid breaking charging on devices without a temp-sensor. |
| 33 | */ | ||
| 34 | #define AXP288_ADC_EN_MASK 0xF0 | ||
| 35 | #define AXP288_ADC_TS_ENABLE 0x01 | ||
| 36 | |||
| 37 | #define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0) | ||
| 38 | #define AXP288_ADC_TS_CURRENT_OFF (0 << 0) | ||
| 39 | #define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0) | ||
| 40 | #define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0) | ||
| 41 | #define AXP288_ADC_TS_CURRENT_ON (3 << 0) | ||
| 33 | 42 | ||
| 34 | enum axp288_adc_id { | 43 | enum axp288_adc_id { |
| 35 | AXP288_ADC_TS, | 44 | AXP288_ADC_TS, |
| @@ -44,6 +53,7 @@ enum axp288_adc_id { | |||
| 44 | struct axp288_adc_info { | 53 | struct axp288_adc_info { |
| 45 | int irq; | 54 | int irq; |
| 46 | struct regmap *regmap; | 55 | struct regmap *regmap; |
| 56 | bool ts_enabled; | ||
| 47 | }; | 57 | }; |
| 48 | 58 | ||
| 49 | static const struct iio_chan_spec axp288_adc_channels[] = { | 59 | static const struct iio_chan_spec axp288_adc_channels[] = { |
| @@ -115,21 +125,33 @@ static int axp288_adc_read_channel(int *val, unsigned long address, | |||
| 115 | return IIO_VAL_INT; | 125 | return IIO_VAL_INT; |
| 116 | } | 126 | } |
| 117 | 127 | ||
| 118 | static int axp288_adc_set_ts(struct regmap *regmap, unsigned int mode, | 128 | /* |
| 119 | unsigned long address) | 129 | * The current-source used for the battery temp-sensor (TS) is shared |
| 130 | * with the GPADC. For proper fuel-gauge and charger operation the TS | ||
| 131 | * current-source needs to be permanently on. But to read the GPADC we | ||
| 132 | * need to temporary switch the TS current-source to ondemand, so that | ||
| 133 | * the GPADC can use it, otherwise we will always read an all 0 value. | ||
| 134 | */ | ||
| 135 | static int axp288_adc_set_ts(struct axp288_adc_info *info, | ||
| 136 | unsigned int mode, unsigned long address) | ||
| 120 | { | 137 | { |
| 121 | int ret; | 138 | int ret; |
| 122 | 139 | ||
| 123 | /* channels other than GPADC do not need to switch TS pin */ | 140 | /* No need to switch the current-source if the TS pin is disabled */ |
| 141 | if (!info->ts_enabled) | ||
| 142 | return 0; | ||
| 143 | |||
| 144 | /* Channels other than GPADC do not need the current source */ | ||
| 124 | if (address != AXP288_GP_ADC_H) | 145 | if (address != AXP288_GP_ADC_H) |
| 125 | return 0; | 146 | return 0; |
| 126 | 147 | ||
| 127 | ret = regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, mode); | 148 | ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, |
| 149 | AXP288_ADC_TS_CURRENT_ON_OFF_MASK, mode); | ||
| 128 | if (ret) | 150 | if (ret) |
| 129 | return ret; | 151 | return ret; |
| 130 | 152 | ||
| 131 | /* When switching to the GPADC pin give things some time to settle */ | 153 | /* When switching to the GPADC pin give things some time to settle */ |
| 132 | if (mode == AXP288_ADC_TS_PIN_GPADC) | 154 | if (mode == AXP288_ADC_TS_CURRENT_ON_ONDEMAND) |
| 133 | usleep_range(6000, 10000); | 155 | usleep_range(6000, 10000); |
| 134 | 156 | ||
| 135 | return 0; | 157 | return 0; |
| @@ -145,14 +167,14 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, | |||
| 145 | mutex_lock(&indio_dev->mlock); | 167 | mutex_lock(&indio_dev->mlock); |
| 146 | switch (mask) { | 168 | switch (mask) { |
| 147 | case IIO_CHAN_INFO_RAW: | 169 | case IIO_CHAN_INFO_RAW: |
| 148 | if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_GPADC, | 170 | if (axp288_adc_set_ts(info, AXP288_ADC_TS_CURRENT_ON_ONDEMAND, |
| 149 | chan->address)) { | 171 | chan->address)) { |
| 150 | dev_err(&indio_dev->dev, "GPADC mode\n"); | 172 | dev_err(&indio_dev->dev, "GPADC mode\n"); |
| 151 | ret = -EINVAL; | 173 | ret = -EINVAL; |
| 152 | break; | 174 | break; |
| 153 | } | 175 | } |
| 154 | ret = axp288_adc_read_channel(val, chan->address, info->regmap); | 176 | ret = axp288_adc_read_channel(val, chan->address, info->regmap); |
| 155 | if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_ON, | 177 | if (axp288_adc_set_ts(info, AXP288_ADC_TS_CURRENT_ON, |
| 156 | chan->address)) | 178 | chan->address)) |
| 157 | dev_err(&indio_dev->dev, "TS pin restore\n"); | 179 | dev_err(&indio_dev->dev, "TS pin restore\n"); |
| 158 | break; | 180 | break; |
| @@ -164,13 +186,35 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, | |||
| 164 | return ret; | 186 | return ret; |
| 165 | } | 187 | } |
| 166 | 188 | ||
| 167 | static int axp288_adc_set_state(struct regmap *regmap) | 189 | static int axp288_adc_initialize(struct axp288_adc_info *info) |
| 168 | { | 190 | { |
| 169 | /* ADC should be always enabled for internal FG to function */ | 191 | int ret, adc_enable_val; |
| 170 | if (regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON)) | 192 | |
| 171 | return -EIO; | 193 | /* |
| 194 | * Determine if the TS pin is enabled and set the TS current-source | ||
| 195 | * accordingly. | ||
| 196 | */ | ||
| 197 | ret = regmap_read(info->regmap, AXP20X_ADC_EN1, &adc_enable_val); | ||
| 198 | if (ret) | ||
| 199 | return ret; | ||
| 200 | |||
| 201 | if (adc_enable_val & AXP288_ADC_TS_ENABLE) { | ||
| 202 | info->ts_enabled = true; | ||
| 203 | ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, | ||
| 204 | AXP288_ADC_TS_CURRENT_ON_OFF_MASK, | ||
| 205 | AXP288_ADC_TS_CURRENT_ON); | ||
| 206 | } else { | ||
| 207 | info->ts_enabled = false; | ||
| 208 | ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, | ||
| 209 | AXP288_ADC_TS_CURRENT_ON_OFF_MASK, | ||
| 210 | AXP288_ADC_TS_CURRENT_OFF); | ||
| 211 | } | ||
| 212 | if (ret) | ||
| 213 | return ret; | ||
| 172 | 214 | ||
| 173 | return regmap_write(regmap, AXP20X_ADC_EN1, AXP288_ADC_EN_MASK); | 215 | /* Turn on the ADC for all channels except TS, leave TS as is */ |
| 216 | return regmap_update_bits(info->regmap, AXP20X_ADC_EN1, | ||
| 217 | AXP288_ADC_EN_MASK, AXP288_ADC_EN_MASK); | ||
| 174 | } | 218 | } |
| 175 | 219 | ||
| 176 | static const struct iio_info axp288_adc_iio_info = { | 220 | static const struct iio_info axp288_adc_iio_info = { |
| @@ -200,7 +244,7 @@ static int axp288_adc_probe(struct platform_device *pdev) | |||
| 200 | * Set ADC to enabled state at all time, including system suspend. | 244 | * Set ADC to enabled state at all time, including system suspend. |
| 201 | * otherwise internal fuel gauge functionality may be affected. | 245 | * otherwise internal fuel gauge functionality may be affected. |
| 202 | */ | 246 | */ |
| 203 | ret = axp288_adc_set_state(axp20x->regmap); | 247 | ret = axp288_adc_initialize(info); |
| 204 | if (ret) { | 248 | if (ret) { |
| 205 | dev_err(&pdev->dev, "unable to enable ADC device\n"); | 249 | dev_err(&pdev->dev, "unable to enable ADC device\n"); |
| 206 | return ret; | 250 | return ret; |
diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c index 184d686ebd99..8b4568edd5cb 100644 --- a/drivers/iio/adc/ti-ads8688.c +++ b/drivers/iio/adc/ti-ads8688.c | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | 41 | ||
| 42 | #define ADS8688_VREF_MV 4096 | 42 | #define ADS8688_VREF_MV 4096 |
| 43 | #define ADS8688_REALBITS 16 | 43 | #define ADS8688_REALBITS 16 |
| 44 | #define ADS8688_MAX_CHANNELS 8 | ||
| 44 | 45 | ||
| 45 | /* | 46 | /* |
| 46 | * enum ads8688_range - ADS8688 reference voltage range | 47 | * enum ads8688_range - ADS8688 reference voltage range |
| @@ -385,7 +386,7 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) | |||
| 385 | { | 386 | { |
| 386 | struct iio_poll_func *pf = p; | 387 | struct iio_poll_func *pf = p; |
| 387 | struct iio_dev *indio_dev = pf->indio_dev; | 388 | struct iio_dev *indio_dev = pf->indio_dev; |
| 388 | u16 buffer[8]; | 389 | u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)]; |
| 389 | int i, j = 0; | 390 | int i, j = 0; |
| 390 | 391 | ||
| 391 | for (i = 0; i < indio_dev->masklength; i++) { | 392 | for (i = 0; i < indio_dev->masklength; i++) { |
diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c index a406ad31b096..3a20cb5d9bff 100644 --- a/drivers/iio/chemical/atlas-ph-sensor.c +++ b/drivers/iio/chemical/atlas-ph-sensor.c | |||
| @@ -444,9 +444,8 @@ static int atlas_read_raw(struct iio_dev *indio_dev, | |||
| 444 | case IIO_CHAN_INFO_SCALE: | 444 | case IIO_CHAN_INFO_SCALE: |
| 445 | switch (chan->type) { | 445 | switch (chan->type) { |
| 446 | case IIO_TEMP: | 446 | case IIO_TEMP: |
| 447 | *val = 1; /* 0.01 */ | 447 | *val = 10; |
| 448 | *val2 = 100; | 448 | return IIO_VAL_INT; |
| 449 | break; | ||
| 450 | case IIO_PH: | 449 | case IIO_PH: |
| 451 | *val = 1; /* 0.001 */ | 450 | *val = 1; /* 0.001 */ |
| 452 | *val2 = 1000; | 451 | *val2 = 1000; |
| @@ -477,7 +476,7 @@ static int atlas_write_raw(struct iio_dev *indio_dev, | |||
| 477 | int val, int val2, long mask) | 476 | int val, int val2, long mask) |
| 478 | { | 477 | { |
| 479 | struct atlas_data *data = iio_priv(indio_dev); | 478 | struct atlas_data *data = iio_priv(indio_dev); |
| 480 | __be32 reg = cpu_to_be32(val); | 479 | __be32 reg = cpu_to_be32(val / 10); |
| 481 | 480 | ||
| 482 | if (val2 != 0 || val < 0 || val > 20000) | 481 | if (val2 != 0 || val < 0 || val > 20000) |
| 483 | return -EINVAL; | 482 | return -EINVAL; |
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 3cd830d52967..616734313f0c 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h | |||
| @@ -267,7 +267,6 @@ static inline int ib_mad_enforce_security(struct ib_mad_agent_private *map, | |||
| 267 | #endif | 267 | #endif |
| 268 | 268 | ||
| 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); | 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); |
| 270 | void ib_device_put(struct ib_device *device); | ||
| 271 | /* RDMA device netlink */ | 270 | /* RDMA device netlink */ |
| 272 | void nldev_init(void); | 271 | void nldev_init(void); |
| 273 | void nldev_exit(void); | 272 | void nldev_exit(void); |
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 8872453e26c0..238ec42778ef 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
| @@ -156,19 +156,26 @@ struct ib_device *ib_device_get_by_index(u32 index) | |||
| 156 | down_read(&lists_rwsem); | 156 | down_read(&lists_rwsem); |
| 157 | device = __ib_device_get_by_index(index); | 157 | device = __ib_device_get_by_index(index); |
| 158 | if (device) { | 158 | if (device) { |
| 159 | /* Do not return a device if unregistration has started. */ | 159 | if (!ib_device_try_get(device)) |
| 160 | if (!refcount_inc_not_zero(&device->refcount)) | ||
| 161 | device = NULL; | 160 | device = NULL; |
| 162 | } | 161 | } |
| 163 | up_read(&lists_rwsem); | 162 | up_read(&lists_rwsem); |
| 164 | return device; | 163 | return device; |
| 165 | } | 164 | } |
| 166 | 165 | ||
| 166 | /** | ||
| 167 | * ib_device_put - Release IB device reference | ||
| 168 | * @device: device whose reference to be released | ||
| 169 | * | ||
| 170 | * ib_device_put() releases reference to the IB device to allow it to be | ||
| 171 | * unregistered and eventually free. | ||
| 172 | */ | ||
| 167 | void ib_device_put(struct ib_device *device) | 173 | void ib_device_put(struct ib_device *device) |
| 168 | { | 174 | { |
| 169 | if (refcount_dec_and_test(&device->refcount)) | 175 | if (refcount_dec_and_test(&device->refcount)) |
| 170 | complete(&device->unreg_completion); | 176 | complete(&device->unreg_completion); |
| 171 | } | 177 | } |
| 178 | EXPORT_SYMBOL(ib_device_put); | ||
| 172 | 179 | ||
| 173 | static struct ib_device *__ib_device_get_by_name(const char *name) | 180 | static struct ib_device *__ib_device_get_by_name(const char *name) |
| 174 | { | 181 | { |
| @@ -303,7 +310,6 @@ struct ib_device *ib_alloc_device(size_t size) | |||
| 303 | rwlock_init(&device->client_data_lock); | 310 | rwlock_init(&device->client_data_lock); |
| 304 | INIT_LIST_HEAD(&device->client_data_list); | 311 | INIT_LIST_HEAD(&device->client_data_list); |
| 305 | INIT_LIST_HEAD(&device->port_list); | 312 | INIT_LIST_HEAD(&device->port_list); |
| 306 | refcount_set(&device->refcount, 1); | ||
| 307 | init_completion(&device->unreg_completion); | 313 | init_completion(&device->unreg_completion); |
| 308 | 314 | ||
| 309 | return device; | 315 | return device; |
| @@ -620,6 +626,7 @@ int ib_register_device(struct ib_device *device, const char *name, | |||
| 620 | goto cg_cleanup; | 626 | goto cg_cleanup; |
| 621 | } | 627 | } |
| 622 | 628 | ||
| 629 | refcount_set(&device->refcount, 1); | ||
| 623 | device->reg_state = IB_DEV_REGISTERED; | 630 | device->reg_state = IB_DEV_REGISTERED; |
| 624 | 631 | ||
| 625 | list_for_each_entry(client, &client_list, list) | 632 | list_for_each_entry(client, &client_list, list) |
diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c index a4ec43093cb3..acb882f279cb 100644 --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c | |||
| @@ -352,6 +352,8 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, | |||
| 352 | umem->writable = 1; | 352 | umem->writable = 1; |
| 353 | umem->is_odp = 1; | 353 | umem->is_odp = 1; |
| 354 | odp_data->per_mm = per_mm; | 354 | odp_data->per_mm = per_mm; |
| 355 | umem->owning_mm = per_mm->mm; | ||
| 356 | mmgrab(umem->owning_mm); | ||
| 355 | 357 | ||
| 356 | mutex_init(&odp_data->umem_mutex); | 358 | mutex_init(&odp_data->umem_mutex); |
| 357 | init_completion(&odp_data->notifier_completion); | 359 | init_completion(&odp_data->notifier_completion); |
| @@ -384,6 +386,7 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, | |||
| 384 | out_page_list: | 386 | out_page_list: |
| 385 | vfree(odp_data->page_list); | 387 | vfree(odp_data->page_list); |
| 386 | out_odp_data: | 388 | out_odp_data: |
| 389 | mmdrop(umem->owning_mm); | ||
| 387 | kfree(odp_data); | 390 | kfree(odp_data); |
| 388 | return ERR_PTR(ret); | 391 | return ERR_PTR(ret); |
| 389 | } | 392 | } |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 2890a77339e1..5f366838b7ff 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
| @@ -204,6 +204,9 @@ void ib_uverbs_release_file(struct kref *ref) | |||
| 204 | if (atomic_dec_and_test(&file->device->refcount)) | 204 | if (atomic_dec_and_test(&file->device->refcount)) |
| 205 | ib_uverbs_comp_dev(file->device); | 205 | ib_uverbs_comp_dev(file->device); |
| 206 | 206 | ||
| 207 | if (file->async_file) | ||
| 208 | kref_put(&file->async_file->ref, | ||
| 209 | ib_uverbs_release_async_event_file); | ||
| 207 | put_device(&file->device->dev); | 210 | put_device(&file->device->dev); |
| 208 | kfree(file); | 211 | kfree(file); |
| 209 | } | 212 | } |
| @@ -964,11 +967,19 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) | |||
| 964 | 967 | ||
| 965 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ | 968 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ |
| 966 | mutex_lock(&ufile->umap_lock); | 969 | mutex_lock(&ufile->umap_lock); |
| 967 | if (!list_empty(&ufile->umaps)) { | 970 | while (!list_empty(&ufile->umaps)) { |
| 968 | mm = list_first_entry(&ufile->umaps, | 971 | int ret; |
| 969 | struct rdma_umap_priv, list) | 972 | |
| 970 | ->vma->vm_mm; | 973 | priv = list_first_entry(&ufile->umaps, |
| 971 | mmget(mm); | 974 | struct rdma_umap_priv, list); |
| 975 | mm = priv->vma->vm_mm; | ||
| 976 | ret = mmget_not_zero(mm); | ||
| 977 | if (!ret) { | ||
| 978 | list_del_init(&priv->list); | ||
| 979 | mm = NULL; | ||
| 980 | continue; | ||
| 981 | } | ||
| 982 | break; | ||
| 972 | } | 983 | } |
| 973 | mutex_unlock(&ufile->umap_lock); | 984 | mutex_unlock(&ufile->umap_lock); |
| 974 | if (!mm) | 985 | if (!mm) |
| @@ -1096,10 +1107,6 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp) | |||
| 1096 | list_del_init(&file->list); | 1107 | list_del_init(&file->list); |
| 1097 | mutex_unlock(&file->device->lists_mutex); | 1108 | mutex_unlock(&file->device->lists_mutex); |
| 1098 | 1109 | ||
| 1099 | if (file->async_file) | ||
| 1100 | kref_put(&file->async_file->ref, | ||
| 1101 | ib_uverbs_release_async_event_file); | ||
| 1102 | |||
| 1103 | kref_put(&file->ref, ib_uverbs_release_file); | 1110 | kref_put(&file->ref, ib_uverbs_release_file); |
| 1104 | 1111 | ||
| 1105 | return 0; | 1112 | return 0; |
diff --git a/drivers/infiniband/core/uverbs_std_types_device.c b/drivers/infiniband/core/uverbs_std_types_device.c index 5030ec480370..2a3f2f01028d 100644 --- a/drivers/infiniband/core/uverbs_std_types_device.c +++ b/drivers/infiniband/core/uverbs_std_types_device.c | |||
| @@ -168,12 +168,18 @@ void copy_port_attr_to_resp(struct ib_port_attr *attr, | |||
| 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( | 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( |
| 169 | struct uverbs_attr_bundle *attrs) | 169 | struct uverbs_attr_bundle *attrs) |
| 170 | { | 170 | { |
| 171 | struct ib_device *ib_dev = attrs->ufile->device->ib_dev; | 171 | struct ib_device *ib_dev; |
| 172 | struct ib_port_attr attr = {}; | 172 | struct ib_port_attr attr = {}; |
| 173 | struct ib_uverbs_query_port_resp_ex resp = {}; | 173 | struct ib_uverbs_query_port_resp_ex resp = {}; |
| 174 | struct ib_ucontext *ucontext; | ||
| 174 | int ret; | 175 | int ret; |
| 175 | u8 port_num; | 176 | u8 port_num; |
| 176 | 177 | ||
| 178 | ucontext = ib_uverbs_get_ucontext(attrs); | ||
| 179 | if (IS_ERR(ucontext)) | ||
| 180 | return PTR_ERR(ucontext); | ||
| 181 | ib_dev = ucontext->device; | ||
| 182 | |||
| 177 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ | 183 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ |
| 178 | if (!ib_dev->ops.query_port) | 184 | if (!ib_dev->ops.query_port) |
| 179 | return -EOPNOTSUPP; | 185 | return -EOPNOTSUPP; |
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c index c22ebc774a6a..f9a7e9d29c8b 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c | |||
| @@ -488,7 +488,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) | |||
| 488 | vmf = 1; | 488 | vmf = 1; |
| 489 | break; | 489 | break; |
| 490 | case STATUS: | 490 | case STATUS: |
| 491 | if (flags & (unsigned long)(VM_WRITE | VM_EXEC)) { | 491 | if (flags & VM_WRITE) { |
| 492 | ret = -EPERM; | 492 | ret = -EPERM; |
| 493 | goto done; | 493 | goto done; |
| 494 | } | 494 | } |
diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c index 88242fe95eaa..bf96067876c9 100644 --- a/drivers/infiniband/hw/hfi1/ud.c +++ b/drivers/infiniband/hw/hfi1/ud.c | |||
| @@ -987,7 +987,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) | |||
| 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; | 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; |
| 989 | wc.wc_flags = IB_WC_WITH_IMM; | 989 | wc.wc_flags = IB_WC_WITH_IMM; |
| 990 | tlen -= sizeof(u32); | ||
| 991 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | 990 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 992 | wc.ex.imm_data = 0; | 991 | wc.ex.imm_data = 0; |
| 993 | wc.wc_flags = 0; | 992 | wc.wc_flags = 0; |
diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c index 960b1946c365..12deacf442cf 100644 --- a/drivers/infiniband/hw/hns/hns_roce_srq.c +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c | |||
| @@ -210,6 +210,7 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, | |||
| 210 | struct ib_udata *udata) | 210 | struct ib_udata *udata) |
| 211 | { | 211 | { |
| 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); | 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); |
| 213 | struct hns_roce_ib_create_srq_resp resp = {}; | ||
| 213 | struct hns_roce_srq *srq; | 214 | struct hns_roce_srq *srq; |
| 214 | int srq_desc_size; | 215 | int srq_desc_size; |
| 215 | int srq_buf_size; | 216 | int srq_buf_size; |
| @@ -378,16 +379,21 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, | |||
| 378 | 379 | ||
| 379 | srq->event = hns_roce_ib_srq_event; | 380 | srq->event = hns_roce_ib_srq_event; |
| 380 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; | 381 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; |
| 382 | resp.srqn = srq->srqn; | ||
| 381 | 383 | ||
| 382 | if (udata) { | 384 | if (udata) { |
| 383 | if (ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) { | 385 | if (ib_copy_to_udata(udata, &resp, |
| 386 | min(udata->outlen, sizeof(resp)))) { | ||
| 384 | ret = -EFAULT; | 387 | ret = -EFAULT; |
| 385 | goto err_wrid; | 388 | goto err_srqc_alloc; |
| 386 | } | 389 | } |
| 387 | } | 390 | } |
| 388 | 391 | ||
| 389 | return &srq->ibsrq; | 392 | return &srq->ibsrq; |
| 390 | 393 | ||
| 394 | err_srqc_alloc: | ||
| 395 | hns_roce_srq_free(hr_dev, srq); | ||
| 396 | |||
| 391 | err_wrid: | 397 | err_wrid: |
| 392 | kvfree(srq->wrid); | 398 | kvfree(srq->wrid); |
| 393 | 399 | ||
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 25439da8976c..936ee1314bcd 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
| @@ -1411,7 +1411,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, | |||
| 1411 | 1411 | ||
| 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); | 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); |
| 1413 | if (sqp->tx_ring[wire_tx_ix].ah) | 1413 | if (sqp->tx_ring[wire_tx_ix].ah) |
| 1414 | rdma_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); | 1414 | mlx4_ib_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); |
| 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; | 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; |
| 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, | 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, |
| 1417 | sqp->tx_ring[wire_tx_ix].buf.map, | 1417 | sqp->tx_ring[wire_tx_ix].buf.map, |
| @@ -1902,7 +1902,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) | |||
| 1902 | if (wc.status == IB_WC_SUCCESS) { | 1902 | if (wc.status == IB_WC_SUCCESS) { |
| 1903 | switch (wc.opcode) { | 1903 | switch (wc.opcode) { |
| 1904 | case IB_WC_SEND: | 1904 | case IB_WC_SEND: |
| 1905 | rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | 1905 | mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & |
| 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); | 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah | 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1908 | = NULL; | 1908 | = NULL; |
| @@ -1931,7 +1931,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) | |||
| 1931 | " status = %d, wrid = 0x%llx\n", | 1931 | " status = %d, wrid = 0x%llx\n", |
| 1932 | ctx->slave, wc.status, wc.wr_id); | 1932 | ctx->slave, wc.status, wc.wr_id); |
| 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { | 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { |
| 1934 | rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | 1934 | mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & |
| 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); | 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah | 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1937 | = NULL; | 1937 | = NULL; |
diff --git a/drivers/infiniband/hw/mlx5/flow.c b/drivers/infiniband/hw/mlx5/flow.c index e8a1e4498e3f..798591a18484 100644 --- a/drivers/infiniband/hw/mlx5/flow.c +++ b/drivers/infiniband/hw/mlx5/flow.c | |||
| @@ -630,8 +630,7 @@ const struct uapi_definition mlx5_ib_flow_defs[] = { | |||
| 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), |
| 631 | UAPI_DEF_CHAIN_OBJ_TREE( | 631 | UAPI_DEF_CHAIN_OBJ_TREE( |
| 632 | UVERBS_OBJECT_FLOW, | 632 | UVERBS_OBJECT_FLOW, |
| 633 | &mlx5_ib_fs, | 633 | &mlx5_ib_fs), |
| 634 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | ||
| 635 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, | 634 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, |
| 636 | &mlx5_ib_flow_actions), | 635 | &mlx5_ib_flow_actions), |
| 637 | {}, | 636 | {}, |
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c index 01e0f6200631..4ee32964e1dd 100644 --- a/drivers/infiniband/hw/mlx5/odp.c +++ b/drivers/infiniband/hw/mlx5/odp.c | |||
| @@ -1595,10 +1595,12 @@ static void mlx5_ib_prefetch_mr_work(struct work_struct *work) | |||
| 1595 | struct prefetch_mr_work *w = | 1595 | struct prefetch_mr_work *w = |
| 1596 | container_of(work, struct prefetch_mr_work, work); | 1596 | container_of(work, struct prefetch_mr_work, work); |
| 1597 | 1597 | ||
| 1598 | if (w->dev->ib_dev.reg_state == IB_DEV_REGISTERED) | 1598 | if (ib_device_try_get(&w->dev->ib_dev)) { |
| 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, | 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, |
| 1600 | w->num_sge); | 1600 | w->num_sge); |
| 1601 | 1601 | ib_device_put(&w->dev->ib_dev); | |
| 1602 | } | ||
| 1603 | put_device(&w->dev->ib_dev.dev); | ||
| 1602 | kfree(w); | 1604 | kfree(w); |
| 1603 | } | 1605 | } |
| 1604 | 1606 | ||
| @@ -1617,15 +1619,13 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd, | |||
| 1617 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, | 1619 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, |
| 1618 | num_sge); | 1620 | num_sge); |
| 1619 | 1621 | ||
| 1620 | if (dev->ib_dev.reg_state != IB_DEV_REGISTERED) | ||
| 1621 | return -ENODEV; | ||
| 1622 | |||
| 1623 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); | 1622 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); |
| 1624 | if (!work) | 1623 | if (!work) |
| 1625 | return -ENOMEM; | 1624 | return -ENOMEM; |
| 1626 | 1625 | ||
| 1627 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); | 1626 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); |
| 1628 | 1627 | ||
| 1628 | get_device(&dev->ib_dev.dev); | ||
| 1629 | work->dev = dev; | 1629 | work->dev = dev; |
| 1630 | work->pf_flags = pf_flags; | 1630 | work->pf_flags = pf_flags; |
| 1631 | work->num_sge = num_sge; | 1631 | work->num_sge = num_sge; |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index dd2ae640bc84..7db778d96ef5 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
| @@ -1912,14 +1912,16 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, | |||
| 1912 | } | 1912 | } |
| 1913 | 1913 | ||
| 1914 | if (!check_flags_mask(ucmd.flags, | 1914 | if (!check_flags_mask(ucmd.flags, |
| 1915 | MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | ||
| 1916 | MLX5_QP_FLAG_BFREG_INDEX | | ||
| 1917 | MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE | | ||
| 1918 | MLX5_QP_FLAG_SCATTER_CQE | | ||
| 1915 | MLX5_QP_FLAG_SIGNATURE | | 1919 | MLX5_QP_FLAG_SIGNATURE | |
| 1916 | MLX5_QP_FLAG_SCATTER_CQE | | 1920 | MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC | |
| 1917 | MLX5_QP_FLAG_TUNNEL_OFFLOADS | | 1921 | MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_UC | |
| 1918 | MLX5_QP_FLAG_BFREG_INDEX | | 1922 | MLX5_QP_FLAG_TUNNEL_OFFLOADS | |
| 1919 | MLX5_QP_FLAG_TYPE_DCT | | 1923 | MLX5_QP_FLAG_TYPE_DCI | |
| 1920 | MLX5_QP_FLAG_TYPE_DCI | | 1924 | MLX5_QP_FLAG_TYPE_DCT)) |
| 1921 | MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | ||
| 1922 | MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE)) | ||
| 1923 | return -EINVAL; | 1925 | return -EINVAL; |
| 1924 | 1926 | ||
| 1925 | err = get_qp_user_index(to_mucontext(pd->uobject->context), | 1927 | err = get_qp_user_index(to_mucontext(pd->uobject->context), |
diff --git a/drivers/infiniband/hw/qib/qib_ud.c b/drivers/infiniband/hw/qib/qib_ud.c index 868da0ece7ba..445ea19a2ec8 100644 --- a/drivers/infiniband/hw/qib/qib_ud.c +++ b/drivers/infiniband/hw/qib/qib_ud.c | |||
| @@ -512,7 +512,6 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, | |||
| 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; | 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; |
| 514 | wc.wc_flags = IB_WC_WITH_IMM; | 514 | wc.wc_flags = IB_WC_WITH_IMM; |
| 515 | tlen -= sizeof(u32); | ||
| 516 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | 515 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 517 | wc.ex.imm_data = 0; | 516 | wc.ex.imm_data = 0; |
| 518 | wc.wc_flags = 0; | 517 | wc.wc_flags = 0; |
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index a1bd8cfc2c25..c6cc3e4ab71d 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c | |||
| @@ -2910,6 +2910,8 @@ send: | |||
| 2910 | goto op_err; | 2910 | goto op_err; |
| 2911 | if (!ret) | 2911 | if (!ret) |
| 2912 | goto rnr_nak; | 2912 | goto rnr_nak; |
| 2913 | if (wqe->length > qp->r_len) | ||
| 2914 | goto inv_err; | ||
| 2913 | break; | 2915 | break; |
| 2914 | 2916 | ||
| 2915 | case IB_WR_RDMA_WRITE_WITH_IMM: | 2917 | case IB_WR_RDMA_WRITE_WITH_IMM: |
| @@ -3078,7 +3080,10 @@ op_err: | |||
| 3078 | goto err; | 3080 | goto err; |
| 3079 | 3081 | ||
| 3080 | inv_err: | 3082 | inv_err: |
| 3081 | send_status = IB_WC_REM_INV_REQ_ERR; | 3083 | send_status = |
| 3084 | sqp->ibqp.qp_type == IB_QPT_RC ? | ||
| 3085 | IB_WC_REM_INV_REQ_ERR : | ||
| 3086 | IB_WC_SUCCESS; | ||
| 3082 | wc.status = IB_WC_LOC_QP_OP_ERR; | 3087 | wc.status = IB_WC_LOC_QP_OP_ERR; |
| 3083 | goto err; | 3088 | goto err; |
| 3084 | 3089 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 1da119d901a9..73e808c1e6ad 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
| @@ -248,7 +248,6 @@ struct ipoib_cm_tx { | |||
| 248 | struct list_head list; | 248 | struct list_head list; |
| 249 | struct net_device *dev; | 249 | struct net_device *dev; |
| 250 | struct ipoib_neigh *neigh; | 250 | struct ipoib_neigh *neigh; |
| 251 | struct ipoib_path *path; | ||
| 252 | struct ipoib_tx_buf *tx_ring; | 251 | struct ipoib_tx_buf *tx_ring; |
| 253 | unsigned int tx_head; | 252 | unsigned int tx_head; |
| 254 | unsigned int tx_tail; | 253 | unsigned int tx_tail; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 0428e01e8f69..aa9dcfc36cd3 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
| @@ -1312,7 +1312,6 @@ struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path | |||
| 1312 | 1312 | ||
| 1313 | neigh->cm = tx; | 1313 | neigh->cm = tx; |
| 1314 | tx->neigh = neigh; | 1314 | tx->neigh = neigh; |
| 1315 | tx->path = path; | ||
| 1316 | tx->dev = dev; | 1315 | tx->dev = dev; |
| 1317 | list_add(&tx->list, &priv->cm.start_list); | 1316 | list_add(&tx->list, &priv->cm.start_list); |
| 1318 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); | 1317 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); |
| @@ -1371,7 +1370,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) | |||
| 1371 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); | 1370 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); |
| 1372 | goto free_neigh; | 1371 | goto free_neigh; |
| 1373 | } | 1372 | } |
| 1374 | memcpy(&pathrec, &p->path->pathrec, sizeof(pathrec)); | 1373 | memcpy(&pathrec, &path->pathrec, sizeof(pathrec)); |
| 1375 | 1374 | ||
| 1376 | spin_unlock_irqrestore(&priv->lock, flags); | 1375 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1377 | netif_tx_unlock_bh(dev); | 1376 | netif_tx_unlock_bh(dev); |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index cfc8b94527b9..aa4e431cbcd3 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
| @@ -252,6 +252,8 @@ static const struct xpad_device { | |||
| 252 | { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, | 252 | { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, |
| 253 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, | 253 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, |
| 254 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, | 254 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, |
| 255 | { 0x1038, 0x1430, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, | ||
| 256 | { 0x1038, 0x1431, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, | ||
| 255 | { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, | 257 | { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, |
| 256 | { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | 258 | { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, |
| 257 | { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, | 259 | { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, |
| @@ -428,6 +430,7 @@ static const struct usb_device_id xpad_table[] = { | |||
| 428 | XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ | 430 | XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ |
| 429 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ | 431 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ |
| 430 | XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ | 432 | XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ |
| 433 | XPAD_XBOX360_VENDOR(0x1038), /* SteelSeries Controllers */ | ||
| 431 | XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ | 434 | XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ |
| 432 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ | 435 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ |
| 433 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ | 436 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 8ec483e8688b..26ec603fe220 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/init.h> | 39 | #include <linux/init.h> |
| 40 | #include <linux/fs.h> | 40 | #include <linux/fs.h> |
| 41 | #include <linux/miscdevice.h> | 41 | #include <linux/miscdevice.h> |
| 42 | #include <linux/overflow.h> | ||
| 42 | #include <linux/input/mt.h> | 43 | #include <linux/input/mt.h> |
| 43 | #include "../input-compat.h" | 44 | #include "../input-compat.h" |
| 44 | 45 | ||
| @@ -405,7 +406,7 @@ static int uinput_open(struct inode *inode, struct file *file) | |||
| 405 | static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, | 406 | static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, |
| 406 | const struct input_absinfo *abs) | 407 | const struct input_absinfo *abs) |
| 407 | { | 408 | { |
| 408 | int min, max; | 409 | int min, max, range; |
| 409 | 410 | ||
| 410 | min = abs->minimum; | 411 | min = abs->minimum; |
| 411 | max = abs->maximum; | 412 | max = abs->maximum; |
| @@ -417,7 +418,7 @@ static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, | |||
| 417 | return -EINVAL; | 418 | return -EINVAL; |
| 418 | } | 419 | } |
| 419 | 420 | ||
| 420 | if (abs->flat > max - min) { | 421 | if (!check_sub_overflow(max, min, &range) && abs->flat > range) { |
| 421 | printk(KERN_DEBUG | 422 | printk(KERN_DEBUG |
| 422 | "%s: abs_flat #%02x out of range: %d (min:%d/max:%d)\n", | 423 | "%s: abs_flat #%02x out of range: %d (min:%d/max:%d)\n", |
| 423 | UINPUT_NAME, code, abs->flat, min, max); | 424 | UINPUT_NAME, code, abs->flat, min, max); |
diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c index b36084710f69..a7cfab3db9ee 100644 --- a/drivers/input/serio/olpc_apsp.c +++ b/drivers/input/serio/olpc_apsp.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/clk.h> | ||
| 27 | 26 | ||
| 28 | /* | 27 | /* |
| 29 | * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. | 28 | * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. |
| @@ -75,7 +74,6 @@ struct olpc_apsp { | |||
| 75 | struct serio *kbio; | 74 | struct serio *kbio; |
| 76 | struct serio *padio; | 75 | struct serio *padio; |
| 77 | void __iomem *base; | 76 | void __iomem *base; |
| 78 | struct clk *clk; | ||
| 79 | int open_count; | 77 | int open_count; |
| 80 | int irq; | 78 | int irq; |
| 81 | }; | 79 | }; |
| @@ -148,17 +146,11 @@ static int olpc_apsp_open(struct serio *port) | |||
| 148 | struct olpc_apsp *priv = port->port_data; | 146 | struct olpc_apsp *priv = port->port_data; |
| 149 | unsigned int tmp; | 147 | unsigned int tmp; |
| 150 | unsigned long l; | 148 | unsigned long l; |
| 151 | int error; | ||
| 152 | 149 | ||
| 153 | if (priv->open_count++ == 0) { | 150 | if (priv->open_count++ == 0) { |
| 154 | error = clk_prepare_enable(priv->clk); | ||
| 155 | if (error) | ||
| 156 | return error; | ||
| 157 | |||
| 158 | l = readl(priv->base + COMMAND_FIFO_STATUS); | 151 | l = readl(priv->base + COMMAND_FIFO_STATUS); |
| 159 | if (!(l & CMD_STS_MASK)) { | 152 | if (!(l & CMD_STS_MASK)) { |
| 160 | dev_err(priv->dev, "SP cannot accept commands.\n"); | 153 | dev_err(priv->dev, "SP cannot accept commands.\n"); |
| 161 | clk_disable_unprepare(priv->clk); | ||
| 162 | return -EIO; | 154 | return -EIO; |
| 163 | } | 155 | } |
| 164 | 156 | ||
| @@ -179,8 +171,6 @@ static void olpc_apsp_close(struct serio *port) | |||
| 179 | /* Disable interrupt 0 */ | 171 | /* Disable interrupt 0 */ |
| 180 | tmp = readl(priv->base + PJ_INTERRUPT_MASK); | 172 | tmp = readl(priv->base + PJ_INTERRUPT_MASK); |
| 181 | writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); | 173 | writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); |
| 182 | |||
| 183 | clk_disable_unprepare(priv->clk); | ||
| 184 | } | 174 | } |
| 185 | } | 175 | } |
| 186 | 176 | ||
| @@ -195,6 +185,8 @@ static int olpc_apsp_probe(struct platform_device *pdev) | |||
| 195 | if (!priv) | 185 | if (!priv) |
| 196 | return -ENOMEM; | 186 | return -ENOMEM; |
| 197 | 187 | ||
| 188 | priv->dev = &pdev->dev; | ||
| 189 | |||
| 198 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 199 | priv->base = devm_ioremap_resource(&pdev->dev, res); | 191 | priv->base = devm_ioremap_resource(&pdev->dev, res); |
| 200 | if (IS_ERR(priv->base)) { | 192 | if (IS_ERR(priv->base)) { |
| @@ -206,10 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) | |||
| 206 | if (priv->irq < 0) | 198 | if (priv->irq < 0) |
| 207 | return priv->irq; | 199 | return priv->irq; |
| 208 | 200 | ||
| 209 | priv->clk = devm_clk_get(&pdev->dev, "sp"); | ||
| 210 | if (IS_ERR(priv->clk)) | ||
| 211 | return PTR_ERR(priv->clk); | ||
| 212 | |||
| 213 | /* KEYBOARD */ | 201 | /* KEYBOARD */ |
| 214 | kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); | 202 | kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
| 215 | if (!kb_serio) | 203 | if (!kb_serio) |
| @@ -248,7 +236,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) | |||
| 248 | goto err_irq; | 236 | goto err_irq; |
| 249 | } | 237 | } |
| 250 | 238 | ||
| 251 | priv->dev = &pdev->dev; | ||
| 252 | device_init_wakeup(priv->dev, 1); | 239 | device_init_wakeup(priv->dev, 1); |
| 253 | platform_set_drvdata(pdev, priv); | 240 | platform_set_drvdata(pdev, priv); |
| 254 | 241 | ||
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index af6027cc7bbf..068dbbc610fc 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -698,7 +698,7 @@ config TOUCHSCREEN_EDT_FT5X06 | |||
| 698 | 698 | ||
| 699 | config TOUCHSCREEN_RASPBERRYPI_FW | 699 | config TOUCHSCREEN_RASPBERRYPI_FW |
| 700 | tristate "Raspberry Pi's firmware base touch screen support" | 700 | tristate "Raspberry Pi's firmware base touch screen support" |
| 701 | depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST | 701 | depends on RASPBERRYPI_FIRMWARE || (RASPBERRYPI_FIRMWARE=n && COMPILE_TEST) |
| 702 | help | 702 | help |
| 703 | Say Y here if you have the official Raspberry Pi 7 inch screen on | 703 | Say Y here if you have the official Raspberry Pi 7 inch screen on |
| 704 | your system. | 704 | your system. |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 87ba23a75b38..2a7b78bb98b4 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -1991,16 +1991,13 @@ static void do_attach(struct iommu_dev_data *dev_data, | |||
| 1991 | 1991 | ||
| 1992 | static void do_detach(struct iommu_dev_data *dev_data) | 1992 | static void do_detach(struct iommu_dev_data *dev_data) |
| 1993 | { | 1993 | { |
| 1994 | struct protection_domain *domain = dev_data->domain; | ||
| 1994 | struct amd_iommu *iommu; | 1995 | struct amd_iommu *iommu; |
| 1995 | u16 alias; | 1996 | u16 alias; |
| 1996 | 1997 | ||
| 1997 | iommu = amd_iommu_rlookup_table[dev_data->devid]; | 1998 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
| 1998 | alias = dev_data->alias; | 1999 | alias = dev_data->alias; |
| 1999 | 2000 | ||
| 2000 | /* decrease reference counters */ | ||
| 2001 | dev_data->domain->dev_iommu[iommu->index] -= 1; | ||
| 2002 | dev_data->domain->dev_cnt -= 1; | ||
| 2003 | |||
| 2004 | /* Update data structures */ | 2001 | /* Update data structures */ |
| 2005 | dev_data->domain = NULL; | 2002 | dev_data->domain = NULL; |
| 2006 | list_del(&dev_data->list); | 2003 | list_del(&dev_data->list); |
| @@ -2010,6 +2007,16 @@ static void do_detach(struct iommu_dev_data *dev_data) | |||
| 2010 | 2007 | ||
| 2011 | /* Flush the DTE entry */ | 2008 | /* Flush the DTE entry */ |
| 2012 | device_flush_dte(dev_data); | 2009 | device_flush_dte(dev_data); |
| 2010 | |||
| 2011 | /* Flush IOTLB */ | ||
| 2012 | domain_flush_tlb_pde(domain); | ||
| 2013 | |||
| 2014 | /* Wait for the flushes to finish */ | ||
| 2015 | domain_flush_complete(domain); | ||
| 2016 | |||
| 2017 | /* decrease reference counters - needs to happen after the flushes */ | ||
| 2018 | domain->dev_iommu[iommu->index] -= 1; | ||
| 2019 | domain->dev_cnt -= 1; | ||
| 2013 | } | 2020 | } |
| 2014 | 2021 | ||
| 2015 | /* | 2022 | /* |
| @@ -2617,13 +2624,13 @@ out_unmap: | |||
| 2617 | bus_addr = address + s->dma_address + (j << PAGE_SHIFT); | 2624 | bus_addr = address + s->dma_address + (j << PAGE_SHIFT); |
| 2618 | iommu_unmap_page(domain, bus_addr, PAGE_SIZE); | 2625 | iommu_unmap_page(domain, bus_addr, PAGE_SIZE); |
| 2619 | 2626 | ||
| 2620 | if (--mapped_pages) | 2627 | if (--mapped_pages == 0) |
| 2621 | goto out_free_iova; | 2628 | goto out_free_iova; |
| 2622 | } | 2629 | } |
| 2623 | } | 2630 | } |
| 2624 | 2631 | ||
| 2625 | out_free_iova: | 2632 | out_free_iova: |
| 2626 | free_iova_fast(&dma_dom->iovad, address, npages); | 2633 | free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages); |
| 2627 | 2634 | ||
| 2628 | out_err: | 2635 | out_err: |
| 2629 | return 0; | 2636 | return 0; |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 2bd9ac285c0d..78188bf7e90d 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -363,7 +363,7 @@ static int dmar_map_gfx = 1; | |||
| 363 | static int dmar_forcedac; | 363 | static int dmar_forcedac; |
| 364 | static int intel_iommu_strict; | 364 | static int intel_iommu_strict; |
| 365 | static int intel_iommu_superpage = 1; | 365 | static int intel_iommu_superpage = 1; |
| 366 | static int intel_iommu_sm = 1; | 366 | static int intel_iommu_sm; |
| 367 | static int iommu_identity_mapping; | 367 | static int iommu_identity_mapping; |
| 368 | 368 | ||
| 369 | #define IDENTMAP_ALL 1 | 369 | #define IDENTMAP_ALL 1 |
| @@ -456,9 +456,9 @@ static int __init intel_iommu_setup(char *str) | |||
| 456 | } else if (!strncmp(str, "sp_off", 6)) { | 456 | } else if (!strncmp(str, "sp_off", 6)) { |
| 457 | pr_info("Disable supported super page\n"); | 457 | pr_info("Disable supported super page\n"); |
| 458 | intel_iommu_superpage = 0; | 458 | intel_iommu_superpage = 0; |
| 459 | } else if (!strncmp(str, "sm_off", 6)) { | 459 | } else if (!strncmp(str, "sm_on", 5)) { |
| 460 | pr_info("Intel-IOMMU: disable scalable mode support\n"); | 460 | pr_info("Intel-IOMMU: scalable mode supported\n"); |
| 461 | intel_iommu_sm = 0; | 461 | intel_iommu_sm = 1; |
| 462 | } else if (!strncmp(str, "tboot_noforce", 13)) { | 462 | } else if (!strncmp(str, "tboot_noforce", 13)) { |
| 463 | printk(KERN_INFO | 463 | printk(KERN_INFO |
| 464 | "Intel-IOMMU: not forcing on after tboot. This could expose security risk for tboot\n"); | 464 | "Intel-IOMMU: not forcing on after tboot. This could expose security risk for tboot\n"); |
| @@ -5294,7 +5294,7 @@ static void intel_iommu_put_resv_regions(struct device *dev, | |||
| 5294 | struct iommu_resv_region *entry, *next; | 5294 | struct iommu_resv_region *entry, *next; |
| 5295 | 5295 | ||
| 5296 | list_for_each_entry_safe(entry, next, head, list) { | 5296 | list_for_each_entry_safe(entry, next, head, list) { |
| 5297 | if (entry->type == IOMMU_RESV_RESERVED) | 5297 | if (entry->type == IOMMU_RESV_MSI) |
| 5298 | kfree(entry); | 5298 | kfree(entry); |
| 5299 | } | 5299 | } |
| 5300 | } | 5300 | } |
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 730f7dabcf37..7e0df67bd3e9 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c | |||
| @@ -441,6 +441,10 @@ static int mtk_iommu_add_device(struct device *dev) | |||
| 441 | iommu_spec.args_count = count; | 441 | iommu_spec.args_count = count; |
| 442 | 442 | ||
| 443 | mtk_iommu_create_mapping(dev, &iommu_spec); | 443 | mtk_iommu_create_mapping(dev, &iommu_spec); |
| 444 | |||
| 445 | /* dev->iommu_fwspec might have changed */ | ||
| 446 | fwspec = dev_iommu_fwspec_get(dev); | ||
| 447 | |||
| 444 | of_node_put(iommu_spec.np); | 448 | of_node_put(iommu_spec.np); |
| 445 | } | 449 | } |
| 446 | 450 | ||
diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index d8947b28db2d..f04a6df65eb8 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c | |||
| @@ -224,7 +224,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, | |||
| 224 | * If we have reason to believe the IOMMU driver missed the initial | 224 | * If we have reason to believe the IOMMU driver missed the initial |
| 225 | * probe for dev, replay it to get things in order. | 225 | * probe for dev, replay it to get things in order. |
| 226 | */ | 226 | */ |
| 227 | if (dev->bus && !device_iommu_mapped(dev)) | 227 | if (!err && dev->bus && !device_iommu_mapped(dev)) |
| 228 | err = iommu_probe_device(dev); | 228 | err = iommu_probe_device(dev); |
| 229 | 229 | ||
| 230 | /* Ignore all other errors apart from EPROBE_DEFER */ | 230 | /* Ignore all other errors apart from EPROBE_DEFER */ |
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index db20e992a40f..c3aba3fc818d 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
| @@ -97,9 +97,14 @@ struct its_device; | |||
| 97 | * The ITS structure - contains most of the infrastructure, with the | 97 | * The ITS structure - contains most of the infrastructure, with the |
| 98 | * top-level MSI domain, the command queue, the collections, and the | 98 | * top-level MSI domain, the command queue, the collections, and the |
| 99 | * list of devices writing to it. | 99 | * list of devices writing to it. |
| 100 | * | ||
| 101 | * dev_alloc_lock has to be taken for device allocations, while the | ||
| 102 | * spinlock must be taken to parse data structures such as the device | ||
| 103 | * list. | ||
| 100 | */ | 104 | */ |
| 101 | struct its_node { | 105 | struct its_node { |
| 102 | raw_spinlock_t lock; | 106 | raw_spinlock_t lock; |
| 107 | struct mutex dev_alloc_lock; | ||
| 103 | struct list_head entry; | 108 | struct list_head entry; |
| 104 | void __iomem *base; | 109 | void __iomem *base; |
| 105 | phys_addr_t phys_base; | 110 | phys_addr_t phys_base; |
| @@ -156,6 +161,7 @@ struct its_device { | |||
| 156 | void *itt; | 161 | void *itt; |
| 157 | u32 nr_ites; | 162 | u32 nr_ites; |
| 158 | u32 device_id; | 163 | u32 device_id; |
| 164 | bool shared; | ||
| 159 | }; | 165 | }; |
| 160 | 166 | ||
| 161 | static struct { | 167 | static struct { |
| @@ -1580,6 +1586,9 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids) | |||
| 1580 | nr_irqs /= 2; | 1586 | nr_irqs /= 2; |
| 1581 | } while (nr_irqs > 0); | 1587 | } while (nr_irqs > 0); |
| 1582 | 1588 | ||
| 1589 | if (!nr_irqs) | ||
| 1590 | err = -ENOSPC; | ||
| 1591 | |||
| 1583 | if (err) | 1592 | if (err) |
| 1584 | goto out; | 1593 | goto out; |
| 1585 | 1594 | ||
| @@ -2059,6 +2068,29 @@ static int __init allocate_lpi_tables(void) | |||
| 2059 | return 0; | 2068 | return 0; |
| 2060 | } | 2069 | } |
| 2061 | 2070 | ||
| 2071 | static u64 its_clear_vpend_valid(void __iomem *vlpi_base) | ||
| 2072 | { | ||
| 2073 | u32 count = 1000000; /* 1s! */ | ||
| 2074 | bool clean; | ||
| 2075 | u64 val; | ||
| 2076 | |||
| 2077 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2078 | val &= ~GICR_VPENDBASER_Valid; | ||
| 2079 | gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | ||
| 2080 | |||
| 2081 | do { | ||
| 2082 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2083 | clean = !(val & GICR_VPENDBASER_Dirty); | ||
| 2084 | if (!clean) { | ||
| 2085 | count--; | ||
| 2086 | cpu_relax(); | ||
| 2087 | udelay(1); | ||
| 2088 | } | ||
| 2089 | } while (!clean && count); | ||
| 2090 | |||
| 2091 | return val; | ||
| 2092 | } | ||
| 2093 | |||
| 2062 | static void its_cpu_init_lpis(void) | 2094 | static void its_cpu_init_lpis(void) |
| 2063 | { | 2095 | { |
| 2064 | void __iomem *rbase = gic_data_rdist_rd_base(); | 2096 | void __iomem *rbase = gic_data_rdist_rd_base(); |
| @@ -2144,6 +2176,30 @@ static void its_cpu_init_lpis(void) | |||
| 2144 | val |= GICR_CTLR_ENABLE_LPIS; | 2176 | val |= GICR_CTLR_ENABLE_LPIS; |
| 2145 | writel_relaxed(val, rbase + GICR_CTLR); | 2177 | writel_relaxed(val, rbase + GICR_CTLR); |
| 2146 | 2178 | ||
| 2179 | if (gic_rdists->has_vlpis) { | ||
| 2180 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | ||
| 2181 | |||
| 2182 | /* | ||
| 2183 | * It's possible for CPU to receive VLPIs before it is | ||
| 2184 | * sheduled as a vPE, especially for the first CPU, and the | ||
| 2185 | * VLPI with INTID larger than 2^(IDbits+1) will be considered | ||
| 2186 | * as out of range and dropped by GIC. | ||
| 2187 | * So we initialize IDbits to known value to avoid VLPI drop. | ||
| 2188 | */ | ||
| 2189 | val = (LPI_NRBITS - 1) & GICR_VPROPBASER_IDBITS_MASK; | ||
| 2190 | pr_debug("GICv4: CPU%d: Init IDbits to 0x%llx for GICR_VPROPBASER\n", | ||
| 2191 | smp_processor_id(), val); | ||
| 2192 | gits_write_vpropbaser(val, vlpi_base + GICR_VPROPBASER); | ||
| 2193 | |||
| 2194 | /* | ||
| 2195 | * Also clear Valid bit of GICR_VPENDBASER, in case some | ||
| 2196 | * ancient programming gets left in and has possibility of | ||
| 2197 | * corrupting memory. | ||
| 2198 | */ | ||
| 2199 | val = its_clear_vpend_valid(vlpi_base); | ||
| 2200 | WARN_ON(val & GICR_VPENDBASER_Dirty); | ||
| 2201 | } | ||
| 2202 | |||
| 2147 | /* Make sure the GIC has seen the above */ | 2203 | /* Make sure the GIC has seen the above */ |
| 2148 | dsb(sy); | 2204 | dsb(sy); |
| 2149 | out: | 2205 | out: |
| @@ -2399,13 +2455,14 @@ static void its_free_device(struct its_device *its_dev) | |||
| 2399 | kfree(its_dev); | 2455 | kfree(its_dev); |
| 2400 | } | 2456 | } |
| 2401 | 2457 | ||
| 2402 | static int its_alloc_device_irq(struct its_device *dev, irq_hw_number_t *hwirq) | 2458 | static int its_alloc_device_irq(struct its_device *dev, int nvecs, irq_hw_number_t *hwirq) |
| 2403 | { | 2459 | { |
| 2404 | int idx; | 2460 | int idx; |
| 2405 | 2461 | ||
| 2406 | idx = find_first_zero_bit(dev->event_map.lpi_map, | 2462 | idx = bitmap_find_free_region(dev->event_map.lpi_map, |
| 2407 | dev->event_map.nr_lpis); | 2463 | dev->event_map.nr_lpis, |
| 2408 | if (idx == dev->event_map.nr_lpis) | 2464 | get_count_order(nvecs)); |
| 2465 | if (idx < 0) | ||
| 2409 | return -ENOSPC; | 2466 | return -ENOSPC; |
| 2410 | 2467 | ||
| 2411 | *hwirq = dev->event_map.lpi_base + idx; | 2468 | *hwirq = dev->event_map.lpi_base + idx; |
| @@ -2421,6 +2478,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
| 2421 | struct its_device *its_dev; | 2478 | struct its_device *its_dev; |
| 2422 | struct msi_domain_info *msi_info; | 2479 | struct msi_domain_info *msi_info; |
| 2423 | u32 dev_id; | 2480 | u32 dev_id; |
| 2481 | int err = 0; | ||
| 2424 | 2482 | ||
| 2425 | /* | 2483 | /* |
| 2426 | * We ignore "dev" entierely, and rely on the dev_id that has | 2484 | * We ignore "dev" entierely, and rely on the dev_id that has |
| @@ -2443,6 +2501,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
| 2443 | return -EINVAL; | 2501 | return -EINVAL; |
| 2444 | } | 2502 | } |
| 2445 | 2503 | ||
| 2504 | mutex_lock(&its->dev_alloc_lock); | ||
| 2446 | its_dev = its_find_device(its, dev_id); | 2505 | its_dev = its_find_device(its, dev_id); |
| 2447 | if (its_dev) { | 2506 | if (its_dev) { |
| 2448 | /* | 2507 | /* |
| @@ -2450,18 +2509,22 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
| 2450 | * another alias (PCI bridge of some sort). No need to | 2509 | * another alias (PCI bridge of some sort). No need to |
| 2451 | * create the device. | 2510 | * create the device. |
| 2452 | */ | 2511 | */ |
| 2512 | its_dev->shared = true; | ||
| 2453 | pr_debug("Reusing ITT for devID %x\n", dev_id); | 2513 | pr_debug("Reusing ITT for devID %x\n", dev_id); |
| 2454 | goto out; | 2514 | goto out; |
| 2455 | } | 2515 | } |
| 2456 | 2516 | ||
| 2457 | its_dev = its_create_device(its, dev_id, nvec, true); | 2517 | its_dev = its_create_device(its, dev_id, nvec, true); |
| 2458 | if (!its_dev) | 2518 | if (!its_dev) { |
| 2459 | return -ENOMEM; | 2519 | err = -ENOMEM; |
| 2520 | goto out; | ||
| 2521 | } | ||
| 2460 | 2522 | ||
| 2461 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); | 2523 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); |
| 2462 | out: | 2524 | out: |
| 2525 | mutex_unlock(&its->dev_alloc_lock); | ||
| 2463 | info->scratchpad[0].ptr = its_dev; | 2526 | info->scratchpad[0].ptr = its_dev; |
| 2464 | return 0; | 2527 | return err; |
| 2465 | } | 2528 | } |
| 2466 | 2529 | ||
| 2467 | static struct msi_domain_ops its_msi_domain_ops = { | 2530 | static struct msi_domain_ops its_msi_domain_ops = { |
| @@ -2501,21 +2564,21 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, | |||
| 2501 | int err; | 2564 | int err; |
| 2502 | int i; | 2565 | int i; |
| 2503 | 2566 | ||
| 2504 | for (i = 0; i < nr_irqs; i++) { | 2567 | err = its_alloc_device_irq(its_dev, nr_irqs, &hwirq); |
| 2505 | err = its_alloc_device_irq(its_dev, &hwirq); | 2568 | if (err) |
| 2506 | if (err) | 2569 | return err; |
| 2507 | return err; | ||
| 2508 | 2570 | ||
| 2509 | err = its_irq_gic_domain_alloc(domain, virq + i, hwirq); | 2571 | for (i = 0; i < nr_irqs; i++) { |
| 2572 | err = its_irq_gic_domain_alloc(domain, virq + i, hwirq + i); | ||
| 2510 | if (err) | 2573 | if (err) |
| 2511 | return err; | 2574 | return err; |
| 2512 | 2575 | ||
| 2513 | irq_domain_set_hwirq_and_chip(domain, virq + i, | 2576 | irq_domain_set_hwirq_and_chip(domain, virq + i, |
| 2514 | hwirq, &its_irq_chip, its_dev); | 2577 | hwirq + i, &its_irq_chip, its_dev); |
| 2515 | irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq + i))); | 2578 | irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq + i))); |
| 2516 | pr_debug("ID:%d pID:%d vID:%d\n", | 2579 | pr_debug("ID:%d pID:%d vID:%d\n", |
| 2517 | (int)(hwirq - its_dev->event_map.lpi_base), | 2580 | (int)(hwirq + i - its_dev->event_map.lpi_base), |
| 2518 | (int) hwirq, virq + i); | 2581 | (int)(hwirq + i), virq + i); |
| 2519 | } | 2582 | } |
| 2520 | 2583 | ||
| 2521 | return 0; | 2584 | return 0; |
| @@ -2565,6 +2628,7 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
| 2565 | { | 2628 | { |
| 2566 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); | 2629 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); |
| 2567 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); | 2630 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); |
| 2631 | struct its_node *its = its_dev->its; | ||
| 2568 | int i; | 2632 | int i; |
| 2569 | 2633 | ||
| 2570 | for (i = 0; i < nr_irqs; i++) { | 2634 | for (i = 0; i < nr_irqs; i++) { |
| @@ -2579,8 +2643,14 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
| 2579 | irq_domain_reset_irq_data(data); | 2643 | irq_domain_reset_irq_data(data); |
| 2580 | } | 2644 | } |
| 2581 | 2645 | ||
| 2582 | /* If all interrupts have been freed, start mopping the floor */ | 2646 | mutex_lock(&its->dev_alloc_lock); |
| 2583 | if (bitmap_empty(its_dev->event_map.lpi_map, | 2647 | |
| 2648 | /* | ||
| 2649 | * If all interrupts have been freed, start mopping the | ||
| 2650 | * floor. This is conditionned on the device not being shared. | ||
| 2651 | */ | ||
| 2652 | if (!its_dev->shared && | ||
| 2653 | bitmap_empty(its_dev->event_map.lpi_map, | ||
| 2584 | its_dev->event_map.nr_lpis)) { | 2654 | its_dev->event_map.nr_lpis)) { |
| 2585 | its_lpi_free(its_dev->event_map.lpi_map, | 2655 | its_lpi_free(its_dev->event_map.lpi_map, |
| 2586 | its_dev->event_map.lpi_base, | 2656 | its_dev->event_map.lpi_base, |
| @@ -2592,6 +2662,8 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
| 2592 | its_free_device(its_dev); | 2662 | its_free_device(its_dev); |
| 2593 | } | 2663 | } |
| 2594 | 2664 | ||
| 2665 | mutex_unlock(&its->dev_alloc_lock); | ||
| 2666 | |||
| 2595 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); | 2667 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); |
| 2596 | } | 2668 | } |
| 2597 | 2669 | ||
| @@ -2754,26 +2826,11 @@ static void its_vpe_schedule(struct its_vpe *vpe) | |||
| 2754 | static void its_vpe_deschedule(struct its_vpe *vpe) | 2826 | static void its_vpe_deschedule(struct its_vpe *vpe) |
| 2755 | { | 2827 | { |
| 2756 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | 2828 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); |
| 2757 | u32 count = 1000000; /* 1s! */ | ||
| 2758 | bool clean; | ||
| 2759 | u64 val; | 2829 | u64 val; |
| 2760 | 2830 | ||
| 2761 | /* We're being scheduled out */ | 2831 | val = its_clear_vpend_valid(vlpi_base); |
| 2762 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2763 | val &= ~GICR_VPENDBASER_Valid; | ||
| 2764 | gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | ||
| 2765 | |||
| 2766 | do { | ||
| 2767 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2768 | clean = !(val & GICR_VPENDBASER_Dirty); | ||
| 2769 | if (!clean) { | ||
| 2770 | count--; | ||
| 2771 | cpu_relax(); | ||
| 2772 | udelay(1); | ||
| 2773 | } | ||
| 2774 | } while (!clean && count); | ||
| 2775 | 2832 | ||
| 2776 | if (unlikely(!clean && !count)) { | 2833 | if (unlikely(val & GICR_VPENDBASER_Dirty)) { |
| 2777 | pr_err_ratelimited("ITS virtual pending table not cleaning\n"); | 2834 | pr_err_ratelimited("ITS virtual pending table not cleaning\n"); |
| 2778 | vpe->idai = false; | 2835 | vpe->idai = false; |
| 2779 | vpe->pending_last = true; | 2836 | vpe->pending_last = true; |
| @@ -3516,6 +3573,7 @@ static int __init its_probe_one(struct resource *res, | |||
| 3516 | } | 3573 | } |
| 3517 | 3574 | ||
| 3518 | raw_spin_lock_init(&its->lock); | 3575 | raw_spin_lock_init(&its->lock); |
| 3576 | mutex_init(&its->dev_alloc_lock); | ||
| 3519 | INIT_LIST_HEAD(&its->entry); | 3577 | INIT_LIST_HEAD(&its->entry); |
| 3520 | INIT_LIST_HEAD(&its->its_device_list); | 3578 | INIT_LIST_HEAD(&its->its_device_list); |
| 3521 | typer = gic_read_typer(its_base + GITS_TYPER); | 3579 | typer = gic_read_typer(its_base + GITS_TYPER); |
diff --git a/drivers/irqchip/irq-gic-v3-mbi.c b/drivers/irqchip/irq-gic-v3-mbi.c index ad70e7c416e3..fbfa7ff6deb1 100644 --- a/drivers/irqchip/irq-gic-v3-mbi.c +++ b/drivers/irqchip/irq-gic-v3-mbi.c | |||
| @@ -24,7 +24,7 @@ struct mbi_range { | |||
| 24 | unsigned long *bm; | 24 | unsigned long *bm; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | static struct mutex mbi_lock; | 27 | static DEFINE_MUTEX(mbi_lock); |
| 28 | static phys_addr_t mbi_phys_base; | 28 | static phys_addr_t mbi_phys_base; |
| 29 | static struct mbi_range *mbi_ranges; | 29 | static struct mbi_range *mbi_ranges; |
| 30 | static unsigned int mbi_range_nr; | 30 | static unsigned int mbi_range_nr; |
diff --git a/drivers/irqchip/irq-madera.c b/drivers/irqchip/irq-madera.c index e9256dee1a45..8b81271c823c 100644 --- a/drivers/irqchip/irq-madera.c +++ b/drivers/irqchip/irq-madera.c | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| 10 | #include <linux/gpio.h> | ||
| 11 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
| 12 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
| 13 | #include <linux/irqdomain.h> | 12 | #include <linux/irqdomain.h> |
| @@ -16,7 +15,6 @@ | |||
| 16 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
| 17 | #include <linux/of.h> | 16 | #include <linux/of.h> |
| 18 | #include <linux/of_device.h> | 17 | #include <linux/of_device.h> |
| 19 | #include <linux/of_gpio.h> | ||
| 20 | #include <linux/of_irq.h> | 18 | #include <linux/of_irq.h> |
| 21 | #include <linux/irqchip/irq-madera.h> | 19 | #include <linux/irqchip/irq-madera.h> |
| 22 | #include <linux/mfd/madera/core.h> | 20 | #include <linux/mfd/madera/core.h> |
diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c index 25f32e1d7764..3496b61a312a 100644 --- a/drivers/irqchip/irq-mmp.c +++ b/drivers/irqchip/irq-mmp.c | |||
| @@ -34,6 +34,9 @@ | |||
| 34 | #define SEL_INT_PENDING (1 << 6) | 34 | #define SEL_INT_PENDING (1 << 6) |
| 35 | #define SEL_INT_NUM_MASK 0x3f | 35 | #define SEL_INT_NUM_MASK 0x3f |
| 36 | 36 | ||
| 37 | #define MMP2_ICU_INT_ROUTE_PJ4_IRQ (1 << 5) | ||
| 38 | #define MMP2_ICU_INT_ROUTE_PJ4_FIQ (1 << 6) | ||
| 39 | |||
| 37 | struct icu_chip_data { | 40 | struct icu_chip_data { |
| 38 | int nr_irqs; | 41 | int nr_irqs; |
| 39 | unsigned int virq_base; | 42 | unsigned int virq_base; |
| @@ -190,7 +193,8 @@ static const struct mmp_intc_conf mmp_conf = { | |||
| 190 | static const struct mmp_intc_conf mmp2_conf = { | 193 | static const struct mmp_intc_conf mmp2_conf = { |
| 191 | .conf_enable = 0x20, | 194 | .conf_enable = 0x20, |
| 192 | .conf_disable = 0x0, | 195 | .conf_disable = 0x0, |
| 193 | .conf_mask = 0x7f, | 196 | .conf_mask = MMP2_ICU_INT_ROUTE_PJ4_IRQ | |
| 197 | MMP2_ICU_INT_ROUTE_PJ4_FIQ, | ||
| 194 | }; | 198 | }; |
| 195 | 199 | ||
| 196 | static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) | 200 | static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) |
diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c index 6edfd4bfa169..a93296b9b45d 100644 --- a/drivers/irqchip/irq-stm32-exti.c +++ b/drivers/irqchip/irq-stm32-exti.c | |||
| @@ -822,6 +822,7 @@ out_unmap: | |||
| 822 | static const struct irq_domain_ops stm32_exti_h_domain_ops = { | 822 | static const struct irq_domain_ops stm32_exti_h_domain_ops = { |
| 823 | .alloc = stm32_exti_h_domain_alloc, | 823 | .alloc = stm32_exti_h_domain_alloc, |
| 824 | .free = irq_domain_free_irqs_common, | 824 | .free = irq_domain_free_irqs_common, |
| 825 | .xlate = irq_domain_xlate_twocell, | ||
| 825 | }; | 826 | }; |
| 826 | 827 | ||
| 827 | static int | 828 | static int |
diff --git a/drivers/irqchip/irq-xtensa-mx.c b/drivers/irqchip/irq-xtensa-mx.c index 5385f5768345..27933338f7b3 100644 --- a/drivers/irqchip/irq-xtensa-mx.c +++ b/drivers/irqchip/irq-xtensa-mx.c | |||
| @@ -71,14 +71,17 @@ static void xtensa_mx_irq_mask(struct irq_data *d) | |||
| 71 | unsigned int mask = 1u << d->hwirq; | 71 | unsigned int mask = 1u << d->hwirq; |
| 72 | 72 | ||
| 73 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | | 73 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | |
| 74 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | 74 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { |
| 75 | set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - | 75 | unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq); |
| 76 | HW_IRQ_MX_BASE), MIENG); | 76 | |
| 77 | } else { | 77 | if (ext_irq >= HW_IRQ_MX_BASE) { |
| 78 | mask = __this_cpu_read(cached_irq_mask) & ~mask; | 78 | set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENG); |
| 79 | __this_cpu_write(cached_irq_mask, mask); | 79 | return; |
| 80 | xtensa_set_sr(mask, intenable); | 80 | } |
| 81 | } | 81 | } |
| 82 | mask = __this_cpu_read(cached_irq_mask) & ~mask; | ||
| 83 | __this_cpu_write(cached_irq_mask, mask); | ||
| 84 | xtensa_set_sr(mask, intenable); | ||
| 82 | } | 85 | } |
| 83 | 86 | ||
| 84 | static void xtensa_mx_irq_unmask(struct irq_data *d) | 87 | static void xtensa_mx_irq_unmask(struct irq_data *d) |
| @@ -86,14 +89,17 @@ static void xtensa_mx_irq_unmask(struct irq_data *d) | |||
| 86 | unsigned int mask = 1u << d->hwirq; | 89 | unsigned int mask = 1u << d->hwirq; |
| 87 | 90 | ||
| 88 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | | 91 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | |
| 89 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | 92 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { |
| 90 | set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - | 93 | unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq); |
| 91 | HW_IRQ_MX_BASE), MIENGSET); | 94 | |
| 92 | } else { | 95 | if (ext_irq >= HW_IRQ_MX_BASE) { |
| 93 | mask |= __this_cpu_read(cached_irq_mask); | 96 | set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENGSET); |
| 94 | __this_cpu_write(cached_irq_mask, mask); | 97 | return; |
| 95 | xtensa_set_sr(mask, intenable); | 98 | } |
| 96 | } | 99 | } |
| 100 | mask |= __this_cpu_read(cached_irq_mask); | ||
| 101 | __this_cpu_write(cached_irq_mask, mask); | ||
| 102 | xtensa_set_sr(mask, intenable); | ||
| 97 | } | 103 | } |
| 98 | 104 | ||
| 99 | static void xtensa_mx_irq_enable(struct irq_data *d) | 105 | static void xtensa_mx_irq_enable(struct irq_data *d) |
| @@ -113,7 +119,11 @@ static void xtensa_mx_irq_ack(struct irq_data *d) | |||
| 113 | 119 | ||
| 114 | static int xtensa_mx_irq_retrigger(struct irq_data *d) | 120 | static int xtensa_mx_irq_retrigger(struct irq_data *d) |
| 115 | { | 121 | { |
| 116 | xtensa_set_sr(1 << d->hwirq, intset); | 122 | unsigned int mask = 1u << d->hwirq; |
| 123 | |||
| 124 | if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE)) | ||
| 125 | return 0; | ||
| 126 | xtensa_set_sr(mask, intset); | ||
| 117 | return 1; | 127 | return 1; |
| 118 | } | 128 | } |
| 119 | 129 | ||
diff --git a/drivers/irqchip/irq-xtensa-pic.c b/drivers/irqchip/irq-xtensa-pic.c index c200234dd2c9..ab12328be5ee 100644 --- a/drivers/irqchip/irq-xtensa-pic.c +++ b/drivers/irqchip/irq-xtensa-pic.c | |||
| @@ -70,7 +70,11 @@ static void xtensa_irq_ack(struct irq_data *d) | |||
| 70 | 70 | ||
| 71 | static int xtensa_irq_retrigger(struct irq_data *d) | 71 | static int xtensa_irq_retrigger(struct irq_data *d) |
| 72 | { | 72 | { |
| 73 | xtensa_set_sr(1 << d->hwirq, intset); | 73 | unsigned int mask = 1u << d->hwirq; |
| 74 | |||
| 75 | if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE)) | ||
| 76 | return 0; | ||
| 77 | xtensa_set_sr(mask, intset); | ||
| 74 | return 1; | 78 | return 1; |
| 75 | } | 79 | } |
| 76 | 80 | ||
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c index 211ed6cffd10..578978711887 100644 --- a/drivers/isdn/mISDN/timerdev.c +++ b/drivers/isdn/mISDN/timerdev.c | |||
| @@ -170,8 +170,8 @@ dev_expire_timer(struct timer_list *t) | |||
| 170 | spin_lock_irqsave(&timer->dev->lock, flags); | 170 | spin_lock_irqsave(&timer->dev->lock, flags); |
| 171 | if (timer->id >= 0) | 171 | if (timer->id >= 0) |
| 172 | list_move_tail(&timer->list, &timer->dev->expired); | 172 | list_move_tail(&timer->list, &timer->dev->expired); |
| 173 | spin_unlock_irqrestore(&timer->dev->lock, flags); | ||
| 174 | wake_up_interruptible(&timer->dev->wait); | 173 | wake_up_interruptible(&timer->dev->wait); |
| 174 | spin_unlock_irqrestore(&timer->dev->lock, flags); | ||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | static int | 177 | static int |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 0ff22159a0ca..47d4e0d30bf0 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
| @@ -2414,9 +2414,21 @@ static int crypt_ctr_cipher_new(struct dm_target *ti, char *cipher_in, char *key | |||
| 2414 | * capi:cipher_api_spec-iv:ivopts | 2414 | * capi:cipher_api_spec-iv:ivopts |
| 2415 | */ | 2415 | */ |
| 2416 | tmp = &cipher_in[strlen("capi:")]; | 2416 | tmp = &cipher_in[strlen("capi:")]; |
| 2417 | cipher_api = strsep(&tmp, "-"); | 2417 | |
| 2418 | *ivmode = strsep(&tmp, ":"); | 2418 | /* Separate IV options if present, it can contain another '-' in hash name */ |
| 2419 | *ivopts = tmp; | 2419 | *ivopts = strrchr(tmp, ':'); |
| 2420 | if (*ivopts) { | ||
| 2421 | **ivopts = '\0'; | ||
| 2422 | (*ivopts)++; | ||
| 2423 | } | ||
| 2424 | /* Parse IV mode */ | ||
| 2425 | *ivmode = strrchr(tmp, '-'); | ||
| 2426 | if (*ivmode) { | ||
| 2427 | **ivmode = '\0'; | ||
| 2428 | (*ivmode)++; | ||
| 2429 | } | ||
| 2430 | /* The rest is crypto API spec */ | ||
| 2431 | cipher_api = tmp; | ||
| 2420 | 2432 | ||
| 2421 | if (*ivmode && !strcmp(*ivmode, "lmk")) | 2433 | if (*ivmode && !strcmp(*ivmode, "lmk")) |
| 2422 | cc->tfms_count = 64; | 2434 | cc->tfms_count = 64; |
| @@ -2486,11 +2498,8 @@ static int crypt_ctr_cipher_old(struct dm_target *ti, char *cipher_in, char *key | |||
| 2486 | goto bad_mem; | 2498 | goto bad_mem; |
| 2487 | 2499 | ||
| 2488 | chainmode = strsep(&tmp, "-"); | 2500 | chainmode = strsep(&tmp, "-"); |
| 2489 | *ivopts = strsep(&tmp, "-"); | 2501 | *ivmode = strsep(&tmp, ":"); |
| 2490 | *ivmode = strsep(&*ivopts, ":"); | 2502 | *ivopts = tmp; |
| 2491 | |||
| 2492 | if (tmp) | ||
| 2493 | DMWARN("Ignoring unexpected additional cipher options"); | ||
| 2494 | 2503 | ||
| 2495 | /* | 2504 | /* |
| 2496 | * For compatibility with the original dm-crypt mapping format, if | 2505 | * For compatibility with the original dm-crypt mapping format, if |
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 4eb5f8c56535..a20531e5f3b4 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c | |||
| @@ -131,7 +131,7 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig) | |||
| 131 | static void rq_completed(struct mapped_device *md) | 131 | static void rq_completed(struct mapped_device *md) |
| 132 | { | 132 | { |
| 133 | /* nudge anyone waiting on suspend queue */ | 133 | /* nudge anyone waiting on suspend queue */ |
| 134 | if (unlikely(waitqueue_active(&md->wait))) | 134 | if (unlikely(wq_has_sleeper(&md->wait))) |
| 135 | wake_up(&md->wait); | 135 | wake_up(&md->wait); |
| 136 | 136 | ||
| 137 | /* | 137 | /* |
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 20b0776e39ef..ed3caceaed07 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
| @@ -1678,7 +1678,7 @@ int dm_thin_remove_range(struct dm_thin_device *td, | |||
| 1678 | return r; | 1678 | return r; |
| 1679 | } | 1679 | } |
| 1680 | 1680 | ||
| 1681 | int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *result) | 1681 | int dm_pool_block_is_shared(struct dm_pool_metadata *pmd, dm_block_t b, bool *result) |
| 1682 | { | 1682 | { |
| 1683 | int r; | 1683 | int r; |
| 1684 | uint32_t ref_count; | 1684 | uint32_t ref_count; |
| @@ -1686,7 +1686,7 @@ int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *resu | |||
| 1686 | down_read(&pmd->root_lock); | 1686 | down_read(&pmd->root_lock); |
| 1687 | r = dm_sm_get_count(pmd->data_sm, b, &ref_count); | 1687 | r = dm_sm_get_count(pmd->data_sm, b, &ref_count); |
| 1688 | if (!r) | 1688 | if (!r) |
| 1689 | *result = (ref_count != 0); | 1689 | *result = (ref_count > 1); |
| 1690 | up_read(&pmd->root_lock); | 1690 | up_read(&pmd->root_lock); |
| 1691 | 1691 | ||
| 1692 | return r; | 1692 | return r; |
diff --git a/drivers/md/dm-thin-metadata.h b/drivers/md/dm-thin-metadata.h index 35e954ea20a9..f6be0d733c20 100644 --- a/drivers/md/dm-thin-metadata.h +++ b/drivers/md/dm-thin-metadata.h | |||
| @@ -195,7 +195,7 @@ int dm_pool_get_metadata_dev_size(struct dm_pool_metadata *pmd, | |||
| 195 | 195 | ||
| 196 | int dm_pool_get_data_dev_size(struct dm_pool_metadata *pmd, dm_block_t *result); | 196 | int dm_pool_get_data_dev_size(struct dm_pool_metadata *pmd, dm_block_t *result); |
| 197 | 197 | ||
| 198 | int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *result); | 198 | int dm_pool_block_is_shared(struct dm_pool_metadata *pmd, dm_block_t b, bool *result); |
| 199 | 199 | ||
| 200 | int dm_pool_inc_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); | 200 | int dm_pool_inc_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); |
| 201 | int dm_pool_dec_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); | 201 | int dm_pool_dec_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index dadd9696340c..ca8af21bf644 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -1048,7 +1048,7 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m | |||
| 1048 | * passdown we have to check that these blocks are now unused. | 1048 | * passdown we have to check that these blocks are now unused. |
| 1049 | */ | 1049 | */ |
| 1050 | int r = 0; | 1050 | int r = 0; |
| 1051 | bool used = true; | 1051 | bool shared = true; |
| 1052 | struct thin_c *tc = m->tc; | 1052 | struct thin_c *tc = m->tc; |
| 1053 | struct pool *pool = tc->pool; | 1053 | struct pool *pool = tc->pool; |
| 1054 | dm_block_t b = m->data_block, e, end = m->data_block + m->virt_end - m->virt_begin; | 1054 | dm_block_t b = m->data_block, e, end = m->data_block + m->virt_end - m->virt_begin; |
| @@ -1058,11 +1058,11 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m | |||
| 1058 | while (b != end) { | 1058 | while (b != end) { |
| 1059 | /* find start of unmapped run */ | 1059 | /* find start of unmapped run */ |
| 1060 | for (; b < end; b++) { | 1060 | for (; b < end; b++) { |
| 1061 | r = dm_pool_block_is_used(pool->pmd, b, &used); | 1061 | r = dm_pool_block_is_shared(pool->pmd, b, &shared); |
| 1062 | if (r) | 1062 | if (r) |
| 1063 | goto out; | 1063 | goto out; |
| 1064 | 1064 | ||
| 1065 | if (!used) | 1065 | if (!shared) |
| 1066 | break; | 1066 | break; |
| 1067 | } | 1067 | } |
| 1068 | 1068 | ||
| @@ -1071,11 +1071,11 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m | |||
| 1071 | 1071 | ||
| 1072 | /* find end of run */ | 1072 | /* find end of run */ |
| 1073 | for (e = b + 1; e != end; e++) { | 1073 | for (e = b + 1; e != end; e++) { |
| 1074 | r = dm_pool_block_is_used(pool->pmd, e, &used); | 1074 | r = dm_pool_block_is_shared(pool->pmd, e, &shared); |
| 1075 | if (r) | 1075 | if (r) |
| 1076 | goto out; | 1076 | goto out; |
| 1077 | 1077 | ||
| 1078 | if (used) | 1078 | if (shared) |
| 1079 | break; | 1079 | break; |
| 1080 | } | 1080 | } |
| 1081 | 1081 | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index d67c95ef8d7e..515e6af9bed2 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -699,7 +699,7 @@ static void end_io_acct(struct dm_io *io) | |||
| 699 | true, duration, &io->stats_aux); | 699 | true, duration, &io->stats_aux); |
| 700 | 700 | ||
| 701 | /* nudge anyone waiting on suspend queue */ | 701 | /* nudge anyone waiting on suspend queue */ |
| 702 | if (unlikely(waitqueue_active(&md->wait))) | 702 | if (unlikely(wq_has_sleeper(&md->wait))) |
| 703 | wake_up(&md->wait); | 703 | wake_up(&md->wait); |
| 704 | } | 704 | } |
| 705 | 705 | ||
| @@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, | |||
| 1320 | 1320 | ||
| 1321 | __bio_clone_fast(clone, bio); | 1321 | __bio_clone_fast(clone, bio); |
| 1322 | 1322 | ||
| 1323 | if (unlikely(bio_integrity(bio) != NULL)) { | 1323 | if (bio_integrity(bio)) { |
| 1324 | int r; | 1324 | int r; |
| 1325 | 1325 | ||
| 1326 | if (unlikely(!dm_target_has_integrity(tio->ti->type) && | 1326 | if (unlikely(!dm_target_has_integrity(tio->ti->type) && |
| @@ -1339,7 +1339,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, | |||
| 1339 | bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); | 1339 | bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); |
| 1340 | clone->bi_iter.bi_size = to_bytes(len); | 1340 | clone->bi_iter.bi_size = to_bytes(len); |
| 1341 | 1341 | ||
| 1342 | if (unlikely(bio_integrity(bio) != NULL)) | 1342 | if (bio_integrity(bio)) |
| 1343 | bio_integrity_trim(clone); | 1343 | bio_integrity_trim(clone); |
| 1344 | 1344 | ||
| 1345 | return 0; | 1345 | return 0; |
| @@ -1588,6 +1588,9 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md, | |||
| 1588 | ci->sector = bio->bi_iter.bi_sector; | 1588 | ci->sector = bio->bi_iter.bi_sector; |
| 1589 | } | 1589 | } |
| 1590 | 1590 | ||
| 1591 | #define __dm_part_stat_sub(part, field, subnd) \ | ||
| 1592 | (part_stat_get(part, field) -= (subnd)) | ||
| 1593 | |||
| 1591 | /* | 1594 | /* |
| 1592 | * Entry point to split a bio into clones and submit them to the targets. | 1595 | * Entry point to split a bio into clones and submit them to the targets. |
| 1593 | */ | 1596 | */ |
| @@ -1642,7 +1645,21 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, | |||
| 1642 | struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count, | 1645 | struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count, |
| 1643 | GFP_NOIO, &md->queue->bio_split); | 1646 | GFP_NOIO, &md->queue->bio_split); |
| 1644 | ci.io->orig_bio = b; | 1647 | ci.io->orig_bio = b; |
| 1648 | |||
| 1649 | /* | ||
| 1650 | * Adjust IO stats for each split, otherwise upon queue | ||
| 1651 | * reentry there will be redundant IO accounting. | ||
| 1652 | * NOTE: this is a stop-gap fix, a proper fix involves | ||
| 1653 | * significant refactoring of DM core's bio splitting | ||
| 1654 | * (by eliminating DM's splitting and just using bio_split) | ||
| 1655 | */ | ||
| 1656 | part_stat_lock(); | ||
| 1657 | __dm_part_stat_sub(&dm_disk(md)->part0, | ||
| 1658 | sectors[op_stat_group(bio_op(bio))], ci.sector_count); | ||
| 1659 | part_stat_unlock(); | ||
| 1660 | |||
| 1645 | bio_chain(b, bio); | 1661 | bio_chain(b, bio); |
| 1662 | trace_block_split(md->queue, b, bio->bi_iter.bi_sector); | ||
| 1646 | ret = generic_make_request(bio); | 1663 | ret = generic_make_request(bio); |
| 1647 | break; | 1664 | break; |
| 1648 | } | 1665 | } |
| @@ -1713,6 +1730,15 @@ out: | |||
| 1713 | return ret; | 1730 | return ret; |
| 1714 | } | 1731 | } |
| 1715 | 1732 | ||
| 1733 | static blk_qc_t dm_process_bio(struct mapped_device *md, | ||
| 1734 | struct dm_table *map, struct bio *bio) | ||
| 1735 | { | ||
| 1736 | if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) | ||
| 1737 | return __process_bio(md, map, bio); | ||
| 1738 | else | ||
| 1739 | return __split_and_process_bio(md, map, bio); | ||
| 1740 | } | ||
| 1741 | |||
| 1716 | static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) | 1742 | static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) |
| 1717 | { | 1743 | { |
| 1718 | struct mapped_device *md = q->queuedata; | 1744 | struct mapped_device *md = q->queuedata; |
| @@ -1733,10 +1759,7 @@ static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) | |||
| 1733 | return ret; | 1759 | return ret; |
| 1734 | } | 1760 | } |
| 1735 | 1761 | ||
| 1736 | if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) | 1762 | ret = dm_process_bio(md, map, bio); |
| 1737 | ret = __process_bio(md, map, bio); | ||
| 1738 | else | ||
| 1739 | ret = __split_and_process_bio(md, map, bio); | ||
| 1740 | 1763 | ||
| 1741 | dm_put_live_table(md, srcu_idx); | 1764 | dm_put_live_table(md, srcu_idx); |
| 1742 | return ret; | 1765 | return ret; |
| @@ -2415,9 +2438,9 @@ static void dm_wq_work(struct work_struct *work) | |||
| 2415 | break; | 2438 | break; |
| 2416 | 2439 | ||
| 2417 | if (dm_request_based(md)) | 2440 | if (dm_request_based(md)) |
| 2418 | generic_make_request(c); | 2441 | (void) generic_make_request(c); |
| 2419 | else | 2442 | else |
| 2420 | __split_and_process_bio(md, map, c); | 2443 | (void) dm_process_bio(md, map, c); |
| 2421 | } | 2444 | } |
| 2422 | 2445 | ||
| 2423 | dm_put_live_table(md, srcu_idx); | 2446 | dm_put_live_table(md, srcu_idx); |
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index ec3a5ef7fee0..cbbe6b6535be 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c | |||
| @@ -1935,12 +1935,14 @@ out: | |||
| 1935 | } | 1935 | } |
| 1936 | 1936 | ||
| 1937 | static struct stripe_head * | 1937 | static struct stripe_head * |
| 1938 | r5c_recovery_alloc_stripe(struct r5conf *conf, | 1938 | r5c_recovery_alloc_stripe( |
| 1939 | sector_t stripe_sect) | 1939 | struct r5conf *conf, |
| 1940 | sector_t stripe_sect, | ||
| 1941 | int noblock) | ||
| 1940 | { | 1942 | { |
| 1941 | struct stripe_head *sh; | 1943 | struct stripe_head *sh; |
| 1942 | 1944 | ||
| 1943 | sh = raid5_get_active_stripe(conf, stripe_sect, 0, 1, 0); | 1945 | sh = raid5_get_active_stripe(conf, stripe_sect, 0, noblock, 0); |
| 1944 | if (!sh) | 1946 | if (!sh) |
| 1945 | return NULL; /* no more stripe available */ | 1947 | return NULL; /* no more stripe available */ |
| 1946 | 1948 | ||
| @@ -2150,7 +2152,7 @@ r5c_recovery_analyze_meta_block(struct r5l_log *log, | |||
| 2150 | stripe_sect); | 2152 | stripe_sect); |
| 2151 | 2153 | ||
| 2152 | if (!sh) { | 2154 | if (!sh) { |
| 2153 | sh = r5c_recovery_alloc_stripe(conf, stripe_sect); | 2155 | sh = r5c_recovery_alloc_stripe(conf, stripe_sect, 1); |
| 2154 | /* | 2156 | /* |
| 2155 | * cannot get stripe from raid5_get_active_stripe | 2157 | * cannot get stripe from raid5_get_active_stripe |
| 2156 | * try replay some stripes | 2158 | * try replay some stripes |
| @@ -2159,20 +2161,29 @@ r5c_recovery_analyze_meta_block(struct r5l_log *log, | |||
| 2159 | r5c_recovery_replay_stripes( | 2161 | r5c_recovery_replay_stripes( |
| 2160 | cached_stripe_list, ctx); | 2162 | cached_stripe_list, ctx); |
| 2161 | sh = r5c_recovery_alloc_stripe( | 2163 | sh = r5c_recovery_alloc_stripe( |
| 2162 | conf, stripe_sect); | 2164 | conf, stripe_sect, 1); |
| 2163 | } | 2165 | } |
| 2164 | if (!sh) { | 2166 | if (!sh) { |
| 2167 | int new_size = conf->min_nr_stripes * 2; | ||
| 2165 | pr_debug("md/raid:%s: Increasing stripe cache size to %d to recovery data on journal.\n", | 2168 | pr_debug("md/raid:%s: Increasing stripe cache size to %d to recovery data on journal.\n", |
| 2166 | mdname(mddev), | 2169 | mdname(mddev), |
| 2167 | conf->min_nr_stripes * 2); | 2170 | new_size); |
| 2168 | raid5_set_cache_size(mddev, | 2171 | ret = raid5_set_cache_size(mddev, new_size); |
| 2169 | conf->min_nr_stripes * 2); | 2172 | if (conf->min_nr_stripes <= new_size / 2) { |
| 2170 | sh = r5c_recovery_alloc_stripe(conf, | 2173 | pr_err("md/raid:%s: Cannot increase cache size, ret=%d, new_size=%d, min_nr_stripes=%d, max_nr_stripes=%d\n", |
| 2171 | stripe_sect); | 2174 | mdname(mddev), |
| 2175 | ret, | ||
| 2176 | new_size, | ||
| 2177 | conf->min_nr_stripes, | ||
| 2178 | conf->max_nr_stripes); | ||
| 2179 | return -ENOMEM; | ||
| 2180 | } | ||
| 2181 | sh = r5c_recovery_alloc_stripe( | ||
| 2182 | conf, stripe_sect, 0); | ||
| 2172 | } | 2183 | } |
| 2173 | if (!sh) { | 2184 | if (!sh) { |
| 2174 | pr_err("md/raid:%s: Cannot get enough stripes due to memory pressure. Recovery failed.\n", | 2185 | pr_err("md/raid:%s: Cannot get enough stripes due to memory pressure. Recovery failed.\n", |
| 2175 | mdname(mddev)); | 2186 | mdname(mddev)); |
| 2176 | return -ENOMEM; | 2187 | return -ENOMEM; |
| 2177 | } | 2188 | } |
| 2178 | list_add_tail(&sh->lru, cached_stripe_list); | 2189 | list_add_tail(&sh->lru, cached_stripe_list); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4990f0319f6c..cecea901ab8c 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -6369,6 +6369,7 @@ raid5_show_stripe_cache_size(struct mddev *mddev, char *page) | |||
| 6369 | int | 6369 | int |
| 6370 | raid5_set_cache_size(struct mddev *mddev, int size) | 6370 | raid5_set_cache_size(struct mddev *mddev, int size) |
| 6371 | { | 6371 | { |
| 6372 | int result = 0; | ||
| 6372 | struct r5conf *conf = mddev->private; | 6373 | struct r5conf *conf = mddev->private; |
| 6373 | 6374 | ||
| 6374 | if (size <= 16 || size > 32768) | 6375 | if (size <= 16 || size > 32768) |
| @@ -6385,11 +6386,14 @@ raid5_set_cache_size(struct mddev *mddev, int size) | |||
| 6385 | 6386 | ||
| 6386 | mutex_lock(&conf->cache_size_mutex); | 6387 | mutex_lock(&conf->cache_size_mutex); |
| 6387 | while (size > conf->max_nr_stripes) | 6388 | while (size > conf->max_nr_stripes) |
| 6388 | if (!grow_one_stripe(conf, GFP_KERNEL)) | 6389 | if (!grow_one_stripe(conf, GFP_KERNEL)) { |
| 6390 | conf->min_nr_stripes = conf->max_nr_stripes; | ||
| 6391 | result = -ENOMEM; | ||
| 6389 | break; | 6392 | break; |
| 6393 | } | ||
| 6390 | mutex_unlock(&conf->cache_size_mutex); | 6394 | mutex_unlock(&conf->cache_size_mutex); |
| 6391 | 6395 | ||
| 6392 | return 0; | 6396 | return result; |
| 6393 | } | 6397 | } |
| 6394 | EXPORT_SYMBOL(raid5_set_cache_size); | 6398 | EXPORT_SYMBOL(raid5_set_cache_size); |
| 6395 | 6399 | ||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index f461460a2aeb..76f9909cf396 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -1419,7 +1419,7 @@ config MFD_TPS65217 | |||
| 1419 | 1419 | ||
| 1420 | config MFD_TPS68470 | 1420 | config MFD_TPS68470 |
| 1421 | bool "TI TPS68470 Power Management / LED chips" | 1421 | bool "TI TPS68470 Power Management / LED chips" |
| 1422 | depends on ACPI && I2C=y | 1422 | depends on ACPI && PCI && I2C=y |
| 1423 | select MFD_CORE | 1423 | select MFD_CORE |
| 1424 | select REGMAP_I2C | 1424 | select REGMAP_I2C |
| 1425 | select I2C_DESIGNWARE_PLATFORM | 1425 | select I2C_DESIGNWARE_PLATFORM |
diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c index b8aaa684c397..2ed23c99f59f 100644 --- a/drivers/misc/ibmvmc.c +++ b/drivers/misc/ibmvmc.c | |||
| @@ -820,21 +820,24 @@ static int ibmvmc_send_msg(struct crq_server_adapter *adapter, | |||
| 820 | * | 820 | * |
| 821 | * Return: | 821 | * Return: |
| 822 | * 0 - Success | 822 | * 0 - Success |
| 823 | * Non-zero - Failure | ||
| 823 | */ | 824 | */ |
| 824 | static int ibmvmc_open(struct inode *inode, struct file *file) | 825 | static int ibmvmc_open(struct inode *inode, struct file *file) |
| 825 | { | 826 | { |
| 826 | struct ibmvmc_file_session *session; | 827 | struct ibmvmc_file_session *session; |
| 827 | int rc = 0; | ||
| 828 | 828 | ||
| 829 | pr_debug("%s: inode = 0x%lx, file = 0x%lx, state = 0x%x\n", __func__, | 829 | pr_debug("%s: inode = 0x%lx, file = 0x%lx, state = 0x%x\n", __func__, |
| 830 | (unsigned long)inode, (unsigned long)file, | 830 | (unsigned long)inode, (unsigned long)file, |
| 831 | ibmvmc.state); | 831 | ibmvmc.state); |
| 832 | 832 | ||
| 833 | session = kzalloc(sizeof(*session), GFP_KERNEL); | 833 | session = kzalloc(sizeof(*session), GFP_KERNEL); |
| 834 | if (!session) | ||
| 835 | return -ENOMEM; | ||
| 836 | |||
| 834 | session->file = file; | 837 | session->file = file; |
| 835 | file->private_data = session; | 838 | file->private_data = session; |
| 836 | 839 | ||
| 837 | return rc; | 840 | return 0; |
| 838 | } | 841 | } |
| 839 | 842 | ||
| 840 | /** | 843 | /** |
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 1fc8ea0f519b..ca4c9cc218a2 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
| @@ -401,8 +401,11 @@ static void mei_io_list_flush_cl(struct list_head *head, | |||
| 401 | struct mei_cl_cb *cb, *next; | 401 | struct mei_cl_cb *cb, *next; |
| 402 | 402 | ||
| 403 | list_for_each_entry_safe(cb, next, head, list) { | 403 | list_for_each_entry_safe(cb, next, head, list) { |
| 404 | if (cl == cb->cl) | 404 | if (cl == cb->cl) { |
| 405 | list_del_init(&cb->list); | 405 | list_del_init(&cb->list); |
| 406 | if (cb->fop_type == MEI_FOP_READ) | ||
| 407 | mei_io_cb_free(cb); | ||
| 408 | } | ||
| 406 | } | 409 | } |
| 407 | } | 410 | } |
| 408 | 411 | ||
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index 78c26cebf5d4..8f7616557c97 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c | |||
| @@ -1187,9 +1187,15 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) | |||
| 1187 | dma_setup_res = (struct hbm_dma_setup_response *)mei_msg; | 1187 | dma_setup_res = (struct hbm_dma_setup_response *)mei_msg; |
| 1188 | 1188 | ||
| 1189 | if (dma_setup_res->status) { | 1189 | if (dma_setup_res->status) { |
| 1190 | dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", | 1190 | u8 status = dma_setup_res->status; |
| 1191 | dma_setup_res->status, | 1191 | |
| 1192 | mei_hbm_status_str(dma_setup_res->status)); | 1192 | if (status == MEI_HBMS_NOT_ALLOWED) { |
| 1193 | dev_dbg(dev->dev, "hbm: dma setup not allowed\n"); | ||
| 1194 | } else { | ||
| 1195 | dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", | ||
| 1196 | status, | ||
| 1197 | mei_hbm_status_str(status)); | ||
| 1198 | } | ||
| 1193 | dev->hbm_f_dr_supported = 0; | 1199 | dev->hbm_f_dr_supported = 0; |
| 1194 | mei_dmam_ring_free(dev); | 1200 | mei_dmam_ring_free(dev); |
| 1195 | } | 1201 | } |
diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h index e4b10b2d1a08..bb1ee9834a02 100644 --- a/drivers/misc/mei/hw-me-regs.h +++ b/drivers/misc/mei/hw-me-regs.h | |||
| @@ -127,6 +127,8 @@ | |||
| 127 | #define MEI_DEV_ID_BXT_M 0x1A9A /* Broxton M */ | 127 | #define MEI_DEV_ID_BXT_M 0x1A9A /* Broxton M */ |
| 128 | #define MEI_DEV_ID_APL_I 0x5A9A /* Apollo Lake I */ | 128 | #define MEI_DEV_ID_APL_I 0x5A9A /* Apollo Lake I */ |
| 129 | 129 | ||
| 130 | #define MEI_DEV_ID_DNV_IE 0x19E5 /* Denverton IE */ | ||
| 131 | |||
| 130 | #define MEI_DEV_ID_GLK 0x319A /* Gemini Lake */ | 132 | #define MEI_DEV_ID_GLK 0x319A /* Gemini Lake */ |
| 131 | 133 | ||
| 132 | #define MEI_DEV_ID_KBP 0xA2BA /* Kaby Point */ | 134 | #define MEI_DEV_ID_KBP 0xA2BA /* Kaby Point */ |
| @@ -137,6 +139,8 @@ | |||
| 137 | #define MEI_DEV_ID_CNP_H 0xA360 /* Cannon Point H */ | 139 | #define MEI_DEV_ID_CNP_H 0xA360 /* Cannon Point H */ |
| 138 | #define MEI_DEV_ID_CNP_H_4 0xA364 /* Cannon Point H 4 (iTouch) */ | 140 | #define MEI_DEV_ID_CNP_H_4 0xA364 /* Cannon Point H 4 (iTouch) */ |
| 139 | 141 | ||
| 142 | #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ | ||
| 143 | |||
| 140 | /* | 144 | /* |
| 141 | * MEI HW Section | 145 | * MEI HW Section |
| 142 | */ | 146 | */ |
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index 73ace2d59dea..3ab946ad3257 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c | |||
| @@ -88,11 +88,13 @@ static const struct pci_device_id mei_me_pci_tbl[] = { | |||
| 88 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, MEI_ME_PCH8_CFG)}, | 88 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, MEI_ME_PCH8_CFG)}, |
| 89 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, MEI_ME_PCH8_SPS_CFG)}, | 89 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, MEI_ME_PCH8_SPS_CFG)}, |
| 90 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, MEI_ME_PCH8_SPS_CFG)}, | 90 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, MEI_ME_PCH8_SPS_CFG)}, |
| 91 | {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH8_CFG)}, | 91 | {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH12_CFG)}, |
| 92 | 92 | ||
| 93 | {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, MEI_ME_PCH8_CFG)}, | 93 | {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, MEI_ME_PCH8_CFG)}, |
| 94 | {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, MEI_ME_PCH8_CFG)}, | 94 | {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, MEI_ME_PCH8_CFG)}, |
| 95 | 95 | ||
| 96 | {MEI_PCI_DEVICE(MEI_DEV_ID_DNV_IE, MEI_ME_PCH8_CFG)}, | ||
| 97 | |||
| 96 | {MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)}, | 98 | {MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)}, |
| 97 | 99 | ||
| 98 | {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)}, | 100 | {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)}, |
| @@ -103,6 +105,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { | |||
| 103 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H, MEI_ME_PCH12_CFG)}, | 105 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H, MEI_ME_PCH12_CFG)}, |
| 104 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H_4, MEI_ME_PCH8_CFG)}, | 106 | {MEI_PCI_DEVICE(MEI_DEV_ID_CNP_H_4, MEI_ME_PCH8_CFG)}, |
| 105 | 107 | ||
| 108 | {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, | ||
| 109 | |||
| 106 | /* required last entry */ | 110 | /* required last entry */ |
| 107 | {0, } | 111 | {0, } |
| 108 | }; | 112 | }; |
diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c index 2bfa3a903bf9..744757f541be 100644 --- a/drivers/misc/mic/vop/vop_main.c +++ b/drivers/misc/mic/vop/vop_main.c | |||
| @@ -47,7 +47,8 @@ | |||
| 47 | * @dc: Virtio device control | 47 | * @dc: Virtio device control |
| 48 | * @vpdev: VOP device which is the parent for this virtio device | 48 | * @vpdev: VOP device which is the parent for this virtio device |
| 49 | * @vr: Buffer for accessing the VRING | 49 | * @vr: Buffer for accessing the VRING |
| 50 | * @used: Buffer for used | 50 | * @used_virt: Virtual address of used ring |
| 51 | * @used: DMA address of used ring | ||
| 51 | * @used_size: Size of the used buffer | 52 | * @used_size: Size of the used buffer |
| 52 | * @reset_done: Track whether VOP reset is complete | 53 | * @reset_done: Track whether VOP reset is complete |
| 53 | * @virtio_cookie: Cookie returned upon requesting a interrupt | 54 | * @virtio_cookie: Cookie returned upon requesting a interrupt |
| @@ -61,6 +62,7 @@ struct _vop_vdev { | |||
| 61 | struct mic_device_ctrl __iomem *dc; | 62 | struct mic_device_ctrl __iomem *dc; |
| 62 | struct vop_device *vpdev; | 63 | struct vop_device *vpdev; |
| 63 | void __iomem *vr[VOP_MAX_VRINGS]; | 64 | void __iomem *vr[VOP_MAX_VRINGS]; |
| 65 | void *used_virt[VOP_MAX_VRINGS]; | ||
| 64 | dma_addr_t used[VOP_MAX_VRINGS]; | 66 | dma_addr_t used[VOP_MAX_VRINGS]; |
| 65 | int used_size[VOP_MAX_VRINGS]; | 67 | int used_size[VOP_MAX_VRINGS]; |
| 66 | struct completion reset_done; | 68 | struct completion reset_done; |
| @@ -260,12 +262,12 @@ static bool vop_notify(struct virtqueue *vq) | |||
| 260 | static void vop_del_vq(struct virtqueue *vq, int n) | 262 | static void vop_del_vq(struct virtqueue *vq, int n) |
| 261 | { | 263 | { |
| 262 | struct _vop_vdev *vdev = to_vopvdev(vq->vdev); | 264 | struct _vop_vdev *vdev = to_vopvdev(vq->vdev); |
| 263 | struct vring *vr = (struct vring *)(vq + 1); | ||
| 264 | struct vop_device *vpdev = vdev->vpdev; | 265 | struct vop_device *vpdev = vdev->vpdev; |
| 265 | 266 | ||
| 266 | dma_unmap_single(&vpdev->dev, vdev->used[n], | 267 | dma_unmap_single(&vpdev->dev, vdev->used[n], |
| 267 | vdev->used_size[n], DMA_BIDIRECTIONAL); | 268 | vdev->used_size[n], DMA_BIDIRECTIONAL); |
| 268 | free_pages((unsigned long)vr->used, get_order(vdev->used_size[n])); | 269 | free_pages((unsigned long)vdev->used_virt[n], |
| 270 | get_order(vdev->used_size[n])); | ||
| 269 | vring_del_virtqueue(vq); | 271 | vring_del_virtqueue(vq); |
| 270 | vpdev->hw_ops->iounmap(vpdev, vdev->vr[n]); | 272 | vpdev->hw_ops->iounmap(vpdev, vdev->vr[n]); |
| 271 | vdev->vr[n] = NULL; | 273 | vdev->vr[n] = NULL; |
| @@ -283,6 +285,26 @@ static void vop_del_vqs(struct virtio_device *dev) | |||
| 283 | vop_del_vq(vq, idx++); | 285 | vop_del_vq(vq, idx++); |
| 284 | } | 286 | } |
| 285 | 287 | ||
| 288 | static struct virtqueue *vop_new_virtqueue(unsigned int index, | ||
| 289 | unsigned int num, | ||
| 290 | struct virtio_device *vdev, | ||
| 291 | bool context, | ||
| 292 | void *pages, | ||
| 293 | bool (*notify)(struct virtqueue *vq), | ||
| 294 | void (*callback)(struct virtqueue *vq), | ||
| 295 | const char *name, | ||
| 296 | void *used) | ||
| 297 | { | ||
| 298 | bool weak_barriers = false; | ||
| 299 | struct vring vring; | ||
| 300 | |||
| 301 | vring_init(&vring, num, pages, MIC_VIRTIO_RING_ALIGN); | ||
| 302 | vring.used = used; | ||
| 303 | |||
| 304 | return __vring_new_virtqueue(index, vring, vdev, weak_barriers, context, | ||
| 305 | notify, callback, name); | ||
| 306 | } | ||
| 307 | |||
| 286 | /* | 308 | /* |
| 287 | * This routine will assign vring's allocated in host/io memory. Code in | 309 | * This routine will assign vring's allocated in host/io memory. Code in |
| 288 | * virtio_ring.c however continues to access this io memory as if it were local | 310 | * virtio_ring.c however continues to access this io memory as if it were local |
| @@ -302,7 +324,6 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, | |||
| 302 | struct _mic_vring_info __iomem *info; | 324 | struct _mic_vring_info __iomem *info; |
| 303 | void *used; | 325 | void *used; |
| 304 | int vr_size, _vr_size, err, magic; | 326 | int vr_size, _vr_size, err, magic; |
| 305 | struct vring *vr; | ||
| 306 | u8 type = ioread8(&vdev->desc->type); | 327 | u8 type = ioread8(&vdev->desc->type); |
| 307 | 328 | ||
| 308 | if (index >= ioread8(&vdev->desc->num_vq)) | 329 | if (index >= ioread8(&vdev->desc->num_vq)) |
| @@ -322,17 +343,7 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, | |||
| 322 | return ERR_PTR(-ENOMEM); | 343 | return ERR_PTR(-ENOMEM); |
| 323 | vdev->vr[index] = va; | 344 | vdev->vr[index] = va; |
| 324 | memset_io(va, 0x0, _vr_size); | 345 | memset_io(va, 0x0, _vr_size); |
| 325 | vq = vring_new_virtqueue( | 346 | |
| 326 | index, | ||
| 327 | le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN, | ||
| 328 | dev, | ||
| 329 | false, | ||
| 330 | ctx, | ||
| 331 | (void __force *)va, vop_notify, callback, name); | ||
| 332 | if (!vq) { | ||
| 333 | err = -ENOMEM; | ||
| 334 | goto unmap; | ||
| 335 | } | ||
| 336 | info = va + _vr_size; | 347 | info = va + _vr_size; |
| 337 | magic = ioread32(&info->magic); | 348 | magic = ioread32(&info->magic); |
| 338 | 349 | ||
| @@ -341,18 +352,27 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, | |||
| 341 | goto unmap; | 352 | goto unmap; |
| 342 | } | 353 | } |
| 343 | 354 | ||
| 344 | /* Allocate and reassign used ring now */ | ||
| 345 | vdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + | 355 | vdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + |
| 346 | sizeof(struct vring_used_elem) * | 356 | sizeof(struct vring_used_elem) * |
| 347 | le16_to_cpu(config.num)); | 357 | le16_to_cpu(config.num)); |
| 348 | used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, | 358 | used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, |
| 349 | get_order(vdev->used_size[index])); | 359 | get_order(vdev->used_size[index])); |
| 360 | vdev->used_virt[index] = used; | ||
| 350 | if (!used) { | 361 | if (!used) { |
| 351 | err = -ENOMEM; | 362 | err = -ENOMEM; |
| 352 | dev_err(_vop_dev(vdev), "%s %d err %d\n", | 363 | dev_err(_vop_dev(vdev), "%s %d err %d\n", |
| 353 | __func__, __LINE__, err); | 364 | __func__, __LINE__, err); |
| 354 | goto del_vq; | 365 | goto unmap; |
| 366 | } | ||
| 367 | |||
| 368 | vq = vop_new_virtqueue(index, le16_to_cpu(config.num), dev, ctx, | ||
| 369 | (void __force *)va, vop_notify, callback, | ||
| 370 | name, used); | ||
| 371 | if (!vq) { | ||
| 372 | err = -ENOMEM; | ||
| 373 | goto free_used; | ||
| 355 | } | 374 | } |
| 375 | |||
| 356 | vdev->used[index] = dma_map_single(&vpdev->dev, used, | 376 | vdev->used[index] = dma_map_single(&vpdev->dev, used, |
| 357 | vdev->used_size[index], | 377 | vdev->used_size[index], |
| 358 | DMA_BIDIRECTIONAL); | 378 | DMA_BIDIRECTIONAL); |
| @@ -360,26 +380,17 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, | |||
| 360 | err = -ENOMEM; | 380 | err = -ENOMEM; |
| 361 | dev_err(_vop_dev(vdev), "%s %d err %d\n", | 381 | dev_err(_vop_dev(vdev), "%s %d err %d\n", |
| 362 | __func__, __LINE__, err); | 382 | __func__, __LINE__, err); |
| 363 | goto free_used; | 383 | goto del_vq; |
| 364 | } | 384 | } |
| 365 | writeq(vdev->used[index], &vqconfig->used_address); | 385 | writeq(vdev->used[index], &vqconfig->used_address); |
| 366 | /* | ||
| 367 | * To reassign the used ring here we are directly accessing | ||
| 368 | * struct vring_virtqueue which is a private data structure | ||
| 369 | * in virtio_ring.c. At the minimum, a BUILD_BUG_ON() in | ||
| 370 | * vring_new_virtqueue() would ensure that | ||
| 371 | * (&vq->vring == (struct vring *) (&vq->vq + 1)); | ||
| 372 | */ | ||
| 373 | vr = (struct vring *)(vq + 1); | ||
| 374 | vr->used = used; | ||
| 375 | 386 | ||
| 376 | vq->priv = vdev; | 387 | vq->priv = vdev; |
| 377 | return vq; | 388 | return vq; |
| 389 | del_vq: | ||
| 390 | vring_del_virtqueue(vq); | ||
| 378 | free_used: | 391 | free_used: |
| 379 | free_pages((unsigned long)used, | 392 | free_pages((unsigned long)used, |
| 380 | get_order(vdev->used_size[index])); | 393 | get_order(vdev->used_size[index])); |
| 381 | del_vq: | ||
| 382 | vring_del_virtqueue(vq); | ||
| 383 | unmap: | 394 | unmap: |
| 384 | vpdev->hw_ops->iounmap(vpdev, vdev->vr[index]); | 395 | vpdev->hw_ops->iounmap(vpdev, vdev->vr[index]); |
| 385 | return ERR_PTR(err); | 396 | return ERR_PTR(err); |
| @@ -581,6 +592,8 @@ static int _vop_remove_device(struct mic_device_desc __iomem *d, | |||
| 581 | int ret = -1; | 592 | int ret = -1; |
| 582 | 593 | ||
| 583 | if (ioread8(&dc->config_change) == MIC_VIRTIO_PARAM_DEV_REMOVE) { | 594 | if (ioread8(&dc->config_change) == MIC_VIRTIO_PARAM_DEV_REMOVE) { |
| 595 | struct device *dev = get_device(&vdev->vdev.dev); | ||
| 596 | |||
| 584 | dev_dbg(&vpdev->dev, | 597 | dev_dbg(&vpdev->dev, |
| 585 | "%s %d config_change %d type %d vdev %p\n", | 598 | "%s %d config_change %d type %d vdev %p\n", |
| 586 | __func__, __LINE__, | 599 | __func__, __LINE__, |
| @@ -592,7 +605,7 @@ static int _vop_remove_device(struct mic_device_desc __iomem *d, | |||
| 592 | iowrite8(-1, &dc->h2c_vdev_db); | 605 | iowrite8(-1, &dc->h2c_vdev_db); |
| 593 | if (status & VIRTIO_CONFIG_S_DRIVER_OK) | 606 | if (status & VIRTIO_CONFIG_S_DRIVER_OK) |
| 594 | wait_for_completion(&vdev->reset_done); | 607 | wait_for_completion(&vdev->reset_done); |
| 595 | put_device(&vdev->vdev.dev); | 608 | put_device(dev); |
| 596 | iowrite8(1, &dc->guest_ack); | 609 | iowrite8(1, &dc->guest_ack); |
| 597 | dev_dbg(&vpdev->dev, "%s %d guest_ack %d\n", | 610 | dev_dbg(&vpdev->dev, "%s %d guest_ack %d\n", |
| 598 | __func__, __LINE__, ioread8(&dc->guest_ack)); | 611 | __func__, __LINE__, ioread8(&dc->guest_ack)); |
diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c index 595ac065b401..95ff7c5a1dfb 100644 --- a/drivers/misc/pvpanic.c +++ b/drivers/misc/pvpanic.c | |||
| @@ -70,8 +70,12 @@ pvpanic_walk_resources(struct acpi_resource *res, void *context) | |||
| 70 | struct resource r; | 70 | struct resource r; |
| 71 | 71 | ||
| 72 | if (acpi_dev_resource_io(res, &r)) { | 72 | if (acpi_dev_resource_io(res, &r)) { |
| 73 | #ifdef CONFIG_HAS_IOPORT_MAP | ||
| 73 | base = ioport_map(r.start, resource_size(&r)); | 74 | base = ioport_map(r.start, resource_size(&r)); |
| 74 | return AE_OK; | 75 | return AE_OK; |
| 76 | #else | ||
| 77 | return AE_ERROR; | ||
| 78 | #endif | ||
| 75 | } else if (acpi_dev_resource_memory(res, &r)) { | 79 | } else if (acpi_dev_resource_memory(res, &r)) { |
| 76 | base = ioremap(r.start, resource_size(&r)); | 80 | base = ioremap(r.start, resource_size(&r)); |
| 77 | return AE_OK; | 81 | return AE_OK; |
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index e26b8145efb3..a44ec8bb5418 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
| @@ -116,7 +116,7 @@ config MMC_RICOH_MMC | |||
| 116 | 116 | ||
| 117 | config MMC_SDHCI_ACPI | 117 | config MMC_SDHCI_ACPI |
| 118 | tristate "SDHCI support for ACPI enumerated SDHCI controllers" | 118 | tristate "SDHCI support for ACPI enumerated SDHCI controllers" |
| 119 | depends on MMC_SDHCI && ACPI | 119 | depends on MMC_SDHCI && ACPI && PCI |
| 120 | select IOSF_MBI if X86 | 120 | select IOSF_MBI if X86 |
| 121 | help | 121 | help |
| 122 | This selects support for ACPI enumerated SDHCI controllers, | 122 | This selects support for ACPI enumerated SDHCI controllers, |
| @@ -978,7 +978,7 @@ config MMC_SDHCI_OMAP | |||
| 978 | tristate "TI SDHCI Controller Support" | 978 | tristate "TI SDHCI Controller Support" |
| 979 | depends on MMC_SDHCI_PLTFM && OF | 979 | depends on MMC_SDHCI_PLTFM && OF |
| 980 | select THERMAL | 980 | select THERMAL |
| 981 | select TI_SOC_THERMAL | 981 | imply TI_SOC_THERMAL |
| 982 | help | 982 | help |
| 983 | This selects the Secure Digital Host Controller Interface (SDHCI) | 983 | This selects the Secure Digital Host Controller Interface (SDHCI) |
| 984 | support present in TI's DRA7 SOCs. The controller supports | 984 | support present in TI's DRA7 SOCs. The controller supports |
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 50293529d6de..c9e7aa50bb0a 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c | |||
| @@ -1431,6 +1431,8 @@ static int bcm2835_probe(struct platform_device *pdev) | |||
| 1431 | 1431 | ||
| 1432 | err: | 1432 | err: |
| 1433 | dev_dbg(dev, "%s -> err %d\n", __func__, ret); | 1433 | dev_dbg(dev, "%s -> err %d\n", __func__, ret); |
| 1434 | if (host->dma_chan_rxtx) | ||
| 1435 | dma_release_channel(host->dma_chan_rxtx); | ||
| 1434 | mmc_free_host(mmc); | 1436 | mmc_free_host(mmc); |
| 1435 | 1437 | ||
| 1436 | return ret; | 1438 | return ret; |
diff --git a/drivers/mmc/host/dw_mmc-bluefield.c b/drivers/mmc/host/dw_mmc-bluefield.c index ed8f2254b66a..aa38b1a8017e 100644 --- a/drivers/mmc/host/dw_mmc-bluefield.c +++ b/drivers/mmc/host/dw_mmc-bluefield.c | |||
| @@ -1,11 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Copyright (C) 2018 Mellanox Technologies. | 3 | * Copyright (C) 2018 Mellanox Technologies. |
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | */ | 4 | */ |
| 10 | 5 | ||
| 11 | #include <linux/bitfield.h> | 6 | #include <linux/bitfield.h> |
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index c2690c1a50ff..f19ec60bcbdc 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c | |||
| @@ -179,6 +179,8 @@ struct meson_host { | |||
| 179 | struct sd_emmc_desc *descs; | 179 | struct sd_emmc_desc *descs; |
| 180 | dma_addr_t descs_dma_addr; | 180 | dma_addr_t descs_dma_addr; |
| 181 | 181 | ||
| 182 | int irq; | ||
| 183 | |||
| 182 | bool vqmmc_enabled; | 184 | bool vqmmc_enabled; |
| 183 | }; | 185 | }; |
| 184 | 186 | ||
| @@ -738,6 +740,11 @@ static int meson_mmc_clk_phase_tuning(struct mmc_host *mmc, u32 opcode, | |||
| 738 | static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) | 740 | static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) |
| 739 | { | 741 | { |
| 740 | struct meson_host *host = mmc_priv(mmc); | 742 | struct meson_host *host = mmc_priv(mmc); |
| 743 | int adj = 0; | ||
| 744 | |||
| 745 | /* enable signal resampling w/o delay */ | ||
| 746 | adj = ADJUST_ADJ_EN; | ||
| 747 | writel(adj, host->regs + host->data->adjust); | ||
| 741 | 748 | ||
| 742 | return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); | 749 | return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); |
| 743 | } | 750 | } |
| @@ -768,6 +775,9 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
| 768 | if (!IS_ERR(mmc->supply.vmmc)) | 775 | if (!IS_ERR(mmc->supply.vmmc)) |
| 769 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); | 776 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); |
| 770 | 777 | ||
| 778 | /* disable signal resampling */ | ||
| 779 | writel(0, host->regs + host->data->adjust); | ||
| 780 | |||
| 771 | /* Reset rx phase */ | 781 | /* Reset rx phase */ |
| 772 | clk_set_phase(host->rx_clk, 0); | 782 | clk_set_phase(host->rx_clk, 0); |
| 773 | 783 | ||
| @@ -1166,7 +1176,7 @@ static int meson_mmc_get_cd(struct mmc_host *mmc) | |||
| 1166 | 1176 | ||
| 1167 | static void meson_mmc_cfg_init(struct meson_host *host) | 1177 | static void meson_mmc_cfg_init(struct meson_host *host) |
| 1168 | { | 1178 | { |
| 1169 | u32 cfg = 0, adj = 0; | 1179 | u32 cfg = 0; |
| 1170 | 1180 | ||
| 1171 | cfg |= FIELD_PREP(CFG_RESP_TIMEOUT_MASK, | 1181 | cfg |= FIELD_PREP(CFG_RESP_TIMEOUT_MASK, |
| 1172 | ilog2(SD_EMMC_CFG_RESP_TIMEOUT)); | 1182 | ilog2(SD_EMMC_CFG_RESP_TIMEOUT)); |
| @@ -1177,10 +1187,6 @@ static void meson_mmc_cfg_init(struct meson_host *host) | |||
| 1177 | cfg |= CFG_ERR_ABORT; | 1187 | cfg |= CFG_ERR_ABORT; |
| 1178 | 1188 | ||
| 1179 | writel(cfg, host->regs + SD_EMMC_CFG); | 1189 | writel(cfg, host->regs + SD_EMMC_CFG); |
| 1180 | |||
| 1181 | /* enable signal resampling w/o delay */ | ||
| 1182 | adj = ADJUST_ADJ_EN; | ||
| 1183 | writel(adj, host->regs + host->data->adjust); | ||
| 1184 | } | 1190 | } |
| 1185 | 1191 | ||
| 1186 | static int meson_mmc_card_busy(struct mmc_host *mmc) | 1192 | static int meson_mmc_card_busy(struct mmc_host *mmc) |
| @@ -1231,7 +1237,7 @@ static int meson_mmc_probe(struct platform_device *pdev) | |||
| 1231 | struct resource *res; | 1237 | struct resource *res; |
| 1232 | struct meson_host *host; | 1238 | struct meson_host *host; |
| 1233 | struct mmc_host *mmc; | 1239 | struct mmc_host *mmc; |
| 1234 | int ret, irq; | 1240 | int ret; |
| 1235 | 1241 | ||
| 1236 | mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev); | 1242 | mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev); |
| 1237 | if (!mmc) | 1243 | if (!mmc) |
| @@ -1276,8 +1282,8 @@ static int meson_mmc_probe(struct platform_device *pdev) | |||
| 1276 | goto free_host; | 1282 | goto free_host; |
| 1277 | } | 1283 | } |
| 1278 | 1284 | ||
| 1279 | irq = platform_get_irq(pdev, 0); | 1285 | host->irq = platform_get_irq(pdev, 0); |
| 1280 | if (irq <= 0) { | 1286 | if (host->irq <= 0) { |
| 1281 | dev_err(&pdev->dev, "failed to get interrupt resource.\n"); | 1287 | dev_err(&pdev->dev, "failed to get interrupt resource.\n"); |
| 1282 | ret = -EINVAL; | 1288 | ret = -EINVAL; |
| 1283 | goto free_host; | 1289 | goto free_host; |
| @@ -1331,9 +1337,8 @@ static int meson_mmc_probe(struct platform_device *pdev) | |||
| 1331 | writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN, | 1337 | writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN, |
| 1332 | host->regs + SD_EMMC_IRQ_EN); | 1338 | host->regs + SD_EMMC_IRQ_EN); |
| 1333 | 1339 | ||
| 1334 | ret = devm_request_threaded_irq(&pdev->dev, irq, meson_mmc_irq, | 1340 | ret = request_threaded_irq(host->irq, meson_mmc_irq, |
| 1335 | meson_mmc_irq_thread, IRQF_SHARED, | 1341 | meson_mmc_irq_thread, IRQF_SHARED, NULL, host); |
| 1336 | NULL, host); | ||
| 1337 | if (ret) | 1342 | if (ret) |
| 1338 | goto err_init_clk; | 1343 | goto err_init_clk; |
| 1339 | 1344 | ||
| @@ -1351,7 +1356,7 @@ static int meson_mmc_probe(struct platform_device *pdev) | |||
| 1351 | if (host->bounce_buf == NULL) { | 1356 | if (host->bounce_buf == NULL) { |
| 1352 | dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n"); | 1357 | dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n"); |
| 1353 | ret = -ENOMEM; | 1358 | ret = -ENOMEM; |
| 1354 | goto err_init_clk; | 1359 | goto err_free_irq; |
| 1355 | } | 1360 | } |
| 1356 | 1361 | ||
| 1357 | host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, | 1362 | host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, |
| @@ -1370,6 +1375,8 @@ static int meson_mmc_probe(struct platform_device *pdev) | |||
| 1370 | err_bounce_buf: | 1375 | err_bounce_buf: |
| 1371 | dma_free_coherent(host->dev, host->bounce_buf_size, | 1376 | dma_free_coherent(host->dev, host->bounce_buf_size, |
| 1372 | host->bounce_buf, host->bounce_dma_addr); | 1377 | host->bounce_buf, host->bounce_dma_addr); |
| 1378 | err_free_irq: | ||
| 1379 | free_irq(host->irq, host); | ||
| 1373 | err_init_clk: | 1380 | err_init_clk: |
| 1374 | clk_disable_unprepare(host->mmc_clk); | 1381 | clk_disable_unprepare(host->mmc_clk); |
| 1375 | err_core_clk: | 1382 | err_core_clk: |
| @@ -1387,6 +1394,7 @@ static int meson_mmc_remove(struct platform_device *pdev) | |||
| 1387 | 1394 | ||
| 1388 | /* disable interrupts */ | 1395 | /* disable interrupts */ |
| 1389 | writel(0, host->regs + SD_EMMC_IRQ_EN); | 1396 | writel(0, host->regs + SD_EMMC_IRQ_EN); |
| 1397 | free_irq(host->irq, host); | ||
| 1390 | 1398 | ||
| 1391 | dma_free_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, | 1399 | dma_free_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, |
| 1392 | host->descs, host->descs_dma_addr); | 1400 | host->descs, host->descs_dma_addr); |
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 8afeaf81ae66..833ef0590af8 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c | |||
| @@ -846,7 +846,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) | |||
| 846 | 846 | ||
| 847 | if (timing == MMC_TIMING_MMC_HS400 && | 847 | if (timing == MMC_TIMING_MMC_HS400 && |
| 848 | host->dev_comp->hs400_tune) | 848 | host->dev_comp->hs400_tune) |
| 849 | sdr_set_field(host->base + PAD_CMD_TUNE, | 849 | sdr_set_field(host->base + tune_reg, |
| 850 | MSDC_PAD_TUNE_CMDRRDLY, | 850 | MSDC_PAD_TUNE_CMDRRDLY, |
| 851 | host->hs400_cmd_int_delay); | 851 | host->hs400_cmd_int_delay); |
| 852 | dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->mmc->actual_clock, | 852 | dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->mmc->actual_clock, |
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index 0db99057c44f..9d12c06c7fd6 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c | |||
| @@ -296,7 +296,10 @@ static int sdhci_iproc_probe(struct platform_device *pdev) | |||
| 296 | 296 | ||
| 297 | iproc_host->data = iproc_data; | 297 | iproc_host->data = iproc_data; |
| 298 | 298 | ||
| 299 | mmc_of_parse(host->mmc); | 299 | ret = mmc_of_parse(host->mmc); |
| 300 | if (ret) | ||
| 301 | goto err; | ||
| 302 | |||
| 300 | sdhci_get_property(pdev); | 303 | sdhci_get_property(pdev); |
| 301 | 304 | ||
| 302 | host->mmc->caps |= iproc_host->data->mmc_caps; | 305 | host->mmc->caps |= iproc_host->data->mmc_caps; |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 60104e1079c5..37f174ccbcec 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
| @@ -480,6 +480,10 @@ static struct mtd_part *allocate_partition(struct mtd_info *parent, | |||
| 480 | /* let's register it anyway to preserve ordering */ | 480 | /* let's register it anyway to preserve ordering */ |
| 481 | slave->offset = 0; | 481 | slave->offset = 0; |
| 482 | slave->mtd.size = 0; | 482 | slave->mtd.size = 0; |
| 483 | |||
| 484 | /* Initialize ->erasesize to make add_mtd_device() happy. */ | ||
| 485 | slave->mtd.erasesize = parent->erasesize; | ||
| 486 | |||
| 483 | printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", | 487 | printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", |
| 484 | part->name); | 488 | part->name); |
| 485 | goto out_register; | 489 | goto out_register; |
| @@ -632,7 +636,6 @@ err_remove_part: | |||
| 632 | mutex_unlock(&mtd_partitions_mutex); | 636 | mutex_unlock(&mtd_partitions_mutex); |
| 633 | 637 | ||
| 634 | free_partition(new); | 638 | free_partition(new); |
| 635 | pr_info("%s:%i\n", __func__, __LINE__); | ||
| 636 | 639 | ||
| 637 | return ret; | 640 | return ret; |
| 638 | } | 641 | } |
diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c index bd4cfac6b5aa..a4768df5083f 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c | |||
| @@ -155,9 +155,10 @@ int gpmi_init(struct gpmi_nand_data *this) | |||
| 155 | 155 | ||
| 156 | /* | 156 | /* |
| 157 | * Reset BCH here, too. We got failures otherwise :( | 157 | * Reset BCH here, too. We got failures otherwise :( |
| 158 | * See later BCH reset for explanation of MX23 handling | 158 | * See later BCH reset for explanation of MX23 and MX28 handling |
| 159 | */ | 159 | */ |
| 160 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | 160 | ret = gpmi_reset_block(r->bch_regs, |
| 161 | GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); | ||
| 161 | if (ret) | 162 | if (ret) |
| 162 | goto err_out; | 163 | goto err_out; |
| 163 | 164 | ||
| @@ -263,12 +264,10 @@ int bch_set_geometry(struct gpmi_nand_data *this) | |||
| 263 | /* | 264 | /* |
| 264 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this | 265 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this |
| 265 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. | 266 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. |
| 266 | * On the other hand, the MX28 needs the reset, because one case has been | 267 | * and MX28. |
| 267 | * seen where the BCH produced ECC errors constantly after 10000 | ||
| 268 | * consecutive reboots. The latter case has not been seen on the MX23 | ||
| 269 | * yet, still we don't know if it could happen there as well. | ||
| 270 | */ | 268 | */ |
| 271 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | 269 | ret = gpmi_reset_block(r->bch_regs, |
| 270 | GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); | ||
| 272 | if (ret) | 271 | if (ret) |
| 273 | goto err_out; | 272 | goto err_out; |
| 274 | 273 | ||
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index cca4b24d2ffa..839494ac457c 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c | |||
| @@ -410,6 +410,7 @@ static int nand_check_wp(struct nand_chip *chip) | |||
| 410 | 410 | ||
| 411 | /** | 411 | /** |
| 412 | * nand_fill_oob - [INTERN] Transfer client buffer to oob | 412 | * nand_fill_oob - [INTERN] Transfer client buffer to oob |
| 413 | * @chip: NAND chip object | ||
| 413 | * @oob: oob data buffer | 414 | * @oob: oob data buffer |
| 414 | * @len: oob data write length | 415 | * @len: oob data write length |
| 415 | * @ops: oob ops structure | 416 | * @ops: oob ops structure |
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c index 1b722fe9213c..19a2b563acdf 100644 --- a/drivers/mtd/nand/raw/nand_bbt.c +++ b/drivers/mtd/nand/raw/nand_bbt.c | |||
| @@ -158,7 +158,7 @@ static u32 add_marker_len(struct nand_bbt_descr *td) | |||
| 158 | 158 | ||
| 159 | /** | 159 | /** |
| 160 | * read_bbt - [GENERIC] Read the bad block table starting from page | 160 | * read_bbt - [GENERIC] Read the bad block table starting from page |
| 161 | * @chip: NAND chip object | 161 | * @this: NAND chip object |
| 162 | * @buf: temporary buffer | 162 | * @buf: temporary buffer |
| 163 | * @page: the starting page | 163 | * @page: the starting page |
| 164 | * @num: the number of bbt descriptors to read | 164 | * @num: the number of bbt descriptors to read |
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 479c2f2cf17f..fa87ae28cdfe 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c | |||
| @@ -304,24 +304,30 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
| 304 | struct nand_device *nand = spinand_to_nand(spinand); | 304 | struct nand_device *nand = spinand_to_nand(spinand); |
| 305 | struct mtd_info *mtd = nanddev_to_mtd(nand); | 305 | struct mtd_info *mtd = nanddev_to_mtd(nand); |
| 306 | struct nand_page_io_req adjreq = *req; | 306 | struct nand_page_io_req adjreq = *req; |
| 307 | unsigned int nbytes = 0; | 307 | void *buf = spinand->databuf; |
| 308 | void *buf = NULL; | 308 | unsigned int nbytes; |
| 309 | u16 column = 0; | 309 | u16 column = 0; |
| 310 | int ret; | 310 | int ret; |
| 311 | 311 | ||
| 312 | memset(spinand->databuf, 0xff, | 312 | /* |
| 313 | nanddev_page_size(nand) + | 313 | * Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset |
| 314 | nanddev_per_page_oobsize(nand)); | 314 | * the cache content to 0xFF (depends on vendor implementation), so we |
| 315 | * must fill the page cache entirely even if we only want to program | ||
| 316 | * the data portion of the page, otherwise we might corrupt the BBM or | ||
| 317 | * user data previously programmed in OOB area. | ||
| 318 | */ | ||
| 319 | nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand); | ||
| 320 | memset(spinand->databuf, 0xff, nbytes); | ||
| 321 | adjreq.dataoffs = 0; | ||
| 322 | adjreq.datalen = nanddev_page_size(nand); | ||
| 323 | adjreq.databuf.out = spinand->databuf; | ||
| 324 | adjreq.ooblen = nanddev_per_page_oobsize(nand); | ||
| 325 | adjreq.ooboffs = 0; | ||
| 326 | adjreq.oobbuf.out = spinand->oobbuf; | ||
| 315 | 327 | ||
| 316 | if (req->datalen) { | 328 | if (req->datalen) |
| 317 | memcpy(spinand->databuf + req->dataoffs, req->databuf.out, | 329 | memcpy(spinand->databuf + req->dataoffs, req->databuf.out, |
| 318 | req->datalen); | 330 | req->datalen); |
| 319 | adjreq.dataoffs = 0; | ||
| 320 | adjreq.datalen = nanddev_page_size(nand); | ||
| 321 | adjreq.databuf.out = spinand->databuf; | ||
| 322 | nbytes = adjreq.datalen; | ||
| 323 | buf = spinand->databuf; | ||
| 324 | } | ||
| 325 | 331 | ||
| 326 | if (req->ooblen) { | 332 | if (req->ooblen) { |
| 327 | if (req->mode == MTD_OPS_AUTO_OOB) | 333 | if (req->mode == MTD_OPS_AUTO_OOB) |
| @@ -332,14 +338,6 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
| 332 | else | 338 | else |
| 333 | memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, | 339 | memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, |
| 334 | req->ooblen); | 340 | req->ooblen); |
| 335 | |||
| 336 | adjreq.ooblen = nanddev_per_page_oobsize(nand); | ||
| 337 | adjreq.ooboffs = 0; | ||
| 338 | nbytes += nanddev_per_page_oobsize(nand); | ||
| 339 | if (!buf) { | ||
| 340 | buf = spinand->oobbuf; | ||
| 341 | column = nanddev_page_size(nand); | ||
| 342 | } | ||
| 343 | } | 341 | } |
| 344 | 342 | ||
| 345 | spinand_cache_op_adjust_colum(spinand, &adjreq, &column); | 343 | spinand_cache_op_adjust_colum(spinand, &adjreq, &column); |
| @@ -370,8 +368,8 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
| 370 | 368 | ||
| 371 | /* | 369 | /* |
| 372 | * We need to use the RANDOM LOAD CACHE operation if there's | 370 | * We need to use the RANDOM LOAD CACHE operation if there's |
| 373 | * more than one iteration, because the LOAD operation resets | 371 | * more than one iteration, because the LOAD operation might |
| 374 | * the cache to 0xff. | 372 | * reset the cache to 0xff. |
| 375 | */ | 373 | */ |
| 376 | if (nbytes) { | 374 | if (nbytes) { |
| 377 | column = op.addr.val; | 375 | column = op.addr.val; |
| @@ -1018,11 +1016,11 @@ static int spinand_init(struct spinand_device *spinand) | |||
| 1018 | for (i = 0; i < nand->memorg.ntargets; i++) { | 1016 | for (i = 0; i < nand->memorg.ntargets; i++) { |
| 1019 | ret = spinand_select_target(spinand, i); | 1017 | ret = spinand_select_target(spinand, i); |
| 1020 | if (ret) | 1018 | if (ret) |
| 1021 | goto err_free_bufs; | 1019 | goto err_manuf_cleanup; |
| 1022 | 1020 | ||
| 1023 | ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); | 1021 | ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); |
| 1024 | if (ret) | 1022 | if (ret) |
| 1025 | goto err_free_bufs; | 1023 | goto err_manuf_cleanup; |
| 1026 | } | 1024 | } |
| 1027 | 1025 | ||
| 1028 | ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); | 1026 | ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); |
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index a0f954f36c09..44e6c7b1b222 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c | |||
| @@ -257,10 +257,7 @@ static int handle_tx(struct ser_device *ser) | |||
| 257 | if (skb->len == 0) { | 257 | if (skb->len == 0) { |
| 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); | 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); |
| 259 | WARN_ON(tmp != skb); | 259 | WARN_ON(tmp != skb); |
| 260 | if (in_interrupt()) | 260 | dev_consume_skb_any(skb); |
| 261 | dev_kfree_skb_irq(skb); | ||
| 262 | else | ||
| 263 | kfree_skb(skb); | ||
| 264 | } | 261 | } |
| 265 | } | 262 | } |
| 266 | /* Send flow off if queue is empty */ | 263 | /* Send flow off if queue is empty */ |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 3b3f88ffab53..c05e4d50d43d 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
| @@ -480,8 +480,6 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb); | |||
| 480 | struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) | 480 | struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) |
| 481 | { | 481 | { |
| 482 | struct can_priv *priv = netdev_priv(dev); | 482 | struct can_priv *priv = netdev_priv(dev); |
| 483 | struct sk_buff *skb = priv->echo_skb[idx]; | ||
| 484 | struct canfd_frame *cf; | ||
| 485 | 483 | ||
| 486 | if (idx >= priv->echo_skb_max) { | 484 | if (idx >= priv->echo_skb_max) { |
| 487 | netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", | 485 | netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", |
| @@ -489,20 +487,21 @@ struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 | |||
| 489 | return NULL; | 487 | return NULL; |
| 490 | } | 488 | } |
| 491 | 489 | ||
| 492 | if (!skb) { | 490 | if (priv->echo_skb[idx]) { |
| 493 | netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n", | 491 | /* Using "struct canfd_frame::len" for the frame |
| 494 | __func__, idx); | 492 | * length is supported on both CAN and CANFD frames. |
| 495 | return NULL; | 493 | */ |
| 496 | } | 494 | struct sk_buff *skb = priv->echo_skb[idx]; |
| 495 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; | ||
| 496 | u8 len = cf->len; | ||
| 497 | 497 | ||
| 498 | /* Using "struct canfd_frame::len" for the frame | 498 | *len_ptr = len; |
| 499 | * length is supported on both CAN and CANFD frames. | 499 | priv->echo_skb[idx] = NULL; |
| 500 | */ | ||
| 501 | cf = (struct canfd_frame *)skb->data; | ||
| 502 | *len_ptr = cf->len; | ||
| 503 | priv->echo_skb[idx] = NULL; | ||
| 504 | 500 | ||
| 505 | return skb; | 501 | return skb; |
| 502 | } | ||
| 503 | |||
| 504 | return NULL; | ||
| 506 | } | 505 | } |
| 507 | 506 | ||
| 508 | /* | 507 | /* |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 0f36eafe3ac1..1c66fb2ad76b 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
| @@ -1106,7 +1106,7 @@ static int flexcan_chip_start(struct net_device *dev) | |||
| 1106 | } | 1106 | } |
| 1107 | } else { | 1107 | } else { |
| 1108 | /* clear and invalidate unused mailboxes first */ | 1108 | /* clear and invalidate unused mailboxes first */ |
| 1109 | for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i <= priv->mb_count; i++) { | 1109 | for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i < priv->mb_count; i++) { |
| 1110 | mb = flexcan_get_mb(priv, i); | 1110 | mb = flexcan_get_mb(priv, i); |
| 1111 | priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, | 1111 | priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, |
| 1112 | &mb->can_ctrl); | 1112 | &mb->can_ctrl); |
| @@ -1432,7 +1432,7 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) | |||
| 1432 | gpr_np = of_find_node_by_phandle(phandle); | 1432 | gpr_np = of_find_node_by_phandle(phandle); |
| 1433 | if (!gpr_np) { | 1433 | if (!gpr_np) { |
| 1434 | dev_dbg(&pdev->dev, "could not find gpr node by phandle\n"); | 1434 | dev_dbg(&pdev->dev, "could not find gpr node by phandle\n"); |
| 1435 | return PTR_ERR(gpr_np); | 1435 | return -ENODEV; |
| 1436 | } | 1436 | } |
| 1437 | 1437 | ||
| 1438 | priv = netdev_priv(dev); | 1438 | priv = netdev_priv(dev); |
diff --git a/drivers/net/dsa/b53/b53_srab.c b/drivers/net/dsa/b53/b53_srab.c index 90f514252987..d9c56a779c08 100644 --- a/drivers/net/dsa/b53/b53_srab.c +++ b/drivers/net/dsa/b53/b53_srab.c | |||
| @@ -511,9 +511,6 @@ static void b53_srab_prepare_irq(struct platform_device *pdev) | |||
| 511 | /* Clear all pending interrupts */ | 511 | /* Clear all pending interrupts */ |
| 512 | writel(0xffffffff, priv->regs + B53_SRAB_INTR); | 512 | writel(0xffffffff, priv->regs + B53_SRAB_INTR); |
| 513 | 513 | ||
| 514 | if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID) | ||
| 515 | return; | ||
| 516 | |||
| 517 | for (i = 0; i < B53_N_PORTS; i++) { | 514 | for (i = 0; i < B53_N_PORTS; i++) { |
| 518 | port = &priv->port_intrs[i]; | 515 | port = &priv->port_intrs[i]; |
| 519 | 516 | ||
diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c index 5200e4bdce93..ea243840ee0f 100644 --- a/drivers/net/dsa/mv88e6xxx/global1_atu.c +++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c | |||
| @@ -314,6 +314,7 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) | |||
| 314 | { | 314 | { |
| 315 | struct mv88e6xxx_chip *chip = dev_id; | 315 | struct mv88e6xxx_chip *chip = dev_id; |
| 316 | struct mv88e6xxx_atu_entry entry; | 316 | struct mv88e6xxx_atu_entry entry; |
| 317 | int spid; | ||
| 317 | int err; | 318 | int err; |
| 318 | u16 val; | 319 | u16 val; |
| 319 | 320 | ||
| @@ -336,6 +337,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) | |||
| 336 | if (err) | 337 | if (err) |
| 337 | goto out; | 338 | goto out; |
| 338 | 339 | ||
| 340 | spid = entry.state; | ||
| 341 | |||
| 339 | if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) { | 342 | if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) { |
| 340 | dev_err_ratelimited(chip->dev, | 343 | dev_err_ratelimited(chip->dev, |
| 341 | "ATU age out violation for %pM\n", | 344 | "ATU age out violation for %pM\n", |
| @@ -344,23 +347,23 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id) | |||
| 344 | 347 | ||
| 345 | if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) { | 348 | if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) { |
| 346 | dev_err_ratelimited(chip->dev, | 349 | dev_err_ratelimited(chip->dev, |
| 347 | "ATU member violation for %pM portvec %x\n", | 350 | "ATU member violation for %pM portvec %x spid %d\n", |
| 348 | entry.mac, entry.portvec); | 351 | entry.mac, entry.portvec, spid); |
| 349 | chip->ports[entry.portvec].atu_member_violation++; | 352 | chip->ports[spid].atu_member_violation++; |
| 350 | } | 353 | } |
| 351 | 354 | ||
| 352 | if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) { | 355 | if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) { |
| 353 | dev_err_ratelimited(chip->dev, | 356 | dev_err_ratelimited(chip->dev, |
| 354 | "ATU miss violation for %pM portvec %x\n", | 357 | "ATU miss violation for %pM portvec %x spid %d\n", |
| 355 | entry.mac, entry.portvec); | 358 | entry.mac, entry.portvec, spid); |
| 356 | chip->ports[entry.portvec].atu_miss_violation++; | 359 | chip->ports[spid].atu_miss_violation++; |
| 357 | } | 360 | } |
| 358 | 361 | ||
| 359 | if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) { | 362 | if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) { |
| 360 | dev_err_ratelimited(chip->dev, | 363 | dev_err_ratelimited(chip->dev, |
| 361 | "ATU full violation for %pM portvec %x\n", | 364 | "ATU full violation for %pM portvec %x spid %d\n", |
| 362 | entry.mac, entry.portvec); | 365 | entry.mac, entry.portvec, spid); |
| 363 | chip->ports[entry.portvec].atu_full_violation++; | 366 | chip->ports[spid].atu_full_violation++; |
| 364 | } | 367 | } |
| 365 | mutex_unlock(&chip->reg_lock); | 368 | mutex_unlock(&chip->reg_lock); |
| 366 | 369 | ||
diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c index 2caa8c8b4b55..1bfc5ff8d81d 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.c +++ b/drivers/net/dsa/mv88e6xxx/serdes.c | |||
| @@ -664,7 +664,7 @@ int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port) | |||
| 664 | if (port < 9) | 664 | if (port < 9) |
| 665 | return 0; | 665 | return 0; |
| 666 | 666 | ||
| 667 | return mv88e6390_serdes_irq_setup(chip, port); | 667 | return mv88e6390x_serdes_irq_setup(chip, port); |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) | 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) |
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c index 4f11f98347ed..1827ef1f6d55 100644 --- a/drivers/net/ethernet/alteon/acenic.c +++ b/drivers/net/ethernet/alteon/acenic.c | |||
| @@ -2059,7 +2059,7 @@ static inline void ace_tx_int(struct net_device *dev, | |||
| 2059 | if (skb) { | 2059 | if (skb) { |
| 2060 | dev->stats.tx_packets++; | 2060 | dev->stats.tx_packets++; |
| 2061 | dev->stats.tx_bytes += skb->len; | 2061 | dev->stats.tx_bytes += skb->len; |
| 2062 | dev_kfree_skb_irq(skb); | 2062 | dev_consume_skb_irq(skb); |
| 2063 | info->skb = NULL; | 2063 | info->skb = NULL; |
| 2064 | } | 2064 | } |
| 2065 | 2065 | ||
diff --git a/drivers/net/ethernet/altera/altera_msgdma.c b/drivers/net/ethernet/altera/altera_msgdma.c index 0fb986ba3290..0ae723f75341 100644 --- a/drivers/net/ethernet/altera/altera_msgdma.c +++ b/drivers/net/ethernet/altera/altera_msgdma.c | |||
| @@ -145,7 +145,8 @@ u32 msgdma_tx_completions(struct altera_tse_private *priv) | |||
| 145 | & 0xffff; | 145 | & 0xffff; |
| 146 | 146 | ||
| 147 | if (inuse) { /* Tx FIFO is not empty */ | 147 | if (inuse) { /* Tx FIFO is not empty */ |
| 148 | ready = priv->tx_prod - priv->tx_cons - inuse - 1; | 148 | ready = max_t(int, |
| 149 | priv->tx_prod - priv->tx_cons - inuse - 1, 0); | ||
| 149 | } else { | 150 | } else { |
| 150 | /* Check for buffered last packet */ | 151 | /* Check for buffered last packet */ |
| 151 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); | 152 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); |
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index 02921d877c08..aa1d1f5339d2 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c | |||
| @@ -714,8 +714,10 @@ static struct phy_device *connect_local_phy(struct net_device *dev) | |||
| 714 | 714 | ||
| 715 | phydev = phy_connect(dev, phy_id_fmt, &altera_tse_adjust_link, | 715 | phydev = phy_connect(dev, phy_id_fmt, &altera_tse_adjust_link, |
| 716 | priv->phy_iface); | 716 | priv->phy_iface); |
| 717 | if (IS_ERR(phydev)) | 717 | if (IS_ERR(phydev)) { |
| 718 | netdev_err(dev, "Could not attach to PHY\n"); | 718 | netdev_err(dev, "Could not attach to PHY\n"); |
| 719 | phydev = NULL; | ||
| 720 | } | ||
| 719 | 721 | ||
| 720 | } else { | 722 | } else { |
| 721 | int ret; | 723 | int ret; |
diff --git a/drivers/net/ethernet/amd/amd8111e.c b/drivers/net/ethernet/amd/amd8111e.c index a90080f12e67..e548c0ae2e00 100644 --- a/drivers/net/ethernet/amd/amd8111e.c +++ b/drivers/net/ethernet/amd/amd8111e.c | |||
| @@ -666,7 +666,7 @@ static int amd8111e_tx(struct net_device *dev) | |||
| 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], | 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], |
| 667 | lp->tx_skbuff[tx_index]->len, | 667 | lp->tx_skbuff[tx_index]->len, |
| 668 | PCI_DMA_TODEVICE); | 668 | PCI_DMA_TODEVICE); |
| 669 | dev_kfree_skb_irq (lp->tx_skbuff[tx_index]); | 669 | dev_consume_skb_irq(lp->tx_skbuff[tx_index]); |
| 670 | lp->tx_skbuff[tx_index] = NULL; | 670 | lp->tx_skbuff[tx_index] = NULL; |
| 671 | lp->tx_dma_addr[tx_index] = 0; | 671 | lp->tx_dma_addr[tx_index] = 0; |
| 672 | } | 672 | } |
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c index 6a8e2567f2bd..4d3855ceb500 100644 --- a/drivers/net/ethernet/apple/bmac.c +++ b/drivers/net/ethernet/apple/bmac.c | |||
| @@ -777,7 +777,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id) | |||
| 777 | 777 | ||
| 778 | if (bp->tx_bufs[bp->tx_empty]) { | 778 | if (bp->tx_bufs[bp->tx_empty]) { |
| 779 | ++dev->stats.tx_packets; | 779 | ++dev->stats.tx_packets; |
| 780 | dev_kfree_skb_irq(bp->tx_bufs[bp->tx_empty]); | 780 | dev_consume_skb_irq(bp->tx_bufs[bp->tx_empty]); |
| 781 | } | 781 | } |
| 782 | bp->tx_bufs[bp->tx_empty] = NULL; | 782 | bp->tx_bufs[bp->tx_empty] = NULL; |
| 783 | bp->tx_fullup = 0; | 783 | bp->tx_fullup = 0; |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index f44808959ff3..97ab0dd25552 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
| @@ -638,7 +638,7 @@ static void b44_tx(struct b44 *bp) | |||
| 638 | bytes_compl += skb->len; | 638 | bytes_compl += skb->len; |
| 639 | pkts_compl++; | 639 | pkts_compl++; |
| 640 | 640 | ||
| 641 | dev_kfree_skb_irq(skb); | 641 | dev_consume_skb_irq(skb); |
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | netdev_completed_queue(bp->dev, pkts_compl, bytes_compl); | 644 | netdev_completed_queue(bp->dev, pkts_compl, bytes_compl); |
| @@ -1012,7 +1012,7 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1012 | } | 1012 | } |
| 1013 | 1013 | ||
| 1014 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), len); | 1014 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), len); |
| 1015 | dev_kfree_skb_any(skb); | 1015 | dev_consume_skb_any(skb); |
| 1016 | skb = bounce_skb; | 1016 | skb = bounce_skb; |
| 1017 | } | 1017 | } |
| 1018 | 1018 | ||
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index f9521d0274b7..28c9b0bdf2f6 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
| @@ -520,7 +520,6 @@ static void bcm_sysport_get_wol(struct net_device *dev, | |||
| 520 | struct ethtool_wolinfo *wol) | 520 | struct ethtool_wolinfo *wol) |
| 521 | { | 521 | { |
| 522 | struct bcm_sysport_priv *priv = netdev_priv(dev); | 522 | struct bcm_sysport_priv *priv = netdev_priv(dev); |
| 523 | u32 reg; | ||
| 524 | 523 | ||
| 525 | wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER; | 524 | wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER; |
| 526 | wol->wolopts = priv->wolopts; | 525 | wol->wolopts = priv->wolopts; |
| @@ -528,11 +527,7 @@ static void bcm_sysport_get_wol(struct net_device *dev, | |||
| 528 | if (!(priv->wolopts & WAKE_MAGICSECURE)) | 527 | if (!(priv->wolopts & WAKE_MAGICSECURE)) |
| 529 | return; | 528 | return; |
| 530 | 529 | ||
| 531 | /* Return the programmed SecureOn password */ | 530 | memcpy(wol->sopass, priv->sopass, sizeof(priv->sopass)); |
| 532 | reg = umac_readl(priv, UMAC_PSW_MS); | ||
| 533 | put_unaligned_be16(reg, &wol->sopass[0]); | ||
| 534 | reg = umac_readl(priv, UMAC_PSW_LS); | ||
| 535 | put_unaligned_be32(reg, &wol->sopass[2]); | ||
| 536 | } | 531 | } |
| 537 | 532 | ||
| 538 | static int bcm_sysport_set_wol(struct net_device *dev, | 533 | static int bcm_sysport_set_wol(struct net_device *dev, |
| @@ -548,13 +543,8 @@ static int bcm_sysport_set_wol(struct net_device *dev, | |||
| 548 | if (wol->wolopts & ~supported) | 543 | if (wol->wolopts & ~supported) |
| 549 | return -EINVAL; | 544 | return -EINVAL; |
| 550 | 545 | ||
| 551 | /* Program the SecureOn password */ | 546 | if (wol->wolopts & WAKE_MAGICSECURE) |
| 552 | if (wol->wolopts & WAKE_MAGICSECURE) { | 547 | memcpy(priv->sopass, wol->sopass, sizeof(priv->sopass)); |
| 553 | umac_writel(priv, get_unaligned_be16(&wol->sopass[0]), | ||
| 554 | UMAC_PSW_MS); | ||
| 555 | umac_writel(priv, get_unaligned_be32(&wol->sopass[2]), | ||
| 556 | UMAC_PSW_LS); | ||
| 557 | } | ||
| 558 | 548 | ||
| 559 | /* Flag the device and relevant IRQ as wakeup capable */ | 549 | /* Flag the device and relevant IRQ as wakeup capable */ |
| 560 | if (wol->wolopts) { | 550 | if (wol->wolopts) { |
| @@ -2649,13 +2639,18 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) | |||
| 2649 | unsigned int index, i = 0; | 2639 | unsigned int index, i = 0; |
| 2650 | u32 reg; | 2640 | u32 reg; |
| 2651 | 2641 | ||
| 2652 | /* Password has already been programmed */ | ||
| 2653 | reg = umac_readl(priv, UMAC_MPD_CTRL); | 2642 | reg = umac_readl(priv, UMAC_MPD_CTRL); |
| 2654 | if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) | 2643 | if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) |
| 2655 | reg |= MPD_EN; | 2644 | reg |= MPD_EN; |
| 2656 | reg &= ~PSW_EN; | 2645 | reg &= ~PSW_EN; |
| 2657 | if (priv->wolopts & WAKE_MAGICSECURE) | 2646 | if (priv->wolopts & WAKE_MAGICSECURE) { |
| 2647 | /* Program the SecureOn password */ | ||
| 2648 | umac_writel(priv, get_unaligned_be16(&priv->sopass[0]), | ||
| 2649 | UMAC_PSW_MS); | ||
| 2650 | umac_writel(priv, get_unaligned_be32(&priv->sopass[2]), | ||
| 2651 | UMAC_PSW_LS); | ||
| 2658 | reg |= PSW_EN; | 2652 | reg |= PSW_EN; |
| 2653 | } | ||
| 2659 | umac_writel(priv, reg, UMAC_MPD_CTRL); | 2654 | umac_writel(priv, reg, UMAC_MPD_CTRL); |
| 2660 | 2655 | ||
| 2661 | if (priv->wolopts & WAKE_FILTER) { | 2656 | if (priv->wolopts & WAKE_FILTER) { |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h index 0887e6356649..0b192fea9c5d 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.h +++ b/drivers/net/ethernet/broadcom/bcmsysport.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define __BCM_SYSPORT_H | 12 | #define __BCM_SYSPORT_H |
| 13 | 13 | ||
| 14 | #include <linux/bitmap.h> | 14 | #include <linux/bitmap.h> |
| 15 | #include <linux/ethtool.h> | ||
| 15 | #include <linux/if_vlan.h> | 16 | #include <linux/if_vlan.h> |
| 16 | #include <linux/net_dim.h> | 17 | #include <linux/net_dim.h> |
| 17 | 18 | ||
| @@ -778,6 +779,7 @@ struct bcm_sysport_priv { | |||
| 778 | unsigned int crc_fwd:1; | 779 | unsigned int crc_fwd:1; |
| 779 | u16 rev; | 780 | u16 rev; |
| 780 | u32 wolopts; | 781 | u32 wolopts; |
| 782 | u8 sopass[SOPASS_MAX]; | ||
| 781 | unsigned int wol_irq_disabled:1; | 783 | unsigned int wol_irq_disabled:1; |
| 782 | 784 | ||
| 783 | /* MIB related fields */ | 785 | /* MIB related fields */ |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 6a512871176b..8bc7e495b027 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
| @@ -4973,12 +4973,18 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp) | |||
| 4973 | struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; | 4973 | struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; |
| 4974 | struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; | 4974 | struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; |
| 4975 | u32 map_idx = ring->map_idx; | 4975 | u32 map_idx = ring->map_idx; |
| 4976 | unsigned int vector; | ||
| 4976 | 4977 | ||
| 4978 | vector = bp->irq_tbl[map_idx].vector; | ||
| 4979 | disable_irq_nosync(vector); | ||
| 4977 | rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); | 4980 | rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx); |
| 4978 | if (rc) | 4981 | if (rc) { |
| 4982 | enable_irq(vector); | ||
| 4979 | goto err_out; | 4983 | goto err_out; |
| 4984 | } | ||
| 4980 | bnxt_set_db(bp, &cpr->cp_db, type, map_idx, ring->fw_ring_id); | 4985 | bnxt_set_db(bp, &cpr->cp_db, type, map_idx, ring->fw_ring_id); |
| 4981 | bnxt_db_nq(bp, &cpr->cp_db, cpr->cp_raw_cons); | 4986 | bnxt_db_nq(bp, &cpr->cp_db, cpr->cp_raw_cons); |
| 4987 | enable_irq(vector); | ||
| 4982 | bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id; | 4988 | bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id; |
| 4983 | 4989 | ||
| 4984 | if (!i) { | 4990 | if (!i) { |
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c index 5db9f4158e62..134ae2862efa 100644 --- a/drivers/net/ethernet/broadcom/sb1250-mac.c +++ b/drivers/net/ethernet/broadcom/sb1250-mac.c | |||
| @@ -1288,7 +1288,7 @@ static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d, | |||
| 1288 | * for transmits, we just free buffers. | 1288 | * for transmits, we just free buffers. |
| 1289 | */ | 1289 | */ |
| 1290 | 1290 | ||
| 1291 | dev_kfree_skb_irq(sb); | 1291 | dev_consume_skb_irq(sb); |
| 1292 | 1292 | ||
| 1293 | /* | 1293 | /* |
| 1294 | * .. and advance to the next buffer. | 1294 | * .. and advance to the next buffer. |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 3d45f4c92cf6..9bbaad9f3d63 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
| @@ -643,6 +643,7 @@ | |||
| 643 | #define MACB_CAPS_JUMBO 0x00000020 | 643 | #define MACB_CAPS_JUMBO 0x00000020 |
| 644 | #define MACB_CAPS_GEM_HAS_PTP 0x00000040 | 644 | #define MACB_CAPS_GEM_HAS_PTP 0x00000040 |
| 645 | #define MACB_CAPS_BD_RD_PREFETCH 0x00000080 | 645 | #define MACB_CAPS_BD_RD_PREFETCH 0x00000080 |
| 646 | #define MACB_CAPS_NEEDS_RSTONUBR 0x00000100 | ||
| 646 | #define MACB_CAPS_FIFO_MODE 0x10000000 | 647 | #define MACB_CAPS_FIFO_MODE 0x10000000 |
| 647 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 | 648 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 |
| 648 | #define MACB_CAPS_SG_DISABLED 0x40000000 | 649 | #define MACB_CAPS_SG_DISABLED 0x40000000 |
| @@ -1214,6 +1215,8 @@ struct macb { | |||
| 1214 | 1215 | ||
| 1215 | int rx_bd_rd_prefetch; | 1216 | int rx_bd_rd_prefetch; |
| 1216 | int tx_bd_rd_prefetch; | 1217 | int tx_bd_rd_prefetch; |
| 1218 | |||
| 1219 | u32 rx_intr_mask; | ||
| 1217 | }; | 1220 | }; |
| 1218 | 1221 | ||
| 1219 | #ifdef CONFIG_MACB_USE_HWSTAMP | 1222 | #ifdef CONFIG_MACB_USE_HWSTAMP |
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 66cc7927061a..2b2882615e8b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c | |||
| @@ -56,8 +56,7 @@ | |||
| 56 | /* level of occupied TX descriptors under which we wake up TX process */ | 56 | /* level of occupied TX descriptors under which we wake up TX process */ |
| 57 | #define MACB_TX_WAKEUP_THRESH(bp) (3 * (bp)->tx_ring_size / 4) | 57 | #define MACB_TX_WAKEUP_THRESH(bp) (3 * (bp)->tx_ring_size / 4) |
| 58 | 58 | ||
| 59 | #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | 59 | #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(ISR_ROVR)) |
| 60 | | MACB_BIT(ISR_ROVR)) | ||
| 61 | #define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ | 60 | #define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ |
| 62 | | MACB_BIT(ISR_RLE) \ | 61 | | MACB_BIT(ISR_RLE) \ |
| 63 | | MACB_BIT(TXERR)) | 62 | | MACB_BIT(TXERR)) |
| @@ -1270,7 +1269,7 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
| 1270 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); | 1269 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); |
| 1271 | napi_reschedule(napi); | 1270 | napi_reschedule(napi); |
| 1272 | } else { | 1271 | } else { |
| 1273 | queue_writel(queue, IER, MACB_RX_INT_FLAGS); | 1272 | queue_writel(queue, IER, bp->rx_intr_mask); |
| 1274 | } | 1273 | } |
| 1275 | } | 1274 | } |
| 1276 | 1275 | ||
| @@ -1288,7 +1287,7 @@ static void macb_hresp_error_task(unsigned long data) | |||
| 1288 | u32 ctrl; | 1287 | u32 ctrl; |
| 1289 | 1288 | ||
| 1290 | for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { | 1289 | for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { |
| 1291 | queue_writel(queue, IDR, MACB_RX_INT_FLAGS | | 1290 | queue_writel(queue, IDR, bp->rx_intr_mask | |
| 1292 | MACB_TX_INT_FLAGS | | 1291 | MACB_TX_INT_FLAGS | |
| 1293 | MACB_BIT(HRESP)); | 1292 | MACB_BIT(HRESP)); |
| 1294 | } | 1293 | } |
| @@ -1318,7 +1317,7 @@ static void macb_hresp_error_task(unsigned long data) | |||
| 1318 | 1317 | ||
| 1319 | /* Enable interrupts */ | 1318 | /* Enable interrupts */ |
| 1320 | queue_writel(queue, IER, | 1319 | queue_writel(queue, IER, |
| 1321 | MACB_RX_INT_FLAGS | | 1320 | bp->rx_intr_mask | |
| 1322 | MACB_TX_INT_FLAGS | | 1321 | MACB_TX_INT_FLAGS | |
| 1323 | MACB_BIT(HRESP)); | 1322 | MACB_BIT(HRESP)); |
| 1324 | } | 1323 | } |
| @@ -1372,14 +1371,14 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
| 1372 | (unsigned int)(queue - bp->queues), | 1371 | (unsigned int)(queue - bp->queues), |
| 1373 | (unsigned long)status); | 1372 | (unsigned long)status); |
| 1374 | 1373 | ||
| 1375 | if (status & MACB_RX_INT_FLAGS) { | 1374 | if (status & bp->rx_intr_mask) { |
| 1376 | /* There's no point taking any more interrupts | 1375 | /* There's no point taking any more interrupts |
| 1377 | * until we have processed the buffers. The | 1376 | * until we have processed the buffers. The |
| 1378 | * scheduling call may fail if the poll routine | 1377 | * scheduling call may fail if the poll routine |
| 1379 | * is already scheduled, so disable interrupts | 1378 | * is already scheduled, so disable interrupts |
| 1380 | * now. | 1379 | * now. |
| 1381 | */ | 1380 | */ |
| 1382 | queue_writel(queue, IDR, MACB_RX_INT_FLAGS); | 1381 | queue_writel(queue, IDR, bp->rx_intr_mask); |
| 1383 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) | 1382 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
| 1384 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); | 1383 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); |
| 1385 | 1384 | ||
| @@ -1412,8 +1411,9 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
| 1412 | /* There is a hardware issue under heavy load where DMA can | 1411 | /* There is a hardware issue under heavy load where DMA can |
| 1413 | * stop, this causes endless "used buffer descriptor read" | 1412 | * stop, this causes endless "used buffer descriptor read" |
| 1414 | * interrupts but it can be cleared by re-enabling RX. See | 1413 | * interrupts but it can be cleared by re-enabling RX. See |
| 1415 | * the at91 manual, section 41.3.1 or the Zynq manual | 1414 | * the at91rm9200 manual, section 41.3.1 or the Zynq manual |
| 1416 | * section 16.7.4 for details. | 1415 | * section 16.7.4 for details. RXUBR is only enabled for |
| 1416 | * these two versions. | ||
| 1417 | */ | 1417 | */ |
| 1418 | if (status & MACB_BIT(RXUBR)) { | 1418 | if (status & MACB_BIT(RXUBR)) { |
| 1419 | ctrl = macb_readl(bp, NCR); | 1419 | ctrl = macb_readl(bp, NCR); |
| @@ -2259,7 +2259,7 @@ static void macb_init_hw(struct macb *bp) | |||
| 2259 | 2259 | ||
| 2260 | /* Enable interrupts */ | 2260 | /* Enable interrupts */ |
| 2261 | queue_writel(queue, IER, | 2261 | queue_writel(queue, IER, |
| 2262 | MACB_RX_INT_FLAGS | | 2262 | bp->rx_intr_mask | |
| 2263 | MACB_TX_INT_FLAGS | | 2263 | MACB_TX_INT_FLAGS | |
| 2264 | MACB_BIT(HRESP)); | 2264 | MACB_BIT(HRESP)); |
| 2265 | } | 2265 | } |
| @@ -3907,6 +3907,7 @@ static const struct macb_config sama5d4_config = { | |||
| 3907 | }; | 3907 | }; |
| 3908 | 3908 | ||
| 3909 | static const struct macb_config emac_config = { | 3909 | static const struct macb_config emac_config = { |
| 3910 | .caps = MACB_CAPS_NEEDS_RSTONUBR, | ||
| 3910 | .clk_init = at91ether_clk_init, | 3911 | .clk_init = at91ether_clk_init, |
| 3911 | .init = at91ether_init, | 3912 | .init = at91ether_init, |
| 3912 | }; | 3913 | }; |
| @@ -3928,7 +3929,8 @@ static const struct macb_config zynqmp_config = { | |||
| 3928 | }; | 3929 | }; |
| 3929 | 3930 | ||
| 3930 | static const struct macb_config zynq_config = { | 3931 | static const struct macb_config zynq_config = { |
| 3931 | .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF, | 3932 | .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF | |
| 3933 | MACB_CAPS_NEEDS_RSTONUBR, | ||
| 3932 | .dma_burst_length = 16, | 3934 | .dma_burst_length = 16, |
| 3933 | .clk_init = macb_clk_init, | 3935 | .clk_init = macb_clk_init, |
| 3934 | .init = macb_init, | 3936 | .init = macb_init, |
| @@ -4083,6 +4085,10 @@ static int macb_probe(struct platform_device *pdev) | |||
| 4083 | macb_dma_desc_get_size(bp); | 4085 | macb_dma_desc_get_size(bp); |
| 4084 | } | 4086 | } |
| 4085 | 4087 | ||
| 4088 | bp->rx_intr_mask = MACB_RX_INT_FLAGS; | ||
| 4089 | if (bp->caps & MACB_CAPS_NEEDS_RSTONUBR) | ||
| 4090 | bp->rx_intr_mask |= MACB_BIT(RXUBR); | ||
| 4091 | |||
| 4086 | mac = of_get_mac_address(np); | 4092 | mac = of_get_mac_address(np); |
| 4087 | if (mac) { | 4093 | if (mac) { |
| 4088 | ether_addr_copy(bp->dev->dev_addr, mac); | 4094 | ether_addr_copy(bp->dev->dev_addr, mac); |
diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig index 5f03199a3acf..05f4a3b21e29 100644 --- a/drivers/net/ethernet/cavium/Kconfig +++ b/drivers/net/ethernet/cavium/Kconfig | |||
| @@ -54,7 +54,6 @@ config CAVIUM_PTP | |||
| 54 | tristate "Cavium PTP coprocessor as PTP clock" | 54 | tristate "Cavium PTP coprocessor as PTP clock" |
| 55 | depends on 64BIT && PCI | 55 | depends on 64BIT && PCI |
| 56 | imply PTP_1588_CLOCK | 56 | imply PTP_1588_CLOCK |
| 57 | default y | ||
| 58 | ---help--- | 57 | ---help--- |
| 59 | This driver adds support for the Precision Time Protocol Clocks and | 58 | This driver adds support for the Precision Time Protocol Clocks and |
| 60 | Timestamping coprocessor (PTP) found on Cavium processors. | 59 | Timestamping coprocessor (PTP) found on Cavium processors. |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 60641e202534..9a7f70db20c7 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
| @@ -1434,7 +1434,8 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, | |||
| 1434 | * csum is correct or is zero. | 1434 | * csum is correct or is zero. |
| 1435 | */ | 1435 | */ |
| 1436 | if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc && | 1436 | if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc && |
| 1437 | tcp_udp_csum_ok && ipv4_csum_ok && outer_csum_ok) { | 1437 | tcp_udp_csum_ok && outer_csum_ok && |
| 1438 | (ipv4_csum_ok || ipv6)) { | ||
| 1438 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1439 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 1439 | skb->csum_level = encap; | 1440 | skb->csum_level = encap; |
| 1440 | } | 1441 | } |
diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c index 13430f75496c..f1a2da15dd0a 100644 --- a/drivers/net/ethernet/dec/tulip/de2104x.c +++ b/drivers/net/ethernet/dec/tulip/de2104x.c | |||
| @@ -585,7 +585,7 @@ static void de_tx (struct de_private *de) | |||
| 585 | netif_dbg(de, tx_done, de->dev, | 585 | netif_dbg(de, tx_done, de->dev, |
| 586 | "tx done, slot %d\n", tx_tail); | 586 | "tx done, slot %d\n", tx_tail); |
| 587 | } | 587 | } |
| 588 | dev_kfree_skb_irq(skb); | 588 | dev_consume_skb_irq(skb); |
| 589 | } | 589 | } |
| 590 | 590 | ||
| 591 | next: | 591 | next: |
diff --git a/drivers/net/ethernet/freescale/dpaa2/Kconfig b/drivers/net/ethernet/freescale/dpaa2/Kconfig index 809a155eb193..f6d244c663fd 100644 --- a/drivers/net/ethernet/freescale/dpaa2/Kconfig +++ b/drivers/net/ethernet/freescale/dpaa2/Kconfig | |||
| @@ -9,8 +9,9 @@ config FSL_DPAA2_ETH | |||
| 9 | 9 | ||
| 10 | config FSL_DPAA2_PTP_CLOCK | 10 | config FSL_DPAA2_PTP_CLOCK |
| 11 | tristate "Freescale DPAA2 PTP Clock" | 11 | tristate "Freescale DPAA2 PTP Clock" |
| 12 | depends on FSL_DPAA2_ETH && POSIX_TIMERS | 12 | depends on FSL_DPAA2_ETH |
| 13 | select PTP_1588_CLOCK | 13 | imply PTP_1588_CLOCK |
| 14 | default y | ||
| 14 | help | 15 | help |
| 15 | This driver adds support for using the DPAA2 1588 timer module | 16 | This driver adds support for using the DPAA2 1588 timer module |
| 16 | as a PTP clock. | 17 | as a PTP clock. |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index ae0f88bce9aa..2370dc204202 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -3467,7 +3467,7 @@ fec_probe(struct platform_device *pdev) | |||
| 3467 | if (ret) | 3467 | if (ret) |
| 3468 | goto failed_clk_ipg; | 3468 | goto failed_clk_ipg; |
| 3469 | 3469 | ||
| 3470 | fep->reg_phy = devm_regulator_get(&pdev->dev, "phy"); | 3470 | fep->reg_phy = devm_regulator_get_optional(&pdev->dev, "phy"); |
| 3471 | if (!IS_ERR(fep->reg_phy)) { | 3471 | if (!IS_ERR(fep->reg_phy)) { |
| 3472 | ret = regulator_enable(fep->reg_phy); | 3472 | ret = regulator_enable(fep->reg_phy); |
| 3473 | if (ret) { | 3473 | if (ret) { |
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c index b90bab72efdb..c1968b3ecec8 100644 --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c | |||
| @@ -369,7 +369,7 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id) | |||
| 369 | dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len, | 369 | dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len, |
| 370 | DMA_TO_DEVICE); | 370 | DMA_TO_DEVICE); |
| 371 | 371 | ||
| 372 | dev_kfree_skb_irq(skb); | 372 | dev_consume_skb_irq(skb); |
| 373 | } | 373 | } |
| 374 | spin_unlock(&priv->lock); | 374 | spin_unlock(&priv->lock); |
| 375 | 375 | ||
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index c3d539e209ed..eb3e65e8868f 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
| @@ -1879,6 +1879,8 @@ static void ucc_geth_free_tx(struct ucc_geth_private *ugeth) | |||
| 1879 | u16 i, j; | 1879 | u16 i, j; |
| 1880 | u8 __iomem *bd; | 1880 | u8 __iomem *bd; |
| 1881 | 1881 | ||
| 1882 | netdev_reset_queue(ugeth->ndev); | ||
| 1883 | |||
| 1882 | ug_info = ugeth->ug_info; | 1884 | ug_info = ugeth->ug_info; |
| 1883 | uf_info = &ug_info->uf_info; | 1885 | uf_info = &ug_info->uf_info; |
| 1884 | 1886 | ||
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 5b33238c6680..60e7d7ae3787 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | |||
| @@ -2418,6 +2418,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) | |||
| 2418 | out_notify_fail: | 2418 | out_notify_fail: |
| 2419 | (void)cancel_work_sync(&priv->service_task); | 2419 | (void)cancel_work_sync(&priv->service_task); |
| 2420 | out_read_prop_fail: | 2420 | out_read_prop_fail: |
| 2421 | /* safe for ACPI FW */ | ||
| 2422 | of_node_put(to_of_node(priv->fwnode)); | ||
| 2421 | free_netdev(ndev); | 2423 | free_netdev(ndev); |
| 2422 | return ret; | 2424 | return ret; |
| 2423 | } | 2425 | } |
| @@ -2447,6 +2449,9 @@ static int hns_nic_dev_remove(struct platform_device *pdev) | |||
| 2447 | set_bit(NIC_STATE_REMOVING, &priv->state); | 2449 | set_bit(NIC_STATE_REMOVING, &priv->state); |
| 2448 | (void)cancel_work_sync(&priv->service_task); | 2450 | (void)cancel_work_sync(&priv->service_task); |
| 2449 | 2451 | ||
| 2452 | /* safe for ACPI FW */ | ||
| 2453 | of_node_put(to_of_node(priv->fwnode)); | ||
| 2454 | |||
| 2450 | free_netdev(ndev); | 2455 | free_netdev(ndev); |
| 2451 | return 0; | 2456 | return 0; |
| 2452 | } | 2457 | } |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index 8e9b95871d30..ce15d2350db9 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | |||
| @@ -1157,16 +1157,18 @@ static int hns_get_regs_len(struct net_device *net_dev) | |||
| 1157 | */ | 1157 | */ |
| 1158 | static int hns_nic_nway_reset(struct net_device *netdev) | 1158 | static int hns_nic_nway_reset(struct net_device *netdev) |
| 1159 | { | 1159 | { |
| 1160 | int ret = 0; | ||
| 1161 | struct phy_device *phy = netdev->phydev; | 1160 | struct phy_device *phy = netdev->phydev; |
| 1162 | 1161 | ||
| 1163 | if (netif_running(netdev)) { | 1162 | if (!netif_running(netdev)) |
| 1164 | /* if autoneg is disabled, don't restart auto-negotiation */ | 1163 | return 0; |
| 1165 | if (phy && phy->autoneg == AUTONEG_ENABLE) | ||
| 1166 | ret = genphy_restart_aneg(phy); | ||
| 1167 | } | ||
| 1168 | 1164 | ||
| 1169 | return ret; | 1165 | if (!phy) |
| 1166 | return -EOPNOTSUPP; | ||
| 1167 | |||
| 1168 | if (phy->autoneg != AUTONEG_ENABLE) | ||
| 1169 | return -EINVAL; | ||
| 1170 | |||
| 1171 | return genphy_restart_aneg(phy); | ||
| 1170 | } | 1172 | } |
| 1171 | 1173 | ||
| 1172 | static u32 | 1174 | static u32 |
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c index 017e08452d8c..baf5cc251f32 100644 --- a/drivers/net/ethernet/hisilicon/hns_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c | |||
| @@ -321,7 +321,7 @@ static int hns_mdio_read(struct mii_bus *bus, int phy_id, int regnum) | |||
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | hns_mdio_cmd_write(mdio_dev, is_c45, | 323 | hns_mdio_cmd_write(mdio_dev, is_c45, |
| 324 | MDIO_C45_WRITE_ADDR, phy_id, devad); | 324 | MDIO_C45_READ, phy_id, devad); |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ | 327 | /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ |
diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c index d719668a6684..92929750f832 100644 --- a/drivers/net/ethernet/i825xx/82596.c +++ b/drivers/net/ethernet/i825xx/82596.c | |||
| @@ -1310,7 +1310,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id) | |||
| 1310 | dev->stats.tx_aborted_errors++; | 1310 | dev->stats.tx_aborted_errors++; |
| 1311 | } | 1311 | } |
| 1312 | 1312 | ||
| 1313 | dev_kfree_skb_irq(skb); | 1313 | dev_consume_skb_irq(skb); |
| 1314 | 1314 | ||
| 1315 | tx_cmd->cmd.command = 0; /* Mark free */ | 1315 | tx_cmd->cmd.command = 0; /* Mark free */ |
| 1316 | break; | 1316 | break; |
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 098d8764c0ea..dd71d5db7274 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
| @@ -1313,7 +1313,6 @@ static int ibmveth_poll(struct napi_struct *napi, int budget) | |||
| 1313 | unsigned long lpar_rc; | 1313 | unsigned long lpar_rc; |
| 1314 | u16 mss = 0; | 1314 | u16 mss = 0; |
| 1315 | 1315 | ||
| 1316 | restart_poll: | ||
| 1317 | while (frames_processed < budget) { | 1316 | while (frames_processed < budget) { |
| 1318 | if (!ibmveth_rxq_pending_buffer(adapter)) | 1317 | if (!ibmveth_rxq_pending_buffer(adapter)) |
| 1319 | break; | 1318 | break; |
| @@ -1401,7 +1400,6 @@ restart_poll: | |||
| 1401 | napi_reschedule(napi)) { | 1400 | napi_reschedule(napi)) { |
| 1402 | lpar_rc = h_vio_signal(adapter->vdev->unit_address, | 1401 | lpar_rc = h_vio_signal(adapter->vdev->unit_address, |
| 1403 | VIO_IRQ_DISABLE); | 1402 | VIO_IRQ_DISABLE); |
| 1404 | goto restart_poll; | ||
| 1405 | } | 1403 | } |
| 1406 | } | 1404 | } |
| 1407 | 1405 | ||
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 04fd1f135011..654ac534b10e 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
| @@ -152,8 +152,10 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
| 152 | memset(p, 0, regs->len); | 152 | memset(p, 0, regs->len); |
| 153 | memcpy_fromio(p, io, B3_RAM_ADDR); | 153 | memcpy_fromio(p, io, B3_RAM_ADDR); |
| 154 | 154 | ||
| 155 | memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, | 155 | if (regs->len > B3_RI_WTO_R1) { |
| 156 | regs->len - B3_RI_WTO_R1); | 156 | memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, |
| 157 | regs->len - B3_RI_WTO_R1); | ||
| 158 | } | ||
| 157 | } | 159 | } |
| 158 | 160 | ||
| 159 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ | 161 | /* Wake on Lan only supported on Yukon chips with rev 1 or above */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c index db909b6069b5..65f8a4b6ed0c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/cq.c | |||
| @@ -306,14 +306,16 @@ static int mlx4_init_user_cqes(void *buf, int entries, int cqe_size) | |||
| 306 | 306 | ||
| 307 | if (entries_per_copy < entries) { | 307 | if (entries_per_copy < entries) { |
| 308 | for (i = 0; i < entries / entries_per_copy; i++) { | 308 | for (i = 0; i < entries / entries_per_copy; i++) { |
| 309 | err = copy_to_user(buf, init_ents, PAGE_SIZE); | 309 | err = copy_to_user((void __user *)buf, init_ents, PAGE_SIZE) ? |
| 310 | -EFAULT : 0; | ||
| 310 | if (err) | 311 | if (err) |
| 311 | goto out; | 312 | goto out; |
| 312 | 313 | ||
| 313 | buf += PAGE_SIZE; | 314 | buf += PAGE_SIZE; |
| 314 | } | 315 | } |
| 315 | } else { | 316 | } else { |
| 316 | err = copy_to_user(buf, init_ents, entries * cqe_size); | 317 | err = copy_to_user((void __user *)buf, init_ents, entries * cqe_size) ? |
| 318 | -EFAULT : 0; | ||
| 317 | } | 319 | } |
| 318 | 320 | ||
| 319 | out: | 321 | out: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 7df728f1e5b5..6e501af0e532 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
| @@ -2067,9 +2067,11 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, | |||
| 2067 | { | 2067 | { |
| 2068 | struct mlx4_cmd_mailbox *mailbox; | 2068 | struct mlx4_cmd_mailbox *mailbox; |
| 2069 | __be32 *outbox; | 2069 | __be32 *outbox; |
| 2070 | u64 qword_field; | ||
| 2070 | u32 dword_field; | 2071 | u32 dword_field; |
| 2071 | int err; | 2072 | u16 word_field; |
| 2072 | u8 byte_field; | 2073 | u8 byte_field; |
| 2074 | int err; | ||
| 2073 | static const u8 a0_dmfs_query_hw_steering[] = { | 2075 | static const u8 a0_dmfs_query_hw_steering[] = { |
| 2074 | [0] = MLX4_STEERING_DMFS_A0_DEFAULT, | 2076 | [0] = MLX4_STEERING_DMFS_A0_DEFAULT, |
| 2075 | [1] = MLX4_STEERING_DMFS_A0_DYNAMIC, | 2077 | [1] = MLX4_STEERING_DMFS_A0_DYNAMIC, |
| @@ -2097,19 +2099,32 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, | |||
| 2097 | 2099 | ||
| 2098 | /* QPC/EEC/CQC/EQC/RDMARC attributes */ | 2100 | /* QPC/EEC/CQC/EQC/RDMARC attributes */ |
| 2099 | 2101 | ||
| 2100 | MLX4_GET(param->qpc_base, outbox, INIT_HCA_QPC_BASE_OFFSET); | 2102 | MLX4_GET(qword_field, outbox, INIT_HCA_QPC_BASE_OFFSET); |
| 2101 | MLX4_GET(param->log_num_qps, outbox, INIT_HCA_LOG_QP_OFFSET); | 2103 | param->qpc_base = qword_field & ~((u64)0x1f); |
| 2102 | MLX4_GET(param->srqc_base, outbox, INIT_HCA_SRQC_BASE_OFFSET); | 2104 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_QP_OFFSET); |
| 2103 | MLX4_GET(param->log_num_srqs, outbox, INIT_HCA_LOG_SRQ_OFFSET); | 2105 | param->log_num_qps = byte_field & 0x1f; |
| 2104 | MLX4_GET(param->cqc_base, outbox, INIT_HCA_CQC_BASE_OFFSET); | 2106 | MLX4_GET(qword_field, outbox, INIT_HCA_SRQC_BASE_OFFSET); |
| 2105 | MLX4_GET(param->log_num_cqs, outbox, INIT_HCA_LOG_CQ_OFFSET); | 2107 | param->srqc_base = qword_field & ~((u64)0x1f); |
| 2106 | MLX4_GET(param->altc_base, outbox, INIT_HCA_ALTC_BASE_OFFSET); | 2108 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_SRQ_OFFSET); |
| 2107 | MLX4_GET(param->auxc_base, outbox, INIT_HCA_AUXC_BASE_OFFSET); | 2109 | param->log_num_srqs = byte_field & 0x1f; |
| 2108 | MLX4_GET(param->eqc_base, outbox, INIT_HCA_EQC_BASE_OFFSET); | 2110 | MLX4_GET(qword_field, outbox, INIT_HCA_CQC_BASE_OFFSET); |
| 2109 | MLX4_GET(param->log_num_eqs, outbox, INIT_HCA_LOG_EQ_OFFSET); | 2111 | param->cqc_base = qword_field & ~((u64)0x1f); |
| 2110 | MLX4_GET(param->num_sys_eqs, outbox, INIT_HCA_NUM_SYS_EQS_OFFSET); | 2112 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_CQ_OFFSET); |
| 2111 | MLX4_GET(param->rdmarc_base, outbox, INIT_HCA_RDMARC_BASE_OFFSET); | 2113 | param->log_num_cqs = byte_field & 0x1f; |
| 2112 | MLX4_GET(param->log_rd_per_qp, outbox, INIT_HCA_LOG_RD_OFFSET); | 2114 | MLX4_GET(qword_field, outbox, INIT_HCA_ALTC_BASE_OFFSET); |
| 2115 | param->altc_base = qword_field; | ||
| 2116 | MLX4_GET(qword_field, outbox, INIT_HCA_AUXC_BASE_OFFSET); | ||
| 2117 | param->auxc_base = qword_field; | ||
| 2118 | MLX4_GET(qword_field, outbox, INIT_HCA_EQC_BASE_OFFSET); | ||
| 2119 | param->eqc_base = qword_field & ~((u64)0x1f); | ||
| 2120 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_EQ_OFFSET); | ||
| 2121 | param->log_num_eqs = byte_field & 0x1f; | ||
| 2122 | MLX4_GET(word_field, outbox, INIT_HCA_NUM_SYS_EQS_OFFSET); | ||
| 2123 | param->num_sys_eqs = word_field & 0xfff; | ||
| 2124 | MLX4_GET(qword_field, outbox, INIT_HCA_RDMARC_BASE_OFFSET); | ||
| 2125 | param->rdmarc_base = qword_field & ~((u64)0x1f); | ||
| 2126 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_RD_OFFSET); | ||
| 2127 | param->log_rd_per_qp = byte_field & 0x7; | ||
| 2113 | 2128 | ||
| 2114 | MLX4_GET(dword_field, outbox, INIT_HCA_FLAGS_OFFSET); | 2129 | MLX4_GET(dword_field, outbox, INIT_HCA_FLAGS_OFFSET); |
| 2115 | if (dword_field & (1 << INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN)) { | 2130 | if (dword_field & (1 << INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN)) { |
| @@ -2128,22 +2143,21 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, | |||
| 2128 | /* steering attributes */ | 2143 | /* steering attributes */ |
| 2129 | if (param->steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED) { | 2144 | if (param->steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED) { |
| 2130 | MLX4_GET(param->mc_base, outbox, INIT_HCA_FS_BASE_OFFSET); | 2145 | MLX4_GET(param->mc_base, outbox, INIT_HCA_FS_BASE_OFFSET); |
| 2131 | MLX4_GET(param->log_mc_entry_sz, outbox, | 2146 | MLX4_GET(byte_field, outbox, INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET); |
| 2132 | INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET); | 2147 | param->log_mc_entry_sz = byte_field & 0x1f; |
| 2133 | MLX4_GET(param->log_mc_table_sz, outbox, | 2148 | MLX4_GET(byte_field, outbox, INIT_HCA_FS_LOG_TABLE_SZ_OFFSET); |
| 2134 | INIT_HCA_FS_LOG_TABLE_SZ_OFFSET); | 2149 | param->log_mc_table_sz = byte_field & 0x1f; |
| 2135 | MLX4_GET(byte_field, outbox, | 2150 | MLX4_GET(byte_field, outbox, INIT_HCA_FS_A0_OFFSET); |
| 2136 | INIT_HCA_FS_A0_OFFSET); | ||
| 2137 | param->dmfs_high_steer_mode = | 2151 | param->dmfs_high_steer_mode = |
| 2138 | a0_dmfs_query_hw_steering[(byte_field >> 6) & 3]; | 2152 | a0_dmfs_query_hw_steering[(byte_field >> 6) & 3]; |
| 2139 | } else { | 2153 | } else { |
| 2140 | MLX4_GET(param->mc_base, outbox, INIT_HCA_MC_BASE_OFFSET); | 2154 | MLX4_GET(param->mc_base, outbox, INIT_HCA_MC_BASE_OFFSET); |
| 2141 | MLX4_GET(param->log_mc_entry_sz, outbox, | 2155 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET); |
| 2142 | INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET); | 2156 | param->log_mc_entry_sz = byte_field & 0x1f; |
| 2143 | MLX4_GET(param->log_mc_hash_sz, outbox, | 2157 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_MC_HASH_SZ_OFFSET); |
| 2144 | INIT_HCA_LOG_MC_HASH_SZ_OFFSET); | 2158 | param->log_mc_hash_sz = byte_field & 0x1f; |
| 2145 | MLX4_GET(param->log_mc_table_sz, outbox, | 2159 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_MC_TABLE_SZ_OFFSET); |
| 2146 | INIT_HCA_LOG_MC_TABLE_SZ_OFFSET); | 2160 | param->log_mc_table_sz = byte_field & 0x1f; |
| 2147 | } | 2161 | } |
| 2148 | 2162 | ||
| 2149 | /* CX3 is capable of extending CQEs/EQEs from 32 to 64 bytes */ | 2163 | /* CX3 is capable of extending CQEs/EQEs from 32 to 64 bytes */ |
| @@ -2167,15 +2181,18 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, | |||
| 2167 | /* TPT attributes */ | 2181 | /* TPT attributes */ |
| 2168 | 2182 | ||
| 2169 | MLX4_GET(param->dmpt_base, outbox, INIT_HCA_DMPT_BASE_OFFSET); | 2183 | MLX4_GET(param->dmpt_base, outbox, INIT_HCA_DMPT_BASE_OFFSET); |
| 2170 | MLX4_GET(param->mw_enabled, outbox, INIT_HCA_TPT_MW_OFFSET); | 2184 | MLX4_GET(byte_field, outbox, INIT_HCA_TPT_MW_OFFSET); |
| 2171 | MLX4_GET(param->log_mpt_sz, outbox, INIT_HCA_LOG_MPT_SZ_OFFSET); | 2185 | param->mw_enabled = byte_field >> 7; |
| 2186 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_MPT_SZ_OFFSET); | ||
| 2187 | param->log_mpt_sz = byte_field & 0x3f; | ||
| 2172 | MLX4_GET(param->mtt_base, outbox, INIT_HCA_MTT_BASE_OFFSET); | 2188 | MLX4_GET(param->mtt_base, outbox, INIT_HCA_MTT_BASE_OFFSET); |
| 2173 | MLX4_GET(param->cmpt_base, outbox, INIT_HCA_CMPT_BASE_OFFSET); | 2189 | MLX4_GET(param->cmpt_base, outbox, INIT_HCA_CMPT_BASE_OFFSET); |
| 2174 | 2190 | ||
| 2175 | /* UAR attributes */ | 2191 | /* UAR attributes */ |
| 2176 | 2192 | ||
| 2177 | MLX4_GET(param->uar_page_sz, outbox, INIT_HCA_UAR_PAGE_SZ_OFFSET); | 2193 | MLX4_GET(param->uar_page_sz, outbox, INIT_HCA_UAR_PAGE_SZ_OFFSET); |
| 2178 | MLX4_GET(param->log_uar_sz, outbox, INIT_HCA_LOG_UAR_SZ_OFFSET); | 2194 | MLX4_GET(byte_field, outbox, INIT_HCA_LOG_UAR_SZ_OFFSET); |
| 2195 | param->log_uar_sz = byte_field & 0xf; | ||
| 2179 | 2196 | ||
| 2180 | /* phv_check enable */ | 2197 | /* phv_check enable */ |
| 2181 | MLX4_GET(byte_field, outbox, INIT_HCA_CACHELINE_SZ_OFFSET); | 2198 | MLX4_GET(byte_field, outbox, INIT_HCA_CACHELINE_SZ_OFFSET); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c index 046948ead152..f3c7ab6faea5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | |||
| @@ -256,6 +256,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv, | |||
| 256 | e->m_neigh.family = n->ops->family; | 256 | e->m_neigh.family = n->ops->family; |
| 257 | memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); | 257 | memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); |
| 258 | e->out_dev = out_dev; | 258 | e->out_dev = out_dev; |
| 259 | e->route_dev = route_dev; | ||
| 259 | 260 | ||
| 260 | /* It's important to add the neigh to the hash table before checking | 261 | /* It's important to add the neigh to the hash table before checking |
| 261 | * the neigh validity state. So if we'll get a notification, in case the | 262 | * the neigh validity state. So if we'll get a notification, in case the |
| @@ -369,6 +370,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv, | |||
| 369 | e->m_neigh.family = n->ops->family; | 370 | e->m_neigh.family = n->ops->family; |
| 370 | memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); | 371 | memcpy(&e->m_neigh.dst_ip, n->primary_key, n->tbl->key_len); |
| 371 | e->out_dev = out_dev; | 372 | e->out_dev = out_dev; |
| 373 | e->route_dev = route_dev; | ||
| 372 | 374 | ||
| 373 | /* It's importent to add the neigh to the hash table before checking | 375 | /* It's importent to add the neigh to the hash table before checking |
| 374 | * the neigh validity state. So if we'll get a notification, in case the | 376 | * the neigh validity state. So if we'll get a notification, in case the |
| @@ -612,16 +614,18 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev, | |||
| 612 | struct mlx5_flow_spec *spec, | 614 | struct mlx5_flow_spec *spec, |
| 613 | struct tc_cls_flower_offload *f, | 615 | struct tc_cls_flower_offload *f, |
| 614 | void *headers_c, | 616 | void *headers_c, |
| 615 | void *headers_v) | 617 | void *headers_v, u8 *match_level) |
| 616 | { | 618 | { |
| 617 | int tunnel_type; | 619 | int tunnel_type; |
| 618 | int err = 0; | 620 | int err = 0; |
| 619 | 621 | ||
| 620 | tunnel_type = mlx5e_tc_tun_get_type(filter_dev); | 622 | tunnel_type = mlx5e_tc_tun_get_type(filter_dev); |
| 621 | if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_VXLAN) { | 623 | if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_VXLAN) { |
| 624 | *match_level = MLX5_MATCH_L4; | ||
| 622 | err = mlx5e_tc_tun_parse_vxlan(priv, spec, f, | 625 | err = mlx5e_tc_tun_parse_vxlan(priv, spec, f, |
| 623 | headers_c, headers_v); | 626 | headers_c, headers_v); |
| 624 | } else if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_GRETAP) { | 627 | } else if (tunnel_type == MLX5E_TC_TUNNEL_TYPE_GRETAP) { |
| 628 | *match_level = MLX5_MATCH_L3; | ||
| 625 | err = mlx5e_tc_tun_parse_gretap(priv, spec, f, | 629 | err = mlx5e_tc_tun_parse_gretap(priv, spec, f, |
| 626 | headers_c, headers_v); | 630 | headers_c, headers_v); |
| 627 | } else { | 631 | } else { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h index 706ce7bf15e7..b63f15de899d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h | |||
| @@ -39,6 +39,6 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev, | |||
| 39 | struct mlx5_flow_spec *spec, | 39 | struct mlx5_flow_spec *spec, |
| 40 | struct tc_cls_flower_offload *f, | 40 | struct tc_cls_flower_offload *f, |
| 41 | void *headers_c, | 41 | void *headers_c, |
| 42 | void *headers_v); | 42 | void *headers_v, u8 *match_level); |
| 43 | 43 | ||
| 44 | #endif //__MLX5_EN_TC_TUNNEL_H__ | 44 | #endif //__MLX5_EN_TC_TUNNEL_H__ |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 8cfd2ec7c0a2..01819e5c9975 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
| @@ -950,7 +950,7 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, | |||
| 950 | if (params->rx_dim_enabled) | 950 | if (params->rx_dim_enabled) |
| 951 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); | 951 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); |
| 952 | 952 | ||
| 953 | if (params->pflags & MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) | 953 | if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE)) |
| 954 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); | 954 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); |
| 955 | 955 | ||
| 956 | return 0; | 956 | return 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 04736212a21c..ef9e472daffb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | |||
| @@ -596,6 +596,10 @@ static void mlx5e_rep_update_flows(struct mlx5e_priv *priv, | |||
| 596 | if (neigh_connected && !(e->flags & MLX5_ENCAP_ENTRY_VALID)) { | 596 | if (neigh_connected && !(e->flags & MLX5_ENCAP_ENTRY_VALID)) { |
| 597 | ether_addr_copy(e->h_dest, ha); | 597 | ether_addr_copy(e->h_dest, ha); |
| 598 | ether_addr_copy(eth->h_dest, ha); | 598 | ether_addr_copy(eth->h_dest, ha); |
| 599 | /* Update the encap source mac, in case that we delete | ||
| 600 | * the flows when encap source mac changed. | ||
| 601 | */ | ||
| 602 | ether_addr_copy(eth->h_source, e->route_dev->dev_addr); | ||
| 599 | 603 | ||
| 600 | mlx5e_tc_encap_flows_add(priv, e); | 604 | mlx5e_tc_encap_flows_add(priv, e); |
| 601 | } | 605 | } |
| @@ -1126,9 +1130,17 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev, | |||
| 1126 | struct mlx5e_priv *priv = netdev_priv(dev); | 1130 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 1127 | struct mlx5e_rep_priv *rpriv = priv->ppriv; | 1131 | struct mlx5e_rep_priv *rpriv = priv->ppriv; |
| 1128 | struct mlx5_eswitch_rep *rep = rpriv->rep; | 1132 | struct mlx5_eswitch_rep *rep = rpriv->rep; |
| 1129 | int ret; | 1133 | int ret, pf_num; |
| 1134 | |||
| 1135 | ret = mlx5_lag_get_pf_num(priv->mdev, &pf_num); | ||
| 1136 | if (ret) | ||
| 1137 | return ret; | ||
| 1138 | |||
| 1139 | if (rep->vport == FDB_UPLINK_VPORT) | ||
| 1140 | ret = snprintf(buf, len, "p%d", pf_num); | ||
| 1141 | else | ||
| 1142 | ret = snprintf(buf, len, "pf%dvf%d", pf_num, rep->vport - 1); | ||
| 1130 | 1143 | ||
| 1131 | ret = snprintf(buf, len, "%d", rep->vport - 1); | ||
| 1132 | if (ret >= len) | 1144 | if (ret >= len) |
| 1133 | return -EOPNOTSUPP; | 1145 | return -EOPNOTSUPP; |
| 1134 | 1146 | ||
| @@ -1285,6 +1297,18 @@ static int mlx5e_uplink_rep_set_mac(struct net_device *netdev, void *addr) | |||
| 1285 | return 0; | 1297 | return 0; |
| 1286 | } | 1298 | } |
| 1287 | 1299 | ||
| 1300 | static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos, | ||
| 1301 | __be16 vlan_proto) | ||
| 1302 | { | ||
| 1303 | netdev_warn_once(dev, "legacy vf vlan setting isn't supported in switchdev mode\n"); | ||
| 1304 | |||
| 1305 | if (vlan != 0) | ||
| 1306 | return -EOPNOTSUPP; | ||
| 1307 | |||
| 1308 | /* allow setting 0-vid for compatibility with libvirt */ | ||
| 1309 | return 0; | ||
| 1310 | } | ||
| 1311 | |||
| 1288 | static const struct switchdev_ops mlx5e_rep_switchdev_ops = { | 1312 | static const struct switchdev_ops mlx5e_rep_switchdev_ops = { |
| 1289 | .switchdev_port_attr_get = mlx5e_attr_get, | 1313 | .switchdev_port_attr_get = mlx5e_attr_get, |
| 1290 | }; | 1314 | }; |
| @@ -1319,6 +1343,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { | |||
| 1319 | .ndo_set_vf_rate = mlx5e_set_vf_rate, | 1343 | .ndo_set_vf_rate = mlx5e_set_vf_rate, |
| 1320 | .ndo_get_vf_config = mlx5e_get_vf_config, | 1344 | .ndo_get_vf_config = mlx5e_get_vf_config, |
| 1321 | .ndo_get_vf_stats = mlx5e_get_vf_stats, | 1345 | .ndo_get_vf_stats = mlx5e_get_vf_stats, |
| 1346 | .ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan, | ||
| 1322 | }; | 1347 | }; |
| 1323 | 1348 | ||
| 1324 | bool mlx5e_eswitch_rep(struct net_device *netdev) | 1349 | bool mlx5e_eswitch_rep(struct net_device *netdev) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h index edd722824697..36eafc877e6b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h | |||
| @@ -148,6 +148,7 @@ struct mlx5e_encap_entry { | |||
| 148 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ | 148 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
| 149 | 149 | ||
| 150 | struct net_device *out_dev; | 150 | struct net_device *out_dev; |
| 151 | struct net_device *route_dev; | ||
| 151 | int tunnel_type; | 152 | int tunnel_type; |
| 152 | int tunnel_hlen; | 153 | int tunnel_hlen; |
| 153 | int reformat_type; | 154 | int reformat_type; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index cae6c6d48984..b5c1b039375a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
| @@ -128,6 +128,7 @@ struct mlx5e_tc_flow_parse_attr { | |||
| 128 | struct net_device *filter_dev; | 128 | struct net_device *filter_dev; |
| 129 | struct mlx5_flow_spec spec; | 129 | struct mlx5_flow_spec spec; |
| 130 | int num_mod_hdr_actions; | 130 | int num_mod_hdr_actions; |
| 131 | int max_mod_hdr_actions; | ||
| 131 | void *mod_hdr_actions; | 132 | void *mod_hdr_actions; |
| 132 | int mirred_ifindex[MLX5_MAX_FLOW_FWD_VPORTS]; | 133 | int mirred_ifindex[MLX5_MAX_FLOW_FWD_VPORTS]; |
| 133 | }; | 134 | }; |
| @@ -1302,7 +1303,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv, | |||
| 1302 | static int parse_tunnel_attr(struct mlx5e_priv *priv, | 1303 | static int parse_tunnel_attr(struct mlx5e_priv *priv, |
| 1303 | struct mlx5_flow_spec *spec, | 1304 | struct mlx5_flow_spec *spec, |
| 1304 | struct tc_cls_flower_offload *f, | 1305 | struct tc_cls_flower_offload *f, |
| 1305 | struct net_device *filter_dev) | 1306 | struct net_device *filter_dev, u8 *match_level) |
| 1306 | { | 1307 | { |
| 1307 | struct netlink_ext_ack *extack = f->common.extack; | 1308 | struct netlink_ext_ack *extack = f->common.extack; |
| 1308 | void *headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, | 1309 | void *headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, |
| @@ -1317,7 +1318,7 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv, | |||
| 1317 | int err = 0; | 1318 | int err = 0; |
| 1318 | 1319 | ||
| 1319 | err = mlx5e_tc_tun_parse(filter_dev, priv, spec, f, | 1320 | err = mlx5e_tc_tun_parse(filter_dev, priv, spec, f, |
| 1320 | headers_c, headers_v); | 1321 | headers_c, headers_v, match_level); |
| 1321 | if (err) { | 1322 | if (err) { |
| 1322 | NL_SET_ERR_MSG_MOD(extack, | 1323 | NL_SET_ERR_MSG_MOD(extack, |
| 1323 | "failed to parse tunnel attributes"); | 1324 | "failed to parse tunnel attributes"); |
| @@ -1426,7 +1427,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, | |||
| 1426 | struct mlx5_flow_spec *spec, | 1427 | struct mlx5_flow_spec *spec, |
| 1427 | struct tc_cls_flower_offload *f, | 1428 | struct tc_cls_flower_offload *f, |
| 1428 | struct net_device *filter_dev, | 1429 | struct net_device *filter_dev, |
| 1429 | u8 *match_level) | 1430 | u8 *match_level, u8 *tunnel_match_level) |
| 1430 | { | 1431 | { |
| 1431 | struct netlink_ext_ack *extack = f->common.extack; | 1432 | struct netlink_ext_ack *extack = f->common.extack; |
| 1432 | void *headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, | 1433 | void *headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, |
| @@ -1477,7 +1478,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, | |||
| 1477 | switch (key->addr_type) { | 1478 | switch (key->addr_type) { |
| 1478 | case FLOW_DISSECTOR_KEY_IPV4_ADDRS: | 1479 | case FLOW_DISSECTOR_KEY_IPV4_ADDRS: |
| 1479 | case FLOW_DISSECTOR_KEY_IPV6_ADDRS: | 1480 | case FLOW_DISSECTOR_KEY_IPV6_ADDRS: |
| 1480 | if (parse_tunnel_attr(priv, spec, f, filter_dev)) | 1481 | if (parse_tunnel_attr(priv, spec, f, filter_dev, tunnel_match_level)) |
| 1481 | return -EOPNOTSUPP; | 1482 | return -EOPNOTSUPP; |
| 1482 | break; | 1483 | break; |
| 1483 | default: | 1484 | default: |
| @@ -1826,11 +1827,11 @@ static int parse_cls_flower(struct mlx5e_priv *priv, | |||
| 1826 | struct mlx5_core_dev *dev = priv->mdev; | 1827 | struct mlx5_core_dev *dev = priv->mdev; |
| 1827 | struct mlx5_eswitch *esw = dev->priv.eswitch; | 1828 | struct mlx5_eswitch *esw = dev->priv.eswitch; |
| 1828 | struct mlx5e_rep_priv *rpriv = priv->ppriv; | 1829 | struct mlx5e_rep_priv *rpriv = priv->ppriv; |
| 1830 | u8 match_level, tunnel_match_level = MLX5_MATCH_NONE; | ||
| 1829 | struct mlx5_eswitch_rep *rep; | 1831 | struct mlx5_eswitch_rep *rep; |
| 1830 | u8 match_level; | ||
| 1831 | int err; | 1832 | int err; |
| 1832 | 1833 | ||
| 1833 | err = __parse_cls_flower(priv, spec, f, filter_dev, &match_level); | 1834 | err = __parse_cls_flower(priv, spec, f, filter_dev, &match_level, &tunnel_match_level); |
| 1834 | 1835 | ||
| 1835 | if (!err && (flow->flags & MLX5E_TC_FLOW_ESWITCH)) { | 1836 | if (!err && (flow->flags & MLX5E_TC_FLOW_ESWITCH)) { |
| 1836 | rep = rpriv->rep; | 1837 | rep = rpriv->rep; |
| @@ -1846,10 +1847,12 @@ static int parse_cls_flower(struct mlx5e_priv *priv, | |||
| 1846 | } | 1847 | } |
| 1847 | } | 1848 | } |
| 1848 | 1849 | ||
| 1849 | if (flow->flags & MLX5E_TC_FLOW_ESWITCH) | 1850 | if (flow->flags & MLX5E_TC_FLOW_ESWITCH) { |
| 1850 | flow->esw_attr->match_level = match_level; | 1851 | flow->esw_attr->match_level = match_level; |
| 1851 | else | 1852 | flow->esw_attr->tunnel_match_level = tunnel_match_level; |
| 1853 | } else { | ||
| 1852 | flow->nic_attr->match_level = match_level; | 1854 | flow->nic_attr->match_level = match_level; |
| 1855 | } | ||
| 1853 | 1856 | ||
| 1854 | return err; | 1857 | return err; |
| 1855 | } | 1858 | } |
| @@ -1934,9 +1937,9 @@ static struct mlx5_fields fields[] = { | |||
| 1934 | OFFLOAD(UDP_DPORT, 2, udp.dest, 0), | 1937 | OFFLOAD(UDP_DPORT, 2, udp.dest, 0), |
| 1935 | }; | 1938 | }; |
| 1936 | 1939 | ||
| 1937 | /* On input attr->num_mod_hdr_actions tells how many HW actions can be parsed at | 1940 | /* On input attr->max_mod_hdr_actions tells how many HW actions can be parsed at |
| 1938 | * max from the SW pedit action. On success, it says how many HW actions were | 1941 | * max from the SW pedit action. On success, attr->num_mod_hdr_actions |
| 1939 | * actually parsed. | 1942 | * says how many HW actions were actually parsed. |
| 1940 | */ | 1943 | */ |
| 1941 | static int offload_pedit_fields(struct pedit_headers *masks, | 1944 | static int offload_pedit_fields(struct pedit_headers *masks, |
| 1942 | struct pedit_headers *vals, | 1945 | struct pedit_headers *vals, |
| @@ -1960,9 +1963,11 @@ static int offload_pedit_fields(struct pedit_headers *masks, | |||
| 1960 | add_vals = &vals[TCA_PEDIT_KEY_EX_CMD_ADD]; | 1963 | add_vals = &vals[TCA_PEDIT_KEY_EX_CMD_ADD]; |
| 1961 | 1964 | ||
| 1962 | action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); | 1965 | action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); |
| 1963 | action = parse_attr->mod_hdr_actions; | 1966 | action = parse_attr->mod_hdr_actions + |
| 1964 | max_actions = parse_attr->num_mod_hdr_actions; | 1967 | parse_attr->num_mod_hdr_actions * action_size; |
| 1965 | nactions = 0; | 1968 | |
| 1969 | max_actions = parse_attr->max_mod_hdr_actions; | ||
| 1970 | nactions = parse_attr->num_mod_hdr_actions; | ||
| 1966 | 1971 | ||
| 1967 | for (i = 0; i < ARRAY_SIZE(fields); i++) { | 1972 | for (i = 0; i < ARRAY_SIZE(fields); i++) { |
| 1968 | f = &fields[i]; | 1973 | f = &fields[i]; |
| @@ -2073,7 +2078,7 @@ static int alloc_mod_hdr_actions(struct mlx5e_priv *priv, | |||
| 2073 | if (!parse_attr->mod_hdr_actions) | 2078 | if (!parse_attr->mod_hdr_actions) |
| 2074 | return -ENOMEM; | 2079 | return -ENOMEM; |
| 2075 | 2080 | ||
| 2076 | parse_attr->num_mod_hdr_actions = max_actions; | 2081 | parse_attr->max_mod_hdr_actions = max_actions; |
| 2077 | return 0; | 2082 | return 0; |
| 2078 | } | 2083 | } |
| 2079 | 2084 | ||
| @@ -2119,9 +2124,11 @@ static int parse_tc_pedit_action(struct mlx5e_priv *priv, | |||
| 2119 | goto out_err; | 2124 | goto out_err; |
| 2120 | } | 2125 | } |
| 2121 | 2126 | ||
| 2122 | err = alloc_mod_hdr_actions(priv, a, namespace, parse_attr); | 2127 | if (!parse_attr->mod_hdr_actions) { |
| 2123 | if (err) | 2128 | err = alloc_mod_hdr_actions(priv, a, namespace, parse_attr); |
| 2124 | goto out_err; | 2129 | if (err) |
| 2130 | goto out_err; | ||
| 2131 | } | ||
| 2125 | 2132 | ||
| 2126 | err = offload_pedit_fields(masks, vals, parse_attr, extack); | 2133 | err = offload_pedit_fields(masks, vals, parse_attr, extack); |
| 2127 | if (err < 0) | 2134 | if (err < 0) |
| @@ -2179,6 +2186,7 @@ static bool csum_offload_supported(struct mlx5e_priv *priv, | |||
| 2179 | 2186 | ||
| 2180 | static bool modify_header_match_supported(struct mlx5_flow_spec *spec, | 2187 | static bool modify_header_match_supported(struct mlx5_flow_spec *spec, |
| 2181 | struct tcf_exts *exts, | 2188 | struct tcf_exts *exts, |
| 2189 | u32 actions, | ||
| 2182 | struct netlink_ext_ack *extack) | 2190 | struct netlink_ext_ack *extack) |
| 2183 | { | 2191 | { |
| 2184 | const struct tc_action *a; | 2192 | const struct tc_action *a; |
| @@ -2188,7 +2196,11 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, | |||
| 2188 | u16 ethertype; | 2196 | u16 ethertype; |
| 2189 | int nkeys, i; | 2197 | int nkeys, i; |
| 2190 | 2198 | ||
| 2191 | headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers); | 2199 | if (actions & MLX5_FLOW_CONTEXT_ACTION_DECAP) |
| 2200 | headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, inner_headers); | ||
| 2201 | else | ||
| 2202 | headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers); | ||
| 2203 | |||
| 2192 | ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype); | 2204 | ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype); |
| 2193 | 2205 | ||
| 2194 | /* for non-IP we only re-write MACs, so we're okay */ | 2206 | /* for non-IP we only re-write MACs, so we're okay */ |
| @@ -2245,7 +2257,7 @@ static bool actions_match_supported(struct mlx5e_priv *priv, | |||
| 2245 | 2257 | ||
| 2246 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) | 2258 | if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) |
| 2247 | return modify_header_match_supported(&parse_attr->spec, exts, | 2259 | return modify_header_match_supported(&parse_attr->spec, exts, |
| 2248 | extack); | 2260 | actions, extack); |
| 2249 | 2261 | ||
| 2250 | return true; | 2262 | return true; |
| 2251 | } | 2263 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 598ad7e4d5c9..0e55cd1f2e98 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | |||
| @@ -387,8 +387,14 @@ netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb, | |||
| 387 | num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); | 387 | num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); |
| 388 | contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi); | 388 | contig_wqebbs_room = mlx5_wq_cyc_get_contig_wqebbs(wq, pi); |
| 389 | if (unlikely(contig_wqebbs_room < num_wqebbs)) { | 389 | if (unlikely(contig_wqebbs_room < num_wqebbs)) { |
| 390 | #ifdef CONFIG_MLX5_EN_IPSEC | ||
| 391 | struct mlx5_wqe_eth_seg cur_eth = wqe->eth; | ||
| 392 | #endif | ||
| 390 | mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room); | 393 | mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room); |
| 391 | mlx5e_sq_fetch_wqe(sq, &wqe, &pi); | 394 | mlx5e_sq_fetch_wqe(sq, &wqe, &pi); |
| 395 | #ifdef CONFIG_MLX5_EN_IPSEC | ||
| 396 | wqe->eth = cur_eth; | ||
| 397 | #endif | ||
| 392 | } | 398 | } |
| 393 | 399 | ||
| 394 | /* fill wqe */ | 400 | /* fill wqe */ |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index a44ea7b85614..5b492b67f4e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
| @@ -1134,13 +1134,6 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, | |||
| 1134 | int err = 0; | 1134 | int err = 0; |
| 1135 | u8 *smac_v; | 1135 | u8 *smac_v; |
| 1136 | 1136 | ||
| 1137 | if (vport->info.spoofchk && !is_valid_ether_addr(vport->info.mac)) { | ||
| 1138 | mlx5_core_warn(esw->dev, | ||
| 1139 | "vport[%d] configure ingress rules failed, illegal mac with spoofchk\n", | ||
| 1140 | vport->vport); | ||
| 1141 | return -EPERM; | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | esw_vport_cleanup_ingress_rules(esw, vport); | 1137 | esw_vport_cleanup_ingress_rules(esw, vport); |
| 1145 | 1138 | ||
| 1146 | if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) { | 1139 | if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) { |
| @@ -1728,7 +1721,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) | |||
| 1728 | int vport_num; | 1721 | int vport_num; |
| 1729 | int err; | 1722 | int err; |
| 1730 | 1723 | ||
| 1731 | if (!MLX5_ESWITCH_MANAGER(dev)) | 1724 | if (!MLX5_VPORT_MANAGER(dev)) |
| 1732 | return 0; | 1725 | return 0; |
| 1733 | 1726 | ||
| 1734 | esw_info(dev, | 1727 | esw_info(dev, |
| @@ -1797,7 +1790,7 @@ abort: | |||
| 1797 | 1790 | ||
| 1798 | void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) | 1791 | void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) |
| 1799 | { | 1792 | { |
| 1800 | if (!esw || !MLX5_ESWITCH_MANAGER(esw->dev)) | 1793 | if (!esw || !MLX5_VPORT_MANAGER(esw->dev)) |
| 1801 | return; | 1794 | return; |
| 1802 | 1795 | ||
| 1803 | esw_info(esw->dev, "cleanup\n"); | 1796 | esw_info(esw->dev, "cleanup\n"); |
| @@ -1827,13 +1820,10 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, | |||
| 1827 | mutex_lock(&esw->state_lock); | 1820 | mutex_lock(&esw->state_lock); |
| 1828 | evport = &esw->vports[vport]; | 1821 | evport = &esw->vports[vport]; |
| 1829 | 1822 | ||
| 1830 | if (evport->info.spoofchk && !is_valid_ether_addr(mac)) { | 1823 | if (evport->info.spoofchk && !is_valid_ether_addr(mac)) |
| 1831 | mlx5_core_warn(esw->dev, | 1824 | mlx5_core_warn(esw->dev, |
| 1832 | "MAC invalidation is not allowed when spoofchk is on, vport(%d)\n", | 1825 | "Set invalid MAC while spoofchk is on, vport(%d)\n", |
| 1833 | vport); | 1826 | vport); |
| 1834 | err = -EPERM; | ||
| 1835 | goto unlock; | ||
| 1836 | } | ||
| 1837 | 1827 | ||
| 1838 | err = mlx5_modify_nic_vport_mac_address(esw->dev, vport, mac); | 1828 | err = mlx5_modify_nic_vport_mac_address(esw->dev, vport, mac); |
| 1839 | if (err) { | 1829 | if (err) { |
| @@ -1979,6 +1969,10 @@ int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw, | |||
| 1979 | evport = &esw->vports[vport]; | 1969 | evport = &esw->vports[vport]; |
| 1980 | pschk = evport->info.spoofchk; | 1970 | pschk = evport->info.spoofchk; |
| 1981 | evport->info.spoofchk = spoofchk; | 1971 | evport->info.spoofchk = spoofchk; |
| 1972 | if (pschk && !is_valid_ether_addr(evport->info.mac)) | ||
| 1973 | mlx5_core_warn(esw->dev, | ||
| 1974 | "Spoofchk in set while MAC is invalid, vport(%d)\n", | ||
| 1975 | evport->vport); | ||
| 1982 | if (evport->enabled && esw->mode == SRIOV_LEGACY) | 1976 | if (evport->enabled && esw->mode == SRIOV_LEGACY) |
| 1983 | err = esw_vport_ingress_config(esw, evport); | 1977 | err = esw_vport_ingress_config(esw, evport); |
| 1984 | if (err) | 1978 | if (err) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index 9c89eea9b2c3..748ff178a1d6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | |||
| @@ -312,6 +312,7 @@ struct mlx5_esw_flow_attr { | |||
| 312 | } dests[MLX5_MAX_FLOW_FWD_VPORTS]; | 312 | } dests[MLX5_MAX_FLOW_FWD_VPORTS]; |
| 313 | u32 mod_hdr_id; | 313 | u32 mod_hdr_id; |
| 314 | u8 match_level; | 314 | u8 match_level; |
| 315 | u8 tunnel_match_level; | ||
| 315 | struct mlx5_fc *counter; | 316 | struct mlx5_fc *counter; |
| 316 | u32 chain; | 317 | u32 chain; |
| 317 | u16 prio; | 318 | u16 prio; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 53065b6ae593..d4e6fe5b9300 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | |||
| @@ -160,14 +160,15 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, | |||
| 160 | MLX5_SET_TO_ONES(fte_match_set_misc, misc, | 160 | MLX5_SET_TO_ONES(fte_match_set_misc, misc, |
| 161 | source_eswitch_owner_vhca_id); | 161 | source_eswitch_owner_vhca_id); |
| 162 | 162 | ||
| 163 | if (attr->match_level == MLX5_MATCH_NONE) | 163 | spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS; |
| 164 | spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS; | 164 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) { |
| 165 | else | 165 | if (attr->tunnel_match_level != MLX5_MATCH_NONE) |
| 166 | spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS | | 166 | spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS; |
| 167 | MLX5_MATCH_MISC_PARAMETERS; | 167 | if (attr->match_level != MLX5_MATCH_NONE) |
| 168 | 168 | spec->match_criteria_enable |= MLX5_MATCH_INNER_HEADERS; | |
| 169 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) | 169 | } else if (attr->match_level != MLX5_MATCH_NONE) { |
| 170 | spec->match_criteria_enable |= MLX5_MATCH_INNER_HEADERS; | 170 | spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS; |
| 171 | } | ||
| 171 | 172 | ||
| 172 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) | 173 | if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) |
| 173 | flow_act.modify_id = attr->mod_hdr_id; | 174 | flow_act.modify_id = attr->mod_hdr_id; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c index 3a6baed722d8..2d223385dc81 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c | |||
| @@ -616,6 +616,27 @@ void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev) | |||
| 616 | } | 616 | } |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | int mlx5_lag_get_pf_num(struct mlx5_core_dev *dev, int *pf_num) | ||
| 620 | { | ||
| 621 | struct mlx5_lag *ldev; | ||
| 622 | int n; | ||
| 623 | |||
| 624 | ldev = mlx5_lag_dev_get(dev); | ||
| 625 | if (!ldev) { | ||
| 626 | mlx5_core_warn(dev, "no lag device, can't get pf num\n"); | ||
| 627 | return -EINVAL; | ||
| 628 | } | ||
| 629 | |||
| 630 | for (n = 0; n < MLX5_MAX_PORTS; n++) | ||
| 631 | if (ldev->pf[n].dev == dev) { | ||
| 632 | *pf_num = n; | ||
| 633 | return 0; | ||
| 634 | } | ||
| 635 | |||
| 636 | mlx5_core_warn(dev, "wasn't able to locate pf in the lag device\n"); | ||
| 637 | return -EINVAL; | ||
| 638 | } | ||
| 639 | |||
| 619 | /* Must be called with intf_mutex held */ | 640 | /* Must be called with intf_mutex held */ |
| 620 | void mlx5_lag_remove(struct mlx5_core_dev *dev) | 641 | void mlx5_lag_remove(struct mlx5_core_dev *dev) |
| 621 | { | 642 | { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index c68dcea5985b..5300b0b6d836 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | |||
| @@ -187,6 +187,8 @@ static inline int mlx5_lag_is_lacp_owner(struct mlx5_core_dev *dev) | |||
| 187 | MLX5_CAP_GEN(dev, lag_master); | 187 | MLX5_CAP_GEN(dev, lag_master); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | int mlx5_lag_get_pf_num(struct mlx5_core_dev *dev, int *pf_num); | ||
| 191 | |||
| 190 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol); | 192 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol); |
| 191 | void mlx5_lag_update(struct mlx5_core_dev *dev); | 193 | void mlx5_lag_update(struct mlx5_core_dev *dev); |
| 192 | 194 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c index 388f205a497f..370ca94b6775 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c | |||
| @@ -44,14 +44,15 @@ static struct mlx5_core_rsc_common * | |||
| 44 | mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) | 44 | mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) |
| 45 | { | 45 | { |
| 46 | struct mlx5_core_rsc_common *common; | 46 | struct mlx5_core_rsc_common *common; |
| 47 | unsigned long flags; | ||
| 47 | 48 | ||
| 48 | spin_lock(&table->lock); | 49 | spin_lock_irqsave(&table->lock, flags); |
| 49 | 50 | ||
| 50 | common = radix_tree_lookup(&table->tree, rsn); | 51 | common = radix_tree_lookup(&table->tree, rsn); |
| 51 | if (common) | 52 | if (common) |
| 52 | atomic_inc(&common->refcount); | 53 | atomic_inc(&common->refcount); |
| 53 | 54 | ||
| 54 | spin_unlock(&table->lock); | 55 | spin_unlock_irqrestore(&table->lock, flags); |
| 55 | 56 | ||
| 56 | return common; | 57 | return common; |
| 57 | } | 58 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed.h b/drivers/net/ethernet/qlogic/qed/qed.h index 24a90163775e..2d8a77cc156b 100644 --- a/drivers/net/ethernet/qlogic/qed/qed.h +++ b/drivers/net/ethernet/qlogic/qed/qed.h | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | extern const struct qed_common_ops qed_common_ops_pass; | 53 | extern const struct qed_common_ops qed_common_ops_pass; |
| 54 | 54 | ||
| 55 | #define QED_MAJOR_VERSION 8 | 55 | #define QED_MAJOR_VERSION 8 |
| 56 | #define QED_MINOR_VERSION 33 | 56 | #define QED_MINOR_VERSION 37 |
| 57 | #define QED_REVISION_VERSION 0 | 57 | #define QED_REVISION_VERSION 0 |
| 58 | #define QED_ENGINEERING_VERSION 20 | 58 | #define QED_ENGINEERING_VERSION 20 |
| 59 | 59 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c index 8f6551421945..2ecaaaa4469a 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c | |||
| @@ -795,19 +795,19 @@ static void qed_init_qm_pq(struct qed_hwfn *p_hwfn, | |||
| 795 | 795 | ||
| 796 | /* get pq index according to PQ_FLAGS */ | 796 | /* get pq index according to PQ_FLAGS */ |
| 797 | static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, | 797 | static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, |
| 798 | u32 pq_flags) | 798 | unsigned long pq_flags) |
| 799 | { | 799 | { |
| 800 | struct qed_qm_info *qm_info = &p_hwfn->qm_info; | 800 | struct qed_qm_info *qm_info = &p_hwfn->qm_info; |
| 801 | 801 | ||
| 802 | /* Can't have multiple flags set here */ | 802 | /* Can't have multiple flags set here */ |
| 803 | if (bitmap_weight((unsigned long *)&pq_flags, | 803 | if (bitmap_weight(&pq_flags, |
| 804 | sizeof(pq_flags) * BITS_PER_BYTE) > 1) { | 804 | sizeof(pq_flags) * BITS_PER_BYTE) > 1) { |
| 805 | DP_ERR(p_hwfn, "requested multiple pq flags 0x%x\n", pq_flags); | 805 | DP_ERR(p_hwfn, "requested multiple pq flags 0x%lx\n", pq_flags); |
| 806 | goto err; | 806 | goto err; |
| 807 | } | 807 | } |
| 808 | 808 | ||
| 809 | if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { | 809 | if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { |
| 810 | DP_ERR(p_hwfn, "pq flag 0x%x is not set\n", pq_flags); | 810 | DP_ERR(p_hwfn, "pq flag 0x%lx is not set\n", pq_flags); |
| 811 | goto err; | 811 | goto err; |
| 812 | } | 812 | } |
| 813 | 813 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c index 67c02ea93906..58be1c4c6668 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c | |||
| @@ -609,6 +609,10 @@ qed_sp_update_accept_mode(struct qed_hwfn *p_hwfn, | |||
| 609 | (!!(accept_filter & QED_ACCEPT_MCAST_MATCHED) && | 609 | (!!(accept_filter & QED_ACCEPT_MCAST_MATCHED) && |
| 610 | !!(accept_filter & QED_ACCEPT_MCAST_UNMATCHED))); | 610 | !!(accept_filter & QED_ACCEPT_MCAST_UNMATCHED))); |
| 611 | 611 | ||
| 612 | SET_FIELD(state, ETH_VPORT_TX_MODE_UCAST_ACCEPT_ALL, | ||
| 613 | (!!(accept_filter & QED_ACCEPT_UCAST_MATCHED) && | ||
| 614 | !!(accept_filter & QED_ACCEPT_UCAST_UNMATCHED))); | ||
| 615 | |||
| 612 | SET_FIELD(state, ETH_VPORT_TX_MODE_BCAST_ACCEPT_ALL, | 616 | SET_FIELD(state, ETH_VPORT_TX_MODE_BCAST_ACCEPT_ALL, |
| 613 | !!(accept_filter & QED_ACCEPT_BCAST)); | 617 | !!(accept_filter & QED_ACCEPT_BCAST)); |
| 614 | 618 | ||
| @@ -744,6 +748,11 @@ int qed_sp_vport_update(struct qed_hwfn *p_hwfn, | |||
| 744 | return rc; | 748 | return rc; |
| 745 | } | 749 | } |
| 746 | 750 | ||
| 751 | if (p_params->update_ctl_frame_check) { | ||
| 752 | p_cmn->ctl_frame_mac_check_en = p_params->mac_chk_en; | ||
| 753 | p_cmn->ctl_frame_ethtype_check_en = p_params->ethtype_chk_en; | ||
| 754 | } | ||
| 755 | |||
| 747 | /* Update mcast bins for VFs, PF doesn't use this functionality */ | 756 | /* Update mcast bins for VFs, PF doesn't use this functionality */ |
| 748 | qed_sp_update_mcast_bin(p_hwfn, p_ramrod, p_params); | 757 | qed_sp_update_mcast_bin(p_hwfn, p_ramrod, p_params); |
| 749 | 758 | ||
| @@ -2207,7 +2216,7 @@ static int qed_fill_eth_dev_info(struct qed_dev *cdev, | |||
| 2207 | u16 num_queues = 0; | 2216 | u16 num_queues = 0; |
| 2208 | 2217 | ||
| 2209 | /* Since the feature controls only queue-zones, | 2218 | /* Since the feature controls only queue-zones, |
| 2210 | * make sure we have the contexts [rx, tx, xdp] to | 2219 | * make sure we have the contexts [rx, xdp, tcs] to |
| 2211 | * match. | 2220 | * match. |
| 2212 | */ | 2221 | */ |
| 2213 | for_each_hwfn(cdev, i) { | 2222 | for_each_hwfn(cdev, i) { |
| @@ -2217,7 +2226,8 @@ static int qed_fill_eth_dev_info(struct qed_dev *cdev, | |||
| 2217 | u16 cids; | 2226 | u16 cids; |
| 2218 | 2227 | ||
| 2219 | cids = hwfn->pf_params.eth_pf_params.num_cons; | 2228 | cids = hwfn->pf_params.eth_pf_params.num_cons; |
| 2220 | num_queues += min_t(u16, l2_queues, cids / 3); | 2229 | cids /= (2 + info->num_tc); |
| 2230 | num_queues += min_t(u16, l2_queues, cids); | ||
| 2221 | } | 2231 | } |
| 2222 | 2232 | ||
| 2223 | /* queues might theoretically be >256, but interrupts' | 2233 | /* queues might theoretically be >256, but interrupts' |
| @@ -2688,7 +2698,8 @@ static int qed_configure_filter_rx_mode(struct qed_dev *cdev, | |||
| 2688 | if (type == QED_FILTER_RX_MODE_TYPE_PROMISC) { | 2698 | if (type == QED_FILTER_RX_MODE_TYPE_PROMISC) { |
| 2689 | accept_flags.rx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | | 2699 | accept_flags.rx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
| 2690 | QED_ACCEPT_MCAST_UNMATCHED; | 2700 | QED_ACCEPT_MCAST_UNMATCHED; |
| 2691 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2701 | accept_flags.tx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
| 2702 | QED_ACCEPT_MCAST_UNMATCHED; | ||
| 2692 | } else if (type == QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC) { | 2703 | } else if (type == QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC) { |
| 2693 | accept_flags.rx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2704 | accept_flags.rx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
| 2694 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | 2705 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
| @@ -2860,7 +2871,8 @@ static int qed_get_coalesce(struct qed_dev *cdev, u16 *coal, void *handle) | |||
| 2860 | p_hwfn = p_cid->p_owner; | 2871 | p_hwfn = p_cid->p_owner; |
| 2861 | rc = qed_get_queue_coalesce(p_hwfn, coal, handle); | 2872 | rc = qed_get_queue_coalesce(p_hwfn, coal, handle); |
| 2862 | if (rc) | 2873 | if (rc) |
| 2863 | DP_NOTICE(p_hwfn, "Unable to read queue coalescing\n"); | 2874 | DP_VERBOSE(cdev, QED_MSG_DEBUG, |
| 2875 | "Unable to read queue coalescing\n"); | ||
| 2864 | 2876 | ||
| 2865 | return rc; | 2877 | return rc; |
| 2866 | } | 2878 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.h b/drivers/net/ethernet/qlogic/qed/qed_l2.h index 8d80f1095d17..7127d5aaac42 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_l2.h +++ b/drivers/net/ethernet/qlogic/qed/qed_l2.h | |||
| @@ -219,6 +219,9 @@ struct qed_sp_vport_update_params { | |||
| 219 | struct qed_rss_params *rss_params; | 219 | struct qed_rss_params *rss_params; |
| 220 | struct qed_filter_accept_flags accept_flags; | 220 | struct qed_filter_accept_flags accept_flags; |
| 221 | struct qed_sge_tpa_params *sge_tpa_params; | 221 | struct qed_sge_tpa_params *sge_tpa_params; |
| 222 | u8 update_ctl_frame_check; | ||
| 223 | u8 mac_chk_en; | ||
| 224 | u8 ethtype_chk_en; | ||
| 222 | }; | 225 | }; |
| 223 | 226 | ||
| 224 | int qed_sp_vport_update(struct qed_hwfn *p_hwfn, | 227 | int qed_sp_vport_update(struct qed_hwfn *p_hwfn, |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c index d9237c65a838..b5f419b71287 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c | |||
| @@ -2451,19 +2451,24 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2451 | { | 2451 | { |
| 2452 | struct qed_ll2_tx_pkt_info pkt; | 2452 | struct qed_ll2_tx_pkt_info pkt; |
| 2453 | const skb_frag_t *frag; | 2453 | const skb_frag_t *frag; |
| 2454 | u8 flags = 0, nr_frags; | ||
| 2454 | int rc = -EINVAL, i; | 2455 | int rc = -EINVAL, i; |
| 2455 | dma_addr_t mapping; | 2456 | dma_addr_t mapping; |
| 2456 | u16 vlan = 0; | 2457 | u16 vlan = 0; |
| 2457 | u8 flags = 0; | ||
| 2458 | 2458 | ||
| 2459 | if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { | 2459 | if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { |
| 2460 | DP_INFO(cdev, "Cannot transmit a checksummed packet\n"); | 2460 | DP_INFO(cdev, "Cannot transmit a checksummed packet\n"); |
| 2461 | return -EINVAL; | 2461 | return -EINVAL; |
| 2462 | } | 2462 | } |
| 2463 | 2463 | ||
| 2464 | if (1 + skb_shinfo(skb)->nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { | 2464 | /* Cache number of fragments from SKB since SKB may be freed by |
| 2465 | * the completion routine after calling qed_ll2_prepare_tx_packet() | ||
| 2466 | */ | ||
| 2467 | nr_frags = skb_shinfo(skb)->nr_frags; | ||
| 2468 | |||
| 2469 | if (1 + nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { | ||
| 2465 | DP_ERR(cdev, "Cannot transmit a packet with %d fragments\n", | 2470 | DP_ERR(cdev, "Cannot transmit a packet with %d fragments\n", |
| 2466 | 1 + skb_shinfo(skb)->nr_frags); | 2471 | 1 + nr_frags); |
| 2467 | return -EINVAL; | 2472 | return -EINVAL; |
| 2468 | } | 2473 | } |
| 2469 | 2474 | ||
| @@ -2485,7 +2490,7 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2485 | } | 2490 | } |
| 2486 | 2491 | ||
| 2487 | memset(&pkt, 0, sizeof(pkt)); | 2492 | memset(&pkt, 0, sizeof(pkt)); |
| 2488 | pkt.num_of_bds = 1 + skb_shinfo(skb)->nr_frags; | 2493 | pkt.num_of_bds = 1 + nr_frags; |
| 2489 | pkt.vlan = vlan; | 2494 | pkt.vlan = vlan; |
| 2490 | pkt.bd_flags = flags; | 2495 | pkt.bd_flags = flags; |
| 2491 | pkt.tx_dest = QED_LL2_TX_DEST_NW; | 2496 | pkt.tx_dest = QED_LL2_TX_DEST_NW; |
| @@ -2496,12 +2501,17 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, | |||
| 2496 | test_bit(QED_LL2_XMIT_FLAGS_FIP_DISCOVERY, &xmit_flags)) | 2501 | test_bit(QED_LL2_XMIT_FLAGS_FIP_DISCOVERY, &xmit_flags)) |
| 2497 | pkt.remove_stag = true; | 2502 | pkt.remove_stag = true; |
| 2498 | 2503 | ||
| 2504 | /* qed_ll2_prepare_tx_packet() may actually send the packet if | ||
| 2505 | * there are no fragments in the skb and subsequently the completion | ||
| 2506 | * routine may run and free the SKB, so no dereferencing the SKB | ||
| 2507 | * beyond this point unless skb has any fragments. | ||
| 2508 | */ | ||
| 2499 | rc = qed_ll2_prepare_tx_packet(&cdev->hwfns[0], cdev->ll2->handle, | 2509 | rc = qed_ll2_prepare_tx_packet(&cdev->hwfns[0], cdev->ll2->handle, |
| 2500 | &pkt, 1); | 2510 | &pkt, 1); |
| 2501 | if (rc) | 2511 | if (rc) |
| 2502 | goto err; | 2512 | goto err; |
| 2503 | 2513 | ||
| 2504 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 2514 | for (i = 0; i < nr_frags; i++) { |
| 2505 | frag = &skb_shinfo(skb)->frags[i]; | 2515 | frag = &skb_shinfo(skb)->frags[i]; |
| 2506 | 2516 | ||
| 2507 | mapping = skb_frag_dma_map(&cdev->pdev->dev, frag, 0, | 2517 | mapping = skb_frag_dma_map(&cdev->pdev->dev, frag, 0, |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp.h b/drivers/net/ethernet/qlogic/qed/qed_sp.h index 4179c9013fc6..96ab77ae6af5 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sp.h +++ b/drivers/net/ethernet/qlogic/qed/qed_sp.h | |||
| @@ -382,6 +382,7 @@ void qed_consq_setup(struct qed_hwfn *p_hwfn); | |||
| 382 | * @param p_hwfn | 382 | * @param p_hwfn |
| 383 | */ | 383 | */ |
| 384 | void qed_consq_free(struct qed_hwfn *p_hwfn); | 384 | void qed_consq_free(struct qed_hwfn *p_hwfn); |
| 385 | int qed_spq_pend_post(struct qed_hwfn *p_hwfn); | ||
| 385 | 386 | ||
| 386 | /** | 387 | /** |
| 387 | * @file | 388 | * @file |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c index 888274fa208b..5a495fda9e9d 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c | |||
| @@ -604,6 +604,9 @@ int qed_sp_pf_update_stag(struct qed_hwfn *p_hwfn) | |||
| 604 | 604 | ||
| 605 | p_ent->ramrod.pf_update.update_mf_vlan_flag = true; | 605 | p_ent->ramrod.pf_update.update_mf_vlan_flag = true; |
| 606 | p_ent->ramrod.pf_update.mf_vlan = cpu_to_le16(p_hwfn->hw_info.ovlan); | 606 | p_ent->ramrod.pf_update.mf_vlan = cpu_to_le16(p_hwfn->hw_info.ovlan); |
| 607 | if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits)) | ||
| 608 | p_ent->ramrod.pf_update.mf_vlan |= | ||
| 609 | cpu_to_le16(((u16)p_hwfn->ufp_info.tc << 13)); | ||
| 607 | 610 | ||
| 608 | return qed_spq_post(p_hwfn, p_ent, NULL); | 611 | return qed_spq_post(p_hwfn, p_ent, NULL); |
| 609 | } | 612 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c index eb88bbc6b193..ba64ff9bedbd 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_spq.c +++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c | |||
| @@ -397,6 +397,11 @@ int qed_eq_completion(struct qed_hwfn *p_hwfn, void *cookie) | |||
| 397 | 397 | ||
| 398 | qed_eq_prod_update(p_hwfn, qed_chain_get_prod_idx(p_chain)); | 398 | qed_eq_prod_update(p_hwfn, qed_chain_get_prod_idx(p_chain)); |
| 399 | 399 | ||
| 400 | /* Attempt to post pending requests */ | ||
| 401 | spin_lock_bh(&p_hwfn->p_spq->lock); | ||
| 402 | rc = qed_spq_pend_post(p_hwfn); | ||
| 403 | spin_unlock_bh(&p_hwfn->p_spq->lock); | ||
| 404 | |||
| 400 | return rc; | 405 | return rc; |
| 401 | } | 406 | } |
| 402 | 407 | ||
| @@ -767,7 +772,7 @@ static int qed_spq_post_list(struct qed_hwfn *p_hwfn, | |||
| 767 | return 0; | 772 | return 0; |
| 768 | } | 773 | } |
| 769 | 774 | ||
| 770 | static int qed_spq_pend_post(struct qed_hwfn *p_hwfn) | 775 | int qed_spq_pend_post(struct qed_hwfn *p_hwfn) |
| 771 | { | 776 | { |
| 772 | struct qed_spq *p_spq = p_hwfn->p_spq; | 777 | struct qed_spq *p_spq = p_hwfn->p_spq; |
| 773 | struct qed_spq_entry *p_ent = NULL; | 778 | struct qed_spq_entry *p_ent = NULL; |
| @@ -905,7 +910,6 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, | |||
| 905 | struct qed_spq_entry *p_ent = NULL; | 910 | struct qed_spq_entry *p_ent = NULL; |
| 906 | struct qed_spq_entry *tmp; | 911 | struct qed_spq_entry *tmp; |
| 907 | struct qed_spq_entry *found = NULL; | 912 | struct qed_spq_entry *found = NULL; |
| 908 | int rc; | ||
| 909 | 913 | ||
| 910 | if (!p_hwfn) | 914 | if (!p_hwfn) |
| 911 | return -EINVAL; | 915 | return -EINVAL; |
| @@ -963,12 +967,7 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, | |||
| 963 | */ | 967 | */ |
| 964 | qed_spq_return_entry(p_hwfn, found); | 968 | qed_spq_return_entry(p_hwfn, found); |
| 965 | 969 | ||
| 966 | /* Attempt to post pending requests */ | 970 | return 0; |
| 967 | spin_lock_bh(&p_spq->lock); | ||
| 968 | rc = qed_spq_pend_post(p_hwfn); | ||
| 969 | spin_unlock_bh(&p_spq->lock); | ||
| 970 | |||
| 971 | return rc; | ||
| 972 | } | 971 | } |
| 973 | 972 | ||
| 974 | int qed_consq_alloc(struct qed_hwfn *p_hwfn) | 973 | int qed_consq_alloc(struct qed_hwfn *p_hwfn) |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c index ca6290fa0f30..71a7af134dd8 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c | |||
| @@ -1969,7 +1969,9 @@ static void qed_iov_vf_mbx_start_vport(struct qed_hwfn *p_hwfn, | |||
| 1969 | params.vport_id = vf->vport_id; | 1969 | params.vport_id = vf->vport_id; |
| 1970 | params.max_buffers_per_cqe = start->max_buffers_per_cqe; | 1970 | params.max_buffers_per_cqe = start->max_buffers_per_cqe; |
| 1971 | params.mtu = vf->mtu; | 1971 | params.mtu = vf->mtu; |
| 1972 | params.check_mac = true; | 1972 | |
| 1973 | /* Non trusted VFs should enable control frame filtering */ | ||
| 1974 | params.check_mac = !vf->p_vf_info.is_trusted_configured; | ||
| 1973 | 1975 | ||
| 1974 | rc = qed_sp_eth_vport_start(p_hwfn, ¶ms); | 1976 | rc = qed_sp_eth_vport_start(p_hwfn, ¶ms); |
| 1975 | if (rc) { | 1977 | if (rc) { |
| @@ -5130,6 +5132,9 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) | |||
| 5130 | params.opaque_fid = vf->opaque_fid; | 5132 | params.opaque_fid = vf->opaque_fid; |
| 5131 | params.vport_id = vf->vport_id; | 5133 | params.vport_id = vf->vport_id; |
| 5132 | 5134 | ||
| 5135 | params.update_ctl_frame_check = 1; | ||
| 5136 | params.mac_chk_en = !vf_info->is_trusted_configured; | ||
| 5137 | |||
| 5133 | if (vf_info->rx_accept_mode & mask) { | 5138 | if (vf_info->rx_accept_mode & mask) { |
| 5134 | flags->update_rx_mode_config = 1; | 5139 | flags->update_rx_mode_config = 1; |
| 5135 | flags->rx_accept_filter = vf_info->rx_accept_mode; | 5140 | flags->rx_accept_filter = vf_info->rx_accept_mode; |
| @@ -5147,7 +5152,8 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) | |||
| 5147 | } | 5152 | } |
| 5148 | 5153 | ||
| 5149 | if (flags->update_rx_mode_config || | 5154 | if (flags->update_rx_mode_config || |
| 5150 | flags->update_tx_mode_config) | 5155 | flags->update_tx_mode_config || |
| 5156 | params.update_ctl_frame_check) | ||
| 5151 | qed_sp_vport_update(hwfn, ¶ms, | 5157 | qed_sp_vport_update(hwfn, ¶ms, |
| 5152 | QED_SPQ_MODE_EBLOCK, NULL); | 5158 | QED_SPQ_MODE_EBLOCK, NULL); |
| 5153 | } | 5159 | } |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c index b6cccf44bf40..5dda547772c1 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_vf.c +++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c | |||
| @@ -261,6 +261,7 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) | |||
| 261 | struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; | 261 | struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; |
| 262 | struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; | 262 | struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; |
| 263 | struct vf_pf_resc_request *p_resc; | 263 | struct vf_pf_resc_request *p_resc; |
| 264 | u8 retry_cnt = VF_ACQUIRE_THRESH; | ||
| 264 | bool resources_acquired = false; | 265 | bool resources_acquired = false; |
| 265 | struct vfpf_acquire_tlv *req; | 266 | struct vfpf_acquire_tlv *req; |
| 266 | int rc = 0, attempts = 0; | 267 | int rc = 0, attempts = 0; |
| @@ -314,6 +315,15 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) | |||
| 314 | 315 | ||
| 315 | /* send acquire request */ | 316 | /* send acquire request */ |
| 316 | rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); | 317 | rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); |
| 318 | |||
| 319 | /* Re-try acquire in case of vf-pf hw channel timeout */ | ||
| 320 | if (retry_cnt && rc == -EBUSY) { | ||
| 321 | DP_VERBOSE(p_hwfn, QED_MSG_IOV, | ||
| 322 | "VF retrying to acquire due to VPC timeout\n"); | ||
| 323 | retry_cnt--; | ||
| 324 | continue; | ||
| 325 | } | ||
| 326 | |||
| 317 | if (rc) | 327 | if (rc) |
| 318 | goto exit; | 328 | goto exit; |
| 319 | 329 | ||
diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h index 613249d1e967..730997b13747 100644 --- a/drivers/net/ethernet/qlogic/qede/qede.h +++ b/drivers/net/ethernet/qlogic/qede/qede.h | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | #include <net/tc_act/tc_gact.h> | 56 | #include <net/tc_act/tc_gact.h> |
| 57 | 57 | ||
| 58 | #define QEDE_MAJOR_VERSION 8 | 58 | #define QEDE_MAJOR_VERSION 8 |
| 59 | #define QEDE_MINOR_VERSION 33 | 59 | #define QEDE_MINOR_VERSION 37 |
| 60 | #define QEDE_REVISION_VERSION 0 | 60 | #define QEDE_REVISION_VERSION 0 |
| 61 | #define QEDE_ENGINEERING_VERSION 20 | 61 | #define QEDE_ENGINEERING_VERSION 20 |
| 62 | #define DRV_MODULE_VERSION __stringify(QEDE_MAJOR_VERSION) "." \ | 62 | #define DRV_MODULE_VERSION __stringify(QEDE_MAJOR_VERSION) "." \ |
| @@ -494,6 +494,9 @@ struct qede_reload_args { | |||
| 494 | 494 | ||
| 495 | /* Datapath functions definition */ | 495 | /* Datapath functions definition */ |
| 496 | netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev); | 496 | netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev); |
| 497 | u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
| 498 | struct net_device *sb_dev, | ||
| 499 | select_queue_fallback_t fallback); | ||
| 497 | netdev_features_t qede_features_check(struct sk_buff *skb, | 500 | netdev_features_t qede_features_check(struct sk_buff *skb, |
| 498 | struct net_device *dev, | 501 | struct net_device *dev, |
| 499 | netdev_features_t features); | 502 | netdev_features_t features); |
diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c index bdf816fe5a16..31b046e24565 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c | |||
| @@ -1695,6 +1695,19 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
| 1695 | return NETDEV_TX_OK; | 1695 | return NETDEV_TX_OK; |
| 1696 | } | 1696 | } |
| 1697 | 1697 | ||
| 1698 | u16 qede_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
| 1699 | struct net_device *sb_dev, | ||
| 1700 | select_queue_fallback_t fallback) | ||
| 1701 | { | ||
| 1702 | struct qede_dev *edev = netdev_priv(dev); | ||
| 1703 | int total_txq; | ||
| 1704 | |||
| 1705 | total_txq = QEDE_TSS_COUNT(edev) * edev->dev_info.num_tc; | ||
| 1706 | |||
| 1707 | return QEDE_TSS_COUNT(edev) ? | ||
| 1708 | fallback(dev, skb, NULL) % total_txq : 0; | ||
| 1709 | } | ||
| 1710 | |||
| 1698 | /* 8B udp header + 8B base tunnel header + 32B option length */ | 1711 | /* 8B udp header + 8B base tunnel header + 32B option length */ |
| 1699 | #define QEDE_MAX_TUN_HDR_LEN 48 | 1712 | #define QEDE_MAX_TUN_HDR_LEN 48 |
| 1700 | 1713 | ||
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index 5a74fcbdbc2b..9790f26d17c4 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c | |||
| @@ -631,6 +631,7 @@ static const struct net_device_ops qede_netdev_ops = { | |||
| 631 | .ndo_open = qede_open, | 631 | .ndo_open = qede_open, |
| 632 | .ndo_stop = qede_close, | 632 | .ndo_stop = qede_close, |
| 633 | .ndo_start_xmit = qede_start_xmit, | 633 | .ndo_start_xmit = qede_start_xmit, |
| 634 | .ndo_select_queue = qede_select_queue, | ||
| 634 | .ndo_set_rx_mode = qede_set_rx_mode, | 635 | .ndo_set_rx_mode = qede_set_rx_mode, |
| 635 | .ndo_set_mac_address = qede_set_mac_addr, | 636 | .ndo_set_mac_address = qede_set_mac_addr, |
| 636 | .ndo_validate_addr = eth_validate_addr, | 637 | .ndo_validate_addr = eth_validate_addr, |
| @@ -666,6 +667,7 @@ static const struct net_device_ops qede_netdev_vf_ops = { | |||
| 666 | .ndo_open = qede_open, | 667 | .ndo_open = qede_open, |
| 667 | .ndo_stop = qede_close, | 668 | .ndo_stop = qede_close, |
| 668 | .ndo_start_xmit = qede_start_xmit, | 669 | .ndo_start_xmit = qede_start_xmit, |
| 670 | .ndo_select_queue = qede_select_queue, | ||
| 669 | .ndo_set_rx_mode = qede_set_rx_mode, | 671 | .ndo_set_rx_mode = qede_set_rx_mode, |
| 670 | .ndo_set_mac_address = qede_set_mac_addr, | 672 | .ndo_set_mac_address = qede_set_mac_addr, |
| 671 | .ndo_validate_addr = eth_validate_addr, | 673 | .ndo_validate_addr = eth_validate_addr, |
| @@ -684,6 +686,7 @@ static const struct net_device_ops qede_netdev_vf_xdp_ops = { | |||
| 684 | .ndo_open = qede_open, | 686 | .ndo_open = qede_open, |
| 685 | .ndo_stop = qede_close, | 687 | .ndo_stop = qede_close, |
| 686 | .ndo_start_xmit = qede_start_xmit, | 688 | .ndo_start_xmit = qede_start_xmit, |
| 689 | .ndo_select_queue = qede_select_queue, | ||
| 687 | .ndo_set_rx_mode = qede_set_rx_mode, | 690 | .ndo_set_rx_mode = qede_set_rx_mode, |
| 688 | .ndo_set_mac_address = qede_set_mac_addr, | 691 | .ndo_set_mac_address = qede_set_mac_addr, |
| 689 | .ndo_validate_addr = eth_validate_addr, | 692 | .ndo_validate_addr = eth_validate_addr, |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 44f6e4873aad..4f910c4f67b0 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
| @@ -691,7 +691,7 @@ static void cp_tx (struct cp_private *cp) | |||
| 691 | } | 691 | } |
| 692 | bytes_compl += skb->len; | 692 | bytes_compl += skb->len; |
| 693 | pkts_compl++; | 693 | pkts_compl++; |
| 694 | dev_kfree_skb_irq(skb); | 694 | dev_consume_skb_irq(skb); |
| 695 | } | 695 | } |
| 696 | 696 | ||
| 697 | cp->tx_skb[tx_tail] = NULL; | 697 | cp->tx_skb[tx_tail] = NULL; |
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index ffc1ada4e6da..d28c8f9ca55b 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c | |||
| @@ -343,7 +343,7 @@ static int ravb_ring_init(struct net_device *ndev, int q) | |||
| 343 | int i; | 343 | int i; |
| 344 | 344 | ||
| 345 | priv->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : ndev->mtu) + | 345 | priv->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : ndev->mtu) + |
| 346 | ETH_HLEN + VLAN_HLEN; | 346 | ETH_HLEN + VLAN_HLEN + sizeof(__sum16); |
| 347 | 347 | ||
| 348 | /* Allocate RX and TX skb rings */ | 348 | /* Allocate RX and TX skb rings */ |
| 349 | priv->rx_skb[q] = kcalloc(priv->num_rx_ring[q], | 349 | priv->rx_skb[q] = kcalloc(priv->num_rx_ring[q], |
| @@ -524,13 +524,15 @@ static void ravb_rx_csum(struct sk_buff *skb) | |||
| 524 | { | 524 | { |
| 525 | u8 *hw_csum; | 525 | u8 *hw_csum; |
| 526 | 526 | ||
| 527 | /* The hardware checksum is 2 bytes appended to packet data */ | 527 | /* The hardware checksum is contained in sizeof(__sum16) (2) bytes |
| 528 | if (unlikely(skb->len < 2)) | 528 | * appended to packet data |
| 529 | */ | ||
| 530 | if (unlikely(skb->len < sizeof(__sum16))) | ||
| 529 | return; | 531 | return; |
| 530 | hw_csum = skb_tail_pointer(skb) - 2; | 532 | hw_csum = skb_tail_pointer(skb) - sizeof(__sum16); |
| 531 | skb->csum = csum_unfold((__force __sum16)get_unaligned_le16(hw_csum)); | 533 | skb->csum = csum_unfold((__force __sum16)get_unaligned_le16(hw_csum)); |
| 532 | skb->ip_summed = CHECKSUM_COMPLETE; | 534 | skb->ip_summed = CHECKSUM_COMPLETE; |
| 533 | skb_trim(skb, skb->len - 2); | 535 | skb_trim(skb, skb->len - sizeof(__sum16)); |
| 534 | } | 536 | } |
| 535 | 537 | ||
| 536 | /* Packet receive function for Ethernet AVB */ | 538 | /* Packet receive function for Ethernet AVB */ |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index b6a50058bb8d..2f2bda68d861 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
| @@ -6046,22 +6046,25 @@ static const struct efx_ef10_nvram_type_info efx_ef10_nvram_types[] = { | |||
| 6046 | { NVRAM_PARTITION_TYPE_EXPANSION_UEFI, 0, 0, "sfc_uefi" }, | 6046 | { NVRAM_PARTITION_TYPE_EXPANSION_UEFI, 0, 0, "sfc_uefi" }, |
| 6047 | { NVRAM_PARTITION_TYPE_STATUS, 0, 0, "sfc_status" } | 6047 | { NVRAM_PARTITION_TYPE_STATUS, 0, 0, "sfc_status" } |
| 6048 | }; | 6048 | }; |
| 6049 | #define EF10_NVRAM_PARTITION_COUNT ARRAY_SIZE(efx_ef10_nvram_types) | ||
| 6049 | 6050 | ||
| 6050 | static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, | 6051 | static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, |
| 6051 | struct efx_mcdi_mtd_partition *part, | 6052 | struct efx_mcdi_mtd_partition *part, |
| 6052 | unsigned int type) | 6053 | unsigned int type, |
| 6054 | unsigned long *found) | ||
| 6053 | { | 6055 | { |
| 6054 | MCDI_DECLARE_BUF(inbuf, MC_CMD_NVRAM_METADATA_IN_LEN); | 6056 | MCDI_DECLARE_BUF(inbuf, MC_CMD_NVRAM_METADATA_IN_LEN); |
| 6055 | MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_METADATA_OUT_LENMAX); | 6057 | MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_METADATA_OUT_LENMAX); |
| 6056 | const struct efx_ef10_nvram_type_info *info; | 6058 | const struct efx_ef10_nvram_type_info *info; |
| 6057 | size_t size, erase_size, outlen; | 6059 | size_t size, erase_size, outlen; |
| 6060 | int type_idx = 0; | ||
| 6058 | bool protected; | 6061 | bool protected; |
| 6059 | int rc; | 6062 | int rc; |
| 6060 | 6063 | ||
| 6061 | for (info = efx_ef10_nvram_types; ; info++) { | 6064 | for (type_idx = 0; ; type_idx++) { |
| 6062 | if (info == | 6065 | if (type_idx == EF10_NVRAM_PARTITION_COUNT) |
| 6063 | efx_ef10_nvram_types + ARRAY_SIZE(efx_ef10_nvram_types)) | ||
| 6064 | return -ENODEV; | 6066 | return -ENODEV; |
| 6067 | info = efx_ef10_nvram_types + type_idx; | ||
| 6065 | if ((type & ~info->type_mask) == info->type) | 6068 | if ((type & ~info->type_mask) == info->type) |
| 6066 | break; | 6069 | break; |
| 6067 | } | 6070 | } |
| @@ -6074,6 +6077,13 @@ static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, | |||
| 6074 | if (protected) | 6077 | if (protected) |
| 6075 | return -ENODEV; /* hide it */ | 6078 | return -ENODEV; /* hide it */ |
| 6076 | 6079 | ||
| 6080 | /* If we've already exposed a partition of this type, hide this | ||
| 6081 | * duplicate. All operations on MTDs are keyed by the type anyway, | ||
| 6082 | * so we can't act on the duplicate. | ||
| 6083 | */ | ||
| 6084 | if (__test_and_set_bit(type_idx, found)) | ||
| 6085 | return -EEXIST; | ||
| 6086 | |||
| 6077 | part->nvram_type = type; | 6087 | part->nvram_type = type; |
| 6078 | 6088 | ||
| 6079 | MCDI_SET_DWORD(inbuf, NVRAM_METADATA_IN_TYPE, type); | 6089 | MCDI_SET_DWORD(inbuf, NVRAM_METADATA_IN_TYPE, type); |
| @@ -6105,6 +6115,7 @@ static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, | |||
| 6105 | static int efx_ef10_mtd_probe(struct efx_nic *efx) | 6115 | static int efx_ef10_mtd_probe(struct efx_nic *efx) |
| 6106 | { | 6116 | { |
| 6107 | MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX); | 6117 | MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX); |
| 6118 | DECLARE_BITMAP(found, EF10_NVRAM_PARTITION_COUNT); | ||
| 6108 | struct efx_mcdi_mtd_partition *parts; | 6119 | struct efx_mcdi_mtd_partition *parts; |
| 6109 | size_t outlen, n_parts_total, i, n_parts; | 6120 | size_t outlen, n_parts_total, i, n_parts; |
| 6110 | unsigned int type; | 6121 | unsigned int type; |
| @@ -6133,11 +6144,13 @@ static int efx_ef10_mtd_probe(struct efx_nic *efx) | |||
| 6133 | for (i = 0; i < n_parts_total; i++) { | 6144 | for (i = 0; i < n_parts_total; i++) { |
| 6134 | type = MCDI_ARRAY_DWORD(outbuf, NVRAM_PARTITIONS_OUT_TYPE_ID, | 6145 | type = MCDI_ARRAY_DWORD(outbuf, NVRAM_PARTITIONS_OUT_TYPE_ID, |
| 6135 | i); | 6146 | i); |
| 6136 | rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type); | 6147 | rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type, |
| 6137 | if (rc == 0) | 6148 | found); |
| 6138 | n_parts++; | 6149 | if (rc == -EEXIST || rc == -ENODEV) |
| 6139 | else if (rc != -ENODEV) | 6150 | continue; |
| 6151 | if (rc) | ||
| 6140 | goto fail; | 6152 | goto fail; |
| 6153 | n_parts++; | ||
| 6141 | } | 6154 | } |
| 6142 | 6155 | ||
| 6143 | rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); | 6156 | rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); |
diff --git a/drivers/net/ethernet/smsc/epic100.c b/drivers/net/ethernet/smsc/epic100.c index 15c62c160953..be47d864f8b9 100644 --- a/drivers/net/ethernet/smsc/epic100.c +++ b/drivers/net/ethernet/smsc/epic100.c | |||
| @@ -1037,7 +1037,7 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep) | |||
| 1037 | skb = ep->tx_skbuff[entry]; | 1037 | skb = ep->tx_skbuff[entry]; |
| 1038 | pci_unmap_single(ep->pci_dev, ep->tx_ring[entry].bufaddr, | 1038 | pci_unmap_single(ep->pci_dev, ep->tx_ring[entry].bufaddr, |
| 1039 | skb->len, PCI_DMA_TODEVICE); | 1039 | skb->len, PCI_DMA_TODEVICE); |
| 1040 | dev_kfree_skb_irq(skb); | 1040 | dev_consume_skb_irq(skb); |
| 1041 | ep->tx_skbuff[entry] = NULL; | 1041 | ep->tx_skbuff[entry] = NULL; |
| 1042 | } | 1042 | } |
| 1043 | 1043 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 7b923362ee55..3b174eae77c1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | |||
| @@ -1342,8 +1342,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) | |||
| 1342 | } | 1342 | } |
| 1343 | 1343 | ||
| 1344 | ret = phy_power_on(bsp_priv, true); | 1344 | ret = phy_power_on(bsp_priv, true); |
| 1345 | if (ret) | 1345 | if (ret) { |
| 1346 | gmac_clk_enable(bsp_priv, false); | ||
| 1346 | return ret; | 1347 | return ret; |
| 1348 | } | ||
| 1347 | 1349 | ||
| 1348 | pm_runtime_enable(dev); | 1350 | pm_runtime_enable(dev); |
| 1349 | pm_runtime_get_sync(dev); | 1351 | pm_runtime_get_sync(dev); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index d1f61c25d82b..5d85742a2be0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | |||
| @@ -721,8 +721,11 @@ static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv) | |||
| 721 | { | 721 | { |
| 722 | unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); | 722 | unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); |
| 723 | 723 | ||
| 724 | if (!clk) | 724 | if (!clk) { |
| 725 | return 0; | 725 | clk = priv->plat->clk_ref_rate; |
| 726 | if (!clk) | ||
| 727 | return 0; | ||
| 728 | } | ||
| 726 | 729 | ||
| 727 | return (usec * (clk / 1000000)) / 256; | 730 | return (usec * (clk / 1000000)) / 256; |
| 728 | } | 731 | } |
| @@ -731,8 +734,11 @@ static u32 stmmac_riwt2usec(u32 riwt, struct stmmac_priv *priv) | |||
| 731 | { | 734 | { |
| 732 | unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); | 735 | unsigned long clk = clk_get_rate(priv->plat->stmmac_clk); |
| 733 | 736 | ||
| 734 | if (!clk) | 737 | if (!clk) { |
| 735 | return 0; | 738 | clk = priv->plat->clk_ref_rate; |
| 739 | if (!clk) | ||
| 740 | return 0; | ||
| 741 | } | ||
| 736 | 742 | ||
| 737 | return (riwt * 256) / (clk / 1000000); | 743 | return (riwt * 256) / (clk / 1000000); |
| 738 | } | 744 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5afba69981cf..685d20472358 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -3023,10 +3023,22 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3023 | 3023 | ||
| 3024 | tx_q = &priv->tx_queue[queue]; | 3024 | tx_q = &priv->tx_queue[queue]; |
| 3025 | 3025 | ||
| 3026 | if (priv->tx_path_in_lpi_mode) | ||
| 3027 | stmmac_disable_eee_mode(priv); | ||
| 3028 | |||
| 3026 | /* Manage oversized TCP frames for GMAC4 device */ | 3029 | /* Manage oversized TCP frames for GMAC4 device */ |
| 3027 | if (skb_is_gso(skb) && priv->tso) { | 3030 | if (skb_is_gso(skb) && priv->tso) { |
| 3028 | if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) | 3031 | if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { |
| 3032 | /* | ||
| 3033 | * There is no way to determine the number of TSO | ||
| 3034 | * capable Queues. Let's use always the Queue 0 | ||
| 3035 | * because if TSO is supported then at least this | ||
| 3036 | * one will be capable. | ||
| 3037 | */ | ||
| 3038 | skb_set_queue_mapping(skb, 0); | ||
| 3039 | |||
| 3029 | return stmmac_tso_xmit(skb, dev); | 3040 | return stmmac_tso_xmit(skb, dev); |
| 3041 | } | ||
| 3030 | } | 3042 | } |
| 3031 | 3043 | ||
| 3032 | if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) { | 3044 | if (unlikely(stmmac_tx_avail(priv, queue) < nfrags + 1)) { |
| @@ -3041,9 +3053,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3041 | return NETDEV_TX_BUSY; | 3053 | return NETDEV_TX_BUSY; |
| 3042 | } | 3054 | } |
| 3043 | 3055 | ||
| 3044 | if (priv->tx_path_in_lpi_mode) | ||
| 3045 | stmmac_disable_eee_mode(priv); | ||
| 3046 | |||
| 3047 | entry = tx_q->cur_tx; | 3056 | entry = tx_q->cur_tx; |
| 3048 | first_entry = entry; | 3057 | first_entry = entry; |
| 3049 | WARN_ON(tx_q->tx_skbuff[first_entry]); | 3058 | WARN_ON(tx_q->tx_skbuff[first_entry]); |
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c index 9020b084b953..6fc05c106afc 100644 --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c | |||
| @@ -1,22 +1,9 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* cassini.c: Sun Microsystems Cassini(+) ethernet driver. | 2 | /* cassini.c: Sun Microsystems Cassini(+) ethernet driver. |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2004 Sun Microsystems Inc. | 4 | * Copyright (C) 2004 Sun Microsystems Inc. |
| 5 | * Copyright (C) 2003 Adrian Sun (asun@darksunrising.com) | 5 | * Copyright (C) 2003 Adrian Sun (asun@darksunrising.com) |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License as | ||
| 9 | * published by the Free Software Foundation; either version 2 of the | ||
| 10 | * License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | * This driver uses the sungem driver (c) David Miller | 7 | * This driver uses the sungem driver (c) David Miller |
| 21 | * (davem@redhat.com) as its basis. | 8 | * (davem@redhat.com) as its basis. |
| 22 | * | 9 | * |
| @@ -1911,7 +1898,7 @@ static inline void cas_tx_ringN(struct cas *cp, int ring, int limit) | |||
| 1911 | cp->net_stats[ring].tx_packets++; | 1898 | cp->net_stats[ring].tx_packets++; |
| 1912 | cp->net_stats[ring].tx_bytes += skb->len; | 1899 | cp->net_stats[ring].tx_bytes += skb->len; |
| 1913 | spin_unlock(&cp->stat_lock[ring]); | 1900 | spin_unlock(&cp->stat_lock[ring]); |
| 1914 | dev_kfree_skb_irq(skb); | 1901 | dev_consume_skb_irq(skb); |
| 1915 | } | 1902 | } |
| 1916 | cp->tx_old[ring] = entry; | 1903 | cp->tx_old[ring] = entry; |
| 1917 | 1904 | ||
diff --git a/drivers/net/ethernet/sun/cassini.h b/drivers/net/ethernet/sun/cassini.h index 13f3860496a8..ae5f05f03f88 100644 --- a/drivers/net/ethernet/sun/cassini.h +++ b/drivers/net/ethernet/sun/cassini.h | |||
| @@ -1,23 +1,10 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* $Id: cassini.h,v 1.16 2004/08/17 21:15:16 zaumen Exp $ | 2 | /* $Id: cassini.h,v 1.16 2004/08/17 21:15:16 zaumen Exp $ |
| 3 | * cassini.h: Definitions for Sun Microsystems Cassini(+) ethernet driver. | 3 | * cassini.h: Definitions for Sun Microsystems Cassini(+) ethernet driver. |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2004 Sun Microsystems Inc. | 5 | * Copyright (C) 2004 Sun Microsystems Inc. |
| 6 | * Copyright (c) 2003 Adrian Sun (asun@darksunrising.com) | 6 | * Copyright (c) 2003 Adrian Sun (asun@darksunrising.com) |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU General Public License as | ||
| 10 | * published by the Free Software Foundation; either version 2 of the | ||
| 11 | * License, or (at your option) any later version. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | * vendor id: 0x108E (Sun Microsystems, Inc.) | 8 | * vendor id: 0x108E (Sun Microsystems, Inc.) |
| 22 | * device id: 0xabba (Cassini) | 9 | * device id: 0xabba (Cassini) |
| 23 | * revision ids: 0x01 = Cassini | 10 | * revision ids: 0x01 = Cassini |
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c index 720b7ac77f3b..e9b757b03b56 100644 --- a/drivers/net/ethernet/sun/sunbmac.c +++ b/drivers/net/ethernet/sun/sunbmac.c | |||
| @@ -781,7 +781,7 @@ static void bigmac_tx(struct bigmac *bp) | |||
| 781 | 781 | ||
| 782 | DTX(("skb(%p) ", skb)); | 782 | DTX(("skb(%p) ", skb)); |
| 783 | bp->tx_skbs[elem] = NULL; | 783 | bp->tx_skbs[elem] = NULL; |
| 784 | dev_kfree_skb_irq(skb); | 784 | dev_consume_skb_irq(skb); |
| 785 | 785 | ||
| 786 | elem = NEXT_TX(elem); | 786 | elem = NEXT_TX(elem); |
| 787 | } | 787 | } |
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index ff641cf30a4e..d007dfeba5c3 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c | |||
| @@ -1962,7 +1962,7 @@ static void happy_meal_tx(struct happy_meal *hp) | |||
| 1962 | this = &txbase[elem]; | 1962 | this = &txbase[elem]; |
| 1963 | } | 1963 | } |
| 1964 | 1964 | ||
| 1965 | dev_kfree_skb_irq(skb); | 1965 | dev_consume_skb_irq(skb); |
| 1966 | dev->stats.tx_packets++; | 1966 | dev->stats.tx_packets++; |
| 1967 | } | 1967 | } |
| 1968 | hp->tx_old = elem; | 1968 | hp->tx_old = elem; |
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index dc966ddb6d81..b24c11187017 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c | |||
| @@ -1739,7 +1739,7 @@ static void bdx_tx_cleanup(struct bdx_priv *priv) | |||
| 1739 | tx_level -= db->rptr->len; /* '-' koz len is negative */ | 1739 | tx_level -= db->rptr->len; /* '-' koz len is negative */ |
| 1740 | 1740 | ||
| 1741 | /* now should come skb pointer - free it */ | 1741 | /* now should come skb pointer - free it */ |
| 1742 | dev_kfree_skb_irq(db->rptr->addr.skb); | 1742 | dev_consume_skb_irq(db->rptr->addr.skb); |
| 1743 | bdx_tx_db_inc_rptr(db); | 1743 | bdx_tx_db_inc_rptr(db); |
| 1744 | } | 1744 | } |
| 1745 | 1745 | ||
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c index 810dfc7de1f9..e2d47b24a869 100644 --- a/drivers/net/ethernet/ti/cpmac.c +++ b/drivers/net/ethernet/ti/cpmac.c | |||
| @@ -608,7 +608,7 @@ static void cpmac_end_xmit(struct net_device *dev, int queue) | |||
| 608 | netdev_dbg(dev, "sent 0x%p, len=%d\n", | 608 | netdev_dbg(dev, "sent 0x%p, len=%d\n", |
| 609 | desc->skb, desc->skb->len); | 609 | desc->skb, desc->skb->len); |
| 610 | 610 | ||
| 611 | dev_kfree_skb_irq(desc->skb); | 611 | dev_consume_skb_irq(desc->skb); |
| 612 | desc->skb = NULL; | 612 | desc->skb = NULL; |
| 613 | if (__netif_subqueue_stopped(dev, queue)) | 613 | if (__netif_subqueue_stopped(dev, queue)) |
| 614 | netif_wake_subqueue(dev, queue); | 614 | netif_wake_subqueue(dev, queue); |
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 82412691ee66..27f6cf140845 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c | |||
| @@ -1740,7 +1740,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, | |||
| 1740 | dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], | 1740 | dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], |
| 1741 | le16_to_cpu(pktlen), DMA_TO_DEVICE); | 1741 | le16_to_cpu(pktlen), DMA_TO_DEVICE); |
| 1742 | } | 1742 | } |
| 1743 | dev_kfree_skb_irq(skb); | 1743 | dev_consume_skb_irq(skb); |
| 1744 | tdinfo->skb = NULL; | 1744 | tdinfo->skb = NULL; |
| 1745 | } | 1745 | } |
| 1746 | 1746 | ||
diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c index 38ac8ef41f5f..56b7791911bf 100644 --- a/drivers/net/fddi/defxx.c +++ b/drivers/net/fddi/defxx.c | |||
| @@ -3512,7 +3512,7 @@ static int dfx_xmt_done(DFX_board_t *bp) | |||
| 3512 | bp->descr_block_virt->xmt_data[comp].long_1, | 3512 | bp->descr_block_virt->xmt_data[comp].long_1, |
| 3513 | p_xmt_drv_descr->p_skb->len, | 3513 | p_xmt_drv_descr->p_skb->len, |
| 3514 | DMA_TO_DEVICE); | 3514 | DMA_TO_DEVICE); |
| 3515 | dev_kfree_skb_irq(p_xmt_drv_descr->p_skb); | 3515 | dev_consume_skb_irq(p_xmt_drv_descr->p_skb); |
| 3516 | 3516 | ||
| 3517 | /* | 3517 | /* |
| 3518 | * Move to start of next packet by updating completion index | 3518 | * Move to start of next packet by updating completion index |
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 58bbba8582b0..3377ac66a347 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c | |||
| @@ -1512,9 +1512,13 @@ static void geneve_link_config(struct net_device *dev, | |||
| 1512 | } | 1512 | } |
| 1513 | #if IS_ENABLED(CONFIG_IPV6) | 1513 | #if IS_ENABLED(CONFIG_IPV6) |
| 1514 | case AF_INET6: { | 1514 | case AF_INET6: { |
| 1515 | struct rt6_info *rt = rt6_lookup(geneve->net, | 1515 | struct rt6_info *rt; |
| 1516 | &info->key.u.ipv6.dst, NULL, 0, | 1516 | |
| 1517 | NULL, 0); | 1517 | if (!__in6_dev_get(dev)) |
| 1518 | break; | ||
| 1519 | |||
| 1520 | rt = rt6_lookup(geneve->net, &info->key.u.ipv6.dst, NULL, 0, | ||
| 1521 | NULL, 0); | ||
| 1518 | 1522 | ||
| 1519 | if (rt && rt->dst.dev) | 1523 | if (rt && rt->dst.dev) |
| 1520 | ldev_mtu = rt->dst.dev->mtu - GENEVE_IPV6_HLEN; | 1524 | ldev_mtu = rt->dst.dev->mtu - GENEVE_IPV6_HLEN; |
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index ef6f766f6389..e859ae2e42d5 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h | |||
| @@ -144,6 +144,8 @@ struct hv_netvsc_packet { | |||
| 144 | u32 total_data_buflen; | 144 | u32 total_data_buflen; |
| 145 | }; | 145 | }; |
| 146 | 146 | ||
| 147 | #define NETVSC_HASH_KEYLEN 40 | ||
| 148 | |||
| 147 | struct netvsc_device_info { | 149 | struct netvsc_device_info { |
| 148 | unsigned char mac_adr[ETH_ALEN]; | 150 | unsigned char mac_adr[ETH_ALEN]; |
| 149 | u32 num_chn; | 151 | u32 num_chn; |
| @@ -151,6 +153,8 @@ struct netvsc_device_info { | |||
| 151 | u32 recv_sections; | 153 | u32 recv_sections; |
| 152 | u32 send_section_size; | 154 | u32 send_section_size; |
| 153 | u32 recv_section_size; | 155 | u32 recv_section_size; |
| 156 | |||
| 157 | u8 rss_key[NETVSC_HASH_KEYLEN]; | ||
| 154 | }; | 158 | }; |
| 155 | 159 | ||
| 156 | enum rndis_device_state { | 160 | enum rndis_device_state { |
| @@ -160,8 +164,6 @@ enum rndis_device_state { | |||
| 160 | RNDIS_DEV_DATAINITIALIZED, | 164 | RNDIS_DEV_DATAINITIALIZED, |
| 161 | }; | 165 | }; |
| 162 | 166 | ||
| 163 | #define NETVSC_HASH_KEYLEN 40 | ||
| 164 | |||
| 165 | struct rndis_device { | 167 | struct rndis_device { |
| 166 | struct net_device *ndev; | 168 | struct net_device *ndev; |
| 167 | 169 | ||
| @@ -209,7 +211,9 @@ int netvsc_recv_callback(struct net_device *net, | |||
| 209 | void netvsc_channel_cb(void *context); | 211 | void netvsc_channel_cb(void *context); |
| 210 | int netvsc_poll(struct napi_struct *napi, int budget); | 212 | int netvsc_poll(struct napi_struct *napi, int budget); |
| 211 | 213 | ||
| 212 | int rndis_set_subchannel(struct net_device *ndev, struct netvsc_device *nvdev); | 214 | int rndis_set_subchannel(struct net_device *ndev, |
| 215 | struct netvsc_device *nvdev, | ||
| 216 | struct netvsc_device_info *dev_info); | ||
| 213 | int rndis_filter_open(struct netvsc_device *nvdev); | 217 | int rndis_filter_open(struct netvsc_device *nvdev); |
| 214 | int rndis_filter_close(struct netvsc_device *nvdev); | 218 | int rndis_filter_close(struct netvsc_device *nvdev); |
| 215 | struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, | 219 | struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, |
| @@ -1177,7 +1181,7 @@ enum ndis_per_pkt_info_type { | |||
| 1177 | 1181 | ||
| 1178 | enum rndis_per_pkt_info_interal_type { | 1182 | enum rndis_per_pkt_info_interal_type { |
| 1179 | RNDIS_PKTINFO_ID = 1, | 1183 | RNDIS_PKTINFO_ID = 1, |
| 1180 | /* Add more memebers here */ | 1184 | /* Add more members here */ |
| 1181 | 1185 | ||
| 1182 | RNDIS_PKTINFO_MAX | 1186 | RNDIS_PKTINFO_MAX |
| 1183 | }; | 1187 | }; |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 922054c1d544..813d195bbd57 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
| @@ -84,7 +84,7 @@ static void netvsc_subchan_work(struct work_struct *w) | |||
| 84 | 84 | ||
| 85 | rdev = nvdev->extension; | 85 | rdev = nvdev->extension; |
| 86 | if (rdev) { | 86 | if (rdev) { |
| 87 | ret = rndis_set_subchannel(rdev->ndev, nvdev); | 87 | ret = rndis_set_subchannel(rdev->ndev, nvdev, NULL); |
| 88 | if (ret == 0) { | 88 | if (ret == 0) { |
| 89 | netif_device_attach(rdev->ndev); | 89 | netif_device_attach(rdev->ndev); |
| 90 | } else { | 90 | } else { |
| @@ -1331,7 +1331,7 @@ void netvsc_channel_cb(void *context) | |||
| 1331 | prefetch(hv_get_ring_buffer(rbi) + rbi->priv_read_index); | 1331 | prefetch(hv_get_ring_buffer(rbi) + rbi->priv_read_index); |
| 1332 | 1332 | ||
| 1333 | if (napi_schedule_prep(&nvchan->napi)) { | 1333 | if (napi_schedule_prep(&nvchan->napi)) { |
| 1334 | /* disable interupts from host */ | 1334 | /* disable interrupts from host */ |
| 1335 | hv_begin_read(rbi); | 1335 | hv_begin_read(rbi); |
| 1336 | 1336 | ||
| 1337 | __napi_schedule_irqoff(&nvchan->napi); | 1337 | __napi_schedule_irqoff(&nvchan->napi); |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 91ed15ea5883..256adbd044f5 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
| @@ -370,7 +370,7 @@ static u32 fill_pg_buf(struct page *page, u32 offset, u32 len, | |||
| 370 | { | 370 | { |
| 371 | int j = 0; | 371 | int j = 0; |
| 372 | 372 | ||
| 373 | /* Deal with compund pages by ignoring unused part | 373 | /* Deal with compound pages by ignoring unused part |
| 374 | * of the page. | 374 | * of the page. |
| 375 | */ | 375 | */ |
| 376 | page += (offset >> PAGE_SHIFT); | 376 | page += (offset >> PAGE_SHIFT); |
| @@ -858,6 +858,39 @@ static void netvsc_get_channels(struct net_device *net, | |||
| 858 | } | 858 | } |
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | /* Alloc struct netvsc_device_info, and initialize it from either existing | ||
| 862 | * struct netvsc_device, or from default values. | ||
| 863 | */ | ||
| 864 | static struct netvsc_device_info *netvsc_devinfo_get | ||
| 865 | (struct netvsc_device *nvdev) | ||
| 866 | { | ||
| 867 | struct netvsc_device_info *dev_info; | ||
| 868 | |||
| 869 | dev_info = kzalloc(sizeof(*dev_info), GFP_ATOMIC); | ||
| 870 | |||
| 871 | if (!dev_info) | ||
| 872 | return NULL; | ||
| 873 | |||
| 874 | if (nvdev) { | ||
| 875 | dev_info->num_chn = nvdev->num_chn; | ||
| 876 | dev_info->send_sections = nvdev->send_section_cnt; | ||
| 877 | dev_info->send_section_size = nvdev->send_section_size; | ||
| 878 | dev_info->recv_sections = nvdev->recv_section_cnt; | ||
| 879 | dev_info->recv_section_size = nvdev->recv_section_size; | ||
| 880 | |||
| 881 | memcpy(dev_info->rss_key, nvdev->extension->rss_key, | ||
| 882 | NETVSC_HASH_KEYLEN); | ||
| 883 | } else { | ||
| 884 | dev_info->num_chn = VRSS_CHANNEL_DEFAULT; | ||
| 885 | dev_info->send_sections = NETVSC_DEFAULT_TX; | ||
| 886 | dev_info->send_section_size = NETVSC_SEND_SECTION_SIZE; | ||
| 887 | dev_info->recv_sections = NETVSC_DEFAULT_RX; | ||
| 888 | dev_info->recv_section_size = NETVSC_RECV_SECTION_SIZE; | ||
| 889 | } | ||
| 890 | |||
| 891 | return dev_info; | ||
| 892 | } | ||
| 893 | |||
| 861 | static int netvsc_detach(struct net_device *ndev, | 894 | static int netvsc_detach(struct net_device *ndev, |
| 862 | struct netvsc_device *nvdev) | 895 | struct netvsc_device *nvdev) |
| 863 | { | 896 | { |
| @@ -909,7 +942,7 @@ static int netvsc_attach(struct net_device *ndev, | |||
| 909 | return PTR_ERR(nvdev); | 942 | return PTR_ERR(nvdev); |
| 910 | 943 | ||
| 911 | if (nvdev->num_chn > 1) { | 944 | if (nvdev->num_chn > 1) { |
| 912 | ret = rndis_set_subchannel(ndev, nvdev); | 945 | ret = rndis_set_subchannel(ndev, nvdev, dev_info); |
| 913 | 946 | ||
| 914 | /* if unavailable, just proceed with one queue */ | 947 | /* if unavailable, just proceed with one queue */ |
| 915 | if (ret) { | 948 | if (ret) { |
| @@ -943,7 +976,7 @@ static int netvsc_set_channels(struct net_device *net, | |||
| 943 | struct net_device_context *net_device_ctx = netdev_priv(net); | 976 | struct net_device_context *net_device_ctx = netdev_priv(net); |
| 944 | struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); | 977 | struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); |
| 945 | unsigned int orig, count = channels->combined_count; | 978 | unsigned int orig, count = channels->combined_count; |
| 946 | struct netvsc_device_info device_info; | 979 | struct netvsc_device_info *device_info; |
| 947 | int ret; | 980 | int ret; |
| 948 | 981 | ||
| 949 | /* We do not support separate count for rx, tx, or other */ | 982 | /* We do not support separate count for rx, tx, or other */ |
| @@ -962,24 +995,26 @@ static int netvsc_set_channels(struct net_device *net, | |||
| 962 | 995 | ||
| 963 | orig = nvdev->num_chn; | 996 | orig = nvdev->num_chn; |
| 964 | 997 | ||
| 965 | memset(&device_info, 0, sizeof(device_info)); | 998 | device_info = netvsc_devinfo_get(nvdev); |
| 966 | device_info.num_chn = count; | 999 | |
| 967 | device_info.send_sections = nvdev->send_section_cnt; | 1000 | if (!device_info) |
| 968 | device_info.send_section_size = nvdev->send_section_size; | 1001 | return -ENOMEM; |
| 969 | device_info.recv_sections = nvdev->recv_section_cnt; | 1002 | |
| 970 | device_info.recv_section_size = nvdev->recv_section_size; | 1003 | device_info->num_chn = count; |
| 971 | 1004 | ||
| 972 | ret = netvsc_detach(net, nvdev); | 1005 | ret = netvsc_detach(net, nvdev); |
| 973 | if (ret) | 1006 | if (ret) |
| 974 | return ret; | 1007 | goto out; |
| 975 | 1008 | ||
| 976 | ret = netvsc_attach(net, &device_info); | 1009 | ret = netvsc_attach(net, device_info); |
| 977 | if (ret) { | 1010 | if (ret) { |
| 978 | device_info.num_chn = orig; | 1011 | device_info->num_chn = orig; |
| 979 | if (netvsc_attach(net, &device_info)) | 1012 | if (netvsc_attach(net, device_info)) |
| 980 | netdev_err(net, "restoring channel setting failed\n"); | 1013 | netdev_err(net, "restoring channel setting failed\n"); |
| 981 | } | 1014 | } |
| 982 | 1015 | ||
| 1016 | out: | ||
| 1017 | kfree(device_info); | ||
| 983 | return ret; | 1018 | return ret; |
| 984 | } | 1019 | } |
| 985 | 1020 | ||
| @@ -1048,48 +1083,45 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) | |||
| 1048 | struct net_device *vf_netdev = rtnl_dereference(ndevctx->vf_netdev); | 1083 | struct net_device *vf_netdev = rtnl_dereference(ndevctx->vf_netdev); |
| 1049 | struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); | 1084 | struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); |
| 1050 | int orig_mtu = ndev->mtu; | 1085 | int orig_mtu = ndev->mtu; |
| 1051 | struct netvsc_device_info device_info; | 1086 | struct netvsc_device_info *device_info; |
| 1052 | int ret = 0; | 1087 | int ret = 0; |
| 1053 | 1088 | ||
| 1054 | if (!nvdev || nvdev->destroy) | 1089 | if (!nvdev || nvdev->destroy) |
| 1055 | return -ENODEV; | 1090 | return -ENODEV; |
| 1056 | 1091 | ||
| 1092 | device_info = netvsc_devinfo_get(nvdev); | ||
| 1093 | |||
| 1094 | if (!device_info) | ||
| 1095 | return -ENOMEM; | ||
| 1096 | |||
| 1057 | /* Change MTU of underlying VF netdev first. */ | 1097 | /* Change MTU of underlying VF netdev first. */ |
| 1058 | if (vf_netdev) { | 1098 | if (vf_netdev) { |
| 1059 | ret = dev_set_mtu(vf_netdev, mtu); | 1099 | ret = dev_set_mtu(vf_netdev, mtu); |
| 1060 | if (ret) | 1100 | if (ret) |
| 1061 | return ret; | 1101 | goto out; |
| 1062 | } | 1102 | } |
| 1063 | 1103 | ||
| 1064 | memset(&device_info, 0, sizeof(device_info)); | ||
| 1065 | device_info.num_chn = nvdev->num_chn; | ||
| 1066 | device_info.send_sections = nvdev->send_section_cnt; | ||
| 1067 | device_info.send_section_size = nvdev->send_section_size; | ||
| 1068 | device_info.recv_sections = nvdev->recv_section_cnt; | ||
| 1069 | device_info.recv_section_size = nvdev->recv_section_size; | ||
| 1070 | |||
| 1071 | ret = netvsc_detach(ndev, nvdev); | 1104 | ret = netvsc_detach(ndev, nvdev); |
| 1072 | if (ret) | 1105 | if (ret) |
| 1073 | goto rollback_vf; | 1106 | goto rollback_vf; |
| 1074 | 1107 | ||
| 1075 | ndev->mtu = mtu; | 1108 | ndev->mtu = mtu; |
| 1076 | 1109 | ||
| 1077 | ret = netvsc_attach(ndev, &device_info); | 1110 | ret = netvsc_attach(ndev, device_info); |
| 1078 | if (ret) | 1111 | if (!ret) |
| 1079 | goto rollback; | 1112 | goto out; |
| 1080 | |||
| 1081 | return 0; | ||
| 1082 | 1113 | ||
| 1083 | rollback: | ||
| 1084 | /* Attempt rollback to original MTU */ | 1114 | /* Attempt rollback to original MTU */ |
| 1085 | ndev->mtu = orig_mtu; | 1115 | ndev->mtu = orig_mtu; |
| 1086 | 1116 | ||
| 1087 | if (netvsc_attach(ndev, &device_info)) | 1117 | if (netvsc_attach(ndev, device_info)) |
| 1088 | netdev_err(ndev, "restoring mtu failed\n"); | 1118 | netdev_err(ndev, "restoring mtu failed\n"); |
| 1089 | rollback_vf: | 1119 | rollback_vf: |
| 1090 | if (vf_netdev) | 1120 | if (vf_netdev) |
| 1091 | dev_set_mtu(vf_netdev, orig_mtu); | 1121 | dev_set_mtu(vf_netdev, orig_mtu); |
| 1092 | 1122 | ||
| 1123 | out: | ||
| 1124 | kfree(device_info); | ||
| 1093 | return ret; | 1125 | return ret; |
| 1094 | } | 1126 | } |
| 1095 | 1127 | ||
| @@ -1674,7 +1706,7 @@ static int netvsc_set_ringparam(struct net_device *ndev, | |||
| 1674 | { | 1706 | { |
| 1675 | struct net_device_context *ndevctx = netdev_priv(ndev); | 1707 | struct net_device_context *ndevctx = netdev_priv(ndev); |
| 1676 | struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); | 1708 | struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); |
| 1677 | struct netvsc_device_info device_info; | 1709 | struct netvsc_device_info *device_info; |
| 1678 | struct ethtool_ringparam orig; | 1710 | struct ethtool_ringparam orig; |
| 1679 | u32 new_tx, new_rx; | 1711 | u32 new_tx, new_rx; |
| 1680 | int ret = 0; | 1712 | int ret = 0; |
| @@ -1694,26 +1726,29 @@ static int netvsc_set_ringparam(struct net_device *ndev, | |||
| 1694 | new_rx == orig.rx_pending) | 1726 | new_rx == orig.rx_pending) |
| 1695 | return 0; /* no change */ | 1727 | return 0; /* no change */ |
| 1696 | 1728 | ||
| 1697 | memset(&device_info, 0, sizeof(device_info)); | 1729 | device_info = netvsc_devinfo_get(nvdev); |
| 1698 | device_info.num_chn = nvdev->num_chn; | 1730 | |
| 1699 | device_info.send_sections = new_tx; | 1731 | if (!device_info) |
| 1700 | device_info.send_section_size = nvdev->send_section_size; | 1732 | return -ENOMEM; |
| 1701 | device_info.recv_sections = new_rx; | 1733 | |
| 1702 | device_info.recv_section_size = nvdev->recv_section_size; | 1734 | device_info->send_sections = new_tx; |
| 1735 | device_info->recv_sections = new_rx; | ||
| 1703 | 1736 | ||
| 1704 | ret = netvsc_detach(ndev, nvdev); | 1737 | ret = netvsc_detach(ndev, nvdev); |
| 1705 | if (ret) | 1738 | if (ret) |
| 1706 | return ret; | 1739 | goto out; |
| 1707 | 1740 | ||
| 1708 | ret = netvsc_attach(ndev, &device_info); | 1741 | ret = netvsc_attach(ndev, device_info); |
| 1709 | if (ret) { | 1742 | if (ret) { |
| 1710 | device_info.send_sections = orig.tx_pending; | 1743 | device_info->send_sections = orig.tx_pending; |
| 1711 | device_info.recv_sections = orig.rx_pending; | 1744 | device_info->recv_sections = orig.rx_pending; |
| 1712 | 1745 | ||
| 1713 | if (netvsc_attach(ndev, &device_info)) | 1746 | if (netvsc_attach(ndev, device_info)) |
| 1714 | netdev_err(ndev, "restoring ringparam failed"); | 1747 | netdev_err(ndev, "restoring ringparam failed"); |
| 1715 | } | 1748 | } |
| 1716 | 1749 | ||
| 1750 | out: | ||
| 1751 | kfree(device_info); | ||
| 1717 | return ret; | 1752 | return ret; |
| 1718 | } | 1753 | } |
| 1719 | 1754 | ||
| @@ -2088,7 +2123,7 @@ static int netvsc_register_vf(struct net_device *vf_netdev) | |||
| 2088 | if (!netvsc_dev || rtnl_dereference(net_device_ctx->vf_netdev)) | 2123 | if (!netvsc_dev || rtnl_dereference(net_device_ctx->vf_netdev)) |
| 2089 | return NOTIFY_DONE; | 2124 | return NOTIFY_DONE; |
| 2090 | 2125 | ||
| 2091 | /* if syntihetic interface is a different namespace, | 2126 | /* if synthetic interface is a different namespace, |
| 2092 | * then move the VF to that namespace; join will be | 2127 | * then move the VF to that namespace; join will be |
| 2093 | * done again in that context. | 2128 | * done again in that context. |
| 2094 | */ | 2129 | */ |
| @@ -2167,7 +2202,7 @@ static int netvsc_probe(struct hv_device *dev, | |||
| 2167 | { | 2202 | { |
| 2168 | struct net_device *net = NULL; | 2203 | struct net_device *net = NULL; |
| 2169 | struct net_device_context *net_device_ctx; | 2204 | struct net_device_context *net_device_ctx; |
| 2170 | struct netvsc_device_info device_info; | 2205 | struct netvsc_device_info *device_info = NULL; |
| 2171 | struct netvsc_device *nvdev; | 2206 | struct netvsc_device *nvdev; |
| 2172 | int ret = -ENOMEM; | 2207 | int ret = -ENOMEM; |
| 2173 | 2208 | ||
| @@ -2214,21 +2249,21 @@ static int netvsc_probe(struct hv_device *dev, | |||
| 2214 | netif_set_real_num_rx_queues(net, 1); | 2249 | netif_set_real_num_rx_queues(net, 1); |
| 2215 | 2250 | ||
| 2216 | /* Notify the netvsc driver of the new device */ | 2251 | /* Notify the netvsc driver of the new device */ |
| 2217 | memset(&device_info, 0, sizeof(device_info)); | 2252 | device_info = netvsc_devinfo_get(NULL); |
| 2218 | device_info.num_chn = VRSS_CHANNEL_DEFAULT; | 2253 | |
| 2219 | device_info.send_sections = NETVSC_DEFAULT_TX; | 2254 | if (!device_info) { |
| 2220 | device_info.send_section_size = NETVSC_SEND_SECTION_SIZE; | 2255 | ret = -ENOMEM; |
| 2221 | device_info.recv_sections = NETVSC_DEFAULT_RX; | 2256 | goto devinfo_failed; |
| 2222 | device_info.recv_section_size = NETVSC_RECV_SECTION_SIZE; | 2257 | } |
| 2223 | 2258 | ||
| 2224 | nvdev = rndis_filter_device_add(dev, &device_info); | 2259 | nvdev = rndis_filter_device_add(dev, device_info); |
| 2225 | if (IS_ERR(nvdev)) { | 2260 | if (IS_ERR(nvdev)) { |
| 2226 | ret = PTR_ERR(nvdev); | 2261 | ret = PTR_ERR(nvdev); |
| 2227 | netdev_err(net, "unable to add netvsc device (ret %d)\n", ret); | 2262 | netdev_err(net, "unable to add netvsc device (ret %d)\n", ret); |
| 2228 | goto rndis_failed; | 2263 | goto rndis_failed; |
| 2229 | } | 2264 | } |
| 2230 | 2265 | ||
| 2231 | memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN); | 2266 | memcpy(net->dev_addr, device_info->mac_adr, ETH_ALEN); |
| 2232 | 2267 | ||
| 2233 | /* We must get rtnl lock before scheduling nvdev->subchan_work, | 2268 | /* We must get rtnl lock before scheduling nvdev->subchan_work, |
| 2234 | * otherwise netvsc_subchan_work() can get rtnl lock first and wait | 2269 | * otherwise netvsc_subchan_work() can get rtnl lock first and wait |
| @@ -2236,7 +2271,7 @@ static int netvsc_probe(struct hv_device *dev, | |||
| 2236 | * netvsc_probe() can't get rtnl lock and as a result vmbus_onoffer() | 2271 | * netvsc_probe() can't get rtnl lock and as a result vmbus_onoffer() |
| 2237 | * -> ... -> device_add() -> ... -> __device_attach() can't get | 2272 | * -> ... -> device_add() -> ... -> __device_attach() can't get |
| 2238 | * the device lock, so all the subchannels can't be processed -- | 2273 | * the device lock, so all the subchannels can't be processed -- |
| 2239 | * finally netvsc_subchan_work() hangs for ever. | 2274 | * finally netvsc_subchan_work() hangs forever. |
| 2240 | */ | 2275 | */ |
| 2241 | rtnl_lock(); | 2276 | rtnl_lock(); |
| 2242 | 2277 | ||
| @@ -2266,12 +2301,16 @@ static int netvsc_probe(struct hv_device *dev, | |||
| 2266 | 2301 | ||
| 2267 | list_add(&net_device_ctx->list, &netvsc_dev_list); | 2302 | list_add(&net_device_ctx->list, &netvsc_dev_list); |
| 2268 | rtnl_unlock(); | 2303 | rtnl_unlock(); |
| 2304 | |||
| 2305 | kfree(device_info); | ||
| 2269 | return 0; | 2306 | return 0; |
| 2270 | 2307 | ||
| 2271 | register_failed: | 2308 | register_failed: |
| 2272 | rtnl_unlock(); | 2309 | rtnl_unlock(); |
| 2273 | rndis_filter_device_remove(dev, nvdev); | 2310 | rndis_filter_device_remove(dev, nvdev); |
| 2274 | rndis_failed: | 2311 | rndis_failed: |
| 2312 | kfree(device_info); | ||
| 2313 | devinfo_failed: | ||
| 2275 | free_percpu(net_device_ctx->vf_stats); | 2314 | free_percpu(net_device_ctx->vf_stats); |
| 2276 | no_stats: | 2315 | no_stats: |
| 2277 | hv_set_drvdata(dev, NULL); | 2316 | hv_set_drvdata(dev, NULL); |
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 8b537a049c1e..73b60592de06 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c | |||
| @@ -774,8 +774,8 @@ cleanup: | |||
| 774 | return ret; | 774 | return ret; |
| 775 | } | 775 | } |
| 776 | 776 | ||
| 777 | int rndis_filter_set_rss_param(struct rndis_device *rdev, | 777 | static int rndis_set_rss_param_msg(struct rndis_device *rdev, |
| 778 | const u8 *rss_key) | 778 | const u8 *rss_key, u16 flag) |
| 779 | { | 779 | { |
| 780 | struct net_device *ndev = rdev->ndev; | 780 | struct net_device *ndev = rdev->ndev; |
| 781 | struct rndis_request *request; | 781 | struct rndis_request *request; |
| @@ -804,7 +804,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, | |||
| 804 | rssp->hdr.type = NDIS_OBJECT_TYPE_RSS_PARAMETERS; | 804 | rssp->hdr.type = NDIS_OBJECT_TYPE_RSS_PARAMETERS; |
| 805 | rssp->hdr.rev = NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2; | 805 | rssp->hdr.rev = NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2; |
| 806 | rssp->hdr.size = sizeof(struct ndis_recv_scale_param); | 806 | rssp->hdr.size = sizeof(struct ndis_recv_scale_param); |
| 807 | rssp->flag = 0; | 807 | rssp->flag = flag; |
| 808 | rssp->hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 | | 808 | rssp->hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 | |
| 809 | NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 | | 809 | NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 | |
| 810 | NDIS_HASH_TCP_IPV6; | 810 | NDIS_HASH_TCP_IPV6; |
| @@ -829,9 +829,12 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, | |||
| 829 | 829 | ||
| 830 | wait_for_completion(&request->wait_event); | 830 | wait_for_completion(&request->wait_event); |
| 831 | set_complete = &request->response_msg.msg.set_complete; | 831 | set_complete = &request->response_msg.msg.set_complete; |
| 832 | if (set_complete->status == RNDIS_STATUS_SUCCESS) | 832 | if (set_complete->status == RNDIS_STATUS_SUCCESS) { |
| 833 | memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN); | 833 | if (!(flag & NDIS_RSS_PARAM_FLAG_DISABLE_RSS) && |
| 834 | else { | 834 | !(flag & NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED)) |
| 835 | memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN); | ||
| 836 | |||
| 837 | } else { | ||
| 835 | netdev_err(ndev, "Fail to set RSS parameters:0x%x\n", | 838 | netdev_err(ndev, "Fail to set RSS parameters:0x%x\n", |
| 836 | set_complete->status); | 839 | set_complete->status); |
| 837 | ret = -EINVAL; | 840 | ret = -EINVAL; |
| @@ -842,6 +845,16 @@ cleanup: | |||
| 842 | return ret; | 845 | return ret; |
| 843 | } | 846 | } |
| 844 | 847 | ||
| 848 | int rndis_filter_set_rss_param(struct rndis_device *rdev, | ||
| 849 | const u8 *rss_key) | ||
| 850 | { | ||
| 851 | /* Disable RSS before change */ | ||
| 852 | rndis_set_rss_param_msg(rdev, rss_key, | ||
| 853 | NDIS_RSS_PARAM_FLAG_DISABLE_RSS); | ||
| 854 | |||
| 855 | return rndis_set_rss_param_msg(rdev, rss_key, 0); | ||
| 856 | } | ||
| 857 | |||
| 845 | static int rndis_filter_query_device_link_status(struct rndis_device *dev, | 858 | static int rndis_filter_query_device_link_status(struct rndis_device *dev, |
| 846 | struct netvsc_device *net_device) | 859 | struct netvsc_device *net_device) |
| 847 | { | 860 | { |
| @@ -1121,7 +1134,9 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc) | |||
| 1121 | * This breaks overlap of processing the host message for the | 1134 | * This breaks overlap of processing the host message for the |
| 1122 | * new primary channel with the initialization of sub-channels. | 1135 | * new primary channel with the initialization of sub-channels. |
| 1123 | */ | 1136 | */ |
| 1124 | int rndis_set_subchannel(struct net_device *ndev, struct netvsc_device *nvdev) | 1137 | int rndis_set_subchannel(struct net_device *ndev, |
| 1138 | struct netvsc_device *nvdev, | ||
| 1139 | struct netvsc_device_info *dev_info) | ||
| 1125 | { | 1140 | { |
| 1126 | struct nvsp_message *init_packet = &nvdev->channel_init_pkt; | 1141 | struct nvsp_message *init_packet = &nvdev->channel_init_pkt; |
| 1127 | struct net_device_context *ndev_ctx = netdev_priv(ndev); | 1142 | struct net_device_context *ndev_ctx = netdev_priv(ndev); |
| @@ -1161,8 +1176,11 @@ int rndis_set_subchannel(struct net_device *ndev, struct netvsc_device *nvdev) | |||
| 1161 | wait_event(nvdev->subchan_open, | 1176 | wait_event(nvdev->subchan_open, |
| 1162 | atomic_read(&nvdev->open_chn) == nvdev->num_chn); | 1177 | atomic_read(&nvdev->open_chn) == nvdev->num_chn); |
| 1163 | 1178 | ||
| 1164 | /* ignore failues from setting rss parameters, still have channels */ | 1179 | /* ignore failures from setting rss parameters, still have channels */ |
| 1165 | rndis_filter_set_rss_param(rdev, netvsc_hash_key); | 1180 | if (dev_info) |
| 1181 | rndis_filter_set_rss_param(rdev, dev_info->rss_key); | ||
| 1182 | else | ||
| 1183 | rndis_filter_set_rss_param(rdev, netvsc_hash_key); | ||
| 1166 | 1184 | ||
| 1167 | netif_set_real_num_tx_queues(ndev, nvdev->num_chn); | 1185 | netif_set_real_num_tx_queues(ndev, nvdev->num_chn); |
| 1168 | netif_set_real_num_rx_queues(ndev, nvdev->num_chn); | 1186 | netif_set_real_num_rx_queues(ndev, nvdev->num_chn); |
diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c index 44de81e5f140..c589f5ae75bb 100644 --- a/drivers/net/ieee802154/mcr20a.c +++ b/drivers/net/ieee802154/mcr20a.c | |||
| @@ -905,9 +905,9 @@ mcr20a_irq_clean_complete(void *context) | |||
| 905 | } | 905 | } |
| 906 | break; | 906 | break; |
| 907 | case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_SEQIRQ): | 907 | case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_SEQIRQ): |
| 908 | /* rx is starting */ | 908 | /* rx is starting */ |
| 909 | dev_dbg(printdev(lp), "RX is starting\n"); | 909 | dev_dbg(printdev(lp), "RX is starting\n"); |
| 910 | mcr20a_handle_rx(lp); | 910 | mcr20a_handle_rx(lp); |
| 911 | break; | 911 | break; |
| 912 | case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ): | 912 | case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ): |
| 913 | if (lp->is_tx) { | 913 | if (lp->is_tx) { |
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 19bdde60680c..7cdac77d0c68 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c | |||
| @@ -100,12 +100,12 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval, | |||
| 100 | err = ipvlan_register_nf_hook(read_pnet(&port->pnet)); | 100 | err = ipvlan_register_nf_hook(read_pnet(&port->pnet)); |
| 101 | if (!err) { | 101 | if (!err) { |
| 102 | mdev->l3mdev_ops = &ipvl_l3mdev_ops; | 102 | mdev->l3mdev_ops = &ipvl_l3mdev_ops; |
| 103 | mdev->priv_flags |= IFF_L3MDEV_MASTER; | 103 | mdev->priv_flags |= IFF_L3MDEV_RX_HANDLER; |
| 104 | } else | 104 | } else |
| 105 | goto fail; | 105 | goto fail; |
| 106 | } else if (port->mode == IPVLAN_MODE_L3S) { | 106 | } else if (port->mode == IPVLAN_MODE_L3S) { |
| 107 | /* Old mode was L3S */ | 107 | /* Old mode was L3S */ |
| 108 | mdev->priv_flags &= ~IFF_L3MDEV_MASTER; | 108 | mdev->priv_flags &= ~IFF_L3MDEV_RX_HANDLER; |
| 109 | ipvlan_unregister_nf_hook(read_pnet(&port->pnet)); | 109 | ipvlan_unregister_nf_hook(read_pnet(&port->pnet)); |
| 110 | mdev->l3mdev_ops = NULL; | 110 | mdev->l3mdev_ops = NULL; |
| 111 | } | 111 | } |
| @@ -167,7 +167,7 @@ static void ipvlan_port_destroy(struct net_device *dev) | |||
| 167 | struct sk_buff *skb; | 167 | struct sk_buff *skb; |
| 168 | 168 | ||
| 169 | if (port->mode == IPVLAN_MODE_L3S) { | 169 | if (port->mode == IPVLAN_MODE_L3S) { |
| 170 | dev->priv_flags &= ~IFF_L3MDEV_MASTER; | 170 | dev->priv_flags &= ~IFF_L3MDEV_RX_HANDLER; |
| 171 | ipvlan_unregister_nf_hook(dev_net(dev)); | 171 | ipvlan_unregister_nf_hook(dev_net(dev)); |
| 172 | dev->l3mdev_ops = NULL; | 172 | dev->l3mdev_ops = NULL; |
| 173 | } | 173 | } |
diff --git a/drivers/net/phy/asix.c b/drivers/net/phy/asix.c index 8ebe7f5484ae..f14ba5366b91 100644 --- a/drivers/net/phy/asix.c +++ b/drivers/net/phy/asix.c | |||
| @@ -1,13 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* Driver for Asix PHYs | 2 | /* Driver for Asix PHYs |
| 3 | * | 3 | * |
| 4 | * Author: Michael Schmitz <schmitzmic@gmail.com> | 4 | * Author: Michael Schmitz <schmitzmic@gmail.com> |
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 9 | * option) any later version. | ||
| 10 | * | ||
| 11 | */ | 5 | */ |
| 12 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
| 13 | #include <linux/errno.h> | 7 | #include <linux/errno.h> |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 18b41bc345ab..6e8807212aa3 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
| @@ -898,14 +898,14 @@ static void decode_txts(struct dp83640_private *dp83640, | |||
| 898 | struct phy_txts *phy_txts) | 898 | struct phy_txts *phy_txts) |
| 899 | { | 899 | { |
| 900 | struct skb_shared_hwtstamps shhwtstamps; | 900 | struct skb_shared_hwtstamps shhwtstamps; |
| 901 | struct dp83640_skb_info *skb_info; | ||
| 901 | struct sk_buff *skb; | 902 | struct sk_buff *skb; |
| 902 | u64 ns; | ||
| 903 | u8 overflow; | 903 | u8 overflow; |
| 904 | u64 ns; | ||
| 904 | 905 | ||
| 905 | /* We must already have the skb that triggered this. */ | 906 | /* We must already have the skb that triggered this. */ |
| 906 | 907 | again: | |
| 907 | skb = skb_dequeue(&dp83640->tx_queue); | 908 | skb = skb_dequeue(&dp83640->tx_queue); |
| 908 | |||
| 909 | if (!skb) { | 909 | if (!skb) { |
| 910 | pr_debug("have timestamp but tx_queue empty\n"); | 910 | pr_debug("have timestamp but tx_queue empty\n"); |
| 911 | return; | 911 | return; |
| @@ -920,6 +920,11 @@ static void decode_txts(struct dp83640_private *dp83640, | |||
| 920 | } | 920 | } |
| 921 | return; | 921 | return; |
| 922 | } | 922 | } |
| 923 | skb_info = (struct dp83640_skb_info *)skb->cb; | ||
| 924 | if (time_after(jiffies, skb_info->tmo)) { | ||
| 925 | kfree_skb(skb); | ||
| 926 | goto again; | ||
| 927 | } | ||
| 923 | 928 | ||
| 924 | ns = phy2txts(phy_txts); | 929 | ns = phy2txts(phy_txts); |
| 925 | memset(&shhwtstamps, 0, sizeof(shhwtstamps)); | 930 | memset(&shhwtstamps, 0, sizeof(shhwtstamps)); |
| @@ -1472,6 +1477,7 @@ static bool dp83640_rxtstamp(struct phy_device *phydev, | |||
| 1472 | static void dp83640_txtstamp(struct phy_device *phydev, | 1477 | static void dp83640_txtstamp(struct phy_device *phydev, |
| 1473 | struct sk_buff *skb, int type) | 1478 | struct sk_buff *skb, int type) |
| 1474 | { | 1479 | { |
| 1480 | struct dp83640_skb_info *skb_info = (struct dp83640_skb_info *)skb->cb; | ||
| 1475 | struct dp83640_private *dp83640 = phydev->priv; | 1481 | struct dp83640_private *dp83640 = phydev->priv; |
| 1476 | 1482 | ||
| 1477 | switch (dp83640->hwts_tx_en) { | 1483 | switch (dp83640->hwts_tx_en) { |
| @@ -1484,6 +1490,7 @@ static void dp83640_txtstamp(struct phy_device *phydev, | |||
| 1484 | /* fall through */ | 1490 | /* fall through */ |
| 1485 | case HWTSTAMP_TX_ON: | 1491 | case HWTSTAMP_TX_ON: |
| 1486 | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; | 1492 | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
| 1493 | skb_info->tmo = jiffies + SKB_TIMESTAMP_TIMEOUT; | ||
| 1487 | skb_queue_tail(&dp83640->tx_queue, skb); | 1494 | skb_queue_tail(&dp83640->tx_queue, skb); |
| 1488 | break; | 1495 | break; |
| 1489 | 1496 | ||
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 2e12f982534f..abb7876a8776 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -847,7 +847,6 @@ static int m88e1510_config_init(struct phy_device *phydev) | |||
| 847 | 847 | ||
| 848 | /* SGMII-to-Copper mode initialization */ | 848 | /* SGMII-to-Copper mode initialization */ |
| 849 | if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { | 849 | if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { |
| 850 | |||
| 851 | /* Select page 18 */ | 850 | /* Select page 18 */ |
| 852 | err = marvell_set_page(phydev, 18); | 851 | err = marvell_set_page(phydev, 18); |
| 853 | if (err < 0) | 852 | if (err < 0) |
| @@ -870,21 +869,6 @@ static int m88e1510_config_init(struct phy_device *phydev) | |||
| 870 | err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); | 869 | err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE); |
| 871 | if (err < 0) | 870 | if (err < 0) |
| 872 | return err; | 871 | return err; |
| 873 | |||
| 874 | /* There appears to be a bug in the 88e1512 when used in | ||
| 875 | * SGMII to copper mode, where the AN advertisement register | ||
| 876 | * clears the pause bits each time a negotiation occurs. | ||
| 877 | * This means we can never be truely sure what was advertised, | ||
| 878 | * so disable Pause support. | ||
| 879 | */ | ||
| 880 | linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, | ||
| 881 | phydev->supported); | ||
| 882 | linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, | ||
| 883 | phydev->supported); | ||
| 884 | linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, | ||
| 885 | phydev->advertising); | ||
| 886 | linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, | ||
| 887 | phydev->advertising); | ||
| 888 | } | 872 | } |
| 889 | 873 | ||
| 890 | return m88e1318_config_init(phydev); | 874 | return m88e1318_config_init(phydev); |
diff --git a/drivers/net/phy/mdio-hisi-femac.c b/drivers/net/phy/mdio-hisi-femac.c index b03fedd6c1d8..287f3ccf1da1 100644 --- a/drivers/net/phy/mdio-hisi-femac.c +++ b/drivers/net/phy/mdio-hisi-femac.c | |||
| @@ -1,20 +1,8 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0+ | ||
| 1 | /* | 2 | /* |
| 2 | * Hisilicon Fast Ethernet MDIO Bus Driver | 3 | * Hisilicon Fast Ethernet MDIO Bus Driver |
| 3 | * | 4 | * |
| 4 | * Copyright (c) 2016 HiSilicon Technologies Co., Ltd. | 5 | * Copyright (c) 2016 HiSilicon Technologies Co., Ltd. |
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | 6 | */ |
| 19 | 7 | ||
| 20 | #include <linux/clk.h> | 8 | #include <linux/clk.h> |
| @@ -163,4 +151,4 @@ module_platform_driver(hisi_femac_mdio_driver); | |||
| 163 | 151 | ||
| 164 | MODULE_DESCRIPTION("Hisilicon Fast Ethernet MAC MDIO interface driver"); | 152 | MODULE_DESCRIPTION("Hisilicon Fast Ethernet MAC MDIO interface driver"); |
| 165 | MODULE_AUTHOR("Dongpo Li <lidongpo@hisilicon.com>"); | 153 | MODULE_AUTHOR("Dongpo Li <lidongpo@hisilicon.com>"); |
| 166 | MODULE_LICENSE("GPL v2"); | 154 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/phy/rockchip.c b/drivers/net/phy/rockchip.c index f1da70b9b55f..95abf7072f32 100644 --- a/drivers/net/phy/rockchip.c +++ b/drivers/net/phy/rockchip.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0+ | ||
| 1 | /** | 2 | /** |
| 2 | * drivers/net/phy/rockchip.c | 3 | * drivers/net/phy/rockchip.c |
| 3 | * | 4 | * |
| @@ -6,12 +7,6 @@ | |||
| 6 | * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd | 7 | * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd |
| 7 | * | 8 | * |
| 8 | * David Wu <david.wu@rock-chips.com> | 9 | * David Wu <david.wu@rock-chips.com> |
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | */ | 10 | */ |
| 16 | 11 | ||
| 17 | #include <linux/ethtool.h> | 12 | #include <linux/ethtool.h> |
| @@ -229,4 +224,4 @@ MODULE_DEVICE_TABLE(mdio, rockchip_phy_tbl); | |||
| 229 | 224 | ||
| 230 | MODULE_AUTHOR("David Wu <david.wu@rock-chips.com>"); | 225 | MODULE_AUTHOR("David Wu <david.wu@rock-chips.com>"); |
| 231 | MODULE_DESCRIPTION("Rockchip Ethernet PHY driver"); | 226 | MODULE_DESCRIPTION("Rockchip Ethernet PHY driver"); |
| 232 | MODULE_LICENSE("GPL v2"); | 227 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 18656c4094b3..fed298c0cb39 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -866,8 +866,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file, | |||
| 866 | if (rtnl_dereference(tun->xdp_prog)) | 866 | if (rtnl_dereference(tun->xdp_prog)) |
| 867 | sock_set_flag(&tfile->sk, SOCK_XDP); | 867 | sock_set_flag(&tfile->sk, SOCK_XDP); |
| 868 | 868 | ||
| 869 | tun_set_real_num_queues(tun); | ||
| 870 | |||
| 871 | /* device is allowed to go away first, so no need to hold extra | 869 | /* device is allowed to go away first, so no need to hold extra |
| 872 | * refcnt. | 870 | * refcnt. |
| 873 | */ | 871 | */ |
| @@ -879,6 +877,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, | |||
| 879 | rcu_assign_pointer(tfile->tun, tun); | 877 | rcu_assign_pointer(tfile->tun, tun); |
| 880 | rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); | 878 | rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); |
| 881 | tun->numqueues++; | 879 | tun->numqueues++; |
| 880 | tun_set_real_num_queues(tun); | ||
| 882 | out: | 881 | out: |
| 883 | return err; | 882 | return err; |
| 884 | } | 883 | } |
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index b654f05b2ccd..3d93993e74da 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
| @@ -739,8 +739,13 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 739 | asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0); | 739 | asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0); |
| 740 | chipcode &= AX_CHIPCODE_MASK; | 740 | chipcode &= AX_CHIPCODE_MASK; |
| 741 | 741 | ||
| 742 | (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) : | 742 | ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) : |
| 743 | ax88772a_hw_reset(dev, 0); | 743 | ax88772a_hw_reset(dev, 0); |
| 744 | |||
| 745 | if (ret < 0) { | ||
| 746 | netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret); | ||
| 747 | return ret; | ||
| 748 | } | ||
| 744 | 749 | ||
| 745 | /* Read PHYID register *AFTER* the PHY was reset properly */ | 750 | /* Read PHYID register *AFTER* the PHY was reset properly */ |
| 746 | phyid = asix_get_phyid(dev); | 751 | phyid = asix_get_phyid(dev); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 8fadd8eaf601..4cfceb789eea 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -57,6 +57,8 @@ module_param(napi_tx, bool, 0644); | |||
| 57 | #define VIRTIO_XDP_TX BIT(0) | 57 | #define VIRTIO_XDP_TX BIT(0) |
| 58 | #define VIRTIO_XDP_REDIR BIT(1) | 58 | #define VIRTIO_XDP_REDIR BIT(1) |
| 59 | 59 | ||
| 60 | #define VIRTIO_XDP_FLAG BIT(0) | ||
| 61 | |||
| 60 | /* RX packet size EWMA. The average packet size is used to determine the packet | 62 | /* RX packet size EWMA. The average packet size is used to determine the packet |
| 61 | * buffer size when refilling RX rings. As the entire RX ring may be refilled | 63 | * buffer size when refilling RX rings. As the entire RX ring may be refilled |
| 62 | * at once, the weight is chosen so that the EWMA will be insensitive to short- | 64 | * at once, the weight is chosen so that the EWMA will be insensitive to short- |
| @@ -252,6 +254,21 @@ struct padded_vnet_hdr { | |||
| 252 | char padding[4]; | 254 | char padding[4]; |
| 253 | }; | 255 | }; |
| 254 | 256 | ||
| 257 | static bool is_xdp_frame(void *ptr) | ||
| 258 | { | ||
| 259 | return (unsigned long)ptr & VIRTIO_XDP_FLAG; | ||
| 260 | } | ||
| 261 | |||
| 262 | static void *xdp_to_ptr(struct xdp_frame *ptr) | ||
| 263 | { | ||
| 264 | return (void *)((unsigned long)ptr | VIRTIO_XDP_FLAG); | ||
| 265 | } | ||
| 266 | |||
| 267 | static struct xdp_frame *ptr_to_xdp(void *ptr) | ||
| 268 | { | ||
| 269 | return (struct xdp_frame *)((unsigned long)ptr & ~VIRTIO_XDP_FLAG); | ||
| 270 | } | ||
| 271 | |||
| 255 | /* Converting between virtqueue no. and kernel tx/rx queue no. | 272 | /* Converting between virtqueue no. and kernel tx/rx queue no. |
| 256 | * 0:rx0 1:tx0 2:rx1 3:tx1 ... 2N:rxN 2N+1:txN 2N+2:cvq | 273 | * 0:rx0 1:tx0 2:rx1 3:tx1 ... 2N:rxN 2N+1:txN 2N+2:cvq |
| 257 | */ | 274 | */ |
| @@ -462,7 +479,8 @@ static int __virtnet_xdp_xmit_one(struct virtnet_info *vi, | |||
| 462 | 479 | ||
| 463 | sg_init_one(sq->sg, xdpf->data, xdpf->len); | 480 | sg_init_one(sq->sg, xdpf->data, xdpf->len); |
| 464 | 481 | ||
| 465 | err = virtqueue_add_outbuf(sq->vq, sq->sg, 1, xdpf, GFP_ATOMIC); | 482 | err = virtqueue_add_outbuf(sq->vq, sq->sg, 1, xdp_to_ptr(xdpf), |
| 483 | GFP_ATOMIC); | ||
| 466 | if (unlikely(err)) | 484 | if (unlikely(err)) |
| 467 | return -ENOSPC; /* Caller handle free/refcnt */ | 485 | return -ENOSPC; /* Caller handle free/refcnt */ |
| 468 | 486 | ||
| @@ -482,36 +500,47 @@ static int virtnet_xdp_xmit(struct net_device *dev, | |||
| 482 | { | 500 | { |
| 483 | struct virtnet_info *vi = netdev_priv(dev); | 501 | struct virtnet_info *vi = netdev_priv(dev); |
| 484 | struct receive_queue *rq = vi->rq; | 502 | struct receive_queue *rq = vi->rq; |
| 485 | struct xdp_frame *xdpf_sent; | ||
| 486 | struct bpf_prog *xdp_prog; | 503 | struct bpf_prog *xdp_prog; |
| 487 | struct send_queue *sq; | 504 | struct send_queue *sq; |
| 488 | unsigned int len; | 505 | unsigned int len; |
| 506 | int packets = 0; | ||
| 507 | int bytes = 0; | ||
| 489 | int drops = 0; | 508 | int drops = 0; |
| 490 | int kicks = 0; | 509 | int kicks = 0; |
| 491 | int ret, err; | 510 | int ret, err; |
| 511 | void *ptr; | ||
| 492 | int i; | 512 | int i; |
| 493 | 513 | ||
| 494 | sq = virtnet_xdp_sq(vi); | ||
| 495 | |||
| 496 | if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) { | ||
| 497 | ret = -EINVAL; | ||
| 498 | drops = n; | ||
| 499 | goto out; | ||
| 500 | } | ||
| 501 | |||
| 502 | /* Only allow ndo_xdp_xmit if XDP is loaded on dev, as this | 514 | /* Only allow ndo_xdp_xmit if XDP is loaded on dev, as this |
| 503 | * indicate XDP resources have been successfully allocated. | 515 | * indicate XDP resources have been successfully allocated. |
| 504 | */ | 516 | */ |
| 505 | xdp_prog = rcu_dereference(rq->xdp_prog); | 517 | xdp_prog = rcu_dereference(rq->xdp_prog); |
| 506 | if (!xdp_prog) { | 518 | if (!xdp_prog) |
| 507 | ret = -ENXIO; | 519 | return -ENXIO; |
| 520 | |||
| 521 | sq = virtnet_xdp_sq(vi); | ||
| 522 | |||
| 523 | if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK)) { | ||
| 524 | ret = -EINVAL; | ||
| 508 | drops = n; | 525 | drops = n; |
| 509 | goto out; | 526 | goto out; |
| 510 | } | 527 | } |
| 511 | 528 | ||
| 512 | /* Free up any pending old buffers before queueing new ones. */ | 529 | /* Free up any pending old buffers before queueing new ones. */ |
| 513 | while ((xdpf_sent = virtqueue_get_buf(sq->vq, &len)) != NULL) | 530 | while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) { |
| 514 | xdp_return_frame(xdpf_sent); | 531 | if (likely(is_xdp_frame(ptr))) { |
| 532 | struct xdp_frame *frame = ptr_to_xdp(ptr); | ||
| 533 | |||
| 534 | bytes += frame->len; | ||
| 535 | xdp_return_frame(frame); | ||
| 536 | } else { | ||
| 537 | struct sk_buff *skb = ptr; | ||
| 538 | |||
| 539 | bytes += skb->len; | ||
| 540 | napi_consume_skb(skb, false); | ||
| 541 | } | ||
| 542 | packets++; | ||
| 543 | } | ||
| 515 | 544 | ||
| 516 | for (i = 0; i < n; i++) { | 545 | for (i = 0; i < n; i++) { |
| 517 | struct xdp_frame *xdpf = frames[i]; | 546 | struct xdp_frame *xdpf = frames[i]; |
| @@ -530,6 +559,8 @@ static int virtnet_xdp_xmit(struct net_device *dev, | |||
| 530 | } | 559 | } |
| 531 | out: | 560 | out: |
| 532 | u64_stats_update_begin(&sq->stats.syncp); | 561 | u64_stats_update_begin(&sq->stats.syncp); |
| 562 | sq->stats.bytes += bytes; | ||
| 563 | sq->stats.packets += packets; | ||
| 533 | sq->stats.xdp_tx += n; | 564 | sq->stats.xdp_tx += n; |
| 534 | sq->stats.xdp_tx_drops += drops; | 565 | sq->stats.xdp_tx_drops += drops; |
| 535 | sq->stats.kicks += kicks; | 566 | sq->stats.kicks += kicks; |
| @@ -1332,18 +1363,26 @@ static int virtnet_receive(struct receive_queue *rq, int budget, | |||
| 1332 | 1363 | ||
| 1333 | static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) | 1364 | static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) |
| 1334 | { | 1365 | { |
| 1335 | struct sk_buff *skb; | ||
| 1336 | unsigned int len; | 1366 | unsigned int len; |
| 1337 | unsigned int packets = 0; | 1367 | unsigned int packets = 0; |
| 1338 | unsigned int bytes = 0; | 1368 | unsigned int bytes = 0; |
| 1369 | void *ptr; | ||
| 1339 | 1370 | ||
| 1340 | while ((skb = virtqueue_get_buf(sq->vq, &len)) != NULL) { | 1371 | while ((ptr = virtqueue_get_buf(sq->vq, &len)) != NULL) { |
| 1341 | pr_debug("Sent skb %p\n", skb); | 1372 | if (likely(!is_xdp_frame(ptr))) { |
| 1373 | struct sk_buff *skb = ptr; | ||
| 1342 | 1374 | ||
| 1343 | bytes += skb->len; | 1375 | pr_debug("Sent skb %p\n", skb); |
| 1344 | packets++; | 1376 | |
| 1377 | bytes += skb->len; | ||
| 1378 | napi_consume_skb(skb, in_napi); | ||
| 1379 | } else { | ||
| 1380 | struct xdp_frame *frame = ptr_to_xdp(ptr); | ||
| 1345 | 1381 | ||
| 1346 | napi_consume_skb(skb, in_napi); | 1382 | bytes += frame->len; |
| 1383 | xdp_return_frame(frame); | ||
| 1384 | } | ||
| 1385 | packets++; | ||
| 1347 | } | 1386 | } |
| 1348 | 1387 | ||
| 1349 | /* Avoid overhead when no packets have been processed | 1388 | /* Avoid overhead when no packets have been processed |
| @@ -1358,6 +1397,16 @@ static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) | |||
| 1358 | u64_stats_update_end(&sq->stats.syncp); | 1397 | u64_stats_update_end(&sq->stats.syncp); |
| 1359 | } | 1398 | } |
| 1360 | 1399 | ||
| 1400 | static bool is_xdp_raw_buffer_queue(struct virtnet_info *vi, int q) | ||
| 1401 | { | ||
| 1402 | if (q < (vi->curr_queue_pairs - vi->xdp_queue_pairs)) | ||
| 1403 | return false; | ||
| 1404 | else if (q < vi->curr_queue_pairs) | ||
| 1405 | return true; | ||
| 1406 | else | ||
| 1407 | return false; | ||
| 1408 | } | ||
| 1409 | |||
| 1361 | static void virtnet_poll_cleantx(struct receive_queue *rq) | 1410 | static void virtnet_poll_cleantx(struct receive_queue *rq) |
| 1362 | { | 1411 | { |
| 1363 | struct virtnet_info *vi = rq->vq->vdev->priv; | 1412 | struct virtnet_info *vi = rq->vq->vdev->priv; |
| @@ -1365,7 +1414,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq) | |||
| 1365 | struct send_queue *sq = &vi->sq[index]; | 1414 | struct send_queue *sq = &vi->sq[index]; |
| 1366 | struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, index); | 1415 | struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, index); |
| 1367 | 1416 | ||
| 1368 | if (!sq->napi.weight) | 1417 | if (!sq->napi.weight || is_xdp_raw_buffer_queue(vi, index)) |
| 1369 | return; | 1418 | return; |
| 1370 | 1419 | ||
| 1371 | if (__netif_tx_trylock(txq)) { | 1420 | if (__netif_tx_trylock(txq)) { |
| @@ -1442,8 +1491,16 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget) | |||
| 1442 | { | 1491 | { |
| 1443 | struct send_queue *sq = container_of(napi, struct send_queue, napi); | 1492 | struct send_queue *sq = container_of(napi, struct send_queue, napi); |
| 1444 | struct virtnet_info *vi = sq->vq->vdev->priv; | 1493 | struct virtnet_info *vi = sq->vq->vdev->priv; |
| 1445 | struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, vq2txq(sq->vq)); | 1494 | unsigned int index = vq2txq(sq->vq); |
| 1495 | struct netdev_queue *txq; | ||
| 1446 | 1496 | ||
| 1497 | if (unlikely(is_xdp_raw_buffer_queue(vi, index))) { | ||
| 1498 | /* We don't need to enable cb for XDP */ | ||
| 1499 | napi_complete_done(napi, 0); | ||
| 1500 | return 0; | ||
| 1501 | } | ||
| 1502 | |||
| 1503 | txq = netdev_get_tx_queue(vi->dev, index); | ||
| 1447 | __netif_tx_lock(txq, raw_smp_processor_id()); | 1504 | __netif_tx_lock(txq, raw_smp_processor_id()); |
| 1448 | free_old_xmit_skbs(sq, true); | 1505 | free_old_xmit_skbs(sq, true); |
| 1449 | __netif_tx_unlock(txq); | 1506 | __netif_tx_unlock(txq); |
| @@ -2395,6 +2452,10 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, | |||
| 2395 | return -ENOMEM; | 2452 | return -ENOMEM; |
| 2396 | } | 2453 | } |
| 2397 | 2454 | ||
| 2455 | old_prog = rtnl_dereference(vi->rq[0].xdp_prog); | ||
| 2456 | if (!prog && !old_prog) | ||
| 2457 | return 0; | ||
| 2458 | |||
| 2398 | if (prog) { | 2459 | if (prog) { |
| 2399 | prog = bpf_prog_add(prog, vi->max_queue_pairs - 1); | 2460 | prog = bpf_prog_add(prog, vi->max_queue_pairs - 1); |
| 2400 | if (IS_ERR(prog)) | 2461 | if (IS_ERR(prog)) |
| @@ -2402,36 +2463,62 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, | |||
| 2402 | } | 2463 | } |
| 2403 | 2464 | ||
| 2404 | /* Make sure NAPI is not using any XDP TX queues for RX. */ | 2465 | /* Make sure NAPI is not using any XDP TX queues for RX. */ |
| 2405 | if (netif_running(dev)) | 2466 | if (netif_running(dev)) { |
| 2406 | for (i = 0; i < vi->max_queue_pairs; i++) | 2467 | for (i = 0; i < vi->max_queue_pairs; i++) { |
| 2407 | napi_disable(&vi->rq[i].napi); | 2468 | napi_disable(&vi->rq[i].napi); |
| 2469 | virtnet_napi_tx_disable(&vi->sq[i].napi); | ||
| 2470 | } | ||
| 2471 | } | ||
| 2472 | |||
| 2473 | if (!prog) { | ||
| 2474 | for (i = 0; i < vi->max_queue_pairs; i++) { | ||
| 2475 | rcu_assign_pointer(vi->rq[i].xdp_prog, prog); | ||
| 2476 | if (i == 0) | ||
| 2477 | virtnet_restore_guest_offloads(vi); | ||
| 2478 | } | ||
| 2479 | synchronize_net(); | ||
| 2480 | } | ||
| 2408 | 2481 | ||
| 2409 | netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); | ||
| 2410 | err = _virtnet_set_queues(vi, curr_qp + xdp_qp); | 2482 | err = _virtnet_set_queues(vi, curr_qp + xdp_qp); |
| 2411 | if (err) | 2483 | if (err) |
| 2412 | goto err; | 2484 | goto err; |
| 2485 | netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); | ||
| 2413 | vi->xdp_queue_pairs = xdp_qp; | 2486 | vi->xdp_queue_pairs = xdp_qp; |
| 2414 | 2487 | ||
| 2415 | for (i = 0; i < vi->max_queue_pairs; i++) { | 2488 | if (prog) { |
| 2416 | old_prog = rtnl_dereference(vi->rq[i].xdp_prog); | 2489 | for (i = 0; i < vi->max_queue_pairs; i++) { |
| 2417 | rcu_assign_pointer(vi->rq[i].xdp_prog, prog); | 2490 | rcu_assign_pointer(vi->rq[i].xdp_prog, prog); |
| 2418 | if (i == 0) { | 2491 | if (i == 0 && !old_prog) |
| 2419 | if (!old_prog) | ||
| 2420 | virtnet_clear_guest_offloads(vi); | 2492 | virtnet_clear_guest_offloads(vi); |
| 2421 | if (!prog) | ||
| 2422 | virtnet_restore_guest_offloads(vi); | ||
| 2423 | } | 2493 | } |
| 2494 | } | ||
| 2495 | |||
| 2496 | for (i = 0; i < vi->max_queue_pairs; i++) { | ||
| 2424 | if (old_prog) | 2497 | if (old_prog) |
| 2425 | bpf_prog_put(old_prog); | 2498 | bpf_prog_put(old_prog); |
| 2426 | if (netif_running(dev)) | 2499 | if (netif_running(dev)) { |
| 2427 | virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); | 2500 | virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); |
| 2501 | virtnet_napi_tx_enable(vi, vi->sq[i].vq, | ||
| 2502 | &vi->sq[i].napi); | ||
| 2503 | } | ||
| 2428 | } | 2504 | } |
| 2429 | 2505 | ||
| 2430 | return 0; | 2506 | return 0; |
| 2431 | 2507 | ||
| 2432 | err: | 2508 | err: |
| 2433 | for (i = 0; i < vi->max_queue_pairs; i++) | 2509 | if (!prog) { |
| 2434 | virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); | 2510 | virtnet_clear_guest_offloads(vi); |
| 2511 | for (i = 0; i < vi->max_queue_pairs; i++) | ||
| 2512 | rcu_assign_pointer(vi->rq[i].xdp_prog, old_prog); | ||
| 2513 | } | ||
| 2514 | |||
| 2515 | if (netif_running(dev)) { | ||
| 2516 | for (i = 0; i < vi->max_queue_pairs; i++) { | ||
| 2517 | virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); | ||
| 2518 | virtnet_napi_tx_enable(vi, vi->sq[i].vq, | ||
| 2519 | &vi->sq[i].napi); | ||
| 2520 | } | ||
| 2521 | } | ||
| 2435 | if (prog) | 2522 | if (prog) |
| 2436 | bpf_prog_sub(prog, vi->max_queue_pairs - 1); | 2523 | bpf_prog_sub(prog, vi->max_queue_pairs - 1); |
| 2437 | return err; | 2524 | return err; |
| @@ -2613,16 +2700,6 @@ static void free_receive_page_frags(struct virtnet_info *vi) | |||
| 2613 | put_page(vi->rq[i].alloc_frag.page); | 2700 | put_page(vi->rq[i].alloc_frag.page); |
| 2614 | } | 2701 | } |
| 2615 | 2702 | ||
| 2616 | static bool is_xdp_raw_buffer_queue(struct virtnet_info *vi, int q) | ||
| 2617 | { | ||
| 2618 | if (q < (vi->curr_queue_pairs - vi->xdp_queue_pairs)) | ||
| 2619 | return false; | ||
| 2620 | else if (q < vi->curr_queue_pairs) | ||
| 2621 | return true; | ||
| 2622 | else | ||
| 2623 | return false; | ||
| 2624 | } | ||
| 2625 | |||
| 2626 | static void free_unused_bufs(struct virtnet_info *vi) | 2703 | static void free_unused_bufs(struct virtnet_info *vi) |
| 2627 | { | 2704 | { |
| 2628 | void *buf; | 2705 | void *buf; |
| @@ -2631,10 +2708,10 @@ static void free_unused_bufs(struct virtnet_info *vi) | |||
| 2631 | for (i = 0; i < vi->max_queue_pairs; i++) { | 2708 | for (i = 0; i < vi->max_queue_pairs; i++) { |
| 2632 | struct virtqueue *vq = vi->sq[i].vq; | 2709 | struct virtqueue *vq = vi->sq[i].vq; |
| 2633 | while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) { | 2710 | while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) { |
| 2634 | if (!is_xdp_raw_buffer_queue(vi, i)) | 2711 | if (!is_xdp_frame(buf)) |
| 2635 | dev_kfree_skb(buf); | 2712 | dev_kfree_skb(buf); |
| 2636 | else | 2713 | else |
| 2637 | put_page(virt_to_head_page(buf)); | 2714 | xdp_return_frame(ptr_to_xdp(buf)); |
| 2638 | } | 2715 | } |
| 2639 | } | 2716 | } |
| 2640 | 2717 | ||
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index c0b0f525c87c..27decf8ae840 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
| @@ -1575,7 +1575,7 @@ try: | |||
| 1575 | dev->stats.tx_packets++; | 1575 | dev->stats.tx_packets++; |
| 1576 | dev->stats.tx_bytes += skb->len; | 1576 | dev->stats.tx_bytes += skb->len; |
| 1577 | } | 1577 | } |
| 1578 | dev_kfree_skb_irq(skb); | 1578 | dev_consume_skb_irq(skb); |
| 1579 | dpriv->tx_skbuff[cur] = NULL; | 1579 | dpriv->tx_skbuff[cur] = NULL; |
| 1580 | ++dpriv->tx_dirty; | 1580 | ++dpriv->tx_dirty; |
| 1581 | } else { | 1581 | } else { |
diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 66d889d54e58..a08f04c3f644 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c | |||
| @@ -482,7 +482,7 @@ static int hdlc_tx_done(struct ucc_hdlc_private *priv) | |||
| 482 | memset(priv->tx_buffer + | 482 | memset(priv->tx_buffer + |
| 483 | (be32_to_cpu(bd->buf) - priv->dma_tx_addr), | 483 | (be32_to_cpu(bd->buf) - priv->dma_tx_addr), |
| 484 | 0, skb->len); | 484 | 0, skb->len); |
| 485 | dev_kfree_skb_irq(skb); | 485 | dev_consume_skb_irq(skb); |
| 486 | 486 | ||
| 487 | priv->tx_skbuff[priv->skb_dirtytx] = NULL; | 487 | priv->tx_skbuff[priv->skb_dirtytx] = NULL; |
| 488 | priv->skb_dirtytx = | 488 | priv->skb_dirtytx = |
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 399b501f3c3c..e8891f5fc83a 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
| @@ -548,7 +548,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { | |||
| 548 | { | 548 | { |
| 549 | .id = WCN3990_HW_1_0_DEV_VERSION, | 549 | .id = WCN3990_HW_1_0_DEV_VERSION, |
| 550 | .dev_id = 0, | 550 | .dev_id = 0, |
| 551 | .bus = ATH10K_BUS_PCI, | 551 | .bus = ATH10K_BUS_SNOC, |
| 552 | .name = "wcn3990 hw1.0", | 552 | .name = "wcn3990 hw1.0", |
| 553 | .continuous_frag_desc = true, | 553 | .continuous_frag_desc = true, |
| 554 | .tx_chain_mask = 0x7, | 554 | .tx_chain_mask = 0x7, |
diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig b/drivers/net/wireless/intel/iwlwifi/Kconfig index 491ca3c8b43c..83d5bceea08f 100644 --- a/drivers/net/wireless/intel/iwlwifi/Kconfig +++ b/drivers/net/wireless/intel/iwlwifi/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config IWLWIFI | 1 | config IWLWIFI |
| 2 | tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " | 2 | tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " |
| 3 | depends on PCI && HAS_IOMEM | 3 | depends on PCI && HAS_IOMEM && CFG80211 |
| 4 | select FW_LOADER | 4 | select FW_LOADER |
| 5 | ---help--- | 5 | ---help--- |
| 6 | Select to build the driver supporting the: | 6 | Select to build the driver supporting the: |
| @@ -47,6 +47,7 @@ if IWLWIFI | |||
| 47 | config IWLWIFI_LEDS | 47 | config IWLWIFI_LEDS |
| 48 | bool | 48 | bool |
| 49 | depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI | 49 | depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI |
| 50 | depends on IWLMVM || IWLDVM | ||
| 50 | select LEDS_TRIGGERS | 51 | select LEDS_TRIGGERS |
| 51 | select MAC80211_LEDS | 52 | select MAC80211_LEDS |
| 52 | default y | 53 | default y |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 3a4b8786f7ea..320edcac4699 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
| @@ -2761,6 +2761,11 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, | |||
| 2761 | BIT(NL80211_CHAN_WIDTH_160); | 2761 | BIT(NL80211_CHAN_WIDTH_160); |
| 2762 | } | 2762 | } |
| 2763 | 2763 | ||
| 2764 | if (!n_limits) { | ||
| 2765 | err = -EINVAL; | ||
| 2766 | goto failed_hw; | ||
| 2767 | } | ||
| 2768 | |||
| 2764 | data->if_combination.n_limits = n_limits; | 2769 | data->if_combination.n_limits = n_limits; |
| 2765 | data->if_combination.max_interfaces = 2048; | 2770 | data->if_combination.max_interfaces = 2048; |
| 2766 | data->if_combination.limits = data->if_limits; | 2771 | data->if_combination.limits = data->if_limits; |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c index 497e762978cc..b2cabce1d74d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c | |||
| @@ -212,24 +212,24 @@ void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev) | |||
| 212 | mt76x02_add_rate_power_offset(t, delta); | 212 | mt76x02_add_rate_power_offset(t, delta); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info) | 215 | void mt76x0_get_power_info(struct mt76x02_dev *dev, s8 *tp) |
| 216 | { | 216 | { |
| 217 | struct mt76x0_chan_map { | 217 | struct mt76x0_chan_map { |
| 218 | u8 chan; | 218 | u8 chan; |
| 219 | u8 offset; | 219 | u8 offset; |
| 220 | } chan_map[] = { | 220 | } chan_map[] = { |
| 221 | { 2, 0 }, { 4, 1 }, { 6, 2 }, { 8, 3 }, | 221 | { 2, 0 }, { 4, 2 }, { 6, 4 }, { 8, 6 }, |
| 222 | { 10, 4 }, { 12, 5 }, { 14, 6 }, { 38, 0 }, | 222 | { 10, 8 }, { 12, 10 }, { 14, 12 }, { 38, 0 }, |
| 223 | { 44, 1 }, { 48, 2 }, { 54, 3 }, { 60, 4 }, | 223 | { 44, 2 }, { 48, 4 }, { 54, 6 }, { 60, 8 }, |
| 224 | { 64, 5 }, { 102, 6 }, { 108, 7 }, { 112, 8 }, | 224 | { 64, 10 }, { 102, 12 }, { 108, 14 }, { 112, 16 }, |
| 225 | { 118, 9 }, { 124, 10 }, { 128, 11 }, { 134, 12 }, | 225 | { 118, 18 }, { 124, 20 }, { 128, 22 }, { 134, 24 }, |
| 226 | { 140, 13 }, { 151, 14 }, { 157, 15 }, { 161, 16 }, | 226 | { 140, 26 }, { 151, 28 }, { 157, 30 }, { 161, 32 }, |
| 227 | { 167, 17 }, { 171, 18 }, { 173, 19 }, | 227 | { 167, 34 }, { 171, 36 }, { 175, 38 }, |
| 228 | }; | 228 | }; |
| 229 | struct ieee80211_channel *chan = dev->mt76.chandef.chan; | 229 | struct ieee80211_channel *chan = dev->mt76.chandef.chan; |
| 230 | u8 offset, addr; | 230 | u8 offset, addr; |
| 231 | int i, idx = 0; | ||
| 231 | u16 data; | 232 | u16 data; |
| 232 | int i; | ||
| 233 | 233 | ||
| 234 | if (mt76x0_tssi_enabled(dev)) { | 234 | if (mt76x0_tssi_enabled(dev)) { |
| 235 | s8 target_power; | 235 | s8 target_power; |
| @@ -239,14 +239,14 @@ void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info) | |||
| 239 | else | 239 | else |
| 240 | data = mt76x02_eeprom_get(dev, MT_EE_2G_TARGET_POWER); | 240 | data = mt76x02_eeprom_get(dev, MT_EE_2G_TARGET_POWER); |
| 241 | target_power = (data & 0xff) - dev->mt76.rate_power.ofdm[7]; | 241 | target_power = (data & 0xff) - dev->mt76.rate_power.ofdm[7]; |
| 242 | info[0] = target_power + mt76x0_get_delta(dev); | 242 | *tp = target_power + mt76x0_get_delta(dev); |
| 243 | info[1] = 0; | ||
| 244 | 243 | ||
| 245 | return; | 244 | return; |
| 246 | } | 245 | } |
| 247 | 246 | ||
| 248 | for (i = 0; i < ARRAY_SIZE(chan_map); i++) { | 247 | for (i = 0; i < ARRAY_SIZE(chan_map); i++) { |
| 249 | if (chan_map[i].chan <= chan->hw_value) { | 248 | if (chan->hw_value <= chan_map[i].chan) { |
| 249 | idx = (chan->hw_value == chan_map[i].chan); | ||
| 250 | offset = chan_map[i].offset; | 250 | offset = chan_map[i].offset; |
| 251 | break; | 251 | break; |
| 252 | } | 252 | } |
| @@ -258,13 +258,16 @@ void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info) | |||
| 258 | addr = MT_EE_TX_POWER_DELTA_BW80 + offset; | 258 | addr = MT_EE_TX_POWER_DELTA_BW80 + offset; |
| 259 | } else { | 259 | } else { |
| 260 | switch (chan->hw_value) { | 260 | switch (chan->hw_value) { |
| 261 | case 42: | ||
| 262 | offset = 2; | ||
| 263 | break; | ||
| 261 | case 58: | 264 | case 58: |
| 262 | offset = 8; | 265 | offset = 8; |
| 263 | break; | 266 | break; |
| 264 | case 106: | 267 | case 106: |
| 265 | offset = 14; | 268 | offset = 14; |
| 266 | break; | 269 | break; |
| 267 | case 112: | 270 | case 122: |
| 268 | offset = 20; | 271 | offset = 20; |
| 269 | break; | 272 | break; |
| 270 | case 155: | 273 | case 155: |
| @@ -277,14 +280,9 @@ void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info) | |||
| 277 | } | 280 | } |
| 278 | 281 | ||
| 279 | data = mt76x02_eeprom_get(dev, addr); | 282 | data = mt76x02_eeprom_get(dev, addr); |
| 280 | 283 | *tp = data >> (8 * idx); | |
| 281 | info[0] = data; | 284 | if (*tp < 0 || *tp > 0x3f) |
| 282 | if (!info[0] || info[0] > 0x3f) | 285 | *tp = 5; |
| 283 | info[0] = 5; | ||
| 284 | |||
| 285 | info[1] = data >> 8; | ||
| 286 | if (!info[1] || info[1] > 0x3f) | ||
| 287 | info[1] = 5; | ||
| 288 | } | 286 | } |
| 289 | 287 | ||
| 290 | static int mt76x0_check_eeprom(struct mt76x02_dev *dev) | 288 | static int mt76x0_check_eeprom(struct mt76x02_dev *dev) |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h index ee9ade9f3c8b..42b259f90b6d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.h | |||
| @@ -26,7 +26,7 @@ struct mt76x02_dev; | |||
| 26 | int mt76x0_eeprom_init(struct mt76x02_dev *dev); | 26 | int mt76x0_eeprom_init(struct mt76x02_dev *dev); |
| 27 | void mt76x0_read_rx_gain(struct mt76x02_dev *dev); | 27 | void mt76x0_read_rx_gain(struct mt76x02_dev *dev); |
| 28 | void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev); | 28 | void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev); |
| 29 | void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info); | 29 | void mt76x0_get_power_info(struct mt76x02_dev *dev, s8 *tp); |
| 30 | 30 | ||
| 31 | static inline s8 s6_to_s8(u32 val) | 31 | static inline s8 s6_to_s8(u32 val) |
| 32 | { | 32 | { |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c index 1eb1a802ed20..b6166703ad76 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | |||
| @@ -845,17 +845,17 @@ static void mt76x0_phy_tssi_calibrate(struct mt76x02_dev *dev) | |||
| 845 | void mt76x0_phy_set_txpower(struct mt76x02_dev *dev) | 845 | void mt76x0_phy_set_txpower(struct mt76x02_dev *dev) |
| 846 | { | 846 | { |
| 847 | struct mt76_rate_power *t = &dev->mt76.rate_power; | 847 | struct mt76_rate_power *t = &dev->mt76.rate_power; |
| 848 | u8 info[2]; | 848 | s8 info; |
| 849 | 849 | ||
| 850 | mt76x0_get_tx_power_per_rate(dev); | 850 | mt76x0_get_tx_power_per_rate(dev); |
| 851 | mt76x0_get_power_info(dev, info); | 851 | mt76x0_get_power_info(dev, &info); |
| 852 | 852 | ||
| 853 | mt76x02_add_rate_power_offset(t, info[0]); | 853 | mt76x02_add_rate_power_offset(t, info); |
| 854 | mt76x02_limit_rate_power(t, dev->mt76.txpower_conf); | 854 | mt76x02_limit_rate_power(t, dev->mt76.txpower_conf); |
| 855 | dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t); | 855 | dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t); |
| 856 | mt76x02_add_rate_power_offset(t, -info[0]); | 856 | mt76x02_add_rate_power_offset(t, -info); |
| 857 | 857 | ||
| 858 | mt76x02_phy_set_txpower(dev, info[0], info[1]); | 858 | mt76x02_phy_set_txpower(dev, info, info); |
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on) | 861 | void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on) |
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index bd10165d7eec..4d4b07701149 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c | |||
| @@ -164,6 +164,12 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | sdio_claim_host(func); | 166 | sdio_claim_host(func); |
| 167 | /* | ||
| 168 | * To guarantee that the SDIO card is power cycled, as required to make | ||
| 169 | * the FW programming to succeed, let's do a brute force HW reset. | ||
| 170 | */ | ||
| 171 | mmc_hw_reset(card->host); | ||
| 172 | |||
| 167 | sdio_enable_func(func); | 173 | sdio_enable_func(func); |
| 168 | sdio_release_host(func); | 174 | sdio_release_host(func); |
| 169 | 175 | ||
| @@ -174,20 +180,13 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) | |||
| 174 | { | 180 | { |
| 175 | struct sdio_func *func = dev_to_sdio_func(glue->dev); | 181 | struct sdio_func *func = dev_to_sdio_func(glue->dev); |
| 176 | struct mmc_card *card = func->card; | 182 | struct mmc_card *card = func->card; |
| 177 | int error; | ||
| 178 | 183 | ||
| 179 | sdio_claim_host(func); | 184 | sdio_claim_host(func); |
| 180 | sdio_disable_func(func); | 185 | sdio_disable_func(func); |
| 181 | sdio_release_host(func); | 186 | sdio_release_host(func); |
| 182 | 187 | ||
| 183 | /* Let runtime PM know the card is powered off */ | 188 | /* Let runtime PM know the card is powered off */ |
| 184 | error = pm_runtime_put(&card->dev); | 189 | pm_runtime_put(&card->dev); |
| 185 | if (error < 0 && error != -EBUSY) { | ||
| 186 | dev_err(&card->dev, "%s failed: %i\n", __func__, error); | ||
| 187 | |||
| 188 | return error; | ||
| 189 | } | ||
| 190 | |||
| 191 | return 0; | 190 | return 0; |
| 192 | } | 191 | } |
| 193 | 192 | ||
diff --git a/drivers/net/wireless/virt_wifi.c b/drivers/net/wireless/virt_wifi.c index 64b218699656..3a93e4d9828b 100644 --- a/drivers/net/wireless/virt_wifi.c +++ b/drivers/net/wireless/virt_wifi.c | |||
| @@ -530,8 +530,10 @@ static int virt_wifi_newlink(struct net *src_net, struct net_device *dev, | |||
| 530 | SET_NETDEV_DEV(dev, &priv->lowerdev->dev); | 530 | SET_NETDEV_DEV(dev, &priv->lowerdev->dev); |
| 531 | dev->ieee80211_ptr = kzalloc(sizeof(*dev->ieee80211_ptr), GFP_KERNEL); | 531 | dev->ieee80211_ptr = kzalloc(sizeof(*dev->ieee80211_ptr), GFP_KERNEL); |
| 532 | 532 | ||
| 533 | if (!dev->ieee80211_ptr) | 533 | if (!dev->ieee80211_ptr) { |
| 534 | err = -ENOMEM; | ||
| 534 | goto remove_handler; | 535 | goto remove_handler; |
| 536 | } | ||
| 535 | 537 | ||
| 536 | dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION; | 538 | dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION; |
| 537 | dev->ieee80211_ptr->wiphy = common_wiphy; | 539 | dev->ieee80211_ptr->wiphy = common_wiphy; |
diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c index 0cf58cabc9ed..3cf50274fadb 100644 --- a/drivers/nvdimm/dimm.c +++ b/drivers/nvdimm/dimm.c | |||
| @@ -26,6 +26,12 @@ static int nvdimm_probe(struct device *dev) | |||
| 26 | struct nvdimm_drvdata *ndd; | 26 | struct nvdimm_drvdata *ndd; |
| 27 | int rc; | 27 | int rc; |
| 28 | 28 | ||
| 29 | rc = nvdimm_security_setup_events(dev); | ||
| 30 | if (rc < 0) { | ||
| 31 | dev_err(dev, "security event setup failed: %d\n", rc); | ||
| 32 | return rc; | ||
| 33 | } | ||
| 34 | |||
| 29 | rc = nvdimm_check_config_data(dev); | 35 | rc = nvdimm_check_config_data(dev); |
| 30 | if (rc) { | 36 | if (rc) { |
| 31 | /* not required for non-aliased nvdimm, ex. NVDIMM-N */ | 37 | /* not required for non-aliased nvdimm, ex. NVDIMM-N */ |
diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index 4890310df874..efe412a6b5b9 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c | |||
| @@ -578,13 +578,25 @@ struct nvdimm *__nvdimm_create(struct nvdimm_bus *nvdimm_bus, | |||
| 578 | } | 578 | } |
| 579 | EXPORT_SYMBOL_GPL(__nvdimm_create); | 579 | EXPORT_SYMBOL_GPL(__nvdimm_create); |
| 580 | 580 | ||
| 581 | int nvdimm_security_setup_events(struct nvdimm *nvdimm) | 581 | static void shutdown_security_notify(void *data) |
| 582 | { | 582 | { |
| 583 | nvdimm->sec.overwrite_state = sysfs_get_dirent(nvdimm->dev.kobj.sd, | 583 | struct nvdimm *nvdimm = data; |
| 584 | "security"); | 584 | |
| 585 | sysfs_put(nvdimm->sec.overwrite_state); | ||
| 586 | } | ||
| 587 | |||
| 588 | int nvdimm_security_setup_events(struct device *dev) | ||
| 589 | { | ||
| 590 | struct nvdimm *nvdimm = to_nvdimm(dev); | ||
| 591 | |||
| 592 | if (nvdimm->sec.state < 0 || !nvdimm->sec.ops | ||
| 593 | || !nvdimm->sec.ops->overwrite) | ||
| 594 | return 0; | ||
| 595 | nvdimm->sec.overwrite_state = sysfs_get_dirent(dev->kobj.sd, "security"); | ||
| 585 | if (!nvdimm->sec.overwrite_state) | 596 | if (!nvdimm->sec.overwrite_state) |
| 586 | return -ENODEV; | 597 | return -ENOMEM; |
| 587 | return 0; | 598 | |
| 599 | return devm_add_action_or_reset(dev, shutdown_security_notify, nvdimm); | ||
| 588 | } | 600 | } |
| 589 | EXPORT_SYMBOL_GPL(nvdimm_security_setup_events); | 601 | EXPORT_SYMBOL_GPL(nvdimm_security_setup_events); |
| 590 | 602 | ||
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index cfde992684e7..379bf4305e61 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h | |||
| @@ -250,6 +250,7 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys, | |||
| 250 | void nvdimm_set_aliasing(struct device *dev); | 250 | void nvdimm_set_aliasing(struct device *dev); |
| 251 | void nvdimm_set_locked(struct device *dev); | 251 | void nvdimm_set_locked(struct device *dev); |
| 252 | void nvdimm_clear_locked(struct device *dev); | 252 | void nvdimm_clear_locked(struct device *dev); |
| 253 | int nvdimm_security_setup_events(struct device *dev); | ||
| 253 | #if IS_ENABLED(CONFIG_NVDIMM_KEYS) | 254 | #if IS_ENABLED(CONFIG_NVDIMM_KEYS) |
| 254 | int nvdimm_security_unlock(struct device *dev); | 255 | int nvdimm_security_unlock(struct device *dev); |
| 255 | #else | 256 | #else |
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 150e49723c15..6a9dd68c0f4f 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
| @@ -1253,6 +1253,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, | |||
| 1253 | * effects say only one namespace is affected. | 1253 | * effects say only one namespace is affected. |
| 1254 | */ | 1254 | */ |
| 1255 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { | 1255 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { |
| 1256 | mutex_lock(&ctrl->scan_lock); | ||
| 1256 | nvme_start_freeze(ctrl); | 1257 | nvme_start_freeze(ctrl); |
| 1257 | nvme_wait_freeze(ctrl); | 1258 | nvme_wait_freeze(ctrl); |
| 1258 | } | 1259 | } |
| @@ -1281,8 +1282,10 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) | |||
| 1281 | */ | 1282 | */ |
| 1282 | if (effects & NVME_CMD_EFFECTS_LBCC) | 1283 | if (effects & NVME_CMD_EFFECTS_LBCC) |
| 1283 | nvme_update_formats(ctrl); | 1284 | nvme_update_formats(ctrl); |
| 1284 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) | 1285 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { |
| 1285 | nvme_unfreeze(ctrl); | 1286 | nvme_unfreeze(ctrl); |
| 1287 | mutex_unlock(&ctrl->scan_lock); | ||
| 1288 | } | ||
| 1286 | if (effects & NVME_CMD_EFFECTS_CCC) | 1289 | if (effects & NVME_CMD_EFFECTS_CCC) |
| 1287 | nvme_init_identify(ctrl); | 1290 | nvme_init_identify(ctrl); |
| 1288 | if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) | 1291 | if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) |
| @@ -3401,6 +3404,7 @@ static void nvme_scan_work(struct work_struct *work) | |||
| 3401 | if (nvme_identify_ctrl(ctrl, &id)) | 3404 | if (nvme_identify_ctrl(ctrl, &id)) |
| 3402 | return; | 3405 | return; |
| 3403 | 3406 | ||
| 3407 | mutex_lock(&ctrl->scan_lock); | ||
| 3404 | nn = le32_to_cpu(id->nn); | 3408 | nn = le32_to_cpu(id->nn); |
| 3405 | if (ctrl->vs >= NVME_VS(1, 1, 0) && | 3409 | if (ctrl->vs >= NVME_VS(1, 1, 0) && |
| 3406 | !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { | 3410 | !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { |
| @@ -3409,6 +3413,7 @@ static void nvme_scan_work(struct work_struct *work) | |||
| 3409 | } | 3413 | } |
| 3410 | nvme_scan_ns_sequential(ctrl, nn); | 3414 | nvme_scan_ns_sequential(ctrl, nn); |
| 3411 | out_free_id: | 3415 | out_free_id: |
| 3416 | mutex_unlock(&ctrl->scan_lock); | ||
| 3412 | kfree(id); | 3417 | kfree(id); |
| 3413 | down_write(&ctrl->namespaces_rwsem); | 3418 | down_write(&ctrl->namespaces_rwsem); |
| 3414 | list_sort(NULL, &ctrl->namespaces, ns_cmp); | 3419 | list_sort(NULL, &ctrl->namespaces, ns_cmp); |
| @@ -3652,6 +3657,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, | |||
| 3652 | 3657 | ||
| 3653 | ctrl->state = NVME_CTRL_NEW; | 3658 | ctrl->state = NVME_CTRL_NEW; |
| 3654 | spin_lock_init(&ctrl->lock); | 3659 | spin_lock_init(&ctrl->lock); |
| 3660 | mutex_init(&ctrl->scan_lock); | ||
| 3655 | INIT_LIST_HEAD(&ctrl->namespaces); | 3661 | INIT_LIST_HEAD(&ctrl->namespaces); |
| 3656 | init_rwsem(&ctrl->namespaces_rwsem); | 3662 | init_rwsem(&ctrl->namespaces_rwsem); |
| 3657 | ctrl->dev = dev; | 3663 | ctrl->dev = dev; |
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index df4b3a6db51b..b9fff3b8ed1b 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c | |||
| @@ -545,8 +545,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) | |||
| 545 | timer_setup(&ctrl->anatt_timer, nvme_anatt_timeout, 0); | 545 | timer_setup(&ctrl->anatt_timer, nvme_anatt_timeout, 0); |
| 546 | ctrl->ana_log_size = sizeof(struct nvme_ana_rsp_hdr) + | 546 | ctrl->ana_log_size = sizeof(struct nvme_ana_rsp_hdr) + |
| 547 | ctrl->nanagrpid * sizeof(struct nvme_ana_group_desc); | 547 | ctrl->nanagrpid * sizeof(struct nvme_ana_group_desc); |
| 548 | if (!(ctrl->anacap & (1 << 6))) | 548 | ctrl->ana_log_size += ctrl->max_namespaces * sizeof(__le32); |
| 549 | ctrl->ana_log_size += ctrl->max_namespaces * sizeof(__le32); | ||
| 550 | 549 | ||
| 551 | if (ctrl->ana_log_size > ctrl->max_hw_sectors << SECTOR_SHIFT) { | 550 | if (ctrl->ana_log_size > ctrl->max_hw_sectors << SECTOR_SHIFT) { |
| 552 | dev_err(ctrl->device, | 551 | dev_err(ctrl->device, |
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index ab961bdeea89..c4a1bb41abf0 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h | |||
| @@ -154,6 +154,7 @@ struct nvme_ctrl { | |||
| 154 | enum nvme_ctrl_state state; | 154 | enum nvme_ctrl_state state; |
| 155 | bool identified; | 155 | bool identified; |
| 156 | spinlock_t lock; | 156 | spinlock_t lock; |
| 157 | struct mutex scan_lock; | ||
| 157 | const struct nvme_ctrl_ops *ops; | 158 | const struct nvme_ctrl_ops *ops; |
| 158 | struct request_queue *admin_q; | 159 | struct request_queue *admin_q; |
| 159 | struct request_queue *connect_q; | 160 | struct request_queue *connect_q; |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 9bc585415d9b..022ea1ee63f8 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
| @@ -2557,16 +2557,7 @@ static void nvme_reset_work(struct work_struct *work) | |||
| 2557 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) | 2557 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) |
| 2558 | nvme_dev_disable(dev, false); | 2558 | nvme_dev_disable(dev, false); |
| 2559 | 2559 | ||
| 2560 | /* | 2560 | mutex_lock(&dev->shutdown_lock); |
| 2561 | * Introduce CONNECTING state from nvme-fc/rdma transports to mark the | ||
| 2562 | * initializing procedure here. | ||
| 2563 | */ | ||
| 2564 | if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { | ||
| 2565 | dev_warn(dev->ctrl.device, | ||
| 2566 | "failed to mark controller CONNECTING\n"); | ||
| 2567 | goto out; | ||
| 2568 | } | ||
| 2569 | |||
| 2570 | result = nvme_pci_enable(dev); | 2561 | result = nvme_pci_enable(dev); |
| 2571 | if (result) | 2562 | if (result) |
| 2572 | goto out; | 2563 | goto out; |
| @@ -2585,6 +2576,17 @@ static void nvme_reset_work(struct work_struct *work) | |||
| 2585 | */ | 2576 | */ |
| 2586 | dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1; | 2577 | dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1; |
| 2587 | dev->ctrl.max_segments = NVME_MAX_SEGS; | 2578 | dev->ctrl.max_segments = NVME_MAX_SEGS; |
| 2579 | mutex_unlock(&dev->shutdown_lock); | ||
| 2580 | |||
| 2581 | /* | ||
| 2582 | * Introduce CONNECTING state from nvme-fc/rdma transports to mark the | ||
| 2583 | * initializing procedure here. | ||
| 2584 | */ | ||
| 2585 | if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { | ||
| 2586 | dev_warn(dev->ctrl.device, | ||
| 2587 | "failed to mark controller CONNECTING\n"); | ||
| 2588 | goto out; | ||
| 2589 | } | ||
| 2588 | 2590 | ||
| 2589 | result = nvme_init_identify(&dev->ctrl); | 2591 | result = nvme_init_identify(&dev->ctrl); |
| 2590 | if (result) | 2592 | if (result) |
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 0a2fd2949ad7..52abc3a6de12 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c | |||
| @@ -119,6 +119,7 @@ struct nvme_rdma_ctrl { | |||
| 119 | 119 | ||
| 120 | struct nvme_ctrl ctrl; | 120 | struct nvme_ctrl ctrl; |
| 121 | bool use_inline_data; | 121 | bool use_inline_data; |
| 122 | u32 io_queues[HCTX_MAX_TYPES]; | ||
| 122 | }; | 123 | }; |
| 123 | 124 | ||
| 124 | static inline struct nvme_rdma_ctrl *to_rdma_ctrl(struct nvme_ctrl *ctrl) | 125 | static inline struct nvme_rdma_ctrl *to_rdma_ctrl(struct nvme_ctrl *ctrl) |
| @@ -165,8 +166,8 @@ static inline int nvme_rdma_queue_idx(struct nvme_rdma_queue *queue) | |||
| 165 | static bool nvme_rdma_poll_queue(struct nvme_rdma_queue *queue) | 166 | static bool nvme_rdma_poll_queue(struct nvme_rdma_queue *queue) |
| 166 | { | 167 | { |
| 167 | return nvme_rdma_queue_idx(queue) > | 168 | return nvme_rdma_queue_idx(queue) > |
| 168 | queue->ctrl->ctrl.opts->nr_io_queues + | 169 | queue->ctrl->io_queues[HCTX_TYPE_DEFAULT] + |
| 169 | queue->ctrl->ctrl.opts->nr_write_queues; | 170 | queue->ctrl->io_queues[HCTX_TYPE_READ]; |
| 170 | } | 171 | } |
| 171 | 172 | ||
| 172 | static inline size_t nvme_rdma_inline_data_size(struct nvme_rdma_queue *queue) | 173 | static inline size_t nvme_rdma_inline_data_size(struct nvme_rdma_queue *queue) |
| @@ -661,8 +662,21 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl) | |||
| 661 | nr_io_queues = min_t(unsigned int, nr_io_queues, | 662 | nr_io_queues = min_t(unsigned int, nr_io_queues, |
| 662 | ibdev->num_comp_vectors); | 663 | ibdev->num_comp_vectors); |
| 663 | 664 | ||
| 664 | nr_io_queues += min(opts->nr_write_queues, num_online_cpus()); | 665 | if (opts->nr_write_queues) { |
| 665 | nr_io_queues += min(opts->nr_poll_queues, num_online_cpus()); | 666 | ctrl->io_queues[HCTX_TYPE_DEFAULT] = |
| 667 | min(opts->nr_write_queues, nr_io_queues); | ||
| 668 | nr_io_queues += ctrl->io_queues[HCTX_TYPE_DEFAULT]; | ||
| 669 | } else { | ||
| 670 | ctrl->io_queues[HCTX_TYPE_DEFAULT] = nr_io_queues; | ||
| 671 | } | ||
| 672 | |||
| 673 | ctrl->io_queues[HCTX_TYPE_READ] = nr_io_queues; | ||
| 674 | |||
| 675 | if (opts->nr_poll_queues) { | ||
| 676 | ctrl->io_queues[HCTX_TYPE_POLL] = | ||
| 677 | min(opts->nr_poll_queues, num_online_cpus()); | ||
| 678 | nr_io_queues += ctrl->io_queues[HCTX_TYPE_POLL]; | ||
| 679 | } | ||
| 666 | 680 | ||
| 667 | ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); | 681 | ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); |
| 668 | if (ret) | 682 | if (ret) |
| @@ -1689,18 +1703,28 @@ static enum blk_eh_timer_return | |||
| 1689 | nvme_rdma_timeout(struct request *rq, bool reserved) | 1703 | nvme_rdma_timeout(struct request *rq, bool reserved) |
| 1690 | { | 1704 | { |
| 1691 | struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); | 1705 | struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); |
| 1706 | struct nvme_rdma_queue *queue = req->queue; | ||
| 1707 | struct nvme_rdma_ctrl *ctrl = queue->ctrl; | ||
| 1692 | 1708 | ||
| 1693 | dev_warn(req->queue->ctrl->ctrl.device, | 1709 | dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", |
| 1694 | "I/O %d QID %d timeout, reset controller\n", | 1710 | rq->tag, nvme_rdma_queue_idx(queue)); |
| 1695 | rq->tag, nvme_rdma_queue_idx(req->queue)); | ||
| 1696 | 1711 | ||
| 1697 | /* queue error recovery */ | 1712 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { |
| 1698 | nvme_rdma_error_recovery(req->queue->ctrl); | 1713 | /* |
| 1714 | * Teardown immediately if controller times out while starting | ||
| 1715 | * or we are already started error recovery. all outstanding | ||
| 1716 | * requests are completed on shutdown, so we return BLK_EH_DONE. | ||
| 1717 | */ | ||
| 1718 | flush_work(&ctrl->err_work); | ||
| 1719 | nvme_rdma_teardown_io_queues(ctrl, false); | ||
| 1720 | nvme_rdma_teardown_admin_queue(ctrl, false); | ||
| 1721 | return BLK_EH_DONE; | ||
| 1722 | } | ||
| 1699 | 1723 | ||
| 1700 | /* fail with DNR on cmd timeout */ | 1724 | dev_warn(ctrl->ctrl.device, "starting error recovery\n"); |
| 1701 | nvme_req(rq)->status = NVME_SC_ABORT_REQ | NVME_SC_DNR; | 1725 | nvme_rdma_error_recovery(ctrl); |
| 1702 | 1726 | ||
| 1703 | return BLK_EH_DONE; | 1727 | return BLK_EH_RESET_TIMER; |
| 1704 | } | 1728 | } |
| 1705 | 1729 | ||
| 1706 | static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, | 1730 | static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, |
| @@ -1779,17 +1803,15 @@ static int nvme_rdma_map_queues(struct blk_mq_tag_set *set) | |||
| 1779 | struct nvme_rdma_ctrl *ctrl = set->driver_data; | 1803 | struct nvme_rdma_ctrl *ctrl = set->driver_data; |
| 1780 | 1804 | ||
| 1781 | set->map[HCTX_TYPE_DEFAULT].queue_offset = 0; | 1805 | set->map[HCTX_TYPE_DEFAULT].queue_offset = 0; |
| 1782 | set->map[HCTX_TYPE_READ].nr_queues = ctrl->ctrl.opts->nr_io_queues; | 1806 | set->map[HCTX_TYPE_DEFAULT].nr_queues = |
| 1807 | ctrl->io_queues[HCTX_TYPE_DEFAULT]; | ||
| 1808 | set->map[HCTX_TYPE_READ].nr_queues = ctrl->io_queues[HCTX_TYPE_READ]; | ||
| 1783 | if (ctrl->ctrl.opts->nr_write_queues) { | 1809 | if (ctrl->ctrl.opts->nr_write_queues) { |
| 1784 | /* separate read/write queues */ | 1810 | /* separate read/write queues */ |
| 1785 | set->map[HCTX_TYPE_DEFAULT].nr_queues = | ||
| 1786 | ctrl->ctrl.opts->nr_write_queues; | ||
| 1787 | set->map[HCTX_TYPE_READ].queue_offset = | 1811 | set->map[HCTX_TYPE_READ].queue_offset = |
| 1788 | ctrl->ctrl.opts->nr_write_queues; | 1812 | ctrl->io_queues[HCTX_TYPE_DEFAULT]; |
| 1789 | } else { | 1813 | } else { |
| 1790 | /* mixed read/write queues */ | 1814 | /* mixed read/write queues */ |
| 1791 | set->map[HCTX_TYPE_DEFAULT].nr_queues = | ||
| 1792 | ctrl->ctrl.opts->nr_io_queues; | ||
| 1793 | set->map[HCTX_TYPE_READ].queue_offset = 0; | 1815 | set->map[HCTX_TYPE_READ].queue_offset = 0; |
| 1794 | } | 1816 | } |
| 1795 | blk_mq_rdma_map_queues(&set->map[HCTX_TYPE_DEFAULT], | 1817 | blk_mq_rdma_map_queues(&set->map[HCTX_TYPE_DEFAULT], |
| @@ -1799,12 +1821,12 @@ static int nvme_rdma_map_queues(struct blk_mq_tag_set *set) | |||
| 1799 | 1821 | ||
| 1800 | if (ctrl->ctrl.opts->nr_poll_queues) { | 1822 | if (ctrl->ctrl.opts->nr_poll_queues) { |
| 1801 | set->map[HCTX_TYPE_POLL].nr_queues = | 1823 | set->map[HCTX_TYPE_POLL].nr_queues = |
| 1802 | ctrl->ctrl.opts->nr_poll_queues; | 1824 | ctrl->io_queues[HCTX_TYPE_POLL]; |
| 1803 | set->map[HCTX_TYPE_POLL].queue_offset = | 1825 | set->map[HCTX_TYPE_POLL].queue_offset = |
| 1804 | ctrl->ctrl.opts->nr_io_queues; | 1826 | ctrl->io_queues[HCTX_TYPE_DEFAULT]; |
| 1805 | if (ctrl->ctrl.opts->nr_write_queues) | 1827 | if (ctrl->ctrl.opts->nr_write_queues) |
| 1806 | set->map[HCTX_TYPE_POLL].queue_offset += | 1828 | set->map[HCTX_TYPE_POLL].queue_offset += |
| 1807 | ctrl->ctrl.opts->nr_write_queues; | 1829 | ctrl->io_queues[HCTX_TYPE_READ]; |
| 1808 | blk_mq_map_queues(&set->map[HCTX_TYPE_POLL]); | 1830 | blk_mq_map_queues(&set->map[HCTX_TYPE_POLL]); |
| 1809 | } | 1831 | } |
| 1810 | return 0; | 1832 | return 0; |
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 265a0543b381..5f0a00425242 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c | |||
| @@ -1948,20 +1948,23 @@ nvme_tcp_timeout(struct request *rq, bool reserved) | |||
| 1948 | struct nvme_tcp_ctrl *ctrl = req->queue->ctrl; | 1948 | struct nvme_tcp_ctrl *ctrl = req->queue->ctrl; |
| 1949 | struct nvme_tcp_cmd_pdu *pdu = req->pdu; | 1949 | struct nvme_tcp_cmd_pdu *pdu = req->pdu; |
| 1950 | 1950 | ||
| 1951 | dev_dbg(ctrl->ctrl.device, | 1951 | dev_warn(ctrl->ctrl.device, |
| 1952 | "queue %d: timeout request %#x type %d\n", | 1952 | "queue %d: timeout request %#x type %d\n", |
| 1953 | nvme_tcp_queue_id(req->queue), rq->tag, | 1953 | nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type); |
| 1954 | pdu->hdr.type); | ||
| 1955 | 1954 | ||
| 1956 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { | 1955 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { |
| 1957 | union nvme_result res = {}; | 1956 | /* |
| 1958 | 1957 | * Teardown immediately if controller times out while starting | |
| 1959 | nvme_req(rq)->flags |= NVME_REQ_CANCELLED; | 1958 | * or we are already started error recovery. all outstanding |
| 1960 | nvme_end_request(rq, cpu_to_le16(NVME_SC_ABORT_REQ), res); | 1959 | * requests are completed on shutdown, so we return BLK_EH_DONE. |
| 1960 | */ | ||
| 1961 | flush_work(&ctrl->err_work); | ||
| 1962 | nvme_tcp_teardown_io_queues(&ctrl->ctrl, false); | ||
| 1963 | nvme_tcp_teardown_admin_queue(&ctrl->ctrl, false); | ||
| 1961 | return BLK_EH_DONE; | 1964 | return BLK_EH_DONE; |
| 1962 | } | 1965 | } |
| 1963 | 1966 | ||
| 1964 | /* queue error recovery */ | 1967 | dev_warn(ctrl->ctrl.device, "starting error recovery\n"); |
| 1965 | nvme_tcp_error_recovery(&ctrl->ctrl); | 1968 | nvme_tcp_error_recovery(&ctrl->ctrl); |
| 1966 | 1969 | ||
| 1967 | return BLK_EH_RESET_TIMER; | 1970 | return BLK_EH_RESET_TIMER; |
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c index a8d23eb80192..a884e3a0e8af 100644 --- a/drivers/nvme/target/rdma.c +++ b/drivers/nvme/target/rdma.c | |||
| @@ -139,6 +139,10 @@ static void nvmet_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc); | |||
| 139 | static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc); | 139 | static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc); |
| 140 | static void nvmet_rdma_qp_event(struct ib_event *event, void *priv); | 140 | static void nvmet_rdma_qp_event(struct ib_event *event, void *priv); |
| 141 | static void nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue); | 141 | static void nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue); |
| 142 | static void nvmet_rdma_free_rsp(struct nvmet_rdma_device *ndev, | ||
| 143 | struct nvmet_rdma_rsp *r); | ||
| 144 | static int nvmet_rdma_alloc_rsp(struct nvmet_rdma_device *ndev, | ||
| 145 | struct nvmet_rdma_rsp *r); | ||
| 142 | 146 | ||
| 143 | static const struct nvmet_fabrics_ops nvmet_rdma_ops; | 147 | static const struct nvmet_fabrics_ops nvmet_rdma_ops; |
| 144 | 148 | ||
| @@ -182,9 +186,17 @@ nvmet_rdma_get_rsp(struct nvmet_rdma_queue *queue) | |||
| 182 | spin_unlock_irqrestore(&queue->rsps_lock, flags); | 186 | spin_unlock_irqrestore(&queue->rsps_lock, flags); |
| 183 | 187 | ||
| 184 | if (unlikely(!rsp)) { | 188 | if (unlikely(!rsp)) { |
| 185 | rsp = kmalloc(sizeof(*rsp), GFP_KERNEL); | 189 | int ret; |
| 190 | |||
| 191 | rsp = kzalloc(sizeof(*rsp), GFP_KERNEL); | ||
| 186 | if (unlikely(!rsp)) | 192 | if (unlikely(!rsp)) |
| 187 | return NULL; | 193 | return NULL; |
| 194 | ret = nvmet_rdma_alloc_rsp(queue->dev, rsp); | ||
| 195 | if (unlikely(ret)) { | ||
| 196 | kfree(rsp); | ||
| 197 | return NULL; | ||
| 198 | } | ||
| 199 | |||
| 188 | rsp->allocated = true; | 200 | rsp->allocated = true; |
| 189 | } | 201 | } |
| 190 | 202 | ||
| @@ -197,6 +209,7 @@ nvmet_rdma_put_rsp(struct nvmet_rdma_rsp *rsp) | |||
| 197 | unsigned long flags; | 209 | unsigned long flags; |
| 198 | 210 | ||
| 199 | if (unlikely(rsp->allocated)) { | 211 | if (unlikely(rsp->allocated)) { |
| 212 | nvmet_rdma_free_rsp(rsp->queue->dev, rsp); | ||
| 200 | kfree(rsp); | 213 | kfree(rsp); |
| 201 | return; | 214 | return; |
| 202 | } | 215 | } |
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 52e47dac028f..80f843030e36 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c | |||
| @@ -310,6 +310,9 @@ static int imx6_pcie_attach_pd(struct device *dev) | |||
| 310 | imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); | 310 | imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); |
| 311 | if (IS_ERR(imx6_pcie->pd_pcie)) | 311 | if (IS_ERR(imx6_pcie->pd_pcie)) |
| 312 | return PTR_ERR(imx6_pcie->pd_pcie); | 312 | return PTR_ERR(imx6_pcie->pd_pcie); |
| 313 | /* Do nothing when power domain missing */ | ||
| 314 | if (!imx6_pcie->pd_pcie) | ||
| 315 | return 0; | ||
| 313 | link = device_link_add(dev, imx6_pcie->pd_pcie, | 316 | link = device_link_add(dev, imx6_pcie->pd_pcie, |
| 314 | DL_FLAG_STATELESS | | 317 | DL_FLAG_STATELESS | |
| 315 | DL_FLAG_PM_RUNTIME | | 318 | DL_FLAG_PM_RUNTIME | |
| @@ -323,13 +326,13 @@ static int imx6_pcie_attach_pd(struct device *dev) | |||
| 323 | if (IS_ERR(imx6_pcie->pd_pcie_phy)) | 326 | if (IS_ERR(imx6_pcie->pd_pcie_phy)) |
| 324 | return PTR_ERR(imx6_pcie->pd_pcie_phy); | 327 | return PTR_ERR(imx6_pcie->pd_pcie_phy); |
| 325 | 328 | ||
| 326 | device_link_add(dev, imx6_pcie->pd_pcie_phy, | 329 | link = device_link_add(dev, imx6_pcie->pd_pcie_phy, |
| 327 | DL_FLAG_STATELESS | | 330 | DL_FLAG_STATELESS | |
| 328 | DL_FLAG_PM_RUNTIME | | 331 | DL_FLAG_PM_RUNTIME | |
| 329 | DL_FLAG_RPM_ACTIVE); | 332 | DL_FLAG_RPM_ACTIVE); |
| 330 | if (IS_ERR(link)) { | 333 | if (!link) { |
| 331 | dev_err(dev, "Failed to add device_link to pcie_phy pd: %ld\n", PTR_ERR(link)); | 334 | dev_err(dev, "Failed to add device_link to pcie_phy pd.\n"); |
| 332 | return PTR_ERR(link); | 335 | return -EINVAL; |
| 333 | } | 336 | } |
| 334 | 337 | ||
| 335 | return 0; | 338 | return 0; |
diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c index b171b6bc15c8..0c389a30ef5d 100644 --- a/drivers/pci/controller/dwc/pcie-armada8k.c +++ b/drivers/pci/controller/dwc/pcie-armada8k.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/resource.h> | 22 | #include <linux/resource.h> |
| 23 | #include <linux/of_pci.h> | 23 | #include <linux/of_pci.h> |
| 24 | #include <linux/of_irq.h> | 24 | #include <linux/of_irq.h> |
| 25 | #include <linux/gpio/consumer.h> | ||
| 26 | 25 | ||
| 27 | #include "pcie-designware.h" | 26 | #include "pcie-designware.h" |
| 28 | 27 | ||
| @@ -30,7 +29,6 @@ struct armada8k_pcie { | |||
| 30 | struct dw_pcie *pci; | 29 | struct dw_pcie *pci; |
| 31 | struct clk *clk; | 30 | struct clk *clk; |
| 32 | struct clk *clk_reg; | 31 | struct clk *clk_reg; |
| 33 | struct gpio_desc *reset_gpio; | ||
| 34 | }; | 32 | }; |
| 35 | 33 | ||
| 36 | #define PCIE_VENDOR_REGS_OFFSET 0x8000 | 34 | #define PCIE_VENDOR_REGS_OFFSET 0x8000 |
| @@ -139,12 +137,6 @@ static int armada8k_pcie_host_init(struct pcie_port *pp) | |||
| 139 | struct dw_pcie *pci = to_dw_pcie_from_pp(pp); | 137 | struct dw_pcie *pci = to_dw_pcie_from_pp(pp); |
| 140 | struct armada8k_pcie *pcie = to_armada8k_pcie(pci); | 138 | struct armada8k_pcie *pcie = to_armada8k_pcie(pci); |
| 141 | 139 | ||
| 142 | if (pcie->reset_gpio) { | ||
| 143 | /* assert and then deassert the reset signal */ | ||
| 144 | gpiod_set_value_cansleep(pcie->reset_gpio, 1); | ||
| 145 | msleep(100); | ||
| 146 | gpiod_set_value_cansleep(pcie->reset_gpio, 0); | ||
| 147 | } | ||
| 148 | dw_pcie_setup_rc(pp); | 140 | dw_pcie_setup_rc(pp); |
| 149 | armada8k_pcie_establish_link(pcie); | 141 | armada8k_pcie_establish_link(pcie); |
| 150 | 142 | ||
| @@ -257,14 +249,6 @@ static int armada8k_pcie_probe(struct platform_device *pdev) | |||
| 257 | goto fail_clkreg; | 249 | goto fail_clkreg; |
| 258 | } | 250 | } |
| 259 | 251 | ||
| 260 | /* Get reset gpio signal and hold asserted (logically high) */ | ||
| 261 | pcie->reset_gpio = devm_gpiod_get_optional(dev, "reset", | ||
| 262 | GPIOD_OUT_HIGH); | ||
| 263 | if (IS_ERR(pcie->reset_gpio)) { | ||
| 264 | ret = PTR_ERR(pcie->reset_gpio); | ||
| 265 | goto fail_clkreg; | ||
| 266 | } | ||
| 267 | |||
| 268 | platform_set_drvdata(pdev, pcie); | 252 | platform_set_drvdata(pdev, pcie); |
| 269 | 253 | ||
| 270 | ret = armada8k_add_pcie_port(pcie, pdev); | 254 | ret = armada8k_add_pcie_port(pcie, pdev); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b0a413f3f7ca..e2a879e93d86 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -639,8 +639,9 @@ static void quirk_synopsys_haps(struct pci_dev *pdev) | |||
| 639 | break; | 639 | break; |
| 640 | } | 640 | } |
| 641 | } | 641 | } |
| 642 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SYNOPSYS, PCI_ANY_ID, | 642 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, PCI_ANY_ID, |
| 643 | quirk_synopsys_haps); | 643 | PCI_CLASS_SERIAL_USB_XHCI, 0, |
| 644 | quirk_synopsys_haps); | ||
| 644 | 645 | ||
| 645 | /* | 646 | /* |
| 646 | * Let's make the southbridge information explicit instead of having to | 647 | * Let's make the southbridge information explicit instead of having to |
diff --git a/drivers/phy/qualcomm/phy-ath79-usb.c b/drivers/phy/qualcomm/phy-ath79-usb.c index 6fd6e07ab345..09a77e556ece 100644 --- a/drivers/phy/qualcomm/phy-ath79-usb.c +++ b/drivers/phy/qualcomm/phy-ath79-usb.c | |||
| @@ -31,7 +31,7 @@ static int ath79_usb_phy_power_on(struct phy *phy) | |||
| 31 | 31 | ||
| 32 | err = reset_control_deassert(priv->reset); | 32 | err = reset_control_deassert(priv->reset); |
| 33 | if (err && priv->no_suspend_override) | 33 | if (err && priv->no_suspend_override) |
| 34 | reset_control_assert(priv->no_suspend_override); | 34 | reset_control_deassert(priv->no_suspend_override); |
| 35 | 35 | ||
| 36 | return err; | 36 | return err; |
| 37 | } | 37 | } |
| @@ -69,7 +69,7 @@ static int ath79_usb_phy_probe(struct platform_device *pdev) | |||
| 69 | if (!priv) | 69 | if (!priv) |
| 70 | return -ENOMEM; | 70 | return -ENOMEM; |
| 71 | 71 | ||
| 72 | priv->reset = devm_reset_control_get(&pdev->dev, "usb-phy"); | 72 | priv->reset = devm_reset_control_get(&pdev->dev, "phy"); |
| 73 | if (IS_ERR(priv->reset)) | 73 | if (IS_ERR(priv->reset)) |
| 74 | return PTR_ERR(priv->reset); | 74 | return PTR_ERR(priv->reset); |
| 75 | 75 | ||
diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c index 77fdaa551977..a52c5bb35033 100644 --- a/drivers/phy/ti/phy-gmii-sel.c +++ b/drivers/phy/ti/phy-gmii-sel.c | |||
| @@ -204,11 +204,11 @@ static struct phy *phy_gmii_sel_of_xlate(struct device *dev, | |||
| 204 | 204 | ||
| 205 | if (args->args_count < 1) | 205 | if (args->args_count < 1) |
| 206 | return ERR_PTR(-EINVAL); | 206 | return ERR_PTR(-EINVAL); |
| 207 | if (!priv || !priv->if_phys) | ||
| 208 | return ERR_PTR(-ENODEV); | ||
| 207 | if (priv->soc_data->features & BIT(PHY_GMII_SEL_RMII_IO_CLK_EN) && | 209 | if (priv->soc_data->features & BIT(PHY_GMII_SEL_RMII_IO_CLK_EN) && |
| 208 | args->args_count < 2) | 210 | args->args_count < 2) |
| 209 | return ERR_PTR(-EINVAL); | 211 | return ERR_PTR(-EINVAL); |
| 210 | if (!priv || !priv->if_phys) | ||
| 211 | return ERR_PTR(-ENODEV); | ||
| 212 | if (phy_id > priv->soc_data->num_ports) | 212 | if (phy_id > priv->soc_data->num_ports) |
| 213 | return ERR_PTR(-EINVAL); | 213 | return ERR_PTR(-EINVAL); |
| 214 | if (phy_id != priv->if_phys[phy_id - 1].id) | 214 | if (phy_id != priv->if_phys[phy_id - 1].id) |
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index 05044e323ea5..03ec7a5d9d0b 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c | |||
| @@ -1513,7 +1513,7 @@ static const struct dmi_system_id chv_no_valid_mask[] = { | |||
| 1513 | .matches = { | 1513 | .matches = { |
| 1514 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), | 1514 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1515 | DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"), | 1515 | DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"), |
| 1516 | DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | 1516 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), |
| 1517 | }, | 1517 | }, |
| 1518 | }, | 1518 | }, |
| 1519 | { | 1519 | { |
| @@ -1521,7 +1521,7 @@ static const struct dmi_system_id chv_no_valid_mask[] = { | |||
| 1521 | .matches = { | 1521 | .matches = { |
| 1522 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), | 1522 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), |
| 1523 | DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"), | 1523 | DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"), |
| 1524 | DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | 1524 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), |
| 1525 | }, | 1525 | }, |
| 1526 | }, | 1526 | }, |
| 1527 | { | 1527 | { |
| @@ -1529,7 +1529,7 @@ static const struct dmi_system_id chv_no_valid_mask[] = { | |||
| 1529 | .matches = { | 1529 | .matches = { |
| 1530 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), | 1530 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1531 | DMI_MATCH(DMI_PRODUCT_NAME, "Cyan"), | 1531 | DMI_MATCH(DMI_PRODUCT_NAME, "Cyan"), |
| 1532 | DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | 1532 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), |
| 1533 | }, | 1533 | }, |
| 1534 | }, | 1534 | }, |
| 1535 | { | 1535 | { |
| @@ -1537,7 +1537,7 @@ static const struct dmi_system_id chv_no_valid_mask[] = { | |||
| 1537 | .matches = { | 1537 | .matches = { |
| 1538 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), | 1538 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1539 | DMI_MATCH(DMI_PRODUCT_NAME, "Celes"), | 1539 | DMI_MATCH(DMI_PRODUCT_NAME, "Celes"), |
| 1540 | DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | 1540 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), |
| 1541 | }, | 1541 | }, |
| 1542 | }, | 1542 | }, |
| 1543 | {} | 1543 | {} |
diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig index 1817786ab6aa..a005cbccb4f7 100644 --- a/drivers/pinctrl/mediatek/Kconfig +++ b/drivers/pinctrl/mediatek/Kconfig | |||
| @@ -45,12 +45,14 @@ config PINCTRL_MT2701 | |||
| 45 | config PINCTRL_MT7623 | 45 | config PINCTRL_MT7623 |
| 46 | bool "Mediatek MT7623 pin control with generic binding" | 46 | bool "Mediatek MT7623 pin control with generic binding" |
| 47 | depends on MACH_MT7623 || COMPILE_TEST | 47 | depends on MACH_MT7623 || COMPILE_TEST |
| 48 | depends on OF | ||
| 48 | default MACH_MT7623 | 49 | default MACH_MT7623 |
| 49 | select PINCTRL_MTK_MOORE | 50 | select PINCTRL_MTK_MOORE |
| 50 | 51 | ||
| 51 | config PINCTRL_MT7629 | 52 | config PINCTRL_MT7629 |
| 52 | bool "Mediatek MT7629 pin control" | 53 | bool "Mediatek MT7629 pin control" |
| 53 | depends on MACH_MT7629 || COMPILE_TEST | 54 | depends on MACH_MT7629 || COMPILE_TEST |
| 55 | depends on OF | ||
| 54 | default MACH_MT7629 | 56 | default MACH_MT7629 |
| 55 | select PINCTRL_MTK_MOORE | 57 | select PINCTRL_MTK_MOORE |
| 56 | 58 | ||
| @@ -92,6 +94,7 @@ config PINCTRL_MT6797 | |||
| 92 | 94 | ||
| 93 | config PINCTRL_MT7622 | 95 | config PINCTRL_MT7622 |
| 94 | bool "MediaTek MT7622 pin control" | 96 | bool "MediaTek MT7622 pin control" |
| 97 | depends on OF | ||
| 95 | depends on ARM64 || COMPILE_TEST | 98 | depends on ARM64 || COMPILE_TEST |
| 96 | default ARM64 && ARCH_MEDIATEK | 99 | default ARM64 && ARCH_MEDIATEK |
| 97 | select PINCTRL_MTK_MOORE | 100 | select PINCTRL_MTK_MOORE |
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index b03481ef99a1..98905d4a79ca 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c | |||
| @@ -832,8 +832,13 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, | |||
| 832 | break; | 832 | break; |
| 833 | 833 | ||
| 834 | case MCP_TYPE_S18: | 834 | case MCP_TYPE_S18: |
| 835 | one_regmap_config = | ||
| 836 | devm_kmemdup(dev, &mcp23x17_regmap, | ||
| 837 | sizeof(struct regmap_config), GFP_KERNEL); | ||
| 838 | if (!one_regmap_config) | ||
| 839 | return -ENOMEM; | ||
| 835 | mcp->regmap = devm_regmap_init(dev, &mcp23sxx_spi_regmap, mcp, | 840 | mcp->regmap = devm_regmap_init(dev, &mcp23sxx_spi_regmap, mcp, |
| 836 | &mcp23x17_regmap); | 841 | one_regmap_config); |
| 837 | mcp->reg_shift = 1; | 842 | mcp->reg_shift = 1; |
| 838 | mcp->chip.ngpio = 16; | 843 | mcp->chip.ngpio = 16; |
| 839 | mcp->chip.label = "mcp23s18"; | 844 | mcp->chip.label = "mcp23s18"; |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-h6.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-h6.c index aa8b58125568..ef4268cc6227 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun50i-h6.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h6.c | |||
| @@ -588,7 +588,7 @@ static const unsigned int h6_irq_bank_map[] = { 1, 5, 6, 7 }; | |||
| 588 | static const struct sunxi_pinctrl_desc h6_pinctrl_data = { | 588 | static const struct sunxi_pinctrl_desc h6_pinctrl_data = { |
| 589 | .pins = h6_pins, | 589 | .pins = h6_pins, |
| 590 | .npins = ARRAY_SIZE(h6_pins), | 590 | .npins = ARRAY_SIZE(h6_pins), |
| 591 | .irq_banks = 3, | 591 | .irq_banks = 4, |
| 592 | .irq_bank_map = h6_irq_bank_map, | 592 | .irq_bank_map = h6_irq_bank_map, |
| 593 | .irq_read_needs_mux = true, | 593 | .irq_read_needs_mux = true, |
| 594 | }; | 594 | }; |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 5d9184d18c16..0e7fa69e93df 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c | |||
| @@ -698,26 +698,24 @@ static int sunxi_pmx_request(struct pinctrl_dev *pctldev, unsigned offset) | |||
| 698 | { | 698 | { |
| 699 | struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | 699 | struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); |
| 700 | unsigned short bank = offset / PINS_PER_BANK; | 700 | unsigned short bank = offset / PINS_PER_BANK; |
| 701 | struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank]; | 701 | unsigned short bank_offset = bank - pctl->desc->pin_base / |
| 702 | struct regulator *reg; | 702 | PINS_PER_BANK; |
| 703 | struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank_offset]; | ||
| 704 | struct regulator *reg = s_reg->regulator; | ||
| 705 | char supply[16]; | ||
| 703 | int ret; | 706 | int ret; |
| 704 | 707 | ||
| 705 | reg = s_reg->regulator; | 708 | if (reg) { |
| 706 | if (!reg) { | ||
| 707 | char supply[16]; | ||
| 708 | |||
| 709 | snprintf(supply, sizeof(supply), "vcc-p%c", 'a' + bank); | ||
| 710 | reg = regulator_get(pctl->dev, supply); | ||
| 711 | if (IS_ERR(reg)) { | ||
| 712 | dev_err(pctl->dev, "Couldn't get bank P%c regulator\n", | ||
| 713 | 'A' + bank); | ||
| 714 | return PTR_ERR(reg); | ||
| 715 | } | ||
| 716 | |||
| 717 | s_reg->regulator = reg; | ||
| 718 | refcount_set(&s_reg->refcount, 1); | ||
| 719 | } else { | ||
| 720 | refcount_inc(&s_reg->refcount); | 709 | refcount_inc(&s_reg->refcount); |
| 710 | return 0; | ||
| 711 | } | ||
| 712 | |||
| 713 | snprintf(supply, sizeof(supply), "vcc-p%c", 'a' + bank); | ||
| 714 | reg = regulator_get(pctl->dev, supply); | ||
| 715 | if (IS_ERR(reg)) { | ||
| 716 | dev_err(pctl->dev, "Couldn't get bank P%c regulator\n", | ||
| 717 | 'A' + bank); | ||
| 718 | return PTR_ERR(reg); | ||
| 721 | } | 719 | } |
| 722 | 720 | ||
| 723 | ret = regulator_enable(reg); | 721 | ret = regulator_enable(reg); |
| @@ -727,13 +725,13 @@ static int sunxi_pmx_request(struct pinctrl_dev *pctldev, unsigned offset) | |||
| 727 | goto out; | 725 | goto out; |
| 728 | } | 726 | } |
| 729 | 727 | ||
| 728 | s_reg->regulator = reg; | ||
| 729 | refcount_set(&s_reg->refcount, 1); | ||
| 730 | |||
| 730 | return 0; | 731 | return 0; |
| 731 | 732 | ||
| 732 | out: | 733 | out: |
| 733 | if (refcount_dec_and_test(&s_reg->refcount)) { | 734 | regulator_put(s_reg->regulator); |
| 734 | regulator_put(s_reg->regulator); | ||
| 735 | s_reg->regulator = NULL; | ||
| 736 | } | ||
| 737 | 735 | ||
| 738 | return ret; | 736 | return ret; |
| 739 | } | 737 | } |
| @@ -742,7 +740,9 @@ static int sunxi_pmx_free(struct pinctrl_dev *pctldev, unsigned offset) | |||
| 742 | { | 740 | { |
| 743 | struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); | 741 | struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); |
| 744 | unsigned short bank = offset / PINS_PER_BANK; | 742 | unsigned short bank = offset / PINS_PER_BANK; |
| 745 | struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank]; | 743 | unsigned short bank_offset = bank - pctl->desc->pin_base / |
| 744 | PINS_PER_BANK; | ||
| 745 | struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank_offset]; | ||
| 746 | 746 | ||
| 747 | if (!refcount_dec_and_test(&s_reg->refcount)) | 747 | if (!refcount_dec_and_test(&s_reg->refcount)) |
| 748 | return 0; | 748 | return 0; |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index e340d2a24b44..034c0317c8d6 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h | |||
| @@ -136,7 +136,7 @@ struct sunxi_pinctrl { | |||
| 136 | struct gpio_chip *chip; | 136 | struct gpio_chip *chip; |
| 137 | const struct sunxi_pinctrl_desc *desc; | 137 | const struct sunxi_pinctrl_desc *desc; |
| 138 | struct device *dev; | 138 | struct device *dev; |
| 139 | struct sunxi_pinctrl_regulator regulators[12]; | 139 | struct sunxi_pinctrl_regulator regulators[9]; |
| 140 | struct irq_domain *domain; | 140 | struct irq_domain *domain; |
| 141 | struct sunxi_pinctrl_function *functions; | 141 | struct sunxi_pinctrl_function *functions; |
| 142 | unsigned nfunctions; | 142 | unsigned nfunctions; |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 5e2109c54c7c..b5e9db85e881 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
| @@ -905,6 +905,7 @@ config TOSHIBA_WMI | |||
| 905 | config ACPI_CMPC | 905 | config ACPI_CMPC |
| 906 | tristate "CMPC Laptop Extras" | 906 | tristate "CMPC Laptop Extras" |
| 907 | depends on ACPI && INPUT | 907 | depends on ACPI && INPUT |
| 908 | depends on BACKLIGHT_LCD_SUPPORT | ||
| 908 | depends on RFKILL || RFKILL=n | 909 | depends on RFKILL || RFKILL=n |
| 909 | select BACKLIGHT_CLASS_DEVICE | 910 | select BACKLIGHT_CLASS_DEVICE |
| 910 | help | 911 | help |
| @@ -1128,6 +1129,7 @@ config INTEL_OAKTRAIL | |||
| 1128 | config SAMSUNG_Q10 | 1129 | config SAMSUNG_Q10 |
| 1129 | tristate "Samsung Q10 Extras" | 1130 | tristate "Samsung Q10 Extras" |
| 1130 | depends on ACPI | 1131 | depends on ACPI |
| 1132 | depends on BACKLIGHT_LCD_SUPPORT | ||
| 1131 | select BACKLIGHT_CLASS_DEVICE | 1133 | select BACKLIGHT_CLASS_DEVICE |
| 1132 | ---help--- | 1134 | ---help--- |
| 1133 | This driver provides support for backlight control on Samsung Q10 | 1135 | This driver provides support for backlight control on Samsung Q10 |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 4e7b55a14b1a..6e294b4d3635 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
| @@ -4469,6 +4469,14 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) | |||
| 4469 | usrparm.psf_data &= 0x7fffffffULL; | 4469 | usrparm.psf_data &= 0x7fffffffULL; |
| 4470 | usrparm.rssd_result &= 0x7fffffffULL; | 4470 | usrparm.rssd_result &= 0x7fffffffULL; |
| 4471 | } | 4471 | } |
| 4472 | /* at least 2 bytes are accessed and should be allocated */ | ||
| 4473 | if (usrparm.psf_data_len < 2) { | ||
| 4474 | DBF_DEV_EVENT(DBF_WARNING, device, | ||
| 4475 | "Symmetrix ioctl invalid data length %d", | ||
| 4476 | usrparm.psf_data_len); | ||
| 4477 | rc = -EINVAL; | ||
| 4478 | goto out; | ||
| 4479 | } | ||
| 4472 | /* alloc I/O data area */ | 4480 | /* alloc I/O data area */ |
| 4473 | psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); | 4481 | psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); |
| 4474 | rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA); | 4482 | rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA); |
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c index 194ffd5c8580..039b2074db7e 100644 --- a/drivers/s390/char/sclp_config.c +++ b/drivers/s390/char/sclp_config.c | |||
| @@ -60,7 +60,9 @@ static void sclp_cpu_capability_notify(struct work_struct *work) | |||
| 60 | 60 | ||
| 61 | static void __ref sclp_cpu_change_notify(struct work_struct *work) | 61 | static void __ref sclp_cpu_change_notify(struct work_struct *work) |
| 62 | { | 62 | { |
| 63 | lock_device_hotplug(); | ||
| 63 | smp_rescan_cpus(); | 64 | smp_rescan_cpus(); |
| 65 | unlock_device_hotplug(); | ||
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | static void sclp_conf_receiver_fn(struct evbuf_header *evbuf) | 68 | static void sclp_conf_receiver_fn(struct evbuf_header *evbuf) |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 48ea0004a56d..5a699746c357 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
| @@ -248,7 +248,8 @@ static inline int ap_test_config(unsigned int *field, unsigned int nr) | |||
| 248 | static inline int ap_test_config_card_id(unsigned int id) | 248 | static inline int ap_test_config_card_id(unsigned int id) |
| 249 | { | 249 | { |
| 250 | if (!ap_configuration) /* QCI not supported */ | 250 | if (!ap_configuration) /* QCI not supported */ |
| 251 | return 1; | 251 | /* only ids 0...3F may be probed */ |
| 252 | return id < 0x40 ? 1 : 0; | ||
| 252 | return ap_test_config(ap_configuration->apm, id); | 253 | return ap_test_config(ap_configuration->apm, id); |
| 253 | } | 254 | } |
| 254 | 255 | ||
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 0ee026947f20..122059ecad84 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/hashtable.h> | 22 | #include <linux/hashtable.h> |
| 23 | #include <linux/ip.h> | 23 | #include <linux/ip.h> |
| 24 | #include <linux/refcount.h> | 24 | #include <linux/refcount.h> |
| 25 | #include <linux/workqueue.h> | ||
| 25 | 26 | ||
| 26 | #include <net/ipv6.h> | 27 | #include <net/ipv6.h> |
| 27 | #include <net/if_inet6.h> | 28 | #include <net/if_inet6.h> |
| @@ -789,6 +790,7 @@ struct qeth_card { | |||
| 789 | struct qeth_seqno seqno; | 790 | struct qeth_seqno seqno; |
| 790 | struct qeth_card_options options; | 791 | struct qeth_card_options options; |
| 791 | 792 | ||
| 793 | struct workqueue_struct *event_wq; | ||
| 792 | wait_queue_head_t wait_q; | 794 | wait_queue_head_t wait_q; |
| 793 | spinlock_t mclock; | 795 | spinlock_t mclock; |
| 794 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; | 796 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; |
| @@ -962,7 +964,6 @@ extern const struct attribute_group *qeth_osn_attr_groups[]; | |||
| 962 | extern const struct attribute_group qeth_device_attr_group; | 964 | extern const struct attribute_group qeth_device_attr_group; |
| 963 | extern const struct attribute_group qeth_device_blkt_group; | 965 | extern const struct attribute_group qeth_device_blkt_group; |
| 964 | extern const struct device_type qeth_generic_devtype; | 966 | extern const struct device_type qeth_generic_devtype; |
| 965 | extern struct workqueue_struct *qeth_wq; | ||
| 966 | 967 | ||
| 967 | int qeth_card_hw_is_reachable(struct qeth_card *); | 968 | int qeth_card_hw_is_reachable(struct qeth_card *); |
| 968 | const char *qeth_get_cardname_short(struct qeth_card *); | 969 | const char *qeth_get_cardname_short(struct qeth_card *); |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index e63e03143ca7..89f912213e62 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
| @@ -74,8 +74,7 @@ static void qeth_notify_skbs(struct qeth_qdio_out_q *queue, | |||
| 74 | static void qeth_release_skbs(struct qeth_qdio_out_buffer *buf); | 74 | static void qeth_release_skbs(struct qeth_qdio_out_buffer *buf); |
| 75 | static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *, int); | 75 | static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *, int); |
| 76 | 76 | ||
| 77 | struct workqueue_struct *qeth_wq; | 77 | static struct workqueue_struct *qeth_wq; |
| 78 | EXPORT_SYMBOL_GPL(qeth_wq); | ||
| 79 | 78 | ||
| 80 | int qeth_card_hw_is_reachable(struct qeth_card *card) | 79 | int qeth_card_hw_is_reachable(struct qeth_card *card) |
| 81 | { | 80 | { |
| @@ -566,6 +565,7 @@ static int __qeth_issue_next_read(struct qeth_card *card) | |||
| 566 | QETH_DBF_MESSAGE(2, "error %i on device %x when starting next read ccw!\n", | 565 | QETH_DBF_MESSAGE(2, "error %i on device %x when starting next read ccw!\n", |
| 567 | rc, CARD_DEVID(card)); | 566 | rc, CARD_DEVID(card)); |
| 568 | atomic_set(&channel->irq_pending, 0); | 567 | atomic_set(&channel->irq_pending, 0); |
| 568 | qeth_release_buffer(channel, iob); | ||
| 569 | card->read_or_write_problem = 1; | 569 | card->read_or_write_problem = 1; |
| 570 | qeth_schedule_recovery(card); | 570 | qeth_schedule_recovery(card); |
| 571 | wake_up(&card->wait_q); | 571 | wake_up(&card->wait_q); |
| @@ -1127,6 +1127,8 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, | |||
| 1127 | rc = qeth_get_problem(card, cdev, irb); | 1127 | rc = qeth_get_problem(card, cdev, irb); |
| 1128 | if (rc) { | 1128 | if (rc) { |
| 1129 | card->read_or_write_problem = 1; | 1129 | card->read_or_write_problem = 1; |
| 1130 | if (iob) | ||
| 1131 | qeth_release_buffer(iob->channel, iob); | ||
| 1130 | qeth_clear_ipacmd_list(card); | 1132 | qeth_clear_ipacmd_list(card); |
| 1131 | qeth_schedule_recovery(card); | 1133 | qeth_schedule_recovery(card); |
| 1132 | goto out; | 1134 | goto out; |
| @@ -1466,6 +1468,10 @@ static struct qeth_card *qeth_alloc_card(struct ccwgroup_device *gdev) | |||
| 1466 | CARD_RDEV(card) = gdev->cdev[0]; | 1468 | CARD_RDEV(card) = gdev->cdev[0]; |
| 1467 | CARD_WDEV(card) = gdev->cdev[1]; | 1469 | CARD_WDEV(card) = gdev->cdev[1]; |
| 1468 | CARD_DDEV(card) = gdev->cdev[2]; | 1470 | CARD_DDEV(card) = gdev->cdev[2]; |
| 1471 | |||
| 1472 | card->event_wq = alloc_ordered_workqueue("%s", 0, dev_name(&gdev->dev)); | ||
| 1473 | if (!card->event_wq) | ||
| 1474 | goto out_wq; | ||
| 1469 | if (qeth_setup_channel(&card->read, true)) | 1475 | if (qeth_setup_channel(&card->read, true)) |
| 1470 | goto out_ip; | 1476 | goto out_ip; |
| 1471 | if (qeth_setup_channel(&card->write, true)) | 1477 | if (qeth_setup_channel(&card->write, true)) |
| @@ -1481,6 +1487,8 @@ out_data: | |||
| 1481 | out_channel: | 1487 | out_channel: |
| 1482 | qeth_clean_channel(&card->read); | 1488 | qeth_clean_channel(&card->read); |
| 1483 | out_ip: | 1489 | out_ip: |
| 1490 | destroy_workqueue(card->event_wq); | ||
| 1491 | out_wq: | ||
| 1484 | dev_set_drvdata(&gdev->dev, NULL); | 1492 | dev_set_drvdata(&gdev->dev, NULL); |
| 1485 | kfree(card); | 1493 | kfree(card); |
| 1486 | out: | 1494 | out: |
| @@ -1809,6 +1817,7 @@ static int qeth_idx_activate_get_answer(struct qeth_card *card, | |||
| 1809 | QETH_DBF_MESSAGE(2, "Error2 in activating channel rc=%d\n", rc); | 1817 | QETH_DBF_MESSAGE(2, "Error2 in activating channel rc=%d\n", rc); |
| 1810 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); | 1818 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); |
| 1811 | atomic_set(&channel->irq_pending, 0); | 1819 | atomic_set(&channel->irq_pending, 0); |
| 1820 | qeth_release_buffer(channel, iob); | ||
| 1812 | wake_up(&card->wait_q); | 1821 | wake_up(&card->wait_q); |
| 1813 | return rc; | 1822 | return rc; |
| 1814 | } | 1823 | } |
| @@ -1878,6 +1887,7 @@ static int qeth_idx_activate_channel(struct qeth_card *card, | |||
| 1878 | rc); | 1887 | rc); |
| 1879 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | 1888 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); |
| 1880 | atomic_set(&channel->irq_pending, 0); | 1889 | atomic_set(&channel->irq_pending, 0); |
| 1890 | qeth_release_buffer(channel, iob); | ||
| 1881 | wake_up(&card->wait_q); | 1891 | wake_up(&card->wait_q); |
| 1882 | return rc; | 1892 | return rc; |
| 1883 | } | 1893 | } |
| @@ -2058,6 +2068,7 @@ int qeth_send_control_data(struct qeth_card *card, int len, | |||
| 2058 | } | 2068 | } |
| 2059 | reply = qeth_alloc_reply(card); | 2069 | reply = qeth_alloc_reply(card); |
| 2060 | if (!reply) { | 2070 | if (!reply) { |
| 2071 | qeth_release_buffer(channel, iob); | ||
| 2061 | return -ENOMEM; | 2072 | return -ENOMEM; |
| 2062 | } | 2073 | } |
| 2063 | reply->callback = reply_cb; | 2074 | reply->callback = reply_cb; |
| @@ -2389,11 +2400,12 @@ static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *q, int bidx) | |||
| 2389 | return 0; | 2400 | return 0; |
| 2390 | } | 2401 | } |
| 2391 | 2402 | ||
| 2392 | static void qeth_free_qdio_out_buf(struct qeth_qdio_out_q *q) | 2403 | static void qeth_free_output_queue(struct qeth_qdio_out_q *q) |
| 2393 | { | 2404 | { |
| 2394 | if (!q) | 2405 | if (!q) |
| 2395 | return; | 2406 | return; |
| 2396 | 2407 | ||
| 2408 | qeth_clear_outq_buffers(q, 1); | ||
| 2397 | qdio_free_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); | 2409 | qdio_free_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); |
| 2398 | kfree(q); | 2410 | kfree(q); |
| 2399 | } | 2411 | } |
| @@ -2467,10 +2479,8 @@ out_freeoutqbufs: | |||
| 2467 | card->qdio.out_qs[i]->bufs[j] = NULL; | 2479 | card->qdio.out_qs[i]->bufs[j] = NULL; |
| 2468 | } | 2480 | } |
| 2469 | out_freeoutq: | 2481 | out_freeoutq: |
| 2470 | while (i > 0) { | 2482 | while (i > 0) |
| 2471 | qeth_free_qdio_out_buf(card->qdio.out_qs[--i]); | 2483 | qeth_free_output_queue(card->qdio.out_qs[--i]); |
| 2472 | qeth_clear_outq_buffers(card->qdio.out_qs[i], 1); | ||
| 2473 | } | ||
| 2474 | kfree(card->qdio.out_qs); | 2484 | kfree(card->qdio.out_qs); |
| 2475 | card->qdio.out_qs = NULL; | 2485 | card->qdio.out_qs = NULL; |
| 2476 | out_freepool: | 2486 | out_freepool: |
| @@ -2503,10 +2513,8 @@ static void qeth_free_qdio_buffers(struct qeth_card *card) | |||
| 2503 | qeth_free_buffer_pool(card); | 2513 | qeth_free_buffer_pool(card); |
| 2504 | /* free outbound qdio_qs */ | 2514 | /* free outbound qdio_qs */ |
| 2505 | if (card->qdio.out_qs) { | 2515 | if (card->qdio.out_qs) { |
| 2506 | for (i = 0; i < card->qdio.no_out_queues; ++i) { | 2516 | for (i = 0; i < card->qdio.no_out_queues; i++) |
| 2507 | qeth_clear_outq_buffers(card->qdio.out_qs[i], 1); | 2517 | qeth_free_output_queue(card->qdio.out_qs[i]); |
| 2508 | qeth_free_qdio_out_buf(card->qdio.out_qs[i]); | ||
| 2509 | } | ||
| 2510 | kfree(card->qdio.out_qs); | 2518 | kfree(card->qdio.out_qs); |
| 2511 | card->qdio.out_qs = NULL; | 2519 | card->qdio.out_qs = NULL; |
| 2512 | } | 2520 | } |
| @@ -5028,6 +5036,7 @@ static void qeth_core_free_card(struct qeth_card *card) | |||
| 5028 | qeth_clean_channel(&card->read); | 5036 | qeth_clean_channel(&card->read); |
| 5029 | qeth_clean_channel(&card->write); | 5037 | qeth_clean_channel(&card->write); |
| 5030 | qeth_clean_channel(&card->data); | 5038 | qeth_clean_channel(&card->data); |
| 5039 | destroy_workqueue(card->event_wq); | ||
| 5031 | qeth_free_qdio_buffers(card); | 5040 | qeth_free_qdio_buffers(card); |
| 5032 | unregister_service_level(&card->qeth_service_level); | 5041 | unregister_service_level(&card->qeth_service_level); |
| 5033 | dev_set_drvdata(&card->gdev->dev, NULL); | 5042 | dev_set_drvdata(&card->gdev->dev, NULL); |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index f108d4b44605..a43de2f9bcac 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
| @@ -369,6 +369,8 @@ static void qeth_l2_stop_card(struct qeth_card *card, int recovery_mode) | |||
| 369 | qeth_clear_cmd_buffers(&card->read); | 369 | qeth_clear_cmd_buffers(&card->read); |
| 370 | qeth_clear_cmd_buffers(&card->write); | 370 | qeth_clear_cmd_buffers(&card->write); |
| 371 | } | 371 | } |
| 372 | |||
| 373 | flush_workqueue(card->event_wq); | ||
| 372 | } | 374 | } |
| 373 | 375 | ||
| 374 | static int qeth_l2_process_inbound_buffer(struct qeth_card *card, | 376 | static int qeth_l2_process_inbound_buffer(struct qeth_card *card, |
| @@ -801,6 +803,8 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev) | |||
| 801 | 803 | ||
| 802 | if (cgdev->state == CCWGROUP_ONLINE) | 804 | if (cgdev->state == CCWGROUP_ONLINE) |
| 803 | qeth_l2_set_offline(cgdev); | 805 | qeth_l2_set_offline(cgdev); |
| 806 | |||
| 807 | cancel_work_sync(&card->close_dev_work); | ||
| 804 | if (qeth_netdev_is_registered(card->dev)) | 808 | if (qeth_netdev_is_registered(card->dev)) |
| 805 | unregister_netdev(card->dev); | 809 | unregister_netdev(card->dev); |
| 806 | } | 810 | } |
| @@ -1434,7 +1438,7 @@ static void qeth_bridge_state_change(struct qeth_card *card, | |||
| 1434 | data->card = card; | 1438 | data->card = card; |
| 1435 | memcpy(&data->qports, qports, | 1439 | memcpy(&data->qports, qports, |
| 1436 | sizeof(struct qeth_sbp_state_change) + extrasize); | 1440 | sizeof(struct qeth_sbp_state_change) + extrasize); |
| 1437 | queue_work(qeth_wq, &data->worker); | 1441 | queue_work(card->event_wq, &data->worker); |
| 1438 | } | 1442 | } |
| 1439 | 1443 | ||
| 1440 | struct qeth_bridge_host_data { | 1444 | struct qeth_bridge_host_data { |
| @@ -1506,7 +1510,7 @@ static void qeth_bridge_host_event(struct qeth_card *card, | |||
| 1506 | data->card = card; | 1510 | data->card = card; |
| 1507 | memcpy(&data->hostevs, hostevs, | 1511 | memcpy(&data->hostevs, hostevs, |
| 1508 | sizeof(struct qeth_ipacmd_addr_change) + extrasize); | 1512 | sizeof(struct qeth_ipacmd_addr_change) + extrasize); |
| 1509 | queue_work(qeth_wq, &data->worker); | 1513 | queue_work(card->event_wq, &data->worker); |
| 1510 | } | 1514 | } |
| 1511 | 1515 | ||
| 1512 | /* SETBRIDGEPORT support; sending commands */ | 1516 | /* SETBRIDGEPORT support; sending commands */ |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 42a7cdc59b76..df34bff4ac31 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
| @@ -1433,6 +1433,8 @@ static void qeth_l3_stop_card(struct qeth_card *card, int recovery_mode) | |||
| 1433 | qeth_clear_cmd_buffers(&card->read); | 1433 | qeth_clear_cmd_buffers(&card->read); |
| 1434 | qeth_clear_cmd_buffers(&card->write); | 1434 | qeth_clear_cmd_buffers(&card->write); |
| 1435 | } | 1435 | } |
| 1436 | |||
| 1437 | flush_workqueue(card->event_wq); | ||
| 1436 | } | 1438 | } |
| 1437 | 1439 | ||
| 1438 | /* | 1440 | /* |
| @@ -2338,6 +2340,7 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) | |||
| 2338 | if (cgdev->state == CCWGROUP_ONLINE) | 2340 | if (cgdev->state == CCWGROUP_ONLINE) |
| 2339 | qeth_l3_set_offline(cgdev); | 2341 | qeth_l3_set_offline(cgdev); |
| 2340 | 2342 | ||
| 2343 | cancel_work_sync(&card->close_dev_work); | ||
| 2341 | if (qeth_netdev_is_registered(card->dev)) | 2344 | if (qeth_netdev_is_registered(card->dev)) |
| 2342 | unregister_netdev(card->dev); | 2345 | unregister_netdev(card->dev); |
| 2343 | qeth_l3_clear_ip_htable(card, 0); | 2346 | qeth_l3_clear_ip_htable(card, 0); |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 9cf30d124b9e..e390f8c6d5f3 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
| @@ -403,7 +403,6 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
| 403 | goto failed; | 403 | goto failed; |
| 404 | 404 | ||
| 405 | /* report size limit per scatter-gather segment */ | 405 | /* report size limit per scatter-gather segment */ |
| 406 | adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN; | ||
| 407 | adapter->ccw_device->dev.dma_parms = &adapter->dma_parms; | 406 | adapter->ccw_device->dev.dma_parms = &adapter->dma_parms; |
| 408 | 407 | ||
| 409 | adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM; | 408 | adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM; |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 00acc7144bbc..f4f6a07c5222 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
| @@ -428,6 +428,8 @@ static struct scsi_host_template zfcp_scsi_host_template = { | |||
| 428 | .max_sectors = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1) | 428 | .max_sectors = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1) |
| 429 | * ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2) * 8, | 429 | * ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2) * 8, |
| 430 | /* GCD, adjusted later */ | 430 | /* GCD, adjusted later */ |
| 431 | /* report size limit per scatter-gather segment */ | ||
| 432 | .max_segment_size = ZFCP_QDIO_SBALE_LEN, | ||
| 431 | .dma_boundary = ZFCP_QDIO_SBALE_LEN - 1, | 433 | .dma_boundary = ZFCP_QDIO_SBALE_LEN - 1, |
| 432 | .shost_attrs = zfcp_sysfs_shost_attrs, | 434 | .shost_attrs = zfcp_sysfs_shost_attrs, |
| 433 | .sdev_attrs = zfcp_sysfs_sdev_attrs, | 435 | .sdev_attrs = zfcp_sysfs_sdev_attrs, |
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 128d658d472a..16957d7ac414 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
| @@ -295,7 +295,7 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
| 295 | if(tpnt->sdev_attrs == NULL) | 295 | if(tpnt->sdev_attrs == NULL) |
| 296 | tpnt->sdev_attrs = NCR_700_dev_attrs; | 296 | tpnt->sdev_attrs = NCR_700_dev_attrs; |
| 297 | 297 | ||
| 298 | memory = dma_alloc_attrs(hostdata->dev, TOTAL_MEM_SIZE, &pScript, | 298 | memory = dma_alloc_attrs(dev, TOTAL_MEM_SIZE, &pScript, |
| 299 | GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); | 299 | GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); |
| 300 | if(memory == NULL) { | 300 | if(memory == NULL) { |
| 301 | printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n"); | 301 | printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n"); |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 634ddb90e7aa..7e56a11836c1 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
| @@ -1747,11 +1747,10 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1747 | shost->max_sectors = (shost->sg_tablesize * 8) + 112; | 1747 | shost->max_sectors = (shost->sg_tablesize * 8) + 112; |
| 1748 | } | 1748 | } |
| 1749 | 1749 | ||
| 1750 | error = dma_set_max_seg_size(&pdev->dev, | 1750 | if (aac->adapter_info.options & AAC_OPT_NEW_COMM) |
| 1751 | (aac->adapter_info.options & AAC_OPT_NEW_COMM) ? | 1751 | shost->max_segment_size = shost->max_sectors << 9; |
| 1752 | (shost->max_sectors << 9) : 65536); | 1752 | else |
| 1753 | if (error) | 1753 | shost->max_segment_size = 65536; |
| 1754 | goto out_deinit; | ||
| 1755 | 1754 | ||
| 1756 | /* | 1755 | /* |
| 1757 | * Firmware printf works only with older firmware. | 1756 | * Firmware printf works only with older firmware. |
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index f83f79b07b50..07efcb9b5b94 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c | |||
| @@ -280,7 +280,7 @@ static ssize_t asd_show_dev_rev(struct device *dev, | |||
| 280 | return snprintf(buf, PAGE_SIZE, "%s\n", | 280 | return snprintf(buf, PAGE_SIZE, "%s\n", |
| 281 | asd_dev_rev[asd_ha->revision_id]); | 281 | asd_dev_rev[asd_ha->revision_id]); |
| 282 | } | 282 | } |
| 283 | static DEVICE_ATTR(revision, S_IRUGO, asd_show_dev_rev, NULL); | 283 | static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL); |
| 284 | 284 | ||
| 285 | static ssize_t asd_show_dev_bios_build(struct device *dev, | 285 | static ssize_t asd_show_dev_bios_build(struct device *dev, |
| 286 | struct device_attribute *attr,char *buf) | 286 | struct device_attribute *attr,char *buf) |
| @@ -477,7 +477,7 @@ static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha) | |||
| 477 | { | 477 | { |
| 478 | int err; | 478 | int err; |
| 479 | 479 | ||
| 480 | err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision); | 480 | err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
| 481 | if (err) | 481 | if (err) |
| 482 | return err; | 482 | return err; |
| 483 | 483 | ||
| @@ -499,13 +499,13 @@ err_update_bios: | |||
| 499 | err_biosb: | 499 | err_biosb: |
| 500 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); | 500 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); |
| 501 | err_rev: | 501 | err_rev: |
| 502 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); | 502 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
| 503 | return err; | 503 | return err; |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) | 506 | static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha) |
| 507 | { | 507 | { |
| 508 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision); | 508 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision); |
| 509 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); | 509 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build); |
| 510 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); | 510 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn); |
| 511 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios); | 511 | device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios); |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 350257c13a5b..bc9f2a2365f4 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
| @@ -240,6 +240,7 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba) | |||
| 240 | return NULL; | 240 | return NULL; |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | cmgr->hba = hba; | ||
| 243 | cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list), | 244 | cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list), |
| 244 | GFP_KERNEL); | 245 | GFP_KERNEL); |
| 245 | if (!cmgr->free_list) { | 246 | if (!cmgr->free_list) { |
| @@ -256,7 +257,6 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba) | |||
| 256 | goto mem_err; | 257 | goto mem_err; |
| 257 | } | 258 | } |
| 258 | 259 | ||
| 259 | cmgr->hba = hba; | ||
| 260 | cmgr->cmds = (struct bnx2fc_cmd **)(cmgr + 1); | 260 | cmgr->cmds = (struct bnx2fc_cmd **)(cmgr + 1); |
| 261 | 261 | ||
| 262 | for (i = 0; i < arr_sz; i++) { | 262 | for (i = 0; i < arr_sz; i++) { |
| @@ -295,7 +295,7 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba) | |||
| 295 | 295 | ||
| 296 | /* Allocate pool of io_bdts - one for each bnx2fc_cmd */ | 296 | /* Allocate pool of io_bdts - one for each bnx2fc_cmd */ |
| 297 | mem_size = num_ios * sizeof(struct io_bdt *); | 297 | mem_size = num_ios * sizeof(struct io_bdt *); |
| 298 | cmgr->io_bdt_pool = kmalloc(mem_size, GFP_KERNEL); | 298 | cmgr->io_bdt_pool = kzalloc(mem_size, GFP_KERNEL); |
| 299 | if (!cmgr->io_bdt_pool) { | 299 | if (!cmgr->io_bdt_pool) { |
| 300 | printk(KERN_ERR PFX "failed to alloc io_bdt_pool\n"); | 300 | printk(KERN_ERR PFX "failed to alloc io_bdt_pool\n"); |
| 301 | goto mem_err; | 301 | goto mem_err; |
diff --git a/drivers/scsi/csiostor/csio_attr.c b/drivers/scsi/csiostor/csio_attr.c index 8a004036e3d7..9bd2bd8dc2be 100644 --- a/drivers/scsi/csiostor/csio_attr.c +++ b/drivers/scsi/csiostor/csio_attr.c | |||
| @@ -594,12 +594,12 @@ csio_vport_create(struct fc_vport *fc_vport, bool disable) | |||
| 594 | } | 594 | } |
| 595 | 595 | ||
| 596 | fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING); | 596 | fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING); |
| 597 | ln->fc_vport = fc_vport; | ||
| 597 | 598 | ||
| 598 | if (csio_fcoe_alloc_vnp(hw, ln)) | 599 | if (csio_fcoe_alloc_vnp(hw, ln)) |
| 599 | goto error; | 600 | goto error; |
| 600 | 601 | ||
| 601 | *(struct csio_lnode **)fc_vport->dd_data = ln; | 602 | *(struct csio_lnode **)fc_vport->dd_data = ln; |
| 602 | ln->fc_vport = fc_vport; | ||
| 603 | if (!fc_vport->node_name) | 603 | if (!fc_vport->node_name) |
| 604 | fc_vport->node_name = wwn_to_u64(csio_ln_wwnn(ln)); | 604 | fc_vport->node_name = wwn_to_u64(csio_ln_wwnn(ln)); |
| 605 | if (!fc_vport->port_name) | 605 | if (!fc_vport->port_name) |
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index bfa13e3b191c..c8bad2c093b8 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c | |||
| @@ -3687,6 +3687,7 @@ static int cxlflash_probe(struct pci_dev *pdev, | |||
| 3687 | host->max_cmd_len = CXLFLASH_MAX_CDB_LEN; | 3687 | host->max_cmd_len = CXLFLASH_MAX_CDB_LEN; |
| 3688 | 3688 | ||
| 3689 | cfg = shost_priv(host); | 3689 | cfg = shost_priv(host); |
| 3690 | cfg->state = STATE_PROBING; | ||
| 3690 | cfg->host = host; | 3691 | cfg->host = host; |
| 3691 | rc = alloc_mem(cfg); | 3692 | rc = alloc_mem(cfg); |
| 3692 | if (rc) { | 3693 | if (rc) { |
| @@ -3775,6 +3776,7 @@ out: | |||
| 3775 | return rc; | 3776 | return rc; |
| 3776 | 3777 | ||
| 3777 | out_remove: | 3778 | out_remove: |
| 3779 | cfg->state = STATE_PROBED; | ||
| 3778 | cxlflash_remove(pdev); | 3780 | cxlflash_remove(pdev); |
| 3779 | goto out; | 3781 | goto out; |
| 3780 | } | 3782 | } |
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index be83590ed955..ff943f477d6f 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
| @@ -1726,14 +1726,14 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
| 1726 | fc_frame_payload_op(fp) != ELS_LS_ACC) { | 1726 | fc_frame_payload_op(fp) != ELS_LS_ACC) { |
| 1727 | FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n"); | 1727 | FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n"); |
| 1728 | fc_lport_error(lport, fp); | 1728 | fc_lport_error(lport, fp); |
| 1729 | goto err; | 1729 | goto out; |
| 1730 | } | 1730 | } |
| 1731 | 1731 | ||
| 1732 | flp = fc_frame_payload_get(fp, sizeof(*flp)); | 1732 | flp = fc_frame_payload_get(fp, sizeof(*flp)); |
| 1733 | if (!flp) { | 1733 | if (!flp) { |
| 1734 | FC_LPORT_DBG(lport, "FLOGI bad response\n"); | 1734 | FC_LPORT_DBG(lport, "FLOGI bad response\n"); |
| 1735 | fc_lport_error(lport, fp); | 1735 | fc_lport_error(lport, fp); |
| 1736 | goto err; | 1736 | goto out; |
| 1737 | } | 1737 | } |
| 1738 | 1738 | ||
| 1739 | mfs = ntohs(flp->fl_csp.sp_bb_data) & | 1739 | mfs = ntohs(flp->fl_csp.sp_bb_data) & |
| @@ -1743,7 +1743,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
| 1743 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " | 1743 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " |
| 1744 | "lport->mfs:%hu\n", mfs, lport->mfs); | 1744 | "lport->mfs:%hu\n", mfs, lport->mfs); |
| 1745 | fc_lport_error(lport, fp); | 1745 | fc_lport_error(lport, fp); |
| 1746 | goto err; | 1746 | goto out; |
| 1747 | } | 1747 | } |
| 1748 | 1748 | ||
| 1749 | if (mfs <= lport->mfs) { | 1749 | if (mfs <= lport->mfs) { |
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 9192a1d9dec6..dfba4921b265 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c | |||
| @@ -184,7 +184,6 @@ void fc_rport_destroy(struct kref *kref) | |||
| 184 | struct fc_rport_priv *rdata; | 184 | struct fc_rport_priv *rdata; |
| 185 | 185 | ||
| 186 | rdata = container_of(kref, struct fc_rport_priv, kref); | 186 | rdata = container_of(kref, struct fc_rport_priv, kref); |
| 187 | WARN_ON(!list_empty(&rdata->peers)); | ||
| 188 | kfree_rcu(rdata, rcu); | 187 | kfree_rcu(rdata, rcu); |
| 189 | } | 188 | } |
| 190 | EXPORT_SYMBOL(fc_rport_destroy); | 189 | EXPORT_SYMBOL(fc_rport_destroy); |
diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 4c66b19e6199..8c9f79042228 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c | |||
| @@ -297,7 +297,8 @@ lpfc_nvme_localport_delete(struct nvme_fc_local_port *localport) | |||
| 297 | lport); | 297 | lport); |
| 298 | 298 | ||
| 299 | /* release any threads waiting for the unreg to complete */ | 299 | /* release any threads waiting for the unreg to complete */ |
| 300 | complete(&lport->lport_unreg_done); | 300 | if (lport->vport->localport) |
| 301 | complete(lport->lport_unreg_cmp); | ||
| 301 | } | 302 | } |
| 302 | 303 | ||
| 303 | /* lpfc_nvme_remoteport_delete | 304 | /* lpfc_nvme_remoteport_delete |
| @@ -2545,7 +2546,8 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) | |||
| 2545 | */ | 2546 | */ |
| 2546 | void | 2547 | void |
| 2547 | lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, | 2548 | lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, |
| 2548 | struct lpfc_nvme_lport *lport) | 2549 | struct lpfc_nvme_lport *lport, |
| 2550 | struct completion *lport_unreg_cmp) | ||
| 2549 | { | 2551 | { |
| 2550 | #if (IS_ENABLED(CONFIG_NVME_FC)) | 2552 | #if (IS_ENABLED(CONFIG_NVME_FC)) |
| 2551 | u32 wait_tmo; | 2553 | u32 wait_tmo; |
| @@ -2557,8 +2559,7 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, | |||
| 2557 | */ | 2559 | */ |
| 2558 | wait_tmo = msecs_to_jiffies(LPFC_NVME_WAIT_TMO * 1000); | 2560 | wait_tmo = msecs_to_jiffies(LPFC_NVME_WAIT_TMO * 1000); |
| 2559 | while (true) { | 2561 | while (true) { |
| 2560 | ret = wait_for_completion_timeout(&lport->lport_unreg_done, | 2562 | ret = wait_for_completion_timeout(lport_unreg_cmp, wait_tmo); |
| 2561 | wait_tmo); | ||
| 2562 | if (unlikely(!ret)) { | 2563 | if (unlikely(!ret)) { |
| 2563 | lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR, | 2564 | lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR, |
| 2564 | "6176 Lport %p Localport %p wait " | 2565 | "6176 Lport %p Localport %p wait " |
| @@ -2592,12 +2593,12 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) | |||
| 2592 | struct lpfc_nvme_lport *lport; | 2593 | struct lpfc_nvme_lport *lport; |
| 2593 | struct lpfc_nvme_ctrl_stat *cstat; | 2594 | struct lpfc_nvme_ctrl_stat *cstat; |
| 2594 | int ret; | 2595 | int ret; |
| 2596 | DECLARE_COMPLETION_ONSTACK(lport_unreg_cmp); | ||
| 2595 | 2597 | ||
| 2596 | if (vport->nvmei_support == 0) | 2598 | if (vport->nvmei_support == 0) |
| 2597 | return; | 2599 | return; |
| 2598 | 2600 | ||
| 2599 | localport = vport->localport; | 2601 | localport = vport->localport; |
| 2600 | vport->localport = NULL; | ||
| 2601 | lport = (struct lpfc_nvme_lport *)localport->private; | 2602 | lport = (struct lpfc_nvme_lport *)localport->private; |
| 2602 | cstat = lport->cstat; | 2603 | cstat = lport->cstat; |
| 2603 | 2604 | ||
| @@ -2608,13 +2609,14 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) | |||
| 2608 | /* lport's rport list is clear. Unregister | 2609 | /* lport's rport list is clear. Unregister |
| 2609 | * lport and release resources. | 2610 | * lport and release resources. |
| 2610 | */ | 2611 | */ |
| 2611 | init_completion(&lport->lport_unreg_done); | 2612 | lport->lport_unreg_cmp = &lport_unreg_cmp; |
| 2612 | ret = nvme_fc_unregister_localport(localport); | 2613 | ret = nvme_fc_unregister_localport(localport); |
| 2613 | 2614 | ||
| 2614 | /* Wait for completion. This either blocks | 2615 | /* Wait for completion. This either blocks |
| 2615 | * indefinitely or succeeds | 2616 | * indefinitely or succeeds |
| 2616 | */ | 2617 | */ |
| 2617 | lpfc_nvme_lport_unreg_wait(vport, lport); | 2618 | lpfc_nvme_lport_unreg_wait(vport, lport, &lport_unreg_cmp); |
| 2619 | vport->localport = NULL; | ||
| 2618 | kfree(cstat); | 2620 | kfree(cstat); |
| 2619 | 2621 | ||
| 2620 | /* Regardless of the unregister upcall response, clear | 2622 | /* Regardless of the unregister upcall response, clear |
diff --git a/drivers/scsi/lpfc/lpfc_nvme.h b/drivers/scsi/lpfc/lpfc_nvme.h index cfd4719be25c..b234d0298994 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.h +++ b/drivers/scsi/lpfc/lpfc_nvme.h | |||
| @@ -50,7 +50,7 @@ struct lpfc_nvme_ctrl_stat { | |||
| 50 | /* Declare nvme-based local and remote port definitions. */ | 50 | /* Declare nvme-based local and remote port definitions. */ |
| 51 | struct lpfc_nvme_lport { | 51 | struct lpfc_nvme_lport { |
| 52 | struct lpfc_vport *vport; | 52 | struct lpfc_vport *vport; |
| 53 | struct completion lport_unreg_done; | 53 | struct completion *lport_unreg_cmp; |
| 54 | /* Add stats counters here */ | 54 | /* Add stats counters here */ |
| 55 | struct lpfc_nvme_ctrl_stat *cstat; | 55 | struct lpfc_nvme_ctrl_stat *cstat; |
| 56 | atomic_t fc4NvmeLsRequests; | 56 | atomic_t fc4NvmeLsRequests; |
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c index 6245f442d784..95fee83090eb 100644 --- a/drivers/scsi/lpfc/lpfc_nvmet.c +++ b/drivers/scsi/lpfc/lpfc_nvmet.c | |||
| @@ -1003,7 +1003,8 @@ lpfc_nvmet_targetport_delete(struct nvmet_fc_target_port *targetport) | |||
| 1003 | struct lpfc_nvmet_tgtport *tport = targetport->private; | 1003 | struct lpfc_nvmet_tgtport *tport = targetport->private; |
| 1004 | 1004 | ||
| 1005 | /* release any threads waiting for the unreg to complete */ | 1005 | /* release any threads waiting for the unreg to complete */ |
| 1006 | complete(&tport->tport_unreg_done); | 1006 | if (tport->phba->targetport) |
| 1007 | complete(tport->tport_unreg_cmp); | ||
| 1007 | } | 1008 | } |
| 1008 | 1009 | ||
| 1009 | static void | 1010 | static void |
| @@ -1692,6 +1693,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) | |||
| 1692 | struct lpfc_nvmet_tgtport *tgtp; | 1693 | struct lpfc_nvmet_tgtport *tgtp; |
| 1693 | struct lpfc_queue *wq; | 1694 | struct lpfc_queue *wq; |
| 1694 | uint32_t qidx; | 1695 | uint32_t qidx; |
| 1696 | DECLARE_COMPLETION_ONSTACK(tport_unreg_cmp); | ||
| 1695 | 1697 | ||
| 1696 | if (phba->nvmet_support == 0) | 1698 | if (phba->nvmet_support == 0) |
| 1697 | return; | 1699 | return; |
| @@ -1701,9 +1703,9 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) | |||
| 1701 | wq = phba->sli4_hba.nvme_wq[qidx]; | 1703 | wq = phba->sli4_hba.nvme_wq[qidx]; |
| 1702 | lpfc_nvmet_wqfull_flush(phba, wq, NULL); | 1704 | lpfc_nvmet_wqfull_flush(phba, wq, NULL); |
| 1703 | } | 1705 | } |
| 1704 | init_completion(&tgtp->tport_unreg_done); | 1706 | tgtp->tport_unreg_cmp = &tport_unreg_cmp; |
| 1705 | nvmet_fc_unregister_targetport(phba->targetport); | 1707 | nvmet_fc_unregister_targetport(phba->targetport); |
| 1706 | wait_for_completion_timeout(&tgtp->tport_unreg_done, 5); | 1708 | wait_for_completion_timeout(&tport_unreg_cmp, 5); |
| 1707 | lpfc_nvmet_cleanup_io_context(phba); | 1709 | lpfc_nvmet_cleanup_io_context(phba); |
| 1708 | } | 1710 | } |
| 1709 | phba->targetport = NULL; | 1711 | phba->targetport = NULL; |
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.h b/drivers/scsi/lpfc/lpfc_nvmet.h index 1aaff63f1f41..0ec1082ce7ef 100644 --- a/drivers/scsi/lpfc/lpfc_nvmet.h +++ b/drivers/scsi/lpfc/lpfc_nvmet.h | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | /* Used for NVME Target */ | 34 | /* Used for NVME Target */ |
| 35 | struct lpfc_nvmet_tgtport { | 35 | struct lpfc_nvmet_tgtport { |
| 36 | struct lpfc_hba *phba; | 36 | struct lpfc_hba *phba; |
| 37 | struct completion tport_unreg_done; | 37 | struct completion *tport_unreg_cmp; |
| 38 | 38 | ||
| 39 | /* Stats counters - lpfc_nvmet_unsol_ls_buffer */ | 39 | /* Stats counters - lpfc_nvmet_unsol_ls_buffer */ |
| 40 | atomic_t rcv_ls_req_in; | 40 | atomic_t rcv_ls_req_in; |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 661512bec3ac..e27f4df24021 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | 62 | ||
| 63 | /* make sure inq_product_rev string corresponds to this version */ | 63 | /* make sure inq_product_rev string corresponds to this version */ |
| 64 | #define SDEBUG_VERSION "0188" /* format to fit INQUIRY revision field */ | 64 | #define SDEBUG_VERSION "0188" /* format to fit INQUIRY revision field */ |
| 65 | static const char *sdebug_version_date = "20180128"; | 65 | static const char *sdebug_version_date = "20190125"; |
| 66 | 66 | ||
| 67 | #define MY_NAME "scsi_debug" | 67 | #define MY_NAME "scsi_debug" |
| 68 | 68 | ||
| @@ -735,7 +735,7 @@ static inline bool scsi_debug_lbp(void) | |||
| 735 | (sdebug_lbpu || sdebug_lbpws || sdebug_lbpws10); | 735 | (sdebug_lbpu || sdebug_lbpws || sdebug_lbpws10); |
| 736 | } | 736 | } |
| 737 | 737 | ||
| 738 | static void *fake_store(unsigned long long lba) | 738 | static void *lba2fake_store(unsigned long long lba) |
| 739 | { | 739 | { |
| 740 | lba = do_div(lba, sdebug_store_sectors); | 740 | lba = do_div(lba, sdebug_store_sectors); |
| 741 | 741 | ||
| @@ -2514,8 +2514,8 @@ static int do_device_access(struct scsi_cmnd *scmd, u32 sg_skip, u64 lba, | |||
| 2514 | return ret; | 2514 | return ret; |
| 2515 | } | 2515 | } |
| 2516 | 2516 | ||
| 2517 | /* If fake_store(lba,num) compares equal to arr(num), then copy top half of | 2517 | /* If lba2fake_store(lba,num) compares equal to arr(num), then copy top half of |
| 2518 | * arr into fake_store(lba,num) and return true. If comparison fails then | 2518 | * arr into lba2fake_store(lba,num) and return true. If comparison fails then |
| 2519 | * return false. */ | 2519 | * return false. */ |
| 2520 | static bool comp_write_worker(u64 lba, u32 num, const u8 *arr) | 2520 | static bool comp_write_worker(u64 lba, u32 num, const u8 *arr) |
| 2521 | { | 2521 | { |
| @@ -2643,7 +2643,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec, | |||
| 2643 | if (sdt->app_tag == cpu_to_be16(0xffff)) | 2643 | if (sdt->app_tag == cpu_to_be16(0xffff)) |
| 2644 | continue; | 2644 | continue; |
| 2645 | 2645 | ||
| 2646 | ret = dif_verify(sdt, fake_store(sector), sector, ei_lba); | 2646 | ret = dif_verify(sdt, lba2fake_store(sector), sector, ei_lba); |
| 2647 | if (ret) { | 2647 | if (ret) { |
| 2648 | dif_errors++; | 2648 | dif_errors++; |
| 2649 | return ret; | 2649 | return ret; |
| @@ -3261,10 +3261,12 @@ err_out: | |||
| 3261 | static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, | 3261 | static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, |
| 3262 | u32 ei_lba, bool unmap, bool ndob) | 3262 | u32 ei_lba, bool unmap, bool ndob) |
| 3263 | { | 3263 | { |
| 3264 | int ret; | ||
| 3264 | unsigned long iflags; | 3265 | unsigned long iflags; |
| 3265 | unsigned long long i; | 3266 | unsigned long long i; |
| 3266 | int ret; | 3267 | u32 lb_size = sdebug_sector_size; |
| 3267 | u64 lba_off; | 3268 | u64 block, lbaa; |
| 3269 | u8 *fs1p; | ||
| 3268 | 3270 | ||
| 3269 | ret = check_device_access_params(scp, lba, num); | 3271 | ret = check_device_access_params(scp, lba, num); |
| 3270 | if (ret) | 3272 | if (ret) |
| @@ -3276,31 +3278,30 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, | |||
| 3276 | unmap_region(lba, num); | 3278 | unmap_region(lba, num); |
| 3277 | goto out; | 3279 | goto out; |
| 3278 | } | 3280 | } |
| 3279 | 3281 | lbaa = lba; | |
| 3280 | lba_off = lba * sdebug_sector_size; | 3282 | block = do_div(lbaa, sdebug_store_sectors); |
| 3281 | /* if ndob then zero 1 logical block, else fetch 1 logical block */ | 3283 | /* if ndob then zero 1 logical block, else fetch 1 logical block */ |
| 3284 | fs1p = fake_storep + (block * lb_size); | ||
| 3282 | if (ndob) { | 3285 | if (ndob) { |
| 3283 | memset(fake_storep + lba_off, 0, sdebug_sector_size); | 3286 | memset(fs1p, 0, lb_size); |
| 3284 | ret = 0; | 3287 | ret = 0; |
| 3285 | } else | 3288 | } else |
| 3286 | ret = fetch_to_dev_buffer(scp, fake_storep + lba_off, | 3289 | ret = fetch_to_dev_buffer(scp, fs1p, lb_size); |
| 3287 | sdebug_sector_size); | ||
| 3288 | 3290 | ||
| 3289 | if (-1 == ret) { | 3291 | if (-1 == ret) { |
| 3290 | write_unlock_irqrestore(&atomic_rw, iflags); | 3292 | write_unlock_irqrestore(&atomic_rw, iflags); |
| 3291 | return DID_ERROR << 16; | 3293 | return DID_ERROR << 16; |
| 3292 | } else if (sdebug_verbose && !ndob && (ret < sdebug_sector_size)) | 3294 | } else if (sdebug_verbose && !ndob && (ret < lb_size)) |
| 3293 | sdev_printk(KERN_INFO, scp->device, | 3295 | sdev_printk(KERN_INFO, scp->device, |
| 3294 | "%s: %s: lb size=%u, IO sent=%d bytes\n", | 3296 | "%s: %s: lb size=%u, IO sent=%d bytes\n", |
| 3295 | my_name, "write same", | 3297 | my_name, "write same", lb_size, ret); |
| 3296 | sdebug_sector_size, ret); | ||
| 3297 | 3298 | ||
| 3298 | /* Copy first sector to remaining blocks */ | 3299 | /* Copy first sector to remaining blocks */ |
| 3299 | for (i = 1 ; i < num ; i++) | 3300 | for (i = 1 ; i < num ; i++) { |
| 3300 | memcpy(fake_storep + ((lba + i) * sdebug_sector_size), | 3301 | lbaa = lba + i; |
| 3301 | fake_storep + lba_off, | 3302 | block = do_div(lbaa, sdebug_store_sectors); |
| 3302 | sdebug_sector_size); | 3303 | memmove(fake_storep + (block * lb_size), fs1p, lb_size); |
| 3303 | 3304 | } | |
| 3304 | if (scsi_debug_lbp()) | 3305 | if (scsi_debug_lbp()) |
| 3305 | map_region(lba, num); | 3306 | map_region(lba, num); |
| 3306 | out: | 3307 | out: |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b13cc9288ba0..6d65ac584eba 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -1842,8 +1842,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) | |||
| 1842 | blk_queue_segment_boundary(q, shost->dma_boundary); | 1842 | blk_queue_segment_boundary(q, shost->dma_boundary); |
| 1843 | dma_set_seg_boundary(dev, shost->dma_boundary); | 1843 | dma_set_seg_boundary(dev, shost->dma_boundary); |
| 1844 | 1844 | ||
| 1845 | blk_queue_max_segment_size(q, | 1845 | blk_queue_max_segment_size(q, shost->max_segment_size); |
| 1846 | min(shost->max_segment_size, dma_get_max_seg_size(dev))); | 1846 | dma_set_max_seg_size(dev, shost->max_segment_size); |
| 1847 | 1847 | ||
| 1848 | /* | 1848 | /* |
| 1849 | * Set a reasonable default alignment: The larger of 32-byte (dword), | 1849 | * Set a reasonable default alignment: The larger of 32-byte (dword), |
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 83365b29a4d8..fff86940388b 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c | |||
| @@ -462,12 +462,16 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) | |||
| 462 | sdkp->device->use_10_for_rw = 0; | 462 | sdkp->device->use_10_for_rw = 0; |
| 463 | 463 | ||
| 464 | /* | 464 | /* |
| 465 | * If something changed, revalidate the disk zone bitmaps once we have | 465 | * Revalidate the disk zone bitmaps once the block device capacity is |
| 466 | * the capacity, that is on the second revalidate execution during disk | 466 | * set on the second revalidate execution during disk scan and if |
| 467 | * scan and always during normal revalidate. | 467 | * something changed when executing a normal revalidate. |
| 468 | */ | 468 | */ |
| 469 | if (sdkp->first_scan) | 469 | if (sdkp->first_scan) { |
| 470 | sdkp->zone_blocks = zone_blocks; | ||
| 471 | sdkp->nr_zones = nr_zones; | ||
| 470 | return 0; | 472 | return 0; |
| 473 | } | ||
| 474 | |||
| 471 | if (sdkp->zone_blocks != zone_blocks || | 475 | if (sdkp->zone_blocks != zone_blocks || |
| 472 | sdkp->nr_zones != nr_zones || | 476 | sdkp->nr_zones != nr_zones || |
| 473 | disk->queue->nr_zones != nr_zones) { | 477 | disk->queue->nr_zones != nr_zones) { |
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 71334aaf1447..2ddf24466a62 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
| @@ -108,13 +108,19 @@ | |||
| 108 | int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, | 108 | int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, |
| 109 | const char *prefix) | 109 | const char *prefix) |
| 110 | { | 110 | { |
| 111 | u8 *regs; | 111 | u32 *regs; |
| 112 | size_t pos; | ||
| 113 | |||
| 114 | if (offset % 4 != 0 || len % 4 != 0) /* keep readl happy */ | ||
| 115 | return -EINVAL; | ||
| 112 | 116 | ||
| 113 | regs = kzalloc(len, GFP_KERNEL); | 117 | regs = kzalloc(len, GFP_KERNEL); |
| 114 | if (!regs) | 118 | if (!regs) |
| 115 | return -ENOMEM; | 119 | return -ENOMEM; |
| 116 | 120 | ||
| 117 | memcpy_fromio(regs, hba->mmio_base + offset, len); | 121 | for (pos = 0; pos < len; pos += 4) |
| 122 | regs[pos / 4] = ufshcd_readl(hba, offset + pos); | ||
| 123 | |||
| 118 | ufshcd_hex_dump(prefix, regs, len); | 124 | ufshcd_hex_dump(prefix, regs, len); |
| 119 | kfree(regs); | 125 | kfree(regs); |
| 120 | 126 | ||
diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index 52c153cd795a..636f83f781f5 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c | |||
| @@ -1143,18 +1143,19 @@ static void qm_mr_process_task(struct work_struct *work); | |||
| 1143 | static irqreturn_t portal_isr(int irq, void *ptr) | 1143 | static irqreturn_t portal_isr(int irq, void *ptr) |
| 1144 | { | 1144 | { |
| 1145 | struct qman_portal *p = ptr; | 1145 | struct qman_portal *p = ptr; |
| 1146 | |||
| 1147 | u32 clear = QM_DQAVAIL_MASK | p->irq_sources; | ||
| 1148 | u32 is = qm_in(&p->p, QM_REG_ISR) & p->irq_sources; | 1146 | u32 is = qm_in(&p->p, QM_REG_ISR) & p->irq_sources; |
| 1147 | u32 clear = 0; | ||
| 1149 | 1148 | ||
| 1150 | if (unlikely(!is)) | 1149 | if (unlikely(!is)) |
| 1151 | return IRQ_NONE; | 1150 | return IRQ_NONE; |
| 1152 | 1151 | ||
| 1153 | /* DQRR-handling if it's interrupt-driven */ | 1152 | /* DQRR-handling if it's interrupt-driven */ |
| 1154 | if (is & QM_PIRQ_DQRI) | 1153 | if (is & QM_PIRQ_DQRI) { |
| 1155 | __poll_portal_fast(p, QMAN_POLL_LIMIT); | 1154 | __poll_portal_fast(p, QMAN_POLL_LIMIT); |
| 1155 | clear = QM_DQAVAIL_MASK | QM_PIRQ_DQRI; | ||
| 1156 | } | ||
| 1156 | /* Handling of anything else that's interrupt-driven */ | 1157 | /* Handling of anything else that's interrupt-driven */ |
| 1157 | clear |= __poll_portal_slow(p, is); | 1158 | clear |= __poll_portal_slow(p, is) & QM_PIRQ_SLOW; |
| 1158 | qm_out(&p->p, QM_REG_ISR, clear); | 1159 | qm_out(&p->p, QM_REG_ISR, clear); |
| 1159 | return IRQ_HANDLED; | 1160 | return IRQ_HANDLED; |
| 1160 | } | 1161 | } |
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index a0802de8c3a1..6f5afab7c1a1 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c | |||
| @@ -248,10 +248,10 @@ static void ion_dma_buf_detatch(struct dma_buf *dmabuf, | |||
| 248 | struct ion_dma_buf_attachment *a = attachment->priv; | 248 | struct ion_dma_buf_attachment *a = attachment->priv; |
| 249 | struct ion_buffer *buffer = dmabuf->priv; | 249 | struct ion_buffer *buffer = dmabuf->priv; |
| 250 | 250 | ||
| 251 | free_duped_table(a->table); | ||
| 252 | mutex_lock(&buffer->lock); | 251 | mutex_lock(&buffer->lock); |
| 253 | list_del(&a->list); | 252 | list_del(&a->list); |
| 254 | mutex_unlock(&buffer->lock); | 253 | mutex_unlock(&buffer->lock); |
| 254 | free_duped_table(a->table); | ||
| 255 | 255 | ||
| 256 | kfree(a); | 256 | kfree(a); |
| 257 | } | 257 | } |
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index 2848fa71a33d..d6248eecf123 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c | |||
| @@ -170,7 +170,7 @@ int cvm_oct_phy_setup_device(struct net_device *dev) | |||
| 170 | return -ENODEV; | 170 | return -ENODEV; |
| 171 | 171 | ||
| 172 | priv->last_link = 0; | 172 | priv->last_link = 0; |
| 173 | phy_start_aneg(phydev); | 173 | phy_start(phydev); |
| 174 | 174 | ||
| 175 | return 0; | 175 | return 0; |
| 176 | no_phy: | 176 | no_phy: |
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 28cbd6b3d26c..dfee6985efa6 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
| @@ -35,6 +35,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { | |||
| 35 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 35 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
| 36 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ | 36 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ |
| 37 | {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ | 37 | {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ |
| 38 | {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ | ||
| 38 | {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ | 39 | {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ |
| 39 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ | 40 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ |
| 40 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ | 41 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ |
diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h index bcc8dfa8e672..9efb4dcb9d3a 100644 --- a/drivers/staging/rtl8723bs/include/ieee80211.h +++ b/drivers/staging/rtl8723bs/include/ieee80211.h | |||
| @@ -850,18 +850,18 @@ enum ieee80211_state { | |||
| 850 | #define IP_FMT "%pI4" | 850 | #define IP_FMT "%pI4" |
| 851 | #define IP_ARG(x) (x) | 851 | #define IP_ARG(x) (x) |
| 852 | 852 | ||
| 853 | extern __inline int is_multicast_mac_addr(const u8 *addr) | 853 | static inline int is_multicast_mac_addr(const u8 *addr) |
| 854 | { | 854 | { |
| 855 | return ((addr[0] != 0xff) && (0x01 & addr[0])); | 855 | return ((addr[0] != 0xff) && (0x01 & addr[0])); |
| 856 | } | 856 | } |
| 857 | 857 | ||
| 858 | extern __inline int is_broadcast_mac_addr(const u8 *addr) | 858 | static inline int is_broadcast_mac_addr(const u8 *addr) |
| 859 | { | 859 | { |
| 860 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ | 860 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ |
| 861 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); | 861 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 862 | } | 862 | } |
| 863 | 863 | ||
| 864 | extern __inline int is_zero_mac_addr(const u8 *addr) | 864 | static inline int is_zero_mac_addr(const u8 *addr) |
| 865 | { | 865 | { |
| 866 | return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \ | 866 | return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \ |
| 867 | (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00)); | 867 | (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00)); |
diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index c92bbd05516e..005de0024dd4 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c | |||
| @@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch) | |||
| 265 | return; | 265 | return; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | speakup_tty->ops->send_xchar(speakup_tty, ch); | 268 | if (speakup_tty->ops->send_xchar) |
| 269 | speakup_tty->ops->send_xchar(speakup_tty, ch); | ||
| 269 | mutex_unlock(&speakup_tty_mutex); | 270 | mutex_unlock(&speakup_tty_mutex); |
| 270 | } | 271 | } |
| 271 | 272 | ||
| @@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear) | |||
| 277 | return; | 278 | return; |
| 278 | } | 279 | } |
| 279 | 280 | ||
| 280 | speakup_tty->ops->tiocmset(speakup_tty, set, clear); | 281 | if (speakup_tty->ops->tiocmset) |
| 282 | speakup_tty->ops->tiocmset(speakup_tty, set, clear); | ||
| 281 | mutex_unlock(&speakup_tty_mutex); | 283 | mutex_unlock(&speakup_tty_mutex); |
| 282 | } | 284 | } |
| 283 | 285 | ||
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 9e17ec651bde..53f5a1cb4636 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | |||
| @@ -446,6 +446,7 @@ remote_event_wait(wait_queue_head_t *wq, struct remote_event *event) | |||
| 446 | static inline void | 446 | static inline void |
| 447 | remote_event_signal_local(wait_queue_head_t *wq, struct remote_event *event) | 447 | remote_event_signal_local(wait_queue_head_t *wq, struct remote_event *event) |
| 448 | { | 448 | { |
| 449 | event->fired = 1; | ||
| 449 | event->armed = 0; | 450 | event->armed = 0; |
| 450 | wake_up_all(wq); | 451 | wake_up_all(wq); |
| 451 | } | 452 | } |
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 70c854d939ce..3d0badc34825 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c | |||
| @@ -36,7 +36,7 @@ struct wilc_op_mode { | |||
| 36 | struct wilc_reg_frame { | 36 | struct wilc_reg_frame { |
| 37 | bool reg; | 37 | bool reg; |
| 38 | u8 reg_id; | 38 | u8 reg_id; |
| 39 | __le32 frame_type; | 39 | __le16 frame_type; |
| 40 | } __packed; | 40 | } __packed; |
| 41 | 41 | ||
| 42 | struct wilc_drv_handler { | 42 | struct wilc_drv_handler { |
| @@ -1744,7 +1744,6 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, | |||
| 1744 | result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, | 1744 | result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, |
| 1745 | ARRAY_SIZE(wid_list), | 1745 | ARRAY_SIZE(wid_list), |
| 1746 | wilc_get_vif_idx(vif)); | 1746 | wilc_get_vif_idx(vif)); |
| 1747 | kfree(gtk_key); | ||
| 1748 | } else if (mode == WILC_STATION_MODE) { | 1747 | } else if (mode == WILC_STATION_MODE) { |
| 1749 | struct wid wid; | 1748 | struct wid wid; |
| 1750 | 1749 | ||
| @@ -1754,9 +1753,9 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, | |||
| 1754 | wid.val = (u8 *)gtk_key; | 1753 | wid.val = (u8 *)gtk_key; |
| 1755 | result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, | 1754 | result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, |
| 1756 | wilc_get_vif_idx(vif)); | 1755 | wilc_get_vif_idx(vif)); |
| 1757 | kfree(gtk_key); | ||
| 1758 | } | 1756 | } |
| 1759 | 1757 | ||
| 1758 | kfree(gtk_key); | ||
| 1760 | return result; | 1759 | return result; |
| 1761 | } | 1760 | } |
| 1762 | 1761 | ||
diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 3c5e9e030cad..489e5a5038f8 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c | |||
| @@ -1252,21 +1252,22 @@ static u32 init_chip(struct net_device *dev) | |||
| 1252 | ret = wilc->hif_func->hif_read_reg(wilc, 0x1118, ®); | 1252 | ret = wilc->hif_func->hif_read_reg(wilc, 0x1118, ®); |
| 1253 | if (!ret) { | 1253 | if (!ret) { |
| 1254 | netdev_err(dev, "fail read reg 0x1118\n"); | 1254 | netdev_err(dev, "fail read reg 0x1118\n"); |
| 1255 | return ret; | 1255 | goto release; |
| 1256 | } | 1256 | } |
| 1257 | reg |= BIT(0); | 1257 | reg |= BIT(0); |
| 1258 | ret = wilc->hif_func->hif_write_reg(wilc, 0x1118, reg); | 1258 | ret = wilc->hif_func->hif_write_reg(wilc, 0x1118, reg); |
| 1259 | if (!ret) { | 1259 | if (!ret) { |
| 1260 | netdev_err(dev, "fail write reg 0x1118\n"); | 1260 | netdev_err(dev, "fail write reg 0x1118\n"); |
| 1261 | return ret; | 1261 | goto release; |
| 1262 | } | 1262 | } |
| 1263 | ret = wilc->hif_func->hif_write_reg(wilc, 0xc0000, 0x71); | 1263 | ret = wilc->hif_func->hif_write_reg(wilc, 0xc0000, 0x71); |
| 1264 | if (!ret) { | 1264 | if (!ret) { |
| 1265 | netdev_err(dev, "fail write reg 0xc0000\n"); | 1265 | netdev_err(dev, "fail write reg 0xc0000\n"); |
| 1266 | return ret; | 1266 | goto release; |
| 1267 | } | 1267 | } |
| 1268 | } | 1268 | } |
| 1269 | 1269 | ||
| 1270 | release: | ||
| 1270 | release_bus(wilc, WILC_BUS_RELEASE_ONLY); | 1271 | release_bus(wilc, WILC_BUS_RELEASE_ONLY); |
| 1271 | 1272 | ||
| 1272 | return ret; | 1273 | return ret; |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 72016d0dfca5..8e7fffbb8802 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
| @@ -852,6 +852,12 @@ static ssize_t pi_prot_type_store(struct config_item *item, | |||
| 852 | return count; | 852 | return count; |
| 853 | } | 853 | } |
| 854 | 854 | ||
| 855 | /* always zero, but attr needs to remain RW to avoid userspace breakage */ | ||
| 856 | static ssize_t pi_prot_format_show(struct config_item *item, char *page) | ||
| 857 | { | ||
| 858 | return snprintf(page, PAGE_SIZE, "0\n"); | ||
| 859 | } | ||
| 860 | |||
| 855 | static ssize_t pi_prot_format_store(struct config_item *item, | 861 | static ssize_t pi_prot_format_store(struct config_item *item, |
| 856 | const char *page, size_t count) | 862 | const char *page, size_t count) |
| 857 | { | 863 | { |
| @@ -1132,7 +1138,7 @@ CONFIGFS_ATTR(, emulate_3pc); | |||
| 1132 | CONFIGFS_ATTR(, emulate_pr); | 1138 | CONFIGFS_ATTR(, emulate_pr); |
| 1133 | CONFIGFS_ATTR(, pi_prot_type); | 1139 | CONFIGFS_ATTR(, pi_prot_type); |
| 1134 | CONFIGFS_ATTR_RO(, hw_pi_prot_type); | 1140 | CONFIGFS_ATTR_RO(, hw_pi_prot_type); |
| 1135 | CONFIGFS_ATTR_WO(, pi_prot_format); | 1141 | CONFIGFS_ATTR(, pi_prot_format); |
| 1136 | CONFIGFS_ATTR(, pi_prot_verify); | 1142 | CONFIGFS_ATTR(, pi_prot_verify); |
| 1137 | CONFIGFS_ATTR(, enforce_pr_isids); | 1143 | CONFIGFS_ATTR(, enforce_pr_isids); |
| 1138 | CONFIGFS_ATTR(, is_nonrot); | 1144 | CONFIGFS_ATTR(, is_nonrot); |
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index c34c88ef3319..5831e0eecea1 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
| @@ -1317,12 +1317,13 @@ static int tcmu_check_expired_cmd(int id, void *p, void *data) | |||
| 1317 | * target_complete_cmd will translate this to LUN COMM FAILURE | 1317 | * target_complete_cmd will translate this to LUN COMM FAILURE |
| 1318 | */ | 1318 | */ |
| 1319 | scsi_status = SAM_STAT_CHECK_CONDITION; | 1319 | scsi_status = SAM_STAT_CHECK_CONDITION; |
| 1320 | list_del_init(&cmd->queue_entry); | ||
| 1320 | } else { | 1321 | } else { |
| 1322 | list_del_init(&cmd->queue_entry); | ||
| 1321 | idr_remove(&udev->commands, id); | 1323 | idr_remove(&udev->commands, id); |
| 1322 | tcmu_free_cmd(cmd); | 1324 | tcmu_free_cmd(cmd); |
| 1323 | scsi_status = SAM_STAT_TASK_SET_FULL; | 1325 | scsi_status = SAM_STAT_TASK_SET_FULL; |
| 1324 | } | 1326 | } |
| 1325 | list_del_init(&cmd->queue_entry); | ||
| 1326 | 1327 | ||
| 1327 | pr_debug("Timing out cmd %u on dev %s that is %s.\n", | 1328 | pr_debug("Timing out cmd %u on dev %s that is %s.\n", |
| 1328 | id, udev->name, is_running ? "inflight" : "queued"); | 1329 | id, udev->name, is_running ? "inflight" : "queued"); |
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index dfd23245f778..6fff16113628 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
| @@ -774,7 +774,7 @@ of_cpufreq_cooling_register(struct cpufreq_policy *policy) | |||
| 774 | 774 | ||
| 775 | cdev = __cpufreq_cooling_register(np, policy, capacitance); | 775 | cdev = __cpufreq_cooling_register(np, policy, capacitance); |
| 776 | if (IS_ERR(cdev)) { | 776 | if (IS_ERR(cdev)) { |
| 777 | pr_err("cpu_cooling: cpu%d is not running as cooling device: %ld\n", | 777 | pr_err("cpu_cooling: cpu%d failed to register as cooling device: %ld\n", |
| 778 | policy->cpu, PTR_ERR(cdev)); | 778 | policy->cpu, PTR_ERR(cdev)); |
| 779 | cdev = NULL; | 779 | cdev = NULL; |
| 780 | } | 780 | } |
diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c index 284cf2c5a8fd..8e1cf4d789be 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c | |||
| @@ -84,7 +84,12 @@ static ssize_t power_limit_##index##_##suffix##_show(struct device *dev, \ | |||
| 84 | struct pci_dev *pci_dev; \ | 84 | struct pci_dev *pci_dev; \ |
| 85 | struct platform_device *pdev; \ | 85 | struct platform_device *pdev; \ |
| 86 | struct proc_thermal_device *proc_dev; \ | 86 | struct proc_thermal_device *proc_dev; \ |
| 87 | \ | 87 | \ |
| 88 | if (proc_thermal_emum_mode == PROC_THERMAL_NONE) { \ | ||
| 89 | dev_warn(dev, "Attempted to get power limit before device was initialized!\n"); \ | ||
| 90 | return 0; \ | ||
| 91 | } \ | ||
| 92 | \ | ||
| 88 | if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \ | 93 | if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \ |
| 89 | pdev = to_platform_device(dev); \ | 94 | pdev = to_platform_device(dev); \ |
| 90 | proc_dev = platform_get_drvdata(pdev); \ | 95 | proc_dev = platform_get_drvdata(pdev); \ |
| @@ -298,11 +303,6 @@ static int proc_thermal_add(struct device *dev, | |||
| 298 | *priv = proc_priv; | 303 | *priv = proc_priv; |
| 299 | 304 | ||
| 300 | ret = proc_thermal_read_ppcc(proc_priv); | 305 | ret = proc_thermal_read_ppcc(proc_priv); |
| 301 | if (!ret) { | ||
| 302 | ret = sysfs_create_group(&dev->kobj, | ||
| 303 | &power_limit_attribute_group); | ||
| 304 | |||
| 305 | } | ||
| 306 | if (ret) | 306 | if (ret) |
| 307 | return ret; | 307 | return ret; |
| 308 | 308 | ||
| @@ -316,8 +316,7 @@ static int proc_thermal_add(struct device *dev, | |||
| 316 | 316 | ||
| 317 | proc_priv->int340x_zone = int340x_thermal_zone_add(adev, ops); | 317 | proc_priv->int340x_zone = int340x_thermal_zone_add(adev, ops); |
| 318 | if (IS_ERR(proc_priv->int340x_zone)) { | 318 | if (IS_ERR(proc_priv->int340x_zone)) { |
| 319 | ret = PTR_ERR(proc_priv->int340x_zone); | 319 | return PTR_ERR(proc_priv->int340x_zone); |
| 320 | goto remove_group; | ||
| 321 | } else | 320 | } else |
| 322 | ret = 0; | 321 | ret = 0; |
| 323 | 322 | ||
| @@ -331,9 +330,6 @@ static int proc_thermal_add(struct device *dev, | |||
| 331 | 330 | ||
| 332 | remove_zone: | 331 | remove_zone: |
| 333 | int340x_thermal_zone_remove(proc_priv->int340x_zone); | 332 | int340x_thermal_zone_remove(proc_priv->int340x_zone); |
| 334 | remove_group: | ||
| 335 | sysfs_remove_group(&proc_priv->dev->kobj, | ||
| 336 | &power_limit_attribute_group); | ||
| 337 | 333 | ||
| 338 | return ret; | 334 | return ret; |
| 339 | } | 335 | } |
| @@ -364,7 +360,10 @@ static int int3401_add(struct platform_device *pdev) | |||
| 364 | platform_set_drvdata(pdev, proc_priv); | 360 | platform_set_drvdata(pdev, proc_priv); |
| 365 | proc_thermal_emum_mode = PROC_THERMAL_PLATFORM_DEV; | 361 | proc_thermal_emum_mode = PROC_THERMAL_PLATFORM_DEV; |
| 366 | 362 | ||
| 367 | return 0; | 363 | dev_info(&pdev->dev, "Creating sysfs group for PROC_THERMAL_PLATFORM_DEV\n"); |
| 364 | |||
| 365 | return sysfs_create_group(&pdev->dev.kobj, | ||
| 366 | &power_limit_attribute_group); | ||
| 368 | } | 367 | } |
| 369 | 368 | ||
| 370 | static int int3401_remove(struct platform_device *pdev) | 369 | static int int3401_remove(struct platform_device *pdev) |
| @@ -423,7 +422,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, | |||
| 423 | proc_priv->soc_dts = intel_soc_dts_iosf_init( | 422 | proc_priv->soc_dts = intel_soc_dts_iosf_init( |
| 424 | INTEL_SOC_DTS_INTERRUPT_MSI, 2, 0); | 423 | INTEL_SOC_DTS_INTERRUPT_MSI, 2, 0); |
| 425 | 424 | ||
| 426 | if (proc_priv->soc_dts && pdev->irq) { | 425 | if (!IS_ERR(proc_priv->soc_dts) && pdev->irq) { |
| 427 | ret = pci_enable_msi(pdev); | 426 | ret = pci_enable_msi(pdev); |
| 428 | if (!ret) { | 427 | if (!ret) { |
| 429 | ret = request_threaded_irq(pdev->irq, NULL, | 428 | ret = request_threaded_irq(pdev->irq, NULL, |
| @@ -441,7 +440,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, | |||
| 441 | dev_err(&pdev->dev, "No auxiliary DTSs enabled\n"); | 440 | dev_err(&pdev->dev, "No auxiliary DTSs enabled\n"); |
| 442 | } | 441 | } |
| 443 | 442 | ||
| 444 | return 0; | 443 | dev_info(&pdev->dev, "Creating sysfs group for PROC_THERMAL_PCI\n"); |
| 444 | |||
| 445 | return sysfs_create_group(&pdev->dev.kobj, | ||
| 446 | &power_limit_attribute_group); | ||
| 445 | } | 447 | } |
| 446 | 448 | ||
| 447 | static void proc_thermal_pci_remove(struct pci_dev *pdev) | 449 | static void proc_thermal_pci_remove(struct pci_dev *pdev) |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 4bfdb4a1e47d..2df059cc07e2 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
| @@ -867,14 +867,14 @@ __init *thermal_of_build_thermal_zone(struct device_node *np) | |||
| 867 | 867 | ||
| 868 | ret = of_property_read_u32(np, "polling-delay-passive", &prop); | 868 | ret = of_property_read_u32(np, "polling-delay-passive", &prop); |
| 869 | if (ret < 0) { | 869 | if (ret < 0) { |
| 870 | pr_err("missing polling-delay-passive property\n"); | 870 | pr_err("%pOFn: missing polling-delay-passive property\n", np); |
| 871 | goto free_tz; | 871 | goto free_tz; |
| 872 | } | 872 | } |
| 873 | tz->passive_delay = prop; | 873 | tz->passive_delay = prop; |
| 874 | 874 | ||
| 875 | ret = of_property_read_u32(np, "polling-delay", &prop); | 875 | ret = of_property_read_u32(np, "polling-delay", &prop); |
| 876 | if (ret < 0) { | 876 | if (ret < 0) { |
| 877 | pr_err("missing polling-delay property\n"); | 877 | pr_err("%pOFn: missing polling-delay property\n", np); |
| 878 | goto free_tz; | 878 | goto free_tz; |
| 879 | } | 879 | } |
| 880 | tz->polling_delay = prop; | 880 | tz->polling_delay = prop; |
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index 4164414d4c64..8bdf42bc8fc8 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c | |||
| @@ -597,6 +597,7 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, | |||
| 597 | /* too large for caller's buffer */ | 597 | /* too large for caller's buffer */ |
| 598 | ret = -EOVERFLOW; | 598 | ret = -EOVERFLOW; |
| 599 | } else { | 599 | } else { |
| 600 | __set_current_state(TASK_RUNNING); | ||
| 600 | if (copy_to_user(buf, rbuf->buf, rbuf->count)) | 601 | if (copy_to_user(buf, rbuf->buf, rbuf->count)) |
| 601 | ret = -EFAULT; | 602 | ret = -EFAULT; |
| 602 | else | 603 | else |
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 189ab1212d9a..e441221e04b9 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
| @@ -1070,15 +1070,16 @@ int serial8250_register_8250_port(struct uart_8250_port *up) | |||
| 1070 | 1070 | ||
| 1071 | ret = 0; | 1071 | ret = 0; |
| 1072 | } | 1072 | } |
| 1073 | } | ||
| 1074 | 1073 | ||
| 1075 | /* Initialise interrupt backoff work if required */ | 1074 | /* Initialise interrupt backoff work if required */ |
| 1076 | if (up->overrun_backoff_time_ms > 0) { | 1075 | if (up->overrun_backoff_time_ms > 0) { |
| 1077 | uart->overrun_backoff_time_ms = up->overrun_backoff_time_ms; | 1076 | uart->overrun_backoff_time_ms = |
| 1078 | INIT_DELAYED_WORK(&uart->overrun_backoff, | 1077 | up->overrun_backoff_time_ms; |
| 1079 | serial_8250_overrun_backoff_work); | 1078 | INIT_DELAYED_WORK(&uart->overrun_backoff, |
| 1080 | } else { | 1079 | serial_8250_overrun_backoff_work); |
| 1081 | uart->overrun_backoff_time_ms = 0; | 1080 | } else { |
| 1081 | uart->overrun_backoff_time_ms = 0; | ||
| 1082 | } | ||
| 1082 | } | 1083 | } |
| 1083 | 1084 | ||
| 1084 | mutex_unlock(&serial_mutex); | 1085 | mutex_unlock(&serial_mutex); |
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c index e2c407656fa6..c1fdbc0b6840 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c | |||
| @@ -357,6 +357,9 @@ static int mtk8250_probe_of(struct platform_device *pdev, struct uart_port *p, | |||
| 357 | if (dmacnt == 2) { | 357 | if (dmacnt == 2) { |
| 358 | data->dma = devm_kzalloc(&pdev->dev, sizeof(*data->dma), | 358 | data->dma = devm_kzalloc(&pdev->dev, sizeof(*data->dma), |
| 359 | GFP_KERNEL); | 359 | GFP_KERNEL); |
| 360 | if (!data->dma) | ||
| 361 | return -ENOMEM; | ||
| 362 | |||
| 360 | data->dma->fn = mtk8250_dma_filter; | 363 | data->dma->fn = mtk8250_dma_filter; |
| 361 | data->dma->rx_size = MTK_UART_RX_SIZE; | 364 | data->dma->rx_size = MTK_UART_RX_SIZE; |
| 362 | data->dma->rxconf.src_maxburst = MTK_UART_RX_TRIGGER; | 365 | data->dma->rxconf.src_maxburst = MTK_UART_RX_TRIGGER; |
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index f80a300b5d68..48bd694a5fa1 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
| @@ -3420,6 +3420,11 @@ static int | |||
| 3420 | serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) | 3420 | serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) |
| 3421 | { | 3421 | { |
| 3422 | int num_iomem, num_port, first_port = -1, i; | 3422 | int num_iomem, num_port, first_port = -1, i; |
| 3423 | int rc; | ||
| 3424 | |||
| 3425 | rc = serial_pci_is_class_communication(dev); | ||
| 3426 | if (rc) | ||
| 3427 | return rc; | ||
| 3423 | 3428 | ||
| 3424 | /* | 3429 | /* |
| 3425 | * Should we try to make guesses for multiport serial devices later? | 3430 | * Should we try to make guesses for multiport serial devices later? |
| @@ -3647,10 +3652,6 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent) | |||
| 3647 | 3652 | ||
| 3648 | board = &pci_boards[ent->driver_data]; | 3653 | board = &pci_boards[ent->driver_data]; |
| 3649 | 3654 | ||
| 3650 | rc = serial_pci_is_class_communication(dev); | ||
| 3651 | if (rc) | ||
| 3652 | return rc; | ||
| 3653 | |||
| 3654 | rc = serial_pci_is_blacklisted(dev); | 3655 | rc = serial_pci_is_blacklisted(dev); |
| 3655 | if (rc) | 3656 | if (rc) |
| 3656 | return rc; | 3657 | return rc; |
diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/earlycon-riscv-sbi.c index e1a551aae336..ce81523c3113 100644 --- a/drivers/tty/serial/earlycon-riscv-sbi.c +++ b/drivers/tty/serial/earlycon-riscv-sbi.c | |||
| @@ -10,13 +10,16 @@ | |||
| 10 | #include <linux/serial_core.h> | 10 | #include <linux/serial_core.h> |
| 11 | #include <asm/sbi.h> | 11 | #include <asm/sbi.h> |
| 12 | 12 | ||
| 13 | static void sbi_console_write(struct console *con, | 13 | static void sbi_putc(struct uart_port *port, int c) |
| 14 | const char *s, unsigned int n) | ||
| 15 | { | 14 | { |
| 16 | int i; | 15 | sbi_console_putchar(c); |
| 16 | } | ||
| 17 | 17 | ||
| 18 | for (i = 0; i < n; ++i) | 18 | static void sbi_console_write(struct console *con, |
| 19 | sbi_console_putchar(s[i]); | 19 | const char *s, unsigned n) |
| 20 | { | ||
| 21 | struct earlycon_device *dev = con->data; | ||
| 22 | uart_console_write(&dev->port, s, n, sbi_putc); | ||
| 20 | } | 23 | } |
| 21 | 24 | ||
| 22 | static int __init early_sbi_setup(struct earlycon_device *device, | 25 | static int __init early_sbi_setup(struct earlycon_device *device, |
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 241a48e5052c..debdd1b9e01a 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c | |||
| @@ -1697,7 +1697,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 1697 | } | 1697 | } |
| 1698 | 1698 | ||
| 1699 | /* ask the core to calculate the divisor */ | 1699 | /* ask the core to calculate the divisor */ |
| 1700 | baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16); | 1700 | baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 4); |
| 1701 | 1701 | ||
| 1702 | spin_lock_irqsave(&sport->port.lock, flags); | 1702 | spin_lock_irqsave(&sport->port.lock, flags); |
| 1703 | 1703 | ||
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index a72d6d9fb983..38016609c7fa 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c | |||
| @@ -225,7 +225,7 @@ static unsigned int qcom_geni_serial_get_mctrl(struct uart_port *uport) | |||
| 225 | unsigned int mctrl = TIOCM_DSR | TIOCM_CAR; | 225 | unsigned int mctrl = TIOCM_DSR | TIOCM_CAR; |
| 226 | u32 geni_ios; | 226 | u32 geni_ios; |
| 227 | 227 | ||
| 228 | if (uart_console(uport) || !uart_cts_enabled(uport)) { | 228 | if (uart_console(uport)) { |
| 229 | mctrl |= TIOCM_CTS; | 229 | mctrl |= TIOCM_CTS; |
| 230 | } else { | 230 | } else { |
| 231 | geni_ios = readl_relaxed(uport->membase + SE_GENI_IOS); | 231 | geni_ios = readl_relaxed(uport->membase + SE_GENI_IOS); |
| @@ -241,7 +241,7 @@ static void qcom_geni_serial_set_mctrl(struct uart_port *uport, | |||
| 241 | { | 241 | { |
| 242 | u32 uart_manual_rfr = 0; | 242 | u32 uart_manual_rfr = 0; |
| 243 | 243 | ||
| 244 | if (uart_console(uport) || !uart_cts_enabled(uport)) | 244 | if (uart_console(uport)) |
| 245 | return; | 245 | return; |
| 246 | 246 | ||
| 247 | if (!(mctrl & TIOCM_RTS)) | 247 | if (!(mctrl & TIOCM_RTS)) |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index d4cca5bdaf1c..556f50aa1b58 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
| @@ -130,6 +130,9 @@ static void uart_start(struct tty_struct *tty) | |||
| 130 | struct uart_port *port; | 130 | struct uart_port *port; |
| 131 | unsigned long flags; | 131 | unsigned long flags; |
| 132 | 132 | ||
| 133 | if (!state) | ||
| 134 | return; | ||
| 135 | |||
| 133 | port = uart_port_lock(state, flags); | 136 | port = uart_port_lock(state, flags); |
| 134 | __uart_start(tty); | 137 | __uart_start(tty); |
| 135 | uart_port_unlock(port, flags); | 138 | uart_port_unlock(port, flags); |
| @@ -550,10 +553,12 @@ static int uart_put_char(struct tty_struct *tty, unsigned char c) | |||
| 550 | int ret = 0; | 553 | int ret = 0; |
| 551 | 554 | ||
| 552 | circ = &state->xmit; | 555 | circ = &state->xmit; |
| 553 | if (!circ->buf) | 556 | port = uart_port_lock(state, flags); |
| 557 | if (!circ->buf) { | ||
| 558 | uart_port_unlock(port, flags); | ||
| 554 | return 0; | 559 | return 0; |
| 560 | } | ||
| 555 | 561 | ||
| 556 | port = uart_port_lock(state, flags); | ||
| 557 | if (port && uart_circ_chars_free(circ) != 0) { | 562 | if (port && uart_circ_chars_free(circ) != 0) { |
| 558 | circ->buf[circ->head] = c; | 563 | circ->buf[circ->head] = c; |
| 559 | circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1); | 564 | circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1); |
| @@ -586,11 +591,13 @@ static int uart_write(struct tty_struct *tty, | |||
| 586 | return -EL3HLT; | 591 | return -EL3HLT; |
| 587 | } | 592 | } |
| 588 | 593 | ||
| 594 | port = uart_port_lock(state, flags); | ||
| 589 | circ = &state->xmit; | 595 | circ = &state->xmit; |
| 590 | if (!circ->buf) | 596 | if (!circ->buf) { |
| 597 | uart_port_unlock(port, flags); | ||
| 591 | return 0; | 598 | return 0; |
| 599 | } | ||
| 592 | 600 | ||
| 593 | port = uart_port_lock(state, flags); | ||
| 594 | while (port) { | 601 | while (port) { |
| 595 | c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE); | 602 | c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE); |
| 596 | if (count < c) | 603 | if (count < c) |
| @@ -723,6 +730,9 @@ static void uart_unthrottle(struct tty_struct *tty) | |||
| 723 | upstat_t mask = UPSTAT_SYNC_FIFO; | 730 | upstat_t mask = UPSTAT_SYNC_FIFO; |
| 724 | struct uart_port *port; | 731 | struct uart_port *port; |
| 725 | 732 | ||
| 733 | if (!state) | ||
| 734 | return; | ||
| 735 | |||
| 726 | port = uart_port_ref(state); | 736 | port = uart_port_ref(state); |
| 727 | if (!port) | 737 | if (!port) |
| 728 | return; | 738 | return; |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 8df0fd824520..64bbeb7d7e0c 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
| @@ -1921,7 +1921,7 @@ out_nomem: | |||
| 1921 | 1921 | ||
| 1922 | static void sci_free_irq(struct sci_port *port) | 1922 | static void sci_free_irq(struct sci_port *port) |
| 1923 | { | 1923 | { |
| 1924 | int i; | 1924 | int i, j; |
| 1925 | 1925 | ||
| 1926 | /* | 1926 | /* |
| 1927 | * Intentionally in reverse order so we iterate over the muxed | 1927 | * Intentionally in reverse order so we iterate over the muxed |
| @@ -1937,6 +1937,13 @@ static void sci_free_irq(struct sci_port *port) | |||
| 1937 | if (unlikely(irq < 0)) | 1937 | if (unlikely(irq < 0)) |
| 1938 | continue; | 1938 | continue; |
| 1939 | 1939 | ||
| 1940 | /* Check if already freed (irq was muxed) */ | ||
| 1941 | for (j = 0; j < i; j++) | ||
| 1942 | if (port->irqs[j] == irq) | ||
| 1943 | j = i + 1; | ||
| 1944 | if (j > i) | ||
| 1945 | continue; | ||
| 1946 | |||
| 1940 | free_irq(port->irqs[i], port); | 1947 | free_irq(port->irqs[i], port); |
| 1941 | kfree(port->irqstr[i]); | 1948 | kfree(port->irqstr[i]); |
| 1942 | 1949 | ||
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 23c6fd238422..21ffcce16927 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
| @@ -2189,7 +2189,8 @@ static int tiocsti(struct tty_struct *tty, char __user *p) | |||
| 2189 | ld = tty_ldisc_ref_wait(tty); | 2189 | ld = tty_ldisc_ref_wait(tty); |
| 2190 | if (!ld) | 2190 | if (!ld) |
| 2191 | return -EIO; | 2191 | return -EIO; |
| 2192 | ld->ops->receive_buf(tty, &ch, &mbz, 1); | 2192 | if (ld->ops->receive_buf) |
| 2193 | ld->ops->receive_buf(tty, &ch, &mbz, 1); | ||
| 2193 | tty_ldisc_deref(ld); | 2194 | tty_ldisc_deref(ld); |
| 2194 | return 0; | 2195 | return 0; |
| 2195 | } | 2196 | } |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 41ec8e5010f3..bba75560d11e 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
| @@ -1272,6 +1272,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, | |||
| 1272 | if (con_is_visible(vc)) | 1272 | if (con_is_visible(vc)) |
| 1273 | update_screen(vc); | 1273 | update_screen(vc); |
| 1274 | vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); | 1274 | vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); |
| 1275 | notify_update(vc); | ||
| 1275 | return err; | 1276 | return err; |
| 1276 | } | 1277 | } |
| 1277 | 1278 | ||
| @@ -2764,8 +2765,8 @@ rescan_last_byte: | |||
| 2764 | con_flush(vc, draw_from, draw_to, &draw_x); | 2765 | con_flush(vc, draw_from, draw_to, &draw_x); |
| 2765 | vc_uniscr_debug_check(vc); | 2766 | vc_uniscr_debug_check(vc); |
| 2766 | console_conditional_schedule(); | 2767 | console_conditional_schedule(); |
| 2767 | console_unlock(); | ||
| 2768 | notify_update(vc); | 2768 | notify_update(vc); |
| 2769 | console_unlock(); | ||
| 2769 | return n; | 2770 | return n; |
| 2770 | } | 2771 | } |
| 2771 | 2772 | ||
| @@ -2884,8 +2885,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) | |||
| 2884 | unsigned char c; | 2885 | unsigned char c; |
| 2885 | static DEFINE_SPINLOCK(printing_lock); | 2886 | static DEFINE_SPINLOCK(printing_lock); |
| 2886 | const ushort *start; | 2887 | const ushort *start; |
| 2887 | ushort cnt = 0; | 2888 | ushort start_x, cnt; |
| 2888 | ushort myx; | ||
| 2889 | int kmsg_console; | 2889 | int kmsg_console; |
| 2890 | 2890 | ||
| 2891 | /* console busy or not yet initialized */ | 2891 | /* console busy or not yet initialized */ |
| @@ -2898,10 +2898,6 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) | |||
| 2898 | if (kmsg_console && vc_cons_allocated(kmsg_console - 1)) | 2898 | if (kmsg_console && vc_cons_allocated(kmsg_console - 1)) |
| 2899 | vc = vc_cons[kmsg_console - 1].d; | 2899 | vc = vc_cons[kmsg_console - 1].d; |
| 2900 | 2900 | ||
| 2901 | /* read `x' only after setting currcons properly (otherwise | ||
| 2902 | the `x' macro will read the x of the foreground console). */ | ||
| 2903 | myx = vc->vc_x; | ||
| 2904 | |||
| 2905 | if (!vc_cons_allocated(fg_console)) { | 2901 | if (!vc_cons_allocated(fg_console)) { |
| 2906 | /* impossible */ | 2902 | /* impossible */ |
| 2907 | /* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */ | 2903 | /* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */ |
| @@ -2916,53 +2912,41 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) | |||
| 2916 | hide_cursor(vc); | 2912 | hide_cursor(vc); |
| 2917 | 2913 | ||
| 2918 | start = (ushort *)vc->vc_pos; | 2914 | start = (ushort *)vc->vc_pos; |
| 2919 | 2915 | start_x = vc->vc_x; | |
| 2920 | /* Contrived structure to try to emulate original need_wrap behaviour | 2916 | cnt = 0; |
| 2921 | * Problems caused when we have need_wrap set on '\n' character */ | ||
| 2922 | while (count--) { | 2917 | while (count--) { |
| 2923 | c = *b++; | 2918 | c = *b++; |
| 2924 | if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { | 2919 | if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { |
| 2925 | if (cnt > 0) { | 2920 | if (cnt && con_is_visible(vc)) |
| 2926 | if (con_is_visible(vc)) | 2921 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); |
| 2927 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); | 2922 | cnt = 0; |
| 2928 | vc->vc_x += cnt; | ||
| 2929 | if (vc->vc_need_wrap) | ||
| 2930 | vc->vc_x--; | ||
| 2931 | cnt = 0; | ||
| 2932 | } | ||
| 2933 | if (c == 8) { /* backspace */ | 2923 | if (c == 8) { /* backspace */ |
| 2934 | bs(vc); | 2924 | bs(vc); |
| 2935 | start = (ushort *)vc->vc_pos; | 2925 | start = (ushort *)vc->vc_pos; |
| 2936 | myx = vc->vc_x; | 2926 | start_x = vc->vc_x; |
| 2937 | continue; | 2927 | continue; |
| 2938 | } | 2928 | } |
| 2939 | if (c != 13) | 2929 | if (c != 13) |
| 2940 | lf(vc); | 2930 | lf(vc); |
| 2941 | cr(vc); | 2931 | cr(vc); |
| 2942 | start = (ushort *)vc->vc_pos; | 2932 | start = (ushort *)vc->vc_pos; |
| 2943 | myx = vc->vc_x; | 2933 | start_x = vc->vc_x; |
| 2944 | if (c == 10 || c == 13) | 2934 | if (c == 10 || c == 13) |
| 2945 | continue; | 2935 | continue; |
| 2946 | } | 2936 | } |
| 2937 | vc_uniscr_putc(vc, c); | ||
| 2947 | scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); | 2938 | scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); |
| 2948 | notify_write(vc, c); | 2939 | notify_write(vc, c); |
| 2949 | cnt++; | 2940 | cnt++; |
| 2950 | if (myx == vc->vc_cols - 1) { | 2941 | if (vc->vc_x == vc->vc_cols - 1) { |
| 2951 | vc->vc_need_wrap = 1; | ||
| 2952 | continue; | ||
| 2953 | } | ||
| 2954 | vc->vc_pos += 2; | ||
| 2955 | myx++; | ||
| 2956 | } | ||
| 2957 | if (cnt > 0) { | ||
| 2958 | if (con_is_visible(vc)) | ||
| 2959 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); | ||
| 2960 | vc->vc_x += cnt; | ||
| 2961 | if (vc->vc_x == vc->vc_cols) { | ||
| 2962 | vc->vc_x--; | ||
| 2963 | vc->vc_need_wrap = 1; | 2942 | vc->vc_need_wrap = 1; |
| 2943 | } else { | ||
| 2944 | vc->vc_pos += 2; | ||
| 2945 | vc->vc_x++; | ||
| 2964 | } | 2946 | } |
| 2965 | } | 2947 | } |
| 2948 | if (cnt && con_is_visible(vc)) | ||
| 2949 | vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); | ||
| 2966 | set_cursor(vc); | 2950 | set_cursor(vc); |
| 2967 | notify_update(vc); | 2951 | notify_update(vc); |
| 2968 | 2952 | ||
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index e81de9ca8729..9b45aa422e69 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c | |||
| @@ -316,7 +316,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) | |||
| 316 | if (IS_ERR(data->usbmisc_data)) | 316 | if (IS_ERR(data->usbmisc_data)) |
| 317 | return PTR_ERR(data->usbmisc_data); | 317 | return PTR_ERR(data->usbmisc_data); |
| 318 | 318 | ||
| 319 | if (of_usb_get_phy_mode(dev->of_node) == USBPHY_INTERFACE_MODE_HSIC) { | 319 | if ((of_usb_get_phy_mode(dev->of_node) == USBPHY_INTERFACE_MODE_HSIC) |
| 320 | && data->usbmisc_data) { | ||
| 320 | pdata.flags |= CI_HDRC_IMX_IS_HSIC; | 321 | pdata.flags |= CI_HDRC_IMX_IS_HSIC; |
| 321 | data->usbmisc_data->hsic = 1; | 322 | data->usbmisc_data->hsic = 1; |
| 322 | data->pinctrl = devm_pinctrl_get(dev); | 323 | data->pinctrl = devm_pinctrl_get(dev); |
diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c index dc7f7fd71684..c12ac56606c3 100644 --- a/drivers/usb/core/ledtrig-usbport.c +++ b/drivers/usb/core/ledtrig-usbport.c | |||
| @@ -119,11 +119,6 @@ static const struct attribute_group ports_group = { | |||
| 119 | .attrs = ports_attrs, | 119 | .attrs = ports_attrs, |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | static const struct attribute_group *ports_groups[] = { | ||
| 123 | &ports_group, | ||
| 124 | NULL | ||
| 125 | }; | ||
| 126 | |||
| 127 | /*************************************** | 122 | /*************************************** |
| 128 | * Adding & removing ports | 123 | * Adding & removing ports |
| 129 | ***************************************/ | 124 | ***************************************/ |
| @@ -307,6 +302,7 @@ static int usbport_trig_notify(struct notifier_block *nb, unsigned long action, | |||
| 307 | static int usbport_trig_activate(struct led_classdev *led_cdev) | 302 | static int usbport_trig_activate(struct led_classdev *led_cdev) |
| 308 | { | 303 | { |
| 309 | struct usbport_trig_data *usbport_data; | 304 | struct usbport_trig_data *usbport_data; |
| 305 | int err; | ||
| 310 | 306 | ||
| 311 | usbport_data = kzalloc(sizeof(*usbport_data), GFP_KERNEL); | 307 | usbport_data = kzalloc(sizeof(*usbport_data), GFP_KERNEL); |
| 312 | if (!usbport_data) | 308 | if (!usbport_data) |
| @@ -315,6 +311,9 @@ static int usbport_trig_activate(struct led_classdev *led_cdev) | |||
| 315 | 311 | ||
| 316 | /* List of ports */ | 312 | /* List of ports */ |
| 317 | INIT_LIST_HEAD(&usbport_data->ports); | 313 | INIT_LIST_HEAD(&usbport_data->ports); |
| 314 | err = sysfs_create_group(&led_cdev->dev->kobj, &ports_group); | ||
| 315 | if (err) | ||
| 316 | goto err_free; | ||
| 318 | usb_for_each_dev(usbport_data, usbport_trig_add_usb_dev_ports); | 317 | usb_for_each_dev(usbport_data, usbport_trig_add_usb_dev_ports); |
| 319 | usbport_trig_update_count(usbport_data); | 318 | usbport_trig_update_count(usbport_data); |
| 320 | 319 | ||
| @@ -322,8 +321,11 @@ static int usbport_trig_activate(struct led_classdev *led_cdev) | |||
| 322 | usbport_data->nb.notifier_call = usbport_trig_notify; | 321 | usbport_data->nb.notifier_call = usbport_trig_notify; |
| 323 | led_set_trigger_data(led_cdev, usbport_data); | 322 | led_set_trigger_data(led_cdev, usbport_data); |
| 324 | usb_register_notify(&usbport_data->nb); | 323 | usb_register_notify(&usbport_data->nb); |
| 325 | |||
| 326 | return 0; | 324 | return 0; |
| 325 | |||
| 326 | err_free: | ||
| 327 | kfree(usbport_data); | ||
| 328 | return err; | ||
| 327 | } | 329 | } |
| 328 | 330 | ||
| 329 | static void usbport_trig_deactivate(struct led_classdev *led_cdev) | 331 | static void usbport_trig_deactivate(struct led_classdev *led_cdev) |
| @@ -335,6 +337,8 @@ static void usbport_trig_deactivate(struct led_classdev *led_cdev) | |||
| 335 | usbport_trig_remove_port(usbport_data, port); | 337 | usbport_trig_remove_port(usbport_data, port); |
| 336 | } | 338 | } |
| 337 | 339 | ||
| 340 | sysfs_remove_group(&led_cdev->dev->kobj, &ports_group); | ||
| 341 | |||
| 338 | usb_unregister_notify(&usbport_data->nb); | 342 | usb_unregister_notify(&usbport_data->nb); |
| 339 | 343 | ||
| 340 | kfree(usbport_data); | 344 | kfree(usbport_data); |
| @@ -344,7 +348,6 @@ static struct led_trigger usbport_led_trigger = { | |||
| 344 | .name = "usbport", | 348 | .name = "usbport", |
| 345 | .activate = usbport_trig_activate, | 349 | .activate = usbport_trig_activate, |
| 346 | .deactivate = usbport_trig_deactivate, | 350 | .deactivate = usbport_trig_deactivate, |
| 347 | .groups = ports_groups, | ||
| 348 | }; | 351 | }; |
| 349 | 352 | ||
| 350 | static int __init usbport_trig_init(void) | 353 | static int __init usbport_trig_init(void) |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 68ad75a7460d..55ef3cc2701b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
| @@ -261,7 +261,7 @@ static void dwc2_gadget_wkup_alert_handler(struct dwc2_hsotg *hsotg) | |||
| 261 | 261 | ||
| 262 | if (gintsts2 & GINTSTS2_WKUP_ALERT_INT) { | 262 | if (gintsts2 & GINTSTS2_WKUP_ALERT_INT) { |
| 263 | dev_dbg(hsotg->dev, "%s: Wkup_Alert_Int\n", __func__); | 263 | dev_dbg(hsotg->dev, "%s: Wkup_Alert_Int\n", __func__); |
| 264 | dwc2_clear_bit(hsotg, GINTSTS2, GINTSTS2_WKUP_ALERT_INT); | 264 | dwc2_set_bit(hsotg, GINTSTS2, GINTSTS2_WKUP_ALERT_INT); |
| 265 | dwc2_set_bit(hsotg, DCTL, DCTL_RMTWKUPSIG); | 265 | dwc2_set_bit(hsotg, DCTL, DCTL_RMTWKUPSIG); |
| 266 | } | 266 | } |
| 267 | } | 267 | } |
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index cb7fcd7c0ad8..c1e9ea621f41 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c | |||
| @@ -78,7 +78,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev) | |||
| 78 | for (i = 0; i < exynos->num_clks; i++) { | 78 | for (i = 0; i < exynos->num_clks; i++) { |
| 79 | ret = clk_prepare_enable(exynos->clks[i]); | 79 | ret = clk_prepare_enable(exynos->clks[i]); |
| 80 | if (ret) { | 80 | if (ret) { |
| 81 | while (--i > 0) | 81 | while (i-- > 0) |
| 82 | clk_disable_unprepare(exynos->clks[i]); | 82 | clk_disable_unprepare(exynos->clks[i]); |
| 83 | return ret; | 83 | return ret; |
| 84 | } | 84 | } |
| @@ -223,7 +223,7 @@ static int dwc3_exynos_resume(struct device *dev) | |||
| 223 | for (i = 0; i < exynos->num_clks; i++) { | 223 | for (i = 0; i < exynos->num_clks; i++) { |
| 224 | ret = clk_prepare_enable(exynos->clks[i]); | 224 | ret = clk_prepare_enable(exynos->clks[i]); |
| 225 | if (ret) { | 225 | if (ret) { |
| 226 | while (--i > 0) | 226 | while (i-- > 0) |
| 227 | clk_disable_unprepare(exynos->clks[i]); | 227 | clk_disable_unprepare(exynos->clks[i]); |
| 228 | return ret; | 228 | return ret; |
| 229 | } | 229 | } |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 07bd31bb2f8a..6c9b76bcc2e1 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
| @@ -177,6 +177,7 @@ static void dwc3_gadget_del_and_unmap_request(struct dwc3_ep *dep, | |||
| 177 | req->started = false; | 177 | req->started = false; |
| 178 | list_del(&req->list); | 178 | list_del(&req->list); |
| 179 | req->remaining = 0; | 179 | req->remaining = 0; |
| 180 | req->needs_extra_trb = false; | ||
| 180 | 181 | ||
| 181 | if (req->request.status == -EINPROGRESS) | 182 | if (req->request.status == -EINPROGRESS) |
| 182 | req->request.status = status; | 183 | req->request.status = status; |
| @@ -1118,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, | |||
| 1118 | unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); | 1119 | unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); |
| 1119 | unsigned int rem = length % maxp; | 1120 | unsigned int rem = length % maxp; |
| 1120 | 1121 | ||
| 1121 | if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) { | 1122 | if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) { |
| 1122 | struct dwc3 *dwc = dep->dwc; | 1123 | struct dwc3 *dwc = dep->dwc; |
| 1123 | struct dwc3_trb *trb; | 1124 | struct dwc3_trb *trb; |
| 1124 | 1125 | ||
| @@ -1984,6 +1985,7 @@ static int __dwc3_gadget_start(struct dwc3 *dwc) | |||
| 1984 | 1985 | ||
| 1985 | /* begin to receive SETUP packets */ | 1986 | /* begin to receive SETUP packets */ |
| 1986 | dwc->ep0state = EP0_SETUP_PHASE; | 1987 | dwc->ep0state = EP0_SETUP_PHASE; |
| 1988 | dwc->link_state = DWC3_LINK_STATE_SS_DIS; | ||
| 1987 | dwc3_ep0_out_start(dwc); | 1989 | dwc3_ep0_out_start(dwc); |
| 1988 | 1990 | ||
| 1989 | dwc3_gadget_enable_irq(dwc); | 1991 | dwc3_gadget_enable_irq(dwc); |
| @@ -3379,6 +3381,8 @@ int dwc3_gadget_suspend(struct dwc3 *dwc) | |||
| 3379 | dwc3_disconnect_gadget(dwc); | 3381 | dwc3_disconnect_gadget(dwc); |
| 3380 | __dwc3_gadget_stop(dwc); | 3382 | __dwc3_gadget_stop(dwc); |
| 3381 | 3383 | ||
| 3384 | synchronize_irq(dwc->irq_gadget); | ||
| 3385 | |||
| 3382 | return 0; | 3386 | return 0; |
| 3383 | } | 3387 | } |
| 3384 | 3388 | ||
diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c index 9cdef108fb1b..ed68a4860b7d 100644 --- a/drivers/usb/gadget/function/f_sourcesink.c +++ b/drivers/usb/gadget/function/f_sourcesink.c | |||
| @@ -838,7 +838,7 @@ static struct usb_function *source_sink_alloc_func( | |||
| 838 | 838 | ||
| 839 | ss = kzalloc(sizeof(*ss), GFP_KERNEL); | 839 | ss = kzalloc(sizeof(*ss), GFP_KERNEL); |
| 840 | if (!ss) | 840 | if (!ss) |
| 841 | return NULL; | 841 | return ERR_PTR(-ENOMEM); |
| 842 | 842 | ||
| 843 | ss_opts = container_of(fi, struct f_ss_opts, func_inst); | 843 | ss_opts = container_of(fi, struct f_ss_opts, func_inst); |
| 844 | 844 | ||
diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c index 660878a19505..b77f3126580e 100644 --- a/drivers/usb/gadget/udc/net2272.c +++ b/drivers/usb/gadget/udc/net2272.c | |||
| @@ -2083,7 +2083,7 @@ static irqreturn_t net2272_irq(int irq, void *_dev) | |||
| 2083 | #if defined(PLX_PCI_RDK2) | 2083 | #if defined(PLX_PCI_RDK2) |
| 2084 | /* see if PCI int for us by checking irqstat */ | 2084 | /* see if PCI int for us by checking irqstat */ |
| 2085 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); | 2085 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); |
| 2086 | if (!intcsr & (1 << NET2272_PCI_IRQ)) { | 2086 | if (!(intcsr & (1 << NET2272_PCI_IRQ))) { |
| 2087 | spin_unlock(&dev->lock); | 2087 | spin_unlock(&dev->lock); |
| 2088 | return IRQ_NONE; | 2088 | return IRQ_NONE; |
| 2089 | } | 2089 | } |
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index f26109eafdbf..66ec1fdf9fe7 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c | |||
| @@ -302,3 +302,4 @@ MODULE_AUTHOR("Chao Xie <chao.xie@marvell.com>"); | |||
| 302 | MODULE_AUTHOR("Neil Zhang <zhangwm@marvell.com>"); | 302 | MODULE_AUTHOR("Neil Zhang <zhangwm@marvell.com>"); |
| 303 | MODULE_ALIAS("mv-ehci"); | 303 | MODULE_ALIAS("mv-ehci"); |
| 304 | MODULE_LICENSE("GPL"); | 304 | MODULE_LICENSE("GPL"); |
| 305 | MODULE_DEVICE_TABLE(of, ehci_mv_dt_ids); | ||
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index eae8b1b1b45b..ffe462a657b1 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -452,13 +452,10 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | if (request) { | 454 | if (request) { |
| 455 | u8 is_dma = 0; | ||
| 456 | bool short_packet = false; | ||
| 457 | 455 | ||
| 458 | trace_musb_req_tx(req); | 456 | trace_musb_req_tx(req); |
| 459 | 457 | ||
| 460 | if (dma && (csr & MUSB_TXCSR_DMAENAB)) { | 458 | if (dma && (csr & MUSB_TXCSR_DMAENAB)) { |
| 461 | is_dma = 1; | ||
| 462 | csr |= MUSB_TXCSR_P_WZC_BITS; | 459 | csr |= MUSB_TXCSR_P_WZC_BITS; |
| 463 | csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | | 460 | csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | |
| 464 | MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET); | 461 | MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET); |
| @@ -476,16 +473,8 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
| 476 | */ | 473 | */ |
| 477 | if ((request->zero && request->length) | 474 | if ((request->zero && request->length) |
| 478 | && (request->length % musb_ep->packet_sz == 0) | 475 | && (request->length % musb_ep->packet_sz == 0) |
| 479 | && (request->actual == request->length)) | 476 | && (request->actual == request->length)) { |
| 480 | short_packet = true; | ||
| 481 | 477 | ||
| 482 | if ((musb_dma_inventra(musb) || musb_dma_ux500(musb)) && | ||
| 483 | (is_dma && (!dma->desired_mode || | ||
| 484 | (request->actual & | ||
| 485 | (musb_ep->packet_sz - 1))))) | ||
| 486 | short_packet = true; | ||
| 487 | |||
| 488 | if (short_packet) { | ||
| 489 | /* | 478 | /* |
| 490 | * On DMA completion, FIFO may not be | 479 | * On DMA completion, FIFO may not be |
| 491 | * available yet... | 480 | * available yet... |
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index a688f7f87829..5fc6825745f2 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c | |||
| @@ -346,12 +346,10 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) | |||
| 346 | channel->status = MUSB_DMA_STATUS_FREE; | 346 | channel->status = MUSB_DMA_STATUS_FREE; |
| 347 | 347 | ||
| 348 | /* completed */ | 348 | /* completed */ |
| 349 | if ((devctl & MUSB_DEVCTL_HM) | 349 | if (musb_channel->transmit && |
| 350 | && (musb_channel->transmit) | 350 | (!channel->desired_mode || |
| 351 | && ((channel->desired_mode == 0) | 351 | (channel->actual_len % |
| 352 | || (channel->actual_len & | 352 | musb_channel->max_packet_sz))) { |
| 353 | (musb_channel->max_packet_sz - 1))) | ||
| 354 | ) { | ||
| 355 | u8 epnum = musb_channel->epnum; | 353 | u8 epnum = musb_channel->epnum; |
| 356 | int offset = musb->io.ep_offset(epnum, | 354 | int offset = musb->io.ep_offset(epnum, |
| 357 | MUSB_TXCSR); | 355 | MUSB_TXCSR); |
| @@ -363,11 +361,14 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) | |||
| 363 | */ | 361 | */ |
| 364 | musb_ep_select(mbase, epnum); | 362 | musb_ep_select(mbase, epnum); |
| 365 | txcsr = musb_readw(mbase, offset); | 363 | txcsr = musb_readw(mbase, offset); |
| 366 | txcsr &= ~(MUSB_TXCSR_DMAENAB | 364 | if (channel->desired_mode == 1) { |
| 365 | txcsr &= ~(MUSB_TXCSR_DMAENAB | ||
| 367 | | MUSB_TXCSR_AUTOSET); | 366 | | MUSB_TXCSR_AUTOSET); |
| 368 | musb_writew(mbase, offset, txcsr); | 367 | musb_writew(mbase, offset, txcsr); |
| 369 | /* Send out the packet */ | 368 | /* Send out the packet */ |
| 370 | txcsr &= ~MUSB_TXCSR_DMAMODE; | 369 | txcsr &= ~MUSB_TXCSR_DMAMODE; |
| 370 | txcsr |= MUSB_TXCSR_DMAENAB; | ||
| 371 | } | ||
| 371 | txcsr |= MUSB_TXCSR_TXPKTRDY; | 372 | txcsr |= MUSB_TXCSR_TXPKTRDY; |
| 372 | musb_writew(mbase, offset, txcsr); | 373 | musb_writew(mbase, offset, txcsr); |
| 373 | } | 374 | } |
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index d7312eed6088..91ea3083e7ad 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig | |||
| @@ -21,7 +21,7 @@ config AB8500_USB | |||
| 21 | 21 | ||
| 22 | config FSL_USB2_OTG | 22 | config FSL_USB2_OTG |
| 23 | bool "Freescale USB OTG Transceiver Driver" | 23 | bool "Freescale USB OTG Transceiver Driver" |
| 24 | depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM && PM | 24 | depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_OTG_FSM=y && PM |
| 25 | depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y' | 25 | depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y' |
| 26 | select USB_PHY | 26 | select USB_PHY |
| 27 | help | 27 | help |
diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c index 27bdb7222527..f5f0568d8533 100644 --- a/drivers/usb/phy/phy-am335x.c +++ b/drivers/usb/phy/phy-am335x.c | |||
| @@ -61,9 +61,6 @@ static int am335x_phy_probe(struct platform_device *pdev) | |||
| 61 | if (ret) | 61 | if (ret) |
| 62 | return ret; | 62 | return ret; |
| 63 | 63 | ||
| 64 | ret = usb_add_phy_dev(&am_phy->usb_phy_gen.phy); | ||
| 65 | if (ret) | ||
| 66 | return ret; | ||
| 67 | am_phy->usb_phy_gen.phy.init = am335x_init; | 64 | am_phy->usb_phy_gen.phy.init = am335x_init; |
| 68 | am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown; | 65 | am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown; |
| 69 | 66 | ||
| @@ -82,7 +79,7 @@ static int am335x_phy_probe(struct platform_device *pdev) | |||
| 82 | device_set_wakeup_enable(dev, false); | 79 | device_set_wakeup_enable(dev, false); |
| 83 | phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false); | 80 | phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false); |
| 84 | 81 | ||
| 85 | return 0; | 82 | return usb_add_phy_dev(&am_phy->usb_phy_gen.phy); |
| 86 | } | 83 | } |
| 87 | 84 | ||
| 88 | static int am335x_phy_remove(struct platform_device *pdev) | 85 | static int am335x_phy_remove(struct platform_device *pdev) |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 1ab2a6191013..77ef4c481f3c 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -1783,6 +1783,10 @@ static int ftdi_set_bitmode(struct usb_serial_port *port, u8 mode) | |||
| 1783 | int result; | 1783 | int result; |
| 1784 | u16 val; | 1784 | u16 val; |
| 1785 | 1785 | ||
| 1786 | result = usb_autopm_get_interface(serial->interface); | ||
| 1787 | if (result) | ||
| 1788 | return result; | ||
| 1789 | |||
| 1786 | val = (mode << 8) | (priv->gpio_output << 4) | priv->gpio_value; | 1790 | val = (mode << 8) | (priv->gpio_output << 4) | priv->gpio_value; |
| 1787 | result = usb_control_msg(serial->dev, | 1791 | result = usb_control_msg(serial->dev, |
| 1788 | usb_sndctrlpipe(serial->dev, 0), | 1792 | usb_sndctrlpipe(serial->dev, 0), |
| @@ -1795,6 +1799,8 @@ static int ftdi_set_bitmode(struct usb_serial_port *port, u8 mode) | |||
| 1795 | val, result); | 1799 | val, result); |
| 1796 | } | 1800 | } |
| 1797 | 1801 | ||
| 1802 | usb_autopm_put_interface(serial->interface); | ||
| 1803 | |||
| 1798 | return result; | 1804 | return result; |
| 1799 | } | 1805 | } |
| 1800 | 1806 | ||
| @@ -1846,9 +1852,15 @@ static int ftdi_read_cbus_pins(struct usb_serial_port *port) | |||
| 1846 | unsigned char *buf; | 1852 | unsigned char *buf; |
| 1847 | int result; | 1853 | int result; |
| 1848 | 1854 | ||
| 1855 | result = usb_autopm_get_interface(serial->interface); | ||
| 1856 | if (result) | ||
| 1857 | return result; | ||
| 1858 | |||
| 1849 | buf = kmalloc(1, GFP_KERNEL); | 1859 | buf = kmalloc(1, GFP_KERNEL); |
| 1850 | if (!buf) | 1860 | if (!buf) { |
| 1861 | usb_autopm_put_interface(serial->interface); | ||
| 1851 | return -ENOMEM; | 1862 | return -ENOMEM; |
| 1863 | } | ||
| 1852 | 1864 | ||
| 1853 | result = usb_control_msg(serial->dev, | 1865 | result = usb_control_msg(serial->dev, |
| 1854 | usb_rcvctrlpipe(serial->dev, 0), | 1866 | usb_rcvctrlpipe(serial->dev, 0), |
| @@ -1863,6 +1875,7 @@ static int ftdi_read_cbus_pins(struct usb_serial_port *port) | |||
| 1863 | } | 1875 | } |
| 1864 | 1876 | ||
| 1865 | kfree(buf); | 1877 | kfree(buf); |
| 1878 | usb_autopm_put_interface(serial->interface); | ||
| 1866 | 1879 | ||
| 1867 | return result; | 1880 | return result; |
| 1868 | } | 1881 | } |
diff --git a/drivers/usb/serial/keyspan_usa26msg.h b/drivers/usb/serial/keyspan_usa26msg.h index 09e21e84fc4e..a68f1fb25b8a 100644 --- a/drivers/usb/serial/keyspan_usa26msg.h +++ b/drivers/usb/serial/keyspan_usa26msg.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause */ | ||
| 1 | /* | 2 | /* |
| 2 | usa26msg.h | 3 | usa26msg.h |
| 3 | 4 | ||
diff --git a/drivers/usb/serial/keyspan_usa28msg.h b/drivers/usb/serial/keyspan_usa28msg.h index dee454c4609a..a19f3fe5d98d 100644 --- a/drivers/usb/serial/keyspan_usa28msg.h +++ b/drivers/usb/serial/keyspan_usa28msg.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause */ | ||
| 1 | /* | 2 | /* |
| 2 | usa28msg.h | 3 | usa28msg.h |
| 3 | 4 | ||
diff --git a/drivers/usb/serial/keyspan_usa49msg.h b/drivers/usb/serial/keyspan_usa49msg.h index 163b2dea2ec5..8c3970fdd868 100644 --- a/drivers/usb/serial/keyspan_usa49msg.h +++ b/drivers/usb/serial/keyspan_usa49msg.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause */ | ||
| 1 | /* | 2 | /* |
| 2 | usa49msg.h | 3 | usa49msg.h |
| 3 | 4 | ||
diff --git a/drivers/usb/serial/keyspan_usa67msg.h b/drivers/usb/serial/keyspan_usa67msg.h index 20fa3e2f7187..dcf502fdbb44 100644 --- a/drivers/usb/serial/keyspan_usa67msg.h +++ b/drivers/usb/serial/keyspan_usa67msg.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause */ | ||
| 1 | /* | 2 | /* |
| 2 | usa67msg.h | 3 | usa67msg.h |
| 3 | 4 | ||
diff --git a/drivers/usb/serial/keyspan_usa90msg.h b/drivers/usb/serial/keyspan_usa90msg.h index 86708ecd8735..c4ca0f631d20 100644 --- a/drivers/usb/serial/keyspan_usa90msg.h +++ b/drivers/usb/serial/keyspan_usa90msg.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause */ | ||
| 1 | /* | 2 | /* |
| 2 | usa90msg.h | 3 | usa90msg.h |
| 3 | 4 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 98e7a5df0f6d..bb3f9aa4a909 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
| @@ -46,6 +46,7 @@ static const struct usb_device_id id_table[] = { | |||
| 46 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, | 46 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
| 47 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, | 47 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, |
| 48 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) }, | 48 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) }, |
| 49 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_TB) }, | ||
| 49 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 50 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
| 50 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 51 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
| 51 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID), | 52 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID), |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 4e2554d55362..559941ca884d 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | #define PL2303_VENDOR_ID 0x067b | 9 | #define PL2303_VENDOR_ID 0x067b |
| 10 | #define PL2303_PRODUCT_ID 0x2303 | 10 | #define PL2303_PRODUCT_ID 0x2303 |
| 11 | #define PL2303_PRODUCT_ID_TB 0x2304 | ||
| 11 | #define PL2303_PRODUCT_ID_RSAQ2 0x04bb | 12 | #define PL2303_PRODUCT_ID_RSAQ2 0x04bb |
| 12 | #define PL2303_PRODUCT_ID_DCU11 0x1234 | 13 | #define PL2303_PRODUCT_ID_DCU11 0x1234 |
| 13 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 | 14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 |
| @@ -20,6 +21,7 @@ | |||
| 20 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 | 21 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 |
| 21 | #define PL2303_PRODUCT_ID_ZTEK 0xe1f1 | 22 | #define PL2303_PRODUCT_ID_ZTEK 0xe1f1 |
| 22 | 23 | ||
| 24 | |||
| 23 | #define ATEN_VENDOR_ID 0x0557 | 25 | #define ATEN_VENDOR_ID 0x0557 |
| 24 | #define ATEN_VENDOR_ID2 0x0547 | 26 | #define ATEN_VENDOR_ID2 0x0547 |
| 25 | #define ATEN_PRODUCT_ID 0x2008 | 27 | #define ATEN_PRODUCT_ID 0x2008 |
diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c index 4d0273508043..edbbb13d6de6 100644 --- a/drivers/usb/serial/usb-serial-simple.c +++ b/drivers/usb/serial/usb-serial-simple.c | |||
| @@ -85,7 +85,8 @@ DEVICE(moto_modem, MOTO_IDS); | |||
| 85 | /* Motorola Tetra driver */ | 85 | /* Motorola Tetra driver */ |
| 86 | #define MOTOROLA_TETRA_IDS() \ | 86 | #define MOTOROLA_TETRA_IDS() \ |
| 87 | { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ | 87 | { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ |
| 88 | { USB_DEVICE(0x0cad, 0x9012) } /* MTP6550 */ | 88 | { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ |
| 89 | { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ | ||
| 89 | DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); | 90 | DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); |
| 90 | 91 | ||
| 91 | /* Novatel Wireless GPS driver */ | 92 | /* Novatel Wireless GPS driver */ |
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 4bc29b586698..f1c39a3c7534 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c | |||
| @@ -2297,7 +2297,8 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port) | |||
| 2297 | pdo_pps_apdo_max_voltage(snk)); | 2297 | pdo_pps_apdo_max_voltage(snk)); |
| 2298 | port->pps_data.max_curr = min_pps_apdo_current(src, snk); | 2298 | port->pps_data.max_curr = min_pps_apdo_current(src, snk); |
| 2299 | port->pps_data.out_volt = min(port->pps_data.max_volt, | 2299 | port->pps_data.out_volt = min(port->pps_data.max_volt, |
| 2300 | port->pps_data.out_volt); | 2300 | max(port->pps_data.min_volt, |
| 2301 | port->pps_data.out_volt)); | ||
| 2301 | port->pps_data.op_curr = min(port->pps_data.max_curr, | 2302 | port->pps_data.op_curr = min(port->pps_data.max_curr, |
| 2302 | port->pps_data.op_curr); | 2303 | port->pps_data.op_curr); |
| 2303 | } | 2304 | } |
diff --git a/drivers/usb/usbip/README b/drivers/usb/usbip/README deleted file mode 100644 index 41a2cf2e77a6..000000000000 --- a/drivers/usb/usbip/README +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | TODO: | ||
| 2 | - more discussion about the protocol | ||
| 3 | - testing | ||
| 4 | - review of the userspace interface | ||
| 5 | - document the protocol | ||
| 6 | |||
| 7 | Please send patches for this code to Greg Kroah-Hartman <greg@kroah.com> | ||
diff --git a/drivers/vfio/pci/trace.h b/drivers/vfio/pci/trace.h index 4d13e510590e..b2aa986ab9ed 100644 --- a/drivers/vfio/pci/trace.h +++ b/drivers/vfio/pci/trace.h | |||
| @@ -1,13 +1,9 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0+ */ | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* | 2 | /* |
| 3 | * VFIO PCI mmap/mmap_fault tracepoints | 3 | * VFIO PCI mmap/mmap_fault tracepoints |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2018 IBM Corp. All rights reserved. | 5 | * Copyright (C) 2018 IBM Corp. All rights reserved. |
| 6 | * Author: Alexey Kardashevskiy <aik@ozlabs.ru> | 6 | * Author: Alexey Kardashevskiy <aik@ozlabs.ru> |
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | 7 | */ |
| 12 | 8 | ||
| 13 | #undef TRACE_SYSTEM | 9 | #undef TRACE_SYSTEM |
diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c index 054a2cf9dd8e..32f695ffe128 100644 --- a/drivers/vfio/pci/vfio_pci_nvlink2.c +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c | |||
| @@ -1,14 +1,10 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0+ | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | /* | 2 | /* |
| 3 | * VFIO PCI NVIDIA Whitherspoon GPU support a.k.a. NVLink2. | 3 | * VFIO PCI NVIDIA Whitherspoon GPU support a.k.a. NVLink2. |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2018 IBM Corp. All rights reserved. | 5 | * Copyright (C) 2018 IBM Corp. All rights reserved. |
| 6 | * Author: Alexey Kardashevskiy <aik@ozlabs.ru> | 6 | * Author: Alexey Kardashevskiy <aik@ozlabs.ru> |
| 7 | * | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * Register an on-GPU RAM region for cacheable access. | 8 | * Register an on-GPU RAM region for cacheable access. |
| 13 | * | 9 | * |
| 14 | * Derived from original vfio_pci_igd.c: | 10 | * Derived from original vfio_pci_igd.c: |
| @@ -178,11 +174,11 @@ static int vfio_pci_nvgpu_add_capability(struct vfio_pci_device *vdev, | |||
| 178 | struct vfio_pci_region *region, struct vfio_info_cap *caps) | 174 | struct vfio_pci_region *region, struct vfio_info_cap *caps) |
| 179 | { | 175 | { |
| 180 | struct vfio_pci_nvgpu_data *data = region->data; | 176 | struct vfio_pci_nvgpu_data *data = region->data; |
| 181 | struct vfio_region_info_cap_nvlink2_ssatgt cap = { 0 }; | 177 | struct vfio_region_info_cap_nvlink2_ssatgt cap = { |
| 182 | 178 | .header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT, | |
| 183 | cap.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT; | 179 | .header.version = 1, |
| 184 | cap.header.version = 1; | 180 | .tgt = data->gpu_tgt |
| 185 | cap.tgt = data->gpu_tgt; | 181 | }; |
| 186 | 182 | ||
| 187 | return vfio_info_add_capability(caps, &cap.header, sizeof(cap)); | 183 | return vfio_info_add_capability(caps, &cap.header, sizeof(cap)); |
| 188 | } | 184 | } |
| @@ -365,18 +361,18 @@ static int vfio_pci_npu2_add_capability(struct vfio_pci_device *vdev, | |||
| 365 | struct vfio_pci_region *region, struct vfio_info_cap *caps) | 361 | struct vfio_pci_region *region, struct vfio_info_cap *caps) |
| 366 | { | 362 | { |
| 367 | struct vfio_pci_npu2_data *data = region->data; | 363 | struct vfio_pci_npu2_data *data = region->data; |
| 368 | struct vfio_region_info_cap_nvlink2_ssatgt captgt = { 0 }; | 364 | struct vfio_region_info_cap_nvlink2_ssatgt captgt = { |
| 369 | struct vfio_region_info_cap_nvlink2_lnkspd capspd = { 0 }; | 365 | .header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT, |
| 366 | .header.version = 1, | ||
| 367 | .tgt = data->gpu_tgt | ||
| 368 | }; | ||
| 369 | struct vfio_region_info_cap_nvlink2_lnkspd capspd = { | ||
| 370 | .header.id = VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD, | ||
| 371 | .header.version = 1, | ||
| 372 | .link_speed = data->link_speed | ||
| 373 | }; | ||
| 370 | int ret; | 374 | int ret; |
| 371 | 375 | ||
| 372 | captgt.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT; | ||
| 373 | captgt.header.version = 1; | ||
| 374 | captgt.tgt = data->gpu_tgt; | ||
| 375 | |||
| 376 | capspd.header.id = VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD; | ||
| 377 | capspd.header.version = 1; | ||
| 378 | capspd.link_speed = data->link_speed; | ||
| 379 | |||
| 380 | ret = vfio_info_add_capability(caps, &captgt.header, sizeof(captgt)); | 376 | ret = vfio_info_add_capability(caps, &captgt.header, sizeof(captgt)); |
| 381 | if (ret) | 377 | if (ret) |
| 382 | return ret; | 378 | return ret; |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index bca86bf7189f..df51a35cf537 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
| @@ -1337,7 +1337,8 @@ static int vhost_net_open(struct inode *inode, struct file *f) | |||
| 1337 | n->vqs[i].rx_ring = NULL; | 1337 | n->vqs[i].rx_ring = NULL; |
| 1338 | vhost_net_buf_init(&n->vqs[i].rxq); | 1338 | vhost_net_buf_init(&n->vqs[i].rxq); |
| 1339 | } | 1339 | } |
| 1340 | vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX); | 1340 | vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX, |
| 1341 | UIO_MAXIOV + VHOST_NET_BATCH); | ||
| 1341 | 1342 | ||
| 1342 | vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, EPOLLOUT, dev); | 1343 | vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, EPOLLOUT, dev); |
| 1343 | vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, EPOLLIN, dev); | 1344 | vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, EPOLLIN, dev); |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 344684f3e2e4..23593cb23dd0 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
| @@ -1627,7 +1627,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) | |||
| 1627 | vqs[i] = &vs->vqs[i].vq; | 1627 | vqs[i] = &vs->vqs[i].vq; |
| 1628 | vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick; | 1628 | vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick; |
| 1629 | } | 1629 | } |
| 1630 | vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ); | 1630 | vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ, UIO_MAXIOV); |
| 1631 | 1631 | ||
| 1632 | vhost_scsi_init_inflight(vs, NULL); | 1632 | vhost_scsi_init_inflight(vs, NULL); |
| 1633 | 1633 | ||
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 15a216cdd507..24a129fcdd61 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
| @@ -390,9 +390,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) | |||
| 390 | vq->indirect = kmalloc_array(UIO_MAXIOV, | 390 | vq->indirect = kmalloc_array(UIO_MAXIOV, |
| 391 | sizeof(*vq->indirect), | 391 | sizeof(*vq->indirect), |
| 392 | GFP_KERNEL); | 392 | GFP_KERNEL); |
| 393 | vq->log = kmalloc_array(UIO_MAXIOV, sizeof(*vq->log), | 393 | vq->log = kmalloc_array(dev->iov_limit, sizeof(*vq->log), |
| 394 | GFP_KERNEL); | 394 | GFP_KERNEL); |
| 395 | vq->heads = kmalloc_array(UIO_MAXIOV, sizeof(*vq->heads), | 395 | vq->heads = kmalloc_array(dev->iov_limit, sizeof(*vq->heads), |
| 396 | GFP_KERNEL); | 396 | GFP_KERNEL); |
| 397 | if (!vq->indirect || !vq->log || !vq->heads) | 397 | if (!vq->indirect || !vq->log || !vq->heads) |
| 398 | goto err_nomem; | 398 | goto err_nomem; |
| @@ -414,7 +414,7 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) | |||
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | void vhost_dev_init(struct vhost_dev *dev, | 416 | void vhost_dev_init(struct vhost_dev *dev, |
| 417 | struct vhost_virtqueue **vqs, int nvqs) | 417 | struct vhost_virtqueue **vqs, int nvqs, int iov_limit) |
| 418 | { | 418 | { |
| 419 | struct vhost_virtqueue *vq; | 419 | struct vhost_virtqueue *vq; |
| 420 | int i; | 420 | int i; |
| @@ -427,6 +427,7 @@ void vhost_dev_init(struct vhost_dev *dev, | |||
| 427 | dev->iotlb = NULL; | 427 | dev->iotlb = NULL; |
| 428 | dev->mm = NULL; | 428 | dev->mm = NULL; |
| 429 | dev->worker = NULL; | 429 | dev->worker = NULL; |
| 430 | dev->iov_limit = iov_limit; | ||
| 430 | init_llist_head(&dev->work_list); | 431 | init_llist_head(&dev->work_list); |
| 431 | init_waitqueue_head(&dev->wait); | 432 | init_waitqueue_head(&dev->wait); |
| 432 | INIT_LIST_HEAD(&dev->read_list); | 433 | INIT_LIST_HEAD(&dev->read_list); |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 1b675dad5e05..9490e7ddb340 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
| @@ -170,9 +170,11 @@ struct vhost_dev { | |||
| 170 | struct list_head read_list; | 170 | struct list_head read_list; |
| 171 | struct list_head pending_list; | 171 | struct list_head pending_list; |
| 172 | wait_queue_head_t wait; | 172 | wait_queue_head_t wait; |
| 173 | int iov_limit; | ||
| 173 | }; | 174 | }; |
| 174 | 175 | ||
| 175 | void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs); | 176 | void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, |
| 177 | int nvqs, int iov_limit); | ||
| 176 | long vhost_dev_set_owner(struct vhost_dev *dev); | 178 | long vhost_dev_set_owner(struct vhost_dev *dev); |
| 177 | bool vhost_dev_has_owner(struct vhost_dev *dev); | 179 | bool vhost_dev_has_owner(struct vhost_dev *dev); |
| 178 | long vhost_dev_check_owner(struct vhost_dev *); | 180 | long vhost_dev_check_owner(struct vhost_dev *); |
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 3fbc068eaa9b..bb5fc0e9fbc2 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c | |||
| @@ -531,7 +531,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) | |||
| 531 | vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick; | 531 | vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick; |
| 532 | vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick; | 532 | vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick; |
| 533 | 533 | ||
| 534 | vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs)); | 534 | vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs), UIO_MAXIOV); |
| 535 | 535 | ||
| 536 | file->private_data = vsock; | 536 | file->private_data = vsock; |
| 537 | spin_lock_init(&vsock->send_pkt_list_lock); | 537 | spin_lock_init(&vsock->send_pkt_list_lock); |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 09731b2f6815..c6b3bdbbdbc9 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
| @@ -271,6 +271,7 @@ static void vgacon_scrollback_update(struct vc_data *c, int t, int count) | |||
| 271 | 271 | ||
| 272 | static void vgacon_restore_screen(struct vc_data *c) | 272 | static void vgacon_restore_screen(struct vc_data *c) |
| 273 | { | 273 | { |
| 274 | c->vc_origin = c->vc_visible_origin; | ||
| 274 | vgacon_scrollback_cur->save = 0; | 275 | vgacon_scrollback_cur->save = 0; |
| 275 | 276 | ||
| 276 | if (!vga_is_gfx && !vgacon_scrollback_cur->restore) { | 277 | if (!vga_is_gfx && !vgacon_scrollback_cur->restore) { |
| @@ -287,8 +288,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) | |||
| 287 | int start, end, count, soff; | 288 | int start, end, count, soff; |
| 288 | 289 | ||
| 289 | if (!lines) { | 290 | if (!lines) { |
| 290 | c->vc_visible_origin = c->vc_origin; | 291 | vgacon_restore_screen(c); |
| 291 | vga_set_mem_top(c); | ||
| 292 | return; | 292 | return; |
| 293 | } | 293 | } |
| 294 | 294 | ||
| @@ -298,6 +298,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) | |||
| 298 | if (!vgacon_scrollback_cur->save) { | 298 | if (!vgacon_scrollback_cur->save) { |
| 299 | vgacon_cursor(c, CM_ERASE); | 299 | vgacon_cursor(c, CM_ERASE); |
| 300 | vgacon_save_screen(c); | 300 | vgacon_save_screen(c); |
| 301 | c->vc_origin = (unsigned long)c->vc_screenbuf; | ||
| 301 | vgacon_scrollback_cur->save = 1; | 302 | vgacon_scrollback_cur->save = 1; |
| 302 | } | 303 | } |
| 303 | 304 | ||
| @@ -335,7 +336,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) | |||
| 335 | int copysize; | 336 | int copysize; |
| 336 | 337 | ||
| 337 | int diff = c->vc_rows - count; | 338 | int diff = c->vc_rows - count; |
| 338 | void *d = (void *) c->vc_origin; | 339 | void *d = (void *) c->vc_visible_origin; |
| 339 | void *s = (void *) c->vc_screenbuf; | 340 | void *s = (void *) c->vc_screenbuf; |
| 340 | 341 | ||
| 341 | count *= c->vc_size_row; | 342 | count *= c->vc_size_row; |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cd7e755484e3..a0b07c331255 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
| @@ -152,7 +152,12 @@ struct vring_virtqueue { | |||
| 152 | /* Available for packed ring */ | 152 | /* Available for packed ring */ |
| 153 | struct { | 153 | struct { |
| 154 | /* Actual memory layout for this queue. */ | 154 | /* Actual memory layout for this queue. */ |
| 155 | struct vring_packed vring; | 155 | struct { |
| 156 | unsigned int num; | ||
| 157 | struct vring_packed_desc *desc; | ||
| 158 | struct vring_packed_desc_event *driver; | ||
| 159 | struct vring_packed_desc_event *device; | ||
| 160 | } vring; | ||
| 156 | 161 | ||
| 157 | /* Driver ring wrap counter. */ | 162 | /* Driver ring wrap counter. */ |
| 158 | bool avail_wrap_counter; | 163 | bool avail_wrap_counter; |
| @@ -1609,6 +1614,9 @@ static struct virtqueue *vring_create_virtqueue_packed( | |||
| 1609 | !context; | 1614 | !context; |
| 1610 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); | 1615 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); |
| 1611 | 1616 | ||
| 1617 | if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM)) | ||
| 1618 | vq->weak_barriers = false; | ||
| 1619 | |||
| 1612 | vq->packed.ring_dma_addr = ring_dma_addr; | 1620 | vq->packed.ring_dma_addr = ring_dma_addr; |
| 1613 | vq->packed.driver_event_dma_addr = driver_event_dma_addr; | 1621 | vq->packed.driver_event_dma_addr = driver_event_dma_addr; |
| 1614 | vq->packed.device_event_dma_addr = device_event_dma_addr; | 1622 | vq->packed.device_event_dma_addr = device_event_dma_addr; |
| @@ -2079,6 +2087,9 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, | |||
| 2079 | !context; | 2087 | !context; |
| 2080 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); | 2088 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); |
| 2081 | 2089 | ||
| 2090 | if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM)) | ||
| 2091 | vq->weak_barriers = false; | ||
| 2092 | |||
| 2082 | vq->split.queue_dma_addr = 0; | 2093 | vq->split.queue_dma_addr = 0; |
| 2083 | vq->split.queue_size_in_bytes = 0; | 2094 | vq->split.queue_size_in_bytes = 0; |
| 2084 | 2095 | ||
| @@ -2213,6 +2224,8 @@ void vring_transport_features(struct virtio_device *vdev) | |||
| 2213 | break; | 2224 | break; |
| 2214 | case VIRTIO_F_RING_PACKED: | 2225 | case VIRTIO_F_RING_PACKED: |
| 2215 | break; | 2226 | break; |
| 2227 | case VIRTIO_F_ORDER_PLATFORM: | ||
| 2228 | break; | ||
| 2216 | default: | 2229 | default: |
| 2217 | /* We don't understand this bit. */ | 2230 | /* We don't understand this bit. */ |
| 2218 | __virtio_clear_bit(vdev, i); | 2231 | __virtio_clear_bit(vdev, i); |
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 989cf872b98c..bb7888429be6 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
| @@ -645,7 +645,7 @@ xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma, | |||
| 645 | void *cpu_addr, dma_addr_t dma_addr, size_t size, | 645 | void *cpu_addr, dma_addr_t dma_addr, size_t size, |
| 646 | unsigned long attrs) | 646 | unsigned long attrs) |
| 647 | { | 647 | { |
| 648 | #if defined(CONFIG_ARM) || defined(CONFIG_ARM64) | 648 | #ifdef CONFIG_ARM |
| 649 | if (xen_get_dma_ops(dev)->mmap) | 649 | if (xen_get_dma_ops(dev)->mmap) |
| 650 | return xen_get_dma_ops(dev)->mmap(dev, vma, cpu_addr, | 650 | return xen_get_dma_ops(dev)->mmap(dev, vma, cpu_addr, |
| 651 | dma_addr, size, attrs); | 651 | dma_addr, size, attrs); |
| @@ -662,7 +662,7 @@ xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt, | |||
| 662 | void *cpu_addr, dma_addr_t handle, size_t size, | 662 | void *cpu_addr, dma_addr_t handle, size_t size, |
| 663 | unsigned long attrs) | 663 | unsigned long attrs) |
| 664 | { | 664 | { |
| 665 | #if defined(CONFIG_ARM) || defined(CONFIG_ARM64) | 665 | #ifdef CONFIG_ARM |
| 666 | if (xen_get_dma_ops(dev)->get_sgtable) { | 666 | if (xen_get_dma_ops(dev)->get_sgtable) { |
| 667 | #if 0 | 667 | #if 0 |
| 668 | /* | 668 | /* |
