diff options
Diffstat (limited to 'drivers')
398 files changed, 3005 insertions, 1744 deletions
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c index 8638f43cfc3d..79d86da1c892 100644 --- a/drivers/acpi/acpica/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c | |||
| @@ -186,6 +186,10 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) | |||
| 186 | } | 186 | } |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | if (obj_desc->common.type == ACPI_TYPE_REGION) { | ||
| 190 | acpi_ut_remove_address_range(obj_desc->region.space_id, node); | ||
| 191 | } | ||
| 192 | |||
| 189 | /* Clear the Node entry in all cases */ | 193 | /* Clear the Node entry in all cases */ |
| 190 | 194 | ||
| 191 | node->object = NULL; | 195 | node->object = NULL; |
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 5a389a4f4f65..f1ed0befe303 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
| @@ -567,6 +567,12 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, | |||
| 567 | goto out; | 567 | goto out; |
| 568 | } | 568 | } |
| 569 | 569 | ||
| 570 | dev_dbg(dev, "%s cmd: %s output length: %d\n", dimm_name, | ||
| 571 | cmd_name, out_obj->buffer.length); | ||
| 572 | print_hex_dump_debug(cmd_name, DUMP_PREFIX_OFFSET, 4, 4, | ||
| 573 | out_obj->buffer.pointer, | ||
| 574 | min_t(u32, 128, out_obj->buffer.length), true); | ||
| 575 | |||
| 570 | if (call_pkg) { | 576 | if (call_pkg) { |
| 571 | call_pkg->nd_fw_size = out_obj->buffer.length; | 577 | call_pkg->nd_fw_size = out_obj->buffer.length; |
| 572 | memcpy(call_pkg->nd_payload + call_pkg->nd_size_in, | 578 | memcpy(call_pkg->nd_payload + call_pkg->nd_size_in, |
| @@ -585,12 +591,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, | |||
| 585 | return 0; | 591 | return 0; |
| 586 | } | 592 | } |
| 587 | 593 | ||
| 588 | dev_dbg(dev, "%s cmd: %s output length: %d\n", dimm_name, | ||
| 589 | cmd_name, out_obj->buffer.length); | ||
| 590 | print_hex_dump_debug(cmd_name, DUMP_PREFIX_OFFSET, 4, 4, | ||
| 591 | out_obj->buffer.pointer, | ||
| 592 | min_t(u32, 128, out_obj->buffer.length), true); | ||
| 593 | |||
| 594 | for (i = 0, offset = 0; i < desc->out_num; i++) { | 594 | for (i = 0, offset = 0; i < desc->out_num; i++) { |
| 595 | u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i, buf, | 595 | u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i, buf, |
| 596 | (u32 *) out_obj->buffer.pointer, | 596 | (u32 *) out_obj->buffer.pointer, |
diff --git a/drivers/acpi/nfit/intel.c b/drivers/acpi/nfit/intel.c index f70de71f79d6..cddd0fcf622c 100644 --- a/drivers/acpi/nfit/intel.c +++ b/drivers/acpi/nfit/intel.c | |||
| @@ -122,9 +122,8 @@ static int intel_security_change_key(struct nvdimm *nvdimm, | |||
| 122 | if (!test_bit(cmd, &nfit_mem->dsm_mask)) | 122 | if (!test_bit(cmd, &nfit_mem->dsm_mask)) |
| 123 | return -ENOTTY; | 123 | return -ENOTTY; |
| 124 | 124 | ||
| 125 | if (old_data) | 125 | memcpy(nd_cmd.cmd.old_pass, old_data->data, |
| 126 | memcpy(nd_cmd.cmd.old_pass, old_data->data, | 126 | sizeof(nd_cmd.cmd.old_pass)); |
| 127 | sizeof(nd_cmd.cmd.old_pass)); | ||
| 128 | memcpy(nd_cmd.cmd.new_pass, new_data->data, | 127 | memcpy(nd_cmd.cmd.new_pass, new_data->data, |
| 129 | sizeof(nd_cmd.cmd.new_pass)); | 128 | sizeof(nd_cmd.cmd.new_pass)); |
| 130 | rc = nvdimm_ctl(nvdimm, ND_CMD_CALL, &nd_cmd, sizeof(nd_cmd), NULL); | 129 | rc = nvdimm_ctl(nvdimm, ND_CMD_CALL, &nd_cmd, sizeof(nd_cmd), NULL); |
| @@ -336,9 +335,8 @@ static int __maybe_unused intel_security_overwrite(struct nvdimm *nvdimm, | |||
| 336 | 335 | ||
| 337 | /* flush all cache before we erase DIMM */ | 336 | /* flush all cache before we erase DIMM */ |
| 338 | nvdimm_invalidate_cache(); | 337 | nvdimm_invalidate_cache(); |
| 339 | if (nkey) | 338 | memcpy(nd_cmd.cmd.passphrase, nkey->data, |
| 340 | memcpy(nd_cmd.cmd.passphrase, nkey->data, | 339 | sizeof(nd_cmd.cmd.passphrase)); |
| 341 | sizeof(nd_cmd.cmd.passphrase)); | ||
| 342 | rc = nvdimm_ctl(nvdimm, ND_CMD_CALL, &nd_cmd, sizeof(nd_cmd), NULL); | 340 | rc = nvdimm_ctl(nvdimm, ND_CMD_CALL, &nd_cmd, sizeof(nd_cmd), NULL); |
| 343 | if (rc < 0) | 341 | if (rc < 0) |
| 344 | return rc; | 342 | return rc; |
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index 11e1663bdc4d..b2c06da4f62e 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
| @@ -1646,7 +1646,7 @@ static irqreturn_t fs_irq (int irq, void *dev_id) | |||
| 1646 | } | 1646 | } |
| 1647 | 1647 | ||
| 1648 | if (status & ISR_TBRQ_W) { | 1648 | if (status & ISR_TBRQ_W) { |
| 1649 | fs_dprintk (FS_DEBUG_IRQ, "Data tramsitted!\n"); | 1649 | fs_dprintk (FS_DEBUG_IRQ, "Data transmitted!\n"); |
| 1650 | process_txdone_queue (dev, &dev->tx_relq); | 1650 | process_txdone_queue (dev, &dev->tx_relq); |
| 1651 | } | 1651 | } |
| 1652 | 1652 | ||
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index cb8347500ce2..e49028a60429 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
| @@ -506,7 +506,7 @@ static ssize_t probe_store(struct device *dev, struct device_attribute *attr, | |||
| 506 | 506 | ||
| 507 | ret = lock_device_hotplug_sysfs(); | 507 | ret = lock_device_hotplug_sysfs(); |
| 508 | if (ret) | 508 | if (ret) |
| 509 | goto out; | 509 | return ret; |
| 510 | 510 | ||
| 511 | nid = memory_add_physaddr_to_nid(phys_addr); | 511 | nid = memory_add_physaddr_to_nid(phys_addr); |
| 512 | ret = __add_memory(nid, phys_addr, | 512 | ret = __add_memory(nid, phys_addr, |
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 417a9f15c116..d7ac09c092f2 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c | |||
| @@ -1748,6 +1748,11 @@ static int __init null_init(void) | |||
| 1748 | return -EINVAL; | 1748 | return -EINVAL; |
| 1749 | } | 1749 | } |
| 1750 | 1750 | ||
| 1751 | if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) { | ||
| 1752 | pr_err("null_blk: invalid home_node value\n"); | ||
| 1753 | g_home_node = NUMA_NO_NODE; | ||
| 1754 | } | ||
| 1755 | |||
| 1751 | if (g_queue_mode == NULL_Q_RQ) { | 1756 | if (g_queue_mode == NULL_Q_RQ) { |
| 1752 | pr_err("null_blk: legacy IO path no longer available\n"); | 1757 | pr_err("null_blk: legacy IO path no longer available\n"); |
| 1753 | return -EINVAL; | 1758 | return -EINVAL; |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index 377a694dc228..6d415b20fb70 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
| @@ -314,6 +314,7 @@ static void pcd_init_units(void) | |||
| 314 | disk->queue = blk_mq_init_sq_queue(&cd->tag_set, &pcd_mq_ops, | 314 | disk->queue = blk_mq_init_sq_queue(&cd->tag_set, &pcd_mq_ops, |
| 315 | 1, BLK_MQ_F_SHOULD_MERGE); | 315 | 1, BLK_MQ_F_SHOULD_MERGE); |
| 316 | if (IS_ERR(disk->queue)) { | 316 | if (IS_ERR(disk->queue)) { |
| 317 | put_disk(disk); | ||
| 317 | disk->queue = NULL; | 318 | disk->queue = NULL; |
| 318 | continue; | 319 | continue; |
| 319 | } | 320 | } |
| @@ -750,6 +751,8 @@ static int pcd_detect(void) | |||
| 750 | 751 | ||
| 751 | printk("%s: No CD-ROM drive found\n", name); | 752 | printk("%s: No CD-ROM drive found\n", name); |
| 752 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { | 753 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { |
| 754 | if (!cd->disk) | ||
| 755 | continue; | ||
| 753 | blk_cleanup_queue(cd->disk->queue); | 756 | blk_cleanup_queue(cd->disk->queue); |
| 754 | cd->disk->queue = NULL; | 757 | cd->disk->queue = NULL; |
| 755 | blk_mq_free_tag_set(&cd->tag_set); | 758 | blk_mq_free_tag_set(&cd->tag_set); |
| @@ -1010,8 +1013,14 @@ static int __init pcd_init(void) | |||
| 1010 | pcd_probe_capabilities(); | 1013 | pcd_probe_capabilities(); |
| 1011 | 1014 | ||
| 1012 | if (register_blkdev(major, name)) { | 1015 | if (register_blkdev(major, name)) { |
| 1013 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) | 1016 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { |
| 1017 | if (!cd->disk) | ||
| 1018 | continue; | ||
| 1019 | |||
| 1020 | blk_cleanup_queue(cd->disk->queue); | ||
| 1021 | blk_mq_free_tag_set(&cd->tag_set); | ||
| 1014 | put_disk(cd->disk); | 1022 | put_disk(cd->disk); |
| 1023 | } | ||
| 1015 | return -EBUSY; | 1024 | return -EBUSY; |
| 1016 | } | 1025 | } |
| 1017 | 1026 | ||
| @@ -1032,6 +1041,9 @@ static void __exit pcd_exit(void) | |||
| 1032 | int unit; | 1041 | int unit; |
| 1033 | 1042 | ||
| 1034 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { | 1043 | for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { |
| 1044 | if (!cd->disk) | ||
| 1045 | continue; | ||
| 1046 | |||
| 1035 | if (cd->present) { | 1047 | if (cd->present) { |
| 1036 | del_gendisk(cd->disk); | 1048 | del_gendisk(cd->disk); |
| 1037 | pi_release(cd->pi); | 1049 | pi_release(cd->pi); |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 103b617cdc31..35e6e271b219 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
| @@ -762,6 +762,8 @@ static int pf_detect(void) | |||
| 762 | 762 | ||
| 763 | printk("%s: No ATAPI disk detected\n", name); | 763 | printk("%s: No ATAPI disk detected\n", name); |
| 764 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { | 764 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { |
| 765 | if (!pf->disk) | ||
| 766 | continue; | ||
| 765 | blk_cleanup_queue(pf->disk->queue); | 767 | blk_cleanup_queue(pf->disk->queue); |
| 766 | pf->disk->queue = NULL; | 768 | pf->disk->queue = NULL; |
| 767 | blk_mq_free_tag_set(&pf->tag_set); | 769 | blk_mq_free_tag_set(&pf->tag_set); |
| @@ -1029,8 +1031,13 @@ static int __init pf_init(void) | |||
| 1029 | pf_busy = 0; | 1031 | pf_busy = 0; |
| 1030 | 1032 | ||
| 1031 | if (register_blkdev(major, name)) { | 1033 | if (register_blkdev(major, name)) { |
| 1032 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) | 1034 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { |
| 1035 | if (!pf->disk) | ||
| 1036 | continue; | ||
| 1037 | blk_cleanup_queue(pf->disk->queue); | ||
| 1038 | blk_mq_free_tag_set(&pf->tag_set); | ||
| 1033 | put_disk(pf->disk); | 1039 | put_disk(pf->disk); |
| 1040 | } | ||
| 1034 | return -EBUSY; | 1041 | return -EBUSY; |
| 1035 | } | 1042 | } |
| 1036 | 1043 | ||
| @@ -1051,6 +1058,9 @@ static void __exit pf_exit(void) | |||
| 1051 | int unit; | 1058 | int unit; |
| 1052 | unregister_blkdev(major, name); | 1059 | unregister_blkdev(major, name); |
| 1053 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { | 1060 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { |
| 1061 | if (!pf->disk) | ||
| 1062 | continue; | ||
| 1063 | |||
| 1054 | if (pf->present) | 1064 | if (pf->present) |
| 1055 | del_gendisk(pf->disk); | 1065 | del_gendisk(pf->disk); |
| 1056 | 1066 | ||
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 4bc083b7c9b5..2a7ca4a1e6f7 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
| @@ -513,6 +513,8 @@ static int init_vq(struct virtio_blk *vblk) | |||
| 513 | if (err) | 513 | if (err) |
| 514 | num_vqs = 1; | 514 | num_vqs = 1; |
| 515 | 515 | ||
| 516 | num_vqs = min_t(unsigned int, nr_cpu_ids, num_vqs); | ||
| 517 | |||
| 516 | vblk->vqs = kmalloc_array(num_vqs, sizeof(*vblk->vqs), GFP_KERNEL); | 518 | vblk->vqs = kmalloc_array(num_vqs, sizeof(*vblk->vqs), GFP_KERNEL); |
| 517 | if (!vblk->vqs) | 519 | if (!vblk->vqs) |
| 518 | return -ENOMEM; | 520 | return -ENOMEM; |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 87ccef4bd69e..32a21b8d1d85 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
| @@ -1090,6 +1090,8 @@ static int ace_setup(struct ace_device *ace) | |||
| 1090 | return 0; | 1090 | return 0; |
| 1091 | 1091 | ||
| 1092 | err_read: | 1092 | err_read: |
| 1093 | /* prevent double queue cleanup */ | ||
| 1094 | ace->gd->queue = NULL; | ||
| 1093 | put_disk(ace->gd); | 1095 | put_disk(ace->gd); |
| 1094 | err_alloc_disk: | 1096 | err_alloc_disk: |
| 1095 | blk_cleanup_queue(ace->queue); | 1097 | blk_cleanup_queue(ace->queue); |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 399cad7daae7..d58a359a6622 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
| @@ -774,18 +774,18 @@ struct zram_work { | |||
| 774 | struct zram *zram; | 774 | struct zram *zram; |
| 775 | unsigned long entry; | 775 | unsigned long entry; |
| 776 | struct bio *bio; | 776 | struct bio *bio; |
| 777 | struct bio_vec bvec; | ||
| 777 | }; | 778 | }; |
| 778 | 779 | ||
| 779 | #if PAGE_SIZE != 4096 | 780 | #if PAGE_SIZE != 4096 |
| 780 | static void zram_sync_read(struct work_struct *work) | 781 | static void zram_sync_read(struct work_struct *work) |
| 781 | { | 782 | { |
| 782 | struct bio_vec bvec; | ||
| 783 | struct zram_work *zw = container_of(work, struct zram_work, work); | 783 | struct zram_work *zw = container_of(work, struct zram_work, work); |
| 784 | struct zram *zram = zw->zram; | 784 | struct zram *zram = zw->zram; |
| 785 | unsigned long entry = zw->entry; | 785 | unsigned long entry = zw->entry; |
| 786 | struct bio *bio = zw->bio; | 786 | struct bio *bio = zw->bio; |
| 787 | 787 | ||
| 788 | read_from_bdev_async(zram, &bvec, entry, bio); | 788 | read_from_bdev_async(zram, &zw->bvec, entry, bio); |
| 789 | } | 789 | } |
| 790 | 790 | ||
| 791 | /* | 791 | /* |
| @@ -798,6 +798,7 @@ static int read_from_bdev_sync(struct zram *zram, struct bio_vec *bvec, | |||
| 798 | { | 798 | { |
| 799 | struct zram_work work; | 799 | struct zram_work work; |
| 800 | 800 | ||
| 801 | work.bvec = *bvec; | ||
| 801 | work.zram = zram; | 802 | work.zram = zram; |
| 802 | work.entry = entry; | 803 | work.entry = entry; |
| 803 | work.bio = bio; | 804 | work.bio = bio; |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index ded198328f21..7db48ae65cd2 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -2942,6 +2942,7 @@ static int btusb_config_oob_wake(struct hci_dev *hdev) | |||
| 2942 | return 0; | 2942 | return 0; |
| 2943 | } | 2943 | } |
| 2944 | 2944 | ||
| 2945 | irq_set_status_flags(irq, IRQ_NOAUTOEN); | ||
| 2945 | ret = devm_request_irq(&hdev->dev, irq, btusb_oob_wake_handler, | 2946 | ret = devm_request_irq(&hdev->dev, irq, btusb_oob_wake_handler, |
| 2946 | 0, "OOB Wake-on-BT", data); | 2947 | 0, "OOB Wake-on-BT", data); |
| 2947 | if (ret) { | 2948 | if (ret) { |
| @@ -2956,7 +2957,6 @@ static int btusb_config_oob_wake(struct hci_dev *hdev) | |||
| 2956 | } | 2957 | } |
| 2957 | 2958 | ||
| 2958 | data->oob_wake_irq = irq; | 2959 | data->oob_wake_irq = irq; |
| 2959 | disable_irq(irq); | ||
| 2960 | bt_dev_info(hdev, "OOB Wake-on-BT configured at IRQ %u", irq); | 2960 | bt_dev_info(hdev, "OOB Wake-on-BT configured at IRQ %u", irq); |
| 2961 | return 0; | 2961 | return 0; |
| 2962 | } | 2962 | } |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 72866a004f07..466ebd84ad17 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
| @@ -348,7 +348,7 @@ config XILINX_HWICAP | |||
| 348 | 348 | ||
| 349 | config R3964 | 349 | config R3964 |
| 350 | tristate "Siemens R3964 line discipline" | 350 | tristate "Siemens R3964 line discipline" |
| 351 | depends on TTY | 351 | depends on TTY && BROKEN |
| 352 | ---help--- | 352 | ---help--- |
| 353 | This driver allows synchronous communication with devices using the | 353 | This driver allows synchronous communication with devices using the |
| 354 | Siemens R3964 packet protocol. Unless you are dealing with special | 354 | Siemens R3964 packet protocol. Unless you are dealing with special |
diff --git a/drivers/char/ipmi/ipmi_dmi.c b/drivers/char/ipmi/ipmi_dmi.c index ff0b199be472..f2411468f33f 100644 --- a/drivers/char/ipmi/ipmi_dmi.c +++ b/drivers/char/ipmi/ipmi_dmi.c | |||
| @@ -66,7 +66,6 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, | |||
| 66 | return; | 66 | return; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | memset(&p, 0, sizeof(p)); | ||
| 70 | p.addr = base_addr; | 69 | p.addr = base_addr; |
| 71 | p.space = space; | 70 | p.space = space; |
| 72 | p.regspacing = offset; | 71 | p.regspacing = offset; |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index e8ba67834746..00bf4b17edbf 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
| @@ -214,6 +214,9 @@ struct ipmi_user { | |||
| 214 | 214 | ||
| 215 | /* Does this interface receive IPMI events? */ | 215 | /* Does this interface receive IPMI events? */ |
| 216 | bool gets_events; | 216 | bool gets_events; |
| 217 | |||
| 218 | /* Free must run in process context for RCU cleanup. */ | ||
| 219 | struct work_struct remove_work; | ||
| 217 | }; | 220 | }; |
| 218 | 221 | ||
| 219 | static struct ipmi_user *acquire_ipmi_user(struct ipmi_user *user, int *index) | 222 | static struct ipmi_user *acquire_ipmi_user(struct ipmi_user *user, int *index) |
| @@ -1157,6 +1160,15 @@ static int intf_err_seq(struct ipmi_smi *intf, | |||
| 1157 | return rv; | 1160 | return rv; |
| 1158 | } | 1161 | } |
| 1159 | 1162 | ||
| 1163 | static void free_user_work(struct work_struct *work) | ||
| 1164 | { | ||
| 1165 | struct ipmi_user *user = container_of(work, struct ipmi_user, | ||
| 1166 | remove_work); | ||
| 1167 | |||
| 1168 | cleanup_srcu_struct(&user->release_barrier); | ||
| 1169 | kfree(user); | ||
| 1170 | } | ||
| 1171 | |||
| 1160 | int ipmi_create_user(unsigned int if_num, | 1172 | int ipmi_create_user(unsigned int if_num, |
| 1161 | const struct ipmi_user_hndl *handler, | 1173 | const struct ipmi_user_hndl *handler, |
| 1162 | void *handler_data, | 1174 | void *handler_data, |
| @@ -1200,6 +1212,8 @@ int ipmi_create_user(unsigned int if_num, | |||
| 1200 | goto out_kfree; | 1212 | goto out_kfree; |
| 1201 | 1213 | ||
| 1202 | found: | 1214 | found: |
| 1215 | INIT_WORK(&new_user->remove_work, free_user_work); | ||
| 1216 | |||
| 1203 | rv = init_srcu_struct(&new_user->release_barrier); | 1217 | rv = init_srcu_struct(&new_user->release_barrier); |
| 1204 | if (rv) | 1218 | if (rv) |
| 1205 | goto out_kfree; | 1219 | goto out_kfree; |
| @@ -1260,8 +1274,9 @@ EXPORT_SYMBOL(ipmi_get_smi_info); | |||
| 1260 | static void free_user(struct kref *ref) | 1274 | static void free_user(struct kref *ref) |
| 1261 | { | 1275 | { |
| 1262 | struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); | 1276 | struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); |
| 1263 | cleanup_srcu_struct(&user->release_barrier); | 1277 | |
| 1264 | kfree(user); | 1278 | /* SRCU cleanup must happen in task context. */ |
| 1279 | schedule_work(&user->remove_work); | ||
| 1265 | } | 1280 | } |
| 1266 | 1281 | ||
| 1267 | static void _ipmi_destroy_user(struct ipmi_user *user) | 1282 | static void _ipmi_destroy_user(struct ipmi_user *user) |
diff --git a/drivers/char/ipmi/ipmi_si_hardcode.c b/drivers/char/ipmi/ipmi_si_hardcode.c index 01946cad3d13..682221eebd66 100644 --- a/drivers/char/ipmi/ipmi_si_hardcode.c +++ b/drivers/char/ipmi/ipmi_si_hardcode.c | |||
| @@ -118,6 +118,8 @@ void __init ipmi_hardcode_init(void) | |||
| 118 | char *str; | 118 | char *str; |
| 119 | char *si_type[SI_MAX_PARMS]; | 119 | char *si_type[SI_MAX_PARMS]; |
| 120 | 120 | ||
| 121 | memset(si_type, 0, sizeof(si_type)); | ||
| 122 | |||
| 121 | /* Parse out the si_type string into its components. */ | 123 | /* Parse out the si_type string into its components. */ |
| 122 | str = si_type_str; | 124 | str = si_type_str; |
| 123 | if (*str != '\0') { | 125 | if (*str != '\0') { |
diff --git a/drivers/char/tpm/eventlog/tpm2.c b/drivers/char/tpm/eventlog/tpm2.c index d8b77133a83a..f824563fc28d 100644 --- a/drivers/char/tpm/eventlog/tpm2.c +++ b/drivers/char/tpm/eventlog/tpm2.c | |||
| @@ -37,8 +37,8 @@ | |||
| 37 | * | 37 | * |
| 38 | * Returns size of the event. If it is an invalid event, returns 0. | 38 | * Returns size of the event. If it is an invalid event, returns 0. |
| 39 | */ | 39 | */ |
| 40 | static int calc_tpm2_event_size(struct tcg_pcr_event2_head *event, | 40 | static size_t calc_tpm2_event_size(struct tcg_pcr_event2_head *event, |
| 41 | struct tcg_pcr_event *event_header) | 41 | struct tcg_pcr_event *event_header) |
| 42 | { | 42 | { |
| 43 | struct tcg_efi_specid_event_head *efispecid; | 43 | struct tcg_efi_specid_event_head *efispecid; |
| 44 | struct tcg_event_field *event_field; | 44 | struct tcg_event_field *event_field; |
diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c index 8856cce5a23b..817ae09a369e 100644 --- a/drivers/char/tpm/tpm-dev-common.c +++ b/drivers/char/tpm/tpm-dev-common.c | |||
| @@ -233,12 +233,19 @@ __poll_t tpm_common_poll(struct file *file, poll_table *wait) | |||
| 233 | __poll_t mask = 0; | 233 | __poll_t mask = 0; |
| 234 | 234 | ||
| 235 | poll_wait(file, &priv->async_wait, wait); | 235 | poll_wait(file, &priv->async_wait, wait); |
| 236 | mutex_lock(&priv->buffer_mutex); | ||
| 236 | 237 | ||
| 237 | if (!priv->response_read || priv->response_length) | 238 | /* |
| 239 | * The response_length indicates if there is still response | ||
| 240 | * (or part of it) to be consumed. Partial reads decrease it | ||
| 241 | * by the number of bytes read, and write resets it the zero. | ||
| 242 | */ | ||
| 243 | if (priv->response_length) | ||
| 238 | mask = EPOLLIN | EPOLLRDNORM; | 244 | mask = EPOLLIN | EPOLLRDNORM; |
| 239 | else | 245 | else |
| 240 | mask = EPOLLOUT | EPOLLWRNORM; | 246 | mask = EPOLLOUT | EPOLLWRNORM; |
| 241 | 247 | ||
| 248 | mutex_unlock(&priv->buffer_mutex); | ||
| 242 | return mask; | 249 | return mask; |
| 243 | } | 250 | } |
| 244 | 251 | ||
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 83ece5639f86..ae1030c9b086 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c | |||
| @@ -402,15 +402,13 @@ int tpm_pm_suspend(struct device *dev) | |||
| 402 | if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) | 402 | if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED) |
| 403 | return 0; | 403 | return 0; |
| 404 | 404 | ||
| 405 | if (chip->flags & TPM_CHIP_FLAG_TPM2) { | 405 | if (!tpm_chip_start(chip)) { |
| 406 | mutex_lock(&chip->tpm_mutex); | 406 | if (chip->flags & TPM_CHIP_FLAG_TPM2) |
| 407 | if (!tpm_chip_start(chip)) { | ||
| 408 | tpm2_shutdown(chip, TPM2_SU_STATE); | 407 | tpm2_shutdown(chip, TPM2_SU_STATE); |
| 409 | tpm_chip_stop(chip); | 408 | else |
| 410 | } | 409 | rc = tpm1_pm_suspend(chip, tpm_suspend_pcr); |
| 411 | mutex_unlock(&chip->tpm_mutex); | 410 | |
| 412 | } else { | 411 | tpm_chip_stop(chip); |
| 413 | rc = tpm1_pm_suspend(chip, tpm_suspend_pcr); | ||
| 414 | } | 412 | } |
| 415 | 413 | ||
| 416 | return rc; | 414 | return rc; |
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c index 89d6f3736dbf..f8edbb65eda3 100644 --- a/drivers/clk/at91/clk-programmable.c +++ b/drivers/clk/at91/clk-programmable.c | |||
| @@ -20,8 +20,7 @@ | |||
| 20 | #define PROG_ID_MAX 7 | 20 | #define PROG_ID_MAX 7 |
| 21 | 21 | ||
| 22 | #define PROG_STATUS_MASK(id) (1 << ((id) + 8)) | 22 | #define PROG_STATUS_MASK(id) (1 << ((id) + 8)) |
| 23 | #define PROG_PRES_MASK 0x7 | 23 | #define PROG_PRES(layout, pckr) ((pckr >> layout->pres_shift) & layout->pres_mask) |
| 24 | #define PROG_PRES(layout, pckr) ((pckr >> layout->pres_shift) & PROG_PRES_MASK) | ||
| 25 | #define PROG_MAX_RM9200_CSS 3 | 24 | #define PROG_MAX_RM9200_CSS 3 |
| 26 | 25 | ||
| 27 | struct clk_programmable { | 26 | struct clk_programmable { |
| @@ -37,20 +36,29 @@ static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw, | |||
| 37 | unsigned long parent_rate) | 36 | unsigned long parent_rate) |
| 38 | { | 37 | { |
| 39 | struct clk_programmable *prog = to_clk_programmable(hw); | 38 | struct clk_programmable *prog = to_clk_programmable(hw); |
| 39 | const struct clk_programmable_layout *layout = prog->layout; | ||
| 40 | unsigned int pckr; | 40 | unsigned int pckr; |
| 41 | unsigned long rate; | ||
| 41 | 42 | ||
| 42 | regmap_read(prog->regmap, AT91_PMC_PCKR(prog->id), &pckr); | 43 | regmap_read(prog->regmap, AT91_PMC_PCKR(prog->id), &pckr); |
| 43 | 44 | ||
| 44 | return parent_rate >> PROG_PRES(prog->layout, pckr); | 45 | if (layout->is_pres_direct) |
| 46 | rate = parent_rate / (PROG_PRES(layout, pckr) + 1); | ||
| 47 | else | ||
| 48 | rate = parent_rate >> PROG_PRES(layout, pckr); | ||
| 49 | |||
| 50 | return rate; | ||
| 45 | } | 51 | } |
| 46 | 52 | ||
| 47 | static int clk_programmable_determine_rate(struct clk_hw *hw, | 53 | static int clk_programmable_determine_rate(struct clk_hw *hw, |
| 48 | struct clk_rate_request *req) | 54 | struct clk_rate_request *req) |
| 49 | { | 55 | { |
| 56 | struct clk_programmable *prog = to_clk_programmable(hw); | ||
| 57 | const struct clk_programmable_layout *layout = prog->layout; | ||
| 50 | struct clk_hw *parent; | 58 | struct clk_hw *parent; |
| 51 | long best_rate = -EINVAL; | 59 | long best_rate = -EINVAL; |
| 52 | unsigned long parent_rate; | 60 | unsigned long parent_rate; |
| 53 | unsigned long tmp_rate; | 61 | unsigned long tmp_rate = 0; |
| 54 | int shift; | 62 | int shift; |
| 55 | int i; | 63 | int i; |
| 56 | 64 | ||
| @@ -60,10 +68,18 @@ static int clk_programmable_determine_rate(struct clk_hw *hw, | |||
| 60 | continue; | 68 | continue; |
| 61 | 69 | ||
| 62 | parent_rate = clk_hw_get_rate(parent); | 70 | parent_rate = clk_hw_get_rate(parent); |
| 63 | for (shift = 0; shift < PROG_PRES_MASK; shift++) { | 71 | if (layout->is_pres_direct) { |
| 64 | tmp_rate = parent_rate >> shift; | 72 | for (shift = 0; shift <= layout->pres_mask; shift++) { |
| 65 | if (tmp_rate <= req->rate) | 73 | tmp_rate = parent_rate / (shift + 1); |
| 66 | break; | 74 | if (tmp_rate <= req->rate) |
| 75 | break; | ||
| 76 | } | ||
| 77 | } else { | ||
| 78 | for (shift = 0; shift < layout->pres_mask; shift++) { | ||
| 79 | tmp_rate = parent_rate >> shift; | ||
| 80 | if (tmp_rate <= req->rate) | ||
| 81 | break; | ||
| 82 | } | ||
| 67 | } | 83 | } |
| 68 | 84 | ||
| 69 | if (tmp_rate > req->rate) | 85 | if (tmp_rate > req->rate) |
| @@ -137,16 +153,23 @@ static int clk_programmable_set_rate(struct clk_hw *hw, unsigned long rate, | |||
| 137 | if (!div) | 153 | if (!div) |
| 138 | return -EINVAL; | 154 | return -EINVAL; |
| 139 | 155 | ||
| 140 | shift = fls(div) - 1; | 156 | if (layout->is_pres_direct) { |
| 157 | shift = div - 1; | ||
| 141 | 158 | ||
| 142 | if (div != (1 << shift)) | 159 | if (shift > layout->pres_mask) |
| 143 | return -EINVAL; | 160 | return -EINVAL; |
| 161 | } else { | ||
| 162 | shift = fls(div) - 1; | ||
| 144 | 163 | ||
| 145 | if (shift >= PROG_PRES_MASK) | 164 | if (div != (1 << shift)) |
| 146 | return -EINVAL; | 165 | return -EINVAL; |
| 166 | |||
| 167 | if (shift >= layout->pres_mask) | ||
| 168 | return -EINVAL; | ||
| 169 | } | ||
| 147 | 170 | ||
| 148 | regmap_update_bits(prog->regmap, AT91_PMC_PCKR(prog->id), | 171 | regmap_update_bits(prog->regmap, AT91_PMC_PCKR(prog->id), |
| 149 | PROG_PRES_MASK << layout->pres_shift, | 172 | layout->pres_mask << layout->pres_shift, |
| 150 | shift << layout->pres_shift); | 173 | shift << layout->pres_shift); |
| 151 | 174 | ||
| 152 | return 0; | 175 | return 0; |
| @@ -202,19 +225,25 @@ at91_clk_register_programmable(struct regmap *regmap, | |||
| 202 | } | 225 | } |
| 203 | 226 | ||
| 204 | const struct clk_programmable_layout at91rm9200_programmable_layout = { | 227 | const struct clk_programmable_layout at91rm9200_programmable_layout = { |
| 228 | .pres_mask = 0x7, | ||
| 205 | .pres_shift = 2, | 229 | .pres_shift = 2, |
| 206 | .css_mask = 0x3, | 230 | .css_mask = 0x3, |
| 207 | .have_slck_mck = 0, | 231 | .have_slck_mck = 0, |
| 232 | .is_pres_direct = 0, | ||
| 208 | }; | 233 | }; |
| 209 | 234 | ||
| 210 | const struct clk_programmable_layout at91sam9g45_programmable_layout = { | 235 | const struct clk_programmable_layout at91sam9g45_programmable_layout = { |
| 236 | .pres_mask = 0x7, | ||
| 211 | .pres_shift = 2, | 237 | .pres_shift = 2, |
| 212 | .css_mask = 0x3, | 238 | .css_mask = 0x3, |
| 213 | .have_slck_mck = 1, | 239 | .have_slck_mck = 1, |
| 240 | .is_pres_direct = 0, | ||
| 214 | }; | 241 | }; |
| 215 | 242 | ||
| 216 | const struct clk_programmable_layout at91sam9x5_programmable_layout = { | 243 | const struct clk_programmable_layout at91sam9x5_programmable_layout = { |
| 244 | .pres_mask = 0x7, | ||
| 217 | .pres_shift = 4, | 245 | .pres_shift = 4, |
| 218 | .css_mask = 0x7, | 246 | .css_mask = 0x7, |
| 219 | .have_slck_mck = 0, | 247 | .have_slck_mck = 0, |
| 248 | .is_pres_direct = 0, | ||
| 220 | }; | 249 | }; |
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 672a79bda88c..a0e5ce9c9b9e 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h | |||
| @@ -71,9 +71,11 @@ struct clk_pll_characteristics { | |||
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | struct clk_programmable_layout { | 73 | struct clk_programmable_layout { |
| 74 | u8 pres_mask; | ||
| 74 | u8 pres_shift; | 75 | u8 pres_shift; |
| 75 | u8 css_mask; | 76 | u8 css_mask; |
| 76 | u8 have_slck_mck; | 77 | u8 have_slck_mck; |
| 78 | u8 is_pres_direct; | ||
| 77 | }; | 79 | }; |
| 78 | 80 | ||
| 79 | extern const struct clk_programmable_layout at91rm9200_programmable_layout; | 81 | extern const struct clk_programmable_layout at91rm9200_programmable_layout; |
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c index 1f70cb164b06..81943fac4537 100644 --- a/drivers/clk/at91/sama5d2.c +++ b/drivers/clk/at91/sama5d2.c | |||
| @@ -125,6 +125,14 @@ static const struct { | |||
| 125 | .pll = true }, | 125 | .pll = true }, |
| 126 | }; | 126 | }; |
| 127 | 127 | ||
| 128 | static const struct clk_programmable_layout sama5d2_programmable_layout = { | ||
| 129 | .pres_mask = 0xff, | ||
| 130 | .pres_shift = 4, | ||
| 131 | .css_mask = 0x7, | ||
| 132 | .have_slck_mck = 0, | ||
| 133 | .is_pres_direct = 1, | ||
| 134 | }; | ||
| 135 | |||
| 128 | static void __init sama5d2_pmc_setup(struct device_node *np) | 136 | static void __init sama5d2_pmc_setup(struct device_node *np) |
| 129 | { | 137 | { |
| 130 | struct clk_range range = CLK_RANGE(0, 0); | 138 | struct clk_range range = CLK_RANGE(0, 0); |
| @@ -249,7 +257,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) | |||
| 249 | 257 | ||
| 250 | hw = at91_clk_register_programmable(regmap, name, | 258 | hw = at91_clk_register_programmable(regmap, name, |
| 251 | parent_names, 6, i, | 259 | parent_names, 6, i, |
| 252 | &at91sam9x5_programmable_layout); | 260 | &sama5d2_programmable_layout); |
| 253 | if (IS_ERR(hw)) | 261 | if (IS_ERR(hw)) |
| 254 | goto err_free; | 262 | goto err_free; |
| 255 | } | 263 | } |
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 8c4435c53f09..6e787cc9e5b9 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c | |||
| @@ -46,6 +46,8 @@ static struct clk_lookup *clk_find(const char *dev_id, const char *con_id) | |||
| 46 | if (con_id) | 46 | if (con_id) |
| 47 | best_possible += 1; | 47 | best_possible += 1; |
| 48 | 48 | ||
| 49 | lockdep_assert_held(&clocks_mutex); | ||
| 50 | |||
| 49 | list_for_each_entry(p, &clocks, node) { | 51 | list_for_each_entry(p, &clocks, node) { |
| 50 | match = 0; | 52 | match = 0; |
| 51 | if (p->dev_id) { | 53 | if (p->dev_id) { |
| @@ -402,7 +404,10 @@ void devm_clk_release_clkdev(struct device *dev, const char *con_id, | |||
| 402 | struct clk_lookup *cl; | 404 | struct clk_lookup *cl; |
| 403 | int rval; | 405 | int rval; |
| 404 | 406 | ||
| 407 | mutex_lock(&clocks_mutex); | ||
| 405 | cl = clk_find(dev_id, con_id); | 408 | cl = clk_find(dev_id, con_id); |
| 409 | mutex_unlock(&clocks_mutex); | ||
| 410 | |||
| 406 | WARN_ON(!cl); | 411 | WARN_ON(!cl); |
| 407 | rval = devres_release(dev, devm_clkdev_release, | 412 | rval = devres_release(dev, devm_clkdev_release, |
| 408 | devm_clk_match_clkdev, cl); | 413 | devm_clk_match_clkdev, cl); |
diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c index 1acfa3e3cfb4..113d71042199 100644 --- a/drivers/clk/imx/clk-pll14xx.c +++ b/drivers/clk/imx/clk-pll14xx.c | |||
| @@ -362,7 +362,7 @@ struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, | |||
| 362 | 362 | ||
| 363 | switch (pll_clk->type) { | 363 | switch (pll_clk->type) { |
| 364 | case PLL_1416X: | 364 | case PLL_1416X: |
| 365 | if (!pll->rate_table) | 365 | if (!pll_clk->rate_table) |
| 366 | init.ops = &clk_pll1416x_min_ops; | 366 | init.ops = &clk_pll1416x_min_ops; |
| 367 | else | 367 | else |
| 368 | init.ops = &clk_pll1416x_ops; | 368 | init.ops = &clk_pll1416x_ops; |
diff --git a/drivers/clk/mediatek/clk-gate.c b/drivers/clk/mediatek/clk-gate.c index 9628d4e7690b..85daf826619a 100644 --- a/drivers/clk/mediatek/clk-gate.c +++ b/drivers/clk/mediatek/clk-gate.c | |||
| @@ -169,11 +169,10 @@ struct clk *mtk_clk_register_gate( | |||
| 169 | return ERR_PTR(-ENOMEM); | 169 | return ERR_PTR(-ENOMEM); |
| 170 | 170 | ||
| 171 | init.name = name; | 171 | init.name = name; |
| 172 | init.flags = CLK_SET_RATE_PARENT; | 172 | init.flags = flags | CLK_SET_RATE_PARENT; |
| 173 | init.parent_names = parent_name ? &parent_name : NULL; | 173 | init.parent_names = parent_name ? &parent_name : NULL; |
| 174 | init.num_parents = parent_name ? 1 : 0; | 174 | init.num_parents = parent_name ? 1 : 0; |
| 175 | init.ops = ops; | 175 | init.ops = ops; |
| 176 | init.flags = flags; | ||
| 177 | 176 | ||
| 178 | cg->regmap = regmap; | 177 | cg->regmap = regmap; |
| 179 | cg->set_ofs = set_ofs; | 178 | cg->set_ofs = set_ofs; |
diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 41e16dd7272a..7a14ac9b2fec 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c | |||
| @@ -120,7 +120,7 @@ static bool meson_clk_pll_is_better(unsigned long rate, | |||
| 120 | return true; | 120 | return true; |
| 121 | } else { | 121 | } else { |
| 122 | /* Round down */ | 122 | /* Round down */ |
| 123 | if (now < rate && best < now) | 123 | if (now <= rate && best < now) |
| 124 | return true; | 124 | return true; |
| 125 | } | 125 | } |
| 126 | 126 | ||
diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c index 0e1ce8c03259..f7b11e1eeebe 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c | |||
| @@ -960,14 +960,14 @@ static struct clk_regmap g12a_sd_emmc_c_clk0 = { | |||
| 960 | /* VPU Clock */ | 960 | /* VPU Clock */ |
| 961 | 961 | ||
| 962 | static const char * const g12a_vpu_parent_names[] = { | 962 | static const char * const g12a_vpu_parent_names[] = { |
| 963 | "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7", | 963 | "fclk_div3", "fclk_div4", "fclk_div5", "fclk_div7", |
| 964 | "mpll1", "vid_pll", "hifi_pll", "gp0_pll", | 964 | "mpll1", "vid_pll", "hifi_pll", "gp0_pll", |
| 965 | }; | 965 | }; |
| 966 | 966 | ||
| 967 | static struct clk_regmap g12a_vpu_0_sel = { | 967 | static struct clk_regmap g12a_vpu_0_sel = { |
| 968 | .data = &(struct clk_regmap_mux_data){ | 968 | .data = &(struct clk_regmap_mux_data){ |
| 969 | .offset = HHI_VPU_CLK_CNTL, | 969 | .offset = HHI_VPU_CLK_CNTL, |
| 970 | .mask = 0x3, | 970 | .mask = 0x7, |
| 971 | .shift = 9, | 971 | .shift = 9, |
| 972 | }, | 972 | }, |
| 973 | .hw.init = &(struct clk_init_data){ | 973 | .hw.init = &(struct clk_init_data){ |
| @@ -1011,7 +1011,7 @@ static struct clk_regmap g12a_vpu_0 = { | |||
| 1011 | static struct clk_regmap g12a_vpu_1_sel = { | 1011 | static struct clk_regmap g12a_vpu_1_sel = { |
| 1012 | .data = &(struct clk_regmap_mux_data){ | 1012 | .data = &(struct clk_regmap_mux_data){ |
| 1013 | .offset = HHI_VPU_CLK_CNTL, | 1013 | .offset = HHI_VPU_CLK_CNTL, |
| 1014 | .mask = 0x3, | 1014 | .mask = 0x7, |
| 1015 | .shift = 25, | 1015 | .shift = 25, |
| 1016 | }, | 1016 | }, |
| 1017 | .hw.init = &(struct clk_init_data){ | 1017 | .hw.init = &(struct clk_init_data){ |
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 04df2e208ed6..29ffb4fde714 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c | |||
| @@ -2216,6 +2216,7 @@ static struct clk_regmap gxbb_vdec_1_div = { | |||
| 2216 | .offset = HHI_VDEC_CLK_CNTL, | 2216 | .offset = HHI_VDEC_CLK_CNTL, |
| 2217 | .shift = 0, | 2217 | .shift = 0, |
| 2218 | .width = 7, | 2218 | .width = 7, |
| 2219 | .flags = CLK_DIVIDER_ROUND_CLOSEST, | ||
| 2219 | }, | 2220 | }, |
| 2220 | .hw.init = &(struct clk_init_data){ | 2221 | .hw.init = &(struct clk_init_data){ |
| 2221 | .name = "vdec_1_div", | 2222 | .name = "vdec_1_div", |
| @@ -2261,6 +2262,7 @@ static struct clk_regmap gxbb_vdec_hevc_div = { | |||
| 2261 | .offset = HHI_VDEC2_CLK_CNTL, | 2262 | .offset = HHI_VDEC2_CLK_CNTL, |
| 2262 | .shift = 16, | 2263 | .shift = 16, |
| 2263 | .width = 7, | 2264 | .width = 7, |
| 2265 | .flags = CLK_DIVIDER_ROUND_CLOSEST, | ||
| 2264 | }, | 2266 | }, |
| 2265 | .hw.init = &(struct clk_init_data){ | 2267 | .hw.init = &(struct clk_init_data){ |
| 2266 | .name = "vdec_hevc_div", | 2268 | .name = "vdec_hevc_div", |
diff --git a/drivers/clk/meson/vid-pll-div.c b/drivers/clk/meson/vid-pll-div.c index 08bcc01c0923..daff235bc763 100644 --- a/drivers/clk/meson/vid-pll-div.c +++ b/drivers/clk/meson/vid-pll-div.c | |||
| @@ -82,8 +82,8 @@ static unsigned long meson_vid_pll_div_recalc_rate(struct clk_hw *hw, | |||
| 82 | div = _get_table_val(meson_parm_read(clk->map, &pll_div->val), | 82 | div = _get_table_val(meson_parm_read(clk->map, &pll_div->val), |
| 83 | meson_parm_read(clk->map, &pll_div->sel)); | 83 | meson_parm_read(clk->map, &pll_div->sel)); |
| 84 | if (!div || !div->divider) { | 84 | if (!div || !div->divider) { |
| 85 | pr_info("%s: Invalid config value for vid_pll_div\n", __func__); | 85 | pr_debug("%s: Invalid config value for vid_pll_div\n", __func__); |
| 86 | return parent_rate; | 86 | return 0; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | return DIV_ROUND_UP_ULL(parent_rate * div->multiplier, div->divider); | 89 | return DIV_ROUND_UP_ULL(parent_rate * div->multiplier, div->divider); |
diff --git a/drivers/clk/sunxi-ng/ccu_nkmp.c b/drivers/clk/sunxi-ng/ccu_nkmp.c index 9b49adb20d07..cbcdf664f336 100644 --- a/drivers/clk/sunxi-ng/ccu_nkmp.c +++ b/drivers/clk/sunxi-ng/ccu_nkmp.c | |||
| @@ -167,7 +167,7 @@ static int ccu_nkmp_set_rate(struct clk_hw *hw, unsigned long rate, | |||
| 167 | unsigned long parent_rate) | 167 | unsigned long parent_rate) |
| 168 | { | 168 | { |
| 169 | struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); | 169 | struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); |
| 170 | u32 n_mask, k_mask, m_mask, p_mask; | 170 | u32 n_mask = 0, k_mask = 0, m_mask = 0, p_mask = 0; |
| 171 | struct _ccu_nkmp _nkmp; | 171 | struct _ccu_nkmp _nkmp; |
| 172 | unsigned long flags; | 172 | unsigned long flags; |
| 173 | u32 reg; | 173 | u32 reg; |
| @@ -186,10 +186,24 @@ static int ccu_nkmp_set_rate(struct clk_hw *hw, unsigned long rate, | |||
| 186 | 186 | ||
| 187 | ccu_nkmp_find_best(parent_rate, rate, &_nkmp); | 187 | ccu_nkmp_find_best(parent_rate, rate, &_nkmp); |
| 188 | 188 | ||
| 189 | n_mask = GENMASK(nkmp->n.width + nkmp->n.shift - 1, nkmp->n.shift); | 189 | /* |
| 190 | k_mask = GENMASK(nkmp->k.width + nkmp->k.shift - 1, nkmp->k.shift); | 190 | * If width is 0, GENMASK() macro may not generate expected mask (0) |
| 191 | m_mask = GENMASK(nkmp->m.width + nkmp->m.shift - 1, nkmp->m.shift); | 191 | * as it falls under undefined behaviour by C standard due to shifts |
| 192 | p_mask = GENMASK(nkmp->p.width + nkmp->p.shift - 1, nkmp->p.shift); | 192 | * which are equal or greater than width of left operand. This can |
| 193 | * be easily avoided by explicitly checking if width is 0. | ||
| 194 | */ | ||
| 195 | if (nkmp->n.width) | ||
| 196 | n_mask = GENMASK(nkmp->n.width + nkmp->n.shift - 1, | ||
| 197 | nkmp->n.shift); | ||
| 198 | if (nkmp->k.width) | ||
| 199 | k_mask = GENMASK(nkmp->k.width + nkmp->k.shift - 1, | ||
| 200 | nkmp->k.shift); | ||
| 201 | if (nkmp->m.width) | ||
| 202 | m_mask = GENMASK(nkmp->m.width + nkmp->m.shift - 1, | ||
| 203 | nkmp->m.shift); | ||
| 204 | if (nkmp->p.width) | ||
| 205 | p_mask = GENMASK(nkmp->p.width + nkmp->p.shift - 1, | ||
| 206 | nkmp->p.shift); | ||
| 193 | 207 | ||
| 194 | spin_lock_irqsave(nkmp->common.lock, flags); | 208 | spin_lock_irqsave(nkmp->common.lock, flags); |
| 195 | 209 | ||
diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c index d977193842df..19174835693b 100644 --- a/drivers/clk/x86/clk-pmc-atom.c +++ b/drivers/clk/x86/clk-pmc-atom.c | |||
| @@ -165,7 +165,7 @@ static const struct clk_ops plt_clk_ops = { | |||
| 165 | }; | 165 | }; |
| 166 | 166 | ||
| 167 | static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, | 167 | static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, |
| 168 | void __iomem *base, | 168 | const struct pmc_clk_data *pmc_data, |
| 169 | const char **parent_names, | 169 | const char **parent_names, |
| 170 | int num_parents) | 170 | int num_parents) |
| 171 | { | 171 | { |
| @@ -184,9 +184,17 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, | |||
| 184 | init.num_parents = num_parents; | 184 | init.num_parents = num_parents; |
| 185 | 185 | ||
| 186 | pclk->hw.init = &init; | 186 | pclk->hw.init = &init; |
| 187 | pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; | 187 | pclk->reg = pmc_data->base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; |
| 188 | spin_lock_init(&pclk->lock); | 188 | spin_lock_init(&pclk->lock); |
| 189 | 189 | ||
| 190 | /* | ||
| 191 | * On some systems, the pmc_plt_clocks already enabled by the | ||
| 192 | * firmware are being marked as critical to avoid them being | ||
| 193 | * gated by the clock framework. | ||
| 194 | */ | ||
| 195 | if (pmc_data->critical && plt_clk_is_enabled(&pclk->hw)) | ||
| 196 | init.flags |= CLK_IS_CRITICAL; | ||
| 197 | |||
| 190 | ret = devm_clk_hw_register(&pdev->dev, &pclk->hw); | 198 | ret = devm_clk_hw_register(&pdev->dev, &pclk->hw); |
| 191 | if (ret) { | 199 | if (ret) { |
| 192 | pclk = ERR_PTR(ret); | 200 | pclk = ERR_PTR(ret); |
| @@ -332,7 +340,7 @@ static int plt_clk_probe(struct platform_device *pdev) | |||
| 332 | return PTR_ERR(parent_names); | 340 | return PTR_ERR(parent_names); |
| 333 | 341 | ||
| 334 | for (i = 0; i < PMC_CLK_NUM; i++) { | 342 | for (i = 0; i < PMC_CLK_NUM; i++) { |
| 335 | data->clks[i] = plt_clk_register(pdev, i, pmc_data->base, | 343 | data->clks[i] = plt_clk_register(pdev, i, pmc_data, |
| 336 | parent_names, data->nparents); | 344 | parent_names, data->nparents); |
| 337 | if (IS_ERR(data->clks[i])) { | 345 | if (IS_ERR(data->clks[i])) { |
| 338 | err = PTR_ERR(data->clks[i]); | 346 | err = PTR_ERR(data->clks[i]); |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 171502a356aa..4b3d143f0f8a 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
| @@ -145,6 +145,7 @@ config VT8500_TIMER | |||
| 145 | config NPCM7XX_TIMER | 145 | config NPCM7XX_TIMER |
| 146 | bool "NPCM7xx timer driver" if COMPILE_TEST | 146 | bool "NPCM7xx timer driver" if COMPILE_TEST |
| 147 | depends on HAS_IOMEM | 147 | depends on HAS_IOMEM |
| 148 | select TIMER_OF | ||
| 148 | select CLKSRC_MMIO | 149 | select CLKSRC_MMIO |
| 149 | help | 150 | help |
| 150 | Enable 24-bit TIMER0 and TIMER1 counters in the NPCM7xx architecture, | 151 | Enable 24-bit TIMER0 and TIMER1 counters in the NPCM7xx architecture, |
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index aa4ec53281ce..ea373cfbcecb 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #define pr_fmt(fmt) "arm_arch_timer: " fmt | 12 | #define pr_fmt(fmt) "arch_timer: " fmt |
| 13 | 13 | ||
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| @@ -33,9 +33,6 @@ | |||
| 33 | 33 | ||
| 34 | #include <clocksource/arm_arch_timer.h> | 34 | #include <clocksource/arm_arch_timer.h> |
| 35 | 35 | ||
| 36 | #undef pr_fmt | ||
| 37 | #define pr_fmt(fmt) "arch_timer: " fmt | ||
| 38 | |||
| 39 | #define CNTTIDR 0x08 | 36 | #define CNTTIDR 0x08 |
| 40 | #define CNTTIDR_VIRT(n) (BIT(1) << ((n) * 4)) | 37 | #define CNTTIDR_VIRT(n) (BIT(1) << ((n) * 4)) |
| 41 | 38 | ||
diff --git a/drivers/clocksource/timer-oxnas-rps.c b/drivers/clocksource/timer-oxnas-rps.c index eed6feff8b5f..30c6f4ce672b 100644 --- a/drivers/clocksource/timer-oxnas-rps.c +++ b/drivers/clocksource/timer-oxnas-rps.c | |||
| @@ -296,4 +296,4 @@ err_alloc: | |||
| 296 | TIMER_OF_DECLARE(ox810se_rps, | 296 | TIMER_OF_DECLARE(ox810se_rps, |
| 297 | "oxsemi,ox810se-rps-timer", oxnas_rps_timer_init); | 297 | "oxsemi,ox810se-rps-timer", oxnas_rps_timer_init); |
| 298 | TIMER_OF_DECLARE(ox820_rps, | 298 | TIMER_OF_DECLARE(ox820_rps, |
| 299 | "oxsemi,ox820se-rps-timer", oxnas_rps_timer_init); | 299 | "oxsemi,ox820-rps-timer", oxnas_rps_timer_init); |
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c index 3352da6ed61f..ee8ec5a8cb16 100644 --- a/drivers/clocksource/timer-ti-dm.c +++ b/drivers/clocksource/timer-ti-dm.c | |||
| @@ -585,34 +585,6 @@ static int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, | |||
| 585 | return 0; | 585 | return 0; |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | /* Optimized set_load which removes costly spin wait in timer_start */ | ||
| 589 | static int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, | ||
| 590 | int autoreload, unsigned int load) | ||
| 591 | { | ||
| 592 | u32 l; | ||
| 593 | |||
| 594 | if (unlikely(!timer)) | ||
| 595 | return -EINVAL; | ||
| 596 | |||
| 597 | omap_dm_timer_enable(timer); | ||
| 598 | |||
| 599 | l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); | ||
| 600 | if (autoreload) { | ||
| 601 | l |= OMAP_TIMER_CTRL_AR; | ||
| 602 | omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); | ||
| 603 | } else { | ||
| 604 | l &= ~OMAP_TIMER_CTRL_AR; | ||
| 605 | } | ||
| 606 | l |= OMAP_TIMER_CTRL_ST; | ||
| 607 | |||
| 608 | __omap_dm_timer_load_start(timer, l, load, timer->posted); | ||
| 609 | |||
| 610 | /* Save the context */ | ||
| 611 | timer->context.tclr = l; | ||
| 612 | timer->context.tldr = load; | ||
| 613 | timer->context.tcrr = load; | ||
| 614 | return 0; | ||
| 615 | } | ||
| 616 | static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, | 588 | static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, |
| 617 | unsigned int match) | 589 | unsigned int match) |
| 618 | { | 590 | { |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index b599c7318aab..2986119dd31f 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
| @@ -2596,6 +2596,9 @@ static int __init intel_pstate_init(void) | |||
| 2596 | const struct x86_cpu_id *id; | 2596 | const struct x86_cpu_id *id; |
| 2597 | int rc; | 2597 | int rc; |
| 2598 | 2598 | ||
| 2599 | if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) | ||
| 2600 | return -ENODEV; | ||
| 2601 | |||
| 2599 | if (no_load) | 2602 | if (no_load) |
| 2600 | return -ENODEV; | 2603 | return -ENODEV; |
| 2601 | 2604 | ||
| @@ -2611,7 +2614,7 @@ static int __init intel_pstate_init(void) | |||
| 2611 | } else { | 2614 | } else { |
| 2612 | id = x86_match_cpu(intel_pstate_cpu_ids); | 2615 | id = x86_match_cpu(intel_pstate_cpu_ids); |
| 2613 | if (!id) { | 2616 | if (!id) { |
| 2614 | pr_info("CPU ID not supported\n"); | 2617 | pr_info("CPU model not supported\n"); |
| 2615 | return -ENODEV; | 2618 | return -ENODEV; |
| 2616 | } | 2619 | } |
| 2617 | 2620 | ||
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index b1eadc6652b5..7205d9f4029e 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c | |||
| @@ -865,19 +865,18 @@ static int ahash_update_ctx(struct ahash_request *req) | |||
| 865 | if (ret) | 865 | if (ret) |
| 866 | goto unmap_ctx; | 866 | goto unmap_ctx; |
| 867 | 867 | ||
| 868 | if (mapped_nents) { | 868 | if (mapped_nents) |
| 869 | sg_to_sec4_sg_last(req->src, mapped_nents, | 869 | sg_to_sec4_sg_last(req->src, mapped_nents, |
| 870 | edesc->sec4_sg + sec4_sg_src_index, | 870 | edesc->sec4_sg + sec4_sg_src_index, |
| 871 | 0); | 871 | 0); |
| 872 | if (*next_buflen) | 872 | else |
| 873 | scatterwalk_map_and_copy(next_buf, req->src, | ||
| 874 | to_hash - *buflen, | ||
| 875 | *next_buflen, 0); | ||
| 876 | } else { | ||
| 877 | sg_to_sec4_set_last(edesc->sec4_sg + sec4_sg_src_index - | 873 | sg_to_sec4_set_last(edesc->sec4_sg + sec4_sg_src_index - |
| 878 | 1); | 874 | 1); |
| 879 | } | ||
| 880 | 875 | ||
| 876 | if (*next_buflen) | ||
| 877 | scatterwalk_map_and_copy(next_buf, req->src, | ||
| 878 | to_hash - *buflen, | ||
| 879 | *next_buflen, 0); | ||
| 881 | desc = edesc->hw_desc; | 880 | desc = edesc->hw_desc; |
| 882 | 881 | ||
| 883 | edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, | 882 | edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, |
diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index ec8a291d62ba..54093ffd0aef 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c | |||
| @@ -671,7 +671,7 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_slave_sg( | |||
| 671 | d = bcm2835_dma_create_cb_chain(chan, direction, false, | 671 | d = bcm2835_dma_create_cb_chain(chan, direction, false, |
| 672 | info, extra, | 672 | info, extra, |
| 673 | frames, src, dst, 0, 0, | 673 | frames, src, dst, 0, 0, |
| 674 | GFP_KERNEL); | 674 | GFP_NOWAIT); |
| 675 | if (!d) | 675 | if (!d) |
| 676 | return NULL; | 676 | return NULL; |
| 677 | 677 | ||
diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c index 131f3974740d..814853842e29 100644 --- a/drivers/dma/mediatek/mtk-cqdma.c +++ b/drivers/dma/mediatek/mtk-cqdma.c | |||
| @@ -253,7 +253,7 @@ static void mtk_cqdma_start(struct mtk_cqdma_pchan *pc, | |||
| 253 | #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT | 253 | #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT |
| 254 | mtk_dma_set(pc, MTK_CQDMA_DST2, cvd->dest >> MTK_CQDMA_ADDR2_SHFIT); | 254 | mtk_dma_set(pc, MTK_CQDMA_DST2, cvd->dest >> MTK_CQDMA_ADDR2_SHFIT); |
| 255 | #else | 255 | #else |
| 256 | mtk_dma_set(pc, MTK_CQDMA_SRC2, 0); | 256 | mtk_dma_set(pc, MTK_CQDMA_DST2, 0); |
| 257 | #endif | 257 | #endif |
| 258 | 258 | ||
| 259 | /* setup the length */ | 259 | /* setup the length */ |
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 2b4f25698169..e2a5398f89b5 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c | |||
| @@ -1282,6 +1282,9 @@ static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan, | |||
| 1282 | enum dma_status status; | 1282 | enum dma_status status; |
| 1283 | unsigned int residue = 0; | 1283 | unsigned int residue = 0; |
| 1284 | unsigned int dptr = 0; | 1284 | unsigned int dptr = 0; |
| 1285 | unsigned int chcrb; | ||
| 1286 | unsigned int tcrb; | ||
| 1287 | unsigned int i; | ||
| 1285 | 1288 | ||
| 1286 | if (!desc) | 1289 | if (!desc) |
| 1287 | return 0; | 1290 | return 0; |
| @@ -1330,14 +1333,31 @@ static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan, | |||
| 1330 | } | 1333 | } |
| 1331 | 1334 | ||
| 1332 | /* | 1335 | /* |
| 1336 | * We need to read two registers. | ||
| 1337 | * Make sure the control register does not skip to next chunk | ||
| 1338 | * while reading the counter. | ||
| 1339 | * Trying it 3 times should be enough: Initial read, retry, retry | ||
| 1340 | * for the paranoid. | ||
| 1341 | */ | ||
| 1342 | for (i = 0; i < 3; i++) { | ||
| 1343 | chcrb = rcar_dmac_chan_read(chan, RCAR_DMACHCRB) & | ||
| 1344 | RCAR_DMACHCRB_DPTR_MASK; | ||
| 1345 | tcrb = rcar_dmac_chan_read(chan, RCAR_DMATCRB); | ||
| 1346 | /* Still the same? */ | ||
| 1347 | if (chcrb == (rcar_dmac_chan_read(chan, RCAR_DMACHCRB) & | ||
| 1348 | RCAR_DMACHCRB_DPTR_MASK)) | ||
| 1349 | break; | ||
| 1350 | } | ||
| 1351 | WARN_ONCE(i >= 3, "residue might be not continuous!"); | ||
| 1352 | |||
| 1353 | /* | ||
| 1333 | * In descriptor mode the descriptor running pointer is not maintained | 1354 | * In descriptor mode the descriptor running pointer is not maintained |
| 1334 | * by the interrupt handler, find the running descriptor from the | 1355 | * by the interrupt handler, find the running descriptor from the |
| 1335 | * descriptor pointer field in the CHCRB register. In non-descriptor | 1356 | * descriptor pointer field in the CHCRB register. In non-descriptor |
| 1336 | * mode just use the running descriptor pointer. | 1357 | * mode just use the running descriptor pointer. |
| 1337 | */ | 1358 | */ |
| 1338 | if (desc->hwdescs.use) { | 1359 | if (desc->hwdescs.use) { |
| 1339 | dptr = (rcar_dmac_chan_read(chan, RCAR_DMACHCRB) & | 1360 | dptr = chcrb >> RCAR_DMACHCRB_DPTR_SHIFT; |
| 1340 | RCAR_DMACHCRB_DPTR_MASK) >> RCAR_DMACHCRB_DPTR_SHIFT; | ||
| 1341 | if (dptr == 0) | 1361 | if (dptr == 0) |
| 1342 | dptr = desc->nchunks; | 1362 | dptr = desc->nchunks; |
| 1343 | dptr--; | 1363 | dptr--; |
| @@ -1355,7 +1375,7 @@ static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan, | |||
| 1355 | } | 1375 | } |
| 1356 | 1376 | ||
| 1357 | /* Add the residue for the current chunk. */ | 1377 | /* Add the residue for the current chunk. */ |
| 1358 | residue += rcar_dmac_chan_read(chan, RCAR_DMATCRB) << desc->xfer_shift; | 1378 | residue += tcrb << desc->xfer_shift; |
| 1359 | 1379 | ||
| 1360 | return residue; | 1380 | return residue; |
| 1361 | } | 1381 | } |
| @@ -1368,6 +1388,7 @@ static enum dma_status rcar_dmac_tx_status(struct dma_chan *chan, | |||
| 1368 | enum dma_status status; | 1388 | enum dma_status status; |
| 1369 | unsigned long flags; | 1389 | unsigned long flags; |
| 1370 | unsigned int residue; | 1390 | unsigned int residue; |
| 1391 | bool cyclic; | ||
| 1371 | 1392 | ||
| 1372 | status = dma_cookie_status(chan, cookie, txstate); | 1393 | status = dma_cookie_status(chan, cookie, txstate); |
| 1373 | if (status == DMA_COMPLETE || !txstate) | 1394 | if (status == DMA_COMPLETE || !txstate) |
| @@ -1375,10 +1396,11 @@ static enum dma_status rcar_dmac_tx_status(struct dma_chan *chan, | |||
| 1375 | 1396 | ||
| 1376 | spin_lock_irqsave(&rchan->lock, flags); | 1397 | spin_lock_irqsave(&rchan->lock, flags); |
| 1377 | residue = rcar_dmac_chan_get_residue(rchan, cookie); | 1398 | residue = rcar_dmac_chan_get_residue(rchan, cookie); |
| 1399 | cyclic = rchan->desc.running ? rchan->desc.running->cyclic : false; | ||
| 1378 | spin_unlock_irqrestore(&rchan->lock, flags); | 1400 | spin_unlock_irqrestore(&rchan->lock, flags); |
| 1379 | 1401 | ||
| 1380 | /* if there's no residue, the cookie is complete */ | 1402 | /* if there's no residue, the cookie is complete */ |
| 1381 | if (!residue) | 1403 | if (!residue && !cyclic) |
| 1382 | return DMA_COMPLETE; | 1404 | return DMA_COMPLETE; |
| 1383 | 1405 | ||
| 1384 | dma_set_residue(txstate, residue); | 1406 | dma_set_residue(txstate, residue); |
diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig index 8e17149655f0..540e8cd16ee6 100644 --- a/drivers/extcon/Kconfig +++ b/drivers/extcon/Kconfig | |||
| @@ -116,7 +116,7 @@ config EXTCON_PALMAS | |||
| 116 | 116 | ||
| 117 | config EXTCON_PTN5150 | 117 | config EXTCON_PTN5150 |
| 118 | tristate "NXP PTN5150 CC LOGIC USB EXTCON support" | 118 | tristate "NXP PTN5150 CC LOGIC USB EXTCON support" |
| 119 | depends on I2C && GPIOLIB || COMPILE_TEST | 119 | depends on I2C && (GPIOLIB || COMPILE_TEST) |
| 120 | select REGMAP_I2C | 120 | select REGMAP_I2C |
| 121 | help | 121 | help |
| 122 | Say Y here to enable support for USB peripheral and USB host | 122 | Say Y here to enable support for USB peripheral and USB host |
diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c index f0223cee9774..77092268ee95 100644 --- a/drivers/gpio/gpio-eic-sprd.c +++ b/drivers/gpio/gpio-eic-sprd.c | |||
| @@ -414,6 +414,7 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) | |||
| 414 | irq_set_handler_locked(data, handle_edge_irq); | 414 | irq_set_handler_locked(data, handle_edge_irq); |
| 415 | break; | 415 | break; |
| 416 | case IRQ_TYPE_EDGE_BOTH: | 416 | case IRQ_TYPE_EDGE_BOTH: |
| 417 | sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 0); | ||
| 417 | sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 1); | 418 | sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 1); |
| 418 | irq_set_handler_locked(data, handle_edge_irq); | 419 | irq_set_handler_locked(data, handle_edge_irq); |
| 419 | break; | 420 | break; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 0495bf1d480a..bca3e7740ef6 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -1379,7 +1379,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | |||
| 1379 | 1379 | ||
| 1380 | status = gpiochip_add_irqchip(chip, lock_key, request_key); | 1380 | status = gpiochip_add_irqchip(chip, lock_key, request_key); |
| 1381 | if (status) | 1381 | if (status) |
| 1382 | goto err_remove_chip; | 1382 | goto err_free_gpiochip_mask; |
| 1383 | 1383 | ||
| 1384 | status = of_gpiochip_add(chip); | 1384 | status = of_gpiochip_add(chip); |
| 1385 | if (status) | 1385 | if (status) |
| @@ -1387,7 +1387,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | |||
| 1387 | 1387 | ||
| 1388 | status = gpiochip_init_valid_mask(chip); | 1388 | status = gpiochip_init_valid_mask(chip); |
| 1389 | if (status) | 1389 | if (status) |
| 1390 | goto err_remove_chip; | 1390 | goto err_remove_of_chip; |
| 1391 | 1391 | ||
| 1392 | for (i = 0; i < chip->ngpio; i++) { | 1392 | for (i = 0; i < chip->ngpio; i++) { |
| 1393 | struct gpio_desc *desc = &gdev->descs[i]; | 1393 | struct gpio_desc *desc = &gdev->descs[i]; |
| @@ -1415,14 +1415,18 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, | |||
| 1415 | if (gpiolib_initialized) { | 1415 | if (gpiolib_initialized) { |
| 1416 | status = gpiochip_setup_dev(gdev); | 1416 | status = gpiochip_setup_dev(gdev); |
| 1417 | if (status) | 1417 | if (status) |
| 1418 | goto err_remove_chip; | 1418 | goto err_remove_acpi_chip; |
| 1419 | } | 1419 | } |
| 1420 | return 0; | 1420 | return 0; |
| 1421 | 1421 | ||
| 1422 | err_remove_chip: | 1422 | err_remove_acpi_chip: |
| 1423 | acpi_gpiochip_remove(chip); | 1423 | acpi_gpiochip_remove(chip); |
| 1424 | err_remove_of_chip: | ||
| 1424 | gpiochip_free_hogs(chip); | 1425 | gpiochip_free_hogs(chip); |
| 1425 | of_gpiochip_remove(chip); | 1426 | of_gpiochip_remove(chip); |
| 1427 | err_remove_chip: | ||
| 1428 | gpiochip_irqchip_remove(chip); | ||
| 1429 | err_free_gpiochip_mask: | ||
| 1426 | gpiochip_free_valid_mask(chip); | 1430 | gpiochip_free_valid_mask(chip); |
| 1427 | err_remove_irqchip_mask: | 1431 | err_remove_irqchip_mask: |
| 1428 | gpiochip_irqchip_free_valid_mask(chip); | 1432 | gpiochip_irqchip_free_valid_mask(chip); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 4f8fb4ecde34..79fb302fb954 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
| @@ -3165,6 +3165,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) | |||
| 3165 | 3165 | ||
| 3166 | /* No need to recover an evicted BO */ | 3166 | /* No need to recover an evicted BO */ |
| 3167 | if (shadow->tbo.mem.mem_type != TTM_PL_TT || | 3167 | if (shadow->tbo.mem.mem_type != TTM_PL_TT || |
| 3168 | shadow->tbo.mem.start == AMDGPU_BO_INVALID_OFFSET || | ||
| 3168 | shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM) | 3169 | shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM) |
| 3169 | continue; | 3170 | continue; |
| 3170 | 3171 | ||
| @@ -3173,11 +3174,16 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) | |||
| 3173 | break; | 3174 | break; |
| 3174 | 3175 | ||
| 3175 | if (fence) { | 3176 | if (fence) { |
| 3176 | r = dma_fence_wait_timeout(fence, false, tmo); | 3177 | tmo = dma_fence_wait_timeout(fence, false, tmo); |
| 3177 | dma_fence_put(fence); | 3178 | dma_fence_put(fence); |
| 3178 | fence = next; | 3179 | fence = next; |
| 3179 | if (r <= 0) | 3180 | if (tmo == 0) { |
| 3181 | r = -ETIMEDOUT; | ||
| 3180 | break; | 3182 | break; |
| 3183 | } else if (tmo < 0) { | ||
| 3184 | r = tmo; | ||
| 3185 | break; | ||
| 3186 | } | ||
| 3181 | } else { | 3187 | } else { |
| 3182 | fence = next; | 3188 | fence = next; |
| 3183 | } | 3189 | } |
| @@ -3188,8 +3194,8 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) | |||
| 3188 | tmo = dma_fence_wait_timeout(fence, false, tmo); | 3194 | tmo = dma_fence_wait_timeout(fence, false, tmo); |
| 3189 | dma_fence_put(fence); | 3195 | dma_fence_put(fence); |
| 3190 | 3196 | ||
| 3191 | if (r <= 0 || tmo <= 0) { | 3197 | if (r < 0 || tmo <= 0) { |
| 3192 | DRM_ERROR("recover vram bo from shadow failed\n"); | 3198 | DRM_ERROR("recover vram bo from shadow failed, r is %ld, tmo is %ld\n", r, tmo); |
| 3193 | return -EIO; | 3199 | return -EIO; |
| 3194 | } | 3200 | } |
| 3195 | 3201 | ||
| @@ -3625,6 +3631,7 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev, | |||
| 3625 | struct pci_dev *pdev = adev->pdev; | 3631 | struct pci_dev *pdev = adev->pdev; |
| 3626 | enum pci_bus_speed cur_speed; | 3632 | enum pci_bus_speed cur_speed; |
| 3627 | enum pcie_link_width cur_width; | 3633 | enum pcie_link_width cur_width; |
| 3634 | u32 ret = 1; | ||
| 3628 | 3635 | ||
| 3629 | *speed = PCI_SPEED_UNKNOWN; | 3636 | *speed = PCI_SPEED_UNKNOWN; |
| 3630 | *width = PCIE_LNK_WIDTH_UNKNOWN; | 3637 | *width = PCIE_LNK_WIDTH_UNKNOWN; |
| @@ -3632,6 +3639,10 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev, | |||
| 3632 | while (pdev) { | 3639 | while (pdev) { |
| 3633 | cur_speed = pcie_get_speed_cap(pdev); | 3640 | cur_speed = pcie_get_speed_cap(pdev); |
| 3634 | cur_width = pcie_get_width_cap(pdev); | 3641 | cur_width = pcie_get_width_cap(pdev); |
| 3642 | ret = pcie_bandwidth_available(adev->pdev, NULL, | ||
| 3643 | NULL, &cur_width); | ||
| 3644 | if (!ret) | ||
| 3645 | cur_width = PCIE_LNK_WIDTH_RESRV; | ||
| 3635 | 3646 | ||
| 3636 | if (cur_speed != PCI_SPEED_UNKNOWN) { | 3647 | if (cur_speed != PCI_SPEED_UNKNOWN) { |
| 3637 | if (*speed == PCI_SPEED_UNKNOWN) | 3648 | if (*speed == PCI_SPEED_UNKNOWN) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 0b8ef2d27d6b..fe393a46f881 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include "amdgpu_trace.h" | 35 | #include "amdgpu_trace.h" |
| 36 | 36 | ||
| 37 | #define AMDGPU_IB_TEST_TIMEOUT msecs_to_jiffies(1000) | 37 | #define AMDGPU_IB_TEST_TIMEOUT msecs_to_jiffies(1000) |
| 38 | #define AMDGPU_IB_TEST_GFX_XGMI_TIMEOUT msecs_to_jiffies(2000) | ||
| 38 | 39 | ||
| 39 | /* | 40 | /* |
| 40 | * IB | 41 | * IB |
| @@ -344,6 +345,8 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev) | |||
| 344 | * cost waiting for it coming back under RUNTIME only | 345 | * cost waiting for it coming back under RUNTIME only |
| 345 | */ | 346 | */ |
| 346 | tmo_gfx = 8 * AMDGPU_IB_TEST_TIMEOUT; | 347 | tmo_gfx = 8 * AMDGPU_IB_TEST_TIMEOUT; |
| 348 | } else if (adev->gmc.xgmi.hive_id) { | ||
| 349 | tmo_gfx = AMDGPU_IB_TEST_GFX_XGMI_TIMEOUT; | ||
| 347 | } | 350 | } |
| 348 | 351 | ||
| 349 | for (i = 0; i < adev->num_rings; ++i) { | 352 | for (i = 0; i < adev->num_rings; ++i) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index d0309e8c9d12..a11db2b1a63f 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | |||
| @@ -2405,8 +2405,6 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev) | |||
| 2405 | /* disable CG */ | 2405 | /* disable CG */ |
| 2406 | WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, 0); | 2406 | WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, 0); |
| 2407 | 2407 | ||
| 2408 | adev->gfx.rlc.funcs->reset(adev); | ||
| 2409 | |||
| 2410 | gfx_v9_0_init_pg(adev); | 2408 | gfx_v9_0_init_pg(adev); |
| 2411 | 2409 | ||
| 2412 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) { | 2410 | if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c index d0d966d6080a..1696644ec022 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | |||
| @@ -182,6 +182,7 @@ static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev) | |||
| 182 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, | 182 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, |
| 183 | L2_CACHE_BIGK_FRAGMENT_SIZE, 6); | 183 | L2_CACHE_BIGK_FRAGMENT_SIZE, 6); |
| 184 | } | 184 | } |
| 185 | WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, tmp); | ||
| 185 | 186 | ||
| 186 | tmp = mmVM_L2_CNTL4_DEFAULT; | 187 | tmp = mmVM_L2_CNTL4_DEFAULT; |
| 187 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0); | 188 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0); |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index 8be9677c0c07..cf9a49f49d3a 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c | |||
| @@ -320,6 +320,7 @@ static const struct kfd_deviceid supported_devices[] = { | |||
| 320 | { 0x9876, &carrizo_device_info }, /* Carrizo */ | 320 | { 0x9876, &carrizo_device_info }, /* Carrizo */ |
| 321 | { 0x9877, &carrizo_device_info }, /* Carrizo */ | 321 | { 0x9877, &carrizo_device_info }, /* Carrizo */ |
| 322 | { 0x15DD, &raven_device_info }, /* Raven */ | 322 | { 0x15DD, &raven_device_info }, /* Raven */ |
| 323 | { 0x15D8, &raven_device_info }, /* Raven */ | ||
| 323 | #endif | 324 | #endif |
| 324 | { 0x67A0, &hawaii_device_info }, /* Hawaii */ | 325 | { 0x67A0, &hawaii_device_info }, /* Hawaii */ |
| 325 | { 0x67A1, &hawaii_device_info }, /* Hawaii */ | 326 | { 0x67A1, &hawaii_device_info }, /* Hawaii */ |
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 81127f7d6ed1..3082b55b1e77 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
| @@ -4533,6 +4533,7 @@ static void handle_cursor_update(struct drm_plane *plane, | |||
| 4533 | amdgpu_crtc->cursor_width = plane->state->crtc_w; | 4533 | amdgpu_crtc->cursor_width = plane->state->crtc_w; |
| 4534 | amdgpu_crtc->cursor_height = plane->state->crtc_h; | 4534 | amdgpu_crtc->cursor_height = plane->state->crtc_h; |
| 4535 | 4535 | ||
| 4536 | memset(&attributes, 0, sizeof(attributes)); | ||
| 4536 | attributes.address.high_part = upper_32_bits(address); | 4537 | attributes.address.high_part = upper_32_bits(address); |
| 4537 | attributes.address.low_part = lower_32_bits(address); | 4538 | attributes.address.low_part = lower_32_bits(address); |
| 4538 | attributes.width = plane->state->crtc_w; | 4539 | attributes.width = plane->state->crtc_w; |
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index c68fbd55db3c..a6cda201c964 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c | |||
| @@ -1377,6 +1377,11 @@ static enum surface_update_type det_surface_update(const struct dc *dc, | |||
| 1377 | return UPDATE_TYPE_FULL; | 1377 | return UPDATE_TYPE_FULL; |
| 1378 | } | 1378 | } |
| 1379 | 1379 | ||
| 1380 | if (u->surface->force_full_update) { | ||
| 1381 | update_flags->bits.full_update = 1; | ||
| 1382 | return UPDATE_TYPE_FULL; | ||
| 1383 | } | ||
| 1384 | |||
| 1380 | type = get_plane_info_update_type(u); | 1385 | type = get_plane_info_update_type(u); |
| 1381 | elevate_update_type(&overall_type, type); | 1386 | elevate_update_type(&overall_type, type); |
| 1382 | 1387 | ||
| @@ -1802,6 +1807,14 @@ void dc_commit_updates_for_stream(struct dc *dc, | |||
| 1802 | } | 1807 | } |
| 1803 | 1808 | ||
| 1804 | dc_resource_state_copy_construct(state, context); | 1809 | dc_resource_state_copy_construct(state, context); |
| 1810 | |||
| 1811 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 1812 | struct pipe_ctx *new_pipe = &context->res_ctx.pipe_ctx[i]; | ||
| 1813 | struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i]; | ||
| 1814 | |||
| 1815 | if (new_pipe->plane_state && new_pipe->plane_state != old_pipe->plane_state) | ||
| 1816 | new_pipe->plane_state->force_full_update = true; | ||
| 1817 | } | ||
| 1805 | } | 1818 | } |
| 1806 | 1819 | ||
| 1807 | 1820 | ||
| @@ -1838,6 +1851,12 @@ void dc_commit_updates_for_stream(struct dc *dc, | |||
| 1838 | dc->current_state = context; | 1851 | dc->current_state = context; |
| 1839 | dc_release_state(old); | 1852 | dc_release_state(old); |
| 1840 | 1853 | ||
| 1854 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 1855 | struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; | ||
| 1856 | |||
| 1857 | if (pipe_ctx->plane_state && pipe_ctx->stream == stream) | ||
| 1858 | pipe_ctx->plane_state->force_full_update = false; | ||
| 1859 | } | ||
| 1841 | } | 1860 | } |
| 1842 | /*let's use current_state to update watermark etc*/ | 1861 | /*let's use current_state to update watermark etc*/ |
| 1843 | if (update_type >= UPDATE_TYPE_FULL) | 1862 | if (update_type >= UPDATE_TYPE_FULL) |
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index 4eba3c4800b6..ea18e9c2d8ce 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c | |||
| @@ -2660,12 +2660,18 @@ void core_link_enable_stream( | |||
| 2660 | void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option) | 2660 | void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option) |
| 2661 | { | 2661 | { |
| 2662 | struct dc *core_dc = pipe_ctx->stream->ctx->dc; | 2662 | struct dc *core_dc = pipe_ctx->stream->ctx->dc; |
| 2663 | struct dc_stream_state *stream = pipe_ctx->stream; | ||
| 2663 | 2664 | ||
| 2664 | core_dc->hwss.blank_stream(pipe_ctx); | 2665 | core_dc->hwss.blank_stream(pipe_ctx); |
| 2665 | 2666 | ||
| 2666 | if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) | 2667 | if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) |
| 2667 | deallocate_mst_payload(pipe_ctx); | 2668 | deallocate_mst_payload(pipe_ctx); |
| 2668 | 2669 | ||
| 2670 | if (dc_is_hdmi_signal(pipe_ctx->stream->signal)) | ||
| 2671 | dal_ddc_service_write_scdc_data( | ||
| 2672 | stream->link->ddc, 0, | ||
| 2673 | stream->timing.flags.LTE_340MCSC_SCRAMBLE); | ||
| 2674 | |||
| 2669 | core_dc->hwss.disable_stream(pipe_ctx, option); | 2675 | core_dc->hwss.disable_stream(pipe_ctx, option); |
| 2670 | 2676 | ||
| 2671 | disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal); | 2677 | disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal); |
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 1a7fd6aa77eb..0515095574e7 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h | |||
| @@ -503,6 +503,9 @@ struct dc_plane_state { | |||
| 503 | struct dc_plane_status status; | 503 | struct dc_plane_status status; |
| 504 | struct dc_context *ctx; | 504 | struct dc_context *ctx; |
| 505 | 505 | ||
| 506 | /* HACK: Workaround for forcing full reprogramming under some conditions */ | ||
| 507 | bool force_full_update; | ||
| 508 | |||
| 506 | /* private to dc_surface.c */ | 509 | /* private to dc_surface.c */ |
| 507 | enum dc_irq_source irq_source; | 510 | enum dc_irq_source irq_source; |
| 508 | struct kref refcount; | 511 | struct kref refcount; |
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c index 4febf4ef7240..4fe3664fb495 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | |||
| @@ -190,6 +190,12 @@ static void submit_channel_request( | |||
| 190 | 1, | 190 | 1, |
| 191 | 0); | 191 | 0); |
| 192 | } | 192 | } |
| 193 | |||
| 194 | REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1); | ||
| 195 | |||
| 196 | REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0, | ||
| 197 | 10, aux110->timeout_period/10); | ||
| 198 | |||
| 193 | /* set the delay and the number of bytes to write */ | 199 | /* set the delay and the number of bytes to write */ |
| 194 | 200 | ||
| 195 | /* The length include | 201 | /* The length include |
| @@ -242,9 +248,6 @@ static void submit_channel_request( | |||
| 242 | } | 248 | } |
| 243 | } | 249 | } |
| 244 | 250 | ||
| 245 | REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1); | ||
| 246 | REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0, | ||
| 247 | 10, aux110->timeout_period/10); | ||
| 248 | REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1); | 251 | REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1); |
| 249 | } | 252 | } |
| 250 | 253 | ||
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h index d27f22c05e4b..e28ed6a00ff4 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h | |||
| @@ -71,11 +71,11 @@ enum { /* This is the timeout as defined in DP 1.2a, | |||
| 71 | * at most within ~240usec. That means, | 71 | * at most within ~240usec. That means, |
| 72 | * increasing this timeout will not affect normal operation, | 72 | * increasing this timeout will not affect normal operation, |
| 73 | * and we'll timeout after | 73 | * and we'll timeout after |
| 74 | * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 1600usec. | 74 | * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 2400usec. |
| 75 | * This timeout is especially important for | 75 | * This timeout is especially important for |
| 76 | * resume from S3 and CTS. | 76 | * converters, resume from S3, and CTS. |
| 77 | */ | 77 | */ |
| 78 | SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 4 | 78 | SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 6 |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | struct dce_aux { | 81 | struct dce_aux { |
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c index 683829466a44..0ba68d41b9c3 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | |||
| @@ -1150,28 +1150,9 @@ void hubp1_cursor_set_position( | |||
| 1150 | REG_UPDATE(CURSOR_CONTROL, | 1150 | REG_UPDATE(CURSOR_CONTROL, |
| 1151 | CURSOR_ENABLE, cur_en); | 1151 | CURSOR_ENABLE, cur_en); |
| 1152 | 1152 | ||
| 1153 | //account for cases where we see negative offset relative to overlay plane | 1153 | REG_SET_2(CURSOR_POSITION, 0, |
| 1154 | if (src_x_offset < 0 && src_y_offset < 0) { | ||
| 1155 | REG_SET_2(CURSOR_POSITION, 0, | ||
| 1156 | CURSOR_X_POSITION, 0, | ||
| 1157 | CURSOR_Y_POSITION, 0); | ||
| 1158 | x_hotspot -= src_x_offset; | ||
| 1159 | y_hotspot -= src_y_offset; | ||
| 1160 | } else if (src_x_offset < 0) { | ||
| 1161 | REG_SET_2(CURSOR_POSITION, 0, | ||
| 1162 | CURSOR_X_POSITION, 0, | ||
| 1163 | CURSOR_Y_POSITION, pos->y); | ||
| 1164 | x_hotspot -= src_x_offset; | ||
| 1165 | } else if (src_y_offset < 0) { | ||
| 1166 | REG_SET_2(CURSOR_POSITION, 0, | ||
| 1167 | CURSOR_X_POSITION, pos->x, | 1154 | CURSOR_X_POSITION, pos->x, |
| 1168 | CURSOR_Y_POSITION, 0); | 1155 | CURSOR_Y_POSITION, pos->y); |
| 1169 | y_hotspot -= src_y_offset; | ||
| 1170 | } else { | ||
| 1171 | REG_SET_2(CURSOR_POSITION, 0, | ||
| 1172 | CURSOR_X_POSITION, pos->x, | ||
| 1173 | CURSOR_Y_POSITION, pos->y); | ||
| 1174 | } | ||
| 1175 | 1156 | ||
| 1176 | REG_SET_2(CURSOR_HOT_SPOT, 0, | 1157 | REG_SET_2(CURSOR_HOT_SPOT, 0, |
| 1177 | CURSOR_HOT_SPOT_X, x_hotspot, | 1158 | CURSOR_HOT_SPOT_X, x_hotspot, |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c index 9aa7bec1b5fe..23b5b94a4939 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | |||
| @@ -91,6 +91,12 @@ static void vega20_set_default_registry_data(struct pp_hwmgr *hwmgr) | |||
| 91 | * MP0CLK DS | 91 | * MP0CLK DS |
| 92 | */ | 92 | */ |
| 93 | data->registry_data.disallowed_features = 0xE0041C00; | 93 | data->registry_data.disallowed_features = 0xE0041C00; |
| 94 | /* ECC feature should be disabled on old SMUs */ | ||
| 95 | smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetSmuVersion); | ||
| 96 | hwmgr->smu_version = smum_get_argument(hwmgr); | ||
| 97 | if (hwmgr->smu_version < 0x282100) | ||
| 98 | data->registry_data.disallowed_features |= FEATURE_ECC_MASK; | ||
| 99 | |||
| 94 | data->registry_data.od_state_in_dc_support = 0; | 100 | data->registry_data.od_state_in_dc_support = 0; |
| 95 | data->registry_data.thermal_support = 1; | 101 | data->registry_data.thermal_support = 1; |
| 96 | data->registry_data.skip_baco_hardware = 0; | 102 | data->registry_data.skip_baco_hardware = 0; |
| @@ -357,6 +363,7 @@ static void vega20_init_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
| 357 | data->smu_features[GNLD_DS_MP1CLK].smu_feature_id = FEATURE_DS_MP1CLK_BIT; | 363 | data->smu_features[GNLD_DS_MP1CLK].smu_feature_id = FEATURE_DS_MP1CLK_BIT; |
| 358 | data->smu_features[GNLD_DS_MP0CLK].smu_feature_id = FEATURE_DS_MP0CLK_BIT; | 364 | data->smu_features[GNLD_DS_MP0CLK].smu_feature_id = FEATURE_DS_MP0CLK_BIT; |
| 359 | data->smu_features[GNLD_XGMI].smu_feature_id = FEATURE_XGMI_BIT; | 365 | data->smu_features[GNLD_XGMI].smu_feature_id = FEATURE_XGMI_BIT; |
| 366 | data->smu_features[GNLD_ECC].smu_feature_id = FEATURE_ECC_BIT; | ||
| 360 | 367 | ||
| 361 | for (i = 0; i < GNLD_FEATURES_MAX; i++) { | 368 | for (i = 0; i < GNLD_FEATURES_MAX; i++) { |
| 362 | data->smu_features[i].smu_feature_bitmap = | 369 | data->smu_features[i].smu_feature_bitmap = |
| @@ -3020,7 +3027,8 @@ static int vega20_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf) | |||
| 3020 | "FCLK_DS", | 3027 | "FCLK_DS", |
| 3021 | "MP1CLK_DS", | 3028 | "MP1CLK_DS", |
| 3022 | "MP0CLK_DS", | 3029 | "MP0CLK_DS", |
| 3023 | "XGMI"}; | 3030 | "XGMI", |
| 3031 | "ECC"}; | ||
| 3024 | static const char *output_title[] = { | 3032 | static const char *output_title[] = { |
| 3025 | "FEATURES", | 3033 | "FEATURES", |
| 3026 | "BITMASK", | 3034 | "BITMASK", |
| @@ -3462,6 +3470,7 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr) | |||
| 3462 | struct vega20_single_dpm_table *dpm_table; | 3470 | struct vega20_single_dpm_table *dpm_table; |
| 3463 | bool vblank_too_short = false; | 3471 | bool vblank_too_short = false; |
| 3464 | bool disable_mclk_switching; | 3472 | bool disable_mclk_switching; |
| 3473 | bool disable_fclk_switching; | ||
| 3465 | uint32_t i, latency; | 3474 | uint32_t i, latency; |
| 3466 | 3475 | ||
| 3467 | disable_mclk_switching = ((1 < hwmgr->display_config->num_display) && | 3476 | disable_mclk_switching = ((1 < hwmgr->display_config->num_display) && |
| @@ -3537,13 +3546,20 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr) | |||
| 3537 | if (hwmgr->display_config->nb_pstate_switch_disable) | 3546 | if (hwmgr->display_config->nb_pstate_switch_disable) |
| 3538 | dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value; | 3547 | dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value; |
| 3539 | 3548 | ||
| 3549 | if ((disable_mclk_switching && | ||
| 3550 | (dpm_table->dpm_state.hard_min_level == dpm_table->dpm_levels[dpm_table->count - 1].value)) || | ||
| 3551 | hwmgr->display_config->min_mem_set_clock / 100 >= dpm_table->dpm_levels[dpm_table->count - 1].value) | ||
| 3552 | disable_fclk_switching = true; | ||
| 3553 | else | ||
| 3554 | disable_fclk_switching = false; | ||
| 3555 | |||
| 3540 | /* fclk */ | 3556 | /* fclk */ |
| 3541 | dpm_table = &(data->dpm_table.fclk_table); | 3557 | dpm_table = &(data->dpm_table.fclk_table); |
| 3542 | dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value; | 3558 | dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value; |
| 3543 | dpm_table->dpm_state.soft_max_level = VG20_CLOCK_MAX_DEFAULT; | 3559 | dpm_table->dpm_state.soft_max_level = VG20_CLOCK_MAX_DEFAULT; |
| 3544 | dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value; | 3560 | dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value; |
| 3545 | dpm_table->dpm_state.hard_max_level = VG20_CLOCK_MAX_DEFAULT; | 3561 | dpm_table->dpm_state.hard_max_level = VG20_CLOCK_MAX_DEFAULT; |
| 3546 | if (hwmgr->display_config->nb_pstate_switch_disable) | 3562 | if (hwmgr->display_config->nb_pstate_switch_disable || disable_fclk_switching) |
| 3547 | dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value; | 3563 | dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value; |
| 3548 | 3564 | ||
| 3549 | /* vclk */ | 3565 | /* vclk */ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h index a5bc758ae097..ac2a3118a0ae 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h | |||
| @@ -80,6 +80,7 @@ enum { | |||
| 80 | GNLD_DS_MP1CLK, | 80 | GNLD_DS_MP1CLK, |
| 81 | GNLD_DS_MP0CLK, | 81 | GNLD_DS_MP0CLK, |
| 82 | GNLD_XGMI, | 82 | GNLD_XGMI, |
| 83 | GNLD_ECC, | ||
| 83 | 84 | ||
| 84 | GNLD_FEATURES_MAX | 85 | GNLD_FEATURES_MAX |
| 85 | }; | 86 | }; |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if.h b/drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if.h index 63d5cf691549..195c4ae67058 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if.h +++ b/drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if.h | |||
| @@ -99,7 +99,7 @@ | |||
| 99 | #define FEATURE_DS_MP1CLK_BIT 30 | 99 | #define FEATURE_DS_MP1CLK_BIT 30 |
| 100 | #define FEATURE_DS_MP0CLK_BIT 31 | 100 | #define FEATURE_DS_MP0CLK_BIT 31 |
| 101 | #define FEATURE_XGMI_BIT 32 | 101 | #define FEATURE_XGMI_BIT 32 |
| 102 | #define FEATURE_SPARE_33_BIT 33 | 102 | #define FEATURE_ECC_BIT 33 |
| 103 | #define FEATURE_SPARE_34_BIT 34 | 103 | #define FEATURE_SPARE_34_BIT 34 |
| 104 | #define FEATURE_SPARE_35_BIT 35 | 104 | #define FEATURE_SPARE_35_BIT 35 |
| 105 | #define FEATURE_SPARE_36_BIT 36 | 105 | #define FEATURE_SPARE_36_BIT 36 |
| @@ -165,7 +165,8 @@ | |||
| 165 | #define FEATURE_DS_FCLK_MASK (1 << FEATURE_DS_FCLK_BIT ) | 165 | #define FEATURE_DS_FCLK_MASK (1 << FEATURE_DS_FCLK_BIT ) |
| 166 | #define FEATURE_DS_MP1CLK_MASK (1 << FEATURE_DS_MP1CLK_BIT ) | 166 | #define FEATURE_DS_MP1CLK_MASK (1 << FEATURE_DS_MP1CLK_BIT ) |
| 167 | #define FEATURE_DS_MP0CLK_MASK (1 << FEATURE_DS_MP0CLK_BIT ) | 167 | #define FEATURE_DS_MP0CLK_MASK (1 << FEATURE_DS_MP0CLK_BIT ) |
| 168 | #define FEATURE_XGMI_MASK (1 << FEATURE_XGMI_BIT ) | 168 | #define FEATURE_XGMI_MASK (1ULL << FEATURE_XGMI_BIT ) |
| 169 | #define FEATURE_ECC_MASK (1ULL << FEATURE_ECC_BIT ) | ||
| 169 | 170 | ||
| 170 | #define DPM_OVERRIDE_DISABLE_SOCCLK_PID 0x00000001 | 171 | #define DPM_OVERRIDE_DISABLE_SOCCLK_PID 0x00000001 |
| 171 | #define DPM_OVERRIDE_DISABLE_UCLK_PID 0x00000002 | 172 | #define DPM_OVERRIDE_DISABLE_UCLK_PID 0x00000002 |
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index a63e5f0dae56..ab7968c8f6a2 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | |||
| @@ -1037,6 +1037,35 @@ void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data, | |||
| 1037 | } | 1037 | } |
| 1038 | EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write); | 1038 | EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write); |
| 1039 | 1039 | ||
| 1040 | /* Filter out invalid setups to avoid configuring SCDC and scrambling */ | ||
| 1041 | static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi) | ||
| 1042 | { | ||
| 1043 | struct drm_display_info *display = &hdmi->connector.display_info; | ||
| 1044 | |||
| 1045 | /* Completely disable SCDC support for older controllers */ | ||
| 1046 | if (hdmi->version < 0x200a) | ||
| 1047 | return false; | ||
| 1048 | |||
| 1049 | /* Disable if no DDC bus */ | ||
| 1050 | if (!hdmi->ddc) | ||
| 1051 | return false; | ||
| 1052 | |||
| 1053 | /* Disable if SCDC is not supported, or if an HF-VSDB block is absent */ | ||
| 1054 | if (!display->hdmi.scdc.supported || | ||
| 1055 | !display->hdmi.scdc.scrambling.supported) | ||
| 1056 | return false; | ||
| 1057 | |||
| 1058 | /* | ||
| 1059 | * Disable if display only support low TMDS rates and scrambling | ||
| 1060 | * for low rates is not supported either | ||
| 1061 | */ | ||
| 1062 | if (!display->hdmi.scdc.scrambling.low_rates && | ||
| 1063 | display->max_tmds_clock <= 340000) | ||
| 1064 | return false; | ||
| 1065 | |||
| 1066 | return true; | ||
| 1067 | } | ||
| 1068 | |||
| 1040 | /* | 1069 | /* |
| 1041 | * HDMI2.0 Specifies the following procedure for High TMDS Bit Rates: | 1070 | * HDMI2.0 Specifies the following procedure for High TMDS Bit Rates: |
| 1042 | * - The Source shall suspend transmission of the TMDS clock and data | 1071 | * - The Source shall suspend transmission of the TMDS clock and data |
| @@ -1055,7 +1084,7 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi) | |||
| 1055 | unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; | 1084 | unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; |
| 1056 | 1085 | ||
| 1057 | /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */ | 1086 | /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */ |
| 1058 | if (hdmi->connector.display_info.hdmi.scdc.supported) { | 1087 | if (dw_hdmi_support_scdc(hdmi)) { |
| 1059 | if (mtmdsclock > HDMI14_MAX_TMDSCLK) | 1088 | if (mtmdsclock > HDMI14_MAX_TMDSCLK) |
| 1060 | drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1); | 1089 | drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1); |
| 1061 | else | 1090 | else |
| @@ -1579,8 +1608,9 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, | |||
| 1579 | 1608 | ||
| 1580 | /* Set up HDMI_FC_INVIDCONF */ | 1609 | /* Set up HDMI_FC_INVIDCONF */ |
| 1581 | inv_val = (hdmi->hdmi_data.hdcp_enable || | 1610 | inv_val = (hdmi->hdmi_data.hdcp_enable || |
| 1582 | vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || | 1611 | (dw_hdmi_support_scdc(hdmi) && |
| 1583 | hdmi_info->scdc.scrambling.low_rates ? | 1612 | (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || |
| 1613 | hdmi_info->scdc.scrambling.low_rates)) ? | ||
| 1584 | HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE : | 1614 | HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE : |
| 1585 | HDMI_FC_INVIDCONF_HDCP_KEEPOUT_INACTIVE); | 1615 | HDMI_FC_INVIDCONF_HDCP_KEEPOUT_INACTIVE); |
| 1586 | 1616 | ||
| @@ -1646,7 +1676,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, | |||
| 1646 | } | 1676 | } |
| 1647 | 1677 | ||
| 1648 | /* Scrambling Control */ | 1678 | /* Scrambling Control */ |
| 1649 | if (hdmi_info->scdc.supported) { | 1679 | if (dw_hdmi_support_scdc(hdmi)) { |
| 1650 | if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || | 1680 | if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || |
| 1651 | hdmi_info->scdc.scrambling.low_rates) { | 1681 | hdmi_info->scdc.scrambling.low_rates) { |
| 1652 | /* | 1682 | /* |
| @@ -1658,13 +1688,13 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, | |||
| 1658 | * Source Devices compliant shall set the | 1688 | * Source Devices compliant shall set the |
| 1659 | * Source Version = 1. | 1689 | * Source Version = 1. |
| 1660 | */ | 1690 | */ |
| 1661 | drm_scdc_readb(&hdmi->i2c->adap, SCDC_SINK_VERSION, | 1691 | drm_scdc_readb(hdmi->ddc, SCDC_SINK_VERSION, |
| 1662 | &bytes); | 1692 | &bytes); |
| 1663 | drm_scdc_writeb(&hdmi->i2c->adap, SCDC_SOURCE_VERSION, | 1693 | drm_scdc_writeb(hdmi->ddc, SCDC_SOURCE_VERSION, |
| 1664 | min_t(u8, bytes, SCDC_MIN_SOURCE_VERSION)); | 1694 | min_t(u8, bytes, SCDC_MIN_SOURCE_VERSION)); |
| 1665 | 1695 | ||
| 1666 | /* Enabled Scrambling in the Sink */ | 1696 | /* Enabled Scrambling in the Sink */ |
| 1667 | drm_scdc_set_scrambling(&hdmi->i2c->adap, 1); | 1697 | drm_scdc_set_scrambling(hdmi->ddc, 1); |
| 1668 | 1698 | ||
| 1669 | /* | 1699 | /* |
| 1670 | * To activate the scrambler feature, you must ensure | 1700 | * To activate the scrambler feature, you must ensure |
| @@ -1680,7 +1710,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, | |||
| 1680 | hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL); | 1710 | hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL); |
| 1681 | hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, | 1711 | hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, |
| 1682 | HDMI_MC_SWRSTZ); | 1712 | HDMI_MC_SWRSTZ); |
| 1683 | drm_scdc_set_scrambling(&hdmi->i2c->adap, 0); | 1713 | drm_scdc_set_scrambling(hdmi->ddc, 0); |
| 1684 | } | 1714 | } |
| 1685 | } | 1715 | } |
| 1686 | 1716 | ||
| @@ -1774,6 +1804,8 @@ static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) | |||
| 1774 | * iteration for others. | 1804 | * iteration for others. |
| 1775 | * The Amlogic Meson GX SoCs (v2.01a) have been identified as needing | 1805 | * The Amlogic Meson GX SoCs (v2.01a) have been identified as needing |
| 1776 | * the workaround with a single iteration. | 1806 | * the workaround with a single iteration. |
| 1807 | * The Rockchip RK3288 SoC (v2.00a) and RK3328/RK3399 SoCs (v2.11a) have | ||
| 1808 | * been identified as needing the workaround with a single iteration. | ||
| 1777 | */ | 1809 | */ |
| 1778 | 1810 | ||
| 1779 | switch (hdmi->version) { | 1811 | switch (hdmi->version) { |
| @@ -1782,7 +1814,9 @@ static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi) | |||
| 1782 | break; | 1814 | break; |
| 1783 | case 0x131a: | 1815 | case 0x131a: |
| 1784 | case 0x132a: | 1816 | case 0x132a: |
| 1817 | case 0x200a: | ||
| 1785 | case 0x201a: | 1818 | case 0x201a: |
| 1819 | case 0x211a: | ||
| 1786 | case 0x212a: | 1820 | case 0x212a: |
| 1787 | count = 1; | 1821 | count = 1; |
| 1788 | break; | 1822 | break; |
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 40ac19848034..fbb76332cc9f 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
| @@ -1034,7 +1034,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) | |||
| 1034 | funcs->atomic_disable(crtc, old_crtc_state); | 1034 | funcs->atomic_disable(crtc, old_crtc_state); |
| 1035 | else if (funcs->disable) | 1035 | else if (funcs->disable) |
| 1036 | funcs->disable(crtc); | 1036 | funcs->disable(crtc); |
| 1037 | else | 1037 | else if (funcs->dpms) |
| 1038 | funcs->dpms(crtc, DRM_MODE_DPMS_OFF); | 1038 | funcs->dpms(crtc, DRM_MODE_DPMS_OFF); |
| 1039 | 1039 | ||
| 1040 | if (!(dev->irq_enabled && dev->num_crtcs)) | 1040 | if (!(dev->irq_enabled && dev->num_crtcs)) |
| @@ -1277,10 +1277,9 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, | |||
| 1277 | if (new_crtc_state->enable) { | 1277 | if (new_crtc_state->enable) { |
| 1278 | DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n", | 1278 | DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n", |
| 1279 | crtc->base.id, crtc->name); | 1279 | crtc->base.id, crtc->name); |
| 1280 | |||
| 1281 | if (funcs->atomic_enable) | 1280 | if (funcs->atomic_enable) |
| 1282 | funcs->atomic_enable(crtc, old_crtc_state); | 1281 | funcs->atomic_enable(crtc, old_crtc_state); |
| 1283 | else | 1282 | else if (funcs->commit) |
| 1284 | funcs->commit(crtc); | 1283 | funcs->commit(crtc); |
| 1285 | } | 1284 | } |
| 1286 | } | 1285 | } |
diff --git a/drivers/gpu/drm/i915/gvt/display.c b/drivers/gpu/drm/i915/gvt/display.c index 035479e273be..e3f9caa7839f 100644 --- a/drivers/gpu/drm/i915/gvt/display.c +++ b/drivers/gpu/drm/i915/gvt/display.c | |||
| @@ -448,7 +448,7 @@ void intel_gvt_emulate_vblank(struct intel_gvt *gvt) | |||
| 448 | /** | 448 | /** |
| 449 | * intel_vgpu_emulate_hotplug - trigger hotplug event for vGPU | 449 | * intel_vgpu_emulate_hotplug - trigger hotplug event for vGPU |
| 450 | * @vgpu: a vGPU | 450 | * @vgpu: a vGPU |
| 451 | * @conncted: link state | 451 | * @connected: link state |
| 452 | * | 452 | * |
| 453 | * This function is used to trigger hotplug interrupt for vGPU | 453 | * This function is used to trigger hotplug interrupt for vGPU |
| 454 | * | 454 | * |
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c index 3e7e2b80c857..69a9a1b2ea4a 100644 --- a/drivers/gpu/drm/i915/gvt/dmabuf.c +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c | |||
| @@ -209,7 +209,7 @@ static int vgpu_get_plane_info(struct drm_device *dev, | |||
| 209 | struct drm_i915_private *dev_priv = to_i915(dev); | 209 | struct drm_i915_private *dev_priv = to_i915(dev); |
| 210 | struct intel_vgpu_primary_plane_format p; | 210 | struct intel_vgpu_primary_plane_format p; |
| 211 | struct intel_vgpu_cursor_plane_format c; | 211 | struct intel_vgpu_cursor_plane_format c; |
| 212 | int ret; | 212 | int ret, tile_height = 1; |
| 213 | 213 | ||
| 214 | if (plane_id == DRM_PLANE_TYPE_PRIMARY) { | 214 | if (plane_id == DRM_PLANE_TYPE_PRIMARY) { |
| 215 | ret = intel_vgpu_decode_primary_plane(vgpu, &p); | 215 | ret = intel_vgpu_decode_primary_plane(vgpu, &p); |
| @@ -228,19 +228,19 @@ static int vgpu_get_plane_info(struct drm_device *dev, | |||
| 228 | break; | 228 | break; |
| 229 | case PLANE_CTL_TILED_X: | 229 | case PLANE_CTL_TILED_X: |
| 230 | info->drm_format_mod = I915_FORMAT_MOD_X_TILED; | 230 | info->drm_format_mod = I915_FORMAT_MOD_X_TILED; |
| 231 | tile_height = 8; | ||
| 231 | break; | 232 | break; |
| 232 | case PLANE_CTL_TILED_Y: | 233 | case PLANE_CTL_TILED_Y: |
| 233 | info->drm_format_mod = I915_FORMAT_MOD_Y_TILED; | 234 | info->drm_format_mod = I915_FORMAT_MOD_Y_TILED; |
| 235 | tile_height = 32; | ||
| 234 | break; | 236 | break; |
| 235 | case PLANE_CTL_TILED_YF: | 237 | case PLANE_CTL_TILED_YF: |
| 236 | info->drm_format_mod = I915_FORMAT_MOD_Yf_TILED; | 238 | info->drm_format_mod = I915_FORMAT_MOD_Yf_TILED; |
| 239 | tile_height = 32; | ||
| 237 | break; | 240 | break; |
| 238 | default: | 241 | default: |
| 239 | gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled); | 242 | gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled); |
| 240 | } | 243 | } |
| 241 | |||
| 242 | info->size = (((p.stride * p.height * p.bpp) / 8) + | ||
| 243 | (PAGE_SIZE - 1)) >> PAGE_SHIFT; | ||
| 244 | } else if (plane_id == DRM_PLANE_TYPE_CURSOR) { | 244 | } else if (plane_id == DRM_PLANE_TYPE_CURSOR) { |
| 245 | ret = intel_vgpu_decode_cursor_plane(vgpu, &c); | 245 | ret = intel_vgpu_decode_cursor_plane(vgpu, &c); |
| 246 | if (ret) | 246 | if (ret) |
| @@ -262,14 +262,13 @@ static int vgpu_get_plane_info(struct drm_device *dev, | |||
| 262 | info->x_hot = UINT_MAX; | 262 | info->x_hot = UINT_MAX; |
| 263 | info->y_hot = UINT_MAX; | 263 | info->y_hot = UINT_MAX; |
| 264 | } | 264 | } |
| 265 | |||
| 266 | info->size = (((info->stride * c.height * c.bpp) / 8) | ||
| 267 | + (PAGE_SIZE - 1)) >> PAGE_SHIFT; | ||
| 268 | } else { | 265 | } else { |
| 269 | gvt_vgpu_err("invalid plane id:%d\n", plane_id); | 266 | gvt_vgpu_err("invalid plane id:%d\n", plane_id); |
| 270 | return -EINVAL; | 267 | return -EINVAL; |
| 271 | } | 268 | } |
| 272 | 269 | ||
| 270 | info->size = (info->stride * roundup(info->height, tile_height) | ||
| 271 | + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
| 273 | if (info->size == 0) { | 272 | if (info->size == 0) { |
| 274 | gvt_vgpu_err("fb size is zero\n"); | 273 | gvt_vgpu_err("fb size is zero\n"); |
| 275 | return -EINVAL; | 274 | return -EINVAL; |
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c index d7052ab7908c..9814773882ec 100644 --- a/drivers/gpu/drm/i915/gvt/gtt.c +++ b/drivers/gpu/drm/i915/gvt/gtt.c | |||
| @@ -750,14 +750,20 @@ static void ppgtt_free_spt(struct intel_vgpu_ppgtt_spt *spt) | |||
| 750 | 750 | ||
| 751 | static void ppgtt_free_all_spt(struct intel_vgpu *vgpu) | 751 | static void ppgtt_free_all_spt(struct intel_vgpu *vgpu) |
| 752 | { | 752 | { |
| 753 | struct intel_vgpu_ppgtt_spt *spt; | 753 | struct intel_vgpu_ppgtt_spt *spt, *spn; |
| 754 | struct radix_tree_iter iter; | 754 | struct radix_tree_iter iter; |
| 755 | void **slot; | 755 | LIST_HEAD(all_spt); |
| 756 | void __rcu **slot; | ||
| 756 | 757 | ||
| 758 | rcu_read_lock(); | ||
| 757 | radix_tree_for_each_slot(slot, &vgpu->gtt.spt_tree, &iter, 0) { | 759 | radix_tree_for_each_slot(slot, &vgpu->gtt.spt_tree, &iter, 0) { |
| 758 | spt = radix_tree_deref_slot(slot); | 760 | spt = radix_tree_deref_slot(slot); |
| 759 | ppgtt_free_spt(spt); | 761 | list_move(&spt->post_shadow_list, &all_spt); |
| 760 | } | 762 | } |
| 763 | rcu_read_unlock(); | ||
| 764 | |||
| 765 | list_for_each_entry_safe(spt, spn, &all_spt, post_shadow_list) | ||
| 766 | ppgtt_free_spt(spt); | ||
| 761 | } | 767 | } |
| 762 | 768 | ||
| 763 | static int ppgtt_handle_guest_write_page_table_bytes( | 769 | static int ppgtt_handle_guest_write_page_table_bytes( |
| @@ -1946,7 +1952,7 @@ void _intel_vgpu_mm_release(struct kref *mm_ref) | |||
| 1946 | */ | 1952 | */ |
| 1947 | void intel_vgpu_unpin_mm(struct intel_vgpu_mm *mm) | 1953 | void intel_vgpu_unpin_mm(struct intel_vgpu_mm *mm) |
| 1948 | { | 1954 | { |
| 1949 | atomic_dec(&mm->pincount); | 1955 | atomic_dec_if_positive(&mm->pincount); |
| 1950 | } | 1956 | } |
| 1951 | 1957 | ||
| 1952 | /** | 1958 | /** |
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index d5fcc447d22f..a68addf95c23 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c | |||
| @@ -905,7 +905,7 @@ static inline bool intel_vgpu_in_aperture(struct intel_vgpu *vgpu, u64 off) | |||
| 905 | static int intel_vgpu_aperture_rw(struct intel_vgpu *vgpu, u64 off, | 905 | static int intel_vgpu_aperture_rw(struct intel_vgpu *vgpu, u64 off, |
| 906 | void *buf, unsigned long count, bool is_write) | 906 | void *buf, unsigned long count, bool is_write) |
| 907 | { | 907 | { |
| 908 | void *aperture_va; | 908 | void __iomem *aperture_va; |
| 909 | 909 | ||
| 910 | if (!intel_vgpu_in_aperture(vgpu, off) || | 910 | if (!intel_vgpu_in_aperture(vgpu, off) || |
| 911 | !intel_vgpu_in_aperture(vgpu, off + count)) { | 911 | !intel_vgpu_in_aperture(vgpu, off + count)) { |
| @@ -920,9 +920,9 @@ static int intel_vgpu_aperture_rw(struct intel_vgpu *vgpu, u64 off, | |||
| 920 | return -EIO; | 920 | return -EIO; |
| 921 | 921 | ||
| 922 | if (is_write) | 922 | if (is_write) |
| 923 | memcpy(aperture_va + offset_in_page(off), buf, count); | 923 | memcpy_toio(aperture_va + offset_in_page(off), buf, count); |
| 924 | else | 924 | else |
| 925 | memcpy(buf, aperture_va + offset_in_page(off), count); | 925 | memcpy_fromio(buf, aperture_va + offset_in_page(off), count); |
| 926 | 926 | ||
| 927 | io_mapping_unmap(aperture_va); | 927 | io_mapping_unmap(aperture_va); |
| 928 | 928 | ||
diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c index 159192c097cc..05b953793316 100644 --- a/drivers/gpu/drm/i915/gvt/scheduler.c +++ b/drivers/gpu/drm/i915/gvt/scheduler.c | |||
| @@ -1486,8 +1486,9 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu, int ring_id, | |||
| 1486 | intel_runtime_pm_put_unchecked(dev_priv); | 1486 | intel_runtime_pm_put_unchecked(dev_priv); |
| 1487 | } | 1487 | } |
| 1488 | 1488 | ||
| 1489 | if (ret && (vgpu_is_vm_unhealthy(ret))) { | 1489 | if (ret) { |
| 1490 | enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR); | 1490 | if (vgpu_is_vm_unhealthy(ret)) |
| 1491 | enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR); | ||
| 1491 | intel_vgpu_destroy_workload(workload); | 1492 | intel_vgpu_destroy_workload(workload); |
| 1492 | return ERR_PTR(ret); | 1493 | return ERR_PTR(ret); |
| 1493 | } | 1494 | } |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 0bd890c04fe4..f6f6e5b78e97 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -4830,7 +4830,10 @@ static int i915_dsc_fec_support_show(struct seq_file *m, void *data) | |||
| 4830 | ret = drm_modeset_lock(&dev->mode_config.connection_mutex, | 4830 | ret = drm_modeset_lock(&dev->mode_config.connection_mutex, |
| 4831 | &ctx); | 4831 | &ctx); |
| 4832 | if (ret) { | 4832 | if (ret) { |
| 4833 | ret = -EINTR; | 4833 | if (ret == -EDEADLK && !drm_modeset_backoff(&ctx)) { |
| 4834 | try_again = true; | ||
| 4835 | continue; | ||
| 4836 | } | ||
| 4834 | break; | 4837 | break; |
| 4835 | } | 4838 | } |
| 4836 | crtc = connector->state->crtc; | 4839 | crtc = connector->state->crtc; |
diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c index 73a7bee24a66..641e0778fa9c 100644 --- a/drivers/gpu/drm/i915/icl_dsi.c +++ b/drivers/gpu/drm/i915/icl_dsi.c | |||
| @@ -323,6 +323,21 @@ static void gen11_dsi_program_esc_clk_div(struct intel_encoder *encoder) | |||
| 323 | } | 323 | } |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | static void get_dsi_io_power_domains(struct drm_i915_private *dev_priv, | ||
| 327 | struct intel_dsi *intel_dsi) | ||
| 328 | { | ||
| 329 | enum port port; | ||
| 330 | |||
| 331 | for_each_dsi_port(port, intel_dsi->ports) { | ||
| 332 | WARN_ON(intel_dsi->io_wakeref[port]); | ||
| 333 | intel_dsi->io_wakeref[port] = | ||
| 334 | intel_display_power_get(dev_priv, | ||
| 335 | port == PORT_A ? | ||
| 336 | POWER_DOMAIN_PORT_DDI_A_IO : | ||
| 337 | POWER_DOMAIN_PORT_DDI_B_IO); | ||
| 338 | } | ||
| 339 | } | ||
| 340 | |||
| 326 | static void gen11_dsi_enable_io_power(struct intel_encoder *encoder) | 341 | static void gen11_dsi_enable_io_power(struct intel_encoder *encoder) |
| 327 | { | 342 | { |
| 328 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); | 343 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| @@ -336,13 +351,7 @@ static void gen11_dsi_enable_io_power(struct intel_encoder *encoder) | |||
| 336 | I915_WRITE(ICL_DSI_IO_MODECTL(port), tmp); | 351 | I915_WRITE(ICL_DSI_IO_MODECTL(port), tmp); |
| 337 | } | 352 | } |
| 338 | 353 | ||
| 339 | for_each_dsi_port(port, intel_dsi->ports) { | 354 | get_dsi_io_power_domains(dev_priv, intel_dsi); |
| 340 | intel_dsi->io_wakeref[port] = | ||
| 341 | intel_display_power_get(dev_priv, | ||
| 342 | port == PORT_A ? | ||
| 343 | POWER_DOMAIN_PORT_DDI_A_IO : | ||
| 344 | POWER_DOMAIN_PORT_DDI_B_IO); | ||
| 345 | } | ||
| 346 | } | 355 | } |
| 347 | 356 | ||
| 348 | static void gen11_dsi_power_up_lanes(struct intel_encoder *encoder) | 357 | static void gen11_dsi_power_up_lanes(struct intel_encoder *encoder) |
| @@ -589,6 +598,12 @@ static void gen11_dsi_map_pll(struct intel_encoder *encoder, | |||
| 589 | val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port); | 598 | val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port); |
| 590 | } | 599 | } |
| 591 | I915_WRITE(DPCLKA_CFGCR0_ICL, val); | 600 | I915_WRITE(DPCLKA_CFGCR0_ICL, val); |
| 601 | |||
| 602 | for_each_dsi_port(port, intel_dsi->ports) { | ||
| 603 | val &= ~DPCLKA_CFGCR0_DDI_CLK_OFF(port); | ||
| 604 | } | ||
| 605 | I915_WRITE(DPCLKA_CFGCR0_ICL, val); | ||
| 606 | |||
| 592 | POSTING_READ(DPCLKA_CFGCR0_ICL); | 607 | POSTING_READ(DPCLKA_CFGCR0_ICL); |
| 593 | 608 | ||
| 594 | mutex_unlock(&dev_priv->dpll_lock); | 609 | mutex_unlock(&dev_priv->dpll_lock); |
| @@ -1117,7 +1132,7 @@ static void gen11_dsi_disable_port(struct intel_encoder *encoder) | |||
| 1117 | DRM_ERROR("DDI port:%c buffer not idle\n", | 1132 | DRM_ERROR("DDI port:%c buffer not idle\n", |
| 1118 | port_name(port)); | 1133 | port_name(port)); |
| 1119 | } | 1134 | } |
| 1120 | gen11_dsi_ungate_clocks(encoder); | 1135 | gen11_dsi_gate_clocks(encoder); |
| 1121 | } | 1136 | } |
| 1122 | 1137 | ||
| 1123 | static void gen11_dsi_disable_io_power(struct intel_encoder *encoder) | 1138 | static void gen11_dsi_disable_io_power(struct intel_encoder *encoder) |
| @@ -1218,20 +1233,11 @@ static int gen11_dsi_compute_config(struct intel_encoder *encoder, | |||
| 1218 | return 0; | 1233 | return 0; |
| 1219 | } | 1234 | } |
| 1220 | 1235 | ||
| 1221 | static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder, | 1236 | static void gen11_dsi_get_power_domains(struct intel_encoder *encoder, |
| 1222 | struct intel_crtc_state *crtc_state) | 1237 | struct intel_crtc_state *crtc_state) |
| 1223 | { | 1238 | { |
| 1224 | struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); | 1239 | get_dsi_io_power_domains(to_i915(encoder->base.dev), |
| 1225 | u64 domains = 0; | 1240 | enc_to_intel_dsi(&encoder->base)); |
| 1226 | enum port port; | ||
| 1227 | |||
| 1228 | for_each_dsi_port(port, intel_dsi->ports) | ||
| 1229 | if (port == PORT_A) | ||
| 1230 | domains |= BIT_ULL(POWER_DOMAIN_PORT_DDI_A_IO); | ||
| 1231 | else | ||
| 1232 | domains |= BIT_ULL(POWER_DOMAIN_PORT_DDI_B_IO); | ||
| 1233 | |||
| 1234 | return domains; | ||
| 1235 | } | 1241 | } |
| 1236 | 1242 | ||
| 1237 | static bool gen11_dsi_get_hw_state(struct intel_encoder *encoder, | 1243 | static bool gen11_dsi_get_hw_state(struct intel_encoder *encoder, |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 14d580cdefd3..98cea1f4b3bf 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
| @@ -2075,12 +2075,11 @@ intel_ddi_main_link_aux_domain(struct intel_digital_port *dig_port) | |||
| 2075 | intel_aux_power_domain(dig_port); | 2075 | intel_aux_power_domain(dig_port); |
| 2076 | } | 2076 | } |
| 2077 | 2077 | ||
| 2078 | static u64 intel_ddi_get_power_domains(struct intel_encoder *encoder, | 2078 | static void intel_ddi_get_power_domains(struct intel_encoder *encoder, |
| 2079 | struct intel_crtc_state *crtc_state) | 2079 | struct intel_crtc_state *crtc_state) |
| 2080 | { | 2080 | { |
| 2081 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); | 2081 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 2082 | struct intel_digital_port *dig_port; | 2082 | struct intel_digital_port *dig_port; |
| 2083 | u64 domains; | ||
| 2084 | 2083 | ||
| 2085 | /* | 2084 | /* |
| 2086 | * TODO: Add support for MST encoders. Atm, the following should never | 2085 | * TODO: Add support for MST encoders. Atm, the following should never |
| @@ -2088,10 +2087,10 @@ static u64 intel_ddi_get_power_domains(struct intel_encoder *encoder, | |||
| 2088 | * hook. | 2087 | * hook. |
| 2089 | */ | 2088 | */ |
| 2090 | if (WARN_ON(intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST))) | 2089 | if (WARN_ON(intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST))) |
| 2091 | return 0; | 2090 | return; |
| 2092 | 2091 | ||
| 2093 | dig_port = enc_to_dig_port(&encoder->base); | 2092 | dig_port = enc_to_dig_port(&encoder->base); |
| 2094 | domains = BIT_ULL(dig_port->ddi_io_power_domain); | 2093 | intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain); |
| 2095 | 2094 | ||
| 2096 | /* | 2095 | /* |
| 2097 | * AUX power is only needed for (e)DP mode, and for HDMI mode on TC | 2096 | * AUX power is only needed for (e)DP mode, and for HDMI mode on TC |
| @@ -2099,15 +2098,15 @@ static u64 intel_ddi_get_power_domains(struct intel_encoder *encoder, | |||
| 2099 | */ | 2098 | */ |
| 2100 | if (intel_crtc_has_dp_encoder(crtc_state) || | 2099 | if (intel_crtc_has_dp_encoder(crtc_state) || |
| 2101 | intel_port_is_tc(dev_priv, encoder->port)) | 2100 | intel_port_is_tc(dev_priv, encoder->port)) |
| 2102 | domains |= BIT_ULL(intel_ddi_main_link_aux_domain(dig_port)); | 2101 | intel_display_power_get(dev_priv, |
| 2102 | intel_ddi_main_link_aux_domain(dig_port)); | ||
| 2103 | 2103 | ||
| 2104 | /* | 2104 | /* |
| 2105 | * VDSC power is needed when DSC is enabled | 2105 | * VDSC power is needed when DSC is enabled |
| 2106 | */ | 2106 | */ |
| 2107 | if (crtc_state->dsc_params.compression_enable) | 2107 | if (crtc_state->dsc_params.compression_enable) |
| 2108 | domains |= BIT_ULL(intel_dsc_power_domain(crtc_state)); | 2108 | intel_display_power_get(dev_priv, |
| 2109 | 2109 | intel_dsc_power_domain(crtc_state)); | |
| 2110 | return domains; | ||
| 2111 | } | 2110 | } |
| 2112 | 2111 | ||
| 2113 | void intel_ddi_enable_pipe_clock(const struct intel_crtc_state *crtc_state) | 2112 | void intel_ddi_enable_pipe_clock(const struct intel_crtc_state *crtc_state) |
| @@ -2825,10 +2824,10 @@ void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder) | |||
| 2825 | return; | 2824 | return; |
| 2826 | } | 2825 | } |
| 2827 | /* | 2826 | /* |
| 2828 | * DSI ports should have their DDI clock ungated when disabled | 2827 | * For DSI we keep the ddi clocks gated |
| 2829 | * and gated when enabled. | 2828 | * except during enable/disable sequence. |
| 2830 | */ | 2829 | */ |
| 2831 | ddi_clk_needed = !encoder->base.crtc; | 2830 | ddi_clk_needed = false; |
| 2832 | } | 2831 | } |
| 2833 | 2832 | ||
| 2834 | val = I915_READ(DPCLKA_CFGCR0_ICL); | 2833 | val = I915_READ(DPCLKA_CFGCR0_ICL); |
| @@ -3863,14 +3862,16 @@ static int intel_ddi_compute_config(struct intel_encoder *encoder, | |||
| 3863 | ret = intel_hdmi_compute_config(encoder, pipe_config, conn_state); | 3862 | ret = intel_hdmi_compute_config(encoder, pipe_config, conn_state); |
| 3864 | else | 3863 | else |
| 3865 | ret = intel_dp_compute_config(encoder, pipe_config, conn_state); | 3864 | ret = intel_dp_compute_config(encoder, pipe_config, conn_state); |
| 3865 | if (ret) | ||
| 3866 | return ret; | ||
| 3866 | 3867 | ||
| 3867 | if (IS_GEN9_LP(dev_priv) && ret) | 3868 | if (IS_GEN9_LP(dev_priv)) |
| 3868 | pipe_config->lane_lat_optim_mask = | 3869 | pipe_config->lane_lat_optim_mask = |
| 3869 | bxt_ddi_phy_calc_lane_lat_optim_mask(pipe_config->lane_count); | 3870 | bxt_ddi_phy_calc_lane_lat_optim_mask(pipe_config->lane_count); |
| 3870 | 3871 | ||
| 3871 | intel_ddi_compute_min_voltage_level(dev_priv, pipe_config); | 3872 | intel_ddi_compute_min_voltage_level(dev_priv, pipe_config); |
| 3872 | 3873 | ||
| 3873 | return ret; | 3874 | return 0; |
| 3874 | 3875 | ||
| 3875 | } | 3876 | } |
| 3876 | 3877 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index ccb616351bba..421aac80a838 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -15986,8 +15986,6 @@ get_encoder_power_domains(struct drm_i915_private *dev_priv) | |||
| 15986 | struct intel_encoder *encoder; | 15986 | struct intel_encoder *encoder; |
| 15987 | 15987 | ||
| 15988 | for_each_intel_encoder(&dev_priv->drm, encoder) { | 15988 | for_each_intel_encoder(&dev_priv->drm, encoder) { |
| 15989 | u64 get_domains; | ||
| 15990 | enum intel_display_power_domain domain; | ||
| 15991 | struct intel_crtc_state *crtc_state; | 15989 | struct intel_crtc_state *crtc_state; |
| 15992 | 15990 | ||
| 15993 | if (!encoder->get_power_domains) | 15991 | if (!encoder->get_power_domains) |
| @@ -16001,9 +15999,7 @@ get_encoder_power_domains(struct drm_i915_private *dev_priv) | |||
| 16001 | continue; | 15999 | continue; |
| 16002 | 16000 | ||
| 16003 | crtc_state = to_intel_crtc_state(encoder->base.crtc->state); | 16001 | crtc_state = to_intel_crtc_state(encoder->base.crtc->state); |
| 16004 | get_domains = encoder->get_power_domains(encoder, crtc_state); | 16002 | encoder->get_power_domains(encoder, crtc_state); |
| 16005 | for_each_power_domain(domain, get_domains) | ||
| 16006 | intel_display_power_get(dev_priv, domain); | ||
| 16007 | } | 16003 | } |
| 16008 | } | 16004 | } |
| 16009 | 16005 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index cf709835fb9a..48da4a969a0a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -1859,42 +1859,6 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp, | |||
| 1859 | return -EINVAL; | 1859 | return -EINVAL; |
| 1860 | } | 1860 | } |
| 1861 | 1861 | ||
| 1862 | /* Optimize link config in order: max bpp, min lanes, min clock */ | ||
| 1863 | static int | ||
| 1864 | intel_dp_compute_link_config_fast(struct intel_dp *intel_dp, | ||
| 1865 | struct intel_crtc_state *pipe_config, | ||
| 1866 | const struct link_config_limits *limits) | ||
| 1867 | { | ||
| 1868 | struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; | ||
| 1869 | int bpp, clock, lane_count; | ||
| 1870 | int mode_rate, link_clock, link_avail; | ||
| 1871 | |||
| 1872 | for (bpp = limits->max_bpp; bpp >= limits->min_bpp; bpp -= 2 * 3) { | ||
| 1873 | mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, | ||
| 1874 | bpp); | ||
| 1875 | |||
| 1876 | for (lane_count = limits->min_lane_count; | ||
| 1877 | lane_count <= limits->max_lane_count; | ||
| 1878 | lane_count <<= 1) { | ||
| 1879 | for (clock = limits->min_clock; clock <= limits->max_clock; clock++) { | ||
| 1880 | link_clock = intel_dp->common_rates[clock]; | ||
| 1881 | link_avail = intel_dp_max_data_rate(link_clock, | ||
| 1882 | lane_count); | ||
| 1883 | |||
| 1884 | if (mode_rate <= link_avail) { | ||
| 1885 | pipe_config->lane_count = lane_count; | ||
| 1886 | pipe_config->pipe_bpp = bpp; | ||
| 1887 | pipe_config->port_clock = link_clock; | ||
| 1888 | |||
| 1889 | return 0; | ||
| 1890 | } | ||
| 1891 | } | ||
| 1892 | } | ||
| 1893 | } | ||
| 1894 | |||
| 1895 | return -EINVAL; | ||
| 1896 | } | ||
| 1897 | |||
| 1898 | static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc) | 1862 | static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc) |
| 1899 | { | 1863 | { |
| 1900 | int i, num_bpc; | 1864 | int i, num_bpc; |
| @@ -1922,6 +1886,9 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp, | |||
| 1922 | int pipe_bpp; | 1886 | int pipe_bpp; |
| 1923 | int ret; | 1887 | int ret; |
| 1924 | 1888 | ||
| 1889 | pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) && | ||
| 1890 | intel_dp_supports_fec(intel_dp, pipe_config); | ||
| 1891 | |||
| 1925 | if (!intel_dp_supports_dsc(intel_dp, pipe_config)) | 1892 | if (!intel_dp_supports_dsc(intel_dp, pipe_config)) |
| 1926 | return -EINVAL; | 1893 | return -EINVAL; |
| 1927 | 1894 | ||
| @@ -2031,15 +1998,13 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, | |||
| 2031 | limits.min_bpp = 6 * 3; | 1998 | limits.min_bpp = 6 * 3; |
| 2032 | limits.max_bpp = intel_dp_compute_bpp(intel_dp, pipe_config); | 1999 | limits.max_bpp = intel_dp_compute_bpp(intel_dp, pipe_config); |
| 2033 | 2000 | ||
| 2034 | if (intel_dp_is_edp(intel_dp) && intel_dp->edp_dpcd[0] < DP_EDP_14) { | 2001 | if (intel_dp_is_edp(intel_dp)) { |
| 2035 | /* | 2002 | /* |
| 2036 | * Use the maximum clock and number of lanes the eDP panel | 2003 | * Use the maximum clock and number of lanes the eDP panel |
| 2037 | * advertizes being capable of. The eDP 1.3 and earlier panels | 2004 | * advertizes being capable of. The panels are generally |
| 2038 | * are generally designed to support only a single clock and | 2005 | * designed to support only a single clock and lane |
| 2039 | * lane configuration, and typically these values correspond to | 2006 | * configuration, and typically these values correspond to the |
| 2040 | * the native resolution of the panel. With eDP 1.4 rate select | 2007 | * native resolution of the panel. |
| 2041 | * and DSC, this is decreasingly the case, and we need to be | ||
| 2042 | * able to select less than maximum link config. | ||
| 2043 | */ | 2008 | */ |
| 2044 | limits.min_lane_count = limits.max_lane_count; | 2009 | limits.min_lane_count = limits.max_lane_count; |
| 2045 | limits.min_clock = limits.max_clock; | 2010 | limits.min_clock = limits.max_clock; |
| @@ -2053,22 +2018,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, | |||
| 2053 | intel_dp->common_rates[limits.max_clock], | 2018 | intel_dp->common_rates[limits.max_clock], |
| 2054 | limits.max_bpp, adjusted_mode->crtc_clock); | 2019 | limits.max_bpp, adjusted_mode->crtc_clock); |
| 2055 | 2020 | ||
| 2056 | if (intel_dp_is_edp(intel_dp)) | 2021 | /* |
| 2057 | /* | 2022 | * Optimize for slow and wide. This is the place to add alternative |
| 2058 | * Optimize for fast and narrow. eDP 1.3 section 3.3 and eDP 1.4 | 2023 | * optimization policy. |
| 2059 | * section A.1: "It is recommended that the minimum number of | 2024 | */ |
| 2060 | * lanes be used, using the minimum link rate allowed for that | 2025 | ret = intel_dp_compute_link_config_wide(intel_dp, pipe_config, &limits); |
| 2061 | * lane configuration." | ||
| 2062 | * | ||
| 2063 | * Note that we use the max clock and lane count for eDP 1.3 and | ||
| 2064 | * earlier, and fast vs. wide is irrelevant. | ||
| 2065 | */ | ||
| 2066 | ret = intel_dp_compute_link_config_fast(intel_dp, pipe_config, | ||
| 2067 | &limits); | ||
| 2068 | else | ||
| 2069 | /* Optimize for slow and wide. */ | ||
| 2070 | ret = intel_dp_compute_link_config_wide(intel_dp, pipe_config, | ||
| 2071 | &limits); | ||
| 2072 | 2026 | ||
| 2073 | /* enable compression if the mode doesn't fit available BW */ | 2027 | /* enable compression if the mode doesn't fit available BW */ |
| 2074 | DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en); | 2028 | DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en); |
| @@ -2165,9 +2119,6 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
| 2165 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) | 2119 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) |
| 2166 | return -EINVAL; | 2120 | return -EINVAL; |
| 2167 | 2121 | ||
| 2168 | pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) && | ||
| 2169 | intel_dp_supports_fec(intel_dp, pipe_config); | ||
| 2170 | |||
| 2171 | ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state); | 2122 | ret = intel_dp_compute_link_config(encoder, pipe_config, conn_state); |
| 2172 | if (ret < 0) | 2123 | if (ret < 0) |
| 2173 | return ret; | 2124 | return ret; |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 15db41394b9e..d5660ac1b0d6 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
| @@ -270,10 +270,12 @@ struct intel_encoder { | |||
| 270 | * be set correctly before calling this function. */ | 270 | * be set correctly before calling this function. */ |
| 271 | void (*get_config)(struct intel_encoder *, | 271 | void (*get_config)(struct intel_encoder *, |
| 272 | struct intel_crtc_state *pipe_config); | 272 | struct intel_crtc_state *pipe_config); |
| 273 | /* Returns a mask of power domains that need to be referenced as part | 273 | /* |
| 274 | * of the hardware state readout code. */ | 274 | * Acquires the power domains needed for an active encoder during |
| 275 | u64 (*get_power_domains)(struct intel_encoder *encoder, | 275 | * hardware state readout. |
| 276 | struct intel_crtc_state *crtc_state); | 276 | */ |
| 277 | void (*get_power_domains)(struct intel_encoder *encoder, | ||
| 278 | struct intel_crtc_state *crtc_state); | ||
| 277 | /* | 279 | /* |
| 278 | * Called during system suspend after all pending requests for the | 280 | * Called during system suspend after all pending requests for the |
| 279 | * encoder are flushed (for example for DP AUX transactions) and | 281 | * encoder are flushed (for example for DP AUX transactions) and |
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index e8f694b57b8a..376ffe842e26 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
| @@ -338,8 +338,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, | |||
| 338 | bool *enabled, int width, int height) | 338 | bool *enabled, int width, int height) |
| 339 | { | 339 | { |
| 340 | struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); | 340 | struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); |
| 341 | unsigned long conn_configured, conn_seq, mask; | ||
| 341 | unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); | 342 | unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); |
| 342 | unsigned long conn_configured, conn_seq; | ||
| 343 | int i, j; | 343 | int i, j; |
| 344 | bool *save_enabled; | 344 | bool *save_enabled; |
| 345 | bool fallback = true, ret = true; | 345 | bool fallback = true, ret = true; |
| @@ -357,9 +357,10 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, | |||
| 357 | drm_modeset_backoff(&ctx); | 357 | drm_modeset_backoff(&ctx); |
| 358 | 358 | ||
| 359 | memcpy(save_enabled, enabled, count); | 359 | memcpy(save_enabled, enabled, count); |
| 360 | conn_seq = GENMASK(count - 1, 0); | 360 | mask = GENMASK(count - 1, 0); |
| 361 | conn_configured = 0; | 361 | conn_configured = 0; |
| 362 | retry: | 362 | retry: |
| 363 | conn_seq = conn_configured; | ||
| 363 | for (i = 0; i < count; i++) { | 364 | for (i = 0; i < count; i++) { |
| 364 | struct drm_fb_helper_connector *fb_conn; | 365 | struct drm_fb_helper_connector *fb_conn; |
| 365 | struct drm_connector *connector; | 366 | struct drm_connector *connector; |
| @@ -372,8 +373,7 @@ retry: | |||
| 372 | if (conn_configured & BIT(i)) | 373 | if (conn_configured & BIT(i)) |
| 373 | continue; | 374 | continue; |
| 374 | 375 | ||
| 375 | /* First pass, only consider tiled connectors */ | 376 | if (conn_seq == 0 && !connector->has_tile) |
| 376 | if (conn_seq == GENMASK(count - 1, 0) && !connector->has_tile) | ||
| 377 | continue; | 377 | continue; |
| 378 | 378 | ||
| 379 | if (connector->status == connector_status_connected) | 379 | if (connector->status == connector_status_connected) |
| @@ -477,10 +477,8 @@ retry: | |||
| 477 | conn_configured |= BIT(i); | 477 | conn_configured |= BIT(i); |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | if (conn_configured != conn_seq) { /* repeat until no more are found */ | 480 | if ((conn_configured & mask) != mask && conn_configured != conn_seq) |
| 481 | conn_seq = conn_configured; | ||
| 482 | goto retry; | 481 | goto retry; |
| 483 | } | ||
| 484 | 482 | ||
| 485 | /* | 483 | /* |
| 486 | * If the BIOS didn't enable everything it could, fall back to have the | 484 | * If the BIOS didn't enable everything it could, fall back to have the |
diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c index 6403728fe778..31c93c3ccd00 100644 --- a/drivers/gpu/drm/i915/vlv_dsi.c +++ b/drivers/gpu/drm/i915/vlv_dsi.c | |||
| @@ -256,6 +256,28 @@ static void band_gap_reset(struct drm_i915_private *dev_priv) | |||
| 256 | mutex_unlock(&dev_priv->sb_lock); | 256 | mutex_unlock(&dev_priv->sb_lock); |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | static int bdw_get_pipemisc_bpp(struct intel_crtc *crtc) | ||
| 260 | { | ||
| 261 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | ||
| 262 | u32 tmp; | ||
| 263 | |||
| 264 | tmp = I915_READ(PIPEMISC(crtc->pipe)); | ||
| 265 | |||
| 266 | switch (tmp & PIPEMISC_DITHER_BPC_MASK) { | ||
| 267 | case PIPEMISC_DITHER_6_BPC: | ||
| 268 | return 18; | ||
| 269 | case PIPEMISC_DITHER_8_BPC: | ||
| 270 | return 24; | ||
| 271 | case PIPEMISC_DITHER_10_BPC: | ||
| 272 | return 30; | ||
| 273 | case PIPEMISC_DITHER_12_BPC: | ||
| 274 | return 36; | ||
| 275 | default: | ||
| 276 | MISSING_CASE(tmp); | ||
| 277 | return 0; | ||
| 278 | } | ||
| 279 | } | ||
| 280 | |||
| 259 | static int intel_dsi_compute_config(struct intel_encoder *encoder, | 281 | static int intel_dsi_compute_config(struct intel_encoder *encoder, |
| 260 | struct intel_crtc_state *pipe_config, | 282 | struct intel_crtc_state *pipe_config, |
| 261 | struct drm_connector_state *conn_state) | 283 | struct drm_connector_state *conn_state) |
| @@ -1071,6 +1093,8 @@ static void bxt_dsi_get_pipe_config(struct intel_encoder *encoder, | |||
| 1071 | bpp = mipi_dsi_pixel_format_to_bpp( | 1093 | bpp = mipi_dsi_pixel_format_to_bpp( |
| 1072 | pixel_format_from_register_bits(fmt)); | 1094 | pixel_format_from_register_bits(fmt)); |
| 1073 | 1095 | ||
| 1096 | pipe_config->pipe_bpp = bdw_get_pipemisc_bpp(crtc); | ||
| 1097 | |||
| 1074 | /* Enable Frame time stamo based scanline reporting */ | 1098 | /* Enable Frame time stamo based scanline reporting */ |
| 1075 | adjusted_mode->private_flags |= | 1099 | adjusted_mode->private_flags |= |
| 1076 | I915_MODE_FLAG_GET_SCANLINE_FROM_TIMESTAMP; | 1100 | I915_MODE_FLAG_GET_SCANLINE_FROM_TIMESTAMP; |
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index ec3602ebbc1c..54011df8c2e8 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c | |||
| @@ -71,7 +71,7 @@ static void ipu_crtc_disable_planes(struct ipu_crtc *ipu_crtc, | |||
| 71 | if (disable_partial) | 71 | if (disable_partial) |
| 72 | ipu_plane_disable(ipu_crtc->plane[1], true); | 72 | ipu_plane_disable(ipu_crtc->plane[1], true); |
| 73 | if (disable_full) | 73 | if (disable_full) |
| 74 | ipu_plane_disable(ipu_crtc->plane[0], false); | 74 | ipu_plane_disable(ipu_crtc->plane[0], true); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | static void ipu_crtc_atomic_disable(struct drm_crtc *crtc, | 77 | static void ipu_crtc_atomic_disable(struct drm_crtc *crtc, |
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 22e68a100e7b..5d333138f913 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c | |||
| @@ -662,13 +662,11 @@ static unsigned int mt8173_calculate_factor(int clock) | |||
| 662 | static unsigned int mt2701_calculate_factor(int clock) | 662 | static unsigned int mt2701_calculate_factor(int clock) |
| 663 | { | 663 | { |
| 664 | if (clock <= 64000) | 664 | if (clock <= 64000) |
| 665 | return 16; | ||
| 666 | else if (clock <= 128000) | ||
| 667 | return 8; | ||
| 668 | else if (clock <= 256000) | ||
| 669 | return 4; | 665 | return 4; |
| 670 | else | 666 | else if (clock <= 128000) |
| 671 | return 2; | 667 | return 2; |
| 668 | else | ||
| 669 | return 1; | ||
| 672 | } | 670 | } |
| 673 | 671 | ||
| 674 | static const struct mtk_dpi_conf mt8173_conf = { | 672 | static const struct mtk_dpi_conf mt8173_conf = { |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index cf59ea9bccfd..57ce4708ef1b 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <drm/drmP.h> | 15 | #include <drm/drmP.h> |
| 16 | #include <drm/drm_atomic.h> | 16 | #include <drm/drm_atomic.h> |
| 17 | #include <drm/drm_atomic_helper.h> | 17 | #include <drm/drm_atomic_helper.h> |
| 18 | #include <drm/drm_fb_helper.h> | ||
| 18 | #include <drm/drm_gem.h> | 19 | #include <drm/drm_gem.h> |
| 19 | #include <drm/drm_gem_cma_helper.h> | 20 | #include <drm/drm_gem_cma_helper.h> |
| 20 | #include <drm/drm_of.h> | 21 | #include <drm/drm_of.h> |
| @@ -341,6 +342,8 @@ static struct drm_driver mtk_drm_driver = { | |||
| 341 | .gem_prime_get_sg_table = mtk_gem_prime_get_sg_table, | 342 | .gem_prime_get_sg_table = mtk_gem_prime_get_sg_table, |
| 342 | .gem_prime_import_sg_table = mtk_gem_prime_import_sg_table, | 343 | .gem_prime_import_sg_table = mtk_gem_prime_import_sg_table, |
| 343 | .gem_prime_mmap = mtk_drm_gem_mmap_buf, | 344 | .gem_prime_mmap = mtk_drm_gem_mmap_buf, |
| 345 | .gem_prime_vmap = mtk_drm_gem_prime_vmap, | ||
| 346 | .gem_prime_vunmap = mtk_drm_gem_prime_vunmap, | ||
| 344 | .fops = &mtk_drm_fops, | 347 | .fops = &mtk_drm_fops, |
| 345 | 348 | ||
| 346 | .name = DRIVER_NAME, | 349 | .name = DRIVER_NAME, |
| @@ -376,6 +379,10 @@ static int mtk_drm_bind(struct device *dev) | |||
| 376 | if (ret < 0) | 379 | if (ret < 0) |
| 377 | goto err_deinit; | 380 | goto err_deinit; |
| 378 | 381 | ||
| 382 | ret = drm_fbdev_generic_setup(drm, 32); | ||
| 383 | if (ret) | ||
| 384 | DRM_ERROR("Failed to initialize fbdev: %d\n", ret); | ||
| 385 | |||
| 379 | return 0; | 386 | return 0; |
| 380 | 387 | ||
| 381 | err_deinit: | 388 | err_deinit: |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c index 259b7b0de1d2..38483e9ee071 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c | |||
| @@ -241,3 +241,49 @@ err_gem_free: | |||
| 241 | kfree(mtk_gem); | 241 | kfree(mtk_gem); |
| 242 | return ERR_PTR(ret); | 242 | return ERR_PTR(ret); |
| 243 | } | 243 | } |
| 244 | |||
| 245 | void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj) | ||
| 246 | { | ||
| 247 | struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj); | ||
| 248 | struct sg_table *sgt; | ||
| 249 | struct sg_page_iter iter; | ||
| 250 | unsigned int npages; | ||
| 251 | unsigned int i = 0; | ||
| 252 | |||
| 253 | if (mtk_gem->kvaddr) | ||
| 254 | return mtk_gem->kvaddr; | ||
| 255 | |||
| 256 | sgt = mtk_gem_prime_get_sg_table(obj); | ||
| 257 | if (IS_ERR(sgt)) | ||
| 258 | return NULL; | ||
| 259 | |||
| 260 | npages = obj->size >> PAGE_SHIFT; | ||
| 261 | mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL); | ||
| 262 | if (!mtk_gem->pages) | ||
| 263 | goto out; | ||
| 264 | |||
| 265 | for_each_sg_page(sgt->sgl, &iter, sgt->orig_nents, 0) { | ||
| 266 | mtk_gem->pages[i++] = sg_page_iter_page(&iter); | ||
| 267 | if (i > npages) | ||
| 268 | break; | ||
| 269 | } | ||
| 270 | mtk_gem->kvaddr = vmap(mtk_gem->pages, npages, VM_MAP, | ||
| 271 | pgprot_writecombine(PAGE_KERNEL)); | ||
| 272 | |||
| 273 | out: | ||
| 274 | kfree((void *)sgt); | ||
| 275 | |||
| 276 | return mtk_gem->kvaddr; | ||
| 277 | } | ||
| 278 | |||
| 279 | void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) | ||
| 280 | { | ||
| 281 | struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj); | ||
| 282 | |||
| 283 | if (!mtk_gem->pages) | ||
| 284 | return; | ||
| 285 | |||
| 286 | vunmap(vaddr); | ||
| 287 | mtk_gem->kvaddr = 0; | ||
| 288 | kfree((void *)mtk_gem->pages); | ||
| 289 | } | ||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.h b/drivers/gpu/drm/mediatek/mtk_drm_gem.h index 534639b43a1c..c047a7ef294f 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.h | |||
| @@ -37,6 +37,7 @@ struct mtk_drm_gem_obj { | |||
| 37 | dma_addr_t dma_addr; | 37 | dma_addr_t dma_addr; |
| 38 | unsigned long dma_attrs; | 38 | unsigned long dma_attrs; |
| 39 | struct sg_table *sg; | 39 | struct sg_table *sg; |
| 40 | struct page **pages; | ||
| 40 | }; | 41 | }; |
| 41 | 42 | ||
| 42 | #define to_mtk_gem_obj(x) container_of(x, struct mtk_drm_gem_obj, base) | 43 | #define to_mtk_gem_obj(x) container_of(x, struct mtk_drm_gem_obj, base) |
| @@ -52,5 +53,7 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj, | |||
| 52 | struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj); | 53 | struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj); |
| 53 | struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev, | 54 | struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev, |
| 54 | struct dma_buf_attachment *attach, struct sg_table *sg); | 55 | struct dma_buf_attachment *attach, struct sg_table *sg); |
| 56 | void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj); | ||
| 57 | void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); | ||
| 55 | 58 | ||
| 56 | #endif | 59 | #endif |
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 915cc84621ae..e04e6c293d39 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c | |||
| @@ -1480,7 +1480,6 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, | |||
| 1480 | if (IS_ERR(regmap)) | 1480 | if (IS_ERR(regmap)) |
| 1481 | ret = PTR_ERR(regmap); | 1481 | ret = PTR_ERR(regmap); |
| 1482 | if (ret) { | 1482 | if (ret) { |
| 1483 | ret = PTR_ERR(regmap); | ||
| 1484 | dev_err(dev, | 1483 | dev_err(dev, |
| 1485 | "Failed to get system configuration registers: %d\n", | 1484 | "Failed to get system configuration registers: %d\n", |
| 1486 | ret); | 1485 | ret); |
| @@ -1516,6 +1515,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, | |||
| 1516 | of_node_put(remote); | 1515 | of_node_put(remote); |
| 1517 | 1516 | ||
| 1518 | hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np); | 1517 | hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np); |
| 1518 | of_node_put(i2c_np); | ||
| 1519 | if (!hdmi->ddc_adpt) { | 1519 | if (!hdmi->ddc_adpt) { |
| 1520 | dev_err(dev, "Failed to get ddc i2c adapter by node\n"); | 1520 | dev_err(dev, "Failed to get ddc i2c adapter by node\n"); |
| 1521 | return -EINVAL; | 1521 | return -EINVAL; |
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c index 4ef9c57ffd44..5223498502c4 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c | |||
| @@ -15,28 +15,6 @@ static const struct phy_ops mtk_hdmi_phy_dev_ops = { | |||
| 15 | .owner = THIS_MODULE, | 15 | .owner = THIS_MODULE, |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, | ||
| 19 | unsigned long *parent_rate) | ||
| 20 | { | ||
| 21 | struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); | ||
| 22 | |||
| 23 | hdmi_phy->pll_rate = rate; | ||
| 24 | if (rate <= 74250000) | ||
| 25 | *parent_rate = rate; | ||
| 26 | else | ||
| 27 | *parent_rate = rate / 2; | ||
| 28 | |||
| 29 | return rate; | ||
| 30 | } | ||
| 31 | |||
| 32 | unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, | ||
| 33 | unsigned long parent_rate) | ||
| 34 | { | ||
| 35 | struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); | ||
| 36 | |||
| 37 | return hdmi_phy->pll_rate; | ||
| 38 | } | ||
| 39 | |||
| 40 | void mtk_hdmi_phy_clear_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, | 18 | void mtk_hdmi_phy_clear_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, |
| 41 | u32 bits) | 19 | u32 bits) |
| 42 | { | 20 | { |
| @@ -110,13 +88,11 @@ mtk_hdmi_phy_dev_get_ops(const struct mtk_hdmi_phy *hdmi_phy) | |||
| 110 | return NULL; | 88 | return NULL; |
| 111 | } | 89 | } |
| 112 | 90 | ||
| 113 | static void mtk_hdmi_phy_clk_get_ops(struct mtk_hdmi_phy *hdmi_phy, | 91 | static void mtk_hdmi_phy_clk_get_data(struct mtk_hdmi_phy *hdmi_phy, |
| 114 | const struct clk_ops **ops) | 92 | struct clk_init_data *clk_init) |
| 115 | { | 93 | { |
| 116 | if (hdmi_phy && hdmi_phy->conf && hdmi_phy->conf->hdmi_phy_clk_ops) | 94 | clk_init->flags = hdmi_phy->conf->flags; |
| 117 | *ops = hdmi_phy->conf->hdmi_phy_clk_ops; | 95 | clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops; |
| 118 | else | ||
| 119 | dev_err(hdmi_phy->dev, "Failed to get clk ops of phy\n"); | ||
| 120 | } | 96 | } |
| 121 | 97 | ||
| 122 | static int mtk_hdmi_phy_probe(struct platform_device *pdev) | 98 | static int mtk_hdmi_phy_probe(struct platform_device *pdev) |
| @@ -129,7 +105,6 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev) | |||
| 129 | struct clk_init_data clk_init = { | 105 | struct clk_init_data clk_init = { |
| 130 | .num_parents = 1, | 106 | .num_parents = 1, |
| 131 | .parent_names = (const char * const *)&ref_clk_name, | 107 | .parent_names = (const char * const *)&ref_clk_name, |
| 132 | .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, | ||
| 133 | }; | 108 | }; |
| 134 | 109 | ||
| 135 | struct phy *phy; | 110 | struct phy *phy; |
| @@ -167,7 +142,7 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev) | |||
| 167 | hdmi_phy->dev = dev; | 142 | hdmi_phy->dev = dev; |
| 168 | hdmi_phy->conf = | 143 | hdmi_phy->conf = |
| 169 | (struct mtk_hdmi_phy_conf *)of_device_get_match_data(dev); | 144 | (struct mtk_hdmi_phy_conf *)of_device_get_match_data(dev); |
| 170 | mtk_hdmi_phy_clk_get_ops(hdmi_phy, &clk_init.ops); | 145 | mtk_hdmi_phy_clk_get_data(hdmi_phy, &clk_init); |
| 171 | hdmi_phy->pll_hw.init = &clk_init; | 146 | hdmi_phy->pll_hw.init = &clk_init; |
| 172 | hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw); | 147 | hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw); |
| 173 | if (IS_ERR(hdmi_phy->pll)) { | 148 | if (IS_ERR(hdmi_phy->pll)) { |
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h index f39b1fc66612..2d8b3182470d 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h | |||
| @@ -21,6 +21,7 @@ struct mtk_hdmi_phy; | |||
| 21 | 21 | ||
| 22 | struct mtk_hdmi_phy_conf { | 22 | struct mtk_hdmi_phy_conf { |
| 23 | bool tz_disabled; | 23 | bool tz_disabled; |
| 24 | unsigned long flags; | ||
| 24 | const struct clk_ops *hdmi_phy_clk_ops; | 25 | const struct clk_ops *hdmi_phy_clk_ops; |
| 25 | void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy); | 26 | void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy); |
| 26 | void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy); | 27 | void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy); |
| @@ -48,10 +49,6 @@ void mtk_hdmi_phy_set_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, | |||
| 48 | void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 offset, | 49 | void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 offset, |
| 49 | u32 val, u32 mask); | 50 | u32 val, u32 mask); |
| 50 | struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw); | 51 | struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw); |
| 51 | long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, | ||
| 52 | unsigned long *parent_rate); | ||
| 53 | unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, | ||
| 54 | unsigned long parent_rate); | ||
| 55 | 52 | ||
| 56 | extern struct platform_driver mtk_hdmi_phy_driver; | 53 | extern struct platform_driver mtk_hdmi_phy_driver; |
| 57 | extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf; | 54 | extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf; |
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c index fcc42dc6ea7f..d3cc4022e988 100644 --- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c | |||
| @@ -79,7 +79,6 @@ static int mtk_hdmi_pll_prepare(struct clk_hw *hw) | |||
| 79 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); | 79 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); |
| 80 | usleep_range(80, 100); | 80 | usleep_range(80, 100); |
| 81 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); | 81 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); |
| 82 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); | ||
| 83 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); | 82 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); |
| 84 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); | 83 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); |
| 85 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); | 84 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); |
| @@ -94,7 +93,6 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) | |||
| 94 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); | 93 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); |
| 95 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); | 94 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); |
| 96 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); | 95 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); |
| 97 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); | ||
| 98 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); | 96 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); |
| 99 | usleep_range(80, 100); | 97 | usleep_range(80, 100); |
| 100 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); | 98 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); |
| @@ -108,6 +106,12 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) | |||
| 108 | usleep_range(80, 100); | 106 | usleep_range(80, 100); |
| 109 | } | 107 | } |
| 110 | 108 | ||
| 109 | static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, | ||
| 110 | unsigned long *parent_rate) | ||
| 111 | { | ||
| 112 | return rate; | ||
| 113 | } | ||
| 114 | |||
| 111 | static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, | 115 | static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
| 112 | unsigned long parent_rate) | 116 | unsigned long parent_rate) |
| 113 | { | 117 | { |
| @@ -116,13 +120,14 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
| 116 | 120 | ||
| 117 | if (rate <= 64000000) | 121 | if (rate <= 64000000) |
| 118 | pos_div = 3; | 122 | pos_div = 3; |
| 119 | else if (rate <= 12800000) | 123 | else if (rate <= 128000000) |
| 120 | pos_div = 1; | 124 | pos_div = 2; |
| 121 | else | 125 | else |
| 122 | pos_div = 1; | 126 | pos_div = 1; |
| 123 | 127 | ||
| 124 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON6, RG_HTPLL_PREDIV_MASK); | 128 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON6, RG_HTPLL_PREDIV_MASK); |
| 125 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON6, RG_HTPLL_POSDIV_MASK); | 129 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON6, RG_HTPLL_POSDIV_MASK); |
| 130 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); | ||
| 126 | mtk_hdmi_phy_mask(hdmi_phy, HDMI_CON6, (0x1 << RG_HTPLL_IC), | 131 | mtk_hdmi_phy_mask(hdmi_phy, HDMI_CON6, (0x1 << RG_HTPLL_IC), |
| 127 | RG_HTPLL_IC_MASK); | 132 | RG_HTPLL_IC_MASK); |
| 128 | mtk_hdmi_phy_mask(hdmi_phy, HDMI_CON6, (0x1 << RG_HTPLL_IR), | 133 | mtk_hdmi_phy_mask(hdmi_phy, HDMI_CON6, (0x1 << RG_HTPLL_IR), |
| @@ -154,6 +159,39 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
| 154 | return 0; | 159 | return 0; |
| 155 | } | 160 | } |
| 156 | 161 | ||
| 162 | static unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, | ||
| 163 | unsigned long parent_rate) | ||
| 164 | { | ||
| 165 | struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); | ||
| 166 | unsigned long out_rate, val; | ||
| 167 | |||
| 168 | val = (readl(hdmi_phy->regs + HDMI_CON6) | ||
| 169 | & RG_HTPLL_PREDIV_MASK) >> RG_HTPLL_PREDIV; | ||
| 170 | switch (val) { | ||
| 171 | case 0x00: | ||
| 172 | out_rate = parent_rate; | ||
| 173 | break; | ||
| 174 | case 0x01: | ||
| 175 | out_rate = parent_rate / 2; | ||
| 176 | break; | ||
| 177 | default: | ||
| 178 | out_rate = parent_rate / 4; | ||
| 179 | break; | ||
| 180 | } | ||
| 181 | |||
| 182 | val = (readl(hdmi_phy->regs + HDMI_CON6) | ||
| 183 | & RG_HTPLL_FBKDIV_MASK) >> RG_HTPLL_FBKDIV; | ||
| 184 | out_rate *= (val + 1) * 2; | ||
| 185 | val = (readl(hdmi_phy->regs + HDMI_CON2) | ||
| 186 | & RG_HDMITX_TX_POSDIV_MASK); | ||
| 187 | out_rate >>= (val >> RG_HDMITX_TX_POSDIV); | ||
| 188 | |||
| 189 | if (readl(hdmi_phy->regs + HDMI_CON2) & RG_HDMITX_EN_TX_POSDIV) | ||
| 190 | out_rate /= 5; | ||
| 191 | |||
| 192 | return out_rate; | ||
| 193 | } | ||
| 194 | |||
| 157 | static const struct clk_ops mtk_hdmi_phy_pll_ops = { | 195 | static const struct clk_ops mtk_hdmi_phy_pll_ops = { |
| 158 | .prepare = mtk_hdmi_pll_prepare, | 196 | .prepare = mtk_hdmi_pll_prepare, |
| 159 | .unprepare = mtk_hdmi_pll_unprepare, | 197 | .unprepare = mtk_hdmi_pll_unprepare, |
| @@ -174,7 +212,6 @@ static void mtk_hdmi_phy_enable_tmds(struct mtk_hdmi_phy *hdmi_phy) | |||
| 174 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); | 212 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); |
| 175 | usleep_range(80, 100); | 213 | usleep_range(80, 100); |
| 176 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); | 214 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); |
| 177 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); | ||
| 178 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); | 215 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); |
| 179 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); | 216 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); |
| 180 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); | 217 | mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); |
| @@ -186,7 +223,6 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) | |||
| 186 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); | 223 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); |
| 187 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); | 224 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); |
| 188 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); | 225 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); |
| 189 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); | ||
| 190 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); | 226 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); |
| 191 | usleep_range(80, 100); | 227 | usleep_range(80, 100); |
| 192 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); | 228 | mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); |
| @@ -202,6 +238,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) | |||
| 202 | 238 | ||
| 203 | struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = { | 239 | struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = { |
| 204 | .tz_disabled = true, | 240 | .tz_disabled = true, |
| 241 | .flags = CLK_SET_RATE_GATE, | ||
| 205 | .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops, | 242 | .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops, |
| 206 | .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, | 243 | .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, |
| 207 | .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds, | 244 | .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds, |
diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c index ed5916b27658..47f8a2951682 100644 --- a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c | |||
| @@ -199,6 +199,20 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) | |||
| 199 | usleep_range(100, 150); | 199 | usleep_range(100, 150); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, | ||
| 203 | unsigned long *parent_rate) | ||
| 204 | { | ||
| 205 | struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); | ||
| 206 | |||
| 207 | hdmi_phy->pll_rate = rate; | ||
| 208 | if (rate <= 74250000) | ||
| 209 | *parent_rate = rate; | ||
| 210 | else | ||
| 211 | *parent_rate = rate / 2; | ||
| 212 | |||
| 213 | return rate; | ||
| 214 | } | ||
| 215 | |||
| 202 | static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, | 216 | static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
| 203 | unsigned long parent_rate) | 217 | unsigned long parent_rate) |
| 204 | { | 218 | { |
| @@ -285,6 +299,14 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
| 285 | return 0; | 299 | return 0; |
| 286 | } | 300 | } |
| 287 | 301 | ||
| 302 | static unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, | ||
| 303 | unsigned long parent_rate) | ||
| 304 | { | ||
| 305 | struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); | ||
| 306 | |||
| 307 | return hdmi_phy->pll_rate; | ||
| 308 | } | ||
| 309 | |||
| 288 | static const struct clk_ops mtk_hdmi_phy_pll_ops = { | 310 | static const struct clk_ops mtk_hdmi_phy_pll_ops = { |
| 289 | .prepare = mtk_hdmi_pll_prepare, | 311 | .prepare = mtk_hdmi_pll_prepare, |
| 290 | .unprepare = mtk_hdmi_pll_unprepare, | 312 | .unprepare = mtk_hdmi_pll_unprepare, |
| @@ -309,6 +331,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) | |||
| 309 | } | 331 | } |
| 310 | 332 | ||
| 311 | struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf = { | 333 | struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf = { |
| 334 | .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, | ||
| 312 | .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops, | 335 | .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops, |
| 313 | .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, | 336 | .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, |
| 314 | .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds, | 337 | .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds, |
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c index 340383150fb9..ebf9c96d43ee 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c | |||
| @@ -175,6 +175,7 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) | |||
| 175 | REG_FLD_MOD(core->base, HDMI_CORE_SYS_INTR_UNMASK4, 0, 3, 3); | 175 | REG_FLD_MOD(core->base, HDMI_CORE_SYS_INTR_UNMASK4, 0, 3, 3); |
| 176 | hdmi_wp_clear_irqenable(core->wp, HDMI_IRQ_CORE); | 176 | hdmi_wp_clear_irqenable(core->wp, HDMI_IRQ_CORE); |
| 177 | hdmi_wp_set_irqstatus(core->wp, HDMI_IRQ_CORE); | 177 | hdmi_wp_set_irqstatus(core->wp, HDMI_IRQ_CORE); |
| 178 | REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0); | ||
| 178 | hdmi4_core_disable(core); | 179 | hdmi4_core_disable(core); |
| 179 | return 0; | 180 | return 0; |
| 180 | } | 181 | } |
| @@ -182,16 +183,24 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) | |||
| 182 | if (err) | 183 | if (err) |
| 183 | return err; | 184 | return err; |
| 184 | 185 | ||
| 186 | /* | ||
| 187 | * Initialize CEC clock divider: CEC needs 2MHz clock hence | ||
| 188 | * set the divider to 24 to get 48/24=2MHz clock | ||
| 189 | */ | ||
| 190 | REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0x18, 5, 0); | ||
| 191 | |||
| 185 | /* Clear TX FIFO */ | 192 | /* Clear TX FIFO */ |
| 186 | if (!hdmi_cec_clear_tx_fifo(adap)) { | 193 | if (!hdmi_cec_clear_tx_fifo(adap)) { |
| 187 | pr_err("cec-%s: could not clear TX FIFO\n", adap->name); | 194 | pr_err("cec-%s: could not clear TX FIFO\n", adap->name); |
| 188 | return -EIO; | 195 | err = -EIO; |
| 196 | goto err_disable_clk; | ||
| 189 | } | 197 | } |
| 190 | 198 | ||
| 191 | /* Clear RX FIFO */ | 199 | /* Clear RX FIFO */ |
| 192 | if (!hdmi_cec_clear_rx_fifo(adap)) { | 200 | if (!hdmi_cec_clear_rx_fifo(adap)) { |
| 193 | pr_err("cec-%s: could not clear RX FIFO\n", adap->name); | 201 | pr_err("cec-%s: could not clear RX FIFO\n", adap->name); |
| 194 | return -EIO; | 202 | err = -EIO; |
| 203 | goto err_disable_clk; | ||
| 195 | } | 204 | } |
| 196 | 205 | ||
| 197 | /* Clear CEC interrupts */ | 206 | /* Clear CEC interrupts */ |
| @@ -236,6 +245,12 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) | |||
| 236 | hdmi_write_reg(core->base, HDMI_CEC_INT_STATUS_1, temp); | 245 | hdmi_write_reg(core->base, HDMI_CEC_INT_STATUS_1, temp); |
| 237 | } | 246 | } |
| 238 | return 0; | 247 | return 0; |
| 248 | |||
| 249 | err_disable_clk: | ||
| 250 | REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0); | ||
| 251 | hdmi4_core_disable(core); | ||
| 252 | |||
| 253 | return err; | ||
| 239 | } | 254 | } |
| 240 | 255 | ||
| 241 | static int hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) | 256 | static int hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) |
| @@ -333,11 +348,8 @@ int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core, | |||
| 333 | return ret; | 348 | return ret; |
| 334 | core->wp = wp; | 349 | core->wp = wp; |
| 335 | 350 | ||
| 336 | /* | 351 | /* Disable clock initially, hdmi_cec_adap_enable() manages it */ |
| 337 | * Initialize CEC clock divider: CEC needs 2MHz clock hence | 352 | REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0); |
| 338 | * set the devider to 24 to get 48/24=2MHz clock | ||
| 339 | */ | ||
| 340 | REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0x18, 5, 0); | ||
| 341 | 353 | ||
| 342 | ret = cec_register_adapter(core->adap, &pdev->dev); | 354 | ret = cec_register_adapter(core->adap, &pdev->dev); |
| 343 | if (ret < 0) { | 355 | if (ret < 0) { |
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c index 813ba42f2753..e384b95ad857 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | |||
| @@ -708,7 +708,7 @@ int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp, | |||
| 708 | else | 708 | else |
| 709 | acore.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_RIGHT; | 709 | acore.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_RIGHT; |
| 710 | /* | 710 | /* |
| 711 | * The I2S input word length is twice the lenght given in the IEC-60958 | 711 | * The I2S input word length is twice the length given in the IEC-60958 |
| 712 | * status word. If the word size is greater than | 712 | * status word. If the word size is greater than |
| 713 | * 20 bits, increment by one. | 713 | * 20 bits, increment by one. |
| 714 | */ | 714 | */ |
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index 578d867a81d5..f33e349c4ec5 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c | |||
| @@ -255,10 +255,14 @@ static struct drm_driver qxl_driver = { | |||
| 255 | #if defined(CONFIG_DEBUG_FS) | 255 | #if defined(CONFIG_DEBUG_FS) |
| 256 | .debugfs_init = qxl_debugfs_init, | 256 | .debugfs_init = qxl_debugfs_init, |
| 257 | #endif | 257 | #endif |
| 258 | .prime_handle_to_fd = drm_gem_prime_handle_to_fd, | ||
| 259 | .prime_fd_to_handle = drm_gem_prime_fd_to_handle, | ||
| 258 | .gem_prime_export = drm_gem_prime_export, | 260 | .gem_prime_export = drm_gem_prime_export, |
| 259 | .gem_prime_import = drm_gem_prime_import, | 261 | .gem_prime_import = drm_gem_prime_import, |
| 260 | .gem_prime_pin = qxl_gem_prime_pin, | 262 | .gem_prime_pin = qxl_gem_prime_pin, |
| 261 | .gem_prime_unpin = qxl_gem_prime_unpin, | 263 | .gem_prime_unpin = qxl_gem_prime_unpin, |
| 264 | .gem_prime_get_sg_table = qxl_gem_prime_get_sg_table, | ||
| 265 | .gem_prime_import_sg_table = qxl_gem_prime_import_sg_table, | ||
| 262 | .gem_prime_vmap = qxl_gem_prime_vmap, | 266 | .gem_prime_vmap = qxl_gem_prime_vmap, |
| 263 | .gem_prime_vunmap = qxl_gem_prime_vunmap, | 267 | .gem_prime_vunmap = qxl_gem_prime_vunmap, |
| 264 | .gem_prime_mmap = qxl_gem_prime_mmap, | 268 | .gem_prime_mmap = qxl_gem_prime_mmap, |
diff --git a/drivers/gpu/drm/qxl/qxl_prime.c b/drivers/gpu/drm/qxl/qxl_prime.c index 8b448eca1cd9..114653b471c6 100644 --- a/drivers/gpu/drm/qxl/qxl_prime.c +++ b/drivers/gpu/drm/qxl/qxl_prime.c | |||
| @@ -42,6 +42,18 @@ void qxl_gem_prime_unpin(struct drm_gem_object *obj) | |||
| 42 | qxl_bo_unpin(bo); | 42 | qxl_bo_unpin(bo); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj) | ||
| 46 | { | ||
| 47 | return ERR_PTR(-ENOSYS); | ||
| 48 | } | ||
| 49 | |||
| 50 | struct drm_gem_object *qxl_gem_prime_import_sg_table( | ||
| 51 | struct drm_device *dev, struct dma_buf_attachment *attach, | ||
| 52 | struct sg_table *table) | ||
| 53 | { | ||
| 54 | return ERR_PTR(-ENOSYS); | ||
| 55 | } | ||
| 56 | |||
| 45 | void *qxl_gem_prime_vmap(struct drm_gem_object *obj) | 57 | void *qxl_gem_prime_vmap(struct drm_gem_object *obj) |
| 46 | { | 58 | { |
| 47 | struct qxl_bo *bo = gem_to_qxl_bo(obj); | 59 | struct qxl_bo *bo = gem_to_qxl_bo(obj); |
diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 19fc601c9eeb..a1bec2779e76 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c | |||
| @@ -366,10 +366,9 @@ void drm_sched_increase_karma(struct drm_sched_job *bad) | |||
| 366 | EXPORT_SYMBOL(drm_sched_increase_karma); | 366 | EXPORT_SYMBOL(drm_sched_increase_karma); |
| 367 | 367 | ||
| 368 | /** | 368 | /** |
| 369 | * drm_sched_hw_job_reset - stop the scheduler if it contains the bad job | 369 | * drm_sched_stop - stop the scheduler |
| 370 | * | 370 | * |
| 371 | * @sched: scheduler instance | 371 | * @sched: scheduler instance |
| 372 | * @bad: bad scheduler job | ||
| 373 | * | 372 | * |
| 374 | */ | 373 | */ |
| 375 | void drm_sched_stop(struct drm_gpu_scheduler *sched) | 374 | void drm_sched_stop(struct drm_gpu_scheduler *sched) |
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 3ebd9f5e2719..29258b404e54 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/of_reserved_mem.h> | 16 | #include <linux/of_reserved_mem.h> |
| 17 | 17 | ||
| 18 | #include <drm/drmP.h> | 18 | #include <drm/drmP.h> |
| 19 | #include <drm/drm_atomic_helper.h> | ||
| 19 | #include <drm/drm_fb_cma_helper.h> | 20 | #include <drm/drm_fb_cma_helper.h> |
| 20 | #include <drm/drm_fb_helper.h> | 21 | #include <drm/drm_fb_helper.h> |
| 21 | #include <drm/drm_gem_cma_helper.h> | 22 | #include <drm/drm_gem_cma_helper.h> |
| @@ -85,6 +86,8 @@ static int sun4i_drv_bind(struct device *dev) | |||
| 85 | ret = -ENOMEM; | 86 | ret = -ENOMEM; |
| 86 | goto free_drm; | 87 | goto free_drm; |
| 87 | } | 88 | } |
| 89 | |||
| 90 | dev_set_drvdata(dev, drm); | ||
| 88 | drm->dev_private = drv; | 91 | drm->dev_private = drv; |
| 89 | INIT_LIST_HEAD(&drv->frontend_list); | 92 | INIT_LIST_HEAD(&drv->frontend_list); |
| 90 | INIT_LIST_HEAD(&drv->engine_list); | 93 | INIT_LIST_HEAD(&drv->engine_list); |
| @@ -144,8 +147,12 @@ static void sun4i_drv_unbind(struct device *dev) | |||
| 144 | 147 | ||
| 145 | drm_dev_unregister(drm); | 148 | drm_dev_unregister(drm); |
| 146 | drm_kms_helper_poll_fini(drm); | 149 | drm_kms_helper_poll_fini(drm); |
| 150 | drm_atomic_helper_shutdown(drm); | ||
| 147 | drm_mode_config_cleanup(drm); | 151 | drm_mode_config_cleanup(drm); |
| 152 | |||
| 153 | component_unbind_all(dev, NULL); | ||
| 148 | of_reserved_mem_device_release(dev); | 154 | of_reserved_mem_device_release(dev); |
| 155 | |||
| 149 | drm_dev_put(drm); | 156 | drm_dev_put(drm); |
| 150 | } | 157 | } |
| 151 | 158 | ||
| @@ -395,6 +402,8 @@ static int sun4i_drv_probe(struct platform_device *pdev) | |||
| 395 | 402 | ||
| 396 | static int sun4i_drv_remove(struct platform_device *pdev) | 403 | static int sun4i_drv_remove(struct platform_device *pdev) |
| 397 | { | 404 | { |
| 405 | component_master_del(&pdev->dev, &sun4i_drv_master_ops); | ||
| 406 | |||
| 398 | return 0; | 407 | return 0; |
| 399 | } | 408 | } |
| 400 | 409 | ||
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index dc47720c99ba..39d8509d96a0 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | |||
| @@ -48,8 +48,13 @@ static enum drm_mode_status | |||
| 48 | sun8i_dw_hdmi_mode_valid_h6(struct drm_connector *connector, | 48 | sun8i_dw_hdmi_mode_valid_h6(struct drm_connector *connector, |
| 49 | const struct drm_display_mode *mode) | 49 | const struct drm_display_mode *mode) |
| 50 | { | 50 | { |
| 51 | /* This is max for HDMI 2.0b (4K@60Hz) */ | 51 | /* |
| 52 | if (mode->clock > 594000) | 52 | * Controller support maximum of 594 MHz, which correlates to |
| 53 | * 4K@60Hz 4:4:4 or RGB. However, for frequencies greater than | ||
| 54 | * 340 MHz scrambling has to be enabled. Because scrambling is | ||
| 55 | * not yet implemented, just limit to 340 MHz for now. | ||
| 56 | */ | ||
| 57 | if (mode->clock > 340000) | ||
| 53 | return MODE_CLOCK_HIGH; | 58 | return MODE_CLOCK_HIGH; |
| 54 | 59 | ||
| 55 | return MODE_OK; | 60 | return MODE_OK; |
diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c index fc36e0c10a37..b1e7c76e9c17 100644 --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c | |||
| @@ -227,7 +227,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, | |||
| 227 | 227 | ||
| 228 | err_unregister_gates: | 228 | err_unregister_gates: |
| 229 | for (i = 0; i < CLK_NUM; i++) | 229 | for (i = 0; i < CLK_NUM; i++) |
| 230 | if (clk_data->hws[i]) | 230 | if (!IS_ERR_OR_NULL(clk_data->hws[i])) |
| 231 | clk_hw_unregister_gate(clk_data->hws[i]); | 231 | clk_hw_unregister_gate(clk_data->hws[i]); |
| 232 | clk_disable_unprepare(tcon_top->bus); | 232 | clk_disable_unprepare(tcon_top->bus); |
| 233 | err_assert_reset: | 233 | err_assert_reset: |
| @@ -245,7 +245,8 @@ static void sun8i_tcon_top_unbind(struct device *dev, struct device *master, | |||
| 245 | 245 | ||
| 246 | of_clk_del_provider(dev->of_node); | 246 | of_clk_del_provider(dev->of_node); |
| 247 | for (i = 0; i < CLK_NUM; i++) | 247 | for (i = 0; i < CLK_NUM; i++) |
| 248 | clk_hw_unregister_gate(clk_data->hws[i]); | 248 | if (clk_data->hws[i]) |
| 249 | clk_hw_unregister_gate(clk_data->hws[i]); | ||
| 249 | 250 | ||
| 250 | clk_disable_unprepare(tcon_top->bus); | 251 | clk_disable_unprepare(tcon_top->bus); |
| 251 | reset_control_assert(tcon_top->rst); | 252 | reset_control_assert(tcon_top->rst); |
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 47c55974756d..d23c4bfde790 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c | |||
| @@ -1260,9 +1260,15 @@ static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder) | |||
| 1260 | 1260 | ||
| 1261 | hdmi->dvi = !tegra_output_is_hdmi(output); | 1261 | hdmi->dvi = !tegra_output_is_hdmi(output); |
| 1262 | if (!hdmi->dvi) { | 1262 | if (!hdmi->dvi) { |
| 1263 | err = tegra_hdmi_setup_audio(hdmi); | 1263 | /* |
| 1264 | if (err < 0) | 1264 | * Make sure that the audio format has been configured before |
| 1265 | hdmi->dvi = true; | 1265 | * enabling audio, otherwise we may try to divide by zero. |
| 1266 | */ | ||
| 1267 | if (hdmi->format.sample_rate > 0) { | ||
| 1268 | err = tegra_hdmi_setup_audio(hdmi); | ||
| 1269 | if (err < 0) | ||
| 1270 | hdmi->dvi = true; | ||
| 1271 | } | ||
| 1266 | } | 1272 | } |
| 1267 | 1273 | ||
| 1268 | if (hdmi->config->has_hda) | 1274 | if (hdmi->config->has_hda) |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 3f56647cdb35..1a01669b159a 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
| @@ -49,9 +49,8 @@ static void ttm_bo_global_kobj_release(struct kobject *kobj); | |||
| 49 | * ttm_global_mutex - protecting the global BO state | 49 | * ttm_global_mutex - protecting the global BO state |
| 50 | */ | 50 | */ |
| 51 | DEFINE_MUTEX(ttm_global_mutex); | 51 | DEFINE_MUTEX(ttm_global_mutex); |
| 52 | struct ttm_bo_global ttm_bo_glob = { | 52 | unsigned ttm_bo_glob_use_count; |
| 53 | .use_count = 0 | 53 | struct ttm_bo_global ttm_bo_glob; |
| 54 | }; | ||
| 55 | 54 | ||
| 56 | static struct attribute ttm_bo_count = { | 55 | static struct attribute ttm_bo_count = { |
| 57 | .name = "bo_count", | 56 | .name = "bo_count", |
| @@ -876,8 +875,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, | |||
| 876 | reservation_object_add_shared_fence(bo->resv, fence); | 875 | reservation_object_add_shared_fence(bo->resv, fence); |
| 877 | 876 | ||
| 878 | ret = reservation_object_reserve_shared(bo->resv, 1); | 877 | ret = reservation_object_reserve_shared(bo->resv, 1); |
| 879 | if (unlikely(ret)) | 878 | if (unlikely(ret)) { |
| 879 | dma_fence_put(fence); | ||
| 880 | return ret; | 880 | return ret; |
| 881 | } | ||
| 881 | 882 | ||
| 882 | dma_fence_put(bo->moving); | 883 | dma_fence_put(bo->moving); |
| 883 | bo->moving = fence; | 884 | bo->moving = fence; |
| @@ -1529,12 +1530,13 @@ static void ttm_bo_global_release(void) | |||
| 1529 | struct ttm_bo_global *glob = &ttm_bo_glob; | 1530 | struct ttm_bo_global *glob = &ttm_bo_glob; |
| 1530 | 1531 | ||
| 1531 | mutex_lock(&ttm_global_mutex); | 1532 | mutex_lock(&ttm_global_mutex); |
| 1532 | if (--glob->use_count > 0) | 1533 | if (--ttm_bo_glob_use_count > 0) |
| 1533 | goto out; | 1534 | goto out; |
| 1534 | 1535 | ||
| 1535 | kobject_del(&glob->kobj); | 1536 | kobject_del(&glob->kobj); |
| 1536 | kobject_put(&glob->kobj); | 1537 | kobject_put(&glob->kobj); |
| 1537 | ttm_mem_global_release(&ttm_mem_glob); | 1538 | ttm_mem_global_release(&ttm_mem_glob); |
| 1539 | memset(glob, 0, sizeof(*glob)); | ||
| 1538 | out: | 1540 | out: |
| 1539 | mutex_unlock(&ttm_global_mutex); | 1541 | mutex_unlock(&ttm_global_mutex); |
| 1540 | } | 1542 | } |
| @@ -1546,7 +1548,7 @@ static int ttm_bo_global_init(void) | |||
| 1546 | unsigned i; | 1548 | unsigned i; |
| 1547 | 1549 | ||
| 1548 | mutex_lock(&ttm_global_mutex); | 1550 | mutex_lock(&ttm_global_mutex); |
| 1549 | if (++glob->use_count > 1) | 1551 | if (++ttm_bo_glob_use_count > 1) |
| 1550 | goto out; | 1552 | goto out; |
| 1551 | 1553 | ||
| 1552 | ret = ttm_mem_global_init(&ttm_mem_glob); | 1554 | ret = ttm_mem_global_init(&ttm_mem_glob); |
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index f1567c353b54..9a0909decb36 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c | |||
| @@ -461,8 +461,8 @@ out_no_zone: | |||
| 461 | 461 | ||
| 462 | void ttm_mem_global_release(struct ttm_mem_global *glob) | 462 | void ttm_mem_global_release(struct ttm_mem_global *glob) |
| 463 | { | 463 | { |
| 464 | unsigned int i; | ||
| 465 | struct ttm_mem_zone *zone; | 464 | struct ttm_mem_zone *zone; |
| 465 | unsigned int i; | ||
| 466 | 466 | ||
| 467 | /* let the page allocator first stop the shrink work. */ | 467 | /* let the page allocator first stop the shrink work. */ |
| 468 | ttm_page_alloc_fini(); | 468 | ttm_page_alloc_fini(); |
| @@ -475,9 +475,10 @@ void ttm_mem_global_release(struct ttm_mem_global *glob) | |||
| 475 | zone = glob->zones[i]; | 475 | zone = glob->zones[i]; |
| 476 | kobject_del(&zone->kobj); | 476 | kobject_del(&zone->kobj); |
| 477 | kobject_put(&zone->kobj); | 477 | kobject_put(&zone->kobj); |
| 478 | } | 478 | } |
| 479 | kobject_del(&glob->kobj); | 479 | kobject_del(&glob->kobj); |
| 480 | kobject_put(&glob->kobj); | 480 | kobject_put(&glob->kobj); |
| 481 | memset(glob, 0, sizeof(*glob)); | ||
| 481 | } | 482 | } |
| 482 | 483 | ||
| 483 | static void ttm_check_swapping(struct ttm_mem_global *glob) | 484 | static void ttm_check_swapping(struct ttm_mem_global *glob) |
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index f841accc2c00..627f8dc91d0e 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c | |||
| @@ -730,9 +730,10 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, | |||
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 732 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| 733 | if (!(flags & TTM_PAGE_FLAG_DMA32)) { | 733 | if (!(flags & TTM_PAGE_FLAG_DMA32) && |
| 734 | for (j = 0; j < HPAGE_PMD_NR; ++j) | 734 | (npages - i) >= HPAGE_PMD_NR) { |
| 735 | if (p++ != pages[i + j]) | 735 | for (j = 1; j < HPAGE_PMD_NR; ++j) |
| 736 | if (++p != pages[i + j]) | ||
| 736 | break; | 737 | break; |
| 737 | 738 | ||
| 738 | if (j == HPAGE_PMD_NR) | 739 | if (j == HPAGE_PMD_NR) |
| @@ -759,15 +760,15 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, | |||
| 759 | unsigned max_size, n2free; | 760 | unsigned max_size, n2free; |
| 760 | 761 | ||
| 761 | spin_lock_irqsave(&huge->lock, irq_flags); | 762 | spin_lock_irqsave(&huge->lock, irq_flags); |
| 762 | while (i < npages) { | 763 | while ((npages - i) >= HPAGE_PMD_NR) { |
| 763 | struct page *p = pages[i]; | 764 | struct page *p = pages[i]; |
| 764 | unsigned j; | 765 | unsigned j; |
| 765 | 766 | ||
| 766 | if (!p) | 767 | if (!p) |
| 767 | break; | 768 | break; |
| 768 | 769 | ||
| 769 | for (j = 0; j < HPAGE_PMD_NR; ++j) | 770 | for (j = 1; j < HPAGE_PMD_NR; ++j) |
| 770 | if (p++ != pages[i + j]) | 771 | if (++p != pages[i + j]) |
| 771 | break; | 772 | break; |
| 772 | 773 | ||
| 773 | if (j != HPAGE_PMD_NR) | 774 | if (j != HPAGE_PMD_NR) |
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index 22cd2d13e272..ff47f890e6ad 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c | |||
| @@ -52,6 +52,7 @@ static struct drm_driver driver = { | |||
| 52 | .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME, | 52 | .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME, |
| 53 | .load = udl_driver_load, | 53 | .load = udl_driver_load, |
| 54 | .unload = udl_driver_unload, | 54 | .unload = udl_driver_unload, |
| 55 | .release = udl_driver_release, | ||
| 55 | 56 | ||
| 56 | /* gem hooks */ | 57 | /* gem hooks */ |
| 57 | .gem_free_object_unlocked = udl_gem_free_object, | 58 | .gem_free_object_unlocked = udl_gem_free_object, |
diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index e9e9b1ff678e..4ae67d882eae 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h | |||
| @@ -104,6 +104,7 @@ void udl_urb_completion(struct urb *urb); | |||
| 104 | 104 | ||
| 105 | int udl_driver_load(struct drm_device *dev, unsigned long flags); | 105 | int udl_driver_load(struct drm_device *dev, unsigned long flags); |
| 106 | void udl_driver_unload(struct drm_device *dev); | 106 | void udl_driver_unload(struct drm_device *dev); |
| 107 | void udl_driver_release(struct drm_device *dev); | ||
| 107 | 108 | ||
| 108 | int udl_fbdev_init(struct drm_device *dev); | 109 | int udl_fbdev_init(struct drm_device *dev); |
| 109 | void udl_fbdev_cleanup(struct drm_device *dev); | 110 | void udl_fbdev_cleanup(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index 9086d0d1b880..1f8ef34ade24 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c | |||
| @@ -379,6 +379,12 @@ void udl_driver_unload(struct drm_device *dev) | |||
| 379 | udl_free_urb_list(dev); | 379 | udl_free_urb_list(dev); |
| 380 | 380 | ||
| 381 | udl_fbdev_cleanup(dev); | 381 | udl_fbdev_cleanup(dev); |
| 382 | udl_modeset_cleanup(dev); | ||
| 383 | kfree(udl); | 382 | kfree(udl); |
| 384 | } | 383 | } |
| 384 | |||
| 385 | void udl_driver_release(struct drm_device *dev) | ||
| 386 | { | ||
| 387 | udl_modeset_cleanup(dev); | ||
| 388 | drm_dev_fini(dev); | ||
| 389 | kfree(dev); | ||
| 390 | } | ||
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 730008d3da76..1baa10e94484 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c | |||
| @@ -1042,7 +1042,7 @@ static void | |||
| 1042 | vc4_crtc_reset(struct drm_crtc *crtc) | 1042 | vc4_crtc_reset(struct drm_crtc *crtc) |
| 1043 | { | 1043 | { |
| 1044 | if (crtc->state) | 1044 | if (crtc->state) |
| 1045 | __drm_atomic_helper_crtc_destroy_state(crtc->state); | 1045 | vc4_crtc_destroy_state(crtc, crtc->state); |
| 1046 | 1046 | ||
| 1047 | crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL); | 1047 | crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL); |
| 1048 | if (crtc->state) | 1048 | if (crtc->state) |
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index b996ac1d4fcc..af92964b6889 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c | |||
| @@ -205,10 +205,14 @@ static struct drm_driver driver = { | |||
| 205 | #if defined(CONFIG_DEBUG_FS) | 205 | #if defined(CONFIG_DEBUG_FS) |
| 206 | .debugfs_init = virtio_gpu_debugfs_init, | 206 | .debugfs_init = virtio_gpu_debugfs_init, |
| 207 | #endif | 207 | #endif |
| 208 | .prime_handle_to_fd = drm_gem_prime_handle_to_fd, | ||
| 209 | .prime_fd_to_handle = drm_gem_prime_fd_to_handle, | ||
| 208 | .gem_prime_export = drm_gem_prime_export, | 210 | .gem_prime_export = drm_gem_prime_export, |
| 209 | .gem_prime_import = drm_gem_prime_import, | 211 | .gem_prime_import = drm_gem_prime_import, |
| 210 | .gem_prime_pin = virtgpu_gem_prime_pin, | 212 | .gem_prime_pin = virtgpu_gem_prime_pin, |
| 211 | .gem_prime_unpin = virtgpu_gem_prime_unpin, | 213 | .gem_prime_unpin = virtgpu_gem_prime_unpin, |
| 214 | .gem_prime_get_sg_table = virtgpu_gem_prime_get_sg_table, | ||
| 215 | .gem_prime_import_sg_table = virtgpu_gem_prime_import_sg_table, | ||
| 212 | .gem_prime_vmap = virtgpu_gem_prime_vmap, | 216 | .gem_prime_vmap = virtgpu_gem_prime_vmap, |
| 213 | .gem_prime_vunmap = virtgpu_gem_prime_vunmap, | 217 | .gem_prime_vunmap = virtgpu_gem_prime_vunmap, |
| 214 | .gem_prime_mmap = virtgpu_gem_prime_mmap, | 218 | .gem_prime_mmap = virtgpu_gem_prime_mmap, |
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 3238fdf58eb4..d577cb76f5ad 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h | |||
| @@ -354,6 +354,10 @@ int virtio_gpu_object_wait(struct virtio_gpu_object *bo, bool no_wait); | |||
| 354 | /* virtgpu_prime.c */ | 354 | /* virtgpu_prime.c */ |
| 355 | int virtgpu_gem_prime_pin(struct drm_gem_object *obj); | 355 | int virtgpu_gem_prime_pin(struct drm_gem_object *obj); |
| 356 | void virtgpu_gem_prime_unpin(struct drm_gem_object *obj); | 356 | void virtgpu_gem_prime_unpin(struct drm_gem_object *obj); |
| 357 | struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj); | ||
| 358 | struct drm_gem_object *virtgpu_gem_prime_import_sg_table( | ||
| 359 | struct drm_device *dev, struct dma_buf_attachment *attach, | ||
| 360 | struct sg_table *sgt); | ||
| 357 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj); | 361 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj); |
| 358 | void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); | 362 | void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); |
| 359 | int virtgpu_gem_prime_mmap(struct drm_gem_object *obj, | 363 | int virtgpu_gem_prime_mmap(struct drm_gem_object *obj, |
diff --git a/drivers/gpu/drm/virtio/virtgpu_prime.c b/drivers/gpu/drm/virtio/virtgpu_prime.c index c59ec34c80a5..eb51a78e1199 100644 --- a/drivers/gpu/drm/virtio/virtgpu_prime.c +++ b/drivers/gpu/drm/virtio/virtgpu_prime.c | |||
| @@ -39,6 +39,18 @@ void virtgpu_gem_prime_unpin(struct drm_gem_object *obj) | |||
| 39 | WARN_ONCE(1, "not implemented"); | 39 | WARN_ONCE(1, "not implemented"); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj) | ||
| 43 | { | ||
| 44 | return ERR_PTR(-ENODEV); | ||
| 45 | } | ||
| 46 | |||
| 47 | struct drm_gem_object *virtgpu_gem_prime_import_sg_table( | ||
| 48 | struct drm_device *dev, struct dma_buf_attachment *attach, | ||
| 49 | struct sg_table *table) | ||
| 50 | { | ||
| 51 | return ERR_PTR(-ENODEV); | ||
| 52 | } | ||
| 53 | |||
| 42 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) | 54 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) |
| 43 | { | 55 | { |
| 44 | struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj); | 56 | struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 6165fe2c4504..1bfa353d995c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
| @@ -546,29 +546,13 @@ 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 | /** | ||
| 564 | * vmw_dma_select_mode - Determine how DMA mappings should be set up for this | 549 | * vmw_dma_select_mode - Determine how DMA mappings should be set up for this |
| 565 | * system. | 550 | * system. |
| 566 | * | 551 | * |
| 567 | * @dev_priv: Pointer to a struct vmw_private | 552 | * @dev_priv: Pointer to a struct vmw_private |
| 568 | * | 553 | * |
| 569 | * This functions tries to determine the IOMMU setup and what actions | 554 | * This functions tries to determine what actions need to be taken by the |
| 570 | * need to be taken by the driver to make system pages visible to the | 555 | * driver to make system pages visible to the device. |
| 571 | * device. | ||
| 572 | * If this function decides that DMA is not possible, it returns -EINVAL. | 556 | * If this function decides that DMA is not possible, it returns -EINVAL. |
| 573 | * The driver may then try to disable features of the device that require | 557 | * The driver may then try to disable features of the device that require |
| 574 | * DMA. | 558 | * DMA. |
| @@ -578,23 +562,16 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) | |||
| 578 | static const char *names[vmw_dma_map_max] = { | 562 | static const char *names[vmw_dma_map_max] = { |
| 579 | [vmw_dma_phys] = "Using physical TTM page addresses.", | 563 | [vmw_dma_phys] = "Using physical TTM page addresses.", |
| 580 | [vmw_dma_alloc_coherent] = "Using coherent TTM pages.", | 564 | [vmw_dma_alloc_coherent] = "Using coherent TTM pages.", |
| 581 | [vmw_dma_map_populate] = "Keeping DMA mappings.", | 565 | [vmw_dma_map_populate] = "Caching DMA mappings.", |
| 582 | [vmw_dma_map_bind] = "Giving up DMA mappings early."}; | 566 | [vmw_dma_map_bind] = "Giving up DMA mappings early."}; |
| 583 | 567 | ||
| 584 | if (vmw_force_coherent) | 568 | if (vmw_force_coherent) |
| 585 | dev_priv->map_mode = vmw_dma_alloc_coherent; | 569 | dev_priv->map_mode = vmw_dma_alloc_coherent; |
| 586 | else if (vmw_assume_iommu(dev_priv->dev)) | 570 | else if (vmw_restrict_iommu) |
| 587 | dev_priv->map_mode = vmw_dma_map_populate; | 571 | dev_priv->map_mode = vmw_dma_map_bind; |
| 588 | else if (!vmw_force_iommu) | ||
| 589 | dev_priv->map_mode = vmw_dma_phys; | ||
| 590 | else if (IS_ENABLED(CONFIG_SWIOTLB) && swiotlb_nr_tbl()) | ||
| 591 | dev_priv->map_mode = vmw_dma_alloc_coherent; | ||
| 592 | else | 572 | else |
| 593 | dev_priv->map_mode = vmw_dma_map_populate; | 573 | dev_priv->map_mode = vmw_dma_map_populate; |
| 594 | 574 | ||
| 595 | if (dev_priv->map_mode == vmw_dma_map_populate && vmw_restrict_iommu) | ||
| 596 | dev_priv->map_mode = vmw_dma_map_bind; | ||
| 597 | |||
| 598 | /* No TTM coherent page pool? FIXME: Ask TTM instead! */ | 575 | /* No TTM coherent page pool? FIXME: Ask TTM instead! */ |
| 599 | if (!(IS_ENABLED(CONFIG_SWIOTLB) || IS_ENABLED(CONFIG_INTEL_IOMMU)) && | 576 | if (!(IS_ENABLED(CONFIG_SWIOTLB) || IS_ENABLED(CONFIG_INTEL_IOMMU)) && |
| 600 | (dev_priv->map_mode == vmw_dma_alloc_coherent)) | 577 | (dev_priv->map_mode == vmw_dma_alloc_coherent)) |
diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c index 27101c04a827..0c0eb43abf65 100644 --- a/drivers/gpu/host1x/hw/channel_hw.c +++ b/drivers/gpu/host1x/hw/channel_hw.c | |||
| @@ -115,8 +115,12 @@ static inline void synchronize_syncpt_base(struct host1x_job *job) | |||
| 115 | static void host1x_channel_set_streamid(struct host1x_channel *channel) | 115 | static void host1x_channel_set_streamid(struct host1x_channel *channel) |
| 116 | { | 116 | { |
| 117 | #if HOST1X_HW >= 6 | 117 | #if HOST1X_HW >= 6 |
| 118 | u32 sid = 0x7f; | ||
| 119 | #ifdef CONFIG_IOMMU_API | ||
| 118 | struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); | 120 | struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); |
| 119 | u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f; | 121 | if (spec) |
| 122 | sid = spec->ids[0] & 0xffff; | ||
| 123 | #endif | ||
| 120 | 124 | ||
| 121 | host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); | 125 | host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); |
| 122 | #endif | 126 | #endif |
diff --git a/drivers/gpu/ipu-v3/ipu-dp.c b/drivers/gpu/ipu-v3/ipu-dp.c index 9b2b3fa479c4..5e44ff1f2085 100644 --- a/drivers/gpu/ipu-v3/ipu-dp.c +++ b/drivers/gpu/ipu-v3/ipu-dp.c | |||
| @@ -195,7 +195,8 @@ int ipu_dp_setup_channel(struct ipu_dp *dp, | |||
| 195 | ipu_dp_csc_init(flow, flow->foreground.in_cs, flow->out_cs, | 195 | ipu_dp_csc_init(flow, flow->foreground.in_cs, flow->out_cs, |
| 196 | DP_COM_CONF_CSC_DEF_BOTH); | 196 | DP_COM_CONF_CSC_DEF_BOTH); |
| 197 | } else { | 197 | } else { |
| 198 | if (flow->foreground.in_cs == flow->out_cs) | 198 | if (flow->foreground.in_cs == IPUV3_COLORSPACE_UNKNOWN || |
| 199 | flow->foreground.in_cs == flow->out_cs) | ||
| 199 | /* | 200 | /* |
| 200 | * foreground identical to output, apply color | 201 | * foreground identical to output, apply color |
| 201 | * conversion on background | 202 | * conversion on background |
| @@ -261,6 +262,8 @@ void ipu_dp_disable_channel(struct ipu_dp *dp, bool sync) | |||
| 261 | struct ipu_dp_priv *priv = flow->priv; | 262 | struct ipu_dp_priv *priv = flow->priv; |
| 262 | u32 reg, csc; | 263 | u32 reg, csc; |
| 263 | 264 | ||
| 265 | dp->in_cs = IPUV3_COLORSPACE_UNKNOWN; | ||
| 266 | |||
| 264 | if (!dp->foreground) | 267 | if (!dp->foreground) |
| 265 | return; | 268 | return; |
| 266 | 269 | ||
| @@ -268,8 +271,9 @@ void ipu_dp_disable_channel(struct ipu_dp *dp, bool sync) | |||
| 268 | 271 | ||
| 269 | reg = readl(flow->base + DP_COM_CONF); | 272 | reg = readl(flow->base + DP_COM_CONF); |
| 270 | csc = reg & DP_COM_CONF_CSC_DEF_MASK; | 273 | csc = reg & DP_COM_CONF_CSC_DEF_MASK; |
| 271 | if (csc == DP_COM_CONF_CSC_DEF_FG) | 274 | reg &= ~DP_COM_CONF_CSC_DEF_MASK; |
| 272 | reg &= ~DP_COM_CONF_CSC_DEF_MASK; | 275 | if (csc == DP_COM_CONF_CSC_DEF_BOTH || csc == DP_COM_CONF_CSC_DEF_BG) |
| 276 | reg |= DP_COM_CONF_CSC_DEF_BG; | ||
| 273 | 277 | ||
| 274 | reg &= ~DP_COM_CONF_FG_EN; | 278 | reg &= ~DP_COM_CONF_FG_EN; |
| 275 | writel(reg, flow->base + DP_COM_CONF); | 279 | writel(reg, flow->base + DP_COM_CONF); |
| @@ -347,6 +351,8 @@ int ipu_dp_init(struct ipu_soc *ipu, struct device *dev, unsigned long base) | |||
| 347 | mutex_init(&priv->mutex); | 351 | mutex_init(&priv->mutex); |
| 348 | 352 | ||
| 349 | for (i = 0; i < IPUV3_NUM_FLOWS; i++) { | 353 | for (i = 0; i < IPUV3_NUM_FLOWS; i++) { |
| 354 | priv->flow[i].background.in_cs = IPUV3_COLORSPACE_UNKNOWN; | ||
| 355 | priv->flow[i].foreground.in_cs = IPUV3_COLORSPACE_UNKNOWN; | ||
| 350 | priv->flow[i].foreground.foreground = true; | 356 | priv->flow[i].foreground.foreground = true; |
| 351 | priv->flow[i].base = priv->base + ipu_dp_flow_base[i]; | 357 | priv->flow[i].base = priv->base + ipu_dp_flow_base[i]; |
| 352 | priv->flow[i].priv = priv; | 358 | priv->flow[i].priv = priv; |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 6ca8d322b487..4ca0cdfa6b33 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
| @@ -150,6 +150,7 @@ config HID_ASUS | |||
| 150 | tristate "Asus" | 150 | tristate "Asus" |
| 151 | depends on LEDS_CLASS | 151 | depends on LEDS_CLASS |
| 152 | depends on ASUS_WMI || ASUS_WMI=n | 152 | depends on ASUS_WMI || ASUS_WMI=n |
| 153 | select POWER_SUPPLY | ||
| 153 | ---help--- | 154 | ---help--- |
| 154 | Support for Asus notebook built-in keyboard and touchpad via i2c, and | 155 | Support for Asus notebook built-in keyboard and touchpad via i2c, and |
| 155 | the Asus Republic of Gamers laptop keyboard special keys. | 156 | the Asus Republic of Gamers laptop keyboard special keys. |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 9993b692598f..860e21ec6a49 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1301,10 +1301,10 @@ static u32 __extract(u8 *report, unsigned offset, int n) | |||
| 1301 | u32 hid_field_extract(const struct hid_device *hid, u8 *report, | 1301 | u32 hid_field_extract(const struct hid_device *hid, u8 *report, |
| 1302 | unsigned offset, unsigned n) | 1302 | unsigned offset, unsigned n) |
| 1303 | { | 1303 | { |
| 1304 | if (n > 32) { | 1304 | if (n > 256) { |
| 1305 | hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n", | 1305 | hid_warn(hid, "hid_field_extract() called with n (%d) > 256! (%s)\n", |
| 1306 | n, current->comm); | 1306 | n, current->comm); |
| 1307 | n = 32; | 1307 | n = 256; |
| 1308 | } | 1308 | } |
| 1309 | 1309 | ||
| 1310 | return __extract(report, offset, n); | 1310 | return __extract(report, offset, n); |
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index ac9fda1b5a72..1384e57182af 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
| @@ -1060,10 +1060,15 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p) | |||
| 1060 | seq_printf(f, "\n\n"); | 1060 | seq_printf(f, "\n\n"); |
| 1061 | 1061 | ||
| 1062 | /* dump parsed data and input mappings */ | 1062 | /* dump parsed data and input mappings */ |
| 1063 | if (down_interruptible(&hdev->driver_input_lock)) | ||
| 1064 | return 0; | ||
| 1065 | |||
| 1063 | hid_dump_device(hdev, f); | 1066 | hid_dump_device(hdev, f); |
| 1064 | seq_printf(f, "\n"); | 1067 | seq_printf(f, "\n"); |
| 1065 | hid_dump_input_mapping(hdev, f); | 1068 | hid_dump_input_mapping(hdev, f); |
| 1066 | 1069 | ||
| 1070 | up(&hdev->driver_input_lock); | ||
| 1071 | |||
| 1067 | return 0; | 1072 | return 0; |
| 1068 | } | 1073 | } |
| 1069 | 1074 | ||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index b6d93f4ad037..adce58f24f76 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -1083,6 +1083,7 @@ | |||
| 1083 | #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3 | 1083 | #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3 |
| 1084 | #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 | 1084 | #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 |
| 1085 | #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 | 1085 | #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 |
| 1086 | #define I2C_DEVICE_ID_SYNAPTICS_7E7E 0x7e7e | ||
| 1086 | 1087 | ||
| 1087 | #define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047 | 1088 | #define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047 |
| 1088 | #define USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA 0x0855 | 1089 | #define USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA 0x0855 |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index b10b1922c5bd..b607286a0bc8 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
| @@ -680,6 +680,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 680 | break; | 680 | break; |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ | ||
| 684 | switch (usage->hid & 0xf) { | ||
| 685 | case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break; | ||
| 686 | default: goto ignore; | ||
| 687 | } | ||
| 688 | break; | ||
| 689 | } | ||
| 690 | |||
| 683 | /* | 691 | /* |
| 684 | * Some lazy vendors declare 255 usages for System Control, | 692 | * Some lazy vendors declare 255 usages for System Control, |
| 685 | * leading to the creation of ABS_X|Y axis and too many others. | 693 | * leading to the creation of ABS_X|Y axis and too many others. |
| @@ -902,7 +910,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 902 | case 0x06a: map_key_clear(KEY_GREEN); break; | 910 | case 0x06a: map_key_clear(KEY_GREEN); break; |
| 903 | case 0x06b: map_key_clear(KEY_BLUE); break; | 911 | case 0x06b: map_key_clear(KEY_BLUE); break; |
| 904 | case 0x06c: map_key_clear(KEY_YELLOW); break; | 912 | case 0x06c: map_key_clear(KEY_YELLOW); break; |
| 905 | case 0x06d: map_key_clear(KEY_ZOOM); break; | 913 | case 0x06d: map_key_clear(KEY_ASPECT_RATIO); break; |
| 906 | 914 | ||
| 907 | case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; | 915 | case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; |
| 908 | case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; | 916 | case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; |
| @@ -911,6 +919,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 911 | case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; | 919 | case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; |
| 912 | case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; | 920 | case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; |
| 913 | 921 | ||
| 922 | case 0x079: map_key_clear(KEY_KBDILLUMUP); break; | ||
| 923 | case 0x07a: map_key_clear(KEY_KBDILLUMDOWN); break; | ||
| 924 | case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE); break; | ||
| 925 | |||
| 914 | case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; | 926 | case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; |
| 915 | case 0x083: map_key_clear(KEY_LAST); break; | 927 | case 0x083: map_key_clear(KEY_LAST); break; |
| 916 | case 0x084: map_key_clear(KEY_ENTER); break; | 928 | case 0x084: map_key_clear(KEY_ENTER); break; |
| @@ -998,6 +1010,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 998 | case 0x1b8: map_key_clear(KEY_VIDEO); break; | 1010 | case 0x1b8: map_key_clear(KEY_VIDEO); break; |
| 999 | case 0x1bc: map_key_clear(KEY_MESSENGER); break; | 1011 | case 0x1bc: map_key_clear(KEY_MESSENGER); break; |
| 1000 | case 0x1bd: map_key_clear(KEY_INFO); break; | 1012 | case 0x1bd: map_key_clear(KEY_INFO); break; |
| 1013 | case 0x1cb: map_key_clear(KEY_ASSISTANT); break; | ||
| 1001 | case 0x201: map_key_clear(KEY_NEW); break; | 1014 | case 0x201: map_key_clear(KEY_NEW); break; |
| 1002 | case 0x202: map_key_clear(KEY_OPEN); break; | 1015 | case 0x202: map_key_clear(KEY_OPEN); break; |
| 1003 | case 0x203: map_key_clear(KEY_CLOSE); break; | 1016 | case 0x203: map_key_clear(KEY_CLOSE); break; |
| @@ -1021,6 +1034,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 1021 | case 0x22d: map_key_clear(KEY_ZOOMIN); break; | 1034 | case 0x22d: map_key_clear(KEY_ZOOMIN); break; |
| 1022 | case 0x22e: map_key_clear(KEY_ZOOMOUT); break; | 1035 | case 0x22e: map_key_clear(KEY_ZOOMOUT); break; |
| 1023 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; | 1036 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; |
| 1037 | case 0x232: map_key_clear(KEY_FULL_SCREEN); break; | ||
| 1024 | case 0x233: map_key_clear(KEY_SCROLLUP); break; | 1038 | case 0x233: map_key_clear(KEY_SCROLLUP); break; |
| 1025 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; | 1039 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; |
| 1026 | case 0x238: /* AC Pan */ | 1040 | case 0x238: /* AC Pan */ |
| @@ -1044,6 +1058,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 1044 | case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; | 1058 | case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; |
| 1045 | case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; | 1059 | case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; |
| 1046 | 1060 | ||
| 1061 | case 0x29f: map_key_clear(KEY_SCALE); break; | ||
| 1062 | |||
| 1047 | default: map_key_clear(KEY_UNKNOWN); | 1063 | default: map_key_clear(KEY_UNKNOWN); |
| 1048 | } | 1064 | } |
| 1049 | break; | 1065 | break; |
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 15ed6177a7a3..199cc256e9d9 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c | |||
| @@ -2111,6 +2111,13 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) | |||
| 2111 | kfree(data); | 2111 | kfree(data); |
| 2112 | return -ENOMEM; | 2112 | return -ENOMEM; |
| 2113 | } | 2113 | } |
| 2114 | data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue"); | ||
| 2115 | if (!data->wq) { | ||
| 2116 | kfree(data->effect_ids); | ||
| 2117 | kfree(data); | ||
| 2118 | return -ENOMEM; | ||
| 2119 | } | ||
| 2120 | |||
| 2114 | data->hidpp = hidpp; | 2121 | data->hidpp = hidpp; |
| 2115 | data->feature_index = feature_index; | 2122 | data->feature_index = feature_index; |
| 2116 | data->version = version; | 2123 | data->version = version; |
| @@ -2155,7 +2162,6 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) | |||
| 2155 | /* ignore boost value at response.fap.params[2] */ | 2162 | /* ignore boost value at response.fap.params[2] */ |
| 2156 | 2163 | ||
| 2157 | /* init the hardware command queue */ | 2164 | /* init the hardware command queue */ |
| 2158 | data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue"); | ||
| 2159 | atomic_set(&data->workqueue_size, 0); | 2165 | atomic_set(&data->workqueue_size, 0); |
| 2160 | 2166 | ||
| 2161 | /* initialize with zero autocenter to get wheel in usable state */ | 2167 | /* initialize with zero autocenter to get wheel in usable state */ |
| @@ -2608,8 +2614,9 @@ static int m560_raw_event(struct hid_device *hdev, u8 *data, int size) | |||
| 2608 | input_report_rel(mydata->input, REL_Y, v); | 2614 | input_report_rel(mydata->input, REL_Y, v); |
| 2609 | 2615 | ||
| 2610 | v = hid_snto32(data[6], 8); | 2616 | v = hid_snto32(data[6], 8); |
| 2611 | hidpp_scroll_counter_handle_scroll( | 2617 | if (v != 0) |
| 2612 | &hidpp->vertical_wheel_counter, v); | 2618 | hidpp_scroll_counter_handle_scroll( |
| 2619 | &hidpp->vertical_wheel_counter, v); | ||
| 2613 | 2620 | ||
| 2614 | input_sync(mydata->input); | 2621 | input_sync(mydata->input); |
| 2615 | } | 2622 | } |
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index 953908f2267c..77ffba48cc73 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c | |||
| @@ -715,7 +715,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
| 715 | { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, | 715 | { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) }, |
| 716 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, | 716 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, |
| 717 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, | 717 | { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, |
| 718 | { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, 0x0400) }, | ||
| 719 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, | 718 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, |
| 720 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, | 719 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, |
| 721 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, | 720 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, |
| @@ -855,7 +854,7 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
| 855 | { } | 854 | { } |
| 856 | }; | 855 | }; |
| 857 | 856 | ||
| 858 | /** | 857 | /* |
| 859 | * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer | 858 | * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer |
| 860 | * | 859 | * |
| 861 | * There are composite devices for which we want to ignore only a certain | 860 | * There are composite devices for which we want to ignore only a certain |
| @@ -996,6 +995,10 @@ bool hid_ignore(struct hid_device *hdev) | |||
| 996 | if (hdev->product == 0x0401 && | 995 | if (hdev->product == 0x0401 && |
| 997 | strncmp(hdev->name, "ELAN0800", 8) != 0) | 996 | strncmp(hdev->name, "ELAN0800", 8) != 0) |
| 998 | return true; | 997 | return true; |
| 998 | /* Same with product id 0x0400 */ | ||
| 999 | if (hdev->product == 0x0400 && | ||
| 1000 | strncmp(hdev->name, "QTEC0001", 8) != 0) | ||
| 1001 | return true; | ||
| 999 | break; | 1002 | break; |
| 1000 | } | 1003 | } |
| 1001 | 1004 | ||
| @@ -1042,7 +1045,7 @@ static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev) | |||
| 1042 | } | 1045 | } |
| 1043 | 1046 | ||
| 1044 | if (bl_entry != NULL) | 1047 | if (bl_entry != NULL) |
| 1045 | dbg_hid("Found dynamic quirk 0x%lx for HID device 0x%hx:0x%hx\n", | 1048 | dbg_hid("Found dynamic quirk 0x%lx for HID device 0x%04x:0x%04x\n", |
| 1046 | bl_entry->driver_data, bl_entry->vendor, | 1049 | bl_entry->driver_data, bl_entry->vendor, |
| 1047 | bl_entry->product); | 1050 | bl_entry->product); |
| 1048 | 1051 | ||
| @@ -1209,7 +1212,7 @@ static unsigned long hid_gets_squirk(const struct hid_device *hdev) | |||
| 1209 | quirks |= bl_entry->driver_data; | 1212 | quirks |= bl_entry->driver_data; |
| 1210 | 1213 | ||
| 1211 | if (quirks) | 1214 | if (quirks) |
| 1212 | dbg_hid("Found squirk 0x%lx for HID device 0x%hx:0x%hx\n", | 1215 | dbg_hid("Found squirk 0x%lx for HID device 0x%04x:0x%04x\n", |
| 1213 | quirks, hdev->vendor, hdev->product); | 1216 | quirks, hdev->vendor, hdev->product); |
| 1214 | return quirks; | 1217 | return quirks; |
| 1215 | } | 1218 | } |
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c index 8141cadfca0e..8dae0f9b819e 100644 --- a/drivers/hid/hid-steam.c +++ b/drivers/hid/hid-steam.c | |||
| @@ -499,6 +499,7 @@ static void steam_battery_unregister(struct steam_device *steam) | |||
| 499 | static int steam_register(struct steam_device *steam) | 499 | static int steam_register(struct steam_device *steam) |
| 500 | { | 500 | { |
| 501 | int ret; | 501 | int ret; |
| 502 | bool client_opened; | ||
| 502 | 503 | ||
| 503 | /* | 504 | /* |
| 504 | * This function can be called several times in a row with the | 505 | * This function can be called several times in a row with the |
| @@ -511,9 +512,11 @@ static int steam_register(struct steam_device *steam) | |||
| 511 | * Unlikely, but getting the serial could fail, and it is not so | 512 | * Unlikely, but getting the serial could fail, and it is not so |
| 512 | * important, so make up a serial number and go on. | 513 | * important, so make up a serial number and go on. |
| 513 | */ | 514 | */ |
| 515 | mutex_lock(&steam->mutex); | ||
| 514 | if (steam_get_serial(steam) < 0) | 516 | if (steam_get_serial(steam) < 0) |
| 515 | strlcpy(steam->serial_no, "XXXXXXXXXX", | 517 | strlcpy(steam->serial_no, "XXXXXXXXXX", |
| 516 | sizeof(steam->serial_no)); | 518 | sizeof(steam->serial_no)); |
| 519 | mutex_unlock(&steam->mutex); | ||
| 517 | 520 | ||
| 518 | hid_info(steam->hdev, "Steam Controller '%s' connected", | 521 | hid_info(steam->hdev, "Steam Controller '%s' connected", |
| 519 | steam->serial_no); | 522 | steam->serial_no); |
| @@ -528,13 +531,15 @@ static int steam_register(struct steam_device *steam) | |||
| 528 | } | 531 | } |
| 529 | 532 | ||
| 530 | mutex_lock(&steam->mutex); | 533 | mutex_lock(&steam->mutex); |
| 531 | if (!steam->client_opened) { | 534 | client_opened = steam->client_opened; |
| 535 | if (!client_opened) | ||
| 532 | steam_set_lizard_mode(steam, lizard_mode); | 536 | steam_set_lizard_mode(steam, lizard_mode); |
| 537 | mutex_unlock(&steam->mutex); | ||
| 538 | |||
| 539 | if (!client_opened) | ||
| 533 | ret = steam_input_register(steam); | 540 | ret = steam_input_register(steam); |
| 534 | } else { | 541 | else |
| 535 | ret = 0; | 542 | ret = 0; |
| 536 | } | ||
| 537 | mutex_unlock(&steam->mutex); | ||
| 538 | 543 | ||
| 539 | return ret; | 544 | return ret; |
| 540 | } | 545 | } |
| @@ -630,14 +635,21 @@ static void steam_client_ll_close(struct hid_device *hdev) | |||
| 630 | { | 635 | { |
| 631 | struct steam_device *steam = hdev->driver_data; | 636 | struct steam_device *steam = hdev->driver_data; |
| 632 | 637 | ||
| 638 | unsigned long flags; | ||
| 639 | bool connected; | ||
| 640 | |||
| 641 | spin_lock_irqsave(&steam->lock, flags); | ||
| 642 | connected = steam->connected; | ||
| 643 | spin_unlock_irqrestore(&steam->lock, flags); | ||
| 644 | |||
| 633 | mutex_lock(&steam->mutex); | 645 | mutex_lock(&steam->mutex); |
| 634 | steam->client_opened = false; | 646 | steam->client_opened = false; |
| 647 | if (connected) | ||
| 648 | steam_set_lizard_mode(steam, lizard_mode); | ||
| 635 | mutex_unlock(&steam->mutex); | 649 | mutex_unlock(&steam->mutex); |
| 636 | 650 | ||
| 637 | if (steam->connected) { | 651 | if (connected) |
| 638 | steam_set_lizard_mode(steam, lizard_mode); | ||
| 639 | steam_input_register(steam); | 652 | steam_input_register(steam); |
| 640 | } | ||
| 641 | } | 653 | } |
| 642 | 654 | ||
| 643 | static int steam_client_ll_raw_request(struct hid_device *hdev, | 655 | static int steam_client_ll_raw_request(struct hid_device *hdev, |
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 7710d9f957da..0187c9f8fc22 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c | |||
| @@ -735,10 +735,6 @@ static int uclogic_params_huion_init(struct uclogic_params *params, | |||
| 735 | goto cleanup; | 735 | goto cleanup; |
| 736 | } | 736 | } |
| 737 | rc = usb_string(udev, 201, ver_ptr, ver_len); | 737 | rc = usb_string(udev, 201, ver_ptr, ver_len); |
| 738 | if (ver_ptr == NULL) { | ||
| 739 | rc = -ENOMEM; | ||
| 740 | goto cleanup; | ||
| 741 | } | ||
| 742 | if (rc == -EPIPE) { | 738 | if (rc == -EPIPE) { |
| 743 | *ver_ptr = '\0'; | 739 | *ver_ptr = '\0'; |
| 744 | } else if (rc < 0) { | 740 | } else if (rc < 0) { |
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index 90164fed08d3..4d1f24ee249c 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c | |||
| @@ -184,6 +184,8 @@ static const struct i2c_hid_quirks { | |||
| 184 | I2C_HID_QUIRK_NO_RUNTIME_PM }, | 184 | I2C_HID_QUIRK_NO_RUNTIME_PM }, |
| 185 | { USB_VENDOR_ID_ELAN, HID_ANY_ID, | 185 | { USB_VENDOR_ID_ELAN, HID_ANY_ID, |
| 186 | I2C_HID_QUIRK_BOGUS_IRQ }, | 186 | I2C_HID_QUIRK_BOGUS_IRQ }, |
| 187 | { USB_VENDOR_ID_SYNAPTICS, I2C_DEVICE_ID_SYNAPTICS_7E7E, | ||
| 188 | I2C_HID_QUIRK_NO_RUNTIME_PM }, | ||
| 187 | { 0, 0 } | 189 | { 0, 0 } |
| 188 | }; | 190 | }; |
| 189 | 191 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 6f929bfa9fcd..d0f1dfe2bcbb 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
| @@ -1759,6 +1759,7 @@ config SENSORS_VT8231 | |||
| 1759 | config SENSORS_W83773G | 1759 | config SENSORS_W83773G |
| 1760 | tristate "Nuvoton W83773G" | 1760 | tristate "Nuvoton W83773G" |
| 1761 | depends on I2C | 1761 | depends on I2C |
| 1762 | select REGMAP_I2C | ||
| 1762 | help | 1763 | help |
| 1763 | If you say yes here you get support for the Nuvoton W83773G hardware | 1764 | If you say yes here you get support for the Nuvoton W83773G hardware |
| 1764 | monitoring chip. | 1765 | monitoring chip. |
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index e4f9f7ce92fa..f9abeeeead9e 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c | |||
| @@ -640,7 +640,7 @@ static const struct hwmon_channel_info ntc_chip = { | |||
| 640 | }; | 640 | }; |
| 641 | 641 | ||
| 642 | static const u32 ntc_temp_config[] = { | 642 | static const u32 ntc_temp_config[] = { |
| 643 | HWMON_T_INPUT, HWMON_T_TYPE, | 643 | HWMON_T_INPUT | HWMON_T_TYPE, |
| 644 | 0 | 644 | 0 |
| 645 | }; | 645 | }; |
| 646 | 646 | ||
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c index b91a80abf724..4679acb4918e 100644 --- a/drivers/hwmon/occ/common.c +++ b/drivers/hwmon/occ/common.c | |||
| @@ -890,6 +890,8 @@ static int occ_setup_sensor_attrs(struct occ *occ) | |||
| 890 | s++; | 890 | s++; |
| 891 | } | 891 | } |
| 892 | } | 892 | } |
| 893 | |||
| 894 | s = (sensors->power.num_sensors * 4) + 1; | ||
| 893 | } else { | 895 | } else { |
| 894 | for (i = 0; i < sensors->power.num_sensors; ++i) { | 896 | for (i = 0; i < sensors->power.num_sensors; ++i) { |
| 895 | s = i + 1; | 897 | s = i + 1; |
| @@ -918,11 +920,11 @@ static int occ_setup_sensor_attrs(struct occ *occ) | |||
| 918 | show_power, NULL, 3, i); | 920 | show_power, NULL, 3, i); |
| 919 | attr++; | 921 | attr++; |
| 920 | } | 922 | } |
| 921 | } | ||
| 922 | 923 | ||
| 923 | if (sensors->caps.num_sensors >= 1) { | ||
| 924 | s = sensors->power.num_sensors + 1; | 924 | s = sensors->power.num_sensors + 1; |
| 925 | } | ||
| 925 | 926 | ||
| 927 | if (sensors->caps.num_sensors >= 1) { | ||
| 926 | snprintf(attr->name, sizeof(attr->name), "power%d_label", s); | 928 | snprintf(attr->name, sizeof(attr->name), "power%d_label", s); |
| 927 | attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_caps, NULL, | 929 | attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_caps, NULL, |
| 928 | 0, 0); | 930 | 0, 0); |
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index bb8e3f149979..d464799e40a3 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c | |||
| @@ -426,8 +426,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
| 426 | 426 | ||
| 427 | pm_runtime_get_sync(dev->dev); | 427 | pm_runtime_get_sync(dev->dev); |
| 428 | 428 | ||
| 429 | if (dev->suspended) { | 429 | if (dev_WARN_ONCE(dev->dev, dev->suspended, "Transfer while suspended\n")) { |
| 430 | dev_err(dev->dev, "Error %s call while suspended\n", __func__); | ||
| 431 | ret = -ESHUTDOWN; | 430 | ret = -ESHUTDOWN; |
| 432 | goto done_nolock; | 431 | goto done_nolock; |
| 433 | } | 432 | } |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 42fed40198a0..fd70b110e8f4 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
| @@ -515,9 +515,9 @@ static int i2c_imx_clk_notifier_call(struct notifier_block *nb, | |||
| 515 | unsigned long action, void *data) | 515 | unsigned long action, void *data) |
| 516 | { | 516 | { |
| 517 | struct clk_notifier_data *ndata = data; | 517 | struct clk_notifier_data *ndata = data; |
| 518 | struct imx_i2c_struct *i2c_imx = container_of(&ndata->clk, | 518 | struct imx_i2c_struct *i2c_imx = container_of(nb, |
| 519 | struct imx_i2c_struct, | 519 | struct imx_i2c_struct, |
| 520 | clk); | 520 | clk_change_nb); |
| 521 | 521 | ||
| 522 | if (action & POST_RATE_CHANGE) | 522 | if (action & POST_RATE_CHANGE) |
| 523 | i2c_imx_set_clk(i2c_imx, ndata->new_rate); | 523 | i2c_imx_set_clk(i2c_imx, ndata->new_rate); |
| @@ -1169,11 +1169,13 @@ static int i2c_imx_probe(struct platform_device *pdev) | |||
| 1169 | /* Init DMA config if supported */ | 1169 | /* Init DMA config if supported */ |
| 1170 | ret = i2c_imx_dma_request(i2c_imx, phy_addr); | 1170 | ret = i2c_imx_dma_request(i2c_imx, phy_addr); |
| 1171 | if (ret < 0) | 1171 | if (ret < 0) |
| 1172 | goto clk_notifier_unregister; | 1172 | goto del_adapter; |
| 1173 | 1173 | ||
| 1174 | dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n"); | 1174 | dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n"); |
| 1175 | return 0; /* Return OK */ | 1175 | return 0; /* Return OK */ |
| 1176 | 1176 | ||
| 1177 | del_adapter: | ||
| 1178 | i2c_del_adapter(&i2c_imx->adapter); | ||
| 1177 | clk_notifier_unregister: | 1179 | clk_notifier_unregister: |
| 1178 | clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb); | 1180 | clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb); |
| 1179 | rpm_disable: | 1181 | rpm_disable: |
diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c index d18b0941b71a..f14d4b3fab44 100644 --- a/drivers/i2c/busses/i2c-synquacer.c +++ b/drivers/i2c/busses/i2c-synquacer.c | |||
| @@ -597,6 +597,8 @@ static int synquacer_i2c_probe(struct platform_device *pdev) | |||
| 597 | i2c->adapter = synquacer_i2c_ops; | 597 | i2c->adapter = synquacer_i2c_ops; |
| 598 | i2c_set_adapdata(&i2c->adapter, i2c); | 598 | i2c_set_adapdata(&i2c->adapter, i2c); |
| 599 | i2c->adapter.dev.parent = &pdev->dev; | 599 | i2c->adapter.dev.parent = &pdev->dev; |
| 600 | i2c->adapter.dev.of_node = pdev->dev.of_node; | ||
| 601 | ACPI_COMPANION_SET(&i2c->adapter.dev, ACPI_COMPANION(&pdev->dev)); | ||
| 600 | i2c->adapter.nr = pdev->id; | 602 | i2c->adapter.nr = pdev->id; |
| 601 | init_completion(&i2c->completion); | 603 | init_completion(&i2c->completion); |
| 602 | 604 | ||
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 38af18645133..688aa3b5f3ac 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c | |||
| @@ -185,7 +185,7 @@ static int i2c_generic_bus_free(struct i2c_adapter *adap) | |||
| 185 | int i2c_generic_scl_recovery(struct i2c_adapter *adap) | 185 | int i2c_generic_scl_recovery(struct i2c_adapter *adap) |
| 186 | { | 186 | { |
| 187 | struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; | 187 | struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; |
| 188 | int i = 0, scl = 1, ret; | 188 | int i = 0, scl = 1, ret = 0; |
| 189 | 189 | ||
| 190 | if (bri->prepare_recovery) | 190 | if (bri->prepare_recovery) |
| 191 | bri->prepare_recovery(adap); | 191 | bri->prepare_recovery(adap); |
| @@ -327,6 +327,8 @@ static int i2c_device_probe(struct device *dev) | |||
| 327 | 327 | ||
| 328 | if (client->flags & I2C_CLIENT_HOST_NOTIFY) { | 328 | if (client->flags & I2C_CLIENT_HOST_NOTIFY) { |
| 329 | dev_dbg(dev, "Using Host Notify IRQ\n"); | 329 | dev_dbg(dev, "Using Host Notify IRQ\n"); |
| 330 | /* Keep adapter active when Host Notify is required */ | ||
| 331 | pm_runtime_get_sync(&client->adapter->dev); | ||
| 330 | irq = i2c_smbus_host_notify_to_irq(client); | 332 | irq = i2c_smbus_host_notify_to_irq(client); |
| 331 | } else if (dev->of_node) { | 333 | } else if (dev->of_node) { |
| 332 | irq = of_irq_get_byname(dev->of_node, "irq"); | 334 | irq = of_irq_get_byname(dev->of_node, "irq"); |
| @@ -431,6 +433,8 @@ static int i2c_device_remove(struct device *dev) | |||
| 431 | device_init_wakeup(&client->dev, false); | 433 | device_init_wakeup(&client->dev, false); |
| 432 | 434 | ||
| 433 | client->irq = client->init_irq; | 435 | client->irq = client->init_irq; |
| 436 | if (client->flags & I2C_CLIENT_HOST_NOTIFY) | ||
| 437 | pm_runtime_put(&client->adapter->dev); | ||
| 434 | 438 | ||
| 435 | return status; | 439 | return status; |
| 436 | } | 440 | } |
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 2dc628d4f1ae..1412abcff010 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c | |||
| @@ -1980,7 +1980,6 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, | |||
| 1980 | { | 1980 | { |
| 1981 | struct i3c_dev_boardinfo *boardinfo; | 1981 | struct i3c_dev_boardinfo *boardinfo; |
| 1982 | struct device *dev = &master->dev; | 1982 | struct device *dev = &master->dev; |
| 1983 | struct i3c_device_info info = { }; | ||
| 1984 | enum i3c_addr_slot_status addrstatus; | 1983 | enum i3c_addr_slot_status addrstatus; |
| 1985 | u32 init_dyn_addr = 0; | 1984 | u32 init_dyn_addr = 0; |
| 1986 | 1985 | ||
| @@ -2012,8 +2011,8 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, | |||
| 2012 | 2011 | ||
| 2013 | boardinfo->pid = ((u64)reg[1] << 32) | reg[2]; | 2012 | boardinfo->pid = ((u64)reg[1] << 32) | reg[2]; |
| 2014 | 2013 | ||
| 2015 | if ((info.pid & GENMASK_ULL(63, 48)) || | 2014 | if ((boardinfo->pid & GENMASK_ULL(63, 48)) || |
| 2016 | I3C_PID_RND_LOWER_32BITS(info.pid)) | 2015 | I3C_PID_RND_LOWER_32BITS(boardinfo->pid)) |
| 2017 | return -EINVAL; | 2016 | return -EINVAL; |
| 2018 | 2017 | ||
| 2019 | boardinfo->init_dyn_addr = init_dyn_addr; | 2018 | boardinfo->init_dyn_addr = init_dyn_addr; |
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c index 59279224e07f..10c26ffaa8ef 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c | |||
| @@ -300,7 +300,7 @@ to_dw_i3c_master(struct i3c_master_controller *master) | |||
| 300 | 300 | ||
| 301 | static void dw_i3c_master_disable(struct dw_i3c_master *master) | 301 | static void dw_i3c_master_disable(struct dw_i3c_master *master) |
| 302 | { | 302 | { |
| 303 | writel(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_ENABLE, | 303 | writel(readl(master->regs + DEVICE_CTRL) & ~DEV_CTRL_ENABLE, |
| 304 | master->regs + DEVICE_CTRL); | 304 | master->regs + DEVICE_CTRL); |
| 305 | } | 305 | } |
| 306 | 306 | ||
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 7096e577b23f..50f3ff386bea 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c | |||
| @@ -1437,6 +1437,8 @@ static int kxcjk1013_resume(struct device *dev) | |||
| 1437 | 1437 | ||
| 1438 | mutex_lock(&data->mutex); | 1438 | mutex_lock(&data->mutex); |
| 1439 | ret = kxcjk1013_set_mode(data, OPERATION); | 1439 | ret = kxcjk1013_set_mode(data, OPERATION); |
| 1440 | if (ret == 0) | ||
| 1441 | ret = kxcjk1013_set_range(data, data->range); | ||
| 1440 | mutex_unlock(&data->mutex); | 1442 | mutex_unlock(&data->mutex); |
| 1441 | 1443 | ||
| 1442 | return ret; | 1444 | return ret; |
diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index ff5f2da2e1b1..54d9978b2740 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c | |||
| @@ -121,6 +121,7 @@ static int ad_sd_read_reg_raw(struct ad_sigma_delta *sigma_delta, | |||
| 121 | if (sigma_delta->info->has_registers) { | 121 | if (sigma_delta->info->has_registers) { |
| 122 | data[0] = reg << sigma_delta->info->addr_shift; | 122 | data[0] = reg << sigma_delta->info->addr_shift; |
| 123 | data[0] |= sigma_delta->info->read_mask; | 123 | data[0] |= sigma_delta->info->read_mask; |
| 124 | data[0] |= sigma_delta->comm; | ||
| 124 | spi_message_add_tail(&t[0], &m); | 125 | spi_message_add_tail(&t[0], &m); |
| 125 | } | 126 | } |
| 126 | spi_message_add_tail(&t[1], &m); | 127 | spi_message_add_tail(&t[1], &m); |
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 75d2f73582a3..596841a3c4db 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
| @@ -704,23 +704,29 @@ static int at91_adc_read_raw(struct iio_dev *idev, | |||
| 704 | ret = wait_event_interruptible_timeout(st->wq_data_avail, | 704 | ret = wait_event_interruptible_timeout(st->wq_data_avail, |
| 705 | st->done, | 705 | st->done, |
| 706 | msecs_to_jiffies(1000)); | 706 | msecs_to_jiffies(1000)); |
| 707 | if (ret == 0) | ||
| 708 | ret = -ETIMEDOUT; | ||
| 709 | if (ret < 0) { | ||
| 710 | mutex_unlock(&st->lock); | ||
| 711 | return ret; | ||
| 712 | } | ||
| 713 | |||
| 714 | *val = st->last_value; | ||
| 715 | 707 | ||
| 708 | /* Disable interrupts, regardless if adc conversion was | ||
| 709 | * successful or not | ||
| 710 | */ | ||
| 716 | at91_adc_writel(st, AT91_ADC_CHDR, | 711 | at91_adc_writel(st, AT91_ADC_CHDR, |
| 717 | AT91_ADC_CH(chan->channel)); | 712 | AT91_ADC_CH(chan->channel)); |
| 718 | at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); | 713 | at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); |
| 719 | 714 | ||
| 720 | st->last_value = 0; | 715 | if (ret > 0) { |
| 721 | st->done = false; | 716 | /* a valid conversion took place */ |
| 717 | *val = st->last_value; | ||
| 718 | st->last_value = 0; | ||
| 719 | st->done = false; | ||
| 720 | ret = IIO_VAL_INT; | ||
| 721 | } else if (ret == 0) { | ||
| 722 | /* conversion timeout */ | ||
| 723 | dev_err(&idev->dev, "ADC Channel %d timeout.\n", | ||
| 724 | chan->channel); | ||
| 725 | ret = -ETIMEDOUT; | ||
| 726 | } | ||
| 727 | |||
| 722 | mutex_unlock(&st->lock); | 728 | mutex_unlock(&st->lock); |
| 723 | return IIO_VAL_INT; | 729 | return ret; |
| 724 | 730 | ||
| 725 | case IIO_CHAN_INFO_SCALE: | 731 | case IIO_CHAN_INFO_SCALE: |
| 726 | *val = st->vref_mv; | 732 | *val = st->vref_mv; |
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index b13c61539d46..6401ca7a9a20 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c | |||
| @@ -1292,6 +1292,7 @@ static int xadc_probe(struct platform_device *pdev) | |||
| 1292 | 1292 | ||
| 1293 | err_free_irq: | 1293 | err_free_irq: |
| 1294 | free_irq(xadc->irq, indio_dev); | 1294 | free_irq(xadc->irq, indio_dev); |
| 1295 | cancel_delayed_work_sync(&xadc->zynq_unmask_work); | ||
| 1295 | err_clk_disable_unprepare: | 1296 | err_clk_disable_unprepare: |
| 1296 | clk_disable_unprepare(xadc->clk); | 1297 | clk_disable_unprepare(xadc->clk); |
| 1297 | err_free_samplerate_trigger: | 1298 | err_free_samplerate_trigger: |
| @@ -1321,8 +1322,8 @@ static int xadc_remove(struct platform_device *pdev) | |||
| 1321 | iio_triggered_buffer_cleanup(indio_dev); | 1322 | iio_triggered_buffer_cleanup(indio_dev); |
| 1322 | } | 1323 | } |
| 1323 | free_irq(xadc->irq, indio_dev); | 1324 | free_irq(xadc->irq, indio_dev); |
| 1325 | cancel_delayed_work_sync(&xadc->zynq_unmask_work); | ||
| 1324 | clk_disable_unprepare(xadc->clk); | 1326 | clk_disable_unprepare(xadc->clk); |
| 1325 | cancel_delayed_work(&xadc->zynq_unmask_work); | ||
| 1326 | kfree(xadc->data); | 1327 | kfree(xadc->data); |
| 1327 | kfree(indio_dev->channels); | 1328 | kfree(indio_dev->channels); |
| 1328 | 1329 | ||
diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig index d5d146e9e372..92c684d2b67e 100644 --- a/drivers/iio/chemical/Kconfig +++ b/drivers/iio/chemical/Kconfig | |||
| @@ -64,6 +64,7 @@ config IAQCORE | |||
| 64 | config PMS7003 | 64 | config PMS7003 |
| 65 | tristate "Plantower PMS7003 particulate matter sensor" | 65 | tristate "Plantower PMS7003 particulate matter sensor" |
| 66 | depends on SERIAL_DEV_BUS | 66 | depends on SERIAL_DEV_BUS |
| 67 | select IIO_TRIGGERED_BUFFER | ||
| 67 | help | 68 | help |
| 68 | Say Y here to build support for the Plantower PMS7003 particulate | 69 | Say Y here to build support for the Plantower PMS7003 particulate |
| 69 | matter sensor. | 70 | matter sensor. |
| @@ -71,6 +72,19 @@ config PMS7003 | |||
| 71 | To compile this driver as a module, choose M here: the module will | 72 | To compile this driver as a module, choose M here: the module will |
| 72 | be called pms7003. | 73 | be called pms7003. |
| 73 | 74 | ||
| 75 | config SENSIRION_SGP30 | ||
| 76 | tristate "Sensirion SGPxx gas sensors" | ||
| 77 | depends on I2C | ||
| 78 | select CRC8 | ||
| 79 | help | ||
| 80 | Say Y here to build I2C interface support for the following | ||
| 81 | Sensirion SGP gas sensors: | ||
| 82 | * SGP30 gas sensor | ||
| 83 | * SGPC3 low power gas sensor | ||
| 84 | |||
| 85 | To compile this driver as module, choose M here: the | ||
| 86 | module will be called sgp30. | ||
| 87 | |||
| 74 | config SPS30 | 88 | config SPS30 |
| 75 | tristate "SPS30 particulate matter sensor" | 89 | tristate "SPS30 particulate matter sensor" |
| 76 | depends on I2C | 90 | depends on I2C |
diff --git a/drivers/iio/chemical/bme680.h b/drivers/iio/chemical/bme680.h index 0ae89b87e2d6..4edc5d21cb9f 100644 --- a/drivers/iio/chemical/bme680.h +++ b/drivers/iio/chemical/bme680.h | |||
| @@ -2,11 +2,9 @@ | |||
| 2 | #ifndef BME680_H_ | 2 | #ifndef BME680_H_ |
| 3 | #define BME680_H_ | 3 | #define BME680_H_ |
| 4 | 4 | ||
| 5 | #define BME680_REG_CHIP_I2C_ID 0xD0 | 5 | #define BME680_REG_CHIP_ID 0xD0 |
| 6 | #define BME680_REG_CHIP_SPI_ID 0x50 | ||
| 7 | #define BME680_CHIP_ID_VAL 0x61 | 6 | #define BME680_CHIP_ID_VAL 0x61 |
| 8 | #define BME680_REG_SOFT_RESET_I2C 0xE0 | 7 | #define BME680_REG_SOFT_RESET 0xE0 |
| 9 | #define BME680_REG_SOFT_RESET_SPI 0x60 | ||
| 10 | #define BME680_CMD_SOFTRESET 0xB6 | 8 | #define BME680_CMD_SOFTRESET 0xB6 |
| 11 | #define BME680_REG_STATUS 0x73 | 9 | #define BME680_REG_STATUS 0x73 |
| 12 | #define BME680_SPI_MEM_PAGE_BIT BIT(4) | 10 | #define BME680_SPI_MEM_PAGE_BIT BIT(4) |
diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c index 70c1fe4366f4..ccde4c65ff93 100644 --- a/drivers/iio/chemical/bme680_core.c +++ b/drivers/iio/chemical/bme680_core.c | |||
| @@ -63,9 +63,23 @@ struct bme680_data { | |||
| 63 | s32 t_fine; | 63 | s32 t_fine; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | static const struct regmap_range bme680_volatile_ranges[] = { | ||
| 67 | regmap_reg_range(BME680_REG_MEAS_STAT_0, BME680_REG_GAS_R_LSB), | ||
| 68 | regmap_reg_range(BME680_REG_STATUS, BME680_REG_STATUS), | ||
| 69 | regmap_reg_range(BME680_T2_LSB_REG, BME680_GH3_REG), | ||
| 70 | }; | ||
| 71 | |||
| 72 | static const struct regmap_access_table bme680_volatile_table = { | ||
| 73 | .yes_ranges = bme680_volatile_ranges, | ||
| 74 | .n_yes_ranges = ARRAY_SIZE(bme680_volatile_ranges), | ||
| 75 | }; | ||
| 76 | |||
| 66 | const struct regmap_config bme680_regmap_config = { | 77 | const struct regmap_config bme680_regmap_config = { |
| 67 | .reg_bits = 8, | 78 | .reg_bits = 8, |
| 68 | .val_bits = 8, | 79 | .val_bits = 8, |
| 80 | .max_register = 0xef, | ||
| 81 | .volatile_table = &bme680_volatile_table, | ||
| 82 | .cache_type = REGCACHE_RBTREE, | ||
| 69 | }; | 83 | }; |
| 70 | EXPORT_SYMBOL(bme680_regmap_config); | 84 | EXPORT_SYMBOL(bme680_regmap_config); |
| 71 | 85 | ||
| @@ -316,6 +330,10 @@ static s16 bme680_compensate_temp(struct bme680_data *data, | |||
| 316 | s64 var1, var2, var3; | 330 | s64 var1, var2, var3; |
| 317 | s16 calc_temp; | 331 | s16 calc_temp; |
| 318 | 332 | ||
| 333 | /* If the calibration is invalid, attempt to reload it */ | ||
| 334 | if (!calib->par_t2) | ||
| 335 | bme680_read_calib(data, calib); | ||
| 336 | |||
| 319 | var1 = (adc_temp >> 3) - (calib->par_t1 << 1); | 337 | var1 = (adc_temp >> 3) - (calib->par_t1 << 1); |
| 320 | var2 = (var1 * calib->par_t2) >> 11; | 338 | var2 = (var1 * calib->par_t2) >> 11; |
| 321 | var3 = ((var1 >> 1) * (var1 >> 1)) >> 12; | 339 | var3 = ((var1 >> 1) * (var1 >> 1)) >> 12; |
| @@ -583,8 +601,7 @@ static int bme680_gas_config(struct bme680_data *data) | |||
| 583 | return ret; | 601 | return ret; |
| 584 | } | 602 | } |
| 585 | 603 | ||
| 586 | static int bme680_read_temp(struct bme680_data *data, | 604 | static int bme680_read_temp(struct bme680_data *data, int *val) |
| 587 | int *val, int *val2) | ||
| 588 | { | 605 | { |
| 589 | struct device *dev = regmap_get_device(data->regmap); | 606 | struct device *dev = regmap_get_device(data->regmap); |
| 590 | int ret; | 607 | int ret; |
| @@ -617,10 +634,9 @@ static int bme680_read_temp(struct bme680_data *data, | |||
| 617 | * compensate_press/compensate_humid to get compensated | 634 | * compensate_press/compensate_humid to get compensated |
| 618 | * pressure/humidity readings. | 635 | * pressure/humidity readings. |
| 619 | */ | 636 | */ |
| 620 | if (val && val2) { | 637 | if (val) { |
| 621 | *val = comp_temp; | 638 | *val = comp_temp * 10; /* Centidegrees to millidegrees */ |
| 622 | *val2 = 100; | 639 | return IIO_VAL_INT; |
| 623 | return IIO_VAL_FRACTIONAL; | ||
| 624 | } | 640 | } |
| 625 | 641 | ||
| 626 | return ret; | 642 | return ret; |
| @@ -635,7 +651,7 @@ static int bme680_read_press(struct bme680_data *data, | |||
| 635 | s32 adc_press; | 651 | s32 adc_press; |
| 636 | 652 | ||
| 637 | /* Read and compensate temperature to get a reading of t_fine */ | 653 | /* Read and compensate temperature to get a reading of t_fine */ |
| 638 | ret = bme680_read_temp(data, NULL, NULL); | 654 | ret = bme680_read_temp(data, NULL); |
| 639 | if (ret < 0) | 655 | if (ret < 0) |
| 640 | return ret; | 656 | return ret; |
| 641 | 657 | ||
| @@ -668,7 +684,7 @@ static int bme680_read_humid(struct bme680_data *data, | |||
| 668 | u32 comp_humidity; | 684 | u32 comp_humidity; |
| 669 | 685 | ||
| 670 | /* Read and compensate temperature to get a reading of t_fine */ | 686 | /* Read and compensate temperature to get a reading of t_fine */ |
| 671 | ret = bme680_read_temp(data, NULL, NULL); | 687 | ret = bme680_read_temp(data, NULL); |
| 672 | if (ret < 0) | 688 | if (ret < 0) |
| 673 | return ret; | 689 | return ret; |
| 674 | 690 | ||
| @@ -761,7 +777,7 @@ static int bme680_read_raw(struct iio_dev *indio_dev, | |||
| 761 | case IIO_CHAN_INFO_PROCESSED: | 777 | case IIO_CHAN_INFO_PROCESSED: |
| 762 | switch (chan->type) { | 778 | switch (chan->type) { |
| 763 | case IIO_TEMP: | 779 | case IIO_TEMP: |
| 764 | return bme680_read_temp(data, val, val2); | 780 | return bme680_read_temp(data, val); |
| 765 | case IIO_PRESSURE: | 781 | case IIO_PRESSURE: |
| 766 | return bme680_read_press(data, val, val2); | 782 | return bme680_read_press(data, val, val2); |
| 767 | case IIO_HUMIDITYRELATIVE: | 783 | case IIO_HUMIDITYRELATIVE: |
| @@ -867,8 +883,28 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap, | |||
| 867 | { | 883 | { |
| 868 | struct iio_dev *indio_dev; | 884 | struct iio_dev *indio_dev; |
| 869 | struct bme680_data *data; | 885 | struct bme680_data *data; |
| 886 | unsigned int val; | ||
| 870 | int ret; | 887 | int ret; |
| 871 | 888 | ||
| 889 | ret = regmap_write(regmap, BME680_REG_SOFT_RESET, | ||
| 890 | BME680_CMD_SOFTRESET); | ||
| 891 | if (ret < 0) { | ||
| 892 | dev_err(dev, "Failed to reset chip\n"); | ||
| 893 | return ret; | ||
| 894 | } | ||
| 895 | |||
| 896 | ret = regmap_read(regmap, BME680_REG_CHIP_ID, &val); | ||
| 897 | if (ret < 0) { | ||
| 898 | dev_err(dev, "Error reading chip ID\n"); | ||
| 899 | return ret; | ||
| 900 | } | ||
| 901 | |||
| 902 | if (val != BME680_CHIP_ID_VAL) { | ||
| 903 | dev_err(dev, "Wrong chip ID, got %x expected %x\n", | ||
| 904 | val, BME680_CHIP_ID_VAL); | ||
| 905 | return -ENODEV; | ||
| 906 | } | ||
| 907 | |||
| 872 | indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); | 908 | indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); |
| 873 | if (!indio_dev) | 909 | if (!indio_dev) |
| 874 | return -ENOMEM; | 910 | return -ENOMEM; |
diff --git a/drivers/iio/chemical/bme680_i2c.c b/drivers/iio/chemical/bme680_i2c.c index b2f805b6b36a..de9c9e3d23ea 100644 --- a/drivers/iio/chemical/bme680_i2c.c +++ b/drivers/iio/chemical/bme680_i2c.c | |||
| @@ -23,8 +23,6 @@ static int bme680_i2c_probe(struct i2c_client *client, | |||
| 23 | { | 23 | { |
| 24 | struct regmap *regmap; | 24 | struct regmap *regmap; |
| 25 | const char *name = NULL; | 25 | const char *name = NULL; |
| 26 | unsigned int val; | ||
| 27 | int ret; | ||
| 28 | 26 | ||
| 29 | regmap = devm_regmap_init_i2c(client, &bme680_regmap_config); | 27 | regmap = devm_regmap_init_i2c(client, &bme680_regmap_config); |
| 30 | if (IS_ERR(regmap)) { | 28 | if (IS_ERR(regmap)) { |
| @@ -33,25 +31,6 @@ static int bme680_i2c_probe(struct i2c_client *client, | |||
| 33 | return PTR_ERR(regmap); | 31 | return PTR_ERR(regmap); |
| 34 | } | 32 | } |
| 35 | 33 | ||
| 36 | ret = regmap_write(regmap, BME680_REG_SOFT_RESET_I2C, | ||
| 37 | BME680_CMD_SOFTRESET); | ||
| 38 | if (ret < 0) { | ||
| 39 | dev_err(&client->dev, "Failed to reset chip\n"); | ||
| 40 | return ret; | ||
| 41 | } | ||
| 42 | |||
| 43 | ret = regmap_read(regmap, BME680_REG_CHIP_I2C_ID, &val); | ||
| 44 | if (ret < 0) { | ||
| 45 | dev_err(&client->dev, "Error reading I2C chip ID\n"); | ||
| 46 | return ret; | ||
| 47 | } | ||
| 48 | |||
| 49 | if (val != BME680_CHIP_ID_VAL) { | ||
| 50 | dev_err(&client->dev, "Wrong chip ID, got %x expected %x\n", | ||
| 51 | val, BME680_CHIP_ID_VAL); | ||
| 52 | return -ENODEV; | ||
| 53 | } | ||
| 54 | |||
| 55 | if (id) | 34 | if (id) |
| 56 | name = id->name; | 35 | name = id->name; |
| 57 | 36 | ||
diff --git a/drivers/iio/chemical/bme680_spi.c b/drivers/iio/chemical/bme680_spi.c index d0b7bdd3f066..3b838068a7e4 100644 --- a/drivers/iio/chemical/bme680_spi.c +++ b/drivers/iio/chemical/bme680_spi.c | |||
| @@ -12,28 +12,93 @@ | |||
| 12 | 12 | ||
| 13 | #include "bme680.h" | 13 | #include "bme680.h" |
| 14 | 14 | ||
| 15 | struct bme680_spi_bus_context { | ||
| 16 | struct spi_device *spi; | ||
| 17 | u8 current_page; | ||
| 18 | }; | ||
| 19 | |||
| 20 | /* | ||
| 21 | * In SPI mode there are only 7 address bits, a "page" register determines | ||
| 22 | * which part of the 8-bit range is active. This function looks at the address | ||
| 23 | * and writes the page selection bit if needed | ||
| 24 | */ | ||
| 25 | static int bme680_regmap_spi_select_page( | ||
| 26 | struct bme680_spi_bus_context *ctx, u8 reg) | ||
| 27 | { | ||
| 28 | struct spi_device *spi = ctx->spi; | ||
| 29 | int ret; | ||
| 30 | u8 buf[2]; | ||
| 31 | u8 page = (reg & 0x80) ? 0 : 1; /* Page "1" is low range */ | ||
| 32 | |||
| 33 | if (page == ctx->current_page) | ||
| 34 | return 0; | ||
| 35 | |||
| 36 | /* | ||
| 37 | * Data sheet claims we're only allowed to change bit 4, so we must do | ||
| 38 | * a read-modify-write on each and every page select | ||
| 39 | */ | ||
| 40 | buf[0] = BME680_REG_STATUS; | ||
| 41 | ret = spi_write_then_read(spi, buf, 1, buf + 1, 1); | ||
| 42 | if (ret < 0) { | ||
| 43 | dev_err(&spi->dev, "failed to set page %u\n", page); | ||
| 44 | return ret; | ||
| 45 | } | ||
| 46 | |||
| 47 | buf[0] = BME680_REG_STATUS; | ||
| 48 | if (page) | ||
| 49 | buf[1] |= BME680_SPI_MEM_PAGE_BIT; | ||
| 50 | else | ||
| 51 | buf[1] &= ~BME680_SPI_MEM_PAGE_BIT; | ||
| 52 | |||
| 53 | ret = spi_write(spi, buf, 2); | ||
| 54 | if (ret < 0) { | ||
| 55 | dev_err(&spi->dev, "failed to set page %u\n", page); | ||
| 56 | return ret; | ||
| 57 | } | ||
| 58 | |||
| 59 | ctx->current_page = page; | ||
| 60 | |||
| 61 | return 0; | ||
| 62 | } | ||
| 63 | |||
| 15 | static int bme680_regmap_spi_write(void *context, const void *data, | 64 | static int bme680_regmap_spi_write(void *context, const void *data, |
| 16 | size_t count) | 65 | size_t count) |
| 17 | { | 66 | { |
| 18 | struct spi_device *spi = context; | 67 | struct bme680_spi_bus_context *ctx = context; |
| 68 | struct spi_device *spi = ctx->spi; | ||
| 69 | int ret; | ||
| 19 | u8 buf[2]; | 70 | u8 buf[2]; |
| 20 | 71 | ||
| 21 | memcpy(buf, data, 2); | 72 | memcpy(buf, data, 2); |
| 73 | |||
| 74 | ret = bme680_regmap_spi_select_page(ctx, buf[0]); | ||
| 75 | if (ret) | ||
| 76 | return ret; | ||
| 77 | |||
| 22 | /* | 78 | /* |
| 23 | * The SPI register address (= full register address without bit 7) | 79 | * The SPI register address (= full register address without bit 7) |
| 24 | * and the write command (bit7 = RW = '0') | 80 | * and the write command (bit7 = RW = '0') |
| 25 | */ | 81 | */ |
| 26 | buf[0] &= ~0x80; | 82 | buf[0] &= ~0x80; |
| 27 | 83 | ||
| 28 | return spi_write_then_read(spi, buf, 2, NULL, 0); | 84 | return spi_write(spi, buf, 2); |
| 29 | } | 85 | } |
| 30 | 86 | ||
| 31 | static int bme680_regmap_spi_read(void *context, const void *reg, | 87 | static int bme680_regmap_spi_read(void *context, const void *reg, |
| 32 | size_t reg_size, void *val, size_t val_size) | 88 | size_t reg_size, void *val, size_t val_size) |
| 33 | { | 89 | { |
| 34 | struct spi_device *spi = context; | 90 | struct bme680_spi_bus_context *ctx = context; |
| 91 | struct spi_device *spi = ctx->spi; | ||
| 92 | int ret; | ||
| 93 | u8 addr = *(const u8 *)reg; | ||
| 94 | |||
| 95 | ret = bme680_regmap_spi_select_page(ctx, addr); | ||
| 96 | if (ret) | ||
| 97 | return ret; | ||
| 35 | 98 | ||
| 36 | return spi_write_then_read(spi, reg, reg_size, val, val_size); | 99 | addr |= 0x80; /* bit7 = RW = '1' */ |
| 100 | |||
| 101 | return spi_write_then_read(spi, &addr, 1, val, val_size); | ||
| 37 | } | 102 | } |
| 38 | 103 | ||
| 39 | static struct regmap_bus bme680_regmap_bus = { | 104 | static struct regmap_bus bme680_regmap_bus = { |
| @@ -46,8 +111,8 @@ static struct regmap_bus bme680_regmap_bus = { | |||
| 46 | static int bme680_spi_probe(struct spi_device *spi) | 111 | static int bme680_spi_probe(struct spi_device *spi) |
| 47 | { | 112 | { |
| 48 | const struct spi_device_id *id = spi_get_device_id(spi); | 113 | const struct spi_device_id *id = spi_get_device_id(spi); |
| 114 | struct bme680_spi_bus_context *bus_context; | ||
| 49 | struct regmap *regmap; | 115 | struct regmap *regmap; |
| 50 | unsigned int val; | ||
| 51 | int ret; | 116 | int ret; |
| 52 | 117 | ||
| 53 | spi->bits_per_word = 8; | 118 | spi->bits_per_word = 8; |
| @@ -57,45 +122,21 @@ static int bme680_spi_probe(struct spi_device *spi) | |||
| 57 | return ret; | 122 | return ret; |
| 58 | } | 123 | } |
| 59 | 124 | ||
| 125 | bus_context = devm_kzalloc(&spi->dev, sizeof(*bus_context), GFP_KERNEL); | ||
| 126 | if (!bus_context) | ||
| 127 | return -ENOMEM; | ||
| 128 | |||
| 129 | bus_context->spi = spi; | ||
| 130 | bus_context->current_page = 0xff; /* Undefined on warm boot */ | ||
| 131 | |||
| 60 | regmap = devm_regmap_init(&spi->dev, &bme680_regmap_bus, | 132 | regmap = devm_regmap_init(&spi->dev, &bme680_regmap_bus, |
| 61 | &spi->dev, &bme680_regmap_config); | 133 | bus_context, &bme680_regmap_config); |
| 62 | if (IS_ERR(regmap)) { | 134 | if (IS_ERR(regmap)) { |
| 63 | dev_err(&spi->dev, "Failed to register spi regmap %d\n", | 135 | dev_err(&spi->dev, "Failed to register spi regmap %d\n", |
| 64 | (int)PTR_ERR(regmap)); | 136 | (int)PTR_ERR(regmap)); |
| 65 | return PTR_ERR(regmap); | 137 | return PTR_ERR(regmap); |
| 66 | } | 138 | } |
| 67 | 139 | ||
| 68 | ret = regmap_write(regmap, BME680_REG_SOFT_RESET_SPI, | ||
| 69 | BME680_CMD_SOFTRESET); | ||
| 70 | if (ret < 0) { | ||
| 71 | dev_err(&spi->dev, "Failed to reset chip\n"); | ||
| 72 | return ret; | ||
| 73 | } | ||
| 74 | |||
| 75 | /* after power-on reset, Page 0(0x80-0xFF) of spi_mem_page is active */ | ||
| 76 | ret = regmap_read(regmap, BME680_REG_CHIP_SPI_ID, &val); | ||
| 77 | if (ret < 0) { | ||
| 78 | dev_err(&spi->dev, "Error reading SPI chip ID\n"); | ||
| 79 | return ret; | ||
| 80 | } | ||
| 81 | |||
| 82 | if (val != BME680_CHIP_ID_VAL) { | ||
| 83 | dev_err(&spi->dev, "Wrong chip ID, got %x expected %x\n", | ||
| 84 | val, BME680_CHIP_ID_VAL); | ||
| 85 | return -ENODEV; | ||
| 86 | } | ||
| 87 | /* | ||
| 88 | * select Page 1 of spi_mem_page to enable access to | ||
| 89 | * to registers from address 0x00 to 0x7F. | ||
| 90 | */ | ||
| 91 | ret = regmap_write_bits(regmap, BME680_REG_STATUS, | ||
| 92 | BME680_SPI_MEM_PAGE_BIT, | ||
| 93 | BME680_SPI_MEM_PAGE_1_VAL); | ||
| 94 | if (ret < 0) { | ||
| 95 | dev_err(&spi->dev, "failed to set page 1 of spi_mem_page\n"); | ||
| 96 | return ret; | ||
| 97 | } | ||
| 98 | |||
| 99 | return bme680_core_probe(&spi->dev, regmap, id->name); | 140 | return bme680_core_probe(&spi->dev, regmap, id->name); |
| 100 | } | 141 | } |
| 101 | 142 | ||
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c index 89cb0066a6e0..8d76afb87d87 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c | |||
| @@ -103,9 +103,10 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev, | |||
| 103 | * Do not use IIO_DEGREE_TO_RAD to avoid precision | 103 | * Do not use IIO_DEGREE_TO_RAD to avoid precision |
| 104 | * loss. Round to the nearest integer. | 104 | * loss. Round to the nearest integer. |
| 105 | */ | 105 | */ |
| 106 | *val = div_s64(val64 * 314159 + 9000000ULL, 1000); | 106 | *val = 0; |
| 107 | *val2 = 18000 << (CROS_EC_SENSOR_BITS - 1); | 107 | *val2 = div_s64(val64 * 3141592653ULL, |
| 108 | ret = IIO_VAL_FRACTIONAL; | 108 | 180 << (CROS_EC_SENSOR_BITS - 1)); |
| 109 | ret = IIO_VAL_INT_PLUS_NANO; | ||
| 109 | break; | 110 | break; |
| 110 | case MOTIONSENSE_TYPE_MAG: | 111 | case MOTIONSENSE_TYPE_MAG: |
| 111 | /* | 112 | /* |
diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c index 6d71fd905e29..c701a45469f6 100644 --- a/drivers/iio/dac/mcp4725.c +++ b/drivers/iio/dac/mcp4725.c | |||
| @@ -92,6 +92,7 @@ static ssize_t mcp4725_store_eeprom(struct device *dev, | |||
| 92 | 92 | ||
| 93 | inoutbuf[0] = 0x60; /* write EEPROM */ | 93 | inoutbuf[0] = 0x60; /* write EEPROM */ |
| 94 | inoutbuf[0] |= data->ref_mode << 3; | 94 | inoutbuf[0] |= data->ref_mode << 3; |
| 95 | inoutbuf[0] |= data->powerdown ? ((data->powerdown_mode + 1) << 1) : 0; | ||
| 95 | inoutbuf[1] = data->dac_value >> 4; | 96 | inoutbuf[1] = data->dac_value >> 4; |
| 96 | inoutbuf[2] = (data->dac_value & 0xf) << 4; | 97 | inoutbuf[2] = (data->dac_value & 0xf) << 4; |
| 97 | 98 | ||
diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c index 63ca31628a93..92c07ab826eb 100644 --- a/drivers/iio/gyro/bmg160_core.c +++ b/drivers/iio/gyro/bmg160_core.c | |||
| @@ -582,11 +582,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, | |||
| 582 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: | 582 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: |
| 583 | return bmg160_get_filter(data, val); | 583 | return bmg160_get_filter(data, val); |
| 584 | case IIO_CHAN_INFO_SCALE: | 584 | case IIO_CHAN_INFO_SCALE: |
| 585 | *val = 0; | ||
| 586 | switch (chan->type) { | 585 | switch (chan->type) { |
| 587 | case IIO_TEMP: | 586 | case IIO_TEMP: |
| 588 | *val2 = 500000; | 587 | *val = 500; |
| 589 | return IIO_VAL_INT_PLUS_MICRO; | 588 | return IIO_VAL_INT; |
| 590 | case IIO_ANGL_VEL: | 589 | case IIO_ANGL_VEL: |
| 591 | { | 590 | { |
| 592 | int i; | 591 | int i; |
| @@ -594,6 +593,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, | |||
| 594 | for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) { | 593 | for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) { |
| 595 | if (bmg160_scale_table[i].dps_range == | 594 | if (bmg160_scale_table[i].dps_range == |
| 596 | data->dps_range) { | 595 | data->dps_range) { |
| 596 | *val = 0; | ||
| 597 | *val2 = bmg160_scale_table[i].scale; | 597 | *val2 = bmg160_scale_table[i].scale; |
| 598 | return IIO_VAL_INT_PLUS_MICRO; | 598 | return IIO_VAL_INT_PLUS_MICRO; |
| 599 | } | 599 | } |
diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c index 77fac81a3adc..5ddebede31a6 100644 --- a/drivers/iio/gyro/mpu3050-core.c +++ b/drivers/iio/gyro/mpu3050-core.c | |||
| @@ -29,7 +29,8 @@ | |||
| 29 | 29 | ||
| 30 | #include "mpu3050.h" | 30 | #include "mpu3050.h" |
| 31 | 31 | ||
| 32 | #define MPU3050_CHIP_ID 0x69 | 32 | #define MPU3050_CHIP_ID 0x68 |
| 33 | #define MPU3050_CHIP_ID_MASK 0x7E | ||
| 33 | 34 | ||
| 34 | /* | 35 | /* |
| 35 | * Register map: anything suffixed *_H is a big-endian high byte and always | 36 | * Register map: anything suffixed *_H is a big-endian high byte and always |
| @@ -1176,8 +1177,9 @@ int mpu3050_common_probe(struct device *dev, | |||
| 1176 | goto err_power_down; | 1177 | goto err_power_down; |
| 1177 | } | 1178 | } |
| 1178 | 1179 | ||
| 1179 | if (val != MPU3050_CHIP_ID) { | 1180 | if ((val & MPU3050_CHIP_ID_MASK) != MPU3050_CHIP_ID) { |
| 1180 | dev_err(dev, "unsupported chip id %02x\n", (u8)val); | 1181 | dev_err(dev, "unsupported chip id %02x\n", |
| 1182 | (u8)(val & MPU3050_CHIP_ID_MASK)); | ||
| 1181 | ret = -ENODEV; | 1183 | ret = -ENODEV; |
| 1182 | goto err_power_down; | 1184 | goto err_power_down; |
| 1183 | } | 1185 | } |
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index cd5bfe39591b..dadd921a4a30 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c | |||
| @@ -320,9 +320,8 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev, | |||
| 320 | const unsigned long *mask; | 320 | const unsigned long *mask; |
| 321 | unsigned long *trialmask; | 321 | unsigned long *trialmask; |
| 322 | 322 | ||
| 323 | trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength), | 323 | trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength), |
| 324 | sizeof(*trialmask), | 324 | sizeof(*trialmask), GFP_KERNEL); |
| 325 | GFP_KERNEL); | ||
| 326 | if (trialmask == NULL) | 325 | if (trialmask == NULL) |
| 327 | return -ENOMEM; | 326 | return -ENOMEM; |
| 328 | if (!indio_dev->masklength) { | 327 | if (!indio_dev->masklength) { |
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 4700fd5d8c90..9c4d92115504 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
| @@ -1743,10 +1743,10 @@ EXPORT_SYMBOL(__iio_device_register); | |||
| 1743 | **/ | 1743 | **/ |
| 1744 | void iio_device_unregister(struct iio_dev *indio_dev) | 1744 | void iio_device_unregister(struct iio_dev *indio_dev) |
| 1745 | { | 1745 | { |
| 1746 | mutex_lock(&indio_dev->info_exist_lock); | ||
| 1747 | |||
| 1748 | cdev_device_del(&indio_dev->chrdev, &indio_dev->dev); | 1746 | cdev_device_del(&indio_dev->chrdev, &indio_dev->dev); |
| 1749 | 1747 | ||
| 1748 | mutex_lock(&indio_dev->info_exist_lock); | ||
| 1749 | |||
| 1750 | iio_device_unregister_debugfs(indio_dev); | 1750 | iio_device_unregister_debugfs(indio_dev); |
| 1751 | 1751 | ||
| 1752 | iio_disable_all_buffers(indio_dev); | 1752 | iio_disable_all_buffers(indio_dev); |
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index ea0bc6885517..32cc8fe7902f 100644 --- a/drivers/infiniband/core/uverbs.h +++ b/drivers/infiniband/core/uverbs.h | |||
| @@ -160,6 +160,7 @@ struct ib_uverbs_file { | |||
| 160 | 160 | ||
| 161 | struct mutex umap_lock; | 161 | struct mutex umap_lock; |
| 162 | struct list_head umaps; | 162 | struct list_head umaps; |
| 163 | struct page *disassociate_page; | ||
| 163 | 164 | ||
| 164 | struct idr idr; | 165 | struct idr idr; |
| 165 | /* spinlock protects write access to idr */ | 166 | /* spinlock protects write access to idr */ |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 70b7d80431a9..c489f545baae 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
| @@ -208,6 +208,9 @@ void ib_uverbs_release_file(struct kref *ref) | |||
| 208 | kref_put(&file->async_file->ref, | 208 | kref_put(&file->async_file->ref, |
| 209 | ib_uverbs_release_async_event_file); | 209 | ib_uverbs_release_async_event_file); |
| 210 | put_device(&file->device->dev); | 210 | put_device(&file->device->dev); |
| 211 | |||
| 212 | if (file->disassociate_page) | ||
| 213 | __free_pages(file->disassociate_page, 0); | ||
| 211 | kfree(file); | 214 | kfree(file); |
| 212 | } | 215 | } |
| 213 | 216 | ||
| @@ -877,9 +880,50 @@ static void rdma_umap_close(struct vm_area_struct *vma) | |||
| 877 | kfree(priv); | 880 | kfree(priv); |
| 878 | } | 881 | } |
| 879 | 882 | ||
| 883 | /* | ||
| 884 | * Once the zap_vma_ptes has been called touches to the VMA will come here and | ||
| 885 | * we return a dummy writable zero page for all the pfns. | ||
| 886 | */ | ||
| 887 | static vm_fault_t rdma_umap_fault(struct vm_fault *vmf) | ||
| 888 | { | ||
| 889 | struct ib_uverbs_file *ufile = vmf->vma->vm_file->private_data; | ||
| 890 | struct rdma_umap_priv *priv = vmf->vma->vm_private_data; | ||
| 891 | vm_fault_t ret = 0; | ||
| 892 | |||
| 893 | if (!priv) | ||
| 894 | return VM_FAULT_SIGBUS; | ||
| 895 | |||
| 896 | /* Read only pages can just use the system zero page. */ | ||
| 897 | if (!(vmf->vma->vm_flags & (VM_WRITE | VM_MAYWRITE))) { | ||
| 898 | vmf->page = ZERO_PAGE(vmf->address); | ||
| 899 | get_page(vmf->page); | ||
| 900 | return 0; | ||
| 901 | } | ||
| 902 | |||
| 903 | mutex_lock(&ufile->umap_lock); | ||
| 904 | if (!ufile->disassociate_page) | ||
| 905 | ufile->disassociate_page = | ||
| 906 | alloc_pages(vmf->gfp_mask | __GFP_ZERO, 0); | ||
| 907 | |||
| 908 | if (ufile->disassociate_page) { | ||
| 909 | /* | ||
| 910 | * This VMA is forced to always be shared so this doesn't have | ||
| 911 | * to worry about COW. | ||
| 912 | */ | ||
| 913 | vmf->page = ufile->disassociate_page; | ||
| 914 | get_page(vmf->page); | ||
| 915 | } else { | ||
| 916 | ret = VM_FAULT_SIGBUS; | ||
| 917 | } | ||
| 918 | mutex_unlock(&ufile->umap_lock); | ||
| 919 | |||
| 920 | return ret; | ||
| 921 | } | ||
| 922 | |||
| 880 | static const struct vm_operations_struct rdma_umap_ops = { | 923 | static const struct vm_operations_struct rdma_umap_ops = { |
| 881 | .open = rdma_umap_open, | 924 | .open = rdma_umap_open, |
| 882 | .close = rdma_umap_close, | 925 | .close = rdma_umap_close, |
| 926 | .fault = rdma_umap_fault, | ||
| 883 | }; | 927 | }; |
| 884 | 928 | ||
| 885 | static struct rdma_umap_priv *rdma_user_mmap_pre(struct ib_ucontext *ucontext, | 929 | static struct rdma_umap_priv *rdma_user_mmap_pre(struct ib_ucontext *ucontext, |
| @@ -889,6 +933,9 @@ static struct rdma_umap_priv *rdma_user_mmap_pre(struct ib_ucontext *ucontext, | |||
| 889 | struct ib_uverbs_file *ufile = ucontext->ufile; | 933 | struct ib_uverbs_file *ufile = ucontext->ufile; |
| 890 | struct rdma_umap_priv *priv; | 934 | struct rdma_umap_priv *priv; |
| 891 | 935 | ||
| 936 | if (!(vma->vm_flags & VM_SHARED)) | ||
| 937 | return ERR_PTR(-EINVAL); | ||
| 938 | |||
| 892 | if (vma->vm_end - vma->vm_start != size) | 939 | if (vma->vm_end - vma->vm_start != size) |
| 893 | return ERR_PTR(-EINVAL); | 940 | return ERR_PTR(-EINVAL); |
| 894 | 941 | ||
| @@ -992,7 +1039,9 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) | |||
| 992 | * at a time to get the lock ordering right. Typically there | 1039 | * at a time to get the lock ordering right. Typically there |
| 993 | * will only be one mm, so no big deal. | 1040 | * will only be one mm, so no big deal. |
| 994 | */ | 1041 | */ |
| 995 | down_write(&mm->mmap_sem); | 1042 | down_read(&mm->mmap_sem); |
| 1043 | if (!mmget_still_valid(mm)) | ||
| 1044 | goto skip_mm; | ||
| 996 | mutex_lock(&ufile->umap_lock); | 1045 | mutex_lock(&ufile->umap_lock); |
| 997 | list_for_each_entry_safe (priv, next_priv, &ufile->umaps, | 1046 | list_for_each_entry_safe (priv, next_priv, &ufile->umaps, |
| 998 | list) { | 1047 | list) { |
| @@ -1004,10 +1053,10 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) | |||
| 1004 | 1053 | ||
| 1005 | zap_vma_ptes(vma, vma->vm_start, | 1054 | zap_vma_ptes(vma, vma->vm_start, |
| 1006 | vma->vm_end - vma->vm_start); | 1055 | vma->vm_end - vma->vm_start); |
| 1007 | vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); | ||
| 1008 | } | 1056 | } |
| 1009 | mutex_unlock(&ufile->umap_lock); | 1057 | mutex_unlock(&ufile->umap_lock); |
| 1010 | up_write(&mm->mmap_sem); | 1058 | skip_mm: |
| 1059 | up_read(&mm->mmap_sem); | ||
| 1011 | mmput(mm); | 1060 | mmput(mm); |
| 1012 | } | 1061 | } |
| 1013 | } | 1062 | } |
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c index 612f04190ed8..9784c6c0d2ec 100644 --- a/drivers/infiniband/hw/hfi1/chip.c +++ b/drivers/infiniband/hw/hfi1/chip.c | |||
| @@ -13232,7 +13232,7 @@ static int set_up_context_variables(struct hfi1_devdata *dd) | |||
| 13232 | int total_contexts; | 13232 | int total_contexts; |
| 13233 | int ret; | 13233 | int ret; |
| 13234 | unsigned ngroups; | 13234 | unsigned ngroups; |
| 13235 | int qos_rmt_count; | 13235 | int rmt_count; |
| 13236 | int user_rmt_reduced; | 13236 | int user_rmt_reduced; |
| 13237 | u32 n_usr_ctxts; | 13237 | u32 n_usr_ctxts; |
| 13238 | u32 send_contexts = chip_send_contexts(dd); | 13238 | u32 send_contexts = chip_send_contexts(dd); |
| @@ -13294,10 +13294,20 @@ static int set_up_context_variables(struct hfi1_devdata *dd) | |||
| 13294 | n_usr_ctxts = rcv_contexts - total_contexts; | 13294 | n_usr_ctxts = rcv_contexts - total_contexts; |
| 13295 | } | 13295 | } |
| 13296 | 13296 | ||
| 13297 | /* each user context requires an entry in the RMT */ | 13297 | /* |
| 13298 | qos_rmt_count = qos_rmt_entries(dd, NULL, NULL); | 13298 | * The RMT entries are currently allocated as shown below: |
| 13299 | if (qos_rmt_count + n_usr_ctxts > NUM_MAP_ENTRIES) { | 13299 | * 1. QOS (0 to 128 entries); |
| 13300 | user_rmt_reduced = NUM_MAP_ENTRIES - qos_rmt_count; | 13300 | * 2. FECN for PSM (num_user_contexts + num_vnic_contexts); |
| 13301 | * 3. VNIC (num_vnic_contexts). | ||
| 13302 | * It should be noted that PSM FECN oversubscribe num_vnic_contexts | ||
| 13303 | * entries of RMT because both VNIC and PSM could allocate any receive | ||
| 13304 | * context between dd->first_dyn_alloc_text and dd->num_rcv_contexts, | ||
| 13305 | * and PSM FECN must reserve an RMT entry for each possible PSM receive | ||
| 13306 | * context. | ||
| 13307 | */ | ||
| 13308 | rmt_count = qos_rmt_entries(dd, NULL, NULL) + (num_vnic_contexts * 2); | ||
| 13309 | if (rmt_count + n_usr_ctxts > NUM_MAP_ENTRIES) { | ||
| 13310 | user_rmt_reduced = NUM_MAP_ENTRIES - rmt_count; | ||
| 13301 | dd_dev_err(dd, | 13311 | dd_dev_err(dd, |
| 13302 | "RMT size is reducing the number of user receive contexts from %u to %d\n", | 13312 | "RMT size is reducing the number of user receive contexts from %u to %d\n", |
| 13303 | n_usr_ctxts, | 13313 | n_usr_ctxts, |
| @@ -14285,9 +14295,11 @@ static void init_user_fecn_handling(struct hfi1_devdata *dd, | |||
| 14285 | u64 reg; | 14295 | u64 reg; |
| 14286 | int i, idx, regoff, regidx; | 14296 | int i, idx, regoff, regidx; |
| 14287 | u8 offset; | 14297 | u8 offset; |
| 14298 | u32 total_cnt; | ||
| 14288 | 14299 | ||
| 14289 | /* there needs to be enough room in the map table */ | 14300 | /* there needs to be enough room in the map table */ |
| 14290 | if (rmt->used + dd->num_user_contexts >= NUM_MAP_ENTRIES) { | 14301 | total_cnt = dd->num_rcv_contexts - dd->first_dyn_alloc_ctxt; |
| 14302 | if (rmt->used + total_cnt >= NUM_MAP_ENTRIES) { | ||
| 14291 | dd_dev_err(dd, "User FECN handling disabled - too many user contexts allocated\n"); | 14303 | dd_dev_err(dd, "User FECN handling disabled - too many user contexts allocated\n"); |
| 14292 | return; | 14304 | return; |
| 14293 | } | 14305 | } |
| @@ -14341,7 +14353,7 @@ static void init_user_fecn_handling(struct hfi1_devdata *dd, | |||
| 14341 | /* add rule 1 */ | 14353 | /* add rule 1 */ |
| 14342 | add_rsm_rule(dd, RSM_INS_FECN, &rrd); | 14354 | add_rsm_rule(dd, RSM_INS_FECN, &rrd); |
| 14343 | 14355 | ||
| 14344 | rmt->used += dd->num_user_contexts; | 14356 | rmt->used += total_cnt; |
| 14345 | } | 14357 | } |
| 14346 | 14358 | ||
| 14347 | /* Initialize RSM for VNIC */ | 14359 | /* Initialize RSM for VNIC */ |
diff --git a/drivers/infiniband/hw/hfi1/qp.c b/drivers/infiniband/hw/hfi1/qp.c index 9b643c2409cf..eba300330a02 100644 --- a/drivers/infiniband/hw/hfi1/qp.c +++ b/drivers/infiniband/hw/hfi1/qp.c | |||
| @@ -898,7 +898,9 @@ void notify_error_qp(struct rvt_qp *qp) | |||
| 898 | if (!list_empty(&priv->s_iowait.list) && | 898 | if (!list_empty(&priv->s_iowait.list) && |
| 899 | !(qp->s_flags & RVT_S_BUSY) && | 899 | !(qp->s_flags & RVT_S_BUSY) && |
| 900 | !(priv->s_flags & RVT_S_BUSY)) { | 900 | !(priv->s_flags & RVT_S_BUSY)) { |
| 901 | qp->s_flags &= ~RVT_S_ANY_WAIT_IO; | 901 | qp->s_flags &= ~HFI1_S_ANY_WAIT_IO; |
| 902 | iowait_clear_flag(&priv->s_iowait, IOWAIT_PENDING_IB); | ||
| 903 | iowait_clear_flag(&priv->s_iowait, IOWAIT_PENDING_TID); | ||
| 902 | list_del_init(&priv->s_iowait.list); | 904 | list_del_init(&priv->s_iowait.list); |
| 903 | priv->s_iowait.lock = NULL; | 905 | priv->s_iowait.lock = NULL; |
| 904 | rvt_put_qp(qp); | 906 | rvt_put_qp(qp); |
diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c index e6726c1ab866..5991211d72bd 100644 --- a/drivers/infiniband/hw/hfi1/rc.c +++ b/drivers/infiniband/hw/hfi1/rc.c | |||
| @@ -3088,7 +3088,7 @@ send_last: | |||
| 3088 | update_ack_queue(qp, next); | 3088 | update_ack_queue(qp, next); |
| 3089 | } | 3089 | } |
| 3090 | e = &qp->s_ack_queue[qp->r_head_ack_queue]; | 3090 | e = &qp->s_ack_queue[qp->r_head_ack_queue]; |
| 3091 | if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) { | 3091 | if (e->rdma_sge.mr) { |
| 3092 | rvt_put_mr(e->rdma_sge.mr); | 3092 | rvt_put_mr(e->rdma_sge.mr); |
| 3093 | e->rdma_sge.mr = NULL; | 3093 | e->rdma_sge.mr = NULL; |
| 3094 | } | 3094 | } |
| @@ -3166,7 +3166,7 @@ send_last: | |||
| 3166 | update_ack_queue(qp, next); | 3166 | update_ack_queue(qp, next); |
| 3167 | } | 3167 | } |
| 3168 | e = &qp->s_ack_queue[qp->r_head_ack_queue]; | 3168 | e = &qp->s_ack_queue[qp->r_head_ack_queue]; |
| 3169 | if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) { | 3169 | if (e->rdma_sge.mr) { |
| 3170 | rvt_put_mr(e->rdma_sge.mr); | 3170 | rvt_put_mr(e->rdma_sge.mr); |
| 3171 | e->rdma_sge.mr = NULL; | 3171 | e->rdma_sge.mr = NULL; |
| 3172 | } | 3172 | } |
diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c index fdda33aca77f..43cbce7a19ea 100644 --- a/drivers/infiniband/hw/hfi1/tid_rdma.c +++ b/drivers/infiniband/hw/hfi1/tid_rdma.c | |||
| @@ -5017,24 +5017,14 @@ int hfi1_make_tid_rdma_pkt(struct rvt_qp *qp, struct hfi1_pkt_state *ps) | |||
| 5017 | make_tid_rdma_ack(qp, ohdr, ps)) | 5017 | make_tid_rdma_ack(qp, ohdr, ps)) |
| 5018 | return 1; | 5018 | return 1; |
| 5019 | 5019 | ||
| 5020 | if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_SEND_OK)) { | 5020 | /* |
| 5021 | if (!(ib_rvt_state_ops[qp->state] & RVT_FLUSH_SEND)) | 5021 | * Bail out if we can't send data. |
| 5022 | goto bail; | 5022 | * Be reminded that this check must been done after the call to |
| 5023 | /* We are in the error state, flush the work request. */ | 5023 | * make_tid_rdma_ack() because the responding QP could be in |
| 5024 | if (qp->s_last == READ_ONCE(qp->s_head)) | 5024 | * RTR state where it can send TID RDMA ACK, not TID RDMA WRITE DATA. |
| 5025 | goto bail; | 5025 | */ |
| 5026 | /* If DMAs are in progress, we can't flush immediately. */ | 5026 | if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_SEND_OK)) |
| 5027 | if (iowait_sdma_pending(&priv->s_iowait)) { | 5027 | goto bail; |
| 5028 | qp->s_flags |= RVT_S_WAIT_DMA; | ||
| 5029 | goto bail; | ||
| 5030 | } | ||
| 5031 | clear_ahg(qp); | ||
| 5032 | wqe = rvt_get_swqe_ptr(qp, qp->s_last); | ||
| 5033 | hfi1_trdma_send_complete(qp, wqe, qp->s_last != qp->s_acked ? | ||
| 5034 | IB_WC_SUCCESS : IB_WC_WR_FLUSH_ERR); | ||
| 5035 | /* will get called again */ | ||
| 5036 | goto done_free_tx; | ||
| 5037 | } | ||
| 5038 | 5028 | ||
| 5039 | if (priv->s_flags & RVT_S_WAIT_ACK) | 5029 | if (priv->s_flags & RVT_S_WAIT_ACK) |
| 5040 | goto bail; | 5030 | goto bail; |
| @@ -5144,11 +5134,6 @@ int hfi1_make_tid_rdma_pkt(struct rvt_qp *qp, struct hfi1_pkt_state *ps) | |||
| 5144 | hfi1_make_ruc_header(qp, ohdr, (opcode << 24), bth1, bth2, | 5134 | hfi1_make_ruc_header(qp, ohdr, (opcode << 24), bth1, bth2, |
| 5145 | middle, ps); | 5135 | middle, ps); |
| 5146 | return 1; | 5136 | return 1; |
| 5147 | done_free_tx: | ||
| 5148 | hfi1_put_txreq(ps->s_txreq); | ||
| 5149 | ps->s_txreq = NULL; | ||
| 5150 | return 1; | ||
| 5151 | |||
| 5152 | bail: | 5137 | bail: |
| 5153 | hfi1_put_txreq(ps->s_txreq); | 5138 | hfi1_put_txreq(ps->s_txreq); |
| 5154 | bail_no_tx: | 5139 | bail_no_tx: |
diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c index f1fec56f3ff4..8e29dbb5b5fb 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hem.c +++ b/drivers/infiniband/hw/hns/hns_roce_hem.c | |||
| @@ -792,6 +792,8 @@ void *hns_roce_table_find(struct hns_roce_dev *hr_dev, | |||
| 792 | idx_offset = (obj & (table->num_obj - 1)) % obj_per_chunk; | 792 | idx_offset = (obj & (table->num_obj - 1)) % obj_per_chunk; |
| 793 | dma_offset = offset = idx_offset * table->obj_size; | 793 | dma_offset = offset = idx_offset * table->obj_size; |
| 794 | } else { | 794 | } else { |
| 795 | u32 seg_size = 64; /* 8 bytes per BA and 8 BA per segment */ | ||
| 796 | |||
| 795 | hns_roce_calc_hem_mhop(hr_dev, table, &mhop_obj, &mhop); | 797 | hns_roce_calc_hem_mhop(hr_dev, table, &mhop_obj, &mhop); |
| 796 | /* mtt mhop */ | 798 | /* mtt mhop */ |
| 797 | i = mhop.l0_idx; | 799 | i = mhop.l0_idx; |
| @@ -803,8 +805,8 @@ void *hns_roce_table_find(struct hns_roce_dev *hr_dev, | |||
| 803 | hem_idx = i; | 805 | hem_idx = i; |
| 804 | 806 | ||
| 805 | hem = table->hem[hem_idx]; | 807 | hem = table->hem[hem_idx]; |
| 806 | dma_offset = offset = (obj & (table->num_obj - 1)) * | 808 | dma_offset = offset = (obj & (table->num_obj - 1)) * seg_size % |
| 807 | table->obj_size % mhop.bt_chunk_size; | 809 | mhop.bt_chunk_size; |
| 808 | if (mhop.hop_num == 2) | 810 | if (mhop.hop_num == 2) |
| 809 | dma_offset = offset = 0; | 811 | dma_offset = offset = 0; |
| 810 | } | 812 | } |
diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c index b09f1cde2ff5..08be0e4eabcd 100644 --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c | |||
| @@ -746,7 +746,6 @@ static int hns_roce_write_mtt_chunk(struct hns_roce_dev *hr_dev, | |||
| 746 | struct hns_roce_hem_table *table; | 746 | struct hns_roce_hem_table *table; |
| 747 | dma_addr_t dma_handle; | 747 | dma_addr_t dma_handle; |
| 748 | __le64 *mtts; | 748 | __le64 *mtts; |
| 749 | u32 s = start_index * sizeof(u64); | ||
| 750 | u32 bt_page_size; | 749 | u32 bt_page_size; |
| 751 | u32 i; | 750 | u32 i; |
| 752 | 751 | ||
| @@ -780,7 +779,8 @@ static int hns_roce_write_mtt_chunk(struct hns_roce_dev *hr_dev, | |||
| 780 | return -EINVAL; | 779 | return -EINVAL; |
| 781 | 780 | ||
| 782 | mtts = hns_roce_table_find(hr_dev, table, | 781 | mtts = hns_roce_table_find(hr_dev, table, |
| 783 | mtt->first_seg + s / hr_dev->caps.mtt_entry_sz, | 782 | mtt->first_seg + |
| 783 | start_index / HNS_ROCE_MTT_ENTRY_PER_SEG, | ||
| 784 | &dma_handle); | 784 | &dma_handle); |
| 785 | if (!mtts) | 785 | if (!mtts) |
| 786 | return -ENOMEM; | 786 | return -ENOMEM; |
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c index 57c76eafef2f..60cf9f03e941 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c | |||
| @@ -274,9 +274,6 @@ void hns_roce_qp_free(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) | |||
| 274 | wait_for_completion(&hr_qp->free); | 274 | wait_for_completion(&hr_qp->free); |
| 275 | 275 | ||
| 276 | if ((hr_qp->ibqp.qp_type) != IB_QPT_GSI) { | 276 | if ((hr_qp->ibqp.qp_type) != IB_QPT_GSI) { |
| 277 | if (hr_dev->caps.sccc_entry_sz) | ||
| 278 | hns_roce_table_put(hr_dev, &qp_table->sccc_table, | ||
| 279 | hr_qp->qpn); | ||
| 280 | if (hr_dev->caps.trrl_entry_sz) | 277 | if (hr_dev->caps.trrl_entry_sz) |
| 281 | hns_roce_table_put(hr_dev, &qp_table->trrl_table, | 278 | hns_roce_table_put(hr_dev, &qp_table->trrl_table, |
| 282 | hr_qp->qpn); | 279 | hr_qp->qpn); |
| @@ -536,7 +533,7 @@ static int hns_roce_set_kernel_sq_size(struct hns_roce_dev *hr_dev, | |||
| 536 | 533 | ||
| 537 | static int hns_roce_qp_has_sq(struct ib_qp_init_attr *attr) | 534 | static int hns_roce_qp_has_sq(struct ib_qp_init_attr *attr) |
| 538 | { | 535 | { |
| 539 | if (attr->qp_type == IB_QPT_XRC_TGT) | 536 | if (attr->qp_type == IB_QPT_XRC_TGT || !attr->cap.max_send_wr) |
| 540 | return 0; | 537 | return 0; |
| 541 | 538 | ||
| 542 | return 1; | 539 | return 1; |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 531ff20b32ad..d3dd290ae1b1 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
| @@ -1119,6 +1119,8 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, | |||
| 1119 | if (MLX5_CAP_GEN(mdev, qp_packet_based)) | 1119 | if (MLX5_CAP_GEN(mdev, qp_packet_based)) |
| 1120 | resp.flags |= | 1120 | resp.flags |= |
| 1121 | MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE; | 1121 | MLX5_IB_QUERY_DEV_RESP_PACKET_BASED_CREDIT_MODE; |
| 1122 | |||
| 1123 | resp.flags |= MLX5_IB_QUERY_DEV_RESP_FLAGS_SCAT2CQE_DCT; | ||
| 1122 | } | 1124 | } |
| 1123 | 1125 | ||
| 1124 | if (field_avail(typeof(resp), sw_parsing_caps, | 1126 | if (field_avail(typeof(resp), sw_parsing_caps, |
| @@ -2066,6 +2068,7 @@ static int mlx5_ib_mmap_clock_info_page(struct mlx5_ib_dev *dev, | |||
| 2066 | 2068 | ||
| 2067 | if (vma->vm_flags & VM_WRITE) | 2069 | if (vma->vm_flags & VM_WRITE) |
| 2068 | return -EPERM; | 2070 | return -EPERM; |
| 2071 | vma->vm_flags &= ~VM_MAYWRITE; | ||
| 2069 | 2072 | ||
| 2070 | if (!dev->mdev->clock_info_page) | 2073 | if (!dev->mdev->clock_info_page) |
| 2071 | return -EOPNOTSUPP; | 2074 | return -EOPNOTSUPP; |
| @@ -2231,19 +2234,18 @@ static int mlx5_ib_mmap(struct ib_ucontext *ibcontext, struct vm_area_struct *vm | |||
| 2231 | 2234 | ||
| 2232 | if (vma->vm_flags & VM_WRITE) | 2235 | if (vma->vm_flags & VM_WRITE) |
| 2233 | return -EPERM; | 2236 | return -EPERM; |
| 2237 | vma->vm_flags &= ~VM_MAYWRITE; | ||
| 2234 | 2238 | ||
| 2235 | /* Don't expose to user-space information it shouldn't have */ | 2239 | /* Don't expose to user-space information it shouldn't have */ |
| 2236 | if (PAGE_SIZE > 4096) | 2240 | if (PAGE_SIZE > 4096) |
| 2237 | return -EOPNOTSUPP; | 2241 | return -EOPNOTSUPP; |
| 2238 | 2242 | ||
| 2239 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
| 2240 | pfn = (dev->mdev->iseg_base + | 2243 | pfn = (dev->mdev->iseg_base + |
| 2241 | offsetof(struct mlx5_init_seg, internal_timer_h)) >> | 2244 | offsetof(struct mlx5_init_seg, internal_timer_h)) >> |
| 2242 | PAGE_SHIFT; | 2245 | PAGE_SHIFT; |
| 2243 | if (io_remap_pfn_range(vma, vma->vm_start, pfn, | 2246 | return rdma_user_mmap_io(&context->ibucontext, vma, pfn, |
| 2244 | PAGE_SIZE, vma->vm_page_prot)) | 2247 | PAGE_SIZE, |
| 2245 | return -EAGAIN; | 2248 | pgprot_noncached(vma->vm_page_prot)); |
| 2246 | break; | ||
| 2247 | case MLX5_IB_MMAP_CLOCK_INFO: | 2249 | case MLX5_IB_MMAP_CLOCK_INFO: |
| 2248 | return mlx5_ib_mmap_clock_info_page(dev, vma, context); | 2250 | return mlx5_ib_mmap_clock_info_page(dev, vma, context); |
| 2249 | 2251 | ||
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c index c20bfc41ecf1..0aa10ebda5d9 100644 --- a/drivers/infiniband/hw/mlx5/odp.c +++ b/drivers/infiniband/hw/mlx5/odp.c | |||
| @@ -585,7 +585,7 @@ static int pagefault_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr, | |||
| 585 | struct ib_umem_odp *odp_mr = to_ib_umem_odp(mr->umem); | 585 | struct ib_umem_odp *odp_mr = to_ib_umem_odp(mr->umem); |
| 586 | bool downgrade = flags & MLX5_PF_FLAGS_DOWNGRADE; | 586 | bool downgrade = flags & MLX5_PF_FLAGS_DOWNGRADE; |
| 587 | bool prefetch = flags & MLX5_PF_FLAGS_PREFETCH; | 587 | bool prefetch = flags & MLX5_PF_FLAGS_PREFETCH; |
| 588 | u64 access_mask = ODP_READ_ALLOWED_BIT; | 588 | u64 access_mask; |
| 589 | u64 start_idx, page_mask; | 589 | u64 start_idx, page_mask; |
| 590 | struct ib_umem_odp *odp; | 590 | struct ib_umem_odp *odp; |
| 591 | size_t size; | 591 | size_t size; |
| @@ -607,6 +607,7 @@ next_mr: | |||
| 607 | page_shift = mr->umem->page_shift; | 607 | page_shift = mr->umem->page_shift; |
| 608 | page_mask = ~(BIT(page_shift) - 1); | 608 | page_mask = ~(BIT(page_shift) - 1); |
| 609 | start_idx = (io_virt - (mr->mmkey.iova & page_mask)) >> page_shift; | 609 | start_idx = (io_virt - (mr->mmkey.iova & page_mask)) >> page_shift; |
| 610 | access_mask = ODP_READ_ALLOWED_BIT; | ||
| 610 | 611 | ||
| 611 | if (prefetch && !downgrade && !mr->umem->writable) { | 612 | if (prefetch && !downgrade && !mr->umem->writable) { |
| 612 | /* prefetch with write-access must | 613 | /* prefetch with write-access must |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 7cd006da1dae..8870c350fda0 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
| @@ -1818,13 +1818,16 @@ static void configure_responder_scat_cqe(struct ib_qp_init_attr *init_attr, | |||
| 1818 | 1818 | ||
| 1819 | rcqe_sz = mlx5_ib_get_cqe_size(init_attr->recv_cq); | 1819 | rcqe_sz = mlx5_ib_get_cqe_size(init_attr->recv_cq); |
| 1820 | 1820 | ||
| 1821 | if (rcqe_sz == 128) { | 1821 | if (init_attr->qp_type == MLX5_IB_QPT_DCT) { |
| 1822 | MLX5_SET(qpc, qpc, cs_res, MLX5_RES_SCAT_DATA64_CQE); | 1822 | if (rcqe_sz == 128) |
| 1823 | MLX5_SET(dctc, qpc, cs_res, MLX5_RES_SCAT_DATA64_CQE); | ||
| 1824 | |||
| 1823 | return; | 1825 | return; |
| 1824 | } | 1826 | } |
| 1825 | 1827 | ||
| 1826 | if (init_attr->qp_type != MLX5_IB_QPT_DCT) | 1828 | MLX5_SET(qpc, qpc, cs_res, |
| 1827 | MLX5_SET(qpc, qpc, cs_res, MLX5_RES_SCAT_DATA32_CQE); | 1829 | rcqe_sz == 128 ? MLX5_RES_SCAT_DATA64_CQE : |
| 1830 | MLX5_RES_SCAT_DATA32_CQE); | ||
| 1828 | } | 1831 | } |
| 1829 | 1832 | ||
| 1830 | static void configure_requester_scat_cqe(struct mlx5_ib_dev *dev, | 1833 | static void configure_requester_scat_cqe(struct mlx5_ib_dev *dev, |
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c index 6d8b3e0de57a..ec41400fec0c 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | |||
| @@ -1131,6 +1131,8 @@ static void pvrdma_pci_remove(struct pci_dev *pdev) | |||
| 1131 | pvrdma_page_dir_cleanup(dev, &dev->cq_pdir); | 1131 | pvrdma_page_dir_cleanup(dev, &dev->cq_pdir); |
| 1132 | pvrdma_page_dir_cleanup(dev, &dev->async_pdir); | 1132 | pvrdma_page_dir_cleanup(dev, &dev->async_pdir); |
| 1133 | pvrdma_free_slots(dev); | 1133 | pvrdma_free_slots(dev); |
| 1134 | dma_free_coherent(&pdev->dev, sizeof(*dev->dsr), dev->dsr, | ||
| 1135 | dev->dsrbase); | ||
| 1134 | 1136 | ||
| 1135 | iounmap(dev->regs); | 1137 | iounmap(dev->regs); |
| 1136 | kfree(dev->sgid_tbl); | 1138 | kfree(dev->sgid_tbl); |
diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c index 728795043496..0bb6e39dd03a 100644 --- a/drivers/infiniband/sw/rdmavt/mr.c +++ b/drivers/infiniband/sw/rdmavt/mr.c | |||
| @@ -608,11 +608,6 @@ static int rvt_set_page(struct ib_mr *ibmr, u64 addr) | |||
| 608 | if (unlikely(mapped_segs == mr->mr.max_segs)) | 608 | if (unlikely(mapped_segs == mr->mr.max_segs)) |
| 609 | return -ENOMEM; | 609 | return -ENOMEM; |
| 610 | 610 | ||
| 611 | if (mr->mr.length == 0) { | ||
| 612 | mr->mr.user_base = addr; | ||
| 613 | mr->mr.iova = addr; | ||
| 614 | } | ||
| 615 | |||
| 616 | m = mapped_segs / RVT_SEGSZ; | 611 | m = mapped_segs / RVT_SEGSZ; |
| 617 | n = mapped_segs % RVT_SEGSZ; | 612 | n = mapped_segs % RVT_SEGSZ; |
| 618 | mr->mr.map[m]->segs[n].vaddr = (void *)addr; | 613 | mr->mr.map[m]->segs[n].vaddr = (void *)addr; |
| @@ -630,17 +625,24 @@ static int rvt_set_page(struct ib_mr *ibmr, u64 addr) | |||
| 630 | * @sg_nents: number of entries in sg | 625 | * @sg_nents: number of entries in sg |
| 631 | * @sg_offset: offset in bytes into sg | 626 | * @sg_offset: offset in bytes into sg |
| 632 | * | 627 | * |
| 628 | * Overwrite rvt_mr length with mr length calculated by ib_sg_to_pages. | ||
| 629 | * | ||
| 633 | * Return: number of sg elements mapped to the memory region | 630 | * Return: number of sg elements mapped to the memory region |
| 634 | */ | 631 | */ |
| 635 | int rvt_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, | 632 | int rvt_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, |
| 636 | int sg_nents, unsigned int *sg_offset) | 633 | int sg_nents, unsigned int *sg_offset) |
| 637 | { | 634 | { |
| 638 | struct rvt_mr *mr = to_imr(ibmr); | 635 | struct rvt_mr *mr = to_imr(ibmr); |
| 636 | int ret; | ||
| 639 | 637 | ||
| 640 | mr->mr.length = 0; | 638 | mr->mr.length = 0; |
| 641 | mr->mr.page_shift = PAGE_SHIFT; | 639 | mr->mr.page_shift = PAGE_SHIFT; |
| 642 | return ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, | 640 | ret = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, rvt_set_page); |
| 643 | rvt_set_page); | 641 | mr->mr.user_base = ibmr->iova; |
| 642 | mr->mr.iova = ibmr->iova; | ||
| 643 | mr->mr.offset = ibmr->iova - (u64)mr->mr.map[0]->segs[0].vaddr; | ||
| 644 | mr->mr.length = (size_t)ibmr->length; | ||
| 645 | return ret; | ||
| 644 | } | 646 | } |
| 645 | 647 | ||
| 646 | /** | 648 | /** |
| @@ -671,6 +673,7 @@ int rvt_fast_reg_mr(struct rvt_qp *qp, struct ib_mr *ibmr, u32 key, | |||
| 671 | ibmr->rkey = key; | 673 | ibmr->rkey = key; |
| 672 | mr->mr.lkey = key; | 674 | mr->mr.lkey = key; |
| 673 | mr->mr.access_flags = access; | 675 | mr->mr.access_flags = access; |
| 676 | mr->mr.iova = ibmr->iova; | ||
| 674 | atomic_set(&mr->mr.lkey_invalid, 0); | 677 | atomic_set(&mr->mr.lkey_invalid, 0); |
| 675 | 678 | ||
| 676 | return 0; | 679 | return 0; |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index a878351f1643..52d7f55fca32 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
| @@ -420,7 +420,7 @@ config KEYBOARD_MPR121 | |||
| 420 | 420 | ||
| 421 | config KEYBOARD_SNVS_PWRKEY | 421 | config KEYBOARD_SNVS_PWRKEY |
| 422 | tristate "IMX SNVS Power Key Driver" | 422 | tristate "IMX SNVS Power Key Driver" |
| 423 | depends on SOC_IMX6SX || SOC_IMX7D | 423 | depends on ARCH_MXC || COMPILE_TEST |
| 424 | depends on OF | 424 | depends on OF |
| 425 | help | 425 | help |
| 426 | This is the snvs powerkey driver for the Freescale i.MX application | 426 | This is the snvs powerkey driver for the Freescale i.MX application |
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c index effb63205d3d..4c67cf30a5d9 100644 --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c | |||
| @@ -148,6 +148,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) | |||
| 148 | return error; | 148 | return error; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | pdata->input = input; | ||
| 152 | platform_set_drvdata(pdev, pdata); | ||
| 153 | |||
| 151 | error = devm_request_irq(&pdev->dev, pdata->irq, | 154 | error = devm_request_irq(&pdev->dev, pdata->irq, |
| 152 | imx_snvs_pwrkey_interrupt, | 155 | imx_snvs_pwrkey_interrupt, |
| 153 | 0, pdev->name, pdev); | 156 | 0, pdev->name, pdev); |
| @@ -163,9 +166,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) | |||
| 163 | return error; | 166 | return error; |
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | pdata->input = input; | ||
| 167 | platform_set_drvdata(pdev, pdata); | ||
| 168 | |||
| 169 | device_init_wakeup(&pdev->dev, pdata->wakeup); | 169 | device_init_wakeup(&pdev->dev, pdata->wakeup); |
| 170 | 170 | ||
| 171 | return 0; | 171 | return 0; |
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 628ef617bb2f..f9525d6f0bfe 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c | |||
| @@ -1339,21 +1339,46 @@ static const struct acpi_device_id elan_acpi_id[] = { | |||
| 1339 | { "ELAN0600", 0 }, | 1339 | { "ELAN0600", 0 }, |
| 1340 | { "ELAN0601", 0 }, | 1340 | { "ELAN0601", 0 }, |
| 1341 | { "ELAN0602", 0 }, | 1341 | { "ELAN0602", 0 }, |
| 1342 | { "ELAN0603", 0 }, | ||
| 1343 | { "ELAN0604", 0 }, | ||
| 1342 | { "ELAN0605", 0 }, | 1344 | { "ELAN0605", 0 }, |
| 1345 | { "ELAN0606", 0 }, | ||
| 1346 | { "ELAN0607", 0 }, | ||
| 1343 | { "ELAN0608", 0 }, | 1347 | { "ELAN0608", 0 }, |
| 1344 | { "ELAN0609", 0 }, | 1348 | { "ELAN0609", 0 }, |
| 1345 | { "ELAN060B", 0 }, | 1349 | { "ELAN060B", 0 }, |
| 1346 | { "ELAN060C", 0 }, | 1350 | { "ELAN060C", 0 }, |
| 1351 | { "ELAN060F", 0 }, | ||
| 1352 | { "ELAN0610", 0 }, | ||
| 1347 | { "ELAN0611", 0 }, | 1353 | { "ELAN0611", 0 }, |
| 1348 | { "ELAN0612", 0 }, | 1354 | { "ELAN0612", 0 }, |
| 1355 | { "ELAN0615", 0 }, | ||
| 1356 | { "ELAN0616", 0 }, | ||
| 1349 | { "ELAN0617", 0 }, | 1357 | { "ELAN0617", 0 }, |
| 1350 | { "ELAN0618", 0 }, | 1358 | { "ELAN0618", 0 }, |
| 1359 | { "ELAN0619", 0 }, | ||
| 1360 | { "ELAN061A", 0 }, | ||
| 1361 | { "ELAN061B", 0 }, | ||
| 1351 | { "ELAN061C", 0 }, | 1362 | { "ELAN061C", 0 }, |
| 1352 | { "ELAN061D", 0 }, | 1363 | { "ELAN061D", 0 }, |
| 1353 | { "ELAN061E", 0 }, | 1364 | { "ELAN061E", 0 }, |
| 1365 | { "ELAN061F", 0 }, | ||
| 1354 | { "ELAN0620", 0 }, | 1366 | { "ELAN0620", 0 }, |
| 1355 | { "ELAN0621", 0 }, | 1367 | { "ELAN0621", 0 }, |
| 1356 | { "ELAN0622", 0 }, | 1368 | { "ELAN0622", 0 }, |
| 1369 | { "ELAN0623", 0 }, | ||
| 1370 | { "ELAN0624", 0 }, | ||
| 1371 | { "ELAN0625", 0 }, | ||
| 1372 | { "ELAN0626", 0 }, | ||
| 1373 | { "ELAN0627", 0 }, | ||
| 1374 | { "ELAN0628", 0 }, | ||
| 1375 | { "ELAN0629", 0 }, | ||
| 1376 | { "ELAN062A", 0 }, | ||
| 1377 | { "ELAN062B", 0 }, | ||
| 1378 | { "ELAN062C", 0 }, | ||
| 1379 | { "ELAN062D", 0 }, | ||
| 1380 | { "ELAN0631", 0 }, | ||
| 1381 | { "ELAN0632", 0 }, | ||
| 1357 | { "ELAN1000", 0 }, | 1382 | { "ELAN1000", 0 }, |
| 1358 | { } | 1383 | { } |
| 1359 | }; | 1384 | }; |
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index fc3ab93b7aea..7fb358f96195 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c | |||
| @@ -860,7 +860,7 @@ static int rmi_create_function(struct rmi_device *rmi_dev, | |||
| 860 | 860 | ||
| 861 | error = rmi_register_function(fn); | 861 | error = rmi_register_function(fn); |
| 862 | if (error) | 862 | if (error) |
| 863 | goto err_put_fn; | 863 | return error; |
| 864 | 864 | ||
| 865 | if (pdt->function_number == 0x01) | 865 | if (pdt->function_number == 0x01) |
| 866 | data->f01_container = fn; | 866 | data->f01_container = fn; |
| @@ -870,10 +870,6 @@ static int rmi_create_function(struct rmi_device *rmi_dev, | |||
| 870 | list_add_tail(&fn->node, &data->function_list); | 870 | list_add_tail(&fn->node, &data->function_list); |
| 871 | 871 | ||
| 872 | return RMI_SCAN_CONTINUE; | 872 | return RMI_SCAN_CONTINUE; |
| 873 | |||
| 874 | err_put_fn: | ||
| 875 | put_device(&fn->dev); | ||
| 876 | return error; | ||
| 877 | } | 873 | } |
| 878 | 874 | ||
| 879 | void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake) | 875 | void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake) |
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c index df64d6aed4f7..93901ebd122a 100644 --- a/drivers/input/rmi4/rmi_f11.c +++ b/drivers/input/rmi4/rmi_f11.c | |||
| @@ -1230,7 +1230,7 @@ static int rmi_f11_initialize(struct rmi_function *fn) | |||
| 1230 | } | 1230 | } |
| 1231 | 1231 | ||
| 1232 | rc = f11_write_control_regs(fn, &f11->sens_query, | 1232 | rc = f11_write_control_regs(fn, &f11->sens_query, |
| 1233 | &f11->dev_controls, fn->fd.query_base_addr); | 1233 | &f11->dev_controls, fn->fd.control_base_addr); |
| 1234 | if (rc) | 1234 | if (rc) |
| 1235 | dev_warn(&fn->dev, "Failed to write control registers\n"); | 1235 | dev_warn(&fn->dev, "Failed to write control registers\n"); |
| 1236 | 1236 | ||
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 1b1378619fc9..ff40ba758cf3 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
| @@ -359,7 +359,7 @@ static void iommu_write_l2(struct amd_iommu *iommu, u8 address, u32 val) | |||
| 359 | static void iommu_set_exclusion_range(struct amd_iommu *iommu) | 359 | static void iommu_set_exclusion_range(struct amd_iommu *iommu) |
| 360 | { | 360 | { |
| 361 | u64 start = iommu->exclusion_start & PAGE_MASK; | 361 | u64 start = iommu->exclusion_start & PAGE_MASK; |
| 362 | u64 limit = (start + iommu->exclusion_length) & PAGE_MASK; | 362 | u64 limit = (start + iommu->exclusion_length - 1) & PAGE_MASK; |
| 363 | u64 entry; | 363 | u64 entry; |
| 364 | 364 | ||
| 365 | if (!iommu->exclusion_start) | 365 | if (!iommu->exclusion_start) |
diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c index aa7290784636..0390603170b4 100644 --- a/drivers/irqchip/irq-ath79-misc.c +++ b/drivers/irqchip/irq-ath79-misc.c | |||
| @@ -22,6 +22,15 @@ | |||
| 22 | #define AR71XX_RESET_REG_MISC_INT_ENABLE 4 | 22 | #define AR71XX_RESET_REG_MISC_INT_ENABLE 4 |
| 23 | 23 | ||
| 24 | #define ATH79_MISC_IRQ_COUNT 32 | 24 | #define ATH79_MISC_IRQ_COUNT 32 |
| 25 | #define ATH79_MISC_PERF_IRQ 5 | ||
| 26 | |||
| 27 | static int ath79_perfcount_irq; | ||
| 28 | |||
| 29 | int get_c0_perfcount_int(void) | ||
| 30 | { | ||
| 31 | return ath79_perfcount_irq; | ||
| 32 | } | ||
| 33 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 25 | 34 | ||
| 26 | static void ath79_misc_irq_handler(struct irq_desc *desc) | 35 | static void ath79_misc_irq_handler(struct irq_desc *desc) |
| 27 | { | 36 | { |
| @@ -113,6 +122,8 @@ static void __init ath79_misc_intc_domain_init( | |||
| 113 | { | 122 | { |
| 114 | void __iomem *base = domain->host_data; | 123 | void __iomem *base = domain->host_data; |
| 115 | 124 | ||
| 125 | ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ); | ||
| 126 | |||
| 116 | /* Disable and clear all interrupts */ | 127 | /* Disable and clear all interrupts */ |
| 117 | __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE); | 128 | __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE); |
| 118 | __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); | 129 | __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); |
diff --git a/drivers/irqchip/irq-ls1x.c b/drivers/irqchip/irq-ls1x.c index 86b72fbd3b45..353111a10413 100644 --- a/drivers/irqchip/irq-ls1x.c +++ b/drivers/irqchip/irq-ls1x.c | |||
| @@ -130,6 +130,7 @@ static int __init ls1x_intc_of_init(struct device_node *node, | |||
| 130 | NULL); | 130 | NULL); |
| 131 | if (!priv->domain) { | 131 | if (!priv->domain) { |
| 132 | pr_err("ls1x-irq: cannot add IRQ domain\n"); | 132 | pr_err("ls1x-irq: cannot add IRQ domain\n"); |
| 133 | err = -ENOMEM; | ||
| 133 | goto out_iounmap; | 134 | goto out_iounmap; |
| 134 | } | 135 | } |
| 135 | 136 | ||
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c index 4ab8b1b6608f..a14e35d40538 100644 --- a/drivers/isdn/mISDN/socket.c +++ b/drivers/isdn/mISDN/socket.c | |||
| @@ -710,10 +710,10 @@ base_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) | |||
| 710 | struct sock *sk = sock->sk; | 710 | struct sock *sk = sock->sk; |
| 711 | int err = 0; | 711 | int err = 0; |
| 712 | 712 | ||
| 713 | if (!maddr || maddr->family != AF_ISDN) | 713 | if (addr_len < sizeof(struct sockaddr_mISDN)) |
| 714 | return -EINVAL; | 714 | return -EINVAL; |
| 715 | 715 | ||
| 716 | if (addr_len < sizeof(struct sockaddr_mISDN)) | 716 | if (!maddr || maddr->family != AF_ISDN) |
| 717 | return -EINVAL; | 717 | return -EINVAL; |
| 718 | 718 | ||
| 719 | lock_sock(sk); | 719 | lock_sock(sk); |
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index 3789185144da..0b7d5fb4548d 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c | |||
| @@ -231,14 +231,14 @@ static void pblk_end_partial_read(struct nvm_rq *rqd) | |||
| 231 | struct pblk_sec_meta *meta; | 231 | struct pblk_sec_meta *meta; |
| 232 | struct bio *new_bio = rqd->bio; | 232 | struct bio *new_bio = rqd->bio; |
| 233 | struct bio *bio = pr_ctx->orig_bio; | 233 | struct bio *bio = pr_ctx->orig_bio; |
| 234 | struct bio_vec src_bv, dst_bv; | ||
| 235 | void *meta_list = rqd->meta_list; | 234 | void *meta_list = rqd->meta_list; |
| 236 | int bio_init_idx = pr_ctx->bio_init_idx; | ||
| 237 | unsigned long *read_bitmap = pr_ctx->bitmap; | 235 | unsigned long *read_bitmap = pr_ctx->bitmap; |
| 236 | struct bvec_iter orig_iter = BVEC_ITER_ALL_INIT; | ||
| 237 | struct bvec_iter new_iter = BVEC_ITER_ALL_INIT; | ||
| 238 | int nr_secs = pr_ctx->orig_nr_secs; | 238 | int nr_secs = pr_ctx->orig_nr_secs; |
| 239 | int nr_holes = nr_secs - bitmap_weight(read_bitmap, nr_secs); | 239 | int nr_holes = nr_secs - bitmap_weight(read_bitmap, nr_secs); |
| 240 | void *src_p, *dst_p; | 240 | void *src_p, *dst_p; |
| 241 | int hole, i; | 241 | int bit, i; |
| 242 | 242 | ||
| 243 | if (unlikely(nr_holes == 1)) { | 243 | if (unlikely(nr_holes == 1)) { |
| 244 | struct ppa_addr ppa; | 244 | struct ppa_addr ppa; |
| @@ -257,33 +257,39 @@ static void pblk_end_partial_read(struct nvm_rq *rqd) | |||
| 257 | 257 | ||
| 258 | /* Fill the holes in the original bio */ | 258 | /* Fill the holes in the original bio */ |
| 259 | i = 0; | 259 | i = 0; |
| 260 | hole = find_first_zero_bit(read_bitmap, nr_secs); | 260 | for (bit = 0; bit < nr_secs; bit++) { |
| 261 | do { | 261 | if (!test_bit(bit, read_bitmap)) { |
| 262 | struct pblk_line *line; | 262 | struct bio_vec dst_bv, src_bv; |
| 263 | struct pblk_line *line; | ||
| 263 | 264 | ||
| 264 | line = pblk_ppa_to_line(pblk, rqd->ppa_list[i]); | 265 | line = pblk_ppa_to_line(pblk, rqd->ppa_list[i]); |
| 265 | kref_put(&line->ref, pblk_line_put); | 266 | kref_put(&line->ref, pblk_line_put); |
| 266 | 267 | ||
| 267 | meta = pblk_get_meta(pblk, meta_list, hole); | 268 | meta = pblk_get_meta(pblk, meta_list, bit); |
| 268 | meta->lba = cpu_to_le64(pr_ctx->lba_list_media[i]); | 269 | meta->lba = cpu_to_le64(pr_ctx->lba_list_media[i]); |
| 269 | 270 | ||
| 270 | src_bv = new_bio->bi_io_vec[i++]; | 271 | dst_bv = bio_iter_iovec(bio, orig_iter); |
| 271 | dst_bv = bio->bi_io_vec[bio_init_idx + hole]; | 272 | src_bv = bio_iter_iovec(new_bio, new_iter); |
| 272 | 273 | ||
| 273 | src_p = kmap_atomic(src_bv.bv_page); | 274 | src_p = kmap_atomic(src_bv.bv_page); |
| 274 | dst_p = kmap_atomic(dst_bv.bv_page); | 275 | dst_p = kmap_atomic(dst_bv.bv_page); |
| 275 | 276 | ||
| 276 | memcpy(dst_p + dst_bv.bv_offset, | 277 | memcpy(dst_p + dst_bv.bv_offset, |
| 277 | src_p + src_bv.bv_offset, | 278 | src_p + src_bv.bv_offset, |
| 278 | PBLK_EXPOSED_PAGE_SIZE); | 279 | PBLK_EXPOSED_PAGE_SIZE); |
| 279 | 280 | ||
| 280 | kunmap_atomic(src_p); | 281 | kunmap_atomic(src_p); |
| 281 | kunmap_atomic(dst_p); | 282 | kunmap_atomic(dst_p); |
| 282 | 283 | ||
| 283 | mempool_free(src_bv.bv_page, &pblk->page_bio_pool); | 284 | flush_dcache_page(dst_bv.bv_page); |
| 285 | mempool_free(src_bv.bv_page, &pblk->page_bio_pool); | ||
| 284 | 286 | ||
| 285 | hole = find_next_zero_bit(read_bitmap, nr_secs, hole + 1); | 287 | bio_advance_iter(new_bio, &new_iter, |
| 286 | } while (hole < nr_secs); | 288 | PBLK_EXPOSED_PAGE_SIZE); |
| 289 | i++; | ||
| 290 | } | ||
| 291 | bio_advance_iter(bio, &orig_iter, PBLK_EXPOSED_PAGE_SIZE); | ||
| 292 | } | ||
| 287 | 293 | ||
| 288 | bio_put(new_bio); | 294 | bio_put(new_bio); |
| 289 | kfree(pr_ctx); | 295 | kfree(pr_ctx); |
diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h index 95c6d86ab5e8..c4ef1fceead6 100644 --- a/drivers/md/dm-core.h +++ b/drivers/md/dm-core.h | |||
| @@ -115,6 +115,7 @@ struct mapped_device { | |||
| 115 | struct srcu_struct io_barrier; | 115 | struct srcu_struct io_barrier; |
| 116 | }; | 116 | }; |
| 117 | 117 | ||
| 118 | void disable_discard(struct mapped_device *md); | ||
| 118 | void disable_write_same(struct mapped_device *md); | 119 | void disable_write_same(struct mapped_device *md); |
| 119 | void disable_write_zeroes(struct mapped_device *md); | 120 | void disable_write_zeroes(struct mapped_device *md); |
| 120 | 121 | ||
diff --git a/drivers/md/dm-init.c b/drivers/md/dm-init.c index b53f30f16b4d..4b76f84424c3 100644 --- a/drivers/md/dm-init.c +++ b/drivers/md/dm-init.c | |||
| @@ -36,7 +36,7 @@ struct dm_device { | |||
| 36 | struct list_head list; | 36 | struct list_head list; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | const char *dm_allowed_targets[] __initconst = { | 39 | const char * const dm_allowed_targets[] __initconst = { |
| 40 | "crypt", | 40 | "crypt", |
| 41 | "delay", | 41 | "delay", |
| 42 | "linear", | 42 | "linear", |
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index d57d997a52c8..7c678f50aaa3 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c | |||
| @@ -913,7 +913,7 @@ static void copy_from_journal(struct dm_integrity_c *ic, unsigned section, unsig | |||
| 913 | static bool ranges_overlap(struct dm_integrity_range *range1, struct dm_integrity_range *range2) | 913 | static bool ranges_overlap(struct dm_integrity_range *range1, struct dm_integrity_range *range2) |
| 914 | { | 914 | { |
| 915 | return range1->logical_sector < range2->logical_sector + range2->n_sectors && | 915 | return range1->logical_sector < range2->logical_sector + range2->n_sectors && |
| 916 | range2->logical_sector + range2->n_sectors > range2->logical_sector; | 916 | range1->logical_sector + range1->n_sectors > range2->logical_sector; |
| 917 | } | 917 | } |
| 918 | 918 | ||
| 919 | static bool add_new_range(struct dm_integrity_c *ic, struct dm_integrity_range *new_range, bool check_waiting) | 919 | static bool add_new_range(struct dm_integrity_c *ic, struct dm_integrity_range *new_range, bool check_waiting) |
| @@ -959,8 +959,6 @@ static void remove_range_unlocked(struct dm_integrity_c *ic, struct dm_integrity | |||
| 959 | struct dm_integrity_range *last_range = | 959 | struct dm_integrity_range *last_range = |
| 960 | list_first_entry(&ic->wait_list, struct dm_integrity_range, wait_entry); | 960 | list_first_entry(&ic->wait_list, struct dm_integrity_range, wait_entry); |
| 961 | struct task_struct *last_range_task; | 961 | struct task_struct *last_range_task; |
| 962 | if (!ranges_overlap(range, last_range)) | ||
| 963 | break; | ||
| 964 | last_range_task = last_range->task; | 962 | last_range_task = last_range->task; |
| 965 | list_del(&last_range->wait_entry); | 963 | list_del(&last_range->wait_entry); |
| 966 | if (!add_new_range(ic, last_range, false)) { | 964 | if (!add_new_range(ic, last_range, false)) { |
| @@ -3185,7 +3183,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 3185 | journal_watermark = val; | 3183 | journal_watermark = val; |
| 3186 | else if (sscanf(opt_string, "commit_time:%u%c", &val, &dummy) == 1) | 3184 | else if (sscanf(opt_string, "commit_time:%u%c", &val, &dummy) == 1) |
| 3187 | sync_msec = val; | 3185 | sync_msec = val; |
| 3188 | else if (!memcmp(opt_string, "meta_device:", strlen("meta_device:"))) { | 3186 | else if (!strncmp(opt_string, "meta_device:", strlen("meta_device:"))) { |
| 3189 | if (ic->meta_dev) { | 3187 | if (ic->meta_dev) { |
| 3190 | dm_put_device(ti, ic->meta_dev); | 3188 | dm_put_device(ti, ic->meta_dev); |
| 3191 | ic->meta_dev = NULL; | 3189 | ic->meta_dev = NULL; |
| @@ -3204,17 +3202,17 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 3204 | goto bad; | 3202 | goto bad; |
| 3205 | } | 3203 | } |
| 3206 | ic->sectors_per_block = val >> SECTOR_SHIFT; | 3204 | ic->sectors_per_block = val >> SECTOR_SHIFT; |
| 3207 | } else if (!memcmp(opt_string, "internal_hash:", strlen("internal_hash:"))) { | 3205 | } else if (!strncmp(opt_string, "internal_hash:", strlen("internal_hash:"))) { |
| 3208 | r = get_alg_and_key(opt_string, &ic->internal_hash_alg, &ti->error, | 3206 | r = get_alg_and_key(opt_string, &ic->internal_hash_alg, &ti->error, |
| 3209 | "Invalid internal_hash argument"); | 3207 | "Invalid internal_hash argument"); |
| 3210 | if (r) | 3208 | if (r) |
| 3211 | goto bad; | 3209 | goto bad; |
| 3212 | } else if (!memcmp(opt_string, "journal_crypt:", strlen("journal_crypt:"))) { | 3210 | } else if (!strncmp(opt_string, "journal_crypt:", strlen("journal_crypt:"))) { |
| 3213 | r = get_alg_and_key(opt_string, &ic->journal_crypt_alg, &ti->error, | 3211 | r = get_alg_and_key(opt_string, &ic->journal_crypt_alg, &ti->error, |
| 3214 | "Invalid journal_crypt argument"); | 3212 | "Invalid journal_crypt argument"); |
| 3215 | if (r) | 3213 | if (r) |
| 3216 | goto bad; | 3214 | goto bad; |
| 3217 | } else if (!memcmp(opt_string, "journal_mac:", strlen("journal_mac:"))) { | 3215 | } else if (!strncmp(opt_string, "journal_mac:", strlen("journal_mac:"))) { |
| 3218 | r = get_alg_and_key(opt_string, &ic->journal_mac_alg, &ti->error, | 3216 | r = get_alg_and_key(opt_string, &ic->journal_mac_alg, &ti->error, |
| 3219 | "Invalid journal_mac argument"); | 3217 | "Invalid journal_mac argument"); |
| 3220 | if (r) | 3218 | if (r) |
| @@ -3616,7 +3614,7 @@ static struct target_type integrity_target = { | |||
| 3616 | .io_hints = dm_integrity_io_hints, | 3614 | .io_hints = dm_integrity_io_hints, |
| 3617 | }; | 3615 | }; |
| 3618 | 3616 | ||
| 3619 | int __init dm_integrity_init(void) | 3617 | static int __init dm_integrity_init(void) |
| 3620 | { | 3618 | { |
| 3621 | int r; | 3619 | int r; |
| 3622 | 3620 | ||
| @@ -3635,7 +3633,7 @@ int __init dm_integrity_init(void) | |||
| 3635 | return r; | 3633 | return r; |
| 3636 | } | 3634 | } |
| 3637 | 3635 | ||
| 3638 | void dm_integrity_exit(void) | 3636 | static void __exit dm_integrity_exit(void) |
| 3639 | { | 3637 | { |
| 3640 | dm_unregister_target(&integrity_target); | 3638 | dm_unregister_target(&integrity_target); |
| 3641 | kmem_cache_destroy(journal_io_cache); | 3639 | kmem_cache_destroy(journal_io_cache); |
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 09773636602d..b66745bd08bb 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c | |||
| @@ -222,11 +222,14 @@ static void dm_done(struct request *clone, blk_status_t error, bool mapped) | |||
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | if (unlikely(error == BLK_STS_TARGET)) { | 224 | if (unlikely(error == BLK_STS_TARGET)) { |
| 225 | if (req_op(clone) == REQ_OP_WRITE_SAME && | 225 | if (req_op(clone) == REQ_OP_DISCARD && |
| 226 | !clone->q->limits.max_write_same_sectors) | 226 | !clone->q->limits.max_discard_sectors) |
| 227 | disable_discard(tio->md); | ||
| 228 | else if (req_op(clone) == REQ_OP_WRITE_SAME && | ||
| 229 | !clone->q->limits.max_write_same_sectors) | ||
| 227 | disable_write_same(tio->md); | 230 | disable_write_same(tio->md); |
| 228 | if (req_op(clone) == REQ_OP_WRITE_ZEROES && | 231 | else if (req_op(clone) == REQ_OP_WRITE_ZEROES && |
| 229 | !clone->q->limits.max_write_zeroes_sectors) | 232 | !clone->q->limits.max_write_zeroes_sectors) |
| 230 | disable_write_zeroes(tio->md); | 233 | disable_write_zeroes(tio->md); |
| 231 | } | 234 | } |
| 232 | 235 | ||
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index ba9481f1bf3c..cde3b49b2a91 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
| @@ -1844,6 +1844,36 @@ static bool dm_table_supports_secure_erase(struct dm_table *t) | |||
| 1844 | return true; | 1844 | return true; |
| 1845 | } | 1845 | } |
| 1846 | 1846 | ||
| 1847 | static int device_requires_stable_pages(struct dm_target *ti, | ||
| 1848 | struct dm_dev *dev, sector_t start, | ||
| 1849 | sector_t len, void *data) | ||
| 1850 | { | ||
| 1851 | struct request_queue *q = bdev_get_queue(dev->bdev); | ||
| 1852 | |||
| 1853 | return q && bdi_cap_stable_pages_required(q->backing_dev_info); | ||
| 1854 | } | ||
| 1855 | |||
| 1856 | /* | ||
| 1857 | * If any underlying device requires stable pages, a table must require | ||
| 1858 | * them as well. Only targets that support iterate_devices are considered: | ||
| 1859 | * don't want error, zero, etc to require stable pages. | ||
| 1860 | */ | ||
| 1861 | static bool dm_table_requires_stable_pages(struct dm_table *t) | ||
| 1862 | { | ||
| 1863 | struct dm_target *ti; | ||
| 1864 | unsigned i; | ||
| 1865 | |||
| 1866 | for (i = 0; i < dm_table_get_num_targets(t); i++) { | ||
| 1867 | ti = dm_table_get_target(t, i); | ||
| 1868 | |||
| 1869 | if (ti->type->iterate_devices && | ||
| 1870 | ti->type->iterate_devices(ti, device_requires_stable_pages, NULL)) | ||
| 1871 | return true; | ||
| 1872 | } | ||
| 1873 | |||
| 1874 | return false; | ||
| 1875 | } | ||
| 1876 | |||
| 1847 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | 1877 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, |
| 1848 | struct queue_limits *limits) | 1878 | struct queue_limits *limits) |
| 1849 | { | 1879 | { |
| @@ -1897,6 +1927,15 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
| 1897 | dm_table_verify_integrity(t); | 1927 | dm_table_verify_integrity(t); |
| 1898 | 1928 | ||
| 1899 | /* | 1929 | /* |
| 1930 | * Some devices don't use blk_integrity but still want stable pages | ||
| 1931 | * because they do their own checksumming. | ||
| 1932 | */ | ||
| 1933 | if (dm_table_requires_stable_pages(t)) | ||
| 1934 | q->backing_dev_info->capabilities |= BDI_CAP_STABLE_WRITES; | ||
| 1935 | else | ||
| 1936 | q->backing_dev_info->capabilities &= ~BDI_CAP_STABLE_WRITES; | ||
| 1937 | |||
| 1938 | /* | ||
| 1900 | * Determine whether or not this queue's I/O timings contribute | 1939 | * Determine whether or not this queue's I/O timings contribute |
| 1901 | * to the entropy pool, Only request-based targets use this. | 1940 | * to the entropy pool, Only request-based targets use this. |
| 1902 | * Clear QUEUE_FLAG_ADD_RANDOM if any underlying device does not | 1941 | * Clear QUEUE_FLAG_ADD_RANDOM if any underlying device does not |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 68d24056d0b1..043f0761e4a0 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -945,6 +945,15 @@ static void dec_pending(struct dm_io *io, blk_status_t error) | |||
| 945 | } | 945 | } |
| 946 | } | 946 | } |
| 947 | 947 | ||
| 948 | void disable_discard(struct mapped_device *md) | ||
| 949 | { | ||
| 950 | struct queue_limits *limits = dm_get_queue_limits(md); | ||
| 951 | |||
| 952 | /* device doesn't really support DISCARD, disable it */ | ||
| 953 | limits->max_discard_sectors = 0; | ||
| 954 | blk_queue_flag_clear(QUEUE_FLAG_DISCARD, md->queue); | ||
| 955 | } | ||
| 956 | |||
| 948 | void disable_write_same(struct mapped_device *md) | 957 | void disable_write_same(struct mapped_device *md) |
| 949 | { | 958 | { |
| 950 | struct queue_limits *limits = dm_get_queue_limits(md); | 959 | struct queue_limits *limits = dm_get_queue_limits(md); |
| @@ -970,11 +979,14 @@ static void clone_endio(struct bio *bio) | |||
| 970 | dm_endio_fn endio = tio->ti->type->end_io; | 979 | dm_endio_fn endio = tio->ti->type->end_io; |
| 971 | 980 | ||
| 972 | if (unlikely(error == BLK_STS_TARGET) && md->type != DM_TYPE_NVME_BIO_BASED) { | 981 | if (unlikely(error == BLK_STS_TARGET) && md->type != DM_TYPE_NVME_BIO_BASED) { |
| 973 | if (bio_op(bio) == REQ_OP_WRITE_SAME && | 982 | if (bio_op(bio) == REQ_OP_DISCARD && |
| 974 | !bio->bi_disk->queue->limits.max_write_same_sectors) | 983 | !bio->bi_disk->queue->limits.max_discard_sectors) |
| 984 | disable_discard(md); | ||
| 985 | else if (bio_op(bio) == REQ_OP_WRITE_SAME && | ||
| 986 | !bio->bi_disk->queue->limits.max_write_same_sectors) | ||
| 975 | disable_write_same(md); | 987 | disable_write_same(md); |
| 976 | if (bio_op(bio) == REQ_OP_WRITE_ZEROES && | 988 | else if (bio_op(bio) == REQ_OP_WRITE_ZEROES && |
| 977 | !bio->bi_disk->queue->limits.max_write_zeroes_sectors) | 989 | !bio->bi_disk->queue->limits.max_write_zeroes_sectors) |
| 978 | disable_write_zeroes(md); | 990 | disable_write_zeroes(md); |
| 979 | } | 991 | } |
| 980 | 992 | ||
| @@ -1042,15 +1054,7 @@ int dm_set_target_max_io_len(struct dm_target *ti, sector_t len) | |||
| 1042 | return -EINVAL; | 1054 | return -EINVAL; |
| 1043 | } | 1055 | } |
| 1044 | 1056 | ||
| 1045 | /* | 1057 | ti->max_io_len = (uint32_t) len; |
| 1046 | * BIO based queue uses its own splitting. When multipage bvecs | ||
| 1047 | * is switched on, size of the incoming bio may be too big to | ||
| 1048 | * be handled in some targets, such as crypt. | ||
| 1049 | * | ||
| 1050 | * When these targets are ready for the big bio, we can remove | ||
| 1051 | * the limit. | ||
| 1052 | */ | ||
| 1053 | ti->max_io_len = min_t(uint32_t, len, BIO_MAX_PAGES * PAGE_SIZE); | ||
| 1054 | 1058 | ||
| 1055 | return 0; | 1059 | return 0; |
| 1056 | } | 1060 | } |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 0ce2d8dfc5f1..26ad6468d13a 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -1246,7 +1246,7 @@ config MFD_STA2X11 | |||
| 1246 | 1246 | ||
| 1247 | config MFD_SUN6I_PRCM | 1247 | config MFD_SUN6I_PRCM |
| 1248 | bool "Allwinner A31 PRCM controller" | 1248 | bool "Allwinner A31 PRCM controller" |
| 1249 | depends on ARCH_SUNXI | 1249 | depends on ARCH_SUNXI || COMPILE_TEST |
| 1250 | select MFD_CORE | 1250 | select MFD_CORE |
| 1251 | help | 1251 | help |
| 1252 | Support for the PRCM (Power/Reset/Clock Management) unit available | 1252 | Support for the PRCM (Power/Reset/Clock Management) unit available |
diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c index 69df27769c21..43ac71691fe4 100644 --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c | |||
| @@ -53,67 +53,67 @@ static const struct sprd_pmic_data sc2731_data = { | |||
| 53 | static const struct mfd_cell sprd_pmic_devs[] = { | 53 | static const struct mfd_cell sprd_pmic_devs[] = { |
| 54 | { | 54 | { |
| 55 | .name = "sc27xx-wdt", | 55 | .name = "sc27xx-wdt", |
| 56 | .of_compatible = "sprd,sc27xx-wdt", | 56 | .of_compatible = "sprd,sc2731-wdt", |
| 57 | }, { | 57 | }, { |
| 58 | .name = "sc27xx-rtc", | 58 | .name = "sc27xx-rtc", |
| 59 | .of_compatible = "sprd,sc27xx-rtc", | 59 | .of_compatible = "sprd,sc2731-rtc", |
| 60 | }, { | 60 | }, { |
| 61 | .name = "sc27xx-charger", | 61 | .name = "sc27xx-charger", |
| 62 | .of_compatible = "sprd,sc27xx-charger", | 62 | .of_compatible = "sprd,sc2731-charger", |
| 63 | }, { | 63 | }, { |
| 64 | .name = "sc27xx-chg-timer", | 64 | .name = "sc27xx-chg-timer", |
| 65 | .of_compatible = "sprd,sc27xx-chg-timer", | 65 | .of_compatible = "sprd,sc2731-chg-timer", |
| 66 | }, { | 66 | }, { |
| 67 | .name = "sc27xx-fast-chg", | 67 | .name = "sc27xx-fast-chg", |
| 68 | .of_compatible = "sprd,sc27xx-fast-chg", | 68 | .of_compatible = "sprd,sc2731-fast-chg", |
| 69 | }, { | 69 | }, { |
| 70 | .name = "sc27xx-chg-wdt", | 70 | .name = "sc27xx-chg-wdt", |
| 71 | .of_compatible = "sprd,sc27xx-chg-wdt", | 71 | .of_compatible = "sprd,sc2731-chg-wdt", |
| 72 | }, { | 72 | }, { |
| 73 | .name = "sc27xx-typec", | 73 | .name = "sc27xx-typec", |
| 74 | .of_compatible = "sprd,sc27xx-typec", | 74 | .of_compatible = "sprd,sc2731-typec", |
| 75 | }, { | 75 | }, { |
| 76 | .name = "sc27xx-flash", | 76 | .name = "sc27xx-flash", |
| 77 | .of_compatible = "sprd,sc27xx-flash", | 77 | .of_compatible = "sprd,sc2731-flash", |
| 78 | }, { | 78 | }, { |
| 79 | .name = "sc27xx-eic", | 79 | .name = "sc27xx-eic", |
| 80 | .of_compatible = "sprd,sc27xx-eic", | 80 | .of_compatible = "sprd,sc2731-eic", |
| 81 | }, { | 81 | }, { |
| 82 | .name = "sc27xx-efuse", | 82 | .name = "sc27xx-efuse", |
| 83 | .of_compatible = "sprd,sc27xx-efuse", | 83 | .of_compatible = "sprd,sc2731-efuse", |
| 84 | }, { | 84 | }, { |
| 85 | .name = "sc27xx-thermal", | 85 | .name = "sc27xx-thermal", |
| 86 | .of_compatible = "sprd,sc27xx-thermal", | 86 | .of_compatible = "sprd,sc2731-thermal", |
| 87 | }, { | 87 | }, { |
| 88 | .name = "sc27xx-adc", | 88 | .name = "sc27xx-adc", |
| 89 | .of_compatible = "sprd,sc27xx-adc", | 89 | .of_compatible = "sprd,sc2731-adc", |
| 90 | }, { | 90 | }, { |
| 91 | .name = "sc27xx-audio-codec", | 91 | .name = "sc27xx-audio-codec", |
| 92 | .of_compatible = "sprd,sc27xx-audio-codec", | 92 | .of_compatible = "sprd,sc2731-audio-codec", |
| 93 | }, { | 93 | }, { |
| 94 | .name = "sc27xx-regulator", | 94 | .name = "sc27xx-regulator", |
| 95 | .of_compatible = "sprd,sc27xx-regulator", | 95 | .of_compatible = "sprd,sc2731-regulator", |
| 96 | }, { | 96 | }, { |
| 97 | .name = "sc27xx-vibrator", | 97 | .name = "sc27xx-vibrator", |
| 98 | .of_compatible = "sprd,sc27xx-vibrator", | 98 | .of_compatible = "sprd,sc2731-vibrator", |
| 99 | }, { | 99 | }, { |
| 100 | .name = "sc27xx-keypad-led", | 100 | .name = "sc27xx-keypad-led", |
| 101 | .of_compatible = "sprd,sc27xx-keypad-led", | 101 | .of_compatible = "sprd,sc2731-keypad-led", |
| 102 | }, { | 102 | }, { |
| 103 | .name = "sc27xx-bltc", | 103 | .name = "sc27xx-bltc", |
| 104 | .of_compatible = "sprd,sc27xx-bltc", | 104 | .of_compatible = "sprd,sc2731-bltc", |
| 105 | }, { | 105 | }, { |
| 106 | .name = "sc27xx-fgu", | 106 | .name = "sc27xx-fgu", |
| 107 | .of_compatible = "sprd,sc27xx-fgu", | 107 | .of_compatible = "sprd,sc2731-fgu", |
| 108 | }, { | 108 | }, { |
| 109 | .name = "sc27xx-7sreset", | 109 | .name = "sc27xx-7sreset", |
| 110 | .of_compatible = "sprd,sc27xx-7sreset", | 110 | .of_compatible = "sprd,sc2731-7sreset", |
| 111 | }, { | 111 | }, { |
| 112 | .name = "sc27xx-poweroff", | 112 | .name = "sc27xx-poweroff", |
| 113 | .of_compatible = "sprd,sc27xx-poweroff", | 113 | .of_compatible = "sprd,sc2731-poweroff", |
| 114 | }, { | 114 | }, { |
| 115 | .name = "sc27xx-syscon", | 115 | .name = "sc27xx-syscon", |
| 116 | .of_compatible = "sprd,sc27xx-syscon", | 116 | .of_compatible = "sprd,sc2731-syscon", |
| 117 | }, | 117 | }, |
| 118 | }; | 118 | }; |
| 119 | 119 | ||
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 299016bc46d9..104477b512a2 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
| @@ -1245,6 +1245,28 @@ free: | |||
| 1245 | return status; | 1245 | return status; |
| 1246 | } | 1246 | } |
| 1247 | 1247 | ||
| 1248 | static int __maybe_unused twl_suspend(struct device *dev) | ||
| 1249 | { | ||
| 1250 | struct i2c_client *client = to_i2c_client(dev); | ||
| 1251 | |||
| 1252 | if (client->irq) | ||
| 1253 | disable_irq(client->irq); | ||
| 1254 | |||
| 1255 | return 0; | ||
| 1256 | } | ||
| 1257 | |||
| 1258 | static int __maybe_unused twl_resume(struct device *dev) | ||
| 1259 | { | ||
| 1260 | struct i2c_client *client = to_i2c_client(dev); | ||
| 1261 | |||
| 1262 | if (client->irq) | ||
| 1263 | enable_irq(client->irq); | ||
| 1264 | |||
| 1265 | return 0; | ||
| 1266 | } | ||
| 1267 | |||
| 1268 | static SIMPLE_DEV_PM_OPS(twl_dev_pm_ops, twl_suspend, twl_resume); | ||
| 1269 | |||
| 1248 | static const struct i2c_device_id twl_ids[] = { | 1270 | static const struct i2c_device_id twl_ids[] = { |
| 1249 | { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */ | 1271 | { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */ |
| 1250 | { "twl5030", 0 }, /* T2 updated */ | 1272 | { "twl5030", 0 }, /* T2 updated */ |
| @@ -1262,6 +1284,7 @@ static const struct i2c_device_id twl_ids[] = { | |||
| 1262 | /* One Client Driver , 4 Clients */ | 1284 | /* One Client Driver , 4 Clients */ |
| 1263 | static struct i2c_driver twl_driver = { | 1285 | static struct i2c_driver twl_driver = { |
| 1264 | .driver.name = DRIVER_NAME, | 1286 | .driver.name = DRIVER_NAME, |
| 1287 | .driver.pm = &twl_dev_pm_ops, | ||
| 1265 | .id_table = twl_ids, | 1288 | .id_table = twl_ids, |
| 1266 | .probe = twl_probe, | 1289 | .probe = twl_probe, |
| 1267 | .remove = twl_remove, | 1290 | .remove = twl_remove, |
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 39f832d27288..36d0d5c9cfba 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c | |||
| @@ -1184,6 +1184,7 @@ static int fastrpc_cb_probe(struct platform_device *pdev) | |||
| 1184 | struct fastrpc_session_ctx *sess; | 1184 | struct fastrpc_session_ctx *sess; |
| 1185 | struct device *dev = &pdev->dev; | 1185 | struct device *dev = &pdev->dev; |
| 1186 | int i, sessions = 0; | 1186 | int i, sessions = 0; |
| 1187 | int rc; | ||
| 1187 | 1188 | ||
| 1188 | cctx = dev_get_drvdata(dev->parent); | 1189 | cctx = dev_get_drvdata(dev->parent); |
| 1189 | if (!cctx) | 1190 | if (!cctx) |
| @@ -1213,7 +1214,11 @@ static int fastrpc_cb_probe(struct platform_device *pdev) | |||
| 1213 | } | 1214 | } |
| 1214 | cctx->sesscount++; | 1215 | cctx->sesscount++; |
| 1215 | spin_unlock(&cctx->lock); | 1216 | spin_unlock(&cctx->lock); |
| 1216 | dma_set_mask(dev, DMA_BIT_MASK(32)); | 1217 | rc = dma_set_mask(dev, DMA_BIT_MASK(32)); |
| 1218 | if (rc) { | ||
| 1219 | dev_err(dev, "32-bit DMA enable failed\n"); | ||
| 1220 | return rc; | ||
| 1221 | } | ||
| 1217 | 1222 | ||
| 1218 | return 0; | 1223 | return 0; |
| 1219 | } | 1224 | } |
diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c index ea979ebd62fb..3c509e19d69d 100644 --- a/drivers/misc/habanalabs/goya/goya.c +++ b/drivers/misc/habanalabs/goya/goya.c | |||
| @@ -1688,12 +1688,11 @@ static void goya_init_golden_registers(struct hl_device *hdev) | |||
| 1688 | 1688 | ||
| 1689 | /* | 1689 | /* |
| 1690 | * Workaround for H2 #HW-23 bug | 1690 | * Workaround for H2 #HW-23 bug |
| 1691 | * Set DMA max outstanding read requests to 240 on DMA CH 1. Set it | 1691 | * Set DMA max outstanding read requests to 240 on DMA CH 1. |
| 1692 | * to 16 on KMD DMA | 1692 | * This limitation is still large enough to not affect Gen4 bandwidth. |
| 1693 | * We need to limit only these DMAs because the user can only read | 1693 | * We need to only limit that DMA channel because the user can only read |
| 1694 | * from Host using DMA CH 1 | 1694 | * from Host using DMA CH 1 |
| 1695 | */ | 1695 | */ |
| 1696 | WREG32(mmDMA_CH_0_CFG0, 0x0fff0010); | ||
| 1697 | WREG32(mmDMA_CH_1_CFG0, 0x0fff00F0); | 1696 | WREG32(mmDMA_CH_1_CFG0, 0x0fff00F0); |
| 1698 | 1697 | ||
| 1699 | goya->hw_cap_initialized |= HW_CAP_GOLDEN; | 1698 | goya->hw_cap_initialized |= HW_CAP_GOLDEN; |
| @@ -3693,7 +3692,7 @@ static int goya_validate_dma_pkt_mmu(struct hl_device *hdev, | |||
| 3693 | * WA for HW-23. | 3692 | * WA for HW-23. |
| 3694 | * We can't allow user to read from Host using QMANs other than 1. | 3693 | * We can't allow user to read from Host using QMANs other than 1. |
| 3695 | */ | 3694 | */ |
| 3696 | if (parser->hw_queue_id > GOYA_QUEUE_ID_DMA_1 && | 3695 | if (parser->hw_queue_id != GOYA_QUEUE_ID_DMA_1 && |
| 3697 | hl_mem_area_inside_range(le64_to_cpu(user_dma_pkt->src_addr), | 3696 | hl_mem_area_inside_range(le64_to_cpu(user_dma_pkt->src_addr), |
| 3698 | le32_to_cpu(user_dma_pkt->tsize), | 3697 | le32_to_cpu(user_dma_pkt->tsize), |
| 3699 | hdev->asic_prop.va_space_host_start_address, | 3698 | hdev->asic_prop.va_space_host_start_address, |
diff --git a/drivers/mmc/host/alcor.c b/drivers/mmc/host/alcor.c index 82a97866e0cf..7c8f203f9a24 100644 --- a/drivers/mmc/host/alcor.c +++ b/drivers/mmc/host/alcor.c | |||
| @@ -48,7 +48,6 @@ struct alcor_sdmmc_host { | |||
| 48 | struct mmc_command *cmd; | 48 | struct mmc_command *cmd; |
| 49 | struct mmc_data *data; | 49 | struct mmc_data *data; |
| 50 | unsigned int dma_on:1; | 50 | unsigned int dma_on:1; |
| 51 | unsigned int early_data:1; | ||
| 52 | 51 | ||
| 53 | struct mutex cmd_mutex; | 52 | struct mutex cmd_mutex; |
| 54 | 53 | ||
| @@ -144,8 +143,7 @@ static void alcor_data_set_dma(struct alcor_sdmmc_host *host) | |||
| 144 | host->sg_count--; | 143 | host->sg_count--; |
| 145 | } | 144 | } |
| 146 | 145 | ||
| 147 | static void alcor_trigger_data_transfer(struct alcor_sdmmc_host *host, | 146 | static void alcor_trigger_data_transfer(struct alcor_sdmmc_host *host) |
| 148 | bool early) | ||
| 149 | { | 147 | { |
| 150 | struct alcor_pci_priv *priv = host->alcor_pci; | 148 | struct alcor_pci_priv *priv = host->alcor_pci; |
| 151 | struct mmc_data *data = host->data; | 149 | struct mmc_data *data = host->data; |
| @@ -155,13 +153,6 @@ static void alcor_trigger_data_transfer(struct alcor_sdmmc_host *host, | |||
| 155 | ctrl |= AU6601_DATA_WRITE; | 153 | ctrl |= AU6601_DATA_WRITE; |
| 156 | 154 | ||
| 157 | if (data->host_cookie == COOKIE_MAPPED) { | 155 | if (data->host_cookie == COOKIE_MAPPED) { |
| 158 | if (host->early_data) { | ||
| 159 | host->early_data = false; | ||
| 160 | return; | ||
| 161 | } | ||
| 162 | |||
| 163 | host->early_data = early; | ||
| 164 | |||
| 165 | alcor_data_set_dma(host); | 156 | alcor_data_set_dma(host); |
| 166 | ctrl |= AU6601_DATA_DMA_MODE; | 157 | ctrl |= AU6601_DATA_DMA_MODE; |
| 167 | host->dma_on = 1; | 158 | host->dma_on = 1; |
| @@ -231,6 +222,7 @@ static void alcor_prepare_sg_miter(struct alcor_sdmmc_host *host) | |||
| 231 | static void alcor_prepare_data(struct alcor_sdmmc_host *host, | 222 | static void alcor_prepare_data(struct alcor_sdmmc_host *host, |
| 232 | struct mmc_command *cmd) | 223 | struct mmc_command *cmd) |
| 233 | { | 224 | { |
| 225 | struct alcor_pci_priv *priv = host->alcor_pci; | ||
| 234 | struct mmc_data *data = cmd->data; | 226 | struct mmc_data *data = cmd->data; |
| 235 | 227 | ||
| 236 | if (!data) | 228 | if (!data) |
| @@ -248,7 +240,7 @@ static void alcor_prepare_data(struct alcor_sdmmc_host *host, | |||
| 248 | if (data->host_cookie != COOKIE_MAPPED) | 240 | if (data->host_cookie != COOKIE_MAPPED) |
| 249 | alcor_prepare_sg_miter(host); | 241 | alcor_prepare_sg_miter(host); |
| 250 | 242 | ||
| 251 | alcor_trigger_data_transfer(host, true); | 243 | alcor_write8(priv, 0, AU6601_DATA_XFER_CTRL); |
| 252 | } | 244 | } |
| 253 | 245 | ||
| 254 | static void alcor_send_cmd(struct alcor_sdmmc_host *host, | 246 | static void alcor_send_cmd(struct alcor_sdmmc_host *host, |
| @@ -435,7 +427,7 @@ static int alcor_cmd_irq_done(struct alcor_sdmmc_host *host, u32 intmask) | |||
| 435 | if (!host->data) | 427 | if (!host->data) |
| 436 | return false; | 428 | return false; |
| 437 | 429 | ||
| 438 | alcor_trigger_data_transfer(host, false); | 430 | alcor_trigger_data_transfer(host); |
| 439 | host->cmd = NULL; | 431 | host->cmd = NULL; |
| 440 | return true; | 432 | return true; |
| 441 | } | 433 | } |
| @@ -456,7 +448,7 @@ static void alcor_cmd_irq_thread(struct alcor_sdmmc_host *host, u32 intmask) | |||
| 456 | if (!host->data) | 448 | if (!host->data) |
| 457 | alcor_request_complete(host, 1); | 449 | alcor_request_complete(host, 1); |
| 458 | else | 450 | else |
| 459 | alcor_trigger_data_transfer(host, false); | 451 | alcor_trigger_data_transfer(host); |
| 460 | host->cmd = NULL; | 452 | host->cmd = NULL; |
| 461 | } | 453 | } |
| 462 | 454 | ||
| @@ -487,15 +479,9 @@ static int alcor_data_irq_done(struct alcor_sdmmc_host *host, u32 intmask) | |||
| 487 | break; | 479 | break; |
| 488 | case AU6601_INT_READ_BUF_RDY: | 480 | case AU6601_INT_READ_BUF_RDY: |
| 489 | alcor_trf_block_pio(host, true); | 481 | alcor_trf_block_pio(host, true); |
| 490 | if (!host->blocks) | ||
| 491 | break; | ||
| 492 | alcor_trigger_data_transfer(host, false); | ||
| 493 | return 1; | 482 | return 1; |
| 494 | case AU6601_INT_WRITE_BUF_RDY: | 483 | case AU6601_INT_WRITE_BUF_RDY: |
| 495 | alcor_trf_block_pio(host, false); | 484 | alcor_trf_block_pio(host, false); |
| 496 | if (!host->blocks) | ||
| 497 | break; | ||
| 498 | alcor_trigger_data_transfer(host, false); | ||
| 499 | return 1; | 485 | return 1; |
| 500 | case AU6601_INT_DMA_END: | 486 | case AU6601_INT_DMA_END: |
| 501 | if (!host->sg_count) | 487 | if (!host->sg_count) |
| @@ -508,8 +494,14 @@ static int alcor_data_irq_done(struct alcor_sdmmc_host *host, u32 intmask) | |||
| 508 | break; | 494 | break; |
| 509 | } | 495 | } |
| 510 | 496 | ||
| 511 | if (intmask & AU6601_INT_DATA_END) | 497 | if (intmask & AU6601_INT_DATA_END) { |
| 512 | return 0; | 498 | if (!host->dma_on && host->blocks) { |
| 499 | alcor_trigger_data_transfer(host); | ||
| 500 | return 1; | ||
| 501 | } else { | ||
| 502 | return 0; | ||
| 503 | } | ||
| 504 | } | ||
| 513 | 505 | ||
| 514 | return 1; | 506 | return 1; |
| 515 | } | 507 | } |
diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 5bbed477c9b1..9f20fff9781b 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c | |||
| @@ -797,6 +797,43 @@ void sdhci_omap_reset(struct sdhci_host *host, u8 mask) | |||
| 797 | sdhci_reset(host, mask); | 797 | sdhci_reset(host, mask); |
| 798 | } | 798 | } |
| 799 | 799 | ||
| 800 | #define CMD_ERR_MASK (SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX |\ | ||
| 801 | SDHCI_INT_TIMEOUT) | ||
| 802 | #define CMD_MASK (CMD_ERR_MASK | SDHCI_INT_RESPONSE) | ||
| 803 | |||
| 804 | static u32 sdhci_omap_irq(struct sdhci_host *host, u32 intmask) | ||
| 805 | { | ||
| 806 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | ||
| 807 | struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); | ||
| 808 | |||
| 809 | if (omap_host->is_tuning && host->cmd && !host->data_early && | ||
| 810 | (intmask & CMD_ERR_MASK)) { | ||
| 811 | |||
| 812 | /* | ||
| 813 | * Since we are not resetting data lines during tuning | ||
| 814 | * operation, data error or data complete interrupts | ||
| 815 | * might still arrive. Mark this request as a failure | ||
| 816 | * but still wait for the data interrupt | ||
| 817 | */ | ||
| 818 | if (intmask & SDHCI_INT_TIMEOUT) | ||
| 819 | host->cmd->error = -ETIMEDOUT; | ||
| 820 | else | ||
| 821 | host->cmd->error = -EILSEQ; | ||
| 822 | |||
| 823 | host->cmd = NULL; | ||
| 824 | |||
| 825 | /* | ||
| 826 | * Sometimes command error interrupts and command complete | ||
| 827 | * interrupt will arrive together. Clear all command related | ||
| 828 | * interrupts here. | ||
| 829 | */ | ||
| 830 | sdhci_writel(host, intmask & CMD_MASK, SDHCI_INT_STATUS); | ||
| 831 | intmask &= ~CMD_MASK; | ||
| 832 | } | ||
| 833 | |||
| 834 | return intmask; | ||
| 835 | } | ||
| 836 | |||
| 800 | static struct sdhci_ops sdhci_omap_ops = { | 837 | static struct sdhci_ops sdhci_omap_ops = { |
| 801 | .set_clock = sdhci_omap_set_clock, | 838 | .set_clock = sdhci_omap_set_clock, |
| 802 | .set_power = sdhci_omap_set_power, | 839 | .set_power = sdhci_omap_set_power, |
| @@ -807,6 +844,7 @@ static struct sdhci_ops sdhci_omap_ops = { | |||
| 807 | .platform_send_init_74_clocks = sdhci_omap_init_74_clocks, | 844 | .platform_send_init_74_clocks = sdhci_omap_init_74_clocks, |
| 808 | .reset = sdhci_omap_reset, | 845 | .reset = sdhci_omap_reset, |
| 809 | .set_uhs_signaling = sdhci_omap_set_uhs_signaling, | 846 | .set_uhs_signaling = sdhci_omap_set_uhs_signaling, |
| 847 | .irq = sdhci_omap_irq, | ||
| 810 | }; | 848 | }; |
| 811 | 849 | ||
| 812 | static int sdhci_omap_set_capabilities(struct sdhci_omap_host *omap_host) | 850 | static int sdhci_omap_set_capabilities(struct sdhci_omap_host *omap_host) |
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 72428b6bfc47..7b7286b4d81e 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
| @@ -1876,7 +1876,11 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1876 | continue; | 1876 | continue; |
| 1877 | } | 1877 | } |
| 1878 | 1878 | ||
| 1879 | if (time_after(jiffies, timeo) && !chip_ready(map, adr)) | 1879 | /* |
| 1880 | * We check "time_after" and "!chip_good" before checking "chip_good" to avoid | ||
| 1881 | * the failure due to scheduling. | ||
| 1882 | */ | ||
| 1883 | if (time_after(jiffies, timeo) && !chip_good(map, adr, datum)) | ||
| 1880 | break; | 1884 | break; |
| 1881 | 1885 | ||
| 1882 | if (chip_good(map, adr, datum)) { | 1886 | if (chip_good(map, adr, datum)) { |
diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c index f38e5c1b87e4..d984538980e2 100644 --- a/drivers/mtd/nand/raw/marvell_nand.c +++ b/drivers/mtd/nand/raw/marvell_nand.c | |||
| @@ -722,12 +722,6 @@ static void marvell_nfc_select_target(struct nand_chip *chip, | |||
| 722 | struct marvell_nfc *nfc = to_marvell_nfc(chip->controller); | 722 | struct marvell_nfc *nfc = to_marvell_nfc(chip->controller); |
| 723 | u32 ndcr_generic; | 723 | u32 ndcr_generic; |
| 724 | 724 | ||
| 725 | if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die) | ||
| 726 | return; | ||
| 727 | |||
| 728 | writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0); | ||
| 729 | writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1); | ||
| 730 | |||
| 731 | /* | 725 | /* |
| 732 | * Reset the NDCR register to a clean state for this particular chip, | 726 | * Reset the NDCR register to a clean state for this particular chip, |
| 733 | * also clear ND_RUN bit. | 727 | * also clear ND_RUN bit. |
| @@ -739,6 +733,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip, | |||
| 739 | /* Also reset the interrupt status register */ | 733 | /* Also reset the interrupt status register */ |
| 740 | marvell_nfc_clear_int(nfc, NDCR_ALL_INT); | 734 | marvell_nfc_clear_int(nfc, NDCR_ALL_INT); |
| 741 | 735 | ||
| 736 | if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die) | ||
| 737 | return; | ||
| 738 | |||
| 739 | writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0); | ||
| 740 | writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1); | ||
| 741 | |||
| 742 | nfc->selected_chip = chip; | 742 | nfc->selected_chip = chip; |
| 743 | marvell_nand->selected_die = die_nr; | 743 | marvell_nand->selected_die = die_nr; |
| 744 | } | 744 | } |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b59708c35faf..ee610721098e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -3213,8 +3213,12 @@ static int bond_netdev_event(struct notifier_block *this, | |||
| 3213 | return NOTIFY_DONE; | 3213 | return NOTIFY_DONE; |
| 3214 | 3214 | ||
| 3215 | if (event_dev->flags & IFF_MASTER) { | 3215 | if (event_dev->flags & IFF_MASTER) { |
| 3216 | int ret; | ||
| 3217 | |||
| 3216 | netdev_dbg(event_dev, "IFF_MASTER\n"); | 3218 | netdev_dbg(event_dev, "IFF_MASTER\n"); |
| 3217 | return bond_master_netdev_event(event, event_dev); | 3219 | ret = bond_master_netdev_event(event, event_dev); |
| 3220 | if (ret != NOTIFY_DONE) | ||
| 3221 | return ret; | ||
| 3218 | } | 3222 | } |
| 3219 | 3223 | ||
| 3220 | if (event_dev->flags & IFF_SLAVE) { | 3224 | if (event_dev->flags & IFF_SLAVE) { |
diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c index 2f120b2ffef0..4985268e2273 100644 --- a/drivers/net/bonding/bond_sysfs_slave.c +++ b/drivers/net/bonding/bond_sysfs_slave.c | |||
| @@ -55,7 +55,9 @@ static SLAVE_ATTR_RO(link_failure_count); | |||
| 55 | 55 | ||
| 56 | static ssize_t perm_hwaddr_show(struct slave *slave, char *buf) | 56 | static ssize_t perm_hwaddr_show(struct slave *slave, char *buf) |
| 57 | { | 57 | { |
| 58 | return sprintf(buf, "%pM\n", slave->perm_hwaddr); | 58 | return sprintf(buf, "%*phC\n", |
| 59 | slave->dev->addr_len, | ||
| 60 | slave->perm_hwaddr); | ||
| 59 | } | 61 | } |
| 60 | static SLAVE_ATTR_RO(perm_hwaddr); | 62 | static SLAVE_ATTR_RO(perm_hwaddr); |
| 61 | 63 | ||
diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c index e6234d209787..4212bc4a5f31 100644 --- a/drivers/net/dsa/bcm_sf2_cfp.c +++ b/drivers/net/dsa/bcm_sf2_cfp.c | |||
| @@ -886,6 +886,9 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port, | |||
| 886 | fs->m_ext.data[1])) | 886 | fs->m_ext.data[1])) |
| 887 | return -EINVAL; | 887 | return -EINVAL; |
| 888 | 888 | ||
| 889 | if (fs->location != RX_CLS_LOC_ANY && fs->location >= CFP_NUM_RULES) | ||
| 890 | return -EINVAL; | ||
| 891 | |||
| 889 | if (fs->location != RX_CLS_LOC_ANY && | 892 | if (fs->location != RX_CLS_LOC_ANY && |
| 890 | test_bit(fs->location, priv->cfp.used)) | 893 | test_bit(fs->location, priv->cfp.used)) |
| 891 | return -EBUSY; | 894 | return -EBUSY; |
| @@ -974,6 +977,9 @@ static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, int port, u32 loc) | |||
| 974 | struct cfp_rule *rule; | 977 | struct cfp_rule *rule; |
| 975 | int ret; | 978 | int ret; |
| 976 | 979 | ||
| 980 | if (loc >= CFP_NUM_RULES) | ||
| 981 | return -EINVAL; | ||
| 982 | |||
| 977 | /* Refuse deleting unused rules, and those that are not unique since | 983 | /* Refuse deleting unused rules, and those that are not unique since |
| 978 | * that could leave IPv6 rules with one of the chained rule in the | 984 | * that could leave IPv6 rules with one of the chained rule in the |
| 979 | * table. | 985 | * table. |
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index dce84a2a65c7..c44b2822e4dd 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c | |||
| @@ -427,18 +427,22 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, | |||
| 427 | return 0; | 427 | return 0; |
| 428 | 428 | ||
| 429 | lane = mv88e6390x_serdes_get_lane(chip, port); | 429 | lane = mv88e6390x_serdes_get_lane(chip, port); |
| 430 | if (lane < 0) | 430 | if (lane < 0 && lane != -ENODEV) |
| 431 | return lane; | 431 | return lane; |
| 432 | 432 | ||
| 433 | if (chip->ports[port].serdes_irq) { | 433 | if (lane >= 0) { |
| 434 | err = mv88e6390_serdes_irq_disable(chip, port, lane); | 434 | if (chip->ports[port].serdes_irq) { |
| 435 | err = mv88e6390_serdes_irq_disable(chip, port, lane); | ||
| 436 | if (err) | ||
| 437 | return err; | ||
| 438 | } | ||
| 439 | |||
| 440 | err = mv88e6390x_serdes_power(chip, port, false); | ||
| 435 | if (err) | 441 | if (err) |
| 436 | return err; | 442 | return err; |
| 437 | } | 443 | } |
| 438 | 444 | ||
| 439 | err = mv88e6390x_serdes_power(chip, port, false); | 445 | chip->ports[port].cmode = 0; |
| 440 | if (err) | ||
| 441 | return err; | ||
| 442 | 446 | ||
| 443 | if (cmode) { | 447 | if (cmode) { |
| 444 | err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, ®); | 448 | err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, ®); |
| @@ -452,6 +456,12 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, | |||
| 452 | if (err) | 456 | if (err) |
| 453 | return err; | 457 | return err; |
| 454 | 458 | ||
| 459 | chip->ports[port].cmode = cmode; | ||
| 460 | |||
| 461 | lane = mv88e6390x_serdes_get_lane(chip, port); | ||
| 462 | if (lane < 0) | ||
| 463 | return lane; | ||
| 464 | |||
| 455 | err = mv88e6390x_serdes_power(chip, port, true); | 465 | err = mv88e6390x_serdes_power(chip, port, true); |
| 456 | if (err) | 466 | if (err) |
| 457 | return err; | 467 | return err; |
| @@ -463,8 +473,6 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, | |||
| 463 | } | 473 | } |
| 464 | } | 474 | } |
| 465 | 475 | ||
| 466 | chip->ports[port].cmode = cmode; | ||
| 467 | |||
| 468 | return 0; | 476 | return 0; |
| 469 | } | 477 | } |
| 470 | 478 | ||
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index 9e07b469066a..156fbc5601ca 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | |||
| @@ -1721,7 +1721,7 @@ static void atl1_inc_smb(struct atl1_adapter *adapter) | |||
| 1721 | adapter->soft_stats.scc += smb->tx_1_col; | 1721 | adapter->soft_stats.scc += smb->tx_1_col; |
| 1722 | adapter->soft_stats.mcc += smb->tx_2_col; | 1722 | adapter->soft_stats.mcc += smb->tx_2_col; |
| 1723 | adapter->soft_stats.latecol += smb->tx_late_col; | 1723 | adapter->soft_stats.latecol += smb->tx_late_col; |
| 1724 | adapter->soft_stats.tx_underun += smb->tx_underrun; | 1724 | adapter->soft_stats.tx_underrun += smb->tx_underrun; |
| 1725 | adapter->soft_stats.tx_trunc += smb->tx_trunc; | 1725 | adapter->soft_stats.tx_trunc += smb->tx_trunc; |
| 1726 | adapter->soft_stats.tx_pause += smb->tx_pause; | 1726 | adapter->soft_stats.tx_pause += smb->tx_pause; |
| 1727 | 1727 | ||
| @@ -3179,7 +3179,7 @@ static struct atl1_stats atl1_gstrings_stats[] = { | |||
| 3179 | {"tx_deferred_ok", ATL1_STAT(soft_stats.deffer)}, | 3179 | {"tx_deferred_ok", ATL1_STAT(soft_stats.deffer)}, |
| 3180 | {"tx_single_coll_ok", ATL1_STAT(soft_stats.scc)}, | 3180 | {"tx_single_coll_ok", ATL1_STAT(soft_stats.scc)}, |
| 3181 | {"tx_multi_coll_ok", ATL1_STAT(soft_stats.mcc)}, | 3181 | {"tx_multi_coll_ok", ATL1_STAT(soft_stats.mcc)}, |
| 3182 | {"tx_underun", ATL1_STAT(soft_stats.tx_underun)}, | 3182 | {"tx_underrun", ATL1_STAT(soft_stats.tx_underrun)}, |
| 3183 | {"tx_trunc", ATL1_STAT(soft_stats.tx_trunc)}, | 3183 | {"tx_trunc", ATL1_STAT(soft_stats.tx_trunc)}, |
| 3184 | {"tx_pause", ATL1_STAT(soft_stats.tx_pause)}, | 3184 | {"tx_pause", ATL1_STAT(soft_stats.tx_pause)}, |
| 3185 | {"rx_pause", ATL1_STAT(soft_stats.rx_pause)}, | 3185 | {"rx_pause", ATL1_STAT(soft_stats.rx_pause)}, |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h index 34a58cd846a0..eacff19ea05b 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.h +++ b/drivers/net/ethernet/atheros/atlx/atl1.h | |||
| @@ -681,7 +681,7 @@ struct atl1_sft_stats { | |||
| 681 | u64 scc; /* packets TX after a single collision */ | 681 | u64 scc; /* packets TX after a single collision */ |
| 682 | u64 mcc; /* packets TX after multiple collisions */ | 682 | u64 mcc; /* packets TX after multiple collisions */ |
| 683 | u64 latecol; /* TX packets w/ late collisions */ | 683 | u64 latecol; /* TX packets w/ late collisions */ |
| 684 | u64 tx_underun; /* TX packets aborted due to TX FIFO underrun | 684 | u64 tx_underrun; /* TX packets aborted due to TX FIFO underrun |
| 685 | * or TRD FIFO underrun */ | 685 | * or TRD FIFO underrun */ |
| 686 | u64 tx_trunc; /* TX packets truncated due to size > MTU */ | 686 | u64 tx_trunc; /* TX packets truncated due to size > MTU */ |
| 687 | u64 rx_pause; /* num Pause packets received. */ | 687 | u64 rx_pause; /* num Pause packets received. */ |
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c index d99317b3d891..98da0fa27192 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c | |||
| @@ -553,7 +553,7 @@ static void atl2_intr_tx(struct atl2_adapter *adapter) | |||
| 553 | netdev->stats.tx_aborted_errors++; | 553 | netdev->stats.tx_aborted_errors++; |
| 554 | if (txs->late_col) | 554 | if (txs->late_col) |
| 555 | netdev->stats.tx_window_errors++; | 555 | netdev->stats.tx_window_errors++; |
| 556 | if (txs->underun) | 556 | if (txs->underrun) |
| 557 | netdev->stats.tx_fifo_errors++; | 557 | netdev->stats.tx_fifo_errors++; |
| 558 | } while (1); | 558 | } while (1); |
| 559 | 559 | ||
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.h b/drivers/net/ethernet/atheros/atlx/atl2.h index c64a6bdfa7ae..25ec84cb4853 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.h +++ b/drivers/net/ethernet/atheros/atlx/atl2.h | |||
| @@ -260,7 +260,7 @@ struct tx_pkt_status { | |||
| 260 | unsigned multi_col:1; | 260 | unsigned multi_col:1; |
| 261 | unsigned late_col:1; | 261 | unsigned late_col:1; |
| 262 | unsigned abort_col:1; | 262 | unsigned abort_col:1; |
| 263 | unsigned underun:1; /* current packet is aborted | 263 | unsigned underrun:1; /* current packet is aborted |
| 264 | * due to txram underrun */ | 264 | * due to txram underrun */ |
| 265 | unsigned:3; /* reserved */ | 265 | unsigned:3; /* reserved */ |
| 266 | unsigned update:1; /* always 1'b1 in tx_status_buf */ | 266 | unsigned update:1; /* always 1'b1 in tx_status_buf */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c index a9bdc21873d3..10ff37d6dc78 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | |||
| @@ -957,7 +957,7 @@ int bnx2x_vfpf_update_vlan(struct bnx2x *bp, u16 vid, u8 vf_qid, bool add) | |||
| 957 | bnx2x_sample_bulletin(bp); | 957 | bnx2x_sample_bulletin(bp); |
| 958 | 958 | ||
| 959 | if (bp->shadow_bulletin.content.valid_bitmap & 1 << VLAN_VALID) { | 959 | if (bp->shadow_bulletin.content.valid_bitmap & 1 << VLAN_VALID) { |
| 960 | BNX2X_ERR("Hypervisor will dicline the request, avoiding\n"); | 960 | BNX2X_ERR("Hypervisor will decline the request, avoiding\n"); |
| 961 | rc = -EINVAL; | 961 | rc = -EINVAL; |
| 962 | goto out; | 962 | goto out; |
| 963 | } | 963 | } |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 0bb9d7b3a2b6..52ade133b57c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
| @@ -1133,6 +1133,8 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, | |||
| 1133 | tpa_info = &rxr->rx_tpa[agg_id]; | 1133 | tpa_info = &rxr->rx_tpa[agg_id]; |
| 1134 | 1134 | ||
| 1135 | if (unlikely(cons != rxr->rx_next_cons)) { | 1135 | if (unlikely(cons != rxr->rx_next_cons)) { |
| 1136 | netdev_warn(bp->dev, "TPA cons %x != expected cons %x\n", | ||
| 1137 | cons, rxr->rx_next_cons); | ||
| 1136 | bnxt_sched_reset(bp, rxr); | 1138 | bnxt_sched_reset(bp, rxr); |
| 1137 | return; | 1139 | return; |
| 1138 | } | 1140 | } |
| @@ -1585,15 +1587,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, | |||
| 1585 | } | 1587 | } |
| 1586 | 1588 | ||
| 1587 | cons = rxcmp->rx_cmp_opaque; | 1589 | cons = rxcmp->rx_cmp_opaque; |
| 1588 | rx_buf = &rxr->rx_buf_ring[cons]; | ||
| 1589 | data = rx_buf->data; | ||
| 1590 | data_ptr = rx_buf->data_ptr; | ||
| 1591 | if (unlikely(cons != rxr->rx_next_cons)) { | 1590 | if (unlikely(cons != rxr->rx_next_cons)) { |
| 1592 | int rc1 = bnxt_discard_rx(bp, cpr, raw_cons, rxcmp); | 1591 | int rc1 = bnxt_discard_rx(bp, cpr, raw_cons, rxcmp); |
| 1593 | 1592 | ||
| 1593 | netdev_warn(bp->dev, "RX cons %x != expected cons %x\n", | ||
| 1594 | cons, rxr->rx_next_cons); | ||
| 1594 | bnxt_sched_reset(bp, rxr); | 1595 | bnxt_sched_reset(bp, rxr); |
| 1595 | return rc1; | 1596 | return rc1; |
| 1596 | } | 1597 | } |
| 1598 | rx_buf = &rxr->rx_buf_ring[cons]; | ||
| 1599 | data = rx_buf->data; | ||
| 1600 | data_ptr = rx_buf->data_ptr; | ||
| 1597 | prefetch(data_ptr); | 1601 | prefetch(data_ptr); |
| 1598 | 1602 | ||
| 1599 | misc = le32_to_cpu(rxcmp->rx_cmp_misc_v1); | 1603 | misc = le32_to_cpu(rxcmp->rx_cmp_misc_v1); |
| @@ -1610,12 +1614,18 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, | |||
| 1610 | 1614 | ||
| 1611 | rx_buf->data = NULL; | 1615 | rx_buf->data = NULL; |
| 1612 | if (rxcmp1->rx_cmp_cfa_code_errors_v2 & RX_CMP_L2_ERRORS) { | 1616 | if (rxcmp1->rx_cmp_cfa_code_errors_v2 & RX_CMP_L2_ERRORS) { |
| 1617 | u32 rx_err = le32_to_cpu(rxcmp1->rx_cmp_cfa_code_errors_v2); | ||
| 1618 | |||
| 1613 | bnxt_reuse_rx_data(rxr, cons, data); | 1619 | bnxt_reuse_rx_data(rxr, cons, data); |
| 1614 | if (agg_bufs) | 1620 | if (agg_bufs) |
| 1615 | bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs); | 1621 | bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs); |
| 1616 | 1622 | ||
| 1617 | rc = -EIO; | 1623 | rc = -EIO; |
| 1618 | goto next_rx; | 1624 | if (rx_err & RX_CMPL_ERRORS_BUFFER_ERROR_MASK) { |
| 1625 | netdev_warn(bp->dev, "RX buffer error %x\n", rx_err); | ||
| 1626 | bnxt_sched_reset(bp, rxr); | ||
| 1627 | } | ||
| 1628 | goto next_rx_no_len; | ||
| 1619 | } | 1629 | } |
| 1620 | 1630 | ||
| 1621 | len = le32_to_cpu(rxcmp->rx_cmp_len_flags_type) >> RX_CMP_LEN_SHIFT; | 1631 | len = le32_to_cpu(rxcmp->rx_cmp_len_flags_type) >> RX_CMP_LEN_SHIFT; |
| @@ -1696,12 +1706,13 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, | |||
| 1696 | rc = 1; | 1706 | rc = 1; |
| 1697 | 1707 | ||
| 1698 | next_rx: | 1708 | next_rx: |
| 1699 | rxr->rx_prod = NEXT_RX(prod); | ||
| 1700 | rxr->rx_next_cons = NEXT_RX(cons); | ||
| 1701 | |||
| 1702 | cpr->rx_packets += 1; | 1709 | cpr->rx_packets += 1; |
| 1703 | cpr->rx_bytes += len; | 1710 | cpr->rx_bytes += len; |
| 1704 | 1711 | ||
| 1712 | next_rx_no_len: | ||
| 1713 | rxr->rx_prod = NEXT_RX(prod); | ||
| 1714 | rxr->rx_next_cons = NEXT_RX(cons); | ||
| 1715 | |||
| 1705 | next_rx_no_prod_no_len: | 1716 | next_rx_no_prod_no_len: |
| 1706 | *raw_cons = tmp_raw_cons; | 1717 | *raw_cons = tmp_raw_cons; |
| 1707 | 1718 | ||
| @@ -5125,10 +5136,10 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path) | |||
| 5125 | for (i = 0; i < bp->tx_nr_rings; i++) { | 5136 | for (i = 0; i < bp->tx_nr_rings; i++) { |
| 5126 | struct bnxt_tx_ring_info *txr = &bp->tx_ring[i]; | 5137 | struct bnxt_tx_ring_info *txr = &bp->tx_ring[i]; |
| 5127 | struct bnxt_ring_struct *ring = &txr->tx_ring_struct; | 5138 | struct bnxt_ring_struct *ring = &txr->tx_ring_struct; |
| 5128 | u32 cmpl_ring_id; | ||
| 5129 | 5139 | ||
| 5130 | cmpl_ring_id = bnxt_cp_ring_for_tx(bp, txr); | ||
| 5131 | if (ring->fw_ring_id != INVALID_HW_RING_ID) { | 5140 | if (ring->fw_ring_id != INVALID_HW_RING_ID) { |
| 5141 | u32 cmpl_ring_id = bnxt_cp_ring_for_tx(bp, txr); | ||
| 5142 | |||
| 5132 | hwrm_ring_free_send_msg(bp, ring, | 5143 | hwrm_ring_free_send_msg(bp, ring, |
| 5133 | RING_FREE_REQ_RING_TYPE_TX, | 5144 | RING_FREE_REQ_RING_TYPE_TX, |
| 5134 | close_path ? cmpl_ring_id : | 5145 | close_path ? cmpl_ring_id : |
| @@ -5141,10 +5152,10 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path) | |||
| 5141 | struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i]; | 5152 | struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i]; |
| 5142 | struct bnxt_ring_struct *ring = &rxr->rx_ring_struct; | 5153 | struct bnxt_ring_struct *ring = &rxr->rx_ring_struct; |
| 5143 | u32 grp_idx = rxr->bnapi->index; | 5154 | u32 grp_idx = rxr->bnapi->index; |
| 5144 | u32 cmpl_ring_id; | ||
| 5145 | 5155 | ||
| 5146 | cmpl_ring_id = bnxt_cp_ring_for_rx(bp, rxr); | ||
| 5147 | if (ring->fw_ring_id != INVALID_HW_RING_ID) { | 5156 | if (ring->fw_ring_id != INVALID_HW_RING_ID) { |
| 5157 | u32 cmpl_ring_id = bnxt_cp_ring_for_rx(bp, rxr); | ||
| 5158 | |||
| 5148 | hwrm_ring_free_send_msg(bp, ring, | 5159 | hwrm_ring_free_send_msg(bp, ring, |
| 5149 | RING_FREE_REQ_RING_TYPE_RX, | 5160 | RING_FREE_REQ_RING_TYPE_RX, |
| 5150 | close_path ? cmpl_ring_id : | 5161 | close_path ? cmpl_ring_id : |
| @@ -5163,10 +5174,10 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path) | |||
| 5163 | struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i]; | 5174 | struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i]; |
| 5164 | struct bnxt_ring_struct *ring = &rxr->rx_agg_ring_struct; | 5175 | struct bnxt_ring_struct *ring = &rxr->rx_agg_ring_struct; |
| 5165 | u32 grp_idx = rxr->bnapi->index; | 5176 | u32 grp_idx = rxr->bnapi->index; |
| 5166 | u32 cmpl_ring_id; | ||
| 5167 | 5177 | ||
| 5168 | cmpl_ring_id = bnxt_cp_ring_for_rx(bp, rxr); | ||
| 5169 | if (ring->fw_ring_id != INVALID_HW_RING_ID) { | 5178 | if (ring->fw_ring_id != INVALID_HW_RING_ID) { |
| 5179 | u32 cmpl_ring_id = bnxt_cp_ring_for_rx(bp, rxr); | ||
| 5180 | |||
| 5170 | hwrm_ring_free_send_msg(bp, ring, type, | 5181 | hwrm_ring_free_send_msg(bp, ring, type, |
| 5171 | close_path ? cmpl_ring_id : | 5182 | close_path ? cmpl_ring_id : |
| 5172 | INVALID_HW_RING_ID); | 5183 | INVALID_HW_RING_ID); |
| @@ -5305,17 +5316,16 @@ __bnxt_hwrm_reserve_pf_rings(struct bnxt *bp, struct hwrm_func_cfg_input *req, | |||
| 5305 | req->num_tx_rings = cpu_to_le16(tx_rings); | 5316 | req->num_tx_rings = cpu_to_le16(tx_rings); |
| 5306 | if (BNXT_NEW_RM(bp)) { | 5317 | if (BNXT_NEW_RM(bp)) { |
| 5307 | enables |= rx_rings ? FUNC_CFG_REQ_ENABLES_NUM_RX_RINGS : 0; | 5318 | enables |= rx_rings ? FUNC_CFG_REQ_ENABLES_NUM_RX_RINGS : 0; |
| 5319 | enables |= stats ? FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; | ||
| 5308 | if (bp->flags & BNXT_FLAG_CHIP_P5) { | 5320 | if (bp->flags & BNXT_FLAG_CHIP_P5) { |
| 5309 | enables |= cp_rings ? FUNC_CFG_REQ_ENABLES_NUM_MSIX : 0; | 5321 | enables |= cp_rings ? FUNC_CFG_REQ_ENABLES_NUM_MSIX : 0; |
| 5310 | enables |= tx_rings + ring_grps ? | 5322 | enables |= tx_rings + ring_grps ? |
| 5311 | FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS | | 5323 | FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0; |
| 5312 | FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; | ||
| 5313 | enables |= rx_rings ? | 5324 | enables |= rx_rings ? |
| 5314 | FUNC_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; | 5325 | FUNC_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; |
| 5315 | } else { | 5326 | } else { |
| 5316 | enables |= cp_rings ? | 5327 | enables |= cp_rings ? |
| 5317 | FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS | | 5328 | FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0; |
| 5318 | FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; | ||
| 5319 | enables |= ring_grps ? | 5329 | enables |= ring_grps ? |
| 5320 | FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS | | 5330 | FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS | |
| 5321 | FUNC_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; | 5331 | FUNC_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; |
| @@ -5355,14 +5365,13 @@ __bnxt_hwrm_reserve_vf_rings(struct bnxt *bp, | |||
| 5355 | enables |= tx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_TX_RINGS : 0; | 5365 | enables |= tx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_TX_RINGS : 0; |
| 5356 | enables |= rx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_RX_RINGS | | 5366 | enables |= rx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_RX_RINGS | |
| 5357 | FUNC_VF_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; | 5367 | FUNC_VF_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0; |
| 5368 | enables |= stats ? FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; | ||
| 5358 | if (bp->flags & BNXT_FLAG_CHIP_P5) { | 5369 | if (bp->flags & BNXT_FLAG_CHIP_P5) { |
| 5359 | enables |= tx_rings + ring_grps ? | 5370 | enables |= tx_rings + ring_grps ? |
| 5360 | FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS | | 5371 | FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0; |
| 5361 | FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; | ||
| 5362 | } else { | 5372 | } else { |
| 5363 | enables |= cp_rings ? | 5373 | enables |= cp_rings ? |
| 5364 | FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS | | 5374 | FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0; |
| 5365 | FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; | ||
| 5366 | enables |= ring_grps ? | 5375 | enables |= ring_grps ? |
| 5367 | FUNC_VF_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0; | 5376 | FUNC_VF_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0; |
| 5368 | } | 5377 | } |
| @@ -6743,6 +6752,7 @@ static int bnxt_hwrm_port_qstats_ext(struct bnxt *bp) | |||
| 6743 | struct hwrm_queue_pri2cos_qcfg_input req2 = {0}; | 6752 | struct hwrm_queue_pri2cos_qcfg_input req2 = {0}; |
| 6744 | struct hwrm_port_qstats_ext_input req = {0}; | 6753 | struct hwrm_port_qstats_ext_input req = {0}; |
| 6745 | struct bnxt_pf_info *pf = &bp->pf; | 6754 | struct bnxt_pf_info *pf = &bp->pf; |
| 6755 | u32 tx_stat_size; | ||
| 6746 | int rc; | 6756 | int rc; |
| 6747 | 6757 | ||
| 6748 | if (!(bp->flags & BNXT_FLAG_PORT_STATS_EXT)) | 6758 | if (!(bp->flags & BNXT_FLAG_PORT_STATS_EXT)) |
| @@ -6752,13 +6762,16 @@ static int bnxt_hwrm_port_qstats_ext(struct bnxt *bp) | |||
| 6752 | req.port_id = cpu_to_le16(pf->port_id); | 6762 | req.port_id = cpu_to_le16(pf->port_id); |
| 6753 | req.rx_stat_size = cpu_to_le16(sizeof(struct rx_port_stats_ext)); | 6763 | req.rx_stat_size = cpu_to_le16(sizeof(struct rx_port_stats_ext)); |
| 6754 | req.rx_stat_host_addr = cpu_to_le64(bp->hw_rx_port_stats_ext_map); | 6764 | req.rx_stat_host_addr = cpu_to_le64(bp->hw_rx_port_stats_ext_map); |
| 6755 | req.tx_stat_size = cpu_to_le16(sizeof(struct tx_port_stats_ext)); | 6765 | tx_stat_size = bp->hw_tx_port_stats_ext ? |
| 6766 | sizeof(*bp->hw_tx_port_stats_ext) : 0; | ||
| 6767 | req.tx_stat_size = cpu_to_le16(tx_stat_size); | ||
| 6756 | req.tx_stat_host_addr = cpu_to_le64(bp->hw_tx_port_stats_ext_map); | 6768 | req.tx_stat_host_addr = cpu_to_le64(bp->hw_tx_port_stats_ext_map); |
| 6757 | mutex_lock(&bp->hwrm_cmd_lock); | 6769 | mutex_lock(&bp->hwrm_cmd_lock); |
| 6758 | rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); | 6770 | rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT); |
| 6759 | if (!rc) { | 6771 | if (!rc) { |
| 6760 | bp->fw_rx_stats_ext_size = le16_to_cpu(resp->rx_stat_size) / 8; | 6772 | bp->fw_rx_stats_ext_size = le16_to_cpu(resp->rx_stat_size) / 8; |
| 6761 | bp->fw_tx_stats_ext_size = le16_to_cpu(resp->tx_stat_size) / 8; | 6773 | bp->fw_tx_stats_ext_size = tx_stat_size ? |
| 6774 | le16_to_cpu(resp->tx_stat_size) / 8 : 0; | ||
| 6762 | } else { | 6775 | } else { |
| 6763 | bp->fw_rx_stats_ext_size = 0; | 6776 | bp->fw_rx_stats_ext_size = 0; |
| 6764 | bp->fw_tx_stats_ext_size = 0; | 6777 | bp->fw_tx_stats_ext_size = 0; |
| @@ -8951,8 +8964,15 @@ static int bnxt_cfg_rx_mode(struct bnxt *bp) | |||
| 8951 | 8964 | ||
| 8952 | skip_uc: | 8965 | skip_uc: |
| 8953 | rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); | 8966 | rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); |
| 8967 | if (rc && vnic->mc_list_count) { | ||
| 8968 | netdev_info(bp->dev, "Failed setting MC filters rc: %d, turning on ALL_MCAST mode\n", | ||
| 8969 | rc); | ||
| 8970 | vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST; | ||
| 8971 | vnic->mc_list_count = 0; | ||
| 8972 | rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0); | ||
| 8973 | } | ||
| 8954 | if (rc) | 8974 | if (rc) |
| 8955 | netdev_err(bp->dev, "HWRM cfa l2 rx mask failure rc: %x\n", | 8975 | netdev_err(bp->dev, "HWRM cfa l2 rx mask failure rc: %d\n", |
| 8956 | rc); | 8976 | rc); |
| 8957 | 8977 | ||
| 8958 | return rc; | 8978 | return rc; |
| @@ -10675,6 +10695,7 @@ init_err_cleanup_tc: | |||
| 10675 | bnxt_clear_int_mode(bp); | 10695 | bnxt_clear_int_mode(bp); |
| 10676 | 10696 | ||
| 10677 | init_err_pci_clean: | 10697 | init_err_pci_clean: |
| 10698 | bnxt_free_hwrm_short_cmd_req(bp); | ||
| 10678 | bnxt_free_hwrm_resources(bp); | 10699 | bnxt_free_hwrm_resources(bp); |
| 10679 | bnxt_free_ctx_mem(bp); | 10700 | bnxt_free_ctx_mem(bp); |
| 10680 | kfree(bp->ctx); | 10701 | kfree(bp->ctx); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 328373e0578f..060a6f386104 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -4283,7 +4283,7 @@ static void tg3_power_down(struct tg3 *tp) | |||
| 4283 | pci_set_power_state(tp->pdev, PCI_D3hot); | 4283 | pci_set_power_state(tp->pdev, PCI_D3hot); |
| 4284 | } | 4284 | } |
| 4285 | 4285 | ||
| 4286 | static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 *duplex) | 4286 | static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u32 *speed, u8 *duplex) |
| 4287 | { | 4287 | { |
| 4288 | switch (val & MII_TG3_AUX_STAT_SPDMASK) { | 4288 | switch (val & MII_TG3_AUX_STAT_SPDMASK) { |
| 4289 | case MII_TG3_AUX_STAT_10HALF: | 4289 | case MII_TG3_AUX_STAT_10HALF: |
| @@ -4787,7 +4787,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, bool force_reset) | |||
| 4787 | bool current_link_up; | 4787 | bool current_link_up; |
| 4788 | u32 bmsr, val; | 4788 | u32 bmsr, val; |
| 4789 | u32 lcl_adv, rmt_adv; | 4789 | u32 lcl_adv, rmt_adv; |
| 4790 | u16 current_speed; | 4790 | u32 current_speed; |
| 4791 | u8 current_duplex; | 4791 | u8 current_duplex; |
| 4792 | int i, err; | 4792 | int i, err; |
| 4793 | 4793 | ||
| @@ -5719,7 +5719,7 @@ out: | |||
| 5719 | static int tg3_setup_fiber_phy(struct tg3 *tp, bool force_reset) | 5719 | static int tg3_setup_fiber_phy(struct tg3 *tp, bool force_reset) |
| 5720 | { | 5720 | { |
| 5721 | u32 orig_pause_cfg; | 5721 | u32 orig_pause_cfg; |
| 5722 | u16 orig_active_speed; | 5722 | u32 orig_active_speed; |
| 5723 | u8 orig_active_duplex; | 5723 | u8 orig_active_duplex; |
| 5724 | u32 mac_status; | 5724 | u32 mac_status; |
| 5725 | bool current_link_up; | 5725 | bool current_link_up; |
| @@ -5823,7 +5823,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset) | |||
| 5823 | { | 5823 | { |
| 5824 | int err = 0; | 5824 | int err = 0; |
| 5825 | u32 bmsr, bmcr; | 5825 | u32 bmsr, bmcr; |
| 5826 | u16 current_speed = SPEED_UNKNOWN; | 5826 | u32 current_speed = SPEED_UNKNOWN; |
| 5827 | u8 current_duplex = DUPLEX_UNKNOWN; | 5827 | u8 current_duplex = DUPLEX_UNKNOWN; |
| 5828 | bool current_link_up = false; | 5828 | bool current_link_up = false; |
| 5829 | u32 local_adv, remote_adv, sgsr; | 5829 | u32 local_adv, remote_adv, sgsr; |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index a772a33b685c..6953d0546acb 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
| @@ -2873,7 +2873,7 @@ struct tg3_tx_ring_info { | |||
| 2873 | struct tg3_link_config { | 2873 | struct tg3_link_config { |
| 2874 | /* Describes what we're trying to get. */ | 2874 | /* Describes what we're trying to get. */ |
| 2875 | u32 advertising; | 2875 | u32 advertising; |
| 2876 | u16 speed; | 2876 | u32 speed; |
| 2877 | u8 duplex; | 2877 | u8 duplex; |
| 2878 | u8 autoneg; | 2878 | u8 autoneg; |
| 2879 | u8 flowctrl; | 2879 | u8 flowctrl; |
| @@ -2882,7 +2882,7 @@ struct tg3_link_config { | |||
| 2882 | u8 active_flowctrl; | 2882 | u8 active_flowctrl; |
| 2883 | 2883 | ||
| 2884 | u8 active_duplex; | 2884 | u8 active_duplex; |
| 2885 | u16 active_speed; | 2885 | u32 active_speed; |
| 2886 | u32 rmt_adv; | 2886 | u32 rmt_adv; |
| 2887 | }; | 2887 | }; |
| 2888 | 2888 | ||
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 1522aee81884..3da2795e2486 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c | |||
| @@ -898,7 +898,9 @@ static void macb_tx_interrupt(struct macb_queue *queue) | |||
| 898 | 898 | ||
| 899 | /* First, update TX stats if needed */ | 899 | /* First, update TX stats if needed */ |
| 900 | if (skb) { | 900 | if (skb) { |
| 901 | if (gem_ptp_do_txstamp(queue, skb, desc) == 0) { | 901 | if (unlikely(skb_shinfo(skb)->tx_flags & |
| 902 | SKBTX_HW_TSTAMP) && | ||
| 903 | gem_ptp_do_txstamp(queue, skb, desc) == 0) { | ||
| 902 | /* skb now belongs to timestamp buffer | 904 | /* skb now belongs to timestamp buffer |
| 903 | * and will be removed later | 905 | * and will be removed later |
| 904 | */ | 906 | */ |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index aa2be4807191..c032bef1b776 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c | |||
| @@ -32,6 +32,13 @@ | |||
| 32 | #define DRV_NAME "nicvf" | 32 | #define DRV_NAME "nicvf" |
| 33 | #define DRV_VERSION "1.0" | 33 | #define DRV_VERSION "1.0" |
| 34 | 34 | ||
| 35 | /* NOTE: Packets bigger than 1530 are split across multiple pages and XDP needs | ||
| 36 | * the buffer to be contiguous. Allow XDP to be set up only if we don't exceed | ||
| 37 | * this value, keeping headroom for the 14 byte Ethernet header and two | ||
| 38 | * VLAN tags (for QinQ) | ||
| 39 | */ | ||
| 40 | #define MAX_XDP_MTU (1530 - ETH_HLEN - VLAN_HLEN * 2) | ||
| 41 | |||
| 35 | /* Supported devices */ | 42 | /* Supported devices */ |
| 36 | static const struct pci_device_id nicvf_id_table[] = { | 43 | static const struct pci_device_id nicvf_id_table[] = { |
| 37 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_CAVIUM, | 44 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_CAVIUM, |
| @@ -1328,10 +1335,11 @@ int nicvf_stop(struct net_device *netdev) | |||
| 1328 | struct nicvf_cq_poll *cq_poll = NULL; | 1335 | struct nicvf_cq_poll *cq_poll = NULL; |
| 1329 | union nic_mbx mbx = {}; | 1336 | union nic_mbx mbx = {}; |
| 1330 | 1337 | ||
| 1331 | cancel_delayed_work_sync(&nic->link_change_work); | ||
| 1332 | |||
| 1333 | /* wait till all queued set_rx_mode tasks completes */ | 1338 | /* wait till all queued set_rx_mode tasks completes */ |
| 1334 | drain_workqueue(nic->nicvf_rx_mode_wq); | 1339 | if (nic->nicvf_rx_mode_wq) { |
| 1340 | cancel_delayed_work_sync(&nic->link_change_work); | ||
| 1341 | drain_workqueue(nic->nicvf_rx_mode_wq); | ||
| 1342 | } | ||
| 1335 | 1343 | ||
| 1336 | mbx.msg.msg = NIC_MBOX_MSG_SHUTDOWN; | 1344 | mbx.msg.msg = NIC_MBOX_MSG_SHUTDOWN; |
| 1337 | nicvf_send_msg_to_pf(nic, &mbx); | 1345 | nicvf_send_msg_to_pf(nic, &mbx); |
| @@ -1452,7 +1460,8 @@ int nicvf_open(struct net_device *netdev) | |||
| 1452 | struct nicvf_cq_poll *cq_poll = NULL; | 1460 | struct nicvf_cq_poll *cq_poll = NULL; |
| 1453 | 1461 | ||
| 1454 | /* wait till all queued set_rx_mode tasks completes if any */ | 1462 | /* wait till all queued set_rx_mode tasks completes if any */ |
| 1455 | drain_workqueue(nic->nicvf_rx_mode_wq); | 1463 | if (nic->nicvf_rx_mode_wq) |
| 1464 | drain_workqueue(nic->nicvf_rx_mode_wq); | ||
| 1456 | 1465 | ||
| 1457 | netif_carrier_off(netdev); | 1466 | netif_carrier_off(netdev); |
| 1458 | 1467 | ||
| @@ -1550,10 +1559,12 @@ int nicvf_open(struct net_device *netdev) | |||
| 1550 | /* Send VF config done msg to PF */ | 1559 | /* Send VF config done msg to PF */ |
| 1551 | nicvf_send_cfg_done(nic); | 1560 | nicvf_send_cfg_done(nic); |
| 1552 | 1561 | ||
| 1553 | INIT_DELAYED_WORK(&nic->link_change_work, | 1562 | if (nic->nicvf_rx_mode_wq) { |
| 1554 | nicvf_link_status_check_task); | 1563 | INIT_DELAYED_WORK(&nic->link_change_work, |
| 1555 | queue_delayed_work(nic->nicvf_rx_mode_wq, | 1564 | nicvf_link_status_check_task); |
| 1556 | &nic->link_change_work, 0); | 1565 | queue_delayed_work(nic->nicvf_rx_mode_wq, |
| 1566 | &nic->link_change_work, 0); | ||
| 1567 | } | ||
| 1557 | 1568 | ||
| 1558 | return 0; | 1569 | return 0; |
| 1559 | cleanup: | 1570 | cleanup: |
| @@ -1578,6 +1589,15 @@ static int nicvf_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 1578 | struct nicvf *nic = netdev_priv(netdev); | 1589 | struct nicvf *nic = netdev_priv(netdev); |
| 1579 | int orig_mtu = netdev->mtu; | 1590 | int orig_mtu = netdev->mtu; |
| 1580 | 1591 | ||
| 1592 | /* For now just support only the usual MTU sized frames, | ||
| 1593 | * plus some headroom for VLAN, QinQ. | ||
| 1594 | */ | ||
| 1595 | if (nic->xdp_prog && new_mtu > MAX_XDP_MTU) { | ||
| 1596 | netdev_warn(netdev, "Jumbo frames not yet supported with XDP, current MTU %d.\n", | ||
| 1597 | netdev->mtu); | ||
| 1598 | return -EINVAL; | ||
| 1599 | } | ||
| 1600 | |||
| 1581 | netdev->mtu = new_mtu; | 1601 | netdev->mtu = new_mtu; |
| 1582 | 1602 | ||
| 1583 | if (!netif_running(netdev)) | 1603 | if (!netif_running(netdev)) |
| @@ -1826,8 +1846,10 @@ static int nicvf_xdp_setup(struct nicvf *nic, struct bpf_prog *prog) | |||
| 1826 | bool bpf_attached = false; | 1846 | bool bpf_attached = false; |
| 1827 | int ret = 0; | 1847 | int ret = 0; |
| 1828 | 1848 | ||
| 1829 | /* For now just support only the usual MTU sized frames */ | 1849 | /* For now just support only the usual MTU sized frames, |
| 1830 | if (prog && (dev->mtu > 1500)) { | 1850 | * plus some headroom for VLAN, QinQ. |
| 1851 | */ | ||
| 1852 | if (prog && dev->mtu > MAX_XDP_MTU) { | ||
| 1831 | netdev_warn(dev, "Jumbo frames not yet supported with XDP, current MTU %d.\n", | 1853 | netdev_warn(dev, "Jumbo frames not yet supported with XDP, current MTU %d.\n", |
| 1832 | dev->mtu); | 1854 | dev->mtu); |
| 1833 | return -EOPNOTSUPP; | 1855 | return -EOPNOTSUPP; |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 5b4d3badcb73..e246f9733bb8 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c | |||
| @@ -105,20 +105,19 @@ static inline struct pgcache *nicvf_alloc_page(struct nicvf *nic, | |||
| 105 | /* Check if page can be recycled */ | 105 | /* Check if page can be recycled */ |
| 106 | if (page) { | 106 | if (page) { |
| 107 | ref_count = page_ref_count(page); | 107 | ref_count = page_ref_count(page); |
| 108 | /* Check if this page has been used once i.e 'put_page' | 108 | /* This page can be recycled if internal ref_count and page's |
| 109 | * called after packet transmission i.e internal ref_count | 109 | * ref_count are equal, indicating that the page has been used |
| 110 | * and page's ref_count are equal i.e page can be recycled. | 110 | * once for packet transmission. For non-XDP mode, internal |
| 111 | * ref_count is always '1'. | ||
| 111 | */ | 112 | */ |
| 112 | if (rbdr->is_xdp && (ref_count == pgcache->ref_count)) | 113 | if (rbdr->is_xdp) { |
| 113 | pgcache->ref_count--; | 114 | if (ref_count == pgcache->ref_count) |
| 114 | else | 115 | pgcache->ref_count--; |
| 115 | page = NULL; | 116 | else |
| 116 | 117 | page = NULL; | |
| 117 | /* In non-XDP mode, page's ref_count needs to be '1' for it | 118 | } else if (ref_count != 1) { |
| 118 | * to be recycled. | ||
| 119 | */ | ||
| 120 | if (!rbdr->is_xdp && (ref_count != 1)) | ||
| 121 | page = NULL; | 119 | page = NULL; |
| 120 | } | ||
| 122 | } | 121 | } |
| 123 | 122 | ||
| 124 | if (!page) { | 123 | if (!page) { |
| @@ -365,11 +364,10 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr) | |||
| 365 | while (head < rbdr->pgcnt) { | 364 | while (head < rbdr->pgcnt) { |
| 366 | pgcache = &rbdr->pgcache[head]; | 365 | pgcache = &rbdr->pgcache[head]; |
| 367 | if (pgcache->page && page_ref_count(pgcache->page) != 0) { | 366 | if (pgcache->page && page_ref_count(pgcache->page) != 0) { |
| 368 | if (!rbdr->is_xdp) { | 367 | if (rbdr->is_xdp) { |
| 369 | put_page(pgcache->page); | 368 | page_ref_sub(pgcache->page, |
| 370 | continue; | 369 | pgcache->ref_count - 1); |
| 371 | } | 370 | } |
| 372 | page_ref_sub(pgcache->page, pgcache->ref_count - 1); | ||
| 373 | put_page(pgcache->page); | 371 | put_page(pgcache->page); |
| 374 | } | 372 | } |
| 375 | head++; | 373 | head++; |
diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c index 74849be5f004..e2919005ead3 100644 --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | |||
| @@ -354,7 +354,10 @@ static struct cxgbi_ppm_pool *ppm_alloc_cpu_pool(unsigned int *total, | |||
| 354 | ppmax = max; | 354 | ppmax = max; |
| 355 | 355 | ||
| 356 | /* pool size must be multiple of unsigned long */ | 356 | /* pool size must be multiple of unsigned long */ |
| 357 | bmap = BITS_TO_LONGS(ppmax); | 357 | bmap = ppmax / BITS_PER_TYPE(unsigned long); |
| 358 | if (!bmap) | ||
| 359 | return NULL; | ||
| 360 | |||
| 358 | ppmax = (bmap * sizeof(unsigned long)) << 3; | 361 | ppmax = (bmap * sizeof(unsigned long)) << 3; |
| 359 | 362 | ||
| 360 | alloc_sz = sizeof(*pools) + sizeof(unsigned long) * bmap; | 363 | alloc_sz = sizeof(*pools) + sizeof(unsigned long) * bmap; |
| @@ -402,6 +405,10 @@ int cxgbi_ppm_init(void **ppm_pp, struct net_device *ndev, | |||
| 402 | if (reserve_factor) { | 405 | if (reserve_factor) { |
| 403 | ppmax_pool = ppmax / reserve_factor; | 406 | ppmax_pool = ppmax / reserve_factor; |
| 404 | pool = ppm_alloc_cpu_pool(&ppmax_pool, &pool_index_max); | 407 | pool = ppm_alloc_cpu_pool(&ppmax_pool, &pool_index_max); |
| 408 | if (!pool) { | ||
| 409 | ppmax_pool = 0; | ||
| 410 | reserve_factor = 0; | ||
| 411 | } | ||
| 405 | 412 | ||
| 406 | pr_debug("%s: ppmax %u, cpu total %u, per cpu %u.\n", | 413 | pr_debug("%s: ppmax %u, cpu total %u, per cpu %u.\n", |
| 407 | ndev->name, ppmax, ppmax_pool, pool_index_max); | 414 | ndev->name, ppmax, ppmax_pool, pool_index_max); |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 697c2427f2b7..a96ad20ee484 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -1840,13 +1840,9 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) | |||
| 1840 | int ret; | 1840 | int ret; |
| 1841 | 1841 | ||
| 1842 | if (enable) { | 1842 | if (enable) { |
| 1843 | ret = clk_prepare_enable(fep->clk_ahb); | ||
| 1844 | if (ret) | ||
| 1845 | return ret; | ||
| 1846 | |||
| 1847 | ret = clk_prepare_enable(fep->clk_enet_out); | 1843 | ret = clk_prepare_enable(fep->clk_enet_out); |
| 1848 | if (ret) | 1844 | if (ret) |
| 1849 | goto failed_clk_enet_out; | 1845 | return ret; |
| 1850 | 1846 | ||
| 1851 | if (fep->clk_ptp) { | 1847 | if (fep->clk_ptp) { |
| 1852 | mutex_lock(&fep->ptp_clk_mutex); | 1848 | mutex_lock(&fep->ptp_clk_mutex); |
| @@ -1866,7 +1862,6 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) | |||
| 1866 | 1862 | ||
| 1867 | phy_reset_after_clk_enable(ndev->phydev); | 1863 | phy_reset_after_clk_enable(ndev->phydev); |
| 1868 | } else { | 1864 | } else { |
| 1869 | clk_disable_unprepare(fep->clk_ahb); | ||
| 1870 | clk_disable_unprepare(fep->clk_enet_out); | 1865 | clk_disable_unprepare(fep->clk_enet_out); |
| 1871 | if (fep->clk_ptp) { | 1866 | if (fep->clk_ptp) { |
| 1872 | mutex_lock(&fep->ptp_clk_mutex); | 1867 | mutex_lock(&fep->ptp_clk_mutex); |
| @@ -1885,8 +1880,6 @@ failed_clk_ref: | |||
| 1885 | failed_clk_ptp: | 1880 | failed_clk_ptp: |
| 1886 | if (fep->clk_enet_out) | 1881 | if (fep->clk_enet_out) |
| 1887 | clk_disable_unprepare(fep->clk_enet_out); | 1882 | clk_disable_unprepare(fep->clk_enet_out); |
| 1888 | failed_clk_enet_out: | ||
| 1889 | clk_disable_unprepare(fep->clk_ahb); | ||
| 1890 | 1883 | ||
| 1891 | return ret; | 1884 | return ret; |
| 1892 | } | 1885 | } |
| @@ -3470,6 +3463,9 @@ fec_probe(struct platform_device *pdev) | |||
| 3470 | ret = clk_prepare_enable(fep->clk_ipg); | 3463 | ret = clk_prepare_enable(fep->clk_ipg); |
| 3471 | if (ret) | 3464 | if (ret) |
| 3472 | goto failed_clk_ipg; | 3465 | goto failed_clk_ipg; |
| 3466 | ret = clk_prepare_enable(fep->clk_ahb); | ||
| 3467 | if (ret) | ||
| 3468 | goto failed_clk_ahb; | ||
| 3473 | 3469 | ||
| 3474 | fep->reg_phy = devm_regulator_get_optional(&pdev->dev, "phy"); | 3470 | fep->reg_phy = devm_regulator_get_optional(&pdev->dev, "phy"); |
| 3475 | if (!IS_ERR(fep->reg_phy)) { | 3471 | if (!IS_ERR(fep->reg_phy)) { |
| @@ -3563,6 +3559,9 @@ failed_reset: | |||
| 3563 | pm_runtime_put(&pdev->dev); | 3559 | pm_runtime_put(&pdev->dev); |
| 3564 | pm_runtime_disable(&pdev->dev); | 3560 | pm_runtime_disable(&pdev->dev); |
| 3565 | failed_regulator: | 3561 | failed_regulator: |
| 3562 | clk_disable_unprepare(fep->clk_ahb); | ||
| 3563 | failed_clk_ahb: | ||
| 3564 | clk_disable_unprepare(fep->clk_ipg); | ||
| 3566 | failed_clk_ipg: | 3565 | failed_clk_ipg: |
| 3567 | fec_enet_clk_enable(ndev, false); | 3566 | fec_enet_clk_enable(ndev, false); |
| 3568 | failed_clk: | 3567 | failed_clk: |
| @@ -3686,6 +3685,7 @@ static int __maybe_unused fec_runtime_suspend(struct device *dev) | |||
| 3686 | struct net_device *ndev = dev_get_drvdata(dev); | 3685 | struct net_device *ndev = dev_get_drvdata(dev); |
| 3687 | struct fec_enet_private *fep = netdev_priv(ndev); | 3686 | struct fec_enet_private *fep = netdev_priv(ndev); |
| 3688 | 3687 | ||
| 3688 | clk_disable_unprepare(fep->clk_ahb); | ||
| 3689 | clk_disable_unprepare(fep->clk_ipg); | 3689 | clk_disable_unprepare(fep->clk_ipg); |
| 3690 | 3690 | ||
| 3691 | return 0; | 3691 | return 0; |
| @@ -3695,8 +3695,20 @@ static int __maybe_unused fec_runtime_resume(struct device *dev) | |||
| 3695 | { | 3695 | { |
| 3696 | struct net_device *ndev = dev_get_drvdata(dev); | 3696 | struct net_device *ndev = dev_get_drvdata(dev); |
| 3697 | struct fec_enet_private *fep = netdev_priv(ndev); | 3697 | struct fec_enet_private *fep = netdev_priv(ndev); |
| 3698 | int ret; | ||
| 3698 | 3699 | ||
| 3699 | return clk_prepare_enable(fep->clk_ipg); | 3700 | ret = clk_prepare_enable(fep->clk_ahb); |
| 3701 | if (ret) | ||
| 3702 | return ret; | ||
| 3703 | ret = clk_prepare_enable(fep->clk_ipg); | ||
| 3704 | if (ret) | ||
| 3705 | goto failed_clk_ipg; | ||
| 3706 | |||
| 3707 | return 0; | ||
| 3708 | |||
| 3709 | failed_clk_ipg: | ||
| 3710 | clk_disable_unprepare(fep->clk_ahb); | ||
| 3711 | return ret; | ||
| 3700 | } | 3712 | } |
| 3701 | 3713 | ||
| 3702 | static const struct dev_pm_ops fec_pm_ops = { | 3714 | static const struct dev_pm_ops fec_pm_ops = { |
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c b/drivers/net/ethernet/hisilicon/hns/hnae.c index 79d03f8ee7b1..c7fa97a7e1f4 100644 --- a/drivers/net/ethernet/hisilicon/hns/hnae.c +++ b/drivers/net/ethernet/hisilicon/hns/hnae.c | |||
| @@ -150,7 +150,6 @@ out_buffer_fail: | |||
| 150 | /* free desc along with its attached buffer */ | 150 | /* free desc along with its attached buffer */ |
| 151 | static void hnae_free_desc(struct hnae_ring *ring) | 151 | static void hnae_free_desc(struct hnae_ring *ring) |
| 152 | { | 152 | { |
| 153 | hnae_free_buffers(ring); | ||
| 154 | dma_unmap_single(ring_to_dev(ring), ring->desc_dma_addr, | 153 | dma_unmap_single(ring_to_dev(ring), ring->desc_dma_addr, |
| 155 | ring->desc_num * sizeof(ring->desc[0]), | 154 | ring->desc_num * sizeof(ring->desc[0]), |
| 156 | ring_to_dma_dir(ring)); | 155 | ring_to_dma_dir(ring)); |
| @@ -183,6 +182,9 @@ static int hnae_alloc_desc(struct hnae_ring *ring) | |||
| 183 | /* fini ring, also free the buffer for the ring */ | 182 | /* fini ring, also free the buffer for the ring */ |
| 184 | static void hnae_fini_ring(struct hnae_ring *ring) | 183 | static void hnae_fini_ring(struct hnae_ring *ring) |
| 185 | { | 184 | { |
| 185 | if (is_rx_ring(ring)) | ||
| 186 | hnae_free_buffers(ring); | ||
| 187 | |||
| 186 | hnae_free_desc(ring); | 188 | hnae_free_desc(ring); |
| 187 | kfree(ring->desc_cb); | 189 | kfree(ring->desc_cb); |
| 188 | ring->desc_cb = NULL; | 190 | ring->desc_cb = NULL; |
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h index 08a750fb60c4..d6fb83437230 100644 --- a/drivers/net/ethernet/hisilicon/hns/hnae.h +++ b/drivers/net/ethernet/hisilicon/hns/hnae.h | |||
| @@ -357,7 +357,7 @@ struct hnae_buf_ops { | |||
| 357 | }; | 357 | }; |
| 358 | 358 | ||
| 359 | struct hnae_queue { | 359 | struct hnae_queue { |
| 360 | void __iomem *io_base; | 360 | u8 __iomem *io_base; |
| 361 | phys_addr_t phy_base; | 361 | phys_addr_t phy_base; |
| 362 | struct hnae_ae_dev *dev; /* the device who use this queue */ | 362 | struct hnae_ae_dev *dev; /* the device who use this queue */ |
| 363 | struct hnae_ring rx_ring ____cacheline_internodealigned_in_smp; | 363 | struct hnae_ring rx_ring ____cacheline_internodealigned_in_smp; |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c index a97228c93831..6c0507921623 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | |||
| @@ -370,7 +370,7 @@ int hns_mac_clr_multicast(struct hns_mac_cb *mac_cb, int vfn) | |||
| 370 | static void hns_mac_param_get(struct mac_params *param, | 370 | static void hns_mac_param_get(struct mac_params *param, |
| 371 | struct hns_mac_cb *mac_cb) | 371 | struct hns_mac_cb *mac_cb) |
| 372 | { | 372 | { |
| 373 | param->vaddr = (void *)mac_cb->vaddr; | 373 | param->vaddr = mac_cb->vaddr; |
| 374 | param->mac_mode = hns_get_enet_interface(mac_cb); | 374 | param->mac_mode = hns_get_enet_interface(mac_cb); |
| 375 | ether_addr_copy(param->addr, mac_cb->addr_entry_idx[0].addr); | 375 | ether_addr_copy(param->addr, mac_cb->addr_entry_idx[0].addr); |
| 376 | param->mac_id = mac_cb->mac_id; | 376 | param->mac_id = mac_cb->mac_id; |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h index fbc75341bef7..22589799f1a5 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h | |||
| @@ -187,7 +187,7 @@ struct mac_statistics { | |||
| 187 | /*mac para struct ,mac get param from nic or dsaf when initialize*/ | 187 | /*mac para struct ,mac get param from nic or dsaf when initialize*/ |
| 188 | struct mac_params { | 188 | struct mac_params { |
| 189 | char addr[ETH_ALEN]; | 189 | char addr[ETH_ALEN]; |
| 190 | void *vaddr; /*virtual address*/ | 190 | u8 __iomem *vaddr; /*virtual address*/ |
| 191 | struct device *dev; | 191 | struct device *dev; |
| 192 | u8 mac_id; | 192 | u8 mac_id; |
| 193 | /**< Ethernet operation mode (MAC-PHY interface and speed) */ | 193 | /**< Ethernet operation mode (MAC-PHY interface and speed) */ |
| @@ -402,7 +402,7 @@ struct mac_driver { | |||
| 402 | enum mac_mode mac_mode; | 402 | enum mac_mode mac_mode; |
| 403 | u8 mac_id; | 403 | u8 mac_id; |
| 404 | struct hns_mac_cb *mac_cb; | 404 | struct hns_mac_cb *mac_cb; |
| 405 | void __iomem *io_base; | 405 | u8 __iomem *io_base; |
| 406 | unsigned int mac_en_flg;/*you'd better don't enable mac twice*/ | 406 | unsigned int mac_en_flg;/*you'd better don't enable mac twice*/ |
| 407 | unsigned int virt_dev_num; | 407 | unsigned int virt_dev_num; |
| 408 | struct device *dev; | 408 | struct device *dev; |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c index ac55db065f16..61eea6ac846f 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | |||
| @@ -1602,8 +1602,6 @@ static void hns_dsaf_set_mac_key( | |||
| 1602 | DSAF_TBL_TCAM_KEY_VLAN_S, vlan_id); | 1602 | DSAF_TBL_TCAM_KEY_VLAN_S, vlan_id); |
| 1603 | dsaf_set_field(mac_key->low.bits.port_vlan, DSAF_TBL_TCAM_KEY_PORT_M, | 1603 | dsaf_set_field(mac_key->low.bits.port_vlan, DSAF_TBL_TCAM_KEY_PORT_M, |
| 1604 | DSAF_TBL_TCAM_KEY_PORT_S, port); | 1604 | DSAF_TBL_TCAM_KEY_PORT_S, port); |
| 1605 | |||
| 1606 | mac_key->low.bits.port_vlan = le16_to_cpu(mac_key->low.bits.port_vlan); | ||
| 1607 | } | 1605 | } |
| 1608 | 1606 | ||
| 1609 | /** | 1607 | /** |
| @@ -1663,8 +1661,8 @@ int hns_dsaf_set_mac_uc_entry( | |||
| 1663 | /* default config dvc to 0 */ | 1661 | /* default config dvc to 0 */ |
| 1664 | mac_data.tbl_ucast_dvc = 0; | 1662 | mac_data.tbl_ucast_dvc = 0; |
| 1665 | mac_data.tbl_ucast_out_port = mac_entry->port_num; | 1663 | mac_data.tbl_ucast_out_port = mac_entry->port_num; |
| 1666 | tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val); | 1664 | tcam_data.tbl_tcam_data_high = mac_key.high.val; |
| 1667 | tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val); | 1665 | tcam_data.tbl_tcam_data_low = mac_key.low.val; |
| 1668 | 1666 | ||
| 1669 | hns_dsaf_tcam_uc_cfg(dsaf_dev, entry_index, &tcam_data, &mac_data); | 1667 | hns_dsaf_tcam_uc_cfg(dsaf_dev, entry_index, &tcam_data, &mac_data); |
| 1670 | 1668 | ||
| @@ -1786,9 +1784,6 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev, | |||
| 1786 | 0xff, | 1784 | 0xff, |
| 1787 | mc_mask); | 1785 | mc_mask); |
| 1788 | 1786 | ||
| 1789 | mask_key.high.val = le32_to_cpu(mask_key.high.val); | ||
| 1790 | mask_key.low.val = le32_to_cpu(mask_key.low.val); | ||
| 1791 | |||
| 1792 | pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key); | 1787 | pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key); |
| 1793 | } | 1788 | } |
| 1794 | 1789 | ||
| @@ -1840,8 +1835,8 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev, | |||
| 1840 | dsaf_dev->ae_dev.name, mac_key.high.val, | 1835 | dsaf_dev->ae_dev.name, mac_key.high.val, |
| 1841 | mac_key.low.val, entry_index); | 1836 | mac_key.low.val, entry_index); |
| 1842 | 1837 | ||
| 1843 | tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val); | 1838 | tcam_data.tbl_tcam_data_high = mac_key.high.val; |
| 1844 | tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val); | 1839 | tcam_data.tbl_tcam_data_low = mac_key.low.val; |
| 1845 | 1840 | ||
| 1846 | /* config mc entry with mask */ | 1841 | /* config mc entry with mask */ |
| 1847 | hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, &tcam_data, | 1842 | hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, &tcam_data, |
| @@ -1956,9 +1951,6 @@ int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev, | |||
| 1956 | /* config key mask */ | 1951 | /* config key mask */ |
| 1957 | hns_dsaf_set_mac_key(dsaf_dev, &mask_key, 0x00, 0xff, mc_mask); | 1952 | hns_dsaf_set_mac_key(dsaf_dev, &mask_key, 0x00, 0xff, mc_mask); |
| 1958 | 1953 | ||
| 1959 | mask_key.high.val = le32_to_cpu(mask_key.high.val); | ||
| 1960 | mask_key.low.val = le32_to_cpu(mask_key.low.val); | ||
| 1961 | |||
| 1962 | pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key); | 1954 | pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key); |
| 1963 | } | 1955 | } |
| 1964 | 1956 | ||
| @@ -2012,8 +2004,8 @@ int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev, | |||
| 2012 | soft_mac_entry += entry_index; | 2004 | soft_mac_entry += entry_index; |
| 2013 | soft_mac_entry->index = DSAF_INVALID_ENTRY_IDX; | 2005 | soft_mac_entry->index = DSAF_INVALID_ENTRY_IDX; |
| 2014 | } else { /* not zero, just del port, update */ | 2006 | } else { /* not zero, just del port, update */ |
| 2015 | tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val); | 2007 | tcam_data.tbl_tcam_data_high = mac_key.high.val; |
| 2016 | tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val); | 2008 | tcam_data.tbl_tcam_data_low = mac_key.low.val; |
| 2017 | 2009 | ||
| 2018 | hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, | 2010 | hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, |
| 2019 | &tcam_data, | 2011 | &tcam_data, |
| @@ -2750,6 +2742,17 @@ int hns_dsaf_get_regs_count(void) | |||
| 2750 | return DSAF_DUMP_REGS_NUM; | 2742 | return DSAF_DUMP_REGS_NUM; |
| 2751 | } | 2743 | } |
| 2752 | 2744 | ||
| 2745 | static int hns_dsaf_get_port_id(u8 port) | ||
| 2746 | { | ||
| 2747 | if (port < DSAF_SERVICE_NW_NUM) | ||
| 2748 | return port; | ||
| 2749 | |||
| 2750 | if (port >= DSAF_BASE_INNER_PORT_NUM) | ||
| 2751 | return port - DSAF_BASE_INNER_PORT_NUM + DSAF_SERVICE_NW_NUM; | ||
| 2752 | |||
| 2753 | return -EINVAL; | ||
| 2754 | } | ||
| 2755 | |||
| 2753 | static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) | 2756 | static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) |
| 2754 | { | 2757 | { |
| 2755 | struct dsaf_tbl_tcam_ucast_cfg tbl_tcam_ucast = {0, 1, 0, 0, 0x80}; | 2758 | struct dsaf_tbl_tcam_ucast_cfg tbl_tcam_ucast = {0, 1, 0, 0, 0x80}; |
| @@ -2815,23 +2818,33 @@ static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) | |||
| 2815 | memset(&temp_key, 0x0, sizeof(temp_key)); | 2818 | memset(&temp_key, 0x0, sizeof(temp_key)); |
| 2816 | mask_entry.addr[0] = 0x01; | 2819 | mask_entry.addr[0] = 0x01; |
| 2817 | hns_dsaf_set_mac_key(dsaf_dev, &mask_key, mask_entry.in_vlan_id, | 2820 | hns_dsaf_set_mac_key(dsaf_dev, &mask_key, mask_entry.in_vlan_id, |
| 2818 | port, mask_entry.addr); | 2821 | 0xf, mask_entry.addr); |
| 2819 | tbl_tcam_mcast.tbl_mcast_item_vld = 1; | 2822 | tbl_tcam_mcast.tbl_mcast_item_vld = 1; |
| 2820 | tbl_tcam_mcast.tbl_mcast_old_en = 0; | 2823 | tbl_tcam_mcast.tbl_mcast_old_en = 0; |
| 2821 | 2824 | ||
| 2822 | if (port < DSAF_SERVICE_NW_NUM) { | 2825 | /* set MAC port to handle multicast */ |
| 2823 | mskid = port; | 2826 | mskid = hns_dsaf_get_port_id(port); |
| 2824 | } else if (port >= DSAF_BASE_INNER_PORT_NUM) { | 2827 | if (mskid == -EINVAL) { |
| 2825 | mskid = port - DSAF_BASE_INNER_PORT_NUM + DSAF_SERVICE_NW_NUM; | ||
| 2826 | } else { | ||
| 2827 | dev_err(dsaf_dev->dev, "%s,pnum(%d)error,key(%#x:%#x)\n", | 2828 | dev_err(dsaf_dev->dev, "%s,pnum(%d)error,key(%#x:%#x)\n", |
| 2828 | dsaf_dev->ae_dev.name, port, | 2829 | dsaf_dev->ae_dev.name, port, |
| 2829 | mask_key.high.val, mask_key.low.val); | 2830 | mask_key.high.val, mask_key.low.val); |
| 2830 | return; | 2831 | return; |
| 2831 | } | 2832 | } |
| 2833 | dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32], | ||
| 2834 | mskid % 32, 1); | ||
| 2832 | 2835 | ||
| 2836 | /* set pool bit map to handle multicast */ | ||
| 2837 | mskid = hns_dsaf_get_port_id(port_num); | ||
| 2838 | if (mskid == -EINVAL) { | ||
| 2839 | dev_err(dsaf_dev->dev, | ||
| 2840 | "%s, pool bit map pnum(%d)error,key(%#x:%#x)\n", | ||
| 2841 | dsaf_dev->ae_dev.name, port_num, | ||
| 2842 | mask_key.high.val, mask_key.low.val); | ||
| 2843 | return; | ||
| 2844 | } | ||
| 2833 | dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32], | 2845 | dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32], |
| 2834 | mskid % 32, 1); | 2846 | mskid % 32, 1); |
| 2847 | |||
| 2835 | memcpy(&temp_key, &mask_key, sizeof(mask_key)); | 2848 | memcpy(&temp_key, &mask_key, sizeof(mask_key)); |
| 2836 | hns_dsaf_tcam_mc_cfg_vague(dsaf_dev, entry_index, &tbl_tcam_data_mc, | 2849 | hns_dsaf_tcam_mc_cfg_vague(dsaf_dev, entry_index, &tbl_tcam_data_mc, |
| 2837 | (struct dsaf_tbl_tcam_data *)(&mask_key), | 2850 | (struct dsaf_tbl_tcam_data *)(&mask_key), |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h index 0e1cd99831a6..76cc8887e1a8 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h | |||
| @@ -467,4 +467,6 @@ int hns_dsaf_clr_mac_mc_port(struct dsaf_device *dsaf_dev, | |||
| 467 | u8 mac_id, u8 port_num); | 467 | u8 mac_id, u8 port_num); |
| 468 | int hns_dsaf_wait_pkt_clean(struct dsaf_device *dsaf_dev, int port); | 468 | int hns_dsaf_wait_pkt_clean(struct dsaf_device *dsaf_dev, int port); |
| 469 | 469 | ||
| 470 | int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset); | ||
| 471 | |||
| 470 | #endif /* __HNS_DSAF_MAIN_H__ */ | 472 | #endif /* __HNS_DSAF_MAIN_H__ */ |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c index 16294cd3c954..19b94879691f 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | |||
| @@ -670,7 +670,7 @@ static int hns_mac_config_sds_loopback(struct hns_mac_cb *mac_cb, bool en) | |||
| 670 | dsaf_set_field(origin, 1ull << 10, 10, en); | 670 | dsaf_set_field(origin, 1ull << 10, 10, en); |
| 671 | dsaf_write_syscon(mac_cb->serdes_ctrl, reg_offset, origin); | 671 | dsaf_write_syscon(mac_cb->serdes_ctrl, reg_offset, origin); |
| 672 | } else { | 672 | } else { |
| 673 | u8 *base_addr = (u8 *)mac_cb->serdes_vaddr + | 673 | u8 __iomem *base_addr = mac_cb->serdes_vaddr + |
| 674 | (mac_cb->mac_id <= 3 ? 0x00280000 : 0x00200000); | 674 | (mac_cb->mac_id <= 3 ? 0x00280000 : 0x00200000); |
| 675 | dsaf_set_reg_field(base_addr, reg_offset, 1ull << 10, 10, en); | 675 | dsaf_set_reg_field(base_addr, reg_offset, 1ull << 10, 10, en); |
| 676 | } | 676 | } |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c index 3d07c8a7639d..17c019106e6e 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c | |||
| @@ -61,7 +61,7 @@ void hns_ppe_set_indir_table(struct hns_ppe_cb *ppe_cb, | |||
| 61 | } | 61 | } |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static void __iomem * | 64 | static u8 __iomem * |
| 65 | hns_ppe_common_get_ioaddr(struct ppe_common_cb *ppe_common) | 65 | hns_ppe_common_get_ioaddr(struct ppe_common_cb *ppe_common) |
| 66 | { | 66 | { |
| 67 | return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET; | 67 | return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET; |
| @@ -111,8 +111,8 @@ hns_ppe_common_free_cfg(struct dsaf_device *dsaf_dev, u32 comm_index) | |||
| 111 | dsaf_dev->ppe_common[comm_index] = NULL; | 111 | dsaf_dev->ppe_common[comm_index] = NULL; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | static void __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common, | 114 | static u8 __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common, |
| 115 | int ppe_idx) | 115 | int ppe_idx) |
| 116 | { | 116 | { |
| 117 | return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET; | 117 | return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET; |
| 118 | } | 118 | } |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h index f670e63a5a01..110c6e8222c7 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h | |||
| @@ -80,7 +80,7 @@ struct hns_ppe_cb { | |||
| 80 | struct hns_ppe_hw_stats hw_stats; | 80 | struct hns_ppe_hw_stats hw_stats; |
| 81 | 81 | ||
| 82 | u8 index; /* index in a ppe common device */ | 82 | u8 index; /* index in a ppe common device */ |
| 83 | void __iomem *io_base; | 83 | u8 __iomem *io_base; |
| 84 | int virq; | 84 | int virq; |
| 85 | u32 rss_indir_table[HNS_PPEV2_RSS_IND_TBL_SIZE]; /*shadow indir tab */ | 85 | u32 rss_indir_table[HNS_PPEV2_RSS_IND_TBL_SIZE]; /*shadow indir tab */ |
| 86 | u32 rss_key[HNS_PPEV2_RSS_KEY_NUM]; /* rss hash key */ | 86 | u32 rss_key[HNS_PPEV2_RSS_KEY_NUM]; /* rss hash key */ |
| @@ -89,7 +89,7 @@ struct hns_ppe_cb { | |||
| 89 | struct ppe_common_cb { | 89 | struct ppe_common_cb { |
| 90 | struct device *dev; | 90 | struct device *dev; |
| 91 | struct dsaf_device *dsaf_dev; | 91 | struct dsaf_device *dsaf_dev; |
| 92 | void __iomem *io_base; | 92 | u8 __iomem *io_base; |
| 93 | 93 | ||
| 94 | enum ppe_common_mode ppe_mode; | 94 | enum ppe_common_mode ppe_mode; |
| 95 | 95 | ||
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c index 6bf346c11b25..ac3518ca4d7b 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c | |||
| @@ -458,7 +458,7 @@ static void hns_rcb_ring_get_cfg(struct hnae_queue *q, int ring_type) | |||
| 458 | mdnum_ppkt = HNS_RCB_RING_MAX_BD_PER_PKT; | 458 | mdnum_ppkt = HNS_RCB_RING_MAX_BD_PER_PKT; |
| 459 | } else { | 459 | } else { |
| 460 | ring = &q->tx_ring; | 460 | ring = &q->tx_ring; |
| 461 | ring->io_base = (u8 __iomem *)ring_pair_cb->q.io_base + | 461 | ring->io_base = ring_pair_cb->q.io_base + |
| 462 | HNS_RCB_TX_REG_OFFSET; | 462 | HNS_RCB_TX_REG_OFFSET; |
| 463 | irq_idx = HNS_RCB_IRQ_IDX_TX; | 463 | irq_idx = HNS_RCB_IRQ_IDX_TX; |
| 464 | mdnum_ppkt = is_ver1 ? HNS_RCB_RING_MAX_TXBD_PER_PKT : | 464 | mdnum_ppkt = is_ver1 ? HNS_RCB_RING_MAX_TXBD_PER_PKT : |
| @@ -764,7 +764,7 @@ static int hns_rcb_get_ring_num(struct dsaf_device *dsaf_dev) | |||
| 764 | } | 764 | } |
| 765 | } | 765 | } |
| 766 | 766 | ||
| 767 | static void __iomem *hns_rcb_common_get_vaddr(struct rcb_common_cb *rcb_common) | 767 | static u8 __iomem *hns_rcb_common_get_vaddr(struct rcb_common_cb *rcb_common) |
| 768 | { | 768 | { |
| 769 | struct dsaf_device *dsaf_dev = rcb_common->dsaf_dev; | 769 | struct dsaf_device *dsaf_dev = rcb_common->dsaf_dev; |
| 770 | 770 | ||
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h index b9733b0b8482..b9e7f11f0896 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h | |||
| @@ -1018,7 +1018,7 @@ | |||
| 1018 | #define XGMAC_PAUSE_CTL_RSP_MODE_B 2 | 1018 | #define XGMAC_PAUSE_CTL_RSP_MODE_B 2 |
| 1019 | #define XGMAC_PAUSE_CTL_TX_XOFF_B 3 | 1019 | #define XGMAC_PAUSE_CTL_TX_XOFF_B 3 |
| 1020 | 1020 | ||
| 1021 | static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value) | 1021 | static inline void dsaf_write_reg(u8 __iomem *base, u32 reg, u32 value) |
| 1022 | { | 1022 | { |
| 1023 | writel(value, base + reg); | 1023 | writel(value, base + reg); |
| 1024 | } | 1024 | } |
| @@ -1053,7 +1053,7 @@ static inline int dsaf_read_syscon(struct regmap *base, u32 reg, u32 *val) | |||
| 1053 | #define dsaf_set_bit(origin, shift, val) \ | 1053 | #define dsaf_set_bit(origin, shift, val) \ |
| 1054 | dsaf_set_field((origin), (1ull << (shift)), (shift), (val)) | 1054 | dsaf_set_field((origin), (1ull << (shift)), (shift), (val)) |
| 1055 | 1055 | ||
| 1056 | static inline void dsaf_set_reg_field(void __iomem *base, u32 reg, u32 mask, | 1056 | static inline void dsaf_set_reg_field(u8 __iomem *base, u32 reg, u32 mask, |
| 1057 | u32 shift, u32 val) | 1057 | u32 shift, u32 val) |
| 1058 | { | 1058 | { |
| 1059 | u32 origin = dsaf_read_reg(base, reg); | 1059 | u32 origin = dsaf_read_reg(base, reg); |
| @@ -1073,7 +1073,7 @@ static inline void dsaf_set_reg_field(void __iomem *base, u32 reg, u32 mask, | |||
| 1073 | #define dsaf_get_bit(origin, shift) \ | 1073 | #define dsaf_get_bit(origin, shift) \ |
| 1074 | dsaf_get_field((origin), (1ull << (shift)), (shift)) | 1074 | dsaf_get_field((origin), (1ull << (shift)), (shift)) |
| 1075 | 1075 | ||
| 1076 | static inline u32 dsaf_get_reg_field(void __iomem *base, u32 reg, u32 mask, | 1076 | static inline u32 dsaf_get_reg_field(u8 __iomem *base, u32 reg, u32 mask, |
| 1077 | u32 shift) | 1077 | u32 shift) |
| 1078 | { | 1078 | { |
| 1079 | u32 origin; | 1079 | u32 origin; |
| @@ -1089,11 +1089,11 @@ static inline u32 dsaf_get_reg_field(void __iomem *base, u32 reg, u32 mask, | |||
| 1089 | dsaf_get_reg_field((dev)->io_base, (reg), (1ull << (bit)), (bit)) | 1089 | dsaf_get_reg_field((dev)->io_base, (reg), (1ull << (bit)), (bit)) |
| 1090 | 1090 | ||
| 1091 | #define dsaf_write_b(addr, data)\ | 1091 | #define dsaf_write_b(addr, data)\ |
| 1092 | writeb((data), (__iomem unsigned char *)(addr)) | 1092 | writeb((data), (__iomem u8 *)(addr)) |
| 1093 | #define dsaf_read_b(addr)\ | 1093 | #define dsaf_read_b(addr)\ |
| 1094 | readb((__iomem unsigned char *)(addr)) | 1094 | readb((__iomem u8 *)(addr)) |
| 1095 | 1095 | ||
| 1096 | #define hns_mac_reg_read64(drv, offset) \ | 1096 | #define hns_mac_reg_read64(drv, offset) \ |
| 1097 | readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset)))) | 1097 | readq((__iomem void *)(((drv)->io_base + 0xc00 + (offset)))) |
| 1098 | 1098 | ||
| 1099 | #endif /* _DSAF_REG_H */ | 1099 | #endif /* _DSAF_REG_H */ |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c index ba4316910dea..a60f207768fc 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c | |||
| @@ -129,7 +129,7 @@ static void hns_xgmac_lf_rf_control_init(struct mac_driver *mac_drv) | |||
| 129 | dsaf_set_bit(val, XGMAC_UNIDIR_EN_B, 0); | 129 | dsaf_set_bit(val, XGMAC_UNIDIR_EN_B, 0); |
| 130 | dsaf_set_bit(val, XGMAC_RF_TX_EN_B, 1); | 130 | dsaf_set_bit(val, XGMAC_RF_TX_EN_B, 1); |
| 131 | dsaf_set_field(val, XGMAC_LF_RF_INSERT_M, XGMAC_LF_RF_INSERT_S, 0); | 131 | dsaf_set_field(val, XGMAC_LF_RF_INSERT_M, XGMAC_LF_RF_INSERT_S, 0); |
| 132 | dsaf_write_reg(mac_drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG, val); | 132 | dsaf_write_dev(mac_drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG, val); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | /** | 135 | /** |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 60e7d7ae3787..4cd86ba1f050 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c | |||
| @@ -29,9 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | #define SERVICE_TIMER_HZ (1 * HZ) | 30 | #define SERVICE_TIMER_HZ (1 * HZ) |
| 31 | 31 | ||
| 32 | #define NIC_TX_CLEAN_MAX_NUM 256 | ||
| 33 | #define NIC_RX_CLEAN_MAX_NUM 64 | ||
| 34 | |||
| 35 | #define RCB_IRQ_NOT_INITED 0 | 32 | #define RCB_IRQ_NOT_INITED 0 |
| 36 | #define RCB_IRQ_INITED 1 | 33 | #define RCB_IRQ_INITED 1 |
| 37 | #define HNS_BUFFER_SIZE_2048 2048 | 34 | #define HNS_BUFFER_SIZE_2048 2048 |
| @@ -376,8 +373,6 @@ netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev, | |||
| 376 | wmb(); /* commit all data before submit */ | 373 | wmb(); /* commit all data before submit */ |
| 377 | assert(skb->queue_mapping < priv->ae_handle->q_num); | 374 | assert(skb->queue_mapping < priv->ae_handle->q_num); |
| 378 | hnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num); | 375 | hnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num); |
| 379 | ring->stats.tx_pkts++; | ||
| 380 | ring->stats.tx_bytes += skb->len; | ||
| 381 | 376 | ||
| 382 | return NETDEV_TX_OK; | 377 | return NETDEV_TX_OK; |
| 383 | 378 | ||
| @@ -999,6 +994,9 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, | |||
| 999 | /* issue prefetch for next Tx descriptor */ | 994 | /* issue prefetch for next Tx descriptor */ |
| 1000 | prefetch(&ring->desc_cb[ring->next_to_clean]); | 995 | prefetch(&ring->desc_cb[ring->next_to_clean]); |
| 1001 | } | 996 | } |
| 997 | /* update tx ring statistics. */ | ||
| 998 | ring->stats.tx_pkts += pkts; | ||
| 999 | ring->stats.tx_bytes += bytes; | ||
| 1002 | 1000 | ||
| 1003 | NETIF_TX_UNLOCK(ring); | 1001 | NETIF_TX_UNLOCK(ring); |
| 1004 | 1002 | ||
| @@ -2152,7 +2150,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) | |||
| 2152 | hns_nic_tx_fini_pro_v2; | 2150 | hns_nic_tx_fini_pro_v2; |
| 2153 | 2151 | ||
| 2154 | netif_napi_add(priv->netdev, &rd->napi, | 2152 | netif_napi_add(priv->netdev, &rd->napi, |
| 2155 | hns_nic_common_poll, NIC_TX_CLEAN_MAX_NUM); | 2153 | hns_nic_common_poll, NAPI_POLL_WEIGHT); |
| 2156 | rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; | 2154 | rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; |
| 2157 | } | 2155 | } |
| 2158 | for (i = h->q_num; i < h->q_num * 2; i++) { | 2156 | for (i = h->q_num; i < h->q_num * 2; i++) { |
| @@ -2165,7 +2163,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) | |||
| 2165 | hns_nic_rx_fini_pro_v2; | 2163 | hns_nic_rx_fini_pro_v2; |
| 2166 | 2164 | ||
| 2167 | netif_napi_add(priv->netdev, &rd->napi, | 2165 | netif_napi_add(priv->netdev, &rd->napi, |
| 2168 | hns_nic_common_poll, NIC_RX_CLEAN_MAX_NUM); | 2166 | hns_nic_common_poll, NAPI_POLL_WEIGHT); |
| 2169 | rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; | 2167 | rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED; |
| 2170 | } | 2168 | } |
| 2171 | 2169 | ||
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile b/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile index fffe8c1c45d3..0fb61d440d3b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # Makefile for the HISILICON network device drivers. | 3 | # Makefile for the HISILICON network device drivers. |
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3 | 6 | ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 |
| 7 | 7 | ||
| 8 | obj-$(CONFIG_HNS3_HCLGE) += hclge.o | 8 | obj-$(CONFIG_HNS3_HCLGE) += hclge.o |
| 9 | hclge-objs = hclge_main.o hclge_cmd.o hclge_mdio.o hclge_tm.o hclge_mbx.o hclge_err.o hclge_debugfs.o | 9 | hclge-objs = hclge_main.o hclge_cmd.o hclge_mdio.o hclge_tm.o hclge_mbx.o hclge_err.o hclge_debugfs.o |
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile b/drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile index fb93bbd35845..6193f8fa7cf3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # Makefile for the HISILICON network device drivers. | 3 | # Makefile for the HISILICON network device drivers. |
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3 | 6 | ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 |
| 7 | 7 | ||
| 8 | obj-$(CONFIG_HNS3_HCLGEVF) += hclgevf.o | 8 | obj-$(CONFIG_HNS3_HCLGEVF) += hclgevf.o |
| 9 | hclgevf-objs = hclgevf_main.o hclgevf_cmd.o hclgevf_mbx.o \ No newline at end of file | 9 | hclgevf-objs = hclgevf_main.o hclgevf_cmd.o hclgevf_mbx.o \ No newline at end of file |
diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c index baf5cc251f32..8b8a7d00e8e0 100644 --- a/drivers/net/ethernet/hisilicon/hns_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns_mdio.c | |||
| @@ -39,7 +39,7 @@ struct hns_mdio_sc_reg { | |||
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | struct hns_mdio_device { | 41 | struct hns_mdio_device { |
| 42 | void *vbase; /* mdio reg base address */ | 42 | u8 __iomem *vbase; /* mdio reg base address */ |
| 43 | struct regmap *subctrl_vbase; | 43 | struct regmap *subctrl_vbase; |
| 44 | struct hns_mdio_sc_reg sc_reg; | 44 | struct hns_mdio_sc_reg sc_reg; |
| 45 | }; | 45 | }; |
| @@ -96,21 +96,17 @@ enum mdio_c45_op_seq { | |||
| 96 | #define MDIO_SC_CLK_ST 0x531C | 96 | #define MDIO_SC_CLK_ST 0x531C |
| 97 | #define MDIO_SC_RESET_ST 0x5A1C | 97 | #define MDIO_SC_RESET_ST 0x5A1C |
| 98 | 98 | ||
| 99 | static void mdio_write_reg(void *base, u32 reg, u32 value) | 99 | static void mdio_write_reg(u8 __iomem *base, u32 reg, u32 value) |
| 100 | { | 100 | { |
| 101 | u8 __iomem *reg_addr = (u8 __iomem *)base; | 101 | writel_relaxed(value, base + reg); |
| 102 | |||
| 103 | writel_relaxed(value, reg_addr + reg); | ||
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | #define MDIO_WRITE_REG(a, reg, value) \ | 104 | #define MDIO_WRITE_REG(a, reg, value) \ |
| 107 | mdio_write_reg((a)->vbase, (reg), (value)) | 105 | mdio_write_reg((a)->vbase, (reg), (value)) |
| 108 | 106 | ||
| 109 | static u32 mdio_read_reg(void *base, u32 reg) | 107 | static u32 mdio_read_reg(u8 __iomem *base, u32 reg) |
| 110 | { | 108 | { |
| 111 | u8 __iomem *reg_addr = (u8 __iomem *)base; | 109 | return readl_relaxed(base + reg); |
| 112 | |||
| 113 | return readl_relaxed(reg_addr + reg); | ||
| 114 | } | 110 | } |
| 115 | 111 | ||
| 116 | #define mdio_set_field(origin, mask, shift, val) \ | 112 | #define mdio_set_field(origin, mask, shift, val) \ |
| @@ -121,7 +117,7 @@ static u32 mdio_read_reg(void *base, u32 reg) | |||
| 121 | 117 | ||
| 122 | #define mdio_get_field(origin, mask, shift) (((origin) >> (shift)) & (mask)) | 118 | #define mdio_get_field(origin, mask, shift) (((origin) >> (shift)) & (mask)) |
| 123 | 119 | ||
| 124 | static void mdio_set_reg_field(void *base, u32 reg, u32 mask, u32 shift, | 120 | static void mdio_set_reg_field(u8 __iomem *base, u32 reg, u32 mask, u32 shift, |
| 125 | u32 val) | 121 | u32 val) |
| 126 | { | 122 | { |
| 127 | u32 origin = mdio_read_reg(base, reg); | 123 | u32 origin = mdio_read_reg(base, reg); |
| @@ -133,7 +129,7 @@ static void mdio_set_reg_field(void *base, u32 reg, u32 mask, u32 shift, | |||
| 133 | #define MDIO_SET_REG_FIELD(dev, reg, mask, shift, val) \ | 129 | #define MDIO_SET_REG_FIELD(dev, reg, mask, shift, val) \ |
| 134 | mdio_set_reg_field((dev)->vbase, (reg), (mask), (shift), (val)) | 130 | mdio_set_reg_field((dev)->vbase, (reg), (mask), (shift), (val)) |
| 135 | 131 | ||
| 136 | static u32 mdio_get_reg_field(void *base, u32 reg, u32 mask, u32 shift) | 132 | static u32 mdio_get_reg_field(u8 __iomem *base, u32 reg, u32 mask, u32 shift) |
| 137 | { | 133 | { |
| 138 | u32 origin; | 134 | u32 origin; |
| 139 | 135 | ||
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 5ecbb1adcf3b..3dfb2d131eb7 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c | |||
| @@ -1885,6 +1885,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter, | |||
| 1885 | */ | 1885 | */ |
| 1886 | adapter->state = VNIC_PROBED; | 1886 | adapter->state = VNIC_PROBED; |
| 1887 | 1887 | ||
| 1888 | reinit_completion(&adapter->init_done); | ||
| 1888 | rc = init_crq_queue(adapter); | 1889 | rc = init_crq_queue(adapter); |
| 1889 | if (rc) { | 1890 | if (rc) { |
| 1890 | netdev_err(adapter->netdev, | 1891 | netdev_err(adapter->netdev, |
| @@ -3761,6 +3762,7 @@ static void handle_query_ip_offload_rsp(struct ibmvnic_adapter *adapter) | |||
| 3761 | { | 3762 | { |
| 3762 | struct device *dev = &adapter->vdev->dev; | 3763 | struct device *dev = &adapter->vdev->dev; |
| 3763 | struct ibmvnic_query_ip_offload_buffer *buf = &adapter->ip_offload_buf; | 3764 | struct ibmvnic_query_ip_offload_buffer *buf = &adapter->ip_offload_buf; |
| 3765 | netdev_features_t old_hw_features = 0; | ||
| 3764 | union ibmvnic_crq crq; | 3766 | union ibmvnic_crq crq; |
| 3765 | int i; | 3767 | int i; |
| 3766 | 3768 | ||
| @@ -3836,24 +3838,41 @@ static void handle_query_ip_offload_rsp(struct ibmvnic_adapter *adapter) | |||
| 3836 | adapter->ip_offload_ctrl.large_rx_ipv4 = 0; | 3838 | adapter->ip_offload_ctrl.large_rx_ipv4 = 0; |
| 3837 | adapter->ip_offload_ctrl.large_rx_ipv6 = 0; | 3839 | adapter->ip_offload_ctrl.large_rx_ipv6 = 0; |
| 3838 | 3840 | ||
| 3839 | adapter->netdev->features = NETIF_F_SG | NETIF_F_GSO; | 3841 | if (adapter->state != VNIC_PROBING) { |
| 3842 | old_hw_features = adapter->netdev->hw_features; | ||
| 3843 | adapter->netdev->hw_features = 0; | ||
| 3844 | } | ||
| 3845 | |||
| 3846 | adapter->netdev->hw_features = NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO; | ||
| 3840 | 3847 | ||
| 3841 | if (buf->tcp_ipv4_chksum || buf->udp_ipv4_chksum) | 3848 | if (buf->tcp_ipv4_chksum || buf->udp_ipv4_chksum) |
| 3842 | adapter->netdev->features |= NETIF_F_IP_CSUM; | 3849 | adapter->netdev->hw_features |= NETIF_F_IP_CSUM; |
| 3843 | 3850 | ||
| 3844 | if (buf->tcp_ipv6_chksum || buf->udp_ipv6_chksum) | 3851 | if (buf->tcp_ipv6_chksum || buf->udp_ipv6_chksum) |
| 3845 | adapter->netdev->features |= NETIF_F_IPV6_CSUM; | 3852 | adapter->netdev->hw_features |= NETIF_F_IPV6_CSUM; |
| 3846 | 3853 | ||
| 3847 | if ((adapter->netdev->features & | 3854 | if ((adapter->netdev->features & |
| 3848 | (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM))) | 3855 | (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM))) |
| 3849 | adapter->netdev->features |= NETIF_F_RXCSUM; | 3856 | adapter->netdev->hw_features |= NETIF_F_RXCSUM; |
| 3850 | 3857 | ||
| 3851 | if (buf->large_tx_ipv4) | 3858 | if (buf->large_tx_ipv4) |
| 3852 | adapter->netdev->features |= NETIF_F_TSO; | 3859 | adapter->netdev->hw_features |= NETIF_F_TSO; |
| 3853 | if (buf->large_tx_ipv6) | 3860 | if (buf->large_tx_ipv6) |
| 3854 | adapter->netdev->features |= NETIF_F_TSO6; | 3861 | adapter->netdev->hw_features |= NETIF_F_TSO6; |
| 3862 | |||
| 3863 | if (adapter->state == VNIC_PROBING) { | ||
| 3864 | adapter->netdev->features |= adapter->netdev->hw_features; | ||
| 3865 | } else if (old_hw_features != adapter->netdev->hw_features) { | ||
| 3866 | netdev_features_t tmp = 0; | ||
| 3855 | 3867 | ||
| 3856 | adapter->netdev->hw_features |= adapter->netdev->features; | 3868 | /* disable features no longer supported */ |
| 3869 | adapter->netdev->features &= adapter->netdev->hw_features; | ||
| 3870 | /* turn on features now supported if previously enabled */ | ||
| 3871 | tmp = (old_hw_features ^ adapter->netdev->hw_features) & | ||
| 3872 | adapter->netdev->hw_features; | ||
| 3873 | adapter->netdev->features |= | ||
| 3874 | tmp & adapter->netdev->wanted_features; | ||
| 3875 | } | ||
| 3857 | 3876 | ||
| 3858 | memset(&crq, 0, sizeof(crq)); | 3877 | memset(&crq, 0, sizeof(crq)); |
| 3859 | crq.control_ip_offload.first = IBMVNIC_CRQ_CMD; | 3878 | crq.control_ip_offload.first = IBMVNIC_CRQ_CMD; |
| @@ -4625,7 +4644,7 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter) | |||
| 4625 | old_num_rx_queues = adapter->req_rx_queues; | 4644 | old_num_rx_queues = adapter->req_rx_queues; |
| 4626 | old_num_tx_queues = adapter->req_tx_queues; | 4645 | old_num_tx_queues = adapter->req_tx_queues; |
| 4627 | 4646 | ||
| 4628 | init_completion(&adapter->init_done); | 4647 | reinit_completion(&adapter->init_done); |
| 4629 | adapter->init_done_rc = 0; | 4648 | adapter->init_done_rc = 0; |
| 4630 | ibmvnic_send_crq_init(adapter); | 4649 | ibmvnic_send_crq_init(adapter); |
| 4631 | if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { | 4650 | if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { |
| @@ -4680,7 +4699,6 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter) | |||
| 4680 | 4699 | ||
| 4681 | adapter->from_passive_init = false; | 4700 | adapter->from_passive_init = false; |
| 4682 | 4701 | ||
| 4683 | init_completion(&adapter->init_done); | ||
| 4684 | adapter->init_done_rc = 0; | 4702 | adapter->init_done_rc = 0; |
| 4685 | ibmvnic_send_crq_init(adapter); | 4703 | ibmvnic_send_crq_init(adapter); |
| 4686 | if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { | 4704 | if (!wait_for_completion_timeout(&adapter->init_done, timeout)) { |
| @@ -4759,6 +4777,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) | |||
| 4759 | INIT_WORK(&adapter->ibmvnic_reset, __ibmvnic_reset); | 4777 | INIT_WORK(&adapter->ibmvnic_reset, __ibmvnic_reset); |
| 4760 | INIT_LIST_HEAD(&adapter->rwi_list); | 4778 | INIT_LIST_HEAD(&adapter->rwi_list); |
| 4761 | spin_lock_init(&adapter->rwi_lock); | 4779 | spin_lock_init(&adapter->rwi_lock); |
| 4780 | init_completion(&adapter->init_done); | ||
| 4762 | adapter->resetting = false; | 4781 | adapter->resetting = false; |
| 4763 | 4782 | ||
| 4764 | adapter->mac_change_pending = false; | 4783 | adapter->mac_change_pending = false; |
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c index 5a0419421511..ecef949f3baa 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c | |||
| @@ -41,6 +41,8 @@ static int __init fm10k_init_module(void) | |||
| 41 | /* create driver workqueue */ | 41 | /* create driver workqueue */ |
| 42 | fm10k_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, | 42 | fm10k_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, |
| 43 | fm10k_driver_name); | 43 | fm10k_driver_name); |
| 44 | if (!fm10k_workqueue) | ||
| 45 | return -ENOMEM; | ||
| 44 | 46 | ||
| 45 | fm10k_dbg_init(); | 47 | fm10k_dbg_init(); |
| 46 | 48 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index d684998ba2b0..d3cc3427caad 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h | |||
| @@ -790,6 +790,8 @@ struct i40e_vsi { | |||
| 790 | 790 | ||
| 791 | /* VSI specific handlers */ | 791 | /* VSI specific handlers */ |
| 792 | irqreturn_t (*irq_handler)(int irq, void *data); | 792 | irqreturn_t (*irq_handler)(int irq, void *data); |
| 793 | |||
| 794 | unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled qps */ | ||
| 793 | } ____cacheline_internodealigned_in_smp; | 795 | } ____cacheline_internodealigned_in_smp; |
| 794 | 796 | ||
| 795 | struct i40e_netdev_priv { | 797 | struct i40e_netdev_priv { |
| @@ -1096,20 +1098,6 @@ static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi) | |||
| 1096 | return !!vsi->xdp_prog; | 1098 | return !!vsi->xdp_prog; |
| 1097 | } | 1099 | } |
| 1098 | 1100 | ||
| 1099 | static inline struct xdp_umem *i40e_xsk_umem(struct i40e_ring *ring) | ||
| 1100 | { | ||
| 1101 | bool xdp_on = i40e_enabled_xdp_vsi(ring->vsi); | ||
| 1102 | int qid = ring->queue_index; | ||
| 1103 | |||
| 1104 | if (ring_is_xdp(ring)) | ||
| 1105 | qid -= ring->vsi->alloc_queue_pairs; | ||
| 1106 | |||
| 1107 | if (!xdp_on) | ||
| 1108 | return NULL; | ||
| 1109 | |||
| 1110 | return xdp_get_umem_from_qid(ring->vsi->netdev, qid); | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch); | 1101 | int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch); |
| 1114 | int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate); | 1102 | int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate); |
| 1115 | int i40e_add_del_cloud_filter(struct i40e_vsi *vsi, | 1103 | int i40e_add_del_cloud_filter(struct i40e_vsi *vsi, |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 4c885801fa26..7874d0ec7fb0 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c | |||
| @@ -2573,8 +2573,7 @@ static int i40e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
| 2573 | return -EOPNOTSUPP; | 2573 | return -EOPNOTSUPP; |
| 2574 | 2574 | ||
| 2575 | /* only magic packet is supported */ | 2575 | /* only magic packet is supported */ |
| 2576 | if (wol->wolopts && (wol->wolopts != WAKE_MAGIC) | 2576 | if (wol->wolopts & ~WAKE_MAGIC) |
| 2577 | | (wol->wolopts != WAKE_FILTER)) | ||
| 2578 | return -EOPNOTSUPP; | 2577 | return -EOPNOTSUPP; |
| 2579 | 2578 | ||
| 2580 | /* is this a new value? */ | 2579 | /* is this a new value? */ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index da62218eb70a..b1c265012c8a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
| @@ -3064,6 +3064,26 @@ static void i40e_config_xps_tx_ring(struct i40e_ring *ring) | |||
| 3064 | } | 3064 | } |
| 3065 | 3065 | ||
| 3066 | /** | 3066 | /** |
| 3067 | * i40e_xsk_umem - Retrieve the AF_XDP ZC if XDP and ZC is enabled | ||
| 3068 | * @ring: The Tx or Rx ring | ||
| 3069 | * | ||
| 3070 | * Returns the UMEM or NULL. | ||
| 3071 | **/ | ||
| 3072 | static struct xdp_umem *i40e_xsk_umem(struct i40e_ring *ring) | ||
| 3073 | { | ||
| 3074 | bool xdp_on = i40e_enabled_xdp_vsi(ring->vsi); | ||
| 3075 | int qid = ring->queue_index; | ||
| 3076 | |||
| 3077 | if (ring_is_xdp(ring)) | ||
| 3078 | qid -= ring->vsi->alloc_queue_pairs; | ||
| 3079 | |||
| 3080 | if (!xdp_on || !test_bit(qid, ring->vsi->af_xdp_zc_qps)) | ||
| 3081 | return NULL; | ||
| 3082 | |||
| 3083 | return xdp_get_umem_from_qid(ring->vsi->netdev, qid); | ||
| 3084 | } | ||
| 3085 | |||
| 3086 | /** | ||
| 3067 | * i40e_configure_tx_ring - Configure a transmit ring context and rest | 3087 | * i40e_configure_tx_ring - Configure a transmit ring context and rest |
| 3068 | * @ring: The Tx ring to configure | 3088 | * @ring: The Tx ring to configure |
| 3069 | * | 3089 | * |
| @@ -10064,6 +10084,12 @@ static int i40e_vsi_mem_alloc(struct i40e_pf *pf, enum i40e_vsi_type type) | |||
| 10064 | hash_init(vsi->mac_filter_hash); | 10084 | hash_init(vsi->mac_filter_hash); |
| 10065 | vsi->irqs_ready = false; | 10085 | vsi->irqs_ready = false; |
| 10066 | 10086 | ||
| 10087 | if (type == I40E_VSI_MAIN) { | ||
| 10088 | vsi->af_xdp_zc_qps = bitmap_zalloc(pf->num_lan_qps, GFP_KERNEL); | ||
| 10089 | if (!vsi->af_xdp_zc_qps) | ||
| 10090 | goto err_rings; | ||
| 10091 | } | ||
| 10092 | |||
| 10067 | ret = i40e_set_num_rings_in_vsi(vsi); | 10093 | ret = i40e_set_num_rings_in_vsi(vsi); |
| 10068 | if (ret) | 10094 | if (ret) |
| 10069 | goto err_rings; | 10095 | goto err_rings; |
| @@ -10082,6 +10108,7 @@ static int i40e_vsi_mem_alloc(struct i40e_pf *pf, enum i40e_vsi_type type) | |||
| 10082 | goto unlock_pf; | 10108 | goto unlock_pf; |
| 10083 | 10109 | ||
| 10084 | err_rings: | 10110 | err_rings: |
| 10111 | bitmap_free(vsi->af_xdp_zc_qps); | ||
| 10085 | pf->next_vsi = i - 1; | 10112 | pf->next_vsi = i - 1; |
| 10086 | kfree(vsi); | 10113 | kfree(vsi); |
| 10087 | unlock_pf: | 10114 | unlock_pf: |
| @@ -10162,6 +10189,7 @@ static int i40e_vsi_clear(struct i40e_vsi *vsi) | |||
| 10162 | i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); | 10189 | i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx); |
| 10163 | i40e_put_lump(pf->irq_pile, vsi->base_vector, vsi->idx); | 10190 | i40e_put_lump(pf->irq_pile, vsi->base_vector, vsi->idx); |
| 10164 | 10191 | ||
| 10192 | bitmap_free(vsi->af_xdp_zc_qps); | ||
| 10165 | i40e_vsi_free_arrays(vsi, true); | 10193 | i40e_vsi_free_arrays(vsi, true); |
| 10166 | i40e_clear_rss_config_user(vsi); | 10194 | i40e_clear_rss_config_user(vsi); |
| 10167 | 10195 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c index 5fb4353c742b..31575c0bb884 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c | |||
| @@ -146,12 +146,13 @@ static int i40e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) | |||
| 146 | static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) | 146 | static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) |
| 147 | { | 147 | { |
| 148 | struct i40e_pf *pf = container_of(ptp, struct i40e_pf, ptp_caps); | 148 | struct i40e_pf *pf = container_of(ptp, struct i40e_pf, ptp_caps); |
| 149 | struct timespec64 now; | 149 | struct timespec64 now, then; |
| 150 | 150 | ||
| 151 | then = ns_to_timespec64(delta); | ||
| 151 | mutex_lock(&pf->tmreg_lock); | 152 | mutex_lock(&pf->tmreg_lock); |
| 152 | 153 | ||
| 153 | i40e_ptp_read(pf, &now, NULL); | 154 | i40e_ptp_read(pf, &now, NULL); |
| 154 | timespec64_add_ns(&now, delta); | 155 | now = timespec64_add(now, then); |
| 155 | i40e_ptp_write(pf, (const struct timespec64 *)&now); | 156 | i40e_ptp_write(pf, (const struct timespec64 *)&now); |
| 156 | 157 | ||
| 157 | mutex_unlock(&pf->tmreg_lock); | 158 | mutex_unlock(&pf->tmreg_lock); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c index b5c182e688e3..1b17486543ac 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c | |||
| @@ -102,6 +102,8 @@ static int i40e_xsk_umem_enable(struct i40e_vsi *vsi, struct xdp_umem *umem, | |||
| 102 | if (err) | 102 | if (err) |
| 103 | return err; | 103 | return err; |
| 104 | 104 | ||
| 105 | set_bit(qid, vsi->af_xdp_zc_qps); | ||
| 106 | |||
| 105 | if_running = netif_running(vsi->netdev) && i40e_enabled_xdp_vsi(vsi); | 107 | if_running = netif_running(vsi->netdev) && i40e_enabled_xdp_vsi(vsi); |
| 106 | 108 | ||
| 107 | if (if_running) { | 109 | if (if_running) { |
| @@ -148,6 +150,7 @@ static int i40e_xsk_umem_disable(struct i40e_vsi *vsi, u16 qid) | |||
| 148 | return err; | 150 | return err; |
| 149 | } | 151 | } |
| 150 | 152 | ||
| 153 | clear_bit(qid, vsi->af_xdp_zc_qps); | ||
| 151 | i40e_xsk_umem_dma_unmap(vsi, umem); | 154 | i40e_xsk_umem_dma_unmap(vsi, umem); |
| 152 | 155 | ||
| 153 | if (if_running) { | 156 | if (if_running) { |
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h index 01fcfc6f3415..d2e2c50ce257 100644 --- a/drivers/net/ethernet/intel/igb/e1000_defines.h +++ b/drivers/net/ethernet/intel/igb/e1000_defines.h | |||
| @@ -194,6 +194,8 @@ | |||
| 194 | /* enable link status from external LINK_0 and LINK_1 pins */ | 194 | /* enable link status from external LINK_0 and LINK_1 pins */ |
| 195 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ | 195 | #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ |
| 196 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ | 196 | #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ |
| 197 | #define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ | ||
| 198 | #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 /* PHY PM enable */ | ||
| 197 | #define E1000_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */ | 199 | #define E1000_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */ |
| 198 | #define E1000_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */ | 200 | #define E1000_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */ |
| 199 | #define E1000_CTRL_RST 0x04000000 /* Global reset */ | 201 | #define E1000_CTRL_RST 0x04000000 /* Global reset */ |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 69b230c53fed..3269d8e94744 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
| @@ -8740,9 +8740,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
| 8740 | struct e1000_hw *hw = &adapter->hw; | 8740 | struct e1000_hw *hw = &adapter->hw; |
| 8741 | u32 ctrl, rctl, status; | 8741 | u32 ctrl, rctl, status; |
| 8742 | u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; | 8742 | u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; |
| 8743 | #ifdef CONFIG_PM | 8743 | bool wake; |
| 8744 | int retval = 0; | ||
| 8745 | #endif | ||
| 8746 | 8744 | ||
| 8747 | rtnl_lock(); | 8745 | rtnl_lock(); |
| 8748 | netif_device_detach(netdev); | 8746 | netif_device_detach(netdev); |
| @@ -8755,14 +8753,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
| 8755 | igb_clear_interrupt_scheme(adapter); | 8753 | igb_clear_interrupt_scheme(adapter); |
| 8756 | rtnl_unlock(); | 8754 | rtnl_unlock(); |
| 8757 | 8755 | ||
| 8758 | #ifdef CONFIG_PM | ||
| 8759 | if (!runtime) { | ||
| 8760 | retval = pci_save_state(pdev); | ||
| 8761 | if (retval) | ||
| 8762 | return retval; | ||
| 8763 | } | ||
| 8764 | #endif | ||
| 8765 | |||
| 8766 | status = rd32(E1000_STATUS); | 8756 | status = rd32(E1000_STATUS); |
| 8767 | if (status & E1000_STATUS_LU) | 8757 | if (status & E1000_STATUS_LU) |
| 8768 | wufc &= ~E1000_WUFC_LNKC; | 8758 | wufc &= ~E1000_WUFC_LNKC; |
| @@ -8779,10 +8769,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
| 8779 | } | 8769 | } |
| 8780 | 8770 | ||
| 8781 | ctrl = rd32(E1000_CTRL); | 8771 | ctrl = rd32(E1000_CTRL); |
| 8782 | /* advertise wake from D3Cold */ | ||
| 8783 | #define E1000_CTRL_ADVD3WUC 0x00100000 | ||
| 8784 | /* phy power management enable */ | ||
| 8785 | #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 | ||
| 8786 | ctrl |= E1000_CTRL_ADVD3WUC; | 8772 | ctrl |= E1000_CTRL_ADVD3WUC; |
| 8787 | wr32(E1000_CTRL, ctrl); | 8773 | wr32(E1000_CTRL, ctrl); |
| 8788 | 8774 | ||
| @@ -8796,12 +8782,15 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
| 8796 | wr32(E1000_WUFC, 0); | 8782 | wr32(E1000_WUFC, 0); |
| 8797 | } | 8783 | } |
| 8798 | 8784 | ||
| 8799 | *enable_wake = wufc || adapter->en_mng_pt; | 8785 | wake = wufc || adapter->en_mng_pt; |
| 8800 | if (!*enable_wake) | 8786 | if (!wake) |
| 8801 | igb_power_down_link(adapter); | 8787 | igb_power_down_link(adapter); |
| 8802 | else | 8788 | else |
| 8803 | igb_power_up_link(adapter); | 8789 | igb_power_up_link(adapter); |
| 8804 | 8790 | ||
| 8791 | if (enable_wake) | ||
| 8792 | *enable_wake = wake; | ||
| 8793 | |||
| 8805 | /* Release control of h/w to f/w. If f/w is AMT enabled, this | 8794 | /* Release control of h/w to f/w. If f/w is AMT enabled, this |
| 8806 | * would have already happened in close and is redundant. | 8795 | * would have already happened in close and is redundant. |
| 8807 | */ | 8796 | */ |
| @@ -8844,22 +8833,7 @@ static void igb_deliver_wake_packet(struct net_device *netdev) | |||
| 8844 | 8833 | ||
| 8845 | static int __maybe_unused igb_suspend(struct device *dev) | 8834 | static int __maybe_unused igb_suspend(struct device *dev) |
| 8846 | { | 8835 | { |
| 8847 | int retval; | 8836 | return __igb_shutdown(to_pci_dev(dev), NULL, 0); |
| 8848 | bool wake; | ||
| 8849 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 8850 | |||
| 8851 | retval = __igb_shutdown(pdev, &wake, 0); | ||
| 8852 | if (retval) | ||
| 8853 | return retval; | ||
| 8854 | |||
| 8855 | if (wake) { | ||
| 8856 | pci_prepare_to_sleep(pdev); | ||
| 8857 | } else { | ||
| 8858 | pci_wake_from_d3(pdev, false); | ||
| 8859 | pci_set_power_state(pdev, PCI_D3hot); | ||
| 8860 | } | ||
| 8861 | |||
| 8862 | return 0; | ||
| 8863 | } | 8837 | } |
| 8864 | 8838 | ||
| 8865 | static int __maybe_unused igb_resume(struct device *dev) | 8839 | static int __maybe_unused igb_resume(struct device *dev) |
| @@ -8930,22 +8904,7 @@ static int __maybe_unused igb_runtime_idle(struct device *dev) | |||
| 8930 | 8904 | ||
| 8931 | static int __maybe_unused igb_runtime_suspend(struct device *dev) | 8905 | static int __maybe_unused igb_runtime_suspend(struct device *dev) |
| 8932 | { | 8906 | { |
| 8933 | struct pci_dev *pdev = to_pci_dev(dev); | 8907 | return __igb_shutdown(to_pci_dev(dev), NULL, 1); |
| 8934 | int retval; | ||
| 8935 | bool wake; | ||
| 8936 | |||
| 8937 | retval = __igb_shutdown(pdev, &wake, 1); | ||
| 8938 | if (retval) | ||
| 8939 | return retval; | ||
| 8940 | |||
| 8941 | if (wake) { | ||
| 8942 | pci_prepare_to_sleep(pdev); | ||
| 8943 | } else { | ||
| 8944 | pci_wake_from_d3(pdev, false); | ||
| 8945 | pci_set_power_state(pdev, PCI_D3hot); | ||
| 8946 | } | ||
| 8947 | |||
| 8948 | return 0; | ||
| 8949 | } | 8908 | } |
| 8950 | 8909 | ||
| 8951 | static int __maybe_unused igb_runtime_resume(struct device *dev) | 8910 | static int __maybe_unused igb_runtime_resume(struct device *dev) |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index cc4907f9ff02..2fb97967961c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | |||
| @@ -905,13 +905,12 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) | |||
| 905 | struct pci_dev *pdev = adapter->pdev; | 905 | struct pci_dev *pdev = adapter->pdev; |
| 906 | struct device *dev = &adapter->netdev->dev; | 906 | struct device *dev = &adapter->netdev->dev; |
| 907 | struct mii_bus *bus; | 907 | struct mii_bus *bus; |
| 908 | int err = -ENODEV; | ||
| 908 | 909 | ||
| 909 | adapter->mii_bus = devm_mdiobus_alloc(dev); | 910 | bus = devm_mdiobus_alloc(dev); |
| 910 | if (!adapter->mii_bus) | 911 | if (!bus) |
| 911 | return -ENOMEM; | 912 | return -ENOMEM; |
| 912 | 913 | ||
| 913 | bus = adapter->mii_bus; | ||
| 914 | |||
| 915 | switch (hw->device_id) { | 914 | switch (hw->device_id) { |
| 916 | /* C3000 SoCs */ | 915 | /* C3000 SoCs */ |
| 917 | case IXGBE_DEV_ID_X550EM_A_KR: | 916 | case IXGBE_DEV_ID_X550EM_A_KR: |
| @@ -949,12 +948,15 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) | |||
| 949 | */ | 948 | */ |
| 950 | hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22; | 949 | hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22; |
| 951 | 950 | ||
| 952 | return mdiobus_register(bus); | 951 | err = mdiobus_register(bus); |
| 952 | if (!err) { | ||
| 953 | adapter->mii_bus = bus; | ||
| 954 | return 0; | ||
| 955 | } | ||
| 953 | 956 | ||
| 954 | ixgbe_no_mii_bus: | 957 | ixgbe_no_mii_bus: |
| 955 | devm_mdiobus_free(dev, bus); | 958 | devm_mdiobus_free(dev, bus); |
| 956 | adapter->mii_bus = NULL; | 959 | return err; |
| 957 | return -ENODEV; | ||
| 958 | } | 960 | } |
| 959 | 961 | ||
| 960 | /** | 962 | /** |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 71c65cc17904..d3eaf2ceaa39 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h | |||
| @@ -858,6 +858,7 @@ void mlx5e_close_channels(struct mlx5e_channels *chs); | |||
| 858 | * switching channels | 858 | * switching channels |
| 859 | */ | 859 | */ |
| 860 | typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv); | 860 | typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv); |
| 861 | int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv); | ||
| 861 | int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, | 862 | int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, |
| 862 | struct mlx5e_channels *new_chs, | 863 | struct mlx5e_channels *new_chs, |
| 863 | mlx5e_fp_hw_modify hw_modify); | 864 | mlx5e_fp_hw_modify hw_modify); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c index 122927f3a600..d5e5afbdca6d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c | |||
| @@ -96,9 +96,6 @@ int mlx5_port_query_eth_proto(struct mlx5_core_dev *dev, u8 port, bool ext, | |||
| 96 | if (!eproto) | 96 | if (!eproto) |
| 97 | return -EINVAL; | 97 | return -EINVAL; |
| 98 | 98 | ||
| 99 | if (ext != MLX5_CAP_PCAM_FEATURE(dev, ptys_extended_ethernet)) | ||
| 100 | return -EOPNOTSUPP; | ||
| 101 | |||
| 102 | err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port); | 99 | err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port); |
| 103 | if (err) | 100 | if (err) |
| 104 | return err; | 101 | return err; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c index eac245a93f91..4ab0d030b544 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c | |||
| @@ -122,7 +122,9 @@ out: | |||
| 122 | return err; | 122 | return err; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | /* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B]) */ | 125 | /* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B]) |
| 126 | * minimum speed value is 40Gbps | ||
| 127 | */ | ||
| 126 | static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) | 128 | static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) |
| 127 | { | 129 | { |
| 128 | u32 speed; | 130 | u32 speed; |
| @@ -130,10 +132,9 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) | |||
| 130 | int err; | 132 | int err; |
| 131 | 133 | ||
| 132 | err = mlx5e_port_linkspeed(priv->mdev, &speed); | 134 | err = mlx5e_port_linkspeed(priv->mdev, &speed); |
| 133 | if (err) { | 135 | if (err) |
| 134 | mlx5_core_warn(priv->mdev, "cannot get port speed\n"); | 136 | speed = SPEED_40000; |
| 135 | return 0; | 137 | speed = max_t(u32, speed, SPEED_40000); |
| 136 | } | ||
| 137 | 138 | ||
| 138 | xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100; | 139 | xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100; |
| 139 | 140 | ||
| @@ -142,7 +143,7 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) | |||
| 142 | } | 143 | } |
| 143 | 144 | ||
| 144 | static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, | 145 | static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, |
| 145 | u32 xoff, unsigned int mtu) | 146 | u32 xoff, unsigned int max_mtu) |
| 146 | { | 147 | { |
| 147 | int i; | 148 | int i; |
| 148 | 149 | ||
| @@ -154,11 +155,12 @@ static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, | |||
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | if (port_buffer->buffer[i].size < | 157 | if (port_buffer->buffer[i].size < |
| 157 | (xoff + mtu + (1 << MLX5E_BUFFER_CELL_SHIFT))) | 158 | (xoff + max_mtu + (1 << MLX5E_BUFFER_CELL_SHIFT))) |
| 158 | return -ENOMEM; | 159 | return -ENOMEM; |
| 159 | 160 | ||
| 160 | port_buffer->buffer[i].xoff = port_buffer->buffer[i].size - xoff; | 161 | port_buffer->buffer[i].xoff = port_buffer->buffer[i].size - xoff; |
| 161 | port_buffer->buffer[i].xon = port_buffer->buffer[i].xoff - mtu; | 162 | port_buffer->buffer[i].xon = |
| 163 | port_buffer->buffer[i].xoff - max_mtu; | ||
| 162 | } | 164 | } |
| 163 | 165 | ||
| 164 | return 0; | 166 | return 0; |
| @@ -166,7 +168,7 @@ static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, | |||
| 166 | 168 | ||
| 167 | /** | 169 | /** |
| 168 | * update_buffer_lossy() | 170 | * update_buffer_lossy() |
| 169 | * mtu: device's MTU | 171 | * max_mtu: netdev's max_mtu |
| 170 | * pfc_en: <input> current pfc configuration | 172 | * pfc_en: <input> current pfc configuration |
| 171 | * buffer: <input> current prio to buffer mapping | 173 | * buffer: <input> current prio to buffer mapping |
| 172 | * xoff: <input> xoff value | 174 | * xoff: <input> xoff value |
| @@ -183,7 +185,7 @@ static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, | |||
| 183 | * Return 0 if no error. | 185 | * Return 0 if no error. |
| 184 | * Set change to true if buffer configuration is modified. | 186 | * Set change to true if buffer configuration is modified. |
| 185 | */ | 187 | */ |
| 186 | static int update_buffer_lossy(unsigned int mtu, | 188 | static int update_buffer_lossy(unsigned int max_mtu, |
| 187 | u8 pfc_en, u8 *buffer, u32 xoff, | 189 | u8 pfc_en, u8 *buffer, u32 xoff, |
| 188 | struct mlx5e_port_buffer *port_buffer, | 190 | struct mlx5e_port_buffer *port_buffer, |
| 189 | bool *change) | 191 | bool *change) |
| @@ -220,7 +222,7 @@ static int update_buffer_lossy(unsigned int mtu, | |||
| 220 | } | 222 | } |
| 221 | 223 | ||
| 222 | if (changed) { | 224 | if (changed) { |
| 223 | err = update_xoff_threshold(port_buffer, xoff, mtu); | 225 | err = update_xoff_threshold(port_buffer, xoff, max_mtu); |
| 224 | if (err) | 226 | if (err) |
| 225 | return err; | 227 | return err; |
| 226 | 228 | ||
| @@ -230,6 +232,7 @@ static int update_buffer_lossy(unsigned int mtu, | |||
| 230 | return 0; | 232 | return 0; |
| 231 | } | 233 | } |
| 232 | 234 | ||
| 235 | #define MINIMUM_MAX_MTU 9216 | ||
| 233 | int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, | 236 | int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, |
| 234 | u32 change, unsigned int mtu, | 237 | u32 change, unsigned int mtu, |
| 235 | struct ieee_pfc *pfc, | 238 | struct ieee_pfc *pfc, |
| @@ -241,12 +244,14 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, | |||
| 241 | bool update_prio2buffer = false; | 244 | bool update_prio2buffer = false; |
| 242 | u8 buffer[MLX5E_MAX_PRIORITY]; | 245 | u8 buffer[MLX5E_MAX_PRIORITY]; |
| 243 | bool update_buffer = false; | 246 | bool update_buffer = false; |
| 247 | unsigned int max_mtu; | ||
| 244 | u32 total_used = 0; | 248 | u32 total_used = 0; |
| 245 | u8 curr_pfc_en; | 249 | u8 curr_pfc_en; |
| 246 | int err; | 250 | int err; |
| 247 | int i; | 251 | int i; |
| 248 | 252 | ||
| 249 | mlx5e_dbg(HW, priv, "%s: change=%x\n", __func__, change); | 253 | mlx5e_dbg(HW, priv, "%s: change=%x\n", __func__, change); |
| 254 | max_mtu = max_t(unsigned int, priv->netdev->max_mtu, MINIMUM_MAX_MTU); | ||
| 250 | 255 | ||
| 251 | err = mlx5e_port_query_buffer(priv, &port_buffer); | 256 | err = mlx5e_port_query_buffer(priv, &port_buffer); |
| 252 | if (err) | 257 | if (err) |
| @@ -254,7 +259,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, | |||
| 254 | 259 | ||
| 255 | if (change & MLX5E_PORT_BUFFER_CABLE_LEN) { | 260 | if (change & MLX5E_PORT_BUFFER_CABLE_LEN) { |
| 256 | update_buffer = true; | 261 | update_buffer = true; |
| 257 | err = update_xoff_threshold(&port_buffer, xoff, mtu); | 262 | err = update_xoff_threshold(&port_buffer, xoff, max_mtu); |
| 258 | if (err) | 263 | if (err) |
| 259 | return err; | 264 | return err; |
| 260 | } | 265 | } |
| @@ -264,7 +269,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, | |||
| 264 | if (err) | 269 | if (err) |
| 265 | return err; | 270 | return err; |
| 266 | 271 | ||
| 267 | err = update_buffer_lossy(mtu, pfc->pfc_en, buffer, xoff, | 272 | err = update_buffer_lossy(max_mtu, pfc->pfc_en, buffer, xoff, |
| 268 | &port_buffer, &update_buffer); | 273 | &port_buffer, &update_buffer); |
| 269 | if (err) | 274 | if (err) |
| 270 | return err; | 275 | return err; |
| @@ -276,8 +281,8 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, | |||
| 276 | if (err) | 281 | if (err) |
| 277 | return err; | 282 | return err; |
| 278 | 283 | ||
| 279 | err = update_buffer_lossy(mtu, curr_pfc_en, prio2buffer, xoff, | 284 | err = update_buffer_lossy(max_mtu, curr_pfc_en, prio2buffer, |
| 280 | &port_buffer, &update_buffer); | 285 | xoff, &port_buffer, &update_buffer); |
| 281 | if (err) | 286 | if (err) |
| 282 | return err; | 287 | return err; |
| 283 | } | 288 | } |
| @@ -301,7 +306,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, | |||
| 301 | return -EINVAL; | 306 | return -EINVAL; |
| 302 | 307 | ||
| 303 | update_buffer = true; | 308 | update_buffer = true; |
| 304 | err = update_xoff_threshold(&port_buffer, xoff, mtu); | 309 | err = update_xoff_threshold(&port_buffer, xoff, max_mtu); |
| 305 | if (err) | 310 | if (err) |
| 306 | return err; | 311 | return err; |
| 307 | } | 312 | } |
| @@ -309,7 +314,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, | |||
| 309 | /* Need to update buffer configuration if xoff value is changed */ | 314 | /* Need to update buffer configuration if xoff value is changed */ |
| 310 | if (!update_buffer && xoff != priv->dcbx.xoff) { | 315 | if (!update_buffer && xoff != priv->dcbx.xoff) { |
| 311 | update_buffer = true; | 316 | update_buffer = true; |
| 312 | err = update_xoff_threshold(&port_buffer, xoff, mtu); | 317 | err = update_xoff_threshold(&port_buffer, xoff, max_mtu); |
| 313 | if (err) | 318 | if (err) |
| 314 | return err; | 319 | return err; |
| 315 | } | 320 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c index 9d38e62cdf24..476dd97f7f2f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c | |||
| @@ -186,12 +186,17 @@ static int mlx5e_tx_reporter_recover_from_ctx(struct mlx5e_tx_err_ctx *err_ctx) | |||
| 186 | 186 | ||
| 187 | static int mlx5e_tx_reporter_recover_all(struct mlx5e_priv *priv) | 187 | static int mlx5e_tx_reporter_recover_all(struct mlx5e_priv *priv) |
| 188 | { | 188 | { |
| 189 | int err; | 189 | int err = 0; |
| 190 | 190 | ||
| 191 | rtnl_lock(); | 191 | rtnl_lock(); |
| 192 | mutex_lock(&priv->state_lock); | 192 | mutex_lock(&priv->state_lock); |
| 193 | mlx5e_close_locked(priv->netdev); | 193 | |
| 194 | err = mlx5e_open_locked(priv->netdev); | 194 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) |
| 195 | goto out; | ||
| 196 | |||
| 197 | err = mlx5e_safe_reopen_channels(priv); | ||
| 198 | |||
| 199 | out: | ||
| 195 | mutex_unlock(&priv->state_lock); | 200 | mutex_unlock(&priv->state_lock); |
| 196 | rtnl_unlock(); | 201 | rtnl_unlock(); |
| 197 | 202 | ||
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 fa2a3c444cdc..eec07b34b4ad 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | |||
| @@ -39,6 +39,10 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv, | |||
| 39 | return -EOPNOTSUPP; | 39 | return -EOPNOTSUPP; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | if (!(mlx5e_eswitch_rep(*out_dev) && | ||
| 43 | mlx5e_is_uplink_rep(netdev_priv(*out_dev)))) | ||
| 44 | return -EOPNOTSUPP; | ||
| 45 | |||
| 42 | return 0; | 46 | return 0; |
| 43 | } | 47 | } |
| 44 | 48 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c index 03b2a9f9c589..cad34d6f5f45 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | |||
| @@ -33,6 +33,26 @@ | |||
| 33 | #include <linux/bpf_trace.h> | 33 | #include <linux/bpf_trace.h> |
| 34 | #include "en/xdp.h" | 34 | #include "en/xdp.h" |
| 35 | 35 | ||
| 36 | int mlx5e_xdp_max_mtu(struct mlx5e_params *params) | ||
| 37 | { | ||
| 38 | int hr = NET_IP_ALIGN + XDP_PACKET_HEADROOM; | ||
| 39 | |||
| 40 | /* Let S := SKB_DATA_ALIGN(sizeof(struct skb_shared_info)). | ||
| 41 | * The condition checked in mlx5e_rx_is_linear_skb is: | ||
| 42 | * SKB_DATA_ALIGN(sw_mtu + hard_mtu + hr) + S <= PAGE_SIZE (1) | ||
| 43 | * (Note that hw_mtu == sw_mtu + hard_mtu.) | ||
| 44 | * What is returned from this function is: | ||
| 45 | * max_mtu = PAGE_SIZE - S - hr - hard_mtu (2) | ||
| 46 | * After assigning sw_mtu := max_mtu, the left side of (1) turns to | ||
| 47 | * SKB_DATA_ALIGN(PAGE_SIZE - S) + S, which is equal to PAGE_SIZE, | ||
| 48 | * because both PAGE_SIZE and S are already aligned. Any number greater | ||
| 49 | * than max_mtu would make the left side of (1) greater than PAGE_SIZE, | ||
| 50 | * so max_mtu is the maximum MTU allowed. | ||
| 51 | */ | ||
| 52 | |||
| 53 | return MLX5E_HW2SW_MTU(params, SKB_MAX_HEAD(hr)); | ||
| 54 | } | ||
| 55 | |||
| 36 | static inline bool | 56 | static inline bool |
| 37 | mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_dma_info *di, | 57 | mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_dma_info *di, |
| 38 | struct xdp_buff *xdp) | 58 | struct xdp_buff *xdp) |
| @@ -304,9 +324,9 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq, struct mlx5e_rq *rq) | |||
| 304 | mlx5e_xdpi_fifo_pop(xdpi_fifo); | 324 | mlx5e_xdpi_fifo_pop(xdpi_fifo); |
| 305 | 325 | ||
| 306 | if (is_redirect) { | 326 | if (is_redirect) { |
| 307 | xdp_return_frame(xdpi.xdpf); | ||
| 308 | dma_unmap_single(sq->pdev, xdpi.dma_addr, | 327 | dma_unmap_single(sq->pdev, xdpi.dma_addr, |
| 309 | xdpi.xdpf->len, DMA_TO_DEVICE); | 328 | xdpi.xdpf->len, DMA_TO_DEVICE); |
| 329 | xdp_return_frame(xdpi.xdpf); | ||
| 310 | } else { | 330 | } else { |
| 311 | /* Recycle RX page */ | 331 | /* Recycle RX page */ |
| 312 | mlx5e_page_release(rq, &xdpi.di, true); | 332 | mlx5e_page_release(rq, &xdpi.di, true); |
| @@ -345,9 +365,9 @@ void mlx5e_free_xdpsq_descs(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq) | |||
| 345 | mlx5e_xdpi_fifo_pop(xdpi_fifo); | 365 | mlx5e_xdpi_fifo_pop(xdpi_fifo); |
| 346 | 366 | ||
| 347 | if (is_redirect) { | 367 | if (is_redirect) { |
| 348 | xdp_return_frame(xdpi.xdpf); | ||
| 349 | dma_unmap_single(sq->pdev, xdpi.dma_addr, | 368 | dma_unmap_single(sq->pdev, xdpi.dma_addr, |
| 350 | xdpi.xdpf->len, DMA_TO_DEVICE); | 369 | xdpi.xdpf->len, DMA_TO_DEVICE); |
| 370 | xdp_return_frame(xdpi.xdpf); | ||
| 351 | } else { | 371 | } else { |
| 352 | /* Recycle RX page */ | 372 | /* Recycle RX page */ |
| 353 | mlx5e_page_release(rq, &xdpi.di, false); | 373 | mlx5e_page_release(rq, &xdpi.di, false); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h index ee27a7c8cd87..553956cadc8a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h | |||
| @@ -34,13 +34,12 @@ | |||
| 34 | 34 | ||
| 35 | #include "en.h" | 35 | #include "en.h" |
| 36 | 36 | ||
| 37 | #define MLX5E_XDP_MAX_MTU ((int)(PAGE_SIZE - \ | ||
| 38 | MLX5_SKB_FRAG_SZ(XDP_PACKET_HEADROOM))) | ||
| 39 | #define MLX5E_XDP_MIN_INLINE (ETH_HLEN + VLAN_HLEN) | 37 | #define MLX5E_XDP_MIN_INLINE (ETH_HLEN + VLAN_HLEN) |
| 40 | #define MLX5E_XDP_TX_EMPTY_DS_COUNT \ | 38 | #define MLX5E_XDP_TX_EMPTY_DS_COUNT \ |
| 41 | (sizeof(struct mlx5e_tx_wqe) / MLX5_SEND_WQE_DS) | 39 | (sizeof(struct mlx5e_tx_wqe) / MLX5_SEND_WQE_DS) |
| 42 | #define MLX5E_XDP_TX_DS_COUNT (MLX5E_XDP_TX_EMPTY_DS_COUNT + 1 /* SG DS */) | 40 | #define MLX5E_XDP_TX_DS_COUNT (MLX5E_XDP_TX_EMPTY_DS_COUNT + 1 /* SG DS */) |
| 43 | 41 | ||
| 42 | int mlx5e_xdp_max_mtu(struct mlx5e_params *params); | ||
| 44 | bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di, | 43 | bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di, |
| 45 | void *va, u16 *rx_headroom, u32 *len); | 44 | void *va, u16 *rx_headroom, u32 *len); |
| 46 | bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq, struct mlx5e_rq *rq); | 45 | bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq, struct mlx5e_rq *rq); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c index 3078491cc0d0..1539cf3de5dc 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c | |||
| @@ -45,7 +45,9 @@ int mlx5e_create_tir(struct mlx5_core_dev *mdev, | |||
| 45 | if (err) | 45 | if (err) |
| 46 | return err; | 46 | return err; |
| 47 | 47 | ||
| 48 | mutex_lock(&mdev->mlx5e_res.td.list_lock); | ||
| 48 | list_add(&tir->list, &mdev->mlx5e_res.td.tirs_list); | 49 | list_add(&tir->list, &mdev->mlx5e_res.td.tirs_list); |
| 50 | mutex_unlock(&mdev->mlx5e_res.td.list_lock); | ||
| 49 | 51 | ||
| 50 | return 0; | 52 | return 0; |
| 51 | } | 53 | } |
| @@ -53,8 +55,10 @@ int mlx5e_create_tir(struct mlx5_core_dev *mdev, | |||
| 53 | void mlx5e_destroy_tir(struct mlx5_core_dev *mdev, | 55 | void mlx5e_destroy_tir(struct mlx5_core_dev *mdev, |
| 54 | struct mlx5e_tir *tir) | 56 | struct mlx5e_tir *tir) |
| 55 | { | 57 | { |
| 58 | mutex_lock(&mdev->mlx5e_res.td.list_lock); | ||
| 56 | mlx5_core_destroy_tir(mdev, tir->tirn); | 59 | mlx5_core_destroy_tir(mdev, tir->tirn); |
| 57 | list_del(&tir->list); | 60 | list_del(&tir->list); |
| 61 | mutex_unlock(&mdev->mlx5e_res.td.list_lock); | ||
| 58 | } | 62 | } |
| 59 | 63 | ||
| 60 | static int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, | 64 | static int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, |
| @@ -114,6 +118,7 @@ int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev) | |||
| 114 | } | 118 | } |
| 115 | 119 | ||
| 116 | INIT_LIST_HEAD(&mdev->mlx5e_res.td.tirs_list); | 120 | INIT_LIST_HEAD(&mdev->mlx5e_res.td.tirs_list); |
| 121 | mutex_init(&mdev->mlx5e_res.td.list_lock); | ||
| 117 | 122 | ||
| 118 | return 0; | 123 | return 0; |
| 119 | 124 | ||
| @@ -141,15 +146,17 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb) | |||
| 141 | { | 146 | { |
| 142 | struct mlx5_core_dev *mdev = priv->mdev; | 147 | struct mlx5_core_dev *mdev = priv->mdev; |
| 143 | struct mlx5e_tir *tir; | 148 | struct mlx5e_tir *tir; |
| 144 | int err = -ENOMEM; | 149 | int err = 0; |
| 145 | u32 tirn = 0; | 150 | u32 tirn = 0; |
| 146 | int inlen; | 151 | int inlen; |
| 147 | void *in; | 152 | void *in; |
| 148 | 153 | ||
| 149 | inlen = MLX5_ST_SZ_BYTES(modify_tir_in); | 154 | inlen = MLX5_ST_SZ_BYTES(modify_tir_in); |
| 150 | in = kvzalloc(inlen, GFP_KERNEL); | 155 | in = kvzalloc(inlen, GFP_KERNEL); |
| 151 | if (!in) | 156 | if (!in) { |
| 157 | err = -ENOMEM; | ||
| 152 | goto out; | 158 | goto out; |
| 159 | } | ||
| 153 | 160 | ||
| 154 | if (enable_uc_lb) | 161 | if (enable_uc_lb) |
| 155 | MLX5_SET(modify_tir_in, in, ctx.self_lb_block, | 162 | MLX5_SET(modify_tir_in, in, ctx.self_lb_block, |
| @@ -157,6 +164,7 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb) | |||
| 157 | 164 | ||
| 158 | MLX5_SET(modify_tir_in, in, bitmask.self_lb_en, 1); | 165 | MLX5_SET(modify_tir_in, in, bitmask.self_lb_en, 1); |
| 159 | 166 | ||
| 167 | mutex_lock(&mdev->mlx5e_res.td.list_lock); | ||
| 160 | list_for_each_entry(tir, &mdev->mlx5e_res.td.tirs_list, list) { | 168 | list_for_each_entry(tir, &mdev->mlx5e_res.td.tirs_list, list) { |
| 161 | tirn = tir->tirn; | 169 | tirn = tir->tirn; |
| 162 | err = mlx5_core_modify_tir(mdev, tirn, in, inlen); | 170 | err = mlx5_core_modify_tir(mdev, tirn, in, inlen); |
| @@ -168,6 +176,7 @@ out: | |||
| 168 | kvfree(in); | 176 | kvfree(in); |
| 169 | if (err) | 177 | if (err) |
| 170 | netdev_err(priv->netdev, "refresh tir(0x%x) failed, %d\n", tirn, err); | 178 | netdev_err(priv->netdev, "refresh tir(0x%x) failed, %d\n", tirn, err); |
| 179 | mutex_unlock(&mdev->mlx5e_res.td.list_lock); | ||
| 171 | 180 | ||
| 172 | return err; | 181 | return err; |
| 173 | } | 182 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index a0987cc5fe4a..78dc8fe2a83c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
| @@ -603,16 +603,18 @@ static void ptys2ethtool_supported_link(struct mlx5_core_dev *mdev, | |||
| 603 | __ETHTOOL_LINK_MODE_MASK_NBITS); | 603 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
| 604 | } | 604 | } |
| 605 | 605 | ||
| 606 | static void ptys2ethtool_adver_link(struct mlx5_core_dev *mdev, | 606 | static void ptys2ethtool_adver_link(unsigned long *advertising_modes, |
| 607 | unsigned long *advertising_modes, | 607 | u32 eth_proto_cap, bool ext) |
| 608 | u32 eth_proto_cap) | ||
| 609 | { | 608 | { |
| 610 | unsigned long proto_cap = eth_proto_cap; | 609 | unsigned long proto_cap = eth_proto_cap; |
| 611 | struct ptys2ethtool_config *table; | 610 | struct ptys2ethtool_config *table; |
| 612 | u32 max_size; | 611 | u32 max_size; |
| 613 | int proto; | 612 | int proto; |
| 614 | 613 | ||
| 615 | mlx5e_ethtool_get_speed_arr(mdev, &table, &max_size); | 614 | table = ext ? ptys2ext_ethtool_table : ptys2legacy_ethtool_table; |
| 615 | max_size = ext ? ARRAY_SIZE(ptys2ext_ethtool_table) : | ||
| 616 | ARRAY_SIZE(ptys2legacy_ethtool_table); | ||
| 617 | |||
| 616 | for_each_set_bit(proto, &proto_cap, max_size) | 618 | for_each_set_bit(proto, &proto_cap, max_size) |
| 617 | bitmap_or(advertising_modes, advertising_modes, | 619 | bitmap_or(advertising_modes, advertising_modes, |
| 618 | table[proto].advertised, | 620 | table[proto].advertised, |
| @@ -794,12 +796,12 @@ static void get_supported(struct mlx5_core_dev *mdev, u32 eth_proto_cap, | |||
| 794 | ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Pause); | 796 | ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Pause); |
| 795 | } | 797 | } |
| 796 | 798 | ||
| 797 | static void get_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_cap, | 799 | static void get_advertising(u32 eth_proto_cap, u8 tx_pause, u8 rx_pause, |
| 798 | u8 tx_pause, u8 rx_pause, | 800 | struct ethtool_link_ksettings *link_ksettings, |
| 799 | struct ethtool_link_ksettings *link_ksettings) | 801 | bool ext) |
| 800 | { | 802 | { |
| 801 | unsigned long *advertising = link_ksettings->link_modes.advertising; | 803 | unsigned long *advertising = link_ksettings->link_modes.advertising; |
| 802 | ptys2ethtool_adver_link(mdev, advertising, eth_proto_cap); | 804 | ptys2ethtool_adver_link(advertising, eth_proto_cap, ext); |
| 803 | 805 | ||
| 804 | if (rx_pause) | 806 | if (rx_pause) |
| 805 | ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Pause); | 807 | ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Pause); |
| @@ -854,8 +856,9 @@ static void get_lp_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_lp, | |||
| 854 | struct ethtool_link_ksettings *link_ksettings) | 856 | struct ethtool_link_ksettings *link_ksettings) |
| 855 | { | 857 | { |
| 856 | unsigned long *lp_advertising = link_ksettings->link_modes.lp_advertising; | 858 | unsigned long *lp_advertising = link_ksettings->link_modes.lp_advertising; |
| 859 | bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); | ||
| 857 | 860 | ||
| 858 | ptys2ethtool_adver_link(mdev, lp_advertising, eth_proto_lp); | 861 | ptys2ethtool_adver_link(lp_advertising, eth_proto_lp, ext); |
| 859 | } | 862 | } |
| 860 | 863 | ||
| 861 | int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, | 864 | int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, |
| @@ -872,6 +875,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, | |||
| 872 | u8 an_disable_admin; | 875 | u8 an_disable_admin; |
| 873 | u8 an_status; | 876 | u8 an_status; |
| 874 | u8 connector_type; | 877 | u8 connector_type; |
| 878 | bool admin_ext; | ||
| 875 | bool ext; | 879 | bool ext; |
| 876 | int err; | 880 | int err; |
| 877 | 881 | ||
| @@ -886,6 +890,19 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, | |||
| 886 | eth_proto_capability); | 890 | eth_proto_capability); |
| 887 | eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, | 891 | eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, |
| 888 | eth_proto_admin); | 892 | eth_proto_admin); |
| 893 | /* Fields: eth_proto_admin and ext_eth_proto_admin are | ||
| 894 | * mutually exclusive. Hence try reading legacy advertising | ||
| 895 | * when extended advertising is zero. | ||
| 896 | * admin_ext indicates how eth_proto_admin should be | ||
| 897 | * interpreted | ||
| 898 | */ | ||
| 899 | admin_ext = ext; | ||
| 900 | if (ext && !eth_proto_admin) { | ||
| 901 | eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, false, | ||
| 902 | eth_proto_admin); | ||
| 903 | admin_ext = false; | ||
| 904 | } | ||
| 905 | |||
| 889 | eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, | 906 | eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, |
| 890 | eth_proto_oper); | 907 | eth_proto_oper); |
| 891 | eth_proto_lp = MLX5_GET(ptys_reg, out, eth_proto_lp_advertise); | 908 | eth_proto_lp = MLX5_GET(ptys_reg, out, eth_proto_lp_advertise); |
| @@ -899,7 +916,8 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, | |||
| 899 | ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); | 916 | ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); |
| 900 | 917 | ||
| 901 | get_supported(mdev, eth_proto_cap, link_ksettings); | 918 | get_supported(mdev, eth_proto_cap, link_ksettings); |
| 902 | get_advertising(mdev, eth_proto_admin, tx_pause, rx_pause, link_ksettings); | 919 | get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings, |
| 920 | admin_ext); | ||
| 903 | get_speed_duplex(priv->netdev, eth_proto_oper, link_ksettings); | 921 | get_speed_duplex(priv->netdev, eth_proto_oper, link_ksettings); |
| 904 | 922 | ||
| 905 | eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; | 923 | eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; |
| @@ -997,19 +1015,17 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, | |||
| 997 | 1015 | ||
| 998 | #define MLX5E_PTYS_EXT ((1ULL << ETHTOOL_LINK_MODE_50000baseKR_Full_BIT) - 1) | 1016 | #define MLX5E_PTYS_EXT ((1ULL << ETHTOOL_LINK_MODE_50000baseKR_Full_BIT) - 1) |
| 999 | 1017 | ||
| 1000 | ext_requested = (link_ksettings->link_modes.advertising[0] > | 1018 | ext_requested = !!(link_ksettings->link_modes.advertising[0] > |
| 1001 | MLX5E_PTYS_EXT); | 1019 | MLX5E_PTYS_EXT || |
| 1020 | link_ksettings->link_modes.advertising[1]); | ||
| 1002 | ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); | 1021 | ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); |
| 1003 | 1022 | ext_requested &= ext_supported; | |
| 1004 | /*when ptys_extended_ethernet is set legacy link modes are deprecated */ | ||
| 1005 | if (ext_requested != ext_supported) | ||
| 1006 | return -EPROTONOSUPPORT; | ||
| 1007 | 1023 | ||
| 1008 | speed = link_ksettings->base.speed; | 1024 | speed = link_ksettings->base.speed; |
| 1009 | ethtool2ptys_adver_func = ext_requested ? | 1025 | ethtool2ptys_adver_func = ext_requested ? |
| 1010 | mlx5e_ethtool2ptys_ext_adver_link : | 1026 | mlx5e_ethtool2ptys_ext_adver_link : |
| 1011 | mlx5e_ethtool2ptys_adver_link; | 1027 | mlx5e_ethtool2ptys_adver_link; |
| 1012 | err = mlx5_port_query_eth_proto(mdev, 1, ext_supported, &eproto); | 1028 | err = mlx5_port_query_eth_proto(mdev, 1, ext_requested, &eproto); |
| 1013 | if (err) { | 1029 | if (err) { |
| 1014 | netdev_err(priv->netdev, "%s: query port eth proto failed: %d\n", | 1030 | netdev_err(priv->netdev, "%s: query port eth proto failed: %d\n", |
| 1015 | __func__, err); | 1031 | __func__, err); |
| @@ -1037,7 +1053,7 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, | |||
| 1037 | if (!an_changes && link_modes == eproto.admin) | 1053 | if (!an_changes && link_modes == eproto.admin) |
| 1038 | goto out; | 1054 | goto out; |
| 1039 | 1055 | ||
| 1040 | mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext_supported); | 1056 | mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext_requested); |
| 1041 | mlx5_toggle_port_link(mdev); | 1057 | mlx5_toggle_port_link(mdev); |
| 1042 | 1058 | ||
| 1043 | out: | 1059 | out: |
| @@ -1570,7 +1586,7 @@ static int mlx5e_get_module_info(struct net_device *netdev, | |||
| 1570 | break; | 1586 | break; |
| 1571 | case MLX5_MODULE_ID_SFP: | 1587 | case MLX5_MODULE_ID_SFP: |
| 1572 | modinfo->type = ETH_MODULE_SFF_8472; | 1588 | modinfo->type = ETH_MODULE_SFF_8472; |
| 1573 | modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; | 1589 | modinfo->eeprom_len = MLX5_EEPROM_PAGE_LENGTH; |
| 1574 | break; | 1590 | break; |
| 1575 | default: | 1591 | default: |
| 1576 | netdev_err(priv->netdev, "%s: cable type not recognized:0x%x\n", | 1592 | netdev_err(priv->netdev, "%s: cable type not recognized:0x%x\n", |
| @@ -1752,7 +1768,8 @@ static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable) | |||
| 1752 | struct mlx5e_channel *c; | 1768 | struct mlx5e_channel *c; |
| 1753 | int i; | 1769 | int i; |
| 1754 | 1770 | ||
| 1755 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) | 1771 | if (!test_bit(MLX5E_STATE_OPENED, &priv->state) || |
| 1772 | priv->channels.params.xdp_prog) | ||
| 1756 | return 0; | 1773 | return 0; |
| 1757 | 1774 | ||
| 1758 | for (i = 0; i < channels->num; i++) { | 1775 | for (i = 0; i < channels->num; i++) { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index b5fdbd3190d9..46157e2a1e5a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
| @@ -951,7 +951,11 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, | |||
| 951 | if (params->rx_dim_enabled) | 951 | if (params->rx_dim_enabled) |
| 952 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); | 952 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); |
| 953 | 953 | ||
| 954 | if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE)) | 954 | /* We disable csum_complete when XDP is enabled since |
| 955 | * XDP programs might manipulate packets which will render | ||
| 956 | * skb->checksum incorrect. | ||
| 957 | */ | ||
| 958 | if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) || c->xdp) | ||
| 955 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); | 959 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); |
| 956 | 960 | ||
| 957 | return 0; | 961 | return 0; |
| @@ -2937,6 +2941,14 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, | |||
| 2937 | return 0; | 2941 | return 0; |
| 2938 | } | 2942 | } |
| 2939 | 2943 | ||
| 2944 | int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv) | ||
| 2945 | { | ||
| 2946 | struct mlx5e_channels new_channels = {}; | ||
| 2947 | |||
| 2948 | new_channels.params = priv->channels.params; | ||
| 2949 | return mlx5e_safe_switch_channels(priv, &new_channels, NULL); | ||
| 2950 | } | ||
| 2951 | |||
| 2940 | void mlx5e_timestamp_init(struct mlx5e_priv *priv) | 2952 | void mlx5e_timestamp_init(struct mlx5e_priv *priv) |
| 2941 | { | 2953 | { |
| 2942 | priv->tstamp.tx_type = HWTSTAMP_TX_OFF; | 2954 | priv->tstamp.tx_type = HWTSTAMP_TX_OFF; |
| @@ -3765,7 +3777,7 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu, | |||
| 3765 | if (params->xdp_prog && | 3777 | if (params->xdp_prog && |
| 3766 | !mlx5e_rx_is_linear_skb(priv->mdev, &new_channels.params)) { | 3778 | !mlx5e_rx_is_linear_skb(priv->mdev, &new_channels.params)) { |
| 3767 | netdev_err(netdev, "MTU(%d) > %d is not allowed while XDP enabled\n", | 3779 | netdev_err(netdev, "MTU(%d) > %d is not allowed while XDP enabled\n", |
| 3768 | new_mtu, MLX5E_XDP_MAX_MTU); | 3780 | new_mtu, mlx5e_xdp_max_mtu(params)); |
| 3769 | err = -EINVAL; | 3781 | err = -EINVAL; |
| 3770 | goto out; | 3782 | goto out; |
| 3771 | } | 3783 | } |
| @@ -4161,11 +4173,10 @@ static void mlx5e_tx_timeout_work(struct work_struct *work) | |||
| 4161 | if (!report_failed) | 4173 | if (!report_failed) |
| 4162 | goto unlock; | 4174 | goto unlock; |
| 4163 | 4175 | ||
| 4164 | mlx5e_close_locked(priv->netdev); | 4176 | err = mlx5e_safe_reopen_channels(priv); |
| 4165 | err = mlx5e_open_locked(priv->netdev); | ||
| 4166 | if (err) | 4177 | if (err) |
| 4167 | netdev_err(priv->netdev, | 4178 | netdev_err(priv->netdev, |
| 4168 | "mlx5e_open_locked failed recovering from a tx_timeout, err(%d).\n", | 4179 | "mlx5e_safe_reopen_channels failed recovering from a tx_timeout, err(%d).\n", |
| 4169 | err); | 4180 | err); |
| 4170 | 4181 | ||
| 4171 | unlock: | 4182 | unlock: |
| @@ -4201,7 +4212,8 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog) | |||
| 4201 | 4212 | ||
| 4202 | if (!mlx5e_rx_is_linear_skb(priv->mdev, &new_channels.params)) { | 4213 | if (!mlx5e_rx_is_linear_skb(priv->mdev, &new_channels.params)) { |
| 4203 | netdev_warn(netdev, "XDP is not allowed with MTU(%d) > %d\n", | 4214 | netdev_warn(netdev, "XDP is not allowed with MTU(%d) > %d\n", |
| 4204 | new_channels.params.sw_mtu, MLX5E_XDP_MAX_MTU); | 4215 | new_channels.params.sw_mtu, |
| 4216 | mlx5e_xdp_max_mtu(&new_channels.params)); | ||
| 4205 | return -EINVAL; | 4217 | return -EINVAL; |
| 4206 | } | 4218 | } |
| 4207 | 4219 | ||
| @@ -4553,7 +4565,7 @@ void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params, | |||
| 4553 | { | 4565 | { |
| 4554 | enum mlx5e_traffic_types tt; | 4566 | enum mlx5e_traffic_types tt; |
| 4555 | 4567 | ||
| 4556 | rss_params->hfunc = ETH_RSS_HASH_XOR; | 4568 | rss_params->hfunc = ETH_RSS_HASH_TOP; |
| 4557 | netdev_rss_key_fill(rss_params->toeplitz_hash_key, | 4569 | netdev_rss_key_fill(rss_params->toeplitz_hash_key, |
| 4558 | sizeof(rss_params->toeplitz_hash_key)); | 4570 | sizeof(rss_params->toeplitz_hash_key)); |
| 4559 | mlx5e_build_default_indir_rqt(rss_params->indirection_rqt, | 4571 | mlx5e_build_default_indir_rqt(rss_params->indirection_rqt, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index 3dde5c7e0739..c3b3002ff62f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | |||
| @@ -692,7 +692,14 @@ static inline bool is_last_ethertype_ip(struct sk_buff *skb, int *network_depth, | |||
| 692 | { | 692 | { |
| 693 | *proto = ((struct ethhdr *)skb->data)->h_proto; | 693 | *proto = ((struct ethhdr *)skb->data)->h_proto; |
| 694 | *proto = __vlan_get_protocol(skb, *proto, network_depth); | 694 | *proto = __vlan_get_protocol(skb, *proto, network_depth); |
| 695 | return (*proto == htons(ETH_P_IP) || *proto == htons(ETH_P_IPV6)); | 695 | |
| 696 | if (*proto == htons(ETH_P_IP)) | ||
| 697 | return pskb_may_pull(skb, *network_depth + sizeof(struct iphdr)); | ||
| 698 | |||
| 699 | if (*proto == htons(ETH_P_IPV6)) | ||
| 700 | return pskb_may_pull(skb, *network_depth + sizeof(struct ipv6hdr)); | ||
| 701 | |||
| 702 | return false; | ||
| 696 | } | 703 | } |
| 697 | 704 | ||
| 698 | static inline void mlx5e_enable_ecn(struct mlx5e_rq *rq, struct sk_buff *skb) | 705 | static inline void mlx5e_enable_ecn(struct mlx5e_rq *rq, struct sk_buff *skb) |
| @@ -712,17 +719,6 @@ static inline void mlx5e_enable_ecn(struct mlx5e_rq *rq, struct sk_buff *skb) | |||
| 712 | rq->stats->ecn_mark += !!rc; | 719 | rq->stats->ecn_mark += !!rc; |
| 713 | } | 720 | } |
| 714 | 721 | ||
| 715 | static u32 mlx5e_get_fcs(const struct sk_buff *skb) | ||
| 716 | { | ||
| 717 | const void *fcs_bytes; | ||
| 718 | u32 _fcs_bytes; | ||
| 719 | |||
| 720 | fcs_bytes = skb_header_pointer(skb, skb->len - ETH_FCS_LEN, | ||
| 721 | ETH_FCS_LEN, &_fcs_bytes); | ||
| 722 | |||
| 723 | return __get_unaligned_cpu32(fcs_bytes); | ||
| 724 | } | ||
| 725 | |||
| 726 | static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) | 722 | static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) |
| 727 | { | 723 | { |
| 728 | void *ip_p = skb->data + network_depth; | 724 | void *ip_p = skb->data + network_depth; |
| @@ -733,6 +729,68 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) | |||
| 733 | 729 | ||
| 734 | #define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN) | 730 | #define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN) |
| 735 | 731 | ||
| 732 | #define MAX_PADDING 8 | ||
| 733 | |||
| 734 | static void | ||
| 735 | tail_padding_csum_slow(struct sk_buff *skb, int offset, int len, | ||
| 736 | struct mlx5e_rq_stats *stats) | ||
| 737 | { | ||
| 738 | stats->csum_complete_tail_slow++; | ||
| 739 | skb->csum = csum_block_add(skb->csum, | ||
| 740 | skb_checksum(skb, offset, len, 0), | ||
| 741 | offset); | ||
| 742 | } | ||
| 743 | |||
| 744 | static void | ||
| 745 | tail_padding_csum(struct sk_buff *skb, int offset, | ||
| 746 | struct mlx5e_rq_stats *stats) | ||
| 747 | { | ||
| 748 | u8 tail_padding[MAX_PADDING]; | ||
| 749 | int len = skb->len - offset; | ||
| 750 | void *tail; | ||
| 751 | |||
| 752 | if (unlikely(len > MAX_PADDING)) { | ||
| 753 | tail_padding_csum_slow(skb, offset, len, stats); | ||
| 754 | return; | ||
| 755 | } | ||
| 756 | |||
| 757 | tail = skb_header_pointer(skb, offset, len, tail_padding); | ||
| 758 | if (unlikely(!tail)) { | ||
| 759 | tail_padding_csum_slow(skb, offset, len, stats); | ||
| 760 | return; | ||
| 761 | } | ||
| 762 | |||
| 763 | stats->csum_complete_tail++; | ||
| 764 | skb->csum = csum_block_add(skb->csum, csum_partial(tail, len, 0), offset); | ||
| 765 | } | ||
| 766 | |||
| 767 | static void | ||
| 768 | mlx5e_skb_padding_csum(struct sk_buff *skb, int network_depth, __be16 proto, | ||
| 769 | struct mlx5e_rq_stats *stats) | ||
| 770 | { | ||
| 771 | struct ipv6hdr *ip6; | ||
| 772 | struct iphdr *ip4; | ||
| 773 | int pkt_len; | ||
| 774 | |||
| 775 | switch (proto) { | ||
| 776 | case htons(ETH_P_IP): | ||
| 777 | ip4 = (struct iphdr *)(skb->data + network_depth); | ||
| 778 | pkt_len = network_depth + ntohs(ip4->tot_len); | ||
| 779 | break; | ||
| 780 | case htons(ETH_P_IPV6): | ||
| 781 | ip6 = (struct ipv6hdr *)(skb->data + network_depth); | ||
| 782 | pkt_len = network_depth + sizeof(*ip6) + ntohs(ip6->payload_len); | ||
| 783 | break; | ||
| 784 | default: | ||
| 785 | return; | ||
| 786 | } | ||
| 787 | |||
| 788 | if (likely(pkt_len >= skb->len)) | ||
| 789 | return; | ||
| 790 | |||
| 791 | tail_padding_csum(skb, pkt_len, stats); | ||
| 792 | } | ||
| 793 | |||
| 736 | static inline void mlx5e_handle_csum(struct net_device *netdev, | 794 | static inline void mlx5e_handle_csum(struct net_device *netdev, |
| 737 | struct mlx5_cqe64 *cqe, | 795 | struct mlx5_cqe64 *cqe, |
| 738 | struct mlx5e_rq *rq, | 796 | struct mlx5e_rq *rq, |
| @@ -752,7 +810,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, | |||
| 752 | return; | 810 | return; |
| 753 | } | 811 | } |
| 754 | 812 | ||
| 755 | if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) | 813 | /* True when explicitly set via priv flag, or XDP prog is loaded */ |
| 814 | if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)) | ||
| 756 | goto csum_unnecessary; | 815 | goto csum_unnecessary; |
| 757 | 816 | ||
| 758 | /* CQE csum doesn't cover padding octets in short ethernet | 817 | /* CQE csum doesn't cover padding octets in short ethernet |
| @@ -780,18 +839,15 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, | |||
| 780 | skb->csum = csum_partial(skb->data + ETH_HLEN, | 839 | skb->csum = csum_partial(skb->data + ETH_HLEN, |
| 781 | network_depth - ETH_HLEN, | 840 | network_depth - ETH_HLEN, |
| 782 | skb->csum); | 841 | skb->csum); |
| 783 | if (unlikely(netdev->features & NETIF_F_RXFCS)) | 842 | |
| 784 | skb->csum = csum_block_add(skb->csum, | 843 | mlx5e_skb_padding_csum(skb, network_depth, proto, stats); |
| 785 | (__force __wsum)mlx5e_get_fcs(skb), | ||
| 786 | skb->len - ETH_FCS_LEN); | ||
| 787 | stats->csum_complete++; | 844 | stats->csum_complete++; |
| 788 | return; | 845 | return; |
| 789 | } | 846 | } |
| 790 | 847 | ||
| 791 | csum_unnecessary: | 848 | csum_unnecessary: |
| 792 | if (likely((cqe->hds_ip_ext & CQE_L3_OK) && | 849 | if (likely((cqe->hds_ip_ext & CQE_L3_OK) && |
| 793 | ((cqe->hds_ip_ext & CQE_L4_OK) || | 850 | (cqe->hds_ip_ext & CQE_L4_OK))) { |
| 794 | (get_cqe_l4_hdr_type(cqe) == CQE_L4_HDR_TYPE_NONE)))) { | ||
| 795 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 851 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 796 | if (cqe_is_tunneled(cqe)) { | 852 | if (cqe_is_tunneled(cqe)) { |
| 797 | skb->csum_level = 1; | 853 | skb->csum_level = 1; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c index 1a78e05cbba8..b75aa8b8bf04 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | |||
| @@ -59,6 +59,8 @@ static const struct counter_desc sw_stats_desc[] = { | |||
| 59 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) }, | 59 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) }, |
| 60 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) }, | 60 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) }, |
| 61 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) }, | 61 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) }, |
| 62 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete_tail) }, | ||
| 63 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete_tail_slow) }, | ||
| 62 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) }, | 64 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) }, |
| 63 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) }, | 65 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) }, |
| 64 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_redirect) }, | 66 | { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_redirect) }, |
| @@ -151,6 +153,8 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) | |||
| 151 | s->rx_removed_vlan_packets += rq_stats->removed_vlan_packets; | 153 | s->rx_removed_vlan_packets += rq_stats->removed_vlan_packets; |
| 152 | s->rx_csum_none += rq_stats->csum_none; | 154 | s->rx_csum_none += rq_stats->csum_none; |
| 153 | s->rx_csum_complete += rq_stats->csum_complete; | 155 | s->rx_csum_complete += rq_stats->csum_complete; |
| 156 | s->rx_csum_complete_tail += rq_stats->csum_complete_tail; | ||
| 157 | s->rx_csum_complete_tail_slow += rq_stats->csum_complete_tail_slow; | ||
| 154 | s->rx_csum_unnecessary += rq_stats->csum_unnecessary; | 158 | s->rx_csum_unnecessary += rq_stats->csum_unnecessary; |
| 155 | s->rx_csum_unnecessary_inner += rq_stats->csum_unnecessary_inner; | 159 | s->rx_csum_unnecessary_inner += rq_stats->csum_unnecessary_inner; |
| 156 | s->rx_xdp_drop += rq_stats->xdp_drop; | 160 | s->rx_xdp_drop += rq_stats->xdp_drop; |
| @@ -1190,6 +1194,8 @@ static const struct counter_desc rq_stats_desc[] = { | |||
| 1190 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) }, | 1194 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) }, |
| 1191 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) }, | 1195 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) }, |
| 1192 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) }, | 1196 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) }, |
| 1197 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete_tail) }, | ||
| 1198 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete_tail_slow) }, | ||
| 1193 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary) }, | 1199 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary) }, |
| 1194 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) }, | 1200 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) }, |
| 1195 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) }, | 1201 | { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) }, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h index 4640d4f986f8..16c3b785f282 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | |||
| @@ -71,6 +71,8 @@ struct mlx5e_sw_stats { | |||
| 71 | u64 rx_csum_unnecessary; | 71 | u64 rx_csum_unnecessary; |
| 72 | u64 rx_csum_none; | 72 | u64 rx_csum_none; |
| 73 | u64 rx_csum_complete; | 73 | u64 rx_csum_complete; |
| 74 | u64 rx_csum_complete_tail; | ||
| 75 | u64 rx_csum_complete_tail_slow; | ||
| 74 | u64 rx_csum_unnecessary_inner; | 76 | u64 rx_csum_unnecessary_inner; |
| 75 | u64 rx_xdp_drop; | 77 | u64 rx_xdp_drop; |
| 76 | u64 rx_xdp_redirect; | 78 | u64 rx_xdp_redirect; |
| @@ -181,6 +183,8 @@ struct mlx5e_rq_stats { | |||
| 181 | u64 packets; | 183 | u64 packets; |
| 182 | u64 bytes; | 184 | u64 bytes; |
| 183 | u64 csum_complete; | 185 | u64 csum_complete; |
| 186 | u64 csum_complete_tail; | ||
| 187 | u64 csum_complete_tail_slow; | ||
| 184 | u64 csum_unnecessary; | 188 | u64 csum_unnecessary; |
| 185 | u64 csum_unnecessary_inner; | 189 | u64 csum_unnecessary_inner; |
| 186 | u64 csum_none; | 190 | u64 csum_none; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index b4967a0ff8c7..d75dc44eb2ff 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
| @@ -2158,6 +2158,52 @@ static bool csum_offload_supported(struct mlx5e_priv *priv, | |||
| 2158 | return true; | 2158 | return true; |
| 2159 | } | 2159 | } |
| 2160 | 2160 | ||
| 2161 | struct ip_ttl_word { | ||
| 2162 | __u8 ttl; | ||
| 2163 | __u8 protocol; | ||
| 2164 | __sum16 check; | ||
| 2165 | }; | ||
| 2166 | |||
| 2167 | struct ipv6_hoplimit_word { | ||
| 2168 | __be16 payload_len; | ||
| 2169 | __u8 nexthdr; | ||
| 2170 | __u8 hop_limit; | ||
| 2171 | }; | ||
| 2172 | |||
| 2173 | static bool is_action_keys_supported(const struct flow_action_entry *act) | ||
| 2174 | { | ||
| 2175 | u32 mask, offset; | ||
| 2176 | u8 htype; | ||
| 2177 | |||
| 2178 | htype = act->mangle.htype; | ||
| 2179 | offset = act->mangle.offset; | ||
| 2180 | mask = ~act->mangle.mask; | ||
| 2181 | /* For IPv4 & IPv6 header check 4 byte word, | ||
| 2182 | * to determine that modified fields | ||
| 2183 | * are NOT ttl & hop_limit only. | ||
| 2184 | */ | ||
| 2185 | if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP4) { | ||
| 2186 | struct ip_ttl_word *ttl_word = | ||
| 2187 | (struct ip_ttl_word *)&mask; | ||
| 2188 | |||
| 2189 | if (offset != offsetof(struct iphdr, ttl) || | ||
| 2190 | ttl_word->protocol || | ||
| 2191 | ttl_word->check) { | ||
| 2192 | return true; | ||
| 2193 | } | ||
| 2194 | } else if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP6) { | ||
| 2195 | struct ipv6_hoplimit_word *hoplimit_word = | ||
| 2196 | (struct ipv6_hoplimit_word *)&mask; | ||
| 2197 | |||
| 2198 | if (offset != offsetof(struct ipv6hdr, payload_len) || | ||
| 2199 | hoplimit_word->payload_len || | ||
| 2200 | hoplimit_word->nexthdr) { | ||
| 2201 | return true; | ||
| 2202 | } | ||
| 2203 | } | ||
| 2204 | return false; | ||
| 2205 | } | ||
| 2206 | |||
| 2161 | static bool modify_header_match_supported(struct mlx5_flow_spec *spec, | 2207 | static bool modify_header_match_supported(struct mlx5_flow_spec *spec, |
| 2162 | struct flow_action *flow_action, | 2208 | struct flow_action *flow_action, |
| 2163 | u32 actions, | 2209 | u32 actions, |
| @@ -2165,9 +2211,9 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, | |||
| 2165 | { | 2211 | { |
| 2166 | const struct flow_action_entry *act; | 2212 | const struct flow_action_entry *act; |
| 2167 | bool modify_ip_header; | 2213 | bool modify_ip_header; |
| 2168 | u8 htype, ip_proto; | ||
| 2169 | void *headers_v; | 2214 | void *headers_v; |
| 2170 | u16 ethertype; | 2215 | u16 ethertype; |
| 2216 | u8 ip_proto; | ||
| 2171 | int i; | 2217 | int i; |
| 2172 | 2218 | ||
| 2173 | if (actions & MLX5_FLOW_CONTEXT_ACTION_DECAP) | 2219 | if (actions & MLX5_FLOW_CONTEXT_ACTION_DECAP) |
| @@ -2187,9 +2233,7 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, | |||
| 2187 | act->id != FLOW_ACTION_ADD) | 2233 | act->id != FLOW_ACTION_ADD) |
| 2188 | continue; | 2234 | continue; |
| 2189 | 2235 | ||
| 2190 | htype = act->mangle.htype; | 2236 | if (is_action_keys_supported(act)) { |
| 2191 | if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP4 || | ||
| 2192 | htype == FLOW_ACT_MANGLE_HDR_TYPE_IP6) { | ||
| 2193 | modify_ip_header = true; | 2237 | modify_ip_header = true; |
| 2194 | break; | 2238 | break; |
| 2195 | } | 2239 | } |
| @@ -2340,15 +2384,22 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, | |||
| 2340 | return 0; | 2384 | return 0; |
| 2341 | } | 2385 | } |
| 2342 | 2386 | ||
| 2343 | static inline int cmp_encap_info(struct ip_tunnel_key *a, | 2387 | struct encap_key { |
| 2344 | struct ip_tunnel_key *b) | 2388 | struct ip_tunnel_key *ip_tun_key; |
| 2389 | int tunnel_type; | ||
| 2390 | }; | ||
| 2391 | |||
| 2392 | static inline int cmp_encap_info(struct encap_key *a, | ||
| 2393 | struct encap_key *b) | ||
| 2345 | { | 2394 | { |
| 2346 | return memcmp(a, b, sizeof(*a)); | 2395 | return memcmp(a->ip_tun_key, b->ip_tun_key, sizeof(*a->ip_tun_key)) || |
| 2396 | a->tunnel_type != b->tunnel_type; | ||
| 2347 | } | 2397 | } |
| 2348 | 2398 | ||
| 2349 | static inline int hash_encap_info(struct ip_tunnel_key *key) | 2399 | static inline int hash_encap_info(struct encap_key *key) |
| 2350 | { | 2400 | { |
| 2351 | return jhash(key, sizeof(*key), 0); | 2401 | return jhash(key->ip_tun_key, sizeof(*key->ip_tun_key), |
| 2402 | key->tunnel_type); | ||
| 2352 | } | 2403 | } |
| 2353 | 2404 | ||
| 2354 | 2405 | ||
| @@ -2379,7 +2430,7 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, | |||
| 2379 | struct mlx5_esw_flow_attr *attr = flow->esw_attr; | 2430 | struct mlx5_esw_flow_attr *attr = flow->esw_attr; |
| 2380 | struct mlx5e_tc_flow_parse_attr *parse_attr; | 2431 | struct mlx5e_tc_flow_parse_attr *parse_attr; |
| 2381 | struct ip_tunnel_info *tun_info; | 2432 | struct ip_tunnel_info *tun_info; |
| 2382 | struct ip_tunnel_key *key; | 2433 | struct encap_key key, e_key; |
| 2383 | struct mlx5e_encap_entry *e; | 2434 | struct mlx5e_encap_entry *e; |
| 2384 | unsigned short family; | 2435 | unsigned short family; |
| 2385 | uintptr_t hash_key; | 2436 | uintptr_t hash_key; |
| @@ -2389,13 +2440,16 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, | |||
| 2389 | parse_attr = attr->parse_attr; | 2440 | parse_attr = attr->parse_attr; |
| 2390 | tun_info = &parse_attr->tun_info[out_index]; | 2441 | tun_info = &parse_attr->tun_info[out_index]; |
| 2391 | family = ip_tunnel_info_af(tun_info); | 2442 | family = ip_tunnel_info_af(tun_info); |
| 2392 | key = &tun_info->key; | 2443 | key.ip_tun_key = &tun_info->key; |
| 2444 | key.tunnel_type = mlx5e_tc_tun_get_type(mirred_dev); | ||
| 2393 | 2445 | ||
| 2394 | hash_key = hash_encap_info(key); | 2446 | hash_key = hash_encap_info(&key); |
| 2395 | 2447 | ||
| 2396 | hash_for_each_possible_rcu(esw->offloads.encap_tbl, e, | 2448 | hash_for_each_possible_rcu(esw->offloads.encap_tbl, e, |
| 2397 | encap_hlist, hash_key) { | 2449 | encap_hlist, hash_key) { |
| 2398 | if (!cmp_encap_info(&e->tun_info.key, key)) { | 2450 | e_key.ip_tun_key = &e->tun_info.key; |
| 2451 | e_key.tunnel_type = e->tunnel_type; | ||
| 2452 | if (!cmp_encap_info(&e_key, &key)) { | ||
| 2399 | found = true; | 2453 | found = true; |
| 2400 | break; | 2454 | break; |
| 2401 | } | 2455 | } |
| @@ -2657,7 +2711,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, | |||
| 2657 | 2711 | ||
| 2658 | if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || | 2712 | if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || |
| 2659 | hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { | 2713 | hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { |
| 2660 | err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_KERNEL, | 2714 | err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_FDB, |
| 2661 | parse_attr, hdrs, extack); | 2715 | parse_attr, hdrs, extack); |
| 2662 | if (err) | 2716 | if (err) |
| 2663 | return err; | 2717 | return err; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index ecd2c747f726..8a67fd197b79 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
| @@ -105,8 +105,7 @@ static int arm_vport_context_events_cmd(struct mlx5_core_dev *dev, u16 vport, | |||
| 105 | opcode, MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT); | 105 | opcode, MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT); |
| 106 | MLX5_SET(modify_nic_vport_context_in, in, field_select.change_event, 1); | 106 | MLX5_SET(modify_nic_vport_context_in, in, field_select.change_event, 1); |
| 107 | MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport); | 107 | MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport); |
| 108 | if (vport) | 108 | MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); |
| 109 | MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1); | ||
| 110 | nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in, | 109 | nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in, |
| 111 | in, nic_vport_context); | 110 | in, nic_vport_context); |
| 112 | 111 | ||
| @@ -134,8 +133,7 @@ static int modify_esw_vport_context_cmd(struct mlx5_core_dev *dev, u16 vport, | |||
| 134 | MLX5_SET(modify_esw_vport_context_in, in, opcode, | 133 | MLX5_SET(modify_esw_vport_context_in, in, opcode, |
| 135 | MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT); | 134 | MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT); |
| 136 | MLX5_SET(modify_esw_vport_context_in, in, vport_number, vport); | 135 | MLX5_SET(modify_esw_vport_context_in, in, vport_number, vport); |
| 137 | if (vport) | 136 | MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1); |
| 138 | MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1); | ||
| 139 | return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); | 137 | return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); |
| 140 | } | 138 | } |
| 141 | 139 | ||
| @@ -431,6 +429,8 @@ static int esw_create_legacy_table(struct mlx5_eswitch *esw) | |||
| 431 | { | 429 | { |
| 432 | int err; | 430 | int err; |
| 433 | 431 | ||
| 432 | memset(&esw->fdb_table.legacy, 0, sizeof(struct legacy_fdb)); | ||
| 433 | |||
| 434 | err = esw_create_legacy_vepa_table(esw); | 434 | err = esw_create_legacy_vepa_table(esw); |
| 435 | if (err) | 435 | if (err) |
| 436 | return err; | 436 | return err; |
| @@ -2157,6 +2157,7 @@ static int _mlx5_eswitch_set_vepa_locked(struct mlx5_eswitch *esw, | |||
| 2157 | 2157 | ||
| 2158 | /* Star rule to forward all traffic to uplink vport */ | 2158 | /* Star rule to forward all traffic to uplink vport */ |
| 2159 | memset(spec, 0, sizeof(*spec)); | 2159 | memset(spec, 0, sizeof(*spec)); |
| 2160 | memset(&dest, 0, sizeof(dest)); | ||
| 2160 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; | 2161 | dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; |
| 2161 | dest.vport.num = MLX5_VPORT_UPLINK; | 2162 | dest.vport.num = MLX5_VPORT_UPLINK; |
| 2162 | flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; | 2163 | flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index f2260391be5b..9b2d78ee22b8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | |||
| @@ -1611,6 +1611,7 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw, int nvports) | |||
| 1611 | { | 1611 | { |
| 1612 | int err; | 1612 | int err; |
| 1613 | 1613 | ||
| 1614 | memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb)); | ||
| 1614 | mutex_init(&esw->fdb_table.offloads.fdb_prio_lock); | 1615 | mutex_init(&esw->fdb_table.offloads.fdb_prio_lock); |
| 1615 | 1616 | ||
| 1616 | err = esw_create_offloads_fdb_tables(esw, nvports); | 1617 | err = esw_create_offloads_fdb_tables(esw, nvports); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c index 5cf5f2a9d51f..22a2ef111514 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c | |||
| @@ -148,14 +148,16 @@ static int mlx5_fpga_tls_alloc_swid(struct idr *idr, spinlock_t *idr_spinlock, | |||
| 148 | return ret; | 148 | return ret; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | static void mlx5_fpga_tls_release_swid(struct idr *idr, | 151 | static void *mlx5_fpga_tls_release_swid(struct idr *idr, |
| 152 | spinlock_t *idr_spinlock, u32 swid) | 152 | spinlock_t *idr_spinlock, u32 swid) |
| 153 | { | 153 | { |
| 154 | unsigned long flags; | 154 | unsigned long flags; |
| 155 | void *ptr; | ||
| 155 | 156 | ||
| 156 | spin_lock_irqsave(idr_spinlock, flags); | 157 | spin_lock_irqsave(idr_spinlock, flags); |
| 157 | idr_remove(idr, swid); | 158 | ptr = idr_remove(idr, swid); |
| 158 | spin_unlock_irqrestore(idr_spinlock, flags); | 159 | spin_unlock_irqrestore(idr_spinlock, flags); |
| 160 | return ptr; | ||
| 159 | } | 161 | } |
| 160 | 162 | ||
| 161 | static void mlx_tls_kfree_complete(struct mlx5_fpga_conn *conn, | 163 | static void mlx_tls_kfree_complete(struct mlx5_fpga_conn *conn, |
| @@ -165,20 +167,12 @@ static void mlx_tls_kfree_complete(struct mlx5_fpga_conn *conn, | |||
| 165 | kfree(buf); | 167 | kfree(buf); |
| 166 | } | 168 | } |
| 167 | 169 | ||
| 168 | struct mlx5_teardown_stream_context { | ||
| 169 | struct mlx5_fpga_tls_command_context cmd; | ||
| 170 | u32 swid; | ||
| 171 | }; | ||
| 172 | |||
| 173 | static void | 170 | static void |
| 174 | mlx5_fpga_tls_teardown_completion(struct mlx5_fpga_conn *conn, | 171 | mlx5_fpga_tls_teardown_completion(struct mlx5_fpga_conn *conn, |
| 175 | struct mlx5_fpga_device *fdev, | 172 | struct mlx5_fpga_device *fdev, |
| 176 | struct mlx5_fpga_tls_command_context *cmd, | 173 | struct mlx5_fpga_tls_command_context *cmd, |
| 177 | struct mlx5_fpga_dma_buf *resp) | 174 | struct mlx5_fpga_dma_buf *resp) |
| 178 | { | 175 | { |
| 179 | struct mlx5_teardown_stream_context *ctx = | ||
| 180 | container_of(cmd, struct mlx5_teardown_stream_context, cmd); | ||
| 181 | |||
| 182 | if (resp) { | 176 | if (resp) { |
| 183 | u32 syndrome = MLX5_GET(tls_resp, resp->sg[0].data, syndrome); | 177 | u32 syndrome = MLX5_GET(tls_resp, resp->sg[0].data, syndrome); |
| 184 | 178 | ||
| @@ -186,14 +180,6 @@ mlx5_fpga_tls_teardown_completion(struct mlx5_fpga_conn *conn, | |||
| 186 | mlx5_fpga_err(fdev, | 180 | mlx5_fpga_err(fdev, |
| 187 | "Teardown stream failed with syndrome = %d", | 181 | "Teardown stream failed with syndrome = %d", |
| 188 | syndrome); | 182 | syndrome); |
| 189 | else if (MLX5_GET(tls_cmd, cmd->buf.sg[0].data, direction_sx)) | ||
| 190 | mlx5_fpga_tls_release_swid(&fdev->tls->tx_idr, | ||
| 191 | &fdev->tls->tx_idr_spinlock, | ||
| 192 | ctx->swid); | ||
| 193 | else | ||
| 194 | mlx5_fpga_tls_release_swid(&fdev->tls->rx_idr, | ||
| 195 | &fdev->tls->rx_idr_spinlock, | ||
| 196 | ctx->swid); | ||
| 197 | } | 183 | } |
| 198 | mlx5_fpga_tls_put_command_ctx(cmd); | 184 | mlx5_fpga_tls_put_command_ctx(cmd); |
| 199 | } | 185 | } |
| @@ -225,8 +211,14 @@ int mlx5_fpga_tls_resync_rx(struct mlx5_core_dev *mdev, u32 handle, u32 seq, | |||
| 225 | 211 | ||
| 226 | rcu_read_lock(); | 212 | rcu_read_lock(); |
| 227 | flow = idr_find(&mdev->fpga->tls->rx_idr, ntohl(handle)); | 213 | flow = idr_find(&mdev->fpga->tls->rx_idr, ntohl(handle)); |
| 228 | rcu_read_unlock(); | 214 | if (unlikely(!flow)) { |
| 215 | rcu_read_unlock(); | ||
| 216 | WARN_ONCE(1, "Received NULL pointer for handle\n"); | ||
| 217 | kfree(buf); | ||
| 218 | return -EINVAL; | ||
| 219 | } | ||
| 229 | mlx5_fpga_tls_flow_to_cmd(flow, cmd); | 220 | mlx5_fpga_tls_flow_to_cmd(flow, cmd); |
| 221 | rcu_read_unlock(); | ||
| 230 | 222 | ||
| 231 | MLX5_SET(tls_cmd, cmd, swid, ntohl(handle)); | 223 | MLX5_SET(tls_cmd, cmd, swid, ntohl(handle)); |
| 232 | MLX5_SET64(tls_cmd, cmd, tls_rcd_sn, be64_to_cpu(rcd_sn)); | 224 | MLX5_SET64(tls_cmd, cmd, tls_rcd_sn, be64_to_cpu(rcd_sn)); |
| @@ -238,6 +230,8 @@ int mlx5_fpga_tls_resync_rx(struct mlx5_core_dev *mdev, u32 handle, u32 seq, | |||
| 238 | buf->complete = mlx_tls_kfree_complete; | 230 | buf->complete = mlx_tls_kfree_complete; |
| 239 | 231 | ||
| 240 | ret = mlx5_fpga_sbu_conn_sendmsg(mdev->fpga->tls->conn, buf); | 232 | ret = mlx5_fpga_sbu_conn_sendmsg(mdev->fpga->tls->conn, buf); |
| 233 | if (ret < 0) | ||
| 234 | kfree(buf); | ||
| 241 | 235 | ||
| 242 | return ret; | 236 | return ret; |
| 243 | } | 237 | } |
| @@ -245,7 +239,7 @@ int mlx5_fpga_tls_resync_rx(struct mlx5_core_dev *mdev, u32 handle, u32 seq, | |||
| 245 | static void mlx5_fpga_tls_send_teardown_cmd(struct mlx5_core_dev *mdev, | 239 | static void mlx5_fpga_tls_send_teardown_cmd(struct mlx5_core_dev *mdev, |
| 246 | void *flow, u32 swid, gfp_t flags) | 240 | void *flow, u32 swid, gfp_t flags) |
| 247 | { | 241 | { |
| 248 | struct mlx5_teardown_stream_context *ctx; | 242 | struct mlx5_fpga_tls_command_context *ctx; |
| 249 | struct mlx5_fpga_dma_buf *buf; | 243 | struct mlx5_fpga_dma_buf *buf; |
| 250 | void *cmd; | 244 | void *cmd; |
| 251 | 245 | ||
| @@ -253,7 +247,7 @@ static void mlx5_fpga_tls_send_teardown_cmd(struct mlx5_core_dev *mdev, | |||
| 253 | if (!ctx) | 247 | if (!ctx) |
| 254 | return; | 248 | return; |
| 255 | 249 | ||
| 256 | buf = &ctx->cmd.buf; | 250 | buf = &ctx->buf; |
| 257 | cmd = (ctx + 1); | 251 | cmd = (ctx + 1); |
| 258 | MLX5_SET(tls_cmd, cmd, command_type, CMD_TEARDOWN_STREAM); | 252 | MLX5_SET(tls_cmd, cmd, command_type, CMD_TEARDOWN_STREAM); |
| 259 | MLX5_SET(tls_cmd, cmd, swid, swid); | 253 | MLX5_SET(tls_cmd, cmd, swid, swid); |
| @@ -264,8 +258,7 @@ static void mlx5_fpga_tls_send_teardown_cmd(struct mlx5_core_dev *mdev, | |||
| 264 | buf->sg[0].data = cmd; | 258 | buf->sg[0].data = cmd; |
| 265 | buf->sg[0].size = MLX5_TLS_COMMAND_SIZE; | 259 | buf->sg[0].size = MLX5_TLS_COMMAND_SIZE; |
| 266 | 260 | ||
| 267 | ctx->swid = swid; | 261 | mlx5_fpga_tls_cmd_send(mdev->fpga, ctx, |
| 268 | mlx5_fpga_tls_cmd_send(mdev->fpga, &ctx->cmd, | ||
| 269 | mlx5_fpga_tls_teardown_completion); | 262 | mlx5_fpga_tls_teardown_completion); |
| 270 | } | 263 | } |
| 271 | 264 | ||
| @@ -275,13 +268,14 @@ void mlx5_fpga_tls_del_flow(struct mlx5_core_dev *mdev, u32 swid, | |||
| 275 | struct mlx5_fpga_tls *tls = mdev->fpga->tls; | 268 | struct mlx5_fpga_tls *tls = mdev->fpga->tls; |
| 276 | void *flow; | 269 | void *flow; |
| 277 | 270 | ||
| 278 | rcu_read_lock(); | ||
| 279 | if (direction_sx) | 271 | if (direction_sx) |
| 280 | flow = idr_find(&tls->tx_idr, swid); | 272 | flow = mlx5_fpga_tls_release_swid(&tls->tx_idr, |
| 273 | &tls->tx_idr_spinlock, | ||
| 274 | swid); | ||
| 281 | else | 275 | else |
| 282 | flow = idr_find(&tls->rx_idr, swid); | 276 | flow = mlx5_fpga_tls_release_swid(&tls->rx_idr, |
| 283 | 277 | &tls->rx_idr_spinlock, | |
| 284 | rcu_read_unlock(); | 278 | swid); |
| 285 | 279 | ||
| 286 | if (!flow) { | 280 | if (!flow) { |
| 287 | mlx5_fpga_err(mdev->fpga, "No flow information for swid %u\n", | 281 | mlx5_fpga_err(mdev->fpga, "No flow information for swid %u\n", |
| @@ -289,6 +283,7 @@ void mlx5_fpga_tls_del_flow(struct mlx5_core_dev *mdev, u32 swid, | |||
| 289 | return; | 283 | return; |
| 290 | } | 284 | } |
| 291 | 285 | ||
| 286 | synchronize_rcu(); /* before kfree(flow) */ | ||
| 292 | mlx5_fpga_tls_send_teardown_cmd(mdev, flow, swid, flags); | 287 | mlx5_fpga_tls_send_teardown_cmd(mdev, flow, swid, flags); |
| 293 | } | 288 | } |
| 294 | 289 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 70cc906a102b..76716419370d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
| @@ -164,26 +164,6 @@ static struct mlx5_profile profile[] = { | |||
| 164 | .size = 8, | 164 | .size = 8, |
| 165 | .limit = 4 | 165 | .limit = 4 |
| 166 | }, | 166 | }, |
| 167 | .mr_cache[16] = { | ||
| 168 | .size = 8, | ||
| 169 | .limit = 4 | ||
| 170 | }, | ||
| 171 | .mr_cache[17] = { | ||
| 172 | .size = 8, | ||
| 173 | .limit = 4 | ||
| 174 | }, | ||
| 175 | .mr_cache[18] = { | ||
| 176 | .size = 8, | ||
| 177 | .limit = 4 | ||
| 178 | }, | ||
| 179 | .mr_cache[19] = { | ||
| 180 | .size = 4, | ||
| 181 | .limit = 2 | ||
| 182 | }, | ||
| 183 | .mr_cache[20] = { | ||
| 184 | .size = 4, | ||
| 185 | .limit = 2 | ||
| 186 | }, | ||
| 187 | }, | 167 | }, |
| 188 | }; | 168 | }; |
| 189 | 169 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c index 21b7f05b16a5..361468e0435d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c | |||
| @@ -317,10 +317,6 @@ int mlx5_query_module_eeprom(struct mlx5_core_dev *dev, | |||
| 317 | size -= offset + size - MLX5_EEPROM_PAGE_LENGTH; | 317 | size -= offset + size - MLX5_EEPROM_PAGE_LENGTH; |
| 318 | 318 | ||
| 319 | i2c_addr = MLX5_I2C_ADDR_LOW; | 319 | i2c_addr = MLX5_I2C_ADDR_LOW; |
| 320 | if (offset >= MLX5_EEPROM_PAGE_LENGTH) { | ||
| 321 | i2c_addr = MLX5_I2C_ADDR_HIGH; | ||
| 322 | offset -= MLX5_EEPROM_PAGE_LENGTH; | ||
| 323 | } | ||
| 324 | 320 | ||
| 325 | MLX5_SET(mcia_reg, in, l, 0); | 321 | MLX5_SET(mcia_reg, in, l, 0); |
| 326 | MLX5_SET(mcia_reg, in, module, module_num); | 322 | MLX5_SET(mcia_reg, in, module, module_num); |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index d23d53c0e284..f26a4ca29363 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c | |||
| @@ -568,7 +568,7 @@ static int mlxsw_emad_init(struct mlxsw_core *mlxsw_core) | |||
| 568 | if (!(mlxsw_core->bus->features & MLXSW_BUS_F_TXRX)) | 568 | if (!(mlxsw_core->bus->features & MLXSW_BUS_F_TXRX)) |
| 569 | return 0; | 569 | return 0; |
| 570 | 570 | ||
| 571 | emad_wq = alloc_workqueue("mlxsw_core_emad", WQ_MEM_RECLAIM, 0); | 571 | emad_wq = alloc_workqueue("mlxsw_core_emad", 0, 0); |
| 572 | if (!emad_wq) | 572 | if (!emad_wq) |
| 573 | return -ENOMEM; | 573 | return -ENOMEM; |
| 574 | mlxsw_core->emad_wq = emad_wq; | 574 | mlxsw_core->emad_wq = emad_wq; |
| @@ -1958,10 +1958,10 @@ static int __init mlxsw_core_module_init(void) | |||
| 1958 | { | 1958 | { |
| 1959 | int err; | 1959 | int err; |
| 1960 | 1960 | ||
| 1961 | mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, WQ_MEM_RECLAIM, 0); | 1961 | mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, 0, 0); |
| 1962 | if (!mlxsw_wq) | 1962 | if (!mlxsw_wq) |
| 1963 | return -ENOMEM; | 1963 | return -ENOMEM; |
| 1964 | mlxsw_owq = alloc_ordered_workqueue("%s_ordered", WQ_MEM_RECLAIM, | 1964 | mlxsw_owq = alloc_ordered_workqueue("%s_ordered", 0, |
| 1965 | mlxsw_core_driver_name); | 1965 | mlxsw_core_driver_name); |
| 1966 | if (!mlxsw_owq) { | 1966 | if (!mlxsw_owq) { |
| 1967 | err = -ENOMEM; | 1967 | err = -ENOMEM; |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h b/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h index ffee38e36ce8..8648ca171254 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h +++ b/drivers/net/ethernet/mellanox/mlxsw/pci_hw.h | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | #define MLXSW_PCI_SW_RESET 0xF0010 | 28 | #define MLXSW_PCI_SW_RESET 0xF0010 |
| 29 | #define MLXSW_PCI_SW_RESET_RST_BIT BIT(0) | 29 | #define MLXSW_PCI_SW_RESET_RST_BIT BIT(0) |
| 30 | #define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 13000 | 30 | #define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 20000 |
| 31 | #define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 | 31 | #define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 |
| 32 | #define MLXSW_PCI_FW_READY 0xA1844 | 32 | #define MLXSW_PCI_FW_READY 0xA1844 |
| 33 | #define MLXSW_PCI_FW_READY_MASK 0xFFFF | 33 | #define MLXSW_PCI_FW_READY_MASK 0xFFFF |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 9eb63300c1d3..6b8aa3761899 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |||
| @@ -3126,11 +3126,11 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev, | |||
| 3126 | if (err) | 3126 | if (err) |
| 3127 | return err; | 3127 | return err; |
| 3128 | 3128 | ||
| 3129 | mlxsw_sp_port->link.autoneg = autoneg; | ||
| 3130 | |||
| 3129 | if (!netif_running(dev)) | 3131 | if (!netif_running(dev)) |
| 3130 | return 0; | 3132 | return 0; |
| 3131 | 3133 | ||
| 3132 | mlxsw_sp_port->link.autoneg = autoneg; | ||
| 3133 | |||
| 3134 | mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); | 3134 | mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); |
| 3135 | mlxsw_sp_port_admin_status_set(mlxsw_sp_port, true); | 3135 | mlxsw_sp_port_admin_status_set(mlxsw_sp_port, true); |
| 3136 | 3136 | ||
| @@ -3316,7 +3316,7 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) | |||
| 3316 | err = mlxsw_sp_port_ets_set(mlxsw_sp_port, | 3316 | err = mlxsw_sp_port_ets_set(mlxsw_sp_port, |
| 3317 | MLXSW_REG_QEEC_HIERARCY_TC, | 3317 | MLXSW_REG_QEEC_HIERARCY_TC, |
| 3318 | i + 8, i, | 3318 | i + 8, i, |
| 3319 | false, 0); | 3319 | true, 100); |
| 3320 | if (err) | 3320 | if (err) |
| 3321 | return err; | 3321 | return err; |
| 3322 | } | 3322 | } |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c index 9a79b5e11597..d633bef5f105 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c | |||
| @@ -70,6 +70,7 @@ static const struct mlxsw_sp_sb_pool_des mlxsw_sp2_sb_pool_dess[] = { | |||
| 70 | {MLXSW_REG_SBXX_DIR_EGRESS, 1}, | 70 | {MLXSW_REG_SBXX_DIR_EGRESS, 1}, |
| 71 | {MLXSW_REG_SBXX_DIR_EGRESS, 2}, | 71 | {MLXSW_REG_SBXX_DIR_EGRESS, 2}, |
| 72 | {MLXSW_REG_SBXX_DIR_EGRESS, 3}, | 72 | {MLXSW_REG_SBXX_DIR_EGRESS, 3}, |
| 73 | {MLXSW_REG_SBXX_DIR_EGRESS, 15}, | ||
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 75 | #define MLXSW_SP_SB_ING_TC_COUNT 8 | 76 | #define MLXSW_SP_SB_ING_TC_COUNT 8 |
| @@ -428,6 +429,7 @@ static const struct mlxsw_sp_sb_pr mlxsw_sp2_sb_prs[] = { | |||
| 428 | MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0), | 429 | MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0), |
| 429 | MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0), | 430 | MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0), |
| 430 | MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0), | 431 | MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0), |
| 432 | MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, MLXSW_SP_SB_INFI), | ||
| 431 | }; | 433 | }; |
| 432 | 434 | ||
| 433 | static int mlxsw_sp_sb_prs_init(struct mlxsw_sp *mlxsw_sp, | 435 | static int mlxsw_sp_sb_prs_init(struct mlxsw_sp *mlxsw_sp, |
| @@ -517,14 +519,14 @@ static const struct mlxsw_sp_sb_cm mlxsw_sp2_sb_cms_egress[] = { | |||
| 517 | MLXSW_SP_SB_CM(0, 7, 4), | 519 | MLXSW_SP_SB_CM(0, 7, 4), |
| 518 | MLXSW_SP_SB_CM(0, 7, 4), | 520 | MLXSW_SP_SB_CM(0, 7, 4), |
| 519 | MLXSW_SP_SB_CM(0, 7, 4), | 521 | MLXSW_SP_SB_CM(0, 7, 4), |
| 520 | MLXSW_SP_SB_CM(0, 7, 4), | 522 | MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8), |
| 521 | MLXSW_SP_SB_CM(0, 7, 4), | 523 | MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8), |
| 522 | MLXSW_SP_SB_CM(0, 7, 4), | 524 | MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8), |
| 523 | MLXSW_SP_SB_CM(0, 7, 4), | 525 | MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8), |
| 524 | MLXSW_SP_SB_CM(0, 7, 4), | 526 | MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8), |
| 525 | MLXSW_SP_SB_CM(0, 7, 4), | 527 | MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8), |
| 526 | MLXSW_SP_SB_CM(0, 7, 4), | 528 | MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8), |
| 527 | MLXSW_SP_SB_CM(0, 7, 4), | 529 | MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8), |
| 528 | MLXSW_SP_SB_CM(1, 0xff, 4), | 530 | MLXSW_SP_SB_CM(1, 0xff, 4), |
| 529 | }; | 531 | }; |
| 530 | 532 | ||
| @@ -671,6 +673,7 @@ static const struct mlxsw_sp_sb_pm mlxsw_sp2_sb_pms[] = { | |||
| 671 | MLXSW_SP_SB_PM(0, 0), | 673 | MLXSW_SP_SB_PM(0, 0), |
| 672 | MLXSW_SP_SB_PM(0, 0), | 674 | MLXSW_SP_SB_PM(0, 0), |
| 673 | MLXSW_SP_SB_PM(0, 0), | 675 | MLXSW_SP_SB_PM(0, 0), |
| 676 | MLXSW_SP_SB_PM(10000, 90000), | ||
| 674 | }; | 677 | }; |
| 675 | 678 | ||
| 676 | static int mlxsw_sp_port_sb_pms_init(struct mlxsw_sp_port *mlxsw_sp_port) | 679 | static int mlxsw_sp_port_sb_pms_init(struct mlxsw_sp_port *mlxsw_sp_port) |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 52fed8c7bf1e..902e766a8ed3 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | |||
| @@ -6781,7 +6781,7 @@ static int mlxsw_sp_router_port_check_rif_addr(struct mlxsw_sp *mlxsw_sp, | |||
| 6781 | /* A RIF is not created for macvlan netdevs. Their MAC is used to | 6781 | /* A RIF is not created for macvlan netdevs. Their MAC is used to |
| 6782 | * populate the FDB | 6782 | * populate the FDB |
| 6783 | */ | 6783 | */ |
| 6784 | if (netif_is_macvlan(dev)) | 6784 | if (netif_is_macvlan(dev) || netif_is_l3_master(dev)) |
| 6785 | return 0; | 6785 | return 0; |
| 6786 | 6786 | ||
| 6787 | for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) { | 6787 | for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) { |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index f6ce386c3036..50111f228d77 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | |||
| @@ -1630,7 +1630,7 @@ static int mlxsw_sp_port_mdb_add(struct mlxsw_sp_port *mlxsw_sp_port, | |||
| 1630 | u16 fid_index; | 1630 | u16 fid_index; |
| 1631 | int err = 0; | 1631 | int err = 0; |
| 1632 | 1632 | ||
| 1633 | if (switchdev_trans_ph_prepare(trans)) | 1633 | if (switchdev_trans_ph_commit(trans)) |
| 1634 | return 0; | 1634 | return 0; |
| 1635 | 1635 | ||
| 1636 | bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); | 1636 | bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); |
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index a1d0d6e42533..d715ef4fc92f 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c | |||
| @@ -613,7 +613,7 @@ static int ocelot_mact_mc_add(struct ocelot_port *port, | |||
| 613 | struct netdev_hw_addr *hw_addr) | 613 | struct netdev_hw_addr *hw_addr) |
| 614 | { | 614 | { |
| 615 | struct ocelot *ocelot = port->ocelot; | 615 | struct ocelot *ocelot = port->ocelot; |
| 616 | struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_KERNEL); | 616 | struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_ATOMIC); |
| 617 | 617 | ||
| 618 | if (!ha) | 618 | if (!ha) |
| 619 | return -ENOMEM; | 619 | return -ENOMEM; |
| @@ -959,10 +959,8 @@ static void ocelot_get_strings(struct net_device *netdev, u32 sset, u8 *data) | |||
| 959 | ETH_GSTRING_LEN); | 959 | ETH_GSTRING_LEN); |
| 960 | } | 960 | } |
| 961 | 961 | ||
| 962 | static void ocelot_check_stats(struct work_struct *work) | 962 | static void ocelot_update_stats(struct ocelot *ocelot) |
| 963 | { | 963 | { |
| 964 | struct delayed_work *del_work = to_delayed_work(work); | ||
| 965 | struct ocelot *ocelot = container_of(del_work, struct ocelot, stats_work); | ||
| 966 | int i, j; | 964 | int i, j; |
| 967 | 965 | ||
| 968 | mutex_lock(&ocelot->stats_lock); | 966 | mutex_lock(&ocelot->stats_lock); |
| @@ -986,11 +984,19 @@ static void ocelot_check_stats(struct work_struct *work) | |||
| 986 | } | 984 | } |
| 987 | } | 985 | } |
| 988 | 986 | ||
| 989 | cancel_delayed_work(&ocelot->stats_work); | 987 | mutex_unlock(&ocelot->stats_lock); |
| 988 | } | ||
| 989 | |||
| 990 | static void ocelot_check_stats_work(struct work_struct *work) | ||
| 991 | { | ||
| 992 | struct delayed_work *del_work = to_delayed_work(work); | ||
| 993 | struct ocelot *ocelot = container_of(del_work, struct ocelot, | ||
| 994 | stats_work); | ||
| 995 | |||
| 996 | ocelot_update_stats(ocelot); | ||
| 997 | |||
| 990 | queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work, | 998 | queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work, |
| 991 | OCELOT_STATS_CHECK_DELAY); | 999 | OCELOT_STATS_CHECK_DELAY); |
| 992 | |||
| 993 | mutex_unlock(&ocelot->stats_lock); | ||
| 994 | } | 1000 | } |
| 995 | 1001 | ||
| 996 | static void ocelot_get_ethtool_stats(struct net_device *dev, | 1002 | static void ocelot_get_ethtool_stats(struct net_device *dev, |
| @@ -1001,7 +1007,7 @@ static void ocelot_get_ethtool_stats(struct net_device *dev, | |||
| 1001 | int i; | 1007 | int i; |
| 1002 | 1008 | ||
| 1003 | /* check and update now */ | 1009 | /* check and update now */ |
| 1004 | ocelot_check_stats(&ocelot->stats_work.work); | 1010 | ocelot_update_stats(ocelot); |
| 1005 | 1011 | ||
| 1006 | /* Copy all counters */ | 1012 | /* Copy all counters */ |
| 1007 | for (i = 0; i < ocelot->num_stats; i++) | 1013 | for (i = 0; i < ocelot->num_stats; i++) |
| @@ -1809,7 +1815,7 @@ int ocelot_init(struct ocelot *ocelot) | |||
| 1809 | ANA_CPUQ_8021_CFG_CPUQ_BPDU_VAL(6), | 1815 | ANA_CPUQ_8021_CFG_CPUQ_BPDU_VAL(6), |
| 1810 | ANA_CPUQ_8021_CFG, i); | 1816 | ANA_CPUQ_8021_CFG, i); |
| 1811 | 1817 | ||
| 1812 | INIT_DELAYED_WORK(&ocelot->stats_work, ocelot_check_stats); | 1818 | INIT_DELAYED_WORK(&ocelot->stats_work, ocelot_check_stats_work); |
| 1813 | queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work, | 1819 | queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work, |
| 1814 | OCELOT_STATS_CHECK_DELAY); | 1820 | OCELOT_STATS_CHECK_DELAY); |
| 1815 | return 0; | 1821 | return 0; |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.c b/drivers/net/ethernet/neterion/vxge/vxge-config.c index 7cde387e5ec6..51cd57ab3d95 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-config.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-config.c | |||
| @@ -2366,6 +2366,7 @@ static void *__vxge_hw_blockpool_malloc(struct __vxge_hw_device *devh, u32 size, | |||
| 2366 | dma_object->addr))) { | 2366 | dma_object->addr))) { |
| 2367 | vxge_os_dma_free(devh->pdev, memblock, | 2367 | vxge_os_dma_free(devh->pdev, memblock, |
| 2368 | &dma_object->acc_handle); | 2368 | &dma_object->acc_handle); |
| 2369 | memblock = NULL; | ||
| 2369 | goto exit; | 2370 | goto exit; |
| 2370 | } | 2371 | } |
| 2371 | 2372 | ||
diff --git a/drivers/net/ethernet/netronome/nfp/abm/cls.c b/drivers/net/ethernet/netronome/nfp/abm/cls.c index 9852080cf454..ff3913085665 100644 --- a/drivers/net/ethernet/netronome/nfp/abm/cls.c +++ b/drivers/net/ethernet/netronome/nfp/abm/cls.c | |||
| @@ -39,7 +39,7 @@ nfp_abm_u32_check_knode(struct nfp_abm *abm, struct tc_cls_u32_knode *knode, | |||
| 39 | } | 39 | } |
| 40 | if (knode->sel->off || knode->sel->offshift || knode->sel->offmask || | 40 | if (knode->sel->off || knode->sel->offshift || knode->sel->offmask || |
| 41 | knode->sel->offoff || knode->fshift) { | 41 | knode->sel->offoff || knode->fshift) { |
| 42 | NL_SET_ERR_MSG_MOD(extack, "variable offseting not supported"); | 42 | NL_SET_ERR_MSG_MOD(extack, "variable offsetting not supported"); |
| 43 | return false; | 43 | return false; |
| 44 | } | 44 | } |
| 45 | if (knode->sel->hoff || knode->sel->hmask) { | 45 | if (knode->sel->hoff || knode->sel->hmask) { |
| @@ -78,7 +78,7 @@ nfp_abm_u32_check_knode(struct nfp_abm *abm, struct tc_cls_u32_knode *knode, | |||
| 78 | 78 | ||
| 79 | k = &knode->sel->keys[0]; | 79 | k = &knode->sel->keys[0]; |
| 80 | if (k->offmask) { | 80 | if (k->offmask) { |
| 81 | NL_SET_ERR_MSG_MOD(extack, "offset mask - variable offseting not supported"); | 81 | NL_SET_ERR_MSG_MOD(extack, "offset mask - variable offsetting not supported"); |
| 82 | return false; | 82 | return false; |
| 83 | } | 83 | } |
| 84 | if (k->off) { | 84 | if (k->off) { |
diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c index eeda4ed98333..e336f6ee94f5 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/action.c +++ b/drivers/net/ethernet/netronome/nfp/flower/action.c | |||
| @@ -48,8 +48,7 @@ nfp_fl_push_vlan(struct nfp_fl_push_vlan *push_vlan, | |||
| 48 | 48 | ||
| 49 | tmp_push_vlan_tci = | 49 | tmp_push_vlan_tci = |
| 50 | FIELD_PREP(NFP_FL_PUSH_VLAN_PRIO, act->vlan.prio) | | 50 | FIELD_PREP(NFP_FL_PUSH_VLAN_PRIO, act->vlan.prio) | |
| 51 | FIELD_PREP(NFP_FL_PUSH_VLAN_VID, act->vlan.vid) | | 51 | FIELD_PREP(NFP_FL_PUSH_VLAN_VID, act->vlan.vid); |
| 52 | NFP_FL_PUSH_VLAN_CFI; | ||
| 53 | push_vlan->vlan_tci = cpu_to_be16(tmp_push_vlan_tci); | 52 | push_vlan->vlan_tci = cpu_to_be16(tmp_push_vlan_tci); |
| 54 | } | 53 | } |
| 55 | 54 | ||
diff --git a/drivers/net/ethernet/netronome/nfp/flower/cmsg.h b/drivers/net/ethernet/netronome/nfp/flower/cmsg.h index 4fcaf11ed56e..0ed51e79db00 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/cmsg.h +++ b/drivers/net/ethernet/netronome/nfp/flower/cmsg.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #define NFP_FLOWER_LAYER2_GENEVE_OP BIT(6) | 26 | #define NFP_FLOWER_LAYER2_GENEVE_OP BIT(6) |
| 27 | 27 | ||
| 28 | #define NFP_FLOWER_MASK_VLAN_PRIO GENMASK(15, 13) | 28 | #define NFP_FLOWER_MASK_VLAN_PRIO GENMASK(15, 13) |
| 29 | #define NFP_FLOWER_MASK_VLAN_CFI BIT(12) | 29 | #define NFP_FLOWER_MASK_VLAN_PRESENT BIT(12) |
| 30 | #define NFP_FLOWER_MASK_VLAN_VID GENMASK(11, 0) | 30 | #define NFP_FLOWER_MASK_VLAN_VID GENMASK(11, 0) |
| 31 | 31 | ||
| 32 | #define NFP_FLOWER_MASK_MPLS_LB GENMASK(31, 12) | 32 | #define NFP_FLOWER_MASK_MPLS_LB GENMASK(31, 12) |
| @@ -82,7 +82,6 @@ | |||
| 82 | #define NFP_FL_OUT_FLAGS_TYPE_IDX GENMASK(2, 0) | 82 | #define NFP_FL_OUT_FLAGS_TYPE_IDX GENMASK(2, 0) |
| 83 | 83 | ||
| 84 | #define NFP_FL_PUSH_VLAN_PRIO GENMASK(15, 13) | 84 | #define NFP_FL_PUSH_VLAN_PRIO GENMASK(15, 13) |
| 85 | #define NFP_FL_PUSH_VLAN_CFI BIT(12) | ||
| 86 | #define NFP_FL_PUSH_VLAN_VID GENMASK(11, 0) | 85 | #define NFP_FL_PUSH_VLAN_VID GENMASK(11, 0) |
| 87 | 86 | ||
| 88 | #define IPV6_FLOW_LABEL_MASK cpu_to_be32(0x000fffff) | 87 | #define IPV6_FLOW_LABEL_MASK cpu_to_be32(0x000fffff) |
diff --git a/drivers/net/ethernet/netronome/nfp/flower/match.c b/drivers/net/ethernet/netronome/nfp/flower/match.c index e03c8ef2c28c..9b8b843d0340 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/match.c +++ b/drivers/net/ethernet/netronome/nfp/flower/match.c | |||
| @@ -30,20 +30,19 @@ nfp_flower_compile_meta_tci(struct nfp_flower_meta_tci *ext, | |||
| 30 | 30 | ||
| 31 | flow_rule_match_vlan(rule, &match); | 31 | flow_rule_match_vlan(rule, &match); |
| 32 | /* Populate the tci field. */ | 32 | /* Populate the tci field. */ |
| 33 | if (match.key->vlan_id || match.key->vlan_priority) { | 33 | tmp_tci = NFP_FLOWER_MASK_VLAN_PRESENT; |
| 34 | tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO, | 34 | tmp_tci |= FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO, |
| 35 | match.key->vlan_priority) | | 35 | match.key->vlan_priority) | |
| 36 | FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID, | 36 | FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID, |
| 37 | match.key->vlan_id) | | 37 | match.key->vlan_id); |
| 38 | NFP_FLOWER_MASK_VLAN_CFI; | 38 | ext->tci = cpu_to_be16(tmp_tci); |
| 39 | ext->tci = cpu_to_be16(tmp_tci); | 39 | |
| 40 | tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO, | 40 | tmp_tci = NFP_FLOWER_MASK_VLAN_PRESENT; |
| 41 | match.mask->vlan_priority) | | 41 | tmp_tci |= FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO, |
| 42 | FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID, | 42 | match.mask->vlan_priority) | |
| 43 | match.mask->vlan_id) | | 43 | FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID, |
| 44 | NFP_FLOWER_MASK_VLAN_CFI; | 44 | match.mask->vlan_id); |
| 45 | msk->tci = cpu_to_be16(tmp_tci); | 45 | msk->tci = cpu_to_be16(tmp_tci); |
| 46 | } | ||
| 47 | } | 46 | } |
| 48 | } | 47 | } |
| 49 | 48 | ||
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index d2c803bb4e56..94d228c04496 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | |||
| @@ -195,7 +195,7 @@ static netdev_tx_t nfp_repr_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
| 195 | ret = dev_queue_xmit(skb); | 195 | ret = dev_queue_xmit(skb); |
| 196 | nfp_repr_inc_tx_stats(netdev, len, ret); | 196 | nfp_repr_inc_tx_stats(netdev, len, ret); |
| 197 | 197 | ||
| 198 | return ret; | 198 | return NETDEV_TX_OK; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | static int nfp_repr_stop(struct net_device *netdev) | 201 | static int nfp_repr_stop(struct net_device *netdev) |
| @@ -383,7 +383,7 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, | |||
| 383 | netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | 383 | netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); |
| 384 | netdev->gso_max_segs = NFP_NET_LSO_MAX_SEGS; | 384 | netdev->gso_max_segs = NFP_NET_LSO_MAX_SEGS; |
| 385 | 385 | ||
| 386 | netdev->priv_flags |= IFF_NO_QUEUE; | 386 | netdev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL; |
| 387 | netdev->features |= NETIF_F_LLTX; | 387 | netdev->features |= NETIF_F_LLTX; |
| 388 | 388 | ||
| 389 | if (nfp_app_has_tc(app)) { | 389 | if (nfp_app_has_tc(app)) { |
diff --git a/drivers/net/ethernet/qlogic/qed/qed.h b/drivers/net/ethernet/qlogic/qed/qed.h index 43a57ec296fd..127c89b22ef0 100644 --- a/drivers/net/ethernet/qlogic/qed/qed.h +++ b/drivers/net/ethernet/qlogic/qed/qed.h | |||
| @@ -431,12 +431,16 @@ struct qed_qm_info { | |||
| 431 | u8 num_pf_rls; | 431 | u8 num_pf_rls; |
| 432 | }; | 432 | }; |
| 433 | 433 | ||
| 434 | #define QED_OVERFLOW_BIT 1 | ||
| 435 | |||
| 434 | struct qed_db_recovery_info { | 436 | struct qed_db_recovery_info { |
| 435 | struct list_head list; | 437 | struct list_head list; |
| 436 | 438 | ||
| 437 | /* Lock to protect the doorbell recovery mechanism list */ | 439 | /* Lock to protect the doorbell recovery mechanism list */ |
| 438 | spinlock_t lock; | 440 | spinlock_t lock; |
| 441 | bool dorq_attn; | ||
| 439 | u32 db_recovery_counter; | 442 | u32 db_recovery_counter; |
| 443 | unsigned long overflow; | ||
| 440 | }; | 444 | }; |
| 441 | 445 | ||
| 442 | struct storm_stats { | 446 | struct storm_stats { |
| @@ -920,8 +924,7 @@ u16 qed_get_cm_pq_idx_llt_mtc(struct qed_hwfn *p_hwfn, u8 tc); | |||
| 920 | 924 | ||
| 921 | /* doorbell recovery mechanism */ | 925 | /* doorbell recovery mechanism */ |
| 922 | void qed_db_recovery_dp(struct qed_hwfn *p_hwfn); | 926 | void qed_db_recovery_dp(struct qed_hwfn *p_hwfn); |
| 923 | void qed_db_recovery_execute(struct qed_hwfn *p_hwfn, | 927 | void qed_db_recovery_execute(struct qed_hwfn *p_hwfn); |
| 924 | enum qed_db_rec_exec db_exec); | ||
| 925 | bool qed_edpm_enabled(struct qed_hwfn *p_hwfn); | 928 | bool qed_edpm_enabled(struct qed_hwfn *p_hwfn); |
| 926 | 929 | ||
| 927 | /* Other Linux specific common definitions */ | 930 | /* Other Linux specific common definitions */ |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c index 9df8c4b3b54e..866cdc86a3f2 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c | |||
| @@ -102,11 +102,15 @@ static void qed_db_recovery_dp_entry(struct qed_hwfn *p_hwfn, | |||
| 102 | 102 | ||
| 103 | /* Doorbell address sanity (address within doorbell bar range) */ | 103 | /* Doorbell address sanity (address within doorbell bar range) */ |
| 104 | static bool qed_db_rec_sanity(struct qed_dev *cdev, | 104 | static bool qed_db_rec_sanity(struct qed_dev *cdev, |
| 105 | void __iomem *db_addr, void *db_data) | 105 | void __iomem *db_addr, |
| 106 | enum qed_db_rec_width db_width, | ||
| 107 | void *db_data) | ||
| 106 | { | 108 | { |
| 109 | u32 width = (db_width == DB_REC_WIDTH_32B) ? 32 : 64; | ||
| 110 | |||
| 107 | /* Make sure doorbell address is within the doorbell bar */ | 111 | /* Make sure doorbell address is within the doorbell bar */ |
| 108 | if (db_addr < cdev->doorbells || | 112 | if (db_addr < cdev->doorbells || |
| 109 | (u8 __iomem *)db_addr > | 113 | (u8 __iomem *)db_addr + width > |
| 110 | (u8 __iomem *)cdev->doorbells + cdev->db_size) { | 114 | (u8 __iomem *)cdev->doorbells + cdev->db_size) { |
| 111 | WARN(true, | 115 | WARN(true, |
| 112 | "Illegal doorbell address: %p. Legal range for doorbell addresses is [%p..%p]\n", | 116 | "Illegal doorbell address: %p. Legal range for doorbell addresses is [%p..%p]\n", |
| @@ -159,7 +163,7 @@ int qed_db_recovery_add(struct qed_dev *cdev, | |||
| 159 | } | 163 | } |
| 160 | 164 | ||
| 161 | /* Sanitize doorbell address */ | 165 | /* Sanitize doorbell address */ |
| 162 | if (!qed_db_rec_sanity(cdev, db_addr, db_data)) | 166 | if (!qed_db_rec_sanity(cdev, db_addr, db_width, db_data)) |
| 163 | return -EINVAL; | 167 | return -EINVAL; |
| 164 | 168 | ||
| 165 | /* Obtain hwfn from doorbell address */ | 169 | /* Obtain hwfn from doorbell address */ |
| @@ -205,10 +209,6 @@ int qed_db_recovery_del(struct qed_dev *cdev, | |||
| 205 | return 0; | 209 | return 0; |
| 206 | } | 210 | } |
| 207 | 211 | ||
| 208 | /* Sanitize doorbell address */ | ||
| 209 | if (!qed_db_rec_sanity(cdev, db_addr, db_data)) | ||
| 210 | return -EINVAL; | ||
| 211 | |||
| 212 | /* Obtain hwfn from doorbell address */ | 212 | /* Obtain hwfn from doorbell address */ |
| 213 | p_hwfn = qed_db_rec_find_hwfn(cdev, db_addr); | 213 | p_hwfn = qed_db_rec_find_hwfn(cdev, db_addr); |
| 214 | 214 | ||
| @@ -300,31 +300,24 @@ void qed_db_recovery_dp(struct qed_hwfn *p_hwfn) | |||
| 300 | 300 | ||
| 301 | /* Ring the doorbell of a single doorbell recovery entry */ | 301 | /* Ring the doorbell of a single doorbell recovery entry */ |
| 302 | static void qed_db_recovery_ring(struct qed_hwfn *p_hwfn, | 302 | static void qed_db_recovery_ring(struct qed_hwfn *p_hwfn, |
| 303 | struct qed_db_recovery_entry *db_entry, | 303 | struct qed_db_recovery_entry *db_entry) |
| 304 | enum qed_db_rec_exec db_exec) | 304 | { |
| 305 | { | 305 | /* Print according to width */ |
| 306 | if (db_exec != DB_REC_ONCE) { | 306 | if (db_entry->db_width == DB_REC_WIDTH_32B) { |
| 307 | /* Print according to width */ | 307 | DP_VERBOSE(p_hwfn, QED_MSG_SPQ, |
| 308 | if (db_entry->db_width == DB_REC_WIDTH_32B) { | 308 | "ringing doorbell address %p data %x\n", |
| 309 | DP_VERBOSE(p_hwfn, QED_MSG_SPQ, | 309 | db_entry->db_addr, |
| 310 | "%s doorbell address %p data %x\n", | 310 | *(u32 *)db_entry->db_data); |
| 311 | db_exec == DB_REC_DRY_RUN ? | 311 | } else { |
| 312 | "would have rung" : "ringing", | 312 | DP_VERBOSE(p_hwfn, QED_MSG_SPQ, |
| 313 | db_entry->db_addr, | 313 | "ringing doorbell address %p data %llx\n", |
| 314 | *(u32 *)db_entry->db_data); | 314 | db_entry->db_addr, |
| 315 | } else { | 315 | *(u64 *)(db_entry->db_data)); |
| 316 | DP_VERBOSE(p_hwfn, QED_MSG_SPQ, | ||
| 317 | "%s doorbell address %p data %llx\n", | ||
| 318 | db_exec == DB_REC_DRY_RUN ? | ||
| 319 | "would have rung" : "ringing", | ||
| 320 | db_entry->db_addr, | ||
| 321 | *(u64 *)(db_entry->db_data)); | ||
| 322 | } | ||
| 323 | } | 316 | } |
| 324 | 317 | ||
| 325 | /* Sanity */ | 318 | /* Sanity */ |
| 326 | if (!qed_db_rec_sanity(p_hwfn->cdev, db_entry->db_addr, | 319 | if (!qed_db_rec_sanity(p_hwfn->cdev, db_entry->db_addr, |
| 327 | db_entry->db_data)) | 320 | db_entry->db_width, db_entry->db_data)) |
| 328 | return; | 321 | return; |
| 329 | 322 | ||
| 330 | /* Flush the write combined buffer. Since there are multiple doorbelling | 323 | /* Flush the write combined buffer. Since there are multiple doorbelling |
| @@ -334,14 +327,12 @@ static void qed_db_recovery_ring(struct qed_hwfn *p_hwfn, | |||
| 334 | wmb(); | 327 | wmb(); |
| 335 | 328 | ||
| 336 | /* Ring the doorbell */ | 329 | /* Ring the doorbell */ |
| 337 | if (db_exec == DB_REC_REAL_DEAL || db_exec == DB_REC_ONCE) { | 330 | if (db_entry->db_width == DB_REC_WIDTH_32B) |
| 338 | if (db_entry->db_width == DB_REC_WIDTH_32B) | 331 | DIRECT_REG_WR(db_entry->db_addr, |
| 339 | DIRECT_REG_WR(db_entry->db_addr, | 332 | *(u32 *)(db_entry->db_data)); |
| 340 | *(u32 *)(db_entry->db_data)); | 333 | else |
| 341 | else | 334 | DIRECT_REG_WR64(db_entry->db_addr, |
| 342 | DIRECT_REG_WR64(db_entry->db_addr, | 335 | *(u64 *)(db_entry->db_data)); |
| 343 | *(u64 *)(db_entry->db_data)); | ||
| 344 | } | ||
| 345 | 336 | ||
| 346 | /* Flush the write combined buffer. Next doorbell may come from a | 337 | /* Flush the write combined buffer. Next doorbell may come from a |
| 347 | * different entity to the same address... | 338 | * different entity to the same address... |
| @@ -350,29 +341,21 @@ static void qed_db_recovery_ring(struct qed_hwfn *p_hwfn, | |||
| 350 | } | 341 | } |
| 351 | 342 | ||
| 352 | /* Traverse the doorbell recovery entry list and ring all the doorbells */ | 343 | /* Traverse the doorbell recovery entry list and ring all the doorbells */ |
| 353 | void qed_db_recovery_execute(struct qed_hwfn *p_hwfn, | 344 | void qed_db_recovery_execute(struct qed_hwfn *p_hwfn) |
| 354 | enum qed_db_rec_exec db_exec) | ||
| 355 | { | 345 | { |
| 356 | struct qed_db_recovery_entry *db_entry = NULL; | 346 | struct qed_db_recovery_entry *db_entry = NULL; |
| 357 | 347 | ||
| 358 | if (db_exec != DB_REC_ONCE) { | 348 | DP_NOTICE(p_hwfn, "Executing doorbell recovery. Counter was %d\n", |
| 359 | DP_NOTICE(p_hwfn, | 349 | p_hwfn->db_recovery_info.db_recovery_counter); |
| 360 | "Executing doorbell recovery. Counter was %d\n", | ||
| 361 | p_hwfn->db_recovery_info.db_recovery_counter); | ||
| 362 | 350 | ||
| 363 | /* Track amount of times recovery was executed */ | 351 | /* Track amount of times recovery was executed */ |
| 364 | p_hwfn->db_recovery_info.db_recovery_counter++; | 352 | p_hwfn->db_recovery_info.db_recovery_counter++; |
| 365 | } | ||
| 366 | 353 | ||
| 367 | /* Protect the list */ | 354 | /* Protect the list */ |
| 368 | spin_lock_bh(&p_hwfn->db_recovery_info.lock); | 355 | spin_lock_bh(&p_hwfn->db_recovery_info.lock); |
| 369 | list_for_each_entry(db_entry, | 356 | list_for_each_entry(db_entry, |
| 370 | &p_hwfn->db_recovery_info.list, list_entry) { | 357 | &p_hwfn->db_recovery_info.list, list_entry) |
| 371 | qed_db_recovery_ring(p_hwfn, db_entry, db_exec); | 358 | qed_db_recovery_ring(p_hwfn, db_entry); |
| 372 | if (db_exec == DB_REC_ONCE) | ||
| 373 | break; | ||
| 374 | } | ||
| 375 | |||
| 376 | spin_unlock_bh(&p_hwfn->db_recovery_info.lock); | 359 | spin_unlock_bh(&p_hwfn->db_recovery_info.lock); |
| 377 | } | 360 | } |
| 378 | 361 | ||
diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c index e23980e301b6..8848d5bed6e5 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_int.c +++ b/drivers/net/ethernet/qlogic/qed/qed_int.c | |||
| @@ -378,6 +378,9 @@ static int qed_db_rec_flush_queue(struct qed_hwfn *p_hwfn, | |||
| 378 | u32 count = QED_DB_REC_COUNT; | 378 | u32 count = QED_DB_REC_COUNT; |
| 379 | u32 usage = 1; | 379 | u32 usage = 1; |
| 380 | 380 | ||
| 381 | /* Flush any pending (e)dpms as they may never arrive */ | ||
| 382 | qed_wr(p_hwfn, p_ptt, DORQ_REG_DPM_FORCE_ABORT, 0x1); | ||
| 383 | |||
| 381 | /* wait for usage to zero or count to run out. This is necessary since | 384 | /* wait for usage to zero or count to run out. This is necessary since |
| 382 | * EDPM doorbell transactions can take multiple 64b cycles, and as such | 385 | * EDPM doorbell transactions can take multiple 64b cycles, and as such |
| 383 | * can "split" over the pci. Possibly, the doorbell drop can happen with | 386 | * can "split" over the pci. Possibly, the doorbell drop can happen with |
| @@ -406,51 +409,74 @@ static int qed_db_rec_flush_queue(struct qed_hwfn *p_hwfn, | |||
| 406 | 409 | ||
| 407 | int qed_db_rec_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) | 410 | int qed_db_rec_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) |
| 408 | { | 411 | { |
| 409 | u32 overflow; | 412 | u32 attn_ovfl, cur_ovfl; |
| 410 | int rc; | 413 | int rc; |
| 411 | 414 | ||
| 412 | overflow = qed_rd(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY); | 415 | attn_ovfl = test_and_clear_bit(QED_OVERFLOW_BIT, |
| 413 | DP_NOTICE(p_hwfn, "PF Overflow sticky 0x%x\n", overflow); | 416 | &p_hwfn->db_recovery_info.overflow); |
| 414 | if (!overflow) { | 417 | cur_ovfl = qed_rd(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY); |
| 415 | qed_db_recovery_execute(p_hwfn, DB_REC_ONCE); | 418 | if (!cur_ovfl && !attn_ovfl) |
| 416 | return 0; | 419 | return 0; |
| 417 | } | ||
| 418 | 420 | ||
| 419 | if (qed_edpm_enabled(p_hwfn)) { | 421 | DP_NOTICE(p_hwfn, "PF Overflow sticky: attn %u current %u\n", |
| 422 | attn_ovfl, cur_ovfl); | ||
| 423 | |||
| 424 | if (cur_ovfl && !p_hwfn->db_bar_no_edpm) { | ||
| 420 | rc = qed_db_rec_flush_queue(p_hwfn, p_ptt); | 425 | rc = qed_db_rec_flush_queue(p_hwfn, p_ptt); |
| 421 | if (rc) | 426 | if (rc) |
| 422 | return rc; | 427 | return rc; |
| 423 | } | 428 | } |
| 424 | 429 | ||
| 425 | /* Flush any pending (e)dpm as they may never arrive */ | ||
| 426 | qed_wr(p_hwfn, p_ptt, DORQ_REG_DPM_FORCE_ABORT, 0x1); | ||
| 427 | |||
| 428 | /* Release overflow sticky indication (stop silently dropping everything) */ | 430 | /* Release overflow sticky indication (stop silently dropping everything) */ |
| 429 | qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY, 0x0); | 431 | qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY, 0x0); |
| 430 | 432 | ||
| 431 | /* Repeat all last doorbells (doorbell drop recovery) */ | 433 | /* Repeat all last doorbells (doorbell drop recovery) */ |
| 432 | qed_db_recovery_execute(p_hwfn, DB_REC_REAL_DEAL); | 434 | qed_db_recovery_execute(p_hwfn); |
| 433 | 435 | ||
| 434 | return 0; | 436 | return 0; |
| 435 | } | 437 | } |
| 436 | 438 | ||
| 437 | static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn) | 439 | static void qed_dorq_attn_overflow(struct qed_hwfn *p_hwfn) |
| 438 | { | 440 | { |
| 439 | u32 int_sts, first_drop_reason, details, address, all_drops_reason; | ||
| 440 | struct qed_ptt *p_ptt = p_hwfn->p_dpc_ptt; | 441 | struct qed_ptt *p_ptt = p_hwfn->p_dpc_ptt; |
| 442 | u32 overflow; | ||
| 441 | int rc; | 443 | int rc; |
| 442 | 444 | ||
| 443 | int_sts = qed_rd(p_hwfn, p_ptt, DORQ_REG_INT_STS); | 445 | overflow = qed_rd(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY); |
| 444 | DP_NOTICE(p_hwfn->cdev, "DORQ attention. int_sts was %x\n", int_sts); | 446 | if (!overflow) |
| 447 | goto out; | ||
| 448 | |||
| 449 | /* Run PF doorbell recovery in next periodic handler */ | ||
| 450 | set_bit(QED_OVERFLOW_BIT, &p_hwfn->db_recovery_info.overflow); | ||
| 451 | |||
| 452 | if (!p_hwfn->db_bar_no_edpm) { | ||
| 453 | rc = qed_db_rec_flush_queue(p_hwfn, p_ptt); | ||
| 454 | if (rc) | ||
| 455 | goto out; | ||
| 456 | } | ||
| 457 | |||
| 458 | qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY, 0x0); | ||
| 459 | out: | ||
| 460 | /* Schedule the handler even if overflow was not detected */ | ||
| 461 | qed_periodic_db_rec_start(p_hwfn); | ||
| 462 | } | ||
| 463 | |||
| 464 | static int qed_dorq_attn_int_sts(struct qed_hwfn *p_hwfn) | ||
| 465 | { | ||
| 466 | u32 int_sts, first_drop_reason, details, address, all_drops_reason; | ||
| 467 | struct qed_ptt *p_ptt = p_hwfn->p_dpc_ptt; | ||
| 445 | 468 | ||
| 446 | /* int_sts may be zero since all PFs were interrupted for doorbell | 469 | /* int_sts may be zero since all PFs were interrupted for doorbell |
| 447 | * overflow but another one already handled it. Can abort here. If | 470 | * overflow but another one already handled it. Can abort here. If |
| 448 | * This PF also requires overflow recovery we will be interrupted again. | 471 | * This PF also requires overflow recovery we will be interrupted again. |
| 449 | * The masked almost full indication may also be set. Ignoring. | 472 | * The masked almost full indication may also be set. Ignoring. |
| 450 | */ | 473 | */ |
| 474 | int_sts = qed_rd(p_hwfn, p_ptt, DORQ_REG_INT_STS); | ||
| 451 | if (!(int_sts & ~DORQ_REG_INT_STS_DORQ_FIFO_AFULL)) | 475 | if (!(int_sts & ~DORQ_REG_INT_STS_DORQ_FIFO_AFULL)) |
| 452 | return 0; | 476 | return 0; |
| 453 | 477 | ||
| 478 | DP_NOTICE(p_hwfn->cdev, "DORQ attention. int_sts was %x\n", int_sts); | ||
| 479 | |||
| 454 | /* check if db_drop or overflow happened */ | 480 | /* check if db_drop or overflow happened */ |
| 455 | if (int_sts & (DORQ_REG_INT_STS_DB_DROP | | 481 | if (int_sts & (DORQ_REG_INT_STS_DB_DROP | |
| 456 | DORQ_REG_INT_STS_DORQ_FIFO_OVFL_ERR)) { | 482 | DORQ_REG_INT_STS_DORQ_FIFO_OVFL_ERR)) { |
| @@ -477,11 +503,6 @@ static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn) | |||
| 477 | GET_FIELD(details, QED_DORQ_ATTENTION_SIZE) * 4, | 503 | GET_FIELD(details, QED_DORQ_ATTENTION_SIZE) * 4, |
| 478 | first_drop_reason, all_drops_reason); | 504 | first_drop_reason, all_drops_reason); |
| 479 | 505 | ||
| 480 | rc = qed_db_rec_handler(p_hwfn, p_ptt); | ||
| 481 | qed_periodic_db_rec_start(p_hwfn); | ||
| 482 | if (rc) | ||
| 483 | return rc; | ||
| 484 | |||
| 485 | /* Clear the doorbell drop details and prepare for next drop */ | 506 | /* Clear the doorbell drop details and prepare for next drop */ |
| 486 | qed_wr(p_hwfn, p_ptt, DORQ_REG_DB_DROP_DETAILS_REL, 0); | 507 | qed_wr(p_hwfn, p_ptt, DORQ_REG_DB_DROP_DETAILS_REL, 0); |
| 487 | 508 | ||
| @@ -507,6 +528,25 @@ static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn) | |||
| 507 | return -EINVAL; | 528 | return -EINVAL; |
| 508 | } | 529 | } |
| 509 | 530 | ||
| 531 | static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn) | ||
| 532 | { | ||
| 533 | p_hwfn->db_recovery_info.dorq_attn = true; | ||
| 534 | qed_dorq_attn_overflow(p_hwfn); | ||
| 535 | |||
| 536 | return qed_dorq_attn_int_sts(p_hwfn); | ||
| 537 | } | ||
| 538 | |||
| 539 | static void qed_dorq_attn_handler(struct qed_hwfn *p_hwfn) | ||
| 540 | { | ||
| 541 | if (p_hwfn->db_recovery_info.dorq_attn) | ||
| 542 | goto out; | ||
| 543 | |||
| 544 | /* Call DORQ callback if the attention was missed */ | ||
| 545 | qed_dorq_attn_cb(p_hwfn); | ||
| 546 | out: | ||
| 547 | p_hwfn->db_recovery_info.dorq_attn = false; | ||
| 548 | } | ||
| 549 | |||
| 510 | /* Instead of major changes to the data-structure, we have a some 'special' | 550 | /* Instead of major changes to the data-structure, we have a some 'special' |
| 511 | * identifiers for sources that changed meaning between adapters. | 551 | * identifiers for sources that changed meaning between adapters. |
| 512 | */ | 552 | */ |
| @@ -1080,6 +1120,9 @@ static int qed_int_deassertion(struct qed_hwfn *p_hwfn, | |||
| 1080 | } | 1120 | } |
| 1081 | } | 1121 | } |
| 1082 | 1122 | ||
| 1123 | /* Handle missed DORQ attention */ | ||
| 1124 | qed_dorq_attn_handler(p_hwfn); | ||
| 1125 | |||
| 1083 | /* Clear IGU indication for the deasserted bits */ | 1126 | /* Clear IGU indication for the deasserted bits */ |
| 1084 | DIRECT_REG_WR((u8 __iomem *)p_hwfn->regview + | 1127 | DIRECT_REG_WR((u8 __iomem *)p_hwfn->regview + |
| 1085 | GTT_BAR0_MAP_REG_IGU_CMD + | 1128 | GTT_BAR0_MAP_REG_IGU_CMD + |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.h b/drivers/net/ethernet/qlogic/qed/qed_int.h index 1f356ed4f761..d473b522afc5 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_int.h +++ b/drivers/net/ethernet/qlogic/qed/qed_int.h | |||
| @@ -192,8 +192,8 @@ void qed_int_disable_post_isr_release(struct qed_dev *cdev); | |||
| 192 | 192 | ||
| 193 | /** | 193 | /** |
| 194 | * @brief - Doorbell Recovery handler. | 194 | * @brief - Doorbell Recovery handler. |
| 195 | * Run DB_REAL_DEAL doorbell recovery in case of PF overflow | 195 | * Run doorbell recovery in case of PF overflow (and flush DORQ if |
| 196 | * (and flush DORQ if needed), otherwise run DB_REC_ONCE. | 196 | * needed). |
| 197 | * | 197 | * |
| 198 | * @param p_hwfn | 198 | * @param p_hwfn |
| 199 | * @param p_ptt | 199 | * @param p_ptt |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c index f164d4acebcb..6de23b56b294 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_main.c +++ b/drivers/net/ethernet/qlogic/qed/qed_main.c | |||
| @@ -970,7 +970,7 @@ static void qed_update_pf_params(struct qed_dev *cdev, | |||
| 970 | } | 970 | } |
| 971 | } | 971 | } |
| 972 | 972 | ||
| 973 | #define QED_PERIODIC_DB_REC_COUNT 100 | 973 | #define QED_PERIODIC_DB_REC_COUNT 10 |
| 974 | #define QED_PERIODIC_DB_REC_INTERVAL_MS 100 | 974 | #define QED_PERIODIC_DB_REC_INTERVAL_MS 100 |
| 975 | #define QED_PERIODIC_DB_REC_INTERVAL \ | 975 | #define QED_PERIODIC_DB_REC_INTERVAL \ |
| 976 | msecs_to_jiffies(QED_PERIODIC_DB_REC_INTERVAL_MS) | 976 | msecs_to_jiffies(QED_PERIODIC_DB_REC_INTERVAL_MS) |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c index 9faaa6df78ed..2f318aaf2b05 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c +++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c | |||
| @@ -1591,7 +1591,7 @@ static void qed_iov_vf_mbx_acquire(struct qed_hwfn *p_hwfn, | |||
| 1591 | p_vfdev->eth_fp_hsi_minor = ETH_HSI_VER_NO_PKT_LEN_TUNN; | 1591 | p_vfdev->eth_fp_hsi_minor = ETH_HSI_VER_NO_PKT_LEN_TUNN; |
| 1592 | } else { | 1592 | } else { |
| 1593 | DP_INFO(p_hwfn, | 1593 | DP_INFO(p_hwfn, |
| 1594 | "VF[%d] needs fastpath HSI %02x.%02x, which is incompatible with loaded FW's faspath HSI %02x.%02x\n", | 1594 | "VF[%d] needs fastpath HSI %02x.%02x, which is incompatible with loaded FW's fastpath HSI %02x.%02x\n", |
| 1595 | vf->abs_vf_id, | 1595 | vf->abs_vf_id, |
| 1596 | req->vfdev_info.eth_fp_hsi_major, | 1596 | req->vfdev_info.eth_fp_hsi_major, |
| 1597 | req->vfdev_info.eth_fp_hsi_minor, | 1597 | req->vfdev_info.eth_fp_hsi_minor, |
diff --git a/drivers/net/ethernet/qlogic/qede/qede_ptp.c b/drivers/net/ethernet/qlogic/qede/qede_ptp.c index 5f3f42a25361..bddb2b5982dc 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ptp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ptp.c | |||
| @@ -490,18 +490,17 @@ int qede_ptp_enable(struct qede_dev *edev, bool init_tc) | |||
| 490 | 490 | ||
| 491 | ptp->clock = ptp_clock_register(&ptp->clock_info, &edev->pdev->dev); | 491 | ptp->clock = ptp_clock_register(&ptp->clock_info, &edev->pdev->dev); |
| 492 | if (IS_ERR(ptp->clock)) { | 492 | if (IS_ERR(ptp->clock)) { |
| 493 | rc = -EINVAL; | ||
| 494 | DP_ERR(edev, "PTP clock registration failed\n"); | 493 | DP_ERR(edev, "PTP clock registration failed\n"); |
| 494 | qede_ptp_disable(edev); | ||
| 495 | rc = -EINVAL; | ||
| 495 | goto err2; | 496 | goto err2; |
| 496 | } | 497 | } |
| 497 | 498 | ||
| 498 | return 0; | 499 | return 0; |
| 499 | 500 | ||
| 500 | err2: | ||
| 501 | qede_ptp_disable(edev); | ||
| 502 | ptp->clock = NULL; | ||
| 503 | err1: | 501 | err1: |
| 504 | kfree(ptp); | 502 | kfree(ptp); |
| 503 | err2: | ||
| 505 | edev->ptp = NULL; | 504 | edev->ptp = NULL; |
| 506 | 505 | ||
| 507 | return rc; | 506 | return rc; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 0c443ea98479..374a4d4371f9 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
| @@ -497,7 +497,7 @@ struct qlcnic_hardware_context { | |||
| 497 | u16 board_type; | 497 | u16 board_type; |
| 498 | u16 supported_type; | 498 | u16 supported_type; |
| 499 | 499 | ||
| 500 | u16 link_speed; | 500 | u32 link_speed; |
| 501 | u16 link_duplex; | 501 | u16 link_duplex; |
| 502 | u16 link_autoneg; | 502 | u16 link_autoneg; |
| 503 | u16 module_type; | 503 | u16 module_type; |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 7562ccbbb39a..ed651dde6ef9 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/pm_runtime.h> | 28 | #include <linux/pm_runtime.h> |
| 29 | #include <linux/firmware.h> | 29 | #include <linux/firmware.h> |
| 30 | #include <linux/prefetch.h> | 30 | #include <linux/prefetch.h> |
| 31 | #include <linux/pci-aspm.h> | ||
| 31 | #include <linux/ipv6.h> | 32 | #include <linux/ipv6.h> |
| 32 | #include <net/ip6_checksum.h> | 33 | #include <net/ip6_checksum.h> |
| 33 | 34 | ||
| @@ -5460,7 +5461,7 @@ static void rtl_hw_start_8168(struct rtl8169_private *tp) | |||
| 5460 | tp->cp_cmd |= PktCntrDisable | INTT_1; | 5461 | tp->cp_cmd |= PktCntrDisable | INTT_1; |
| 5461 | RTL_W16(tp, CPlusCmd, tp->cp_cmd); | 5462 | RTL_W16(tp, CPlusCmd, tp->cp_cmd); |
| 5462 | 5463 | ||
| 5463 | RTL_W16(tp, IntrMitigate, 0x5151); | 5464 | RTL_W16(tp, IntrMitigate, 0x5100); |
| 5464 | 5465 | ||
| 5465 | /* Work around for RxFIFO overflow. */ | 5466 | /* Work around for RxFIFO overflow. */ |
| 5466 | if (tp->mac_version == RTL_GIGA_MAC_VER_11) { | 5467 | if (tp->mac_version == RTL_GIGA_MAC_VER_11) { |
| @@ -7352,6 +7353,11 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 7352 | if (rc) | 7353 | if (rc) |
| 7353 | return rc; | 7354 | return rc; |
| 7354 | 7355 | ||
| 7356 | /* Disable ASPM completely as that cause random device stop working | ||
| 7357 | * problems as well as full system hangs for some PCIe devices users. | ||
| 7358 | */ | ||
| 7359 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); | ||
| 7360 | |||
| 7355 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ | 7361 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ |
| 7356 | rc = pcim_enable_device(pdev); | 7362 | rc = pcim_enable_device(pdev); |
| 7357 | if (rc < 0) { | 7363 | if (rc < 0) { |
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index a18149720aa2..cba5881b2746 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c | |||
| @@ -673,7 +673,8 @@ static void netsec_process_tx(struct netsec_priv *priv) | |||
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | static void *netsec_alloc_rx_data(struct netsec_priv *priv, | 675 | static void *netsec_alloc_rx_data(struct netsec_priv *priv, |
| 676 | dma_addr_t *dma_handle, u16 *desc_len) | 676 | dma_addr_t *dma_handle, u16 *desc_len, |
| 677 | bool napi) | ||
| 677 | { | 678 | { |
| 678 | size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | 679 | size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); |
| 679 | size_t payload_len = NETSEC_RX_BUF_SZ; | 680 | size_t payload_len = NETSEC_RX_BUF_SZ; |
| @@ -682,7 +683,7 @@ static void *netsec_alloc_rx_data(struct netsec_priv *priv, | |||
| 682 | 683 | ||
| 683 | total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD); | 684 | total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD); |
| 684 | 685 | ||
| 685 | buf = napi_alloc_frag(total_len); | 686 | buf = napi ? napi_alloc_frag(total_len) : netdev_alloc_frag(total_len); |
| 686 | if (!buf) | 687 | if (!buf) |
| 687 | return NULL; | 688 | return NULL; |
| 688 | 689 | ||
| @@ -765,7 +766,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) | |||
| 765 | /* allocate a fresh buffer and map it to the hardware. | 766 | /* allocate a fresh buffer and map it to the hardware. |
| 766 | * This will eventually replace the old buffer in the hardware | 767 | * This will eventually replace the old buffer in the hardware |
| 767 | */ | 768 | */ |
| 768 | buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len); | 769 | buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len, |
| 770 | true); | ||
| 769 | if (unlikely(!buf_addr)) | 771 | if (unlikely(!buf_addr)) |
| 770 | break; | 772 | break; |
| 771 | 773 | ||
| @@ -1069,7 +1071,8 @@ static int netsec_setup_rx_dring(struct netsec_priv *priv) | |||
| 1069 | void *buf; | 1071 | void *buf; |
| 1070 | u16 len; | 1072 | u16 len; |
| 1071 | 1073 | ||
| 1072 | buf = netsec_alloc_rx_data(priv, &dma_handle, &len); | 1074 | buf = netsec_alloc_rx_data(priv, &dma_handle, &len, |
| 1075 | false); | ||
| 1073 | if (!buf) { | 1076 | if (!buf) { |
| 1074 | netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); | 1077 | netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); |
| 1075 | goto err_out; | 1078 | goto err_out; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h index 40d6356a7e73..3dfb07a78952 100644 --- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h +++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h | |||
| @@ -29,11 +29,13 @@ | |||
| 29 | /* Specific functions used for Ring mode */ | 29 | /* Specific functions used for Ring mode */ |
| 30 | 30 | ||
| 31 | /* Enhanced descriptors */ | 31 | /* Enhanced descriptors */ |
| 32 | static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end) | 32 | static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end, |
| 33 | int bfsize) | ||
| 33 | { | 34 | { |
| 34 | p->des1 |= cpu_to_le32((BUF_SIZE_8KiB | 35 | if (bfsize == BUF_SIZE_16KiB) |
| 35 | << ERDES1_BUFFER2_SIZE_SHIFT) | 36 | p->des1 |= cpu_to_le32((BUF_SIZE_8KiB |
| 36 | & ERDES1_BUFFER2_SIZE_MASK); | 37 | << ERDES1_BUFFER2_SIZE_SHIFT) |
| 38 | & ERDES1_BUFFER2_SIZE_MASK); | ||
| 37 | 39 | ||
| 38 | if (end) | 40 | if (end) |
| 39 | p->des1 |= cpu_to_le32(ERDES1_END_RING); | 41 | p->des1 |= cpu_to_le32(ERDES1_END_RING); |
| @@ -59,11 +61,15 @@ static inline void enh_set_tx_desc_len_on_ring(struct dma_desc *p, int len) | |||
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | /* Normal descriptors */ | 63 | /* Normal descriptors */ |
| 62 | static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end) | 64 | static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end, int bfsize) |
| 63 | { | 65 | { |
| 64 | p->des1 |= cpu_to_le32(((BUF_SIZE_2KiB - 1) | 66 | if (bfsize >= BUF_SIZE_2KiB) { |
| 65 | << RDES1_BUFFER2_SIZE_SHIFT) | 67 | int bfsize2; |
| 66 | & RDES1_BUFFER2_SIZE_MASK); | 68 | |
| 69 | bfsize2 = min(bfsize - BUF_SIZE_2KiB + 1, BUF_SIZE_2KiB - 1); | ||
| 70 | p->des1 |= cpu_to_le32((bfsize2 << RDES1_BUFFER2_SIZE_SHIFT) | ||
| 71 | & RDES1_BUFFER2_SIZE_MASK); | ||
| 72 | } | ||
| 67 | 73 | ||
| 68 | if (end) | 74 | if (end) |
| 69 | p->des1 |= cpu_to_le32(RDES1_END_RING); | 75 | p->des1 |= cpu_to_le32(RDES1_END_RING); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c index 062a600fa5a7..21428537e231 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c | |||
| @@ -333,6 +333,9 @@ static int stm32mp1_parse_data(struct stm32_dwmac *dwmac, | |||
| 333 | */ | 333 | */ |
| 334 | dwmac->irq_pwr_wakeup = platform_get_irq_byname(pdev, | 334 | dwmac->irq_pwr_wakeup = platform_get_irq_byname(pdev, |
| 335 | "stm32_pwr_wakeup"); | 335 | "stm32_pwr_wakeup"); |
| 336 | if (dwmac->irq_pwr_wakeup == -EPROBE_DEFER) | ||
| 337 | return -EPROBE_DEFER; | ||
| 338 | |||
| 336 | if (!dwmac->clk_eth_ck && dwmac->irq_pwr_wakeup >= 0) { | 339 | if (!dwmac->clk_eth_ck && dwmac->irq_pwr_wakeup >= 0) { |
| 337 | err = device_init_wakeup(&pdev->dev, true); | 340 | err = device_init_wakeup(&pdev->dev, true); |
| 338 | if (err) { | 341 | if (err) { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c index 7fbb6a4dbf51..e061e9f5fad7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | |||
| @@ -296,7 +296,7 @@ exit: | |||
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, | 298 | static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, |
| 299 | int mode, int end) | 299 | int mode, int end, int bfsize) |
| 300 | { | 300 | { |
| 301 | dwmac4_set_rx_owner(p, disable_rx_ic); | 301 | dwmac4_set_rx_owner(p, disable_rx_ic); |
| 302 | } | 302 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c index 1d858fdec997..98fa471da7c0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | |||
| @@ -123,7 +123,7 @@ static int dwxgmac2_get_rx_timestamp_status(void *desc, void *next_desc, | |||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static void dwxgmac2_init_rx_desc(struct dma_desc *p, int disable_rx_ic, | 125 | static void dwxgmac2_init_rx_desc(struct dma_desc *p, int disable_rx_ic, |
| 126 | int mode, int end) | 126 | int mode, int end, int bfsize) |
| 127 | { | 127 | { |
| 128 | dwxgmac2_set_rx_owner(p, disable_rx_ic); | 128 | dwxgmac2_set_rx_owner(p, disable_rx_ic); |
| 129 | } | 129 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c index 5ef91a790f9d..5202d6ad7919 100644 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c | |||
| @@ -201,6 +201,11 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, | |||
| 201 | if (unlikely(rdes0 & RDES0_OWN)) | 201 | if (unlikely(rdes0 & RDES0_OWN)) |
| 202 | return dma_own; | 202 | return dma_own; |
| 203 | 203 | ||
| 204 | if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { | ||
| 205 | stats->rx_length_errors++; | ||
| 206 | return discard_frame; | ||
| 207 | } | ||
| 208 | |||
| 204 | if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) { | 209 | if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) { |
| 205 | if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR)) { | 210 | if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR)) { |
| 206 | x->rx_desc++; | 211 | x->rx_desc++; |
| @@ -231,9 +236,10 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, | |||
| 231 | * It doesn't match with the information reported into the databook. | 236 | * It doesn't match with the information reported into the databook. |
| 232 | * At any rate, we need to understand if the CSUM hw computation is ok | 237 | * At any rate, we need to understand if the CSUM hw computation is ok |
| 233 | * and report this info to the upper layers. */ | 238 | * and report this info to the upper layers. */ |
| 234 | ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), | 239 | if (likely(ret == good_frame)) |
| 235 | !!(rdes0 & RDES0_FRAME_TYPE), | 240 | ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR), |
| 236 | !!(rdes0 & ERDES0_RX_MAC_ADDR)); | 241 | !!(rdes0 & RDES0_FRAME_TYPE), |
| 242 | !!(rdes0 & ERDES0_RX_MAC_ADDR)); | ||
| 237 | 243 | ||
| 238 | if (unlikely(rdes0 & RDES0_DRIBBLING)) | 244 | if (unlikely(rdes0 & RDES0_DRIBBLING)) |
| 239 | x->dribbling_bit++; | 245 | x->dribbling_bit++; |
| @@ -259,15 +265,19 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, | |||
| 259 | } | 265 | } |
| 260 | 266 | ||
| 261 | static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, | 267 | static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, |
| 262 | int mode, int end) | 268 | int mode, int end, int bfsize) |
| 263 | { | 269 | { |
| 270 | int bfsize1; | ||
| 271 | |||
| 264 | p->des0 |= cpu_to_le32(RDES0_OWN); | 272 | p->des0 |= cpu_to_le32(RDES0_OWN); |
| 265 | p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK); | 273 | |
| 274 | bfsize1 = min(bfsize, BUF_SIZE_8KiB); | ||
| 275 | p->des1 |= cpu_to_le32(bfsize1 & ERDES1_BUFFER1_SIZE_MASK); | ||
| 266 | 276 | ||
| 267 | if (mode == STMMAC_CHAIN_MODE) | 277 | if (mode == STMMAC_CHAIN_MODE) |
| 268 | ehn_desc_rx_set_on_chain(p); | 278 | ehn_desc_rx_set_on_chain(p); |
| 269 | else | 279 | else |
| 270 | ehn_desc_rx_set_on_ring(p, end); | 280 | ehn_desc_rx_set_on_ring(p, end, bfsize); |
| 271 | 281 | ||
| 272 | if (disable_rx_ic) | 282 | if (disable_rx_ic) |
| 273 | p->des1 |= cpu_to_le32(ERDES1_DISABLE_IC); | 283 | p->des1 |= cpu_to_le32(ERDES1_DISABLE_IC); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 92b8944f26e3..5bb00234d961 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h | |||
| @@ -33,7 +33,7 @@ struct dma_extended_desc; | |||
| 33 | struct stmmac_desc_ops { | 33 | struct stmmac_desc_ops { |
| 34 | /* DMA RX descriptor ring initialization */ | 34 | /* DMA RX descriptor ring initialization */ |
| 35 | void (*init_rx_desc)(struct dma_desc *p, int disable_rx_ic, int mode, | 35 | void (*init_rx_desc)(struct dma_desc *p, int disable_rx_ic, int mode, |
| 36 | int end); | 36 | int end, int bfsize); |
| 37 | /* DMA TX descriptor ring initialization */ | 37 | /* DMA TX descriptor ring initialization */ |
| 38 | void (*init_tx_desc)(struct dma_desc *p, int mode, int end); | 38 | void (*init_tx_desc)(struct dma_desc *p, int mode, int end); |
| 39 | /* Invoked by the xmit function to prepare the tx descriptor */ | 39 | /* Invoked by the xmit function to prepare the tx descriptor */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c index de65bb29feba..6d690678c20e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c | |||
| @@ -91,8 +91,6 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, | |||
| 91 | return dma_own; | 91 | return dma_own; |
| 92 | 92 | ||
| 93 | if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { | 93 | if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) { |
| 94 | pr_warn("%s: Oversized frame spanned multiple buffers\n", | ||
| 95 | __func__); | ||
| 96 | stats->rx_length_errors++; | 94 | stats->rx_length_errors++; |
| 97 | return discard_frame; | 95 | return discard_frame; |
| 98 | } | 96 | } |
| @@ -135,15 +133,19 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, | |||
| 135 | } | 133 | } |
| 136 | 134 | ||
| 137 | static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, | 135 | static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, |
| 138 | int end) | 136 | int end, int bfsize) |
| 139 | { | 137 | { |
| 138 | int bfsize1; | ||
| 139 | |||
| 140 | p->des0 |= cpu_to_le32(RDES0_OWN); | 140 | p->des0 |= cpu_to_le32(RDES0_OWN); |
| 141 | p->des1 |= cpu_to_le32((BUF_SIZE_2KiB - 1) & RDES1_BUFFER1_SIZE_MASK); | 141 | |
| 142 | bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1); | ||
| 143 | p->des1 |= cpu_to_le32(bfsize1 & RDES1_BUFFER1_SIZE_MASK); | ||
| 142 | 144 | ||
| 143 | if (mode == STMMAC_CHAIN_MODE) | 145 | if (mode == STMMAC_CHAIN_MODE) |
| 144 | ndesc_rx_set_on_chain(p, end); | 146 | ndesc_rx_set_on_chain(p, end); |
| 145 | else | 147 | else |
| 146 | ndesc_rx_set_on_ring(p, end); | 148 | ndesc_rx_set_on_ring(p, end, bfsize); |
| 147 | 149 | ||
| 148 | if (disable_rx_ic) | 150 | if (disable_rx_ic) |
| 149 | p->des1 |= cpu_to_le32(RDES1_DISABLE_IC); | 151 | p->des1 |= cpu_to_le32(RDES1_DISABLE_IC); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6a2e1031a62a..48712437d0da 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -1136,11 +1136,13 @@ static void stmmac_clear_rx_descriptors(struct stmmac_priv *priv, u32 queue) | |||
| 1136 | if (priv->extend_desc) | 1136 | if (priv->extend_desc) |
| 1137 | stmmac_init_rx_desc(priv, &rx_q->dma_erx[i].basic, | 1137 | stmmac_init_rx_desc(priv, &rx_q->dma_erx[i].basic, |
| 1138 | priv->use_riwt, priv->mode, | 1138 | priv->use_riwt, priv->mode, |
| 1139 | (i == DMA_RX_SIZE - 1)); | 1139 | (i == DMA_RX_SIZE - 1), |
| 1140 | priv->dma_buf_sz); | ||
| 1140 | else | 1141 | else |
| 1141 | stmmac_init_rx_desc(priv, &rx_q->dma_rx[i], | 1142 | stmmac_init_rx_desc(priv, &rx_q->dma_rx[i], |
| 1142 | priv->use_riwt, priv->mode, | 1143 | priv->use_riwt, priv->mode, |
| 1143 | (i == DMA_RX_SIZE - 1)); | 1144 | (i == DMA_RX_SIZE - 1), |
| 1145 | priv->dma_buf_sz); | ||
| 1144 | } | 1146 | } |
| 1145 | 1147 | ||
| 1146 | /** | 1148 | /** |
| @@ -2614,8 +2616,6 @@ static int stmmac_open(struct net_device *dev) | |||
| 2614 | u32 chan; | 2616 | u32 chan; |
| 2615 | int ret; | 2617 | int ret; |
| 2616 | 2618 | ||
| 2617 | stmmac_check_ether_addr(priv); | ||
| 2618 | |||
| 2619 | if (priv->hw->pcs != STMMAC_PCS_RGMII && | 2619 | if (priv->hw->pcs != STMMAC_PCS_RGMII && |
| 2620 | priv->hw->pcs != STMMAC_PCS_TBI && | 2620 | priv->hw->pcs != STMMAC_PCS_TBI && |
| 2621 | priv->hw->pcs != STMMAC_PCS_RTBI) { | 2621 | priv->hw->pcs != STMMAC_PCS_RTBI) { |
| @@ -3352,9 +3352,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | |||
| 3352 | { | 3352 | { |
| 3353 | struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; | 3353 | struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
| 3354 | struct stmmac_channel *ch = &priv->channel[queue]; | 3354 | struct stmmac_channel *ch = &priv->channel[queue]; |
| 3355 | unsigned int entry = rx_q->cur_rx; | 3355 | unsigned int next_entry = rx_q->cur_rx; |
| 3356 | int coe = priv->hw->rx_csum; | 3356 | int coe = priv->hw->rx_csum; |
| 3357 | unsigned int next_entry; | ||
| 3358 | unsigned int count = 0; | 3357 | unsigned int count = 0; |
| 3359 | bool xmac; | 3358 | bool xmac; |
| 3360 | 3359 | ||
| @@ -3372,10 +3371,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | |||
| 3372 | stmmac_display_ring(priv, rx_head, DMA_RX_SIZE, true); | 3371 | stmmac_display_ring(priv, rx_head, DMA_RX_SIZE, true); |
| 3373 | } | 3372 | } |
| 3374 | while (count < limit) { | 3373 | while (count < limit) { |
| 3375 | int status; | 3374 | int entry, status; |
| 3376 | struct dma_desc *p; | 3375 | struct dma_desc *p; |
| 3377 | struct dma_desc *np; | 3376 | struct dma_desc *np; |
| 3378 | 3377 | ||
| 3378 | entry = next_entry; | ||
| 3379 | |||
| 3379 | if (priv->extend_desc) | 3380 | if (priv->extend_desc) |
| 3380 | p = (struct dma_desc *)(rx_q->dma_erx + entry); | 3381 | p = (struct dma_desc *)(rx_q->dma_erx + entry); |
| 3381 | else | 3382 | else |
| @@ -3431,11 +3432,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | |||
| 3431 | * ignored | 3432 | * ignored |
| 3432 | */ | 3433 | */ |
| 3433 | if (frame_len > priv->dma_buf_sz) { | 3434 | if (frame_len > priv->dma_buf_sz) { |
| 3434 | netdev_err(priv->dev, | 3435 | if (net_ratelimit()) |
| 3435 | "len %d larger than size (%d)\n", | 3436 | netdev_err(priv->dev, |
| 3436 | frame_len, priv->dma_buf_sz); | 3437 | "len %d larger than size (%d)\n", |
| 3438 | frame_len, priv->dma_buf_sz); | ||
| 3437 | priv->dev->stats.rx_length_errors++; | 3439 | priv->dev->stats.rx_length_errors++; |
| 3438 | break; | 3440 | continue; |
| 3439 | } | 3441 | } |
| 3440 | 3442 | ||
| 3441 | /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3 | 3443 | /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3 |
| @@ -3470,7 +3472,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | |||
| 3470 | dev_warn(priv->device, | 3472 | dev_warn(priv->device, |
| 3471 | "packet dropped\n"); | 3473 | "packet dropped\n"); |
| 3472 | priv->dev->stats.rx_dropped++; | 3474 | priv->dev->stats.rx_dropped++; |
| 3473 | break; | 3475 | continue; |
| 3474 | } | 3476 | } |
| 3475 | 3477 | ||
| 3476 | dma_sync_single_for_cpu(priv->device, | 3478 | dma_sync_single_for_cpu(priv->device, |
| @@ -3490,11 +3492,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | |||
| 3490 | } else { | 3492 | } else { |
| 3491 | skb = rx_q->rx_skbuff[entry]; | 3493 | skb = rx_q->rx_skbuff[entry]; |
| 3492 | if (unlikely(!skb)) { | 3494 | if (unlikely(!skb)) { |
| 3493 | netdev_err(priv->dev, | 3495 | if (net_ratelimit()) |
| 3494 | "%s: Inconsistent Rx chain\n", | 3496 | netdev_err(priv->dev, |
| 3495 | priv->dev->name); | 3497 | "%s: Inconsistent Rx chain\n", |
| 3498 | priv->dev->name); | ||
| 3496 | priv->dev->stats.rx_dropped++; | 3499 | priv->dev->stats.rx_dropped++; |
| 3497 | break; | 3500 | continue; |
| 3498 | } | 3501 | } |
| 3499 | prefetch(skb->data - NET_IP_ALIGN); | 3502 | prefetch(skb->data - NET_IP_ALIGN); |
| 3500 | rx_q->rx_skbuff[entry] = NULL; | 3503 | rx_q->rx_skbuff[entry] = NULL; |
| @@ -3529,7 +3532,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | |||
| 3529 | priv->dev->stats.rx_packets++; | 3532 | priv->dev->stats.rx_packets++; |
| 3530 | priv->dev->stats.rx_bytes += frame_len; | 3533 | priv->dev->stats.rx_bytes += frame_len; |
| 3531 | } | 3534 | } |
| 3532 | entry = next_entry; | ||
| 3533 | } | 3535 | } |
| 3534 | 3536 | ||
| 3535 | stmmac_rx_refill(priv, queue); | 3537 | stmmac_rx_refill(priv, queue); |
| @@ -4299,6 +4301,8 @@ int stmmac_dvr_probe(struct device *device, | |||
| 4299 | if (ret) | 4301 | if (ret) |
| 4300 | goto error_hw_init; | 4302 | goto error_hw_init; |
| 4301 | 4303 | ||
| 4304 | stmmac_check_ether_addr(priv); | ||
| 4305 | |||
| 4302 | /* Configure real RX and TX queues */ | 4306 | /* Configure real RX and TX queues */ |
| 4303 | netif_set_real_num_rx_queues(ndev, priv->plat->rx_queues_to_use); | 4307 | netif_set_real_num_rx_queues(ndev, priv->plat->rx_queues_to_use); |
| 4304 | netif_set_real_num_tx_queues(ndev, priv->plat->tx_queues_to_use); | 4308 | netif_set_real_num_tx_queues(ndev, priv->plat->tx_queues_to_use); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index d819e8eaba12..26db6aa002d1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | |||
| @@ -159,6 +159,12 @@ static const struct dmi_system_id quark_pci_dmi[] = { | |||
| 159 | }, | 159 | }, |
| 160 | .driver_data = (void *)&galileo_stmmac_dmi_data, | 160 | .driver_data = (void *)&galileo_stmmac_dmi_data, |
| 161 | }, | 161 | }, |
| 162 | /* | ||
| 163 | * There are 2 types of SIMATIC IOT2000: IOT2020 and IOT2040. | ||
| 164 | * The asset tag "6ES7647-0AA00-0YA2" is only for IOT2020 which | ||
| 165 | * has only one pci network device while other asset tags are | ||
| 166 | * for IOT2040 which has two. | ||
| 167 | */ | ||
| 162 | { | 168 | { |
| 163 | .matches = { | 169 | .matches = { |
| 164 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), | 170 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), |
| @@ -170,8 +176,6 @@ static const struct dmi_system_id quark_pci_dmi[] = { | |||
| 170 | { | 176 | { |
| 171 | .matches = { | 177 | .matches = { |
| 172 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), | 178 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), |
| 173 | DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, | ||
| 174 | "6ES7647-0AA00-1YA2"), | ||
| 175 | }, | 179 | }, |
| 176 | .driver_data = (void *)&iot2040_stmmac_dmi_data, | 180 | .driver_data = (void *)&iot2040_stmmac_dmi_data, |
| 177 | }, | 181 | }, |
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index e859ae2e42d5..49f41b64077b 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h | |||
| @@ -987,6 +987,7 @@ struct netvsc_device { | |||
| 987 | 987 | ||
| 988 | wait_queue_head_t wait_drain; | 988 | wait_queue_head_t wait_drain; |
| 989 | bool destroy; | 989 | bool destroy; |
| 990 | bool tx_disable; /* if true, do not wake up queue again */ | ||
| 990 | 991 | ||
| 991 | /* Receive buffer allocated by us but manages by NetVSP */ | 992 | /* Receive buffer allocated by us but manages by NetVSP */ |
| 992 | void *recv_buf; | 993 | void *recv_buf; |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 813d195bbd57..e0dce373cdd9 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
| @@ -110,6 +110,7 @@ static struct netvsc_device *alloc_net_device(void) | |||
| 110 | 110 | ||
| 111 | init_waitqueue_head(&net_device->wait_drain); | 111 | init_waitqueue_head(&net_device->wait_drain); |
| 112 | net_device->destroy = false; | 112 | net_device->destroy = false; |
| 113 | net_device->tx_disable = false; | ||
| 113 | 114 | ||
| 114 | net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT; | 115 | net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT; |
| 115 | net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT; | 116 | net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT; |
| @@ -719,7 +720,7 @@ static void netvsc_send_tx_complete(struct net_device *ndev, | |||
| 719 | } else { | 720 | } else { |
| 720 | struct netdev_queue *txq = netdev_get_tx_queue(ndev, q_idx); | 721 | struct netdev_queue *txq = netdev_get_tx_queue(ndev, q_idx); |
| 721 | 722 | ||
| 722 | if (netif_tx_queue_stopped(txq) && | 723 | if (netif_tx_queue_stopped(txq) && !net_device->tx_disable && |
| 723 | (hv_get_avail_to_write_percent(&channel->outbound) > | 724 | (hv_get_avail_to_write_percent(&channel->outbound) > |
| 724 | RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) { | 725 | RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) { |
| 725 | netif_tx_wake_queue(txq); | 726 | netif_tx_wake_queue(txq); |
| @@ -874,7 +875,8 @@ static inline int netvsc_send_pkt( | |||
| 874 | } else if (ret == -EAGAIN) { | 875 | } else if (ret == -EAGAIN) { |
| 875 | netif_tx_stop_queue(txq); | 876 | netif_tx_stop_queue(txq); |
| 876 | ndev_ctx->eth_stats.stop_queue++; | 877 | ndev_ctx->eth_stats.stop_queue++; |
| 877 | if (atomic_read(&nvchan->queue_sends) < 1) { | 878 | if (atomic_read(&nvchan->queue_sends) < 1 && |
| 879 | !net_device->tx_disable) { | ||
| 878 | netif_tx_wake_queue(txq); | 880 | netif_tx_wake_queue(txq); |
| 879 | ndev_ctx->eth_stats.wake_queue++; | 881 | ndev_ctx->eth_stats.wake_queue++; |
| 880 | ret = -ENOSPC; | 882 | ret = -ENOSPC; |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index cf4897043e83..b20fb0fb595b 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
| @@ -109,6 +109,15 @@ static void netvsc_set_rx_mode(struct net_device *net) | |||
| 109 | rcu_read_unlock(); | 109 | rcu_read_unlock(); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | static void netvsc_tx_enable(struct netvsc_device *nvscdev, | ||
| 113 | struct net_device *ndev) | ||
| 114 | { | ||
| 115 | nvscdev->tx_disable = false; | ||
| 116 | virt_wmb(); /* ensure queue wake up mechanism is on */ | ||
| 117 | |||
| 118 | netif_tx_wake_all_queues(ndev); | ||
| 119 | } | ||
| 120 | |||
| 112 | static int netvsc_open(struct net_device *net) | 121 | static int netvsc_open(struct net_device *net) |
| 113 | { | 122 | { |
| 114 | struct net_device_context *ndev_ctx = netdev_priv(net); | 123 | struct net_device_context *ndev_ctx = netdev_priv(net); |
| @@ -129,7 +138,7 @@ static int netvsc_open(struct net_device *net) | |||
| 129 | rdev = nvdev->extension; | 138 | rdev = nvdev->extension; |
| 130 | if (!rdev->link_state) { | 139 | if (!rdev->link_state) { |
| 131 | netif_carrier_on(net); | 140 | netif_carrier_on(net); |
| 132 | netif_tx_wake_all_queues(net); | 141 | netvsc_tx_enable(nvdev, net); |
| 133 | } | 142 | } |
| 134 | 143 | ||
| 135 | if (vf_netdev) { | 144 | if (vf_netdev) { |
| @@ -184,6 +193,17 @@ static int netvsc_wait_until_empty(struct netvsc_device *nvdev) | |||
| 184 | } | 193 | } |
| 185 | } | 194 | } |
| 186 | 195 | ||
| 196 | static void netvsc_tx_disable(struct netvsc_device *nvscdev, | ||
| 197 | struct net_device *ndev) | ||
| 198 | { | ||
| 199 | if (nvscdev) { | ||
| 200 | nvscdev->tx_disable = true; | ||
| 201 | virt_wmb(); /* ensure txq will not wake up after stop */ | ||
| 202 | } | ||
| 203 | |||
| 204 | netif_tx_disable(ndev); | ||
| 205 | } | ||
| 206 | |||
| 187 | static int netvsc_close(struct net_device *net) | 207 | static int netvsc_close(struct net_device *net) |
| 188 | { | 208 | { |
| 189 | struct net_device_context *net_device_ctx = netdev_priv(net); | 209 | struct net_device_context *net_device_ctx = netdev_priv(net); |
| @@ -192,7 +212,7 @@ static int netvsc_close(struct net_device *net) | |||
| 192 | struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); | 212 | struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); |
| 193 | int ret; | 213 | int ret; |
| 194 | 214 | ||
| 195 | netif_tx_disable(net); | 215 | netvsc_tx_disable(nvdev, net); |
| 196 | 216 | ||
| 197 | /* No need to close rndis filter if it is removed already */ | 217 | /* No need to close rndis filter if it is removed already */ |
| 198 | if (!nvdev) | 218 | if (!nvdev) |
| @@ -920,7 +940,7 @@ static int netvsc_detach(struct net_device *ndev, | |||
| 920 | 940 | ||
| 921 | /* If device was up (receiving) then shutdown */ | 941 | /* If device was up (receiving) then shutdown */ |
| 922 | if (netif_running(ndev)) { | 942 | if (netif_running(ndev)) { |
| 923 | netif_tx_disable(ndev); | 943 | netvsc_tx_disable(nvdev, ndev); |
| 924 | 944 | ||
| 925 | ret = rndis_filter_close(nvdev); | 945 | ret = rndis_filter_close(nvdev); |
| 926 | if (ret) { | 946 | if (ret) { |
| @@ -1908,7 +1928,7 @@ static void netvsc_link_change(struct work_struct *w) | |||
| 1908 | if (rdev->link_state) { | 1928 | if (rdev->link_state) { |
| 1909 | rdev->link_state = false; | 1929 | rdev->link_state = false; |
| 1910 | netif_carrier_on(net); | 1930 | netif_carrier_on(net); |
| 1911 | netif_tx_wake_all_queues(net); | 1931 | netvsc_tx_enable(net_device, net); |
| 1912 | } else { | 1932 | } else { |
| 1913 | notify = true; | 1933 | notify = true; |
| 1914 | } | 1934 | } |
| @@ -1918,7 +1938,7 @@ static void netvsc_link_change(struct work_struct *w) | |||
| 1918 | if (!rdev->link_state) { | 1938 | if (!rdev->link_state) { |
| 1919 | rdev->link_state = true; | 1939 | rdev->link_state = true; |
| 1920 | netif_carrier_off(net); | 1940 | netif_carrier_off(net); |
| 1921 | netif_tx_stop_all_queues(net); | 1941 | netvsc_tx_disable(net_device, net); |
| 1922 | } | 1942 | } |
| 1923 | kfree(event); | 1943 | kfree(event); |
| 1924 | break; | 1944 | break; |
| @@ -1927,7 +1947,7 @@ static void netvsc_link_change(struct work_struct *w) | |||
| 1927 | if (!rdev->link_state) { | 1947 | if (!rdev->link_state) { |
| 1928 | rdev->link_state = true; | 1948 | rdev->link_state = true; |
| 1929 | netif_carrier_off(net); | 1949 | netif_carrier_off(net); |
| 1930 | netif_tx_stop_all_queues(net); | 1950 | netvsc_tx_disable(net_device, net); |
| 1931 | event->event = RNDIS_STATUS_MEDIA_CONNECT; | 1951 | event->event = RNDIS_STATUS_MEDIA_CONNECT; |
| 1932 | spin_lock_irqsave(&ndev_ctx->lock, flags); | 1952 | spin_lock_irqsave(&ndev_ctx->lock, flags); |
| 1933 | list_add(&event->list, &ndev_ctx->reconfig_events); | 1953 | list_add(&event->list, &ndev_ctx->reconfig_events); |
diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c index c589f5ae75bb..8bb53ec8d9cf 100644 --- a/drivers/net/ieee802154/mcr20a.c +++ b/drivers/net/ieee802154/mcr20a.c | |||
| @@ -533,6 +533,8 @@ mcr20a_start(struct ieee802154_hw *hw) | |||
| 533 | dev_dbg(printdev(lp), "no slotted operation\n"); | 533 | dev_dbg(printdev(lp), "no slotted operation\n"); |
| 534 | ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1, | 534 | ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1, |
| 535 | DAR_PHY_CTRL1_SLOTTED, 0x0); | 535 | DAR_PHY_CTRL1_SLOTTED, 0x0); |
| 536 | if (ret < 0) | ||
| 537 | return ret; | ||
| 536 | 538 | ||
| 537 | /* enable irq */ | 539 | /* enable irq */ |
| 538 | enable_irq(lp->spi->irq); | 540 | enable_irq(lp->spi->irq); |
| @@ -540,11 +542,15 @@ mcr20a_start(struct ieee802154_hw *hw) | |||
| 540 | /* Unmask SEQ interrupt */ | 542 | /* Unmask SEQ interrupt */ |
| 541 | ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL2, | 543 | ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL2, |
| 542 | DAR_PHY_CTRL2_SEQMSK, 0x0); | 544 | DAR_PHY_CTRL2_SEQMSK, 0x0); |
| 545 | if (ret < 0) | ||
| 546 | return ret; | ||
| 543 | 547 | ||
| 544 | /* Start the RX sequence */ | 548 | /* Start the RX sequence */ |
| 545 | dev_dbg(printdev(lp), "start the RX sequence\n"); | 549 | dev_dbg(printdev(lp), "start the RX sequence\n"); |
| 546 | ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1, | 550 | ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1, |
| 547 | DAR_PHY_CTRL1_XCVSEQ_MASK, MCR20A_XCVSEQ_RX); | 551 | DAR_PHY_CTRL1_XCVSEQ_MASK, MCR20A_XCVSEQ_RX); |
| 552 | if (ret < 0) | ||
| 553 | return ret; | ||
| 548 | 554 | ||
| 549 | return 0; | 555 | return 0; |
| 550 | } | 556 | } |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 3ccba37bd6dd..f76c4048b978 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -1489,9 +1489,10 @@ static int marvell_get_sset_count(struct phy_device *phydev) | |||
| 1489 | 1489 | ||
| 1490 | static void marvell_get_strings(struct phy_device *phydev, u8 *data) | 1490 | static void marvell_get_strings(struct phy_device *phydev, u8 *data) |
| 1491 | { | 1491 | { |
| 1492 | int count = marvell_get_sset_count(phydev); | ||
| 1492 | int i; | 1493 | int i; |
| 1493 | 1494 | ||
| 1494 | for (i = 0; i < ARRAY_SIZE(marvell_hw_stats); i++) { | 1495 | for (i = 0; i < count; i++) { |
| 1495 | strlcpy(data + i * ETH_GSTRING_LEN, | 1496 | strlcpy(data + i * ETH_GSTRING_LEN, |
| 1496 | marvell_hw_stats[i].string, ETH_GSTRING_LEN); | 1497 | marvell_hw_stats[i].string, ETH_GSTRING_LEN); |
| 1497 | } | 1498 | } |
| @@ -1519,9 +1520,10 @@ static u64 marvell_get_stat(struct phy_device *phydev, int i) | |||
| 1519 | static void marvell_get_stats(struct phy_device *phydev, | 1520 | static void marvell_get_stats(struct phy_device *phydev, |
| 1520 | struct ethtool_stats *stats, u64 *data) | 1521 | struct ethtool_stats *stats, u64 *data) |
| 1521 | { | 1522 | { |
| 1523 | int count = marvell_get_sset_count(phydev); | ||
| 1522 | int i; | 1524 | int i; |
| 1523 | 1525 | ||
| 1524 | for (i = 0; i < ARRAY_SIZE(marvell_hw_stats); i++) | 1526 | for (i = 0; i < count; i++) |
| 1525 | data[i] = marvell_get_stat(phydev, i); | 1527 | data[i] = marvell_get_stat(phydev, i); |
| 1526 | } | 1528 | } |
| 1527 | 1529 | ||
diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c index 92b64e254b44..7475cef17cf7 100644 --- a/drivers/net/phy/spi_ks8995.c +++ b/drivers/net/phy/spi_ks8995.c | |||
| @@ -159,6 +159,14 @@ static const struct spi_device_id ks8995_id[] = { | |||
| 159 | }; | 159 | }; |
| 160 | MODULE_DEVICE_TABLE(spi, ks8995_id); | 160 | MODULE_DEVICE_TABLE(spi, ks8995_id); |
| 161 | 161 | ||
| 162 | static const struct of_device_id ks8895_spi_of_match[] = { | ||
| 163 | { .compatible = "micrel,ks8995" }, | ||
| 164 | { .compatible = "micrel,ksz8864" }, | ||
| 165 | { .compatible = "micrel,ksz8795" }, | ||
| 166 | { }, | ||
| 167 | }; | ||
| 168 | MODULE_DEVICE_TABLE(of, ks8895_spi_of_match); | ||
| 169 | |||
| 162 | static inline u8 get_chip_id(u8 val) | 170 | static inline u8 get_chip_id(u8 val) |
| 163 | { | 171 | { |
| 164 | return (val >> ID1_CHIPID_S) & ID1_CHIPID_M; | 172 | return (val >> ID1_CHIPID_S) & ID1_CHIPID_M; |
| @@ -526,6 +534,7 @@ static int ks8995_remove(struct spi_device *spi) | |||
| 526 | static struct spi_driver ks8995_driver = { | 534 | static struct spi_driver ks8995_driver = { |
| 527 | .driver = { | 535 | .driver = { |
| 528 | .name = "spi-ks8995", | 536 | .name = "spi-ks8995", |
| 537 | .of_match_table = of_match_ptr(ks8895_spi_of_match), | ||
| 529 | }, | 538 | }, |
| 530 | .probe = ks8995_probe, | 539 | .probe = ks8995_probe, |
| 531 | .remove = ks8995_remove, | 540 | .remove = ks8995_remove, |
diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c index f4e93f5fc204..ea90db3c7705 100644 --- a/drivers/net/slip/slhc.c +++ b/drivers/net/slip/slhc.c | |||
| @@ -153,7 +153,7 @@ out_fail: | |||
| 153 | void | 153 | void |
| 154 | slhc_free(struct slcompress *comp) | 154 | slhc_free(struct slcompress *comp) |
| 155 | { | 155 | { |
| 156 | if ( comp == NULLSLCOMPR ) | 156 | if ( IS_ERR_OR_NULL(comp) ) |
| 157 | return; | 157 | return; |
| 158 | 158 | ||
| 159 | if ( comp->tstate != NULLSLSTATE ) | 159 | if ( comp->tstate != NULLSLSTATE ) |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 6ed96fdfd96d..16963f7a88f7 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
| @@ -1156,6 +1156,13 @@ static int team_port_add(struct team *team, struct net_device *port_dev, | |||
| 1156 | return -EINVAL; | 1156 | return -EINVAL; |
| 1157 | } | 1157 | } |
| 1158 | 1158 | ||
| 1159 | if (netdev_has_upper_dev(dev, port_dev)) { | ||
| 1160 | NL_SET_ERR_MSG(extack, "Device is already an upper device of the team interface"); | ||
| 1161 | netdev_err(dev, "Device %s is already an upper device of the team interface\n", | ||
| 1162 | portname); | ||
| 1163 | return -EBUSY; | ||
| 1164 | } | ||
| 1165 | |||
| 1159 | if (port_dev->features & NETIF_F_VLAN_CHALLENGED && | 1166 | if (port_dev->features & NETIF_F_VLAN_CHALLENGED && |
| 1160 | vlan_uses_dev(dev)) { | 1167 | vlan_uses_dev(dev)) { |
| 1161 | NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up"); | 1168 | NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up"); |
| @@ -1246,6 +1253,23 @@ static int team_port_add(struct team *team, struct net_device *port_dev, | |||
| 1246 | goto err_option_port_add; | 1253 | goto err_option_port_add; |
| 1247 | } | 1254 | } |
| 1248 | 1255 | ||
| 1256 | /* set promiscuity level to new slave */ | ||
| 1257 | if (dev->flags & IFF_PROMISC) { | ||
| 1258 | err = dev_set_promiscuity(port_dev, 1); | ||
| 1259 | if (err) | ||
| 1260 | goto err_set_slave_promisc; | ||
| 1261 | } | ||
| 1262 | |||
| 1263 | /* set allmulti level to new slave */ | ||
| 1264 | if (dev->flags & IFF_ALLMULTI) { | ||
| 1265 | err = dev_set_allmulti(port_dev, 1); | ||
| 1266 | if (err) { | ||
| 1267 | if (dev->flags & IFF_PROMISC) | ||
| 1268 | dev_set_promiscuity(port_dev, -1); | ||
| 1269 | goto err_set_slave_promisc; | ||
| 1270 | } | ||
| 1271 | } | ||
| 1272 | |||
| 1249 | netif_addr_lock_bh(dev); | 1273 | netif_addr_lock_bh(dev); |
| 1250 | dev_uc_sync_multiple(port_dev, dev); | 1274 | dev_uc_sync_multiple(port_dev, dev); |
| 1251 | dev_mc_sync_multiple(port_dev, dev); | 1275 | dev_mc_sync_multiple(port_dev, dev); |
| @@ -1262,6 +1286,9 @@ static int team_port_add(struct team *team, struct net_device *port_dev, | |||
| 1262 | 1286 | ||
| 1263 | return 0; | 1287 | return 0; |
| 1264 | 1288 | ||
| 1289 | err_set_slave_promisc: | ||
| 1290 | __team_option_inst_del_port(team, port); | ||
| 1291 | |||
| 1265 | err_option_port_add: | 1292 | err_option_port_add: |
| 1266 | team_upper_dev_unlink(team, port); | 1293 | team_upper_dev_unlink(team, port); |
| 1267 | 1294 | ||
| @@ -1307,6 +1334,12 @@ static int team_port_del(struct team *team, struct net_device *port_dev) | |||
| 1307 | 1334 | ||
| 1308 | team_port_disable(team, port); | 1335 | team_port_disable(team, port); |
| 1309 | list_del_rcu(&port->list); | 1336 | list_del_rcu(&port->list); |
| 1337 | |||
| 1338 | if (dev->flags & IFF_PROMISC) | ||
| 1339 | dev_set_promiscuity(port_dev, -1); | ||
| 1340 | if (dev->flags & IFF_ALLMULTI) | ||
| 1341 | dev_set_allmulti(port_dev, -1); | ||
| 1342 | |||
| 1310 | team_upper_dev_unlink(team, port); | 1343 | team_upper_dev_unlink(team, port); |
| 1311 | netdev_rx_handler_unregister(port_dev); | 1344 | netdev_rx_handler_unregister(port_dev); |
| 1312 | team_port_disable_netpoll(port); | 1345 | team_port_disable_netpoll(port); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 74bebbdb4b15..679e404a5224 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -1122,9 +1122,16 @@ static const struct usb_device_id products[] = { | |||
| 1122 | {QMI_FIXED_INTF(0x0846, 0x68d3, 8)}, /* Netgear Aircard 779S */ | 1122 | {QMI_FIXED_INTF(0x0846, 0x68d3, 8)}, /* Netgear Aircard 779S */ |
| 1123 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ | 1123 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ |
| 1124 | {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ | 1124 | {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ |
| 1125 | {QMI_FIXED_INTF(0x1435, 0x0918, 3)}, /* Wistron NeWeb D16Q1 */ | ||
| 1126 | {QMI_FIXED_INTF(0x1435, 0x0918, 4)}, /* Wistron NeWeb D16Q1 */ | ||
| 1127 | {QMI_FIXED_INTF(0x1435, 0x0918, 5)}, /* Wistron NeWeb D16Q1 */ | ||
| 1128 | {QMI_FIXED_INTF(0x1435, 0x3185, 4)}, /* Wistron NeWeb M18Q5 */ | ||
| 1129 | {QMI_FIXED_INTF(0x1435, 0xd111, 4)}, /* M9615A DM11-1 D51QC */ | ||
| 1125 | {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */ | 1130 | {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */ |
| 1126 | {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */ | 1131 | {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */ |
| 1127 | {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */ | 1132 | {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */ |
| 1133 | {QMI_FIXED_INTF(0x1435, 0xd182, 4)}, /* Wistron NeWeb D18 */ | ||
| 1134 | {QMI_FIXED_INTF(0x1435, 0xd182, 5)}, /* Wistron NeWeb D18 */ | ||
| 1128 | {QMI_FIXED_INTF(0x1435, 0xd191, 4)}, /* Wistron NeWeb D19Q1 */ | 1135 | {QMI_FIXED_INTF(0x1435, 0xd191, 4)}, /* Wistron NeWeb D19Q1 */ |
| 1129 | {QMI_QUIRK_SET_DTR(0x1508, 0x1001, 4)}, /* Fibocom NL668 series */ | 1136 | {QMI_QUIRK_SET_DTR(0x1508, 0x1001, 4)}, /* Fibocom NL668 series */ |
| 1130 | {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ | 1137 | {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ |
| @@ -1180,6 +1187,7 @@ static const struct usb_device_id products[] = { | |||
| 1180 | {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */ | 1187 | {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */ |
| 1181 | {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */ | 1188 | {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */ |
| 1182 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ | 1189 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ |
| 1190 | {QMI_FIXED_INTF(0x19d2, 0x0396, 3)}, /* ZTE ZM8620 */ | ||
| 1183 | {QMI_FIXED_INTF(0x19d2, 0x0412, 4)}, /* Telewell TW-LTE 4G */ | 1191 | {QMI_FIXED_INTF(0x19d2, 0x0412, 4)}, /* Telewell TW-LTE 4G */ |
| 1184 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ | 1192 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ |
| 1185 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ | 1193 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ |
| @@ -1200,9 +1208,12 @@ static const struct usb_device_id products[] = { | |||
| 1200 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, | 1208 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, |
| 1201 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ | 1209 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ |
| 1202 | {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ | 1210 | {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ |
| 1211 | {QMI_FIXED_INTF(0x19d2, 0x1432, 3)}, /* ZTE ME3620 */ | ||
| 1203 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ | 1212 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
| 1213 | {QMI_FIXED_INTF(0x2001, 0x7e16, 3)}, /* D-Link DWM-221 */ | ||
| 1204 | {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ | 1214 | {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ |
| 1205 | {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ | 1215 | {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ |
| 1216 | {QMI_FIXED_INTF(0x2020, 0x2031, 4)}, /* Olicard 600 */ | ||
| 1206 | {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ | 1217 | {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ |
| 1207 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ | 1218 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
| 1208 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ | 1219 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index 7c1430ed0244..9ee4d7402ca2 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c | |||
| @@ -875,6 +875,7 @@ static const struct net_device_ops vrf_netdev_ops = { | |||
| 875 | .ndo_init = vrf_dev_init, | 875 | .ndo_init = vrf_dev_init, |
| 876 | .ndo_uninit = vrf_dev_uninit, | 876 | .ndo_uninit = vrf_dev_uninit, |
| 877 | .ndo_start_xmit = vrf_xmit, | 877 | .ndo_start_xmit = vrf_xmit, |
| 878 | .ndo_set_mac_address = eth_mac_addr, | ||
| 878 | .ndo_get_stats64 = vrf_get_stats64, | 879 | .ndo_get_stats64 = vrf_get_stats64, |
| 879 | .ndo_add_slave = vrf_add_slave, | 880 | .ndo_add_slave = vrf_add_slave, |
| 880 | .ndo_del_slave = vrf_del_slave, | 881 | .ndo_del_slave = vrf_del_slave, |
| @@ -1273,9 +1274,15 @@ static void vrf_setup(struct net_device *dev) | |||
| 1273 | 1274 | ||
| 1274 | /* default to no qdisc; user can add if desired */ | 1275 | /* default to no qdisc; user can add if desired */ |
| 1275 | dev->priv_flags |= IFF_NO_QUEUE; | 1276 | dev->priv_flags |= IFF_NO_QUEUE; |
| 1277 | dev->priv_flags |= IFF_NO_RX_HANDLER; | ||
| 1278 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; | ||
| 1276 | 1279 | ||
| 1277 | dev->min_mtu = 0; | 1280 | /* VRF devices do not care about MTU, but if the MTU is set |
| 1278 | dev->max_mtu = 0; | 1281 | * too low then the ipv4 and ipv6 protocols are disabled |
| 1282 | * which breaks networking. | ||
| 1283 | */ | ||
| 1284 | dev->min_mtu = IPV6_MIN_MTU; | ||
| 1285 | dev->max_mtu = ETH_MAX_MTU; | ||
| 1279 | } | 1286 | } |
| 1280 | 1287 | ||
| 1281 | static int vrf_validate(struct nlattr *tb[], struct nlattr *data[], | 1288 | static int vrf_validate(struct nlattr *tb[], struct nlattr *data[], |
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c index 24b983edb357..eca87f7c5b6c 100644 --- a/drivers/net/wireless/ath/ath10k/ce.c +++ b/drivers/net/wireless/ath/ath10k/ce.c | |||
| @@ -1855,7 +1855,7 @@ void ath10k_ce_dump_registers(struct ath10k *ar, | |||
| 1855 | struct ath10k_ce_crash_data ce_data; | 1855 | struct ath10k_ce_crash_data ce_data; |
| 1856 | u32 addr, id; | 1856 | u32 addr, id; |
| 1857 | 1857 | ||
| 1858 | lockdep_assert_held(&ar->data_lock); | 1858 | lockdep_assert_held(&ar->dump_mutex); |
| 1859 | 1859 | ||
| 1860 | ath10k_err(ar, "Copy Engine register dump:\n"); | 1860 | ath10k_err(ar, "Copy Engine register dump:\n"); |
| 1861 | 1861 | ||
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 835b8de92d55..aff585658fc0 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
| @@ -3119,6 +3119,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, | |||
| 3119 | goto err_free_wq; | 3119 | goto err_free_wq; |
| 3120 | 3120 | ||
| 3121 | mutex_init(&ar->conf_mutex); | 3121 | mutex_init(&ar->conf_mutex); |
| 3122 | mutex_init(&ar->dump_mutex); | ||
| 3122 | spin_lock_init(&ar->data_lock); | 3123 | spin_lock_init(&ar->data_lock); |
| 3123 | 3124 | ||
| 3124 | INIT_LIST_HEAD(&ar->peers); | 3125 | INIT_LIST_HEAD(&ar->peers); |
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index e08a17b01e03..e35aae5146f1 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h | |||
| @@ -1063,6 +1063,9 @@ struct ath10k { | |||
| 1063 | /* prevents concurrent FW reconfiguration */ | 1063 | /* prevents concurrent FW reconfiguration */ |
| 1064 | struct mutex conf_mutex; | 1064 | struct mutex conf_mutex; |
| 1065 | 1065 | ||
| 1066 | /* protects coredump data */ | ||
| 1067 | struct mutex dump_mutex; | ||
| 1068 | |||
| 1066 | /* protects shared structure data */ | 1069 | /* protects shared structure data */ |
| 1067 | spinlock_t data_lock; | 1070 | spinlock_t data_lock; |
| 1068 | 1071 | ||
diff --git a/drivers/net/wireless/ath/ath10k/coredump.c b/drivers/net/wireless/ath/ath10k/coredump.c index 33838d9c1cb6..45a355fb62b9 100644 --- a/drivers/net/wireless/ath/ath10k/coredump.c +++ b/drivers/net/wireless/ath/ath10k/coredump.c | |||
| @@ -1102,7 +1102,7 @@ struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar) | |||
| 1102 | { | 1102 | { |
| 1103 | struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data; | 1103 | struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data; |
| 1104 | 1104 | ||
| 1105 | lockdep_assert_held(&ar->data_lock); | 1105 | lockdep_assert_held(&ar->dump_mutex); |
| 1106 | 1106 | ||
| 1107 | if (ath10k_coredump_mask == 0) | 1107 | if (ath10k_coredump_mask == 0) |
| 1108 | /* coredump disabled */ | 1108 | /* coredump disabled */ |
| @@ -1146,7 +1146,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar) | |||
| 1146 | if (!buf) | 1146 | if (!buf) |
| 1147 | return NULL; | 1147 | return NULL; |
| 1148 | 1148 | ||
| 1149 | spin_lock_bh(&ar->data_lock); | 1149 | mutex_lock(&ar->dump_mutex); |
| 1150 | 1150 | ||
| 1151 | dump_data = (struct ath10k_dump_file_data *)(buf); | 1151 | dump_data = (struct ath10k_dump_file_data *)(buf); |
| 1152 | strlcpy(dump_data->df_magic, "ATH10K-FW-DUMP", | 1152 | strlcpy(dump_data->df_magic, "ATH10K-FW-DUMP", |
| @@ -1213,7 +1213,7 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar) | |||
| 1213 | sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len; | 1213 | sofar += sizeof(*dump_tlv) + crash_data->ramdump_buf_len; |
| 1214 | } | 1214 | } |
| 1215 | 1215 | ||
| 1216 | spin_unlock_bh(&ar->data_lock); | 1216 | mutex_unlock(&ar->dump_mutex); |
| 1217 | 1217 | ||
| 1218 | return dump_data; | 1218 | return dump_data; |
| 1219 | } | 1219 | } |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index a20ea270d519..1acc622d2183 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
| @@ -2728,7 +2728,7 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb) | |||
| 2728 | num_msdus++; | 2728 | num_msdus++; |
| 2729 | num_bytes += ret; | 2729 | num_bytes += ret; |
| 2730 | } | 2730 | } |
| 2731 | ieee80211_return_txq(hw, txq); | 2731 | ieee80211_return_txq(hw, txq, false); |
| 2732 | ieee80211_txq_schedule_end(hw, txq->ac); | 2732 | ieee80211_txq_schedule_end(hw, txq->ac); |
| 2733 | 2733 | ||
| 2734 | record->num_msdus = cpu_to_le16(num_msdus); | 2734 | record->num_msdus = cpu_to_le16(num_msdus); |
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index b73c23d4ce86..9c703d287333 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c | |||
| @@ -4089,7 +4089,7 @@ static int ath10k_mac_schedule_txq(struct ieee80211_hw *hw, u32 ac) | |||
| 4089 | if (ret < 0) | 4089 | if (ret < 0) |
| 4090 | break; | 4090 | break; |
| 4091 | } | 4091 | } |
| 4092 | ieee80211_return_txq(hw, txq); | 4092 | ieee80211_return_txq(hw, txq, false); |
| 4093 | ath10k_htt_tx_txq_update(hw, txq); | 4093 | ath10k_htt_tx_txq_update(hw, txq); |
| 4094 | if (ret == -EBUSY) | 4094 | if (ret == -EBUSY) |
| 4095 | break; | 4095 | break; |
| @@ -4374,7 +4374,7 @@ static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, | |||
| 4374 | if (ret < 0) | 4374 | if (ret < 0) |
| 4375 | break; | 4375 | break; |
| 4376 | } | 4376 | } |
| 4377 | ieee80211_return_txq(hw, txq); | 4377 | ieee80211_return_txq(hw, txq, false); |
| 4378 | ath10k_htt_tx_txq_update(hw, txq); | 4378 | ath10k_htt_tx_txq_update(hw, txq); |
| 4379 | out: | 4379 | out: |
| 4380 | ieee80211_txq_schedule_end(hw, ac); | 4380 | ieee80211_txq_schedule_end(hw, ac); |
| @@ -5774,7 +5774,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
| 5774 | } | 5774 | } |
| 5775 | 5775 | ||
| 5776 | if (changed & BSS_CHANGED_MCAST_RATE && | 5776 | if (changed & BSS_CHANGED_MCAST_RATE && |
| 5777 | !WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) { | 5777 | !ath10k_mac_vif_chan(arvif->vif, &def)) { |
| 5778 | band = def.chan->band; | 5778 | band = def.chan->band; |
| 5779 | rateidx = vif->bss_conf.mcast_rate[band] - 1; | 5779 | rateidx = vif->bss_conf.mcast_rate[band] - 1; |
| 5780 | 5780 | ||
| @@ -5812,7 +5812,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw, | |||
| 5812 | } | 5812 | } |
| 5813 | 5813 | ||
| 5814 | if (changed & BSS_CHANGED_BASIC_RATES) { | 5814 | if (changed & BSS_CHANGED_BASIC_RATES) { |
| 5815 | if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) { | 5815 | if (ath10k_mac_vif_chan(vif, &def)) { |
| 5816 | mutex_unlock(&ar->conf_mutex); | 5816 | mutex_unlock(&ar->conf_mutex); |
| 5817 | return; | 5817 | return; |
| 5818 | } | 5818 | } |
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 271f92c24d44..2c27f407a851 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c | |||
| @@ -1441,7 +1441,7 @@ static void ath10k_pci_dump_registers(struct ath10k *ar, | |||
| 1441 | __le32 reg_dump_values[REG_DUMP_COUNT_QCA988X] = {}; | 1441 | __le32 reg_dump_values[REG_DUMP_COUNT_QCA988X] = {}; |
| 1442 | int i, ret; | 1442 | int i, ret; |
| 1443 | 1443 | ||
| 1444 | lockdep_assert_held(&ar->data_lock); | 1444 | lockdep_assert_held(&ar->dump_mutex); |
| 1445 | 1445 | ||
| 1446 | ret = ath10k_pci_diag_read_hi(ar, ®_dump_values[0], | 1446 | ret = ath10k_pci_diag_read_hi(ar, ®_dump_values[0], |
| 1447 | hi_failure_state, | 1447 | hi_failure_state, |
| @@ -1656,7 +1656,7 @@ static void ath10k_pci_dump_memory(struct ath10k *ar, | |||
| 1656 | int ret, i; | 1656 | int ret, i; |
| 1657 | u8 *buf; | 1657 | u8 *buf; |
| 1658 | 1658 | ||
| 1659 | lockdep_assert_held(&ar->data_lock); | 1659 | lockdep_assert_held(&ar->dump_mutex); |
| 1660 | 1660 | ||
| 1661 | if (!crash_data) | 1661 | if (!crash_data) |
| 1662 | return; | 1662 | return; |
| @@ -1734,14 +1734,19 @@ static void ath10k_pci_dump_memory(struct ath10k *ar, | |||
| 1734 | } | 1734 | } |
| 1735 | } | 1735 | } |
| 1736 | 1736 | ||
| 1737 | static void ath10k_pci_fw_crashed_dump(struct ath10k *ar) | 1737 | static void ath10k_pci_fw_dump_work(struct work_struct *work) |
| 1738 | { | 1738 | { |
| 1739 | struct ath10k_pci *ar_pci = container_of(work, struct ath10k_pci, | ||
| 1740 | dump_work); | ||
| 1739 | struct ath10k_fw_crash_data *crash_data; | 1741 | struct ath10k_fw_crash_data *crash_data; |
| 1742 | struct ath10k *ar = ar_pci->ar; | ||
| 1740 | char guid[UUID_STRING_LEN + 1]; | 1743 | char guid[UUID_STRING_LEN + 1]; |
| 1741 | 1744 | ||
| 1742 | spin_lock_bh(&ar->data_lock); | 1745 | mutex_lock(&ar->dump_mutex); |
| 1743 | 1746 | ||
| 1747 | spin_lock_bh(&ar->data_lock); | ||
| 1744 | ar->stats.fw_crash_counter++; | 1748 | ar->stats.fw_crash_counter++; |
| 1749 | spin_unlock_bh(&ar->data_lock); | ||
| 1745 | 1750 | ||
| 1746 | crash_data = ath10k_coredump_new(ar); | 1751 | crash_data = ath10k_coredump_new(ar); |
| 1747 | 1752 | ||
| @@ -1756,11 +1761,18 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar) | |||
| 1756 | ath10k_ce_dump_registers(ar, crash_data); | 1761 | ath10k_ce_dump_registers(ar, crash_data); |
| 1757 | ath10k_pci_dump_memory(ar, crash_data); | 1762 | ath10k_pci_dump_memory(ar, crash_data); |
| 1758 | 1763 | ||
| 1759 | spin_unlock_bh(&ar->data_lock); | 1764 | mutex_unlock(&ar->dump_mutex); |
| 1760 | 1765 | ||
| 1761 | queue_work(ar->workqueue, &ar->restart_work); | 1766 | queue_work(ar->workqueue, &ar->restart_work); |
| 1762 | } | 1767 | } |
| 1763 | 1768 | ||
| 1769 | static void ath10k_pci_fw_crashed_dump(struct ath10k *ar) | ||
| 1770 | { | ||
| 1771 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | ||
| 1772 | |||
| 1773 | queue_work(ar->workqueue, &ar_pci->dump_work); | ||
| 1774 | } | ||
| 1775 | |||
| 1764 | void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe, | 1776 | void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe, |
| 1765 | int force) | 1777 | int force) |
| 1766 | { | 1778 | { |
| @@ -3442,6 +3454,8 @@ int ath10k_pci_setup_resource(struct ath10k *ar) | |||
| 3442 | spin_lock_init(&ar_pci->ps_lock); | 3454 | spin_lock_init(&ar_pci->ps_lock); |
| 3443 | mutex_init(&ar_pci->ce_diag_mutex); | 3455 | mutex_init(&ar_pci->ce_diag_mutex); |
| 3444 | 3456 | ||
| 3457 | INIT_WORK(&ar_pci->dump_work, ath10k_pci_fw_dump_work); | ||
| 3458 | |||
| 3445 | timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0); | 3459 | timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0); |
| 3446 | 3460 | ||
| 3447 | if (QCA_REV_6174(ar) || QCA_REV_9377(ar)) | 3461 | if (QCA_REV_6174(ar) || QCA_REV_9377(ar)) |
diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h index 3773c79f322f..4455ed6c5275 100644 --- a/drivers/net/wireless/ath/ath10k/pci.h +++ b/drivers/net/wireless/ath/ath10k/pci.h | |||
| @@ -121,6 +121,8 @@ struct ath10k_pci { | |||
| 121 | /* For protecting ce_diag */ | 121 | /* For protecting ce_diag */ |
| 122 | struct mutex ce_diag_mutex; | 122 | struct mutex ce_diag_mutex; |
| 123 | 123 | ||
| 124 | struct work_struct dump_work; | ||
| 125 | |||
| 124 | struct ath10k_ce ce; | 126 | struct ath10k_ce ce; |
| 125 | struct timer_list rx_post_retry; | 127 | struct timer_list rx_post_retry; |
| 126 | 128 | ||
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 773d428ff1b0..b17e1ca40995 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
| @@ -1938,12 +1938,15 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) | |||
| 1938 | goto out; | 1938 | goto out; |
| 1939 | 1939 | ||
| 1940 | while ((queue = ieee80211_next_txq(hw, txq->mac80211_qnum))) { | 1940 | while ((queue = ieee80211_next_txq(hw, txq->mac80211_qnum))) { |
| 1941 | bool force; | ||
| 1942 | |||
| 1941 | tid = (struct ath_atx_tid *)queue->drv_priv; | 1943 | tid = (struct ath_atx_tid *)queue->drv_priv; |
| 1942 | 1944 | ||
| 1943 | ret = ath_tx_sched_aggr(sc, txq, tid); | 1945 | ret = ath_tx_sched_aggr(sc, txq, tid); |
| 1944 | ath_dbg(common, QUEUE, "ath_tx_sched_aggr returned %d\n", ret); | 1946 | ath_dbg(common, QUEUE, "ath_tx_sched_aggr returned %d\n", ret); |
| 1945 | 1947 | ||
| 1946 | ieee80211_return_txq(hw, queue); | 1948 | force = !skb_queue_empty(&tid->retry_q); |
| 1949 | ieee80211_return_txq(hw, queue, force); | ||
| 1947 | } | 1950 | } |
| 1948 | 1951 | ||
| 1949 | out: | 1952 | out: |
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c index fdc56f821b5a..0a87d87fbb4f 100644 --- a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c +++ b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c | |||
| @@ -82,6 +82,7 @@ | |||
| 82 | #define IWL_22000_HR_A0_FW_PRE "iwlwifi-QuQnj-a0-hr-a0-" | 82 | #define IWL_22000_HR_A0_FW_PRE "iwlwifi-QuQnj-a0-hr-a0-" |
| 83 | #define IWL_22000_SU_Z0_FW_PRE "iwlwifi-su-z0-" | 83 | #define IWL_22000_SU_Z0_FW_PRE "iwlwifi-su-z0-" |
| 84 | #define IWL_QU_B_JF_B_FW_PRE "iwlwifi-Qu-b0-jf-b0-" | 84 | #define IWL_QU_B_JF_B_FW_PRE "iwlwifi-Qu-b0-jf-b0-" |
| 85 | #define IWL_QUZ_A_HR_B_FW_PRE "iwlwifi-QuZ-a0-hr-b0-" | ||
| 85 | #define IWL_QNJ_B_JF_B_FW_PRE "iwlwifi-QuQnj-b0-jf-b0-" | 86 | #define IWL_QNJ_B_JF_B_FW_PRE "iwlwifi-QuQnj-b0-jf-b0-" |
| 86 | #define IWL_CC_A_FW_PRE "iwlwifi-cc-a0-" | 87 | #define IWL_CC_A_FW_PRE "iwlwifi-cc-a0-" |
| 87 | #define IWL_22000_SO_A_JF_B_FW_PRE "iwlwifi-so-a0-jf-b0-" | 88 | #define IWL_22000_SO_A_JF_B_FW_PRE "iwlwifi-so-a0-jf-b0-" |
| @@ -105,8 +106,8 @@ | |||
| 105 | IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode" | 106 | IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode" |
| 106 | #define IWL_22000_SU_Z0_MODULE_FIRMWARE(api) \ | 107 | #define IWL_22000_SU_Z0_MODULE_FIRMWARE(api) \ |
| 107 | IWL_22000_SU_Z0_FW_PRE __stringify(api) ".ucode" | 108 | IWL_22000_SU_Z0_FW_PRE __stringify(api) ".ucode" |
| 108 | #define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \ | 109 | #define IWL_QUZ_A_HR_B_MODULE_FIRMWARE(api) \ |
| 109 | IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode" | 110 | IWL_QUZ_A_HR_B_FW_PRE __stringify(api) ".ucode" |
| 110 | #define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \ | 111 | #define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \ |
| 111 | IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode" | 112 | IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode" |
| 112 | #define IWL_QNJ_B_JF_B_MODULE_FIRMWARE(api) \ | 113 | #define IWL_QNJ_B_JF_B_MODULE_FIRMWARE(api) \ |
| @@ -200,7 +201,7 @@ static const struct iwl_ht_params iwl_22000_ht_params = { | |||
| 200 | #define IWL_DEVICE_AX210 \ | 201 | #define IWL_DEVICE_AX210 \ |
| 201 | IWL_DEVICE_AX200_COMMON, \ | 202 | IWL_DEVICE_AX200_COMMON, \ |
| 202 | .device_family = IWL_DEVICE_FAMILY_AX210, \ | 203 | .device_family = IWL_DEVICE_FAMILY_AX210, \ |
| 203 | .base_params = &iwl_22000_base_params, \ | 204 | .base_params = &iwl_22560_base_params, \ |
| 204 | .csr = &iwl_csr_v1, \ | 205 | .csr = &iwl_csr_v1, \ |
| 205 | .min_txq_size = 128 | 206 | .min_txq_size = 128 |
| 206 | 207 | ||
| @@ -235,8 +236,20 @@ const struct iwl_cfg iwl_ax101_cfg_qu_hr = { | |||
| 235 | .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, | 236 | .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, |
| 236 | }; | 237 | }; |
| 237 | 238 | ||
| 238 | const struct iwl_cfg iwl22260_2ax_cfg = { | 239 | const struct iwl_cfg iwl_ax101_cfg_quz_hr = { |
| 239 | .name = "Intel(R) Wireless-AX 22260", | 240 | .name = "Intel(R) Wi-Fi 6 AX101", |
| 241 | .fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE, | ||
| 242 | IWL_DEVICE_22500, | ||
| 243 | /* | ||
| 244 | * This device doesn't support receiving BlockAck with a large bitmap | ||
| 245 | * so we need to restrict the size of transmitted aggregation to the | ||
| 246 | * HT size; mac80211 would otherwise pick the HE max (256) by default. | ||
| 247 | */ | ||
| 248 | .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT, | ||
| 249 | }; | ||
| 250 | |||
| 251 | const struct iwl_cfg iwl_ax200_cfg_cc = { | ||
| 252 | .name = "Intel(R) Wi-Fi 6 AX200 160MHz", | ||
| 240 | .fw_name_pre = IWL_CC_A_FW_PRE, | 253 | .fw_name_pre = IWL_CC_A_FW_PRE, |
| 241 | IWL_DEVICE_22500, | 254 | IWL_DEVICE_22500, |
| 242 | /* | 255 | /* |
| @@ -249,7 +262,7 @@ const struct iwl_cfg iwl22260_2ax_cfg = { | |||
| 249 | }; | 262 | }; |
| 250 | 263 | ||
| 251 | const struct iwl_cfg killer1650x_2ax_cfg = { | 264 | const struct iwl_cfg killer1650x_2ax_cfg = { |
| 252 | .name = "Killer(R) Wireless-AX 1650x Wireless Network Adapter (200NGW)", | 265 | .name = "Killer(R) Wi-Fi 6 AX1650x 160MHz Wireless Network Adapter (200NGW)", |
| 253 | .fw_name_pre = IWL_CC_A_FW_PRE, | 266 | .fw_name_pre = IWL_CC_A_FW_PRE, |
| 254 | IWL_DEVICE_22500, | 267 | IWL_DEVICE_22500, |
| 255 | /* | 268 | /* |
| @@ -262,7 +275,7 @@ const struct iwl_cfg killer1650x_2ax_cfg = { | |||
| 262 | }; | 275 | }; |
| 263 | 276 | ||
| 264 | const struct iwl_cfg killer1650w_2ax_cfg = { | 277 | const struct iwl_cfg killer1650w_2ax_cfg = { |
| 265 | .name = "Killer(R) Wireless-AX 1650w Wireless Network Adapter (200D2W)", | 278 | .name = "Killer(R) Wi-Fi 6 AX1650w 160MHz Wireless Network Adapter (200D2W)", |
| 266 | .fw_name_pre = IWL_CC_A_FW_PRE, | 279 | .fw_name_pre = IWL_CC_A_FW_PRE, |
| 267 | IWL_DEVICE_22500, | 280 | IWL_DEVICE_22500, |
| 268 | /* | 281 | /* |
| @@ -328,7 +341,7 @@ const struct iwl_cfg killer1550s_2ac_cfg_qu_b0_jf_b0 = { | |||
| 328 | }; | 341 | }; |
| 329 | 342 | ||
| 330 | const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0 = { | 343 | const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0 = { |
| 331 | .name = "Killer(R) Wireless-AX 1650i Wireless Network Adapter (22560NGW)", | 344 | .name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW)", |
| 332 | .fw_name_pre = IWL_22000_QU_B_HR_B_FW_PRE, | 345 | .fw_name_pre = IWL_22000_QU_B_HR_B_FW_PRE, |
| 333 | IWL_DEVICE_22500, | 346 | IWL_DEVICE_22500, |
| 334 | /* | 347 | /* |
| @@ -340,7 +353,7 @@ const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0 = { | |||
| 340 | }; | 353 | }; |
| 341 | 354 | ||
| 342 | const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0 = { | 355 | const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0 = { |
| 343 | .name = "Killer(R) Wireless-AX 1650s Wireless Network Adapter (22560D2W)", | 356 | .name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201D2W)", |
| 344 | .fw_name_pre = IWL_22000_QU_B_HR_B_FW_PRE, | 357 | .fw_name_pre = IWL_22000_QU_B_HR_B_FW_PRE, |
| 345 | IWL_DEVICE_22500, | 358 | IWL_DEVICE_22500, |
| 346 | /* | 359 | /* |
| @@ -444,6 +457,7 @@ MODULE_FIRMWARE(IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); | |||
| 444 | MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); | 457 | MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); |
| 445 | MODULE_FIRMWARE(IWL_22000_SU_Z0_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); | 458 | MODULE_FIRMWARE(IWL_22000_SU_Z0_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); |
| 446 | MODULE_FIRMWARE(IWL_QU_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); | 459 | MODULE_FIRMWARE(IWL_QU_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); |
| 460 | MODULE_FIRMWARE(IWL_QUZ_A_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); | ||
| 447 | MODULE_FIRMWARE(IWL_QNJ_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); | 461 | MODULE_FIRMWARE(IWL_QNJ_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); |
| 448 | MODULE_FIRMWARE(IWL_CC_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); | 462 | MODULE_FIRMWARE(IWL_CC_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); |
| 449 | MODULE_FIRMWARE(IWL_22000_SO_A_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); | 463 | MODULE_FIRMWARE(IWL_22000_SO_A_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/5000.c b/drivers/net/wireless/intel/iwlwifi/cfg/5000.c index 575a7022d045..3846064d51a5 100644 --- a/drivers/net/wireless/intel/iwlwifi/cfg/5000.c +++ b/drivers/net/wireless/intel/iwlwifi/cfg/5000.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | * | 2 | * |
| 3 | * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. |
| 4 | * Copyright(c) 2018 Intel Corporation | 4 | * Copyright(c) 2018 - 2019 Intel Corporation |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of version 2 of the GNU General Public License as | 7 | * under the terms of version 2 of the GNU General Public License as |
| @@ -136,6 +136,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
| 136 | .ht_params = &iwl5000_ht_params, | 136 | .ht_params = &iwl5000_ht_params, |
| 137 | .led_mode = IWL_LED_BLINK, | 137 | .led_mode = IWL_LED_BLINK, |
| 138 | .internal_wimax_coex = true, | 138 | .internal_wimax_coex = true, |
| 139 | .csr = &iwl_csr_v1, | ||
| 139 | }; | 140 | }; |
| 140 | 141 | ||
| 141 | #define IWL_DEVICE_5150 \ | 142 | #define IWL_DEVICE_5150 \ |
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c index f119c49cd39c..d7380016f1c0 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c | |||
| @@ -1614,6 +1614,7 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, | |||
| 1614 | if (!range) { | 1614 | if (!range) { |
| 1615 | IWL_ERR(fwrt, "Failed to fill region header: id=%d, type=%d\n", | 1615 | IWL_ERR(fwrt, "Failed to fill region header: id=%d, type=%d\n", |
| 1616 | le32_to_cpu(reg->region_id), type); | 1616 | le32_to_cpu(reg->region_id), type); |
| 1617 | memset(*data, 0, le32_to_cpu((*data)->len)); | ||
| 1617 | return; | 1618 | return; |
| 1618 | } | 1619 | } |
| 1619 | 1620 | ||
| @@ -1623,6 +1624,7 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, | |||
| 1623 | if (range_size < 0) { | 1624 | if (range_size < 0) { |
| 1624 | IWL_ERR(fwrt, "Failed to dump region: id=%d, type=%d\n", | 1625 | IWL_ERR(fwrt, "Failed to dump region: id=%d, type=%d\n", |
| 1625 | le32_to_cpu(reg->region_id), type); | 1626 | le32_to_cpu(reg->region_id), type); |
| 1627 | memset(*data, 0, le32_to_cpu((*data)->len)); | ||
| 1626 | return; | 1628 | return; |
| 1627 | } | 1629 | } |
| 1628 | range = range + range_size; | 1630 | range = range + range_size; |
| @@ -1807,12 +1809,12 @@ _iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt, | |||
| 1807 | 1809 | ||
| 1808 | trigger = fwrt->dump.active_trigs[id].trig; | 1810 | trigger = fwrt->dump.active_trigs[id].trig; |
| 1809 | 1811 | ||
| 1810 | size = sizeof(*dump_file); | 1812 | size = iwl_fw_ini_get_trigger_len(fwrt, trigger); |
| 1811 | size += iwl_fw_ini_get_trigger_len(fwrt, trigger); | ||
| 1812 | |||
| 1813 | if (!size) | 1813 | if (!size) |
| 1814 | return NULL; | 1814 | return NULL; |
| 1815 | 1815 | ||
| 1816 | size += sizeof(*dump_file); | ||
| 1817 | |||
| 1816 | dump_file = vzalloc(size); | 1818 | dump_file = vzalloc(size); |
| 1817 | if (!dump_file) | 1819 | if (!dump_file) |
| 1818 | return NULL; | 1820 | return NULL; |
| @@ -1942,14 +1944,10 @@ int iwl_fw_dbg_error_collect(struct iwl_fw_runtime *fwrt, | |||
| 1942 | iwl_dump_error_desc->len = 0; | 1944 | iwl_dump_error_desc->len = 0; |
| 1943 | 1945 | ||
| 1944 | ret = iwl_fw_dbg_collect_desc(fwrt, iwl_dump_error_desc, false, 0); | 1946 | ret = iwl_fw_dbg_collect_desc(fwrt, iwl_dump_error_desc, false, 0); |
| 1945 | if (ret) { | 1947 | if (ret) |
| 1946 | kfree(iwl_dump_error_desc); | 1948 | kfree(iwl_dump_error_desc); |
| 1947 | } else { | 1949 | else |
| 1948 | set_bit(STATUS_FW_WAIT_DUMP, &fwrt->trans->status); | 1950 | iwl_trans_sync_nmi(fwrt->trans); |
| 1949 | |||
| 1950 | /* trigger nmi to halt the fw */ | ||
| 1951 | iwl_force_nmi(fwrt->trans); | ||
| 1952 | } | ||
| 1953 | 1951 | ||
| 1954 | return ret; | 1952 | return ret; |
| 1955 | } | 1953 | } |
| @@ -2489,22 +2487,6 @@ IWL_EXPORT_SYMBOL(iwl_fw_dbg_apply_point); | |||
| 2489 | 2487 | ||
| 2490 | void iwl_fwrt_stop_device(struct iwl_fw_runtime *fwrt) | 2488 | void iwl_fwrt_stop_device(struct iwl_fw_runtime *fwrt) |
| 2491 | { | 2489 | { |
| 2492 | /* if the wait event timeout elapses instead of wake up then | ||
| 2493 | * the driver did not receive NMI interrupt and can not assume the FW | ||
| 2494 | * is halted | ||
| 2495 | */ | ||
| 2496 | int ret = wait_event_timeout(fwrt->trans->fw_halt_waitq, | ||
| 2497 | !test_bit(STATUS_FW_WAIT_DUMP, | ||
| 2498 | &fwrt->trans->status), | ||
| 2499 | msecs_to_jiffies(2000)); | ||
| 2500 | if (!ret) { | ||
| 2501 | /* failed to receive NMI interrupt, assuming the FW is stuck */ | ||
| 2502 | set_bit(STATUS_FW_ERROR, &fwrt->trans->status); | ||
| 2503 | |||
| 2504 | clear_bit(STATUS_FW_WAIT_DUMP, &fwrt->trans->status); | ||
| 2505 | } | ||
| 2506 | |||
| 2507 | /* Assuming the op mode mutex is held at this point */ | ||
| 2508 | iwl_fw_dbg_collect_sync(fwrt); | 2490 | iwl_fw_dbg_collect_sync(fwrt); |
| 2509 | 2491 | ||
| 2510 | iwl_trans_stop_device(fwrt->trans); | 2492 | iwl_trans_stop_device(fwrt->trans); |
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h index 641c95d03b15..e06407dc088b 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/file.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h | |||
| @@ -93,7 +93,7 @@ struct iwl_ucode_header { | |||
| 93 | } u; | 93 | } u; |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | #define IWL_UCODE_INI_TLV_GROUP BIT(24) | 96 | #define IWL_UCODE_INI_TLV_GROUP 0x1000000 |
| 97 | 97 | ||
| 98 | /* | 98 | /* |
| 99 | * new TLV uCode file layout | 99 | * new TLV uCode file layout |
| @@ -148,11 +148,14 @@ enum iwl_ucode_tlv_type { | |||
| 148 | IWL_UCODE_TLV_UMAC_DEBUG_ADDRS = 54, | 148 | IWL_UCODE_TLV_UMAC_DEBUG_ADDRS = 54, |
| 149 | IWL_UCODE_TLV_LMAC_DEBUG_ADDRS = 55, | 149 | IWL_UCODE_TLV_LMAC_DEBUG_ADDRS = 55, |
| 150 | IWL_UCODE_TLV_FW_RECOVERY_INFO = 57, | 150 | IWL_UCODE_TLV_FW_RECOVERY_INFO = 57, |
| 151 | IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION = IWL_UCODE_INI_TLV_GROUP | 0x1, | 151 | |
| 152 | IWL_UCODE_TLV_TYPE_HCMD = IWL_UCODE_INI_TLV_GROUP | 0x2, | 152 | IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION = IWL_UCODE_INI_TLV_GROUP + 0x1, |
| 153 | IWL_UCODE_TLV_TYPE_REGIONS = IWL_UCODE_INI_TLV_GROUP | 0x3, | 153 | IWL_UCODE_TLV_DEBUG_BASE = IWL_UCODE_TLV_TYPE_BUFFER_ALLOCATION, |
| 154 | IWL_UCODE_TLV_TYPE_TRIGGERS = IWL_UCODE_INI_TLV_GROUP | 0x4, | 154 | IWL_UCODE_TLV_TYPE_HCMD = IWL_UCODE_INI_TLV_GROUP + 0x2, |
| 155 | IWL_UCODE_TLV_TYPE_DEBUG_FLOW = IWL_UCODE_INI_TLV_GROUP | 0x5, | 155 | IWL_UCODE_TLV_TYPE_REGIONS = IWL_UCODE_INI_TLV_GROUP + 0x3, |
| 156 | IWL_UCODE_TLV_TYPE_TRIGGERS = IWL_UCODE_INI_TLV_GROUP + 0x4, | ||
| 157 | IWL_UCODE_TLV_TYPE_DEBUG_FLOW = IWL_UCODE_INI_TLV_GROUP + 0x5, | ||
| 158 | IWL_UCODE_TLV_DEBUG_MAX = IWL_UCODE_TLV_TYPE_DEBUG_FLOW, | ||
| 156 | 159 | ||
| 157 | /* TLVs 0x1000-0x2000 are for internal driver usage */ | 160 | /* TLVs 0x1000-0x2000 are for internal driver usage */ |
| 158 | IWL_UCODE_TLV_FW_DBG_DUMP_LST = 0x1000, | 161 | IWL_UCODE_TLV_FW_DBG_DUMP_LST = 0x1000, |
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/init.c b/drivers/net/wireless/intel/iwlwifi/fw/init.c index 7adf4e4e841a..12310e3d2fc5 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/init.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/init.c | |||
| @@ -76,7 +76,6 @@ void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans, | |||
| 76 | fwrt->ops_ctx = ops_ctx; | 76 | fwrt->ops_ctx = ops_ctx; |
| 77 | INIT_DELAYED_WORK(&fwrt->dump.wk, iwl_fw_error_dump_wk); | 77 | INIT_DELAYED_WORK(&fwrt->dump.wk, iwl_fw_error_dump_wk); |
| 78 | iwl_fwrt_dbgfs_register(fwrt, dbgfs_dir); | 78 | iwl_fwrt_dbgfs_register(fwrt, dbgfs_dir); |
| 79 | init_waitqueue_head(&fwrt->trans->fw_halt_waitq); | ||
| 80 | } | 79 | } |
| 81 | IWL_EXPORT_SYMBOL(iwl_fw_runtime_init); | 80 | IWL_EXPORT_SYMBOL(iwl_fw_runtime_init); |
| 82 | 81 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h index f5f87773667b..93070848280a 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h | |||
| @@ -549,8 +549,9 @@ extern const struct iwl_cfg iwl22000_2ac_cfg_hr; | |||
| 549 | extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb; | 549 | extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb; |
| 550 | extern const struct iwl_cfg iwl22000_2ac_cfg_jf; | 550 | extern const struct iwl_cfg iwl22000_2ac_cfg_jf; |
| 551 | extern const struct iwl_cfg iwl_ax101_cfg_qu_hr; | 551 | extern const struct iwl_cfg iwl_ax101_cfg_qu_hr; |
| 552 | extern const struct iwl_cfg iwl_ax101_cfg_quz_hr; | ||
| 552 | extern const struct iwl_cfg iwl22000_2ax_cfg_hr; | 553 | extern const struct iwl_cfg iwl22000_2ax_cfg_hr; |
| 553 | extern const struct iwl_cfg iwl22260_2ax_cfg; | 554 | extern const struct iwl_cfg iwl_ax200_cfg_cc; |
| 554 | extern const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0; | 555 | extern const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0; |
| 555 | extern const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0; | 556 | extern const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0; |
| 556 | extern const struct iwl_cfg killer1650x_2ax_cfg; | 557 | extern const struct iwl_cfg killer1650x_2ax_cfg; |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h index aea6d03e545a..e539bc94eff7 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h | |||
| @@ -327,6 +327,7 @@ enum { | |||
| 327 | #define CSR_HW_REV_TYPE_NONE (0x00001F0) | 327 | #define CSR_HW_REV_TYPE_NONE (0x00001F0) |
| 328 | #define CSR_HW_REV_TYPE_QNJ (0x0000360) | 328 | #define CSR_HW_REV_TYPE_QNJ (0x0000360) |
| 329 | #define CSR_HW_REV_TYPE_QNJ_B0 (0x0000364) | 329 | #define CSR_HW_REV_TYPE_QNJ_B0 (0x0000364) |
| 330 | #define CSR_HW_REV_TYPE_QUZ (0x0000354) | ||
| 330 | #define CSR_HW_REV_TYPE_HR_CDB (0x0000340) | 331 | #define CSR_HW_REV_TYPE_HR_CDB (0x0000340) |
| 331 | #define CSR_HW_REV_TYPE_SO (0x0000370) | 332 | #define CSR_HW_REV_TYPE_SO (0x0000370) |
| 332 | #define CSR_HW_REV_TYPE_TY (0x0000420) | 333 | #define CSR_HW_REV_TYPE_TY (0x0000420) |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c index 5798f434f68f..c7070760a10a 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | |||
| @@ -126,7 +126,8 @@ void iwl_alloc_dbg_tlv(struct iwl_trans *trans, size_t len, const u8 *data, | |||
| 126 | len -= ALIGN(tlv_len, 4); | 126 | len -= ALIGN(tlv_len, 4); |
| 127 | data += sizeof(*tlv) + ALIGN(tlv_len, 4); | 127 | data += sizeof(*tlv) + ALIGN(tlv_len, 4); |
| 128 | 128 | ||
| 129 | if (!(tlv_type & IWL_UCODE_INI_TLV_GROUP)) | 129 | if (tlv_type < IWL_UCODE_TLV_DEBUG_BASE || |
| 130 | tlv_type > IWL_UCODE_TLV_DEBUG_MAX) | ||
| 130 | continue; | 131 | continue; |
| 131 | 132 | ||
| 132 | hdr = (void *)&tlv->data[0]; | 133 | hdr = (void *)&tlv->data[0]; |
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h index bbebbf3efd57..d8690acee40c 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h | |||
| @@ -338,7 +338,6 @@ enum iwl_d3_status { | |||
| 338 | * are sent | 338 | * are sent |
| 339 | * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent | 339 | * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent |
| 340 | * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation | 340 | * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation |
| 341 | * @STATUS_FW_WAIT_DUMP: if set, wait until cleared before collecting dump | ||
| 342 | */ | 341 | */ |
| 343 | enum iwl_trans_status { | 342 | enum iwl_trans_status { |
| 344 | STATUS_SYNC_HCMD_ACTIVE, | 343 | STATUS_SYNC_HCMD_ACTIVE, |
| @@ -351,7 +350,6 @@ enum iwl_trans_status { | |||
| 351 | STATUS_TRANS_GOING_IDLE, | 350 | STATUS_TRANS_GOING_IDLE, |
| 352 | STATUS_TRANS_IDLE, | 351 | STATUS_TRANS_IDLE, |
| 353 | STATUS_TRANS_DEAD, | 352 | STATUS_TRANS_DEAD, |
| 354 | STATUS_FW_WAIT_DUMP, | ||
| 355 | }; | 353 | }; |
| 356 | 354 | ||
| 357 | static inline int | 355 | static inline int |
| @@ -618,6 +616,7 @@ struct iwl_trans_ops { | |||
| 618 | struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans, | 616 | struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans, |
| 619 | u32 dump_mask); | 617 | u32 dump_mask); |
| 620 | void (*debugfs_cleanup)(struct iwl_trans *trans); | 618 | void (*debugfs_cleanup)(struct iwl_trans *trans); |
| 619 | void (*sync_nmi)(struct iwl_trans *trans); | ||
| 621 | }; | 620 | }; |
| 622 | 621 | ||
| 623 | /** | 622 | /** |
| @@ -831,7 +830,6 @@ struct iwl_trans { | |||
| 831 | u32 lmac_error_event_table[2]; | 830 | u32 lmac_error_event_table[2]; |
| 832 | u32 umac_error_event_table; | 831 | u32 umac_error_event_table; |
| 833 | unsigned int error_event_table_tlv_status; | 832 | unsigned int error_event_table_tlv_status; |
| 834 | wait_queue_head_t fw_halt_waitq; | ||
| 835 | 833 | ||
| 836 | /* pointer to trans specific struct */ | 834 | /* pointer to trans specific struct */ |
| 837 | /*Ensure that this pointer will always be aligned to sizeof pointer */ | 835 | /*Ensure that this pointer will always be aligned to sizeof pointer */ |
| @@ -1239,10 +1237,12 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans) | |||
| 1239 | /* prevent double restarts due to the same erroneous FW */ | 1237 | /* prevent double restarts due to the same erroneous FW */ |
| 1240 | if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) | 1238 | if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) |
| 1241 | iwl_op_mode_nic_error(trans->op_mode); | 1239 | iwl_op_mode_nic_error(trans->op_mode); |
| 1240 | } | ||
| 1242 | 1241 | ||
| 1243 | if (test_and_clear_bit(STATUS_FW_WAIT_DUMP, &trans->status)) | 1242 | static inline void iwl_trans_sync_nmi(struct iwl_trans *trans) |
| 1244 | wake_up(&trans->fw_halt_waitq); | 1243 | { |
| 1245 | 1244 | if (trans->ops->sync_nmi) | |
| 1245 | trans->ops->sync_nmi(trans); | ||
| 1246 | } | 1246 | } |
| 1247 | 1247 | ||
| 1248 | /***************************************************** | 1248 | /***************************************************** |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c index 2453ceabf00d..6925527d8457 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c | |||
| @@ -774,8 +774,7 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
| 774 | return; | 774 | return; |
| 775 | 775 | ||
| 776 | mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); | 776 | mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); |
| 777 | 777 | if (IS_ERR_OR_NULL(mvmvif->dbgfs_dir)) { | |
| 778 | if (!mvmvif->dbgfs_dir) { | ||
| 779 | IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n", | 778 | IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n", |
| 780 | dbgfs_dir); | 779 | dbgfs_dir); |
| 781 | return; | 780 | return; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index 00a47f6f1d81..ab68b5d53ec9 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c | |||
| @@ -1121,7 +1121,9 @@ int iwl_mvm_up(struct iwl_mvm *mvm) | |||
| 1121 | ret = iwl_mvm_load_rt_fw(mvm); | 1121 | ret = iwl_mvm_load_rt_fw(mvm); |
| 1122 | if (ret) { | 1122 | if (ret) { |
| 1123 | IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); | 1123 | IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); |
| 1124 | iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER); | 1124 | if (ret != -ERFKILL) |
| 1125 | iwl_fw_dbg_error_collect(&mvm->fwrt, | ||
| 1126 | FW_DBG_TRIGGER_DRIVER); | ||
| 1125 | goto error; | 1127 | goto error; |
| 1126 | } | 1128 | } |
| 1127 | 1129 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 3a92c09d4692..6a3b11dd2edf 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | |||
| @@ -2714,9 +2714,6 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw, | |||
| 2714 | 2714 | ||
| 2715 | iwl_mvm_mac_ctxt_remove(mvm, vif); | 2715 | iwl_mvm_mac_ctxt_remove(mvm, vif); |
| 2716 | 2716 | ||
| 2717 | kfree(mvmvif->ap_wep_key); | ||
| 2718 | mvmvif->ap_wep_key = NULL; | ||
| 2719 | |||
| 2720 | mutex_unlock(&mvm->mutex); | 2717 | mutex_unlock(&mvm->mutex); |
| 2721 | } | 2718 | } |
| 2722 | 2719 | ||
| @@ -3183,24 +3180,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |||
| 3183 | ret = iwl_mvm_update_sta(mvm, vif, sta); | 3180 | ret = iwl_mvm_update_sta(mvm, vif, sta); |
| 3184 | } else if (old_state == IEEE80211_STA_ASSOC && | 3181 | } else if (old_state == IEEE80211_STA_ASSOC && |
| 3185 | new_state == IEEE80211_STA_AUTHORIZED) { | 3182 | new_state == IEEE80211_STA_AUTHORIZED) { |
| 3186 | /* if wep is used, need to set the key for the station now */ | 3183 | ret = 0; |
| 3187 | if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) { | ||
| 3188 | mvm_sta->wep_key = | ||
| 3189 | kmemdup(mvmvif->ap_wep_key, | ||
| 3190 | sizeof(*mvmvif->ap_wep_key) + | ||
| 3191 | mvmvif->ap_wep_key->keylen, | ||
| 3192 | GFP_KERNEL); | ||
| 3193 | if (!mvm_sta->wep_key) { | ||
| 3194 | ret = -ENOMEM; | ||
| 3195 | goto out_unlock; | ||
| 3196 | } | ||
| 3197 | |||
| 3198 | ret = iwl_mvm_set_sta_key(mvm, vif, sta, | ||
| 3199 | mvm_sta->wep_key, | ||
| 3200 | STA_KEY_IDX_INVALID); | ||
| 3201 | } else { | ||
| 3202 | ret = 0; | ||
| 3203 | } | ||
| 3204 | 3184 | ||
| 3205 | /* we don't support TDLS during DCM */ | 3185 | /* we don't support TDLS during DCM */ |
| 3206 | if (iwl_mvm_phy_ctx_count(mvm) > 1) | 3186 | if (iwl_mvm_phy_ctx_count(mvm) > 1) |
| @@ -3242,17 +3222,6 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |||
| 3242 | NL80211_TDLS_DISABLE_LINK); | 3222 | NL80211_TDLS_DISABLE_LINK); |
| 3243 | } | 3223 | } |
| 3244 | 3224 | ||
| 3245 | /* Remove STA key if this is an AP using WEP */ | ||
| 3246 | if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) { | ||
| 3247 | int rm_ret = iwl_mvm_remove_sta_key(mvm, vif, sta, | ||
| 3248 | mvm_sta->wep_key); | ||
| 3249 | |||
| 3250 | if (!ret) | ||
| 3251 | ret = rm_ret; | ||
| 3252 | kfree(mvm_sta->wep_key); | ||
| 3253 | mvm_sta->wep_key = NULL; | ||
| 3254 | } | ||
| 3255 | |||
| 3256 | if (unlikely(ret && | 3225 | if (unlikely(ret && |
| 3257 | test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, | 3226 | test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, |
| 3258 | &mvm->status))) | 3227 | &mvm->status))) |
| @@ -3289,6 +3258,13 @@ static void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw, | |||
| 3289 | struct ieee80211_sta *sta, u32 changed) | 3258 | struct ieee80211_sta *sta, u32 changed) |
| 3290 | { | 3259 | { |
| 3291 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); | 3260 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| 3261 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
| 3262 | |||
| 3263 | if (changed & (IEEE80211_RC_BW_CHANGED | | ||
| 3264 | IEEE80211_RC_SUPP_RATES_CHANGED | | ||
| 3265 | IEEE80211_RC_NSS_CHANGED)) | ||
| 3266 | iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, | ||
| 3267 | true); | ||
| 3292 | 3268 | ||
| 3293 | if (vif->type == NL80211_IFTYPE_STATION && | 3269 | if (vif->type == NL80211_IFTYPE_STATION && |
| 3294 | changed & IEEE80211_RC_NSS_CHANGED) | 3270 | changed & IEEE80211_RC_NSS_CHANGED) |
| @@ -3439,20 +3415,12 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |||
| 3439 | break; | 3415 | break; |
| 3440 | case WLAN_CIPHER_SUITE_WEP40: | 3416 | case WLAN_CIPHER_SUITE_WEP40: |
| 3441 | case WLAN_CIPHER_SUITE_WEP104: | 3417 | case WLAN_CIPHER_SUITE_WEP104: |
| 3442 | if (vif->type == NL80211_IFTYPE_AP) { | 3418 | if (vif->type == NL80211_IFTYPE_STATION) |
| 3443 | struct iwl_mvm_vif *mvmvif = | 3419 | break; |
| 3444 | iwl_mvm_vif_from_mac80211(vif); | 3420 | if (iwl_mvm_has_new_tx_api(mvm)) |
| 3445 | 3421 | return -EOPNOTSUPP; | |
| 3446 | mvmvif->ap_wep_key = kmemdup(key, | 3422 | /* support HW crypto on TX */ |
| 3447 | sizeof(*key) + key->keylen, | 3423 | return 0; |
| 3448 | GFP_KERNEL); | ||
| 3449 | if (!mvmvif->ap_wep_key) | ||
| 3450 | return -ENOMEM; | ||
| 3451 | } | ||
| 3452 | |||
| 3453 | if (vif->type != NL80211_IFTYPE_STATION) | ||
| 3454 | return 0; | ||
| 3455 | break; | ||
| 3456 | default: | 3424 | default: |
| 3457 | /* currently FW supports only one optional cipher scheme */ | 3425 | /* currently FW supports only one optional cipher scheme */ |
| 3458 | if (hw->n_cipher_schemes && | 3426 | if (hw->n_cipher_schemes && |
| @@ -3540,12 +3508,17 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | |||
| 3540 | ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, key_offset); | 3508 | ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, key_offset); |
| 3541 | if (ret) { | 3509 | if (ret) { |
| 3542 | IWL_WARN(mvm, "set key failed\n"); | 3510 | IWL_WARN(mvm, "set key failed\n"); |
| 3511 | key->hw_key_idx = STA_KEY_IDX_INVALID; | ||
| 3543 | /* | 3512 | /* |
| 3544 | * can't add key for RX, but we don't need it | 3513 | * can't add key for RX, but we don't need it |
| 3545 | * in the device for TX so still return 0 | 3514 | * in the device for TX so still return 0, |
| 3515 | * unless we have new TX API where we cannot | ||
| 3516 | * put key material into the TX_CMD | ||
| 3546 | */ | 3517 | */ |
| 3547 | key->hw_key_idx = STA_KEY_IDX_INVALID; | 3518 | if (iwl_mvm_has_new_tx_api(mvm)) |
| 3548 | ret = 0; | 3519 | ret = -EOPNOTSUPP; |
| 3520 | else | ||
| 3521 | ret = 0; | ||
| 3549 | } | 3522 | } |
| 3550 | 3523 | ||
| 3551 | break; | 3524 | break; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index bca6f6b536d9..a50dc53df086 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | |||
| @@ -498,7 +498,6 @@ struct iwl_mvm_vif { | |||
| 498 | netdev_features_t features; | 498 | netdev_features_t features; |
| 499 | 499 | ||
| 500 | struct iwl_probe_resp_data __rcu *probe_resp_data; | 500 | struct iwl_probe_resp_data __rcu *probe_resp_data; |
| 501 | struct ieee80211_key_conf *ap_wep_key; | ||
| 502 | }; | 501 | }; |
| 503 | 502 | ||
| 504 | static inline struct iwl_mvm_vif * | 503 | static inline struct iwl_mvm_vif * |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index ba27dce4c2bb..13681b03c10e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c | |||
| @@ -834,7 +834,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
| 834 | mutex_lock(&mvm->mutex); | 834 | mutex_lock(&mvm->mutex); |
| 835 | iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE); | 835 | iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE); |
| 836 | err = iwl_run_init_mvm_ucode(mvm, true); | 836 | err = iwl_run_init_mvm_ucode(mvm, true); |
| 837 | if (err) | 837 | if (err && err != -ERFKILL) |
| 838 | iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER); | 838 | iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER); |
| 839 | if (!iwlmvm_mod_params.init_dbg || !err) | 839 | if (!iwlmvm_mod_params.init_dbg || !err) |
| 840 | iwl_mvm_stop_device(mvm); | 840 | iwl_mvm_stop_device(mvm); |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c index 1e03acf30762..b516fd1867ec 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | |||
| @@ -169,9 +169,9 @@ static inline int iwl_mvm_check_pn(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | /* iwl_mvm_create_skb Adds the rxb to a new skb */ | 171 | /* iwl_mvm_create_skb Adds the rxb to a new skb */ |
| 172 | static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr, | 172 | static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb, |
| 173 | u16 len, u8 crypt_len, | 173 | struct ieee80211_hdr *hdr, u16 len, u8 crypt_len, |
| 174 | struct iwl_rx_cmd_buffer *rxb) | 174 | struct iwl_rx_cmd_buffer *rxb) |
| 175 | { | 175 | { |
| 176 | struct iwl_rx_packet *pkt = rxb_addr(rxb); | 176 | struct iwl_rx_packet *pkt = rxb_addr(rxb); |
| 177 | struct iwl_rx_mpdu_desc *desc = (void *)pkt->data; | 177 | struct iwl_rx_mpdu_desc *desc = (void *)pkt->data; |
| @@ -204,6 +204,20 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr, | |||
| 204 | * present before copying packet data. | 204 | * present before copying packet data. |
| 205 | */ | 205 | */ |
| 206 | hdrlen += crypt_len; | 206 | hdrlen += crypt_len; |
| 207 | |||
| 208 | if (WARN_ONCE(headlen < hdrlen, | ||
| 209 | "invalid packet lengths (hdrlen=%d, len=%d, crypt_len=%d)\n", | ||
| 210 | hdrlen, len, crypt_len)) { | ||
| 211 | /* | ||
| 212 | * We warn and trace because we want to be able to see | ||
| 213 | * it in trace-cmd as well. | ||
| 214 | */ | ||
| 215 | IWL_DEBUG_RX(mvm, | ||
| 216 | "invalid packet lengths (hdrlen=%d, len=%d, crypt_len=%d)\n", | ||
| 217 | hdrlen, len, crypt_len); | ||
| 218 | return -EINVAL; | ||
| 219 | } | ||
| 220 | |||
| 207 | skb_put_data(skb, hdr, hdrlen); | 221 | skb_put_data(skb, hdr, hdrlen); |
| 208 | skb_put_data(skb, (u8 *)hdr + hdrlen + pad_len, headlen - hdrlen); | 222 | skb_put_data(skb, (u8 *)hdr + hdrlen + pad_len, headlen - hdrlen); |
| 209 | 223 | ||
| @@ -216,6 +230,8 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr, | |||
| 216 | skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset, | 230 | skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset, |
| 217 | fraglen, rxb->truesize); | 231 | fraglen, rxb->truesize); |
| 218 | } | 232 | } |
| 233 | |||
| 234 | return 0; | ||
| 219 | } | 235 | } |
| 220 | 236 | ||
| 221 | static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm, | 237 | static void iwl_mvm_add_rtap_sniffer_config(struct iwl_mvm *mvm, |
| @@ -1671,7 +1687,11 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, | |||
| 1671 | rx_status->boottime_ns = ktime_get_boot_ns(); | 1687 | rx_status->boottime_ns = ktime_get_boot_ns(); |
| 1672 | } | 1688 | } |
| 1673 | 1689 | ||
| 1674 | iwl_mvm_create_skb(skb, hdr, len, crypt_len, rxb); | 1690 | if (iwl_mvm_create_skb(mvm, skb, hdr, len, crypt_len, rxb)) { |
| 1691 | kfree_skb(skb); | ||
| 1692 | goto out; | ||
| 1693 | } | ||
| 1694 | |||
| 1675 | if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc)) | 1695 | if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc)) |
| 1676 | iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, | 1696 | iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, |
| 1677 | sta, csi); | 1697 | sta, csi); |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index 498c315291cf..98d123dd7177 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * Copyright(c) 2012 - 2015 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2012 - 2015 Intel Corporation. All rights reserved. |
| 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH | 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 10 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH | 10 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
| 11 | * Copyright(c) 2018 Intel Corporation | 11 | * Copyright(c) 2018 - 2019 Intel Corporation |
| 12 | * | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of version 2 of the GNU General Public License as | 14 | * it under the terms of version 2 of the GNU General Public License as |
| @@ -31,7 +31,7 @@ | |||
| 31 | * Copyright(c) 2012 - 2015 Intel Corporation. All rights reserved. | 31 | * Copyright(c) 2012 - 2015 Intel Corporation. All rights reserved. |
| 32 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH | 32 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 33 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH | 33 | * Copyright(c) 2016 - 2017 Intel Deutschland GmbH |
| 34 | * Copyright(c) 2018 Intel Corporation | 34 | * Copyright(c) 2018 - 2019 Intel Corporation |
| 35 | * All rights reserved. | 35 | * All rights reserved. |
| 36 | * | 36 | * |
| 37 | * Redistribution and use in source and binary forms, with or without | 37 | * Redistribution and use in source and binary forms, with or without |
| @@ -1399,7 +1399,9 @@ void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk) | |||
| 1399 | 1399 | ||
| 1400 | iwl_mvm_sta_alloc_queue(mvm, txq->sta, txq->ac, tid); | 1400 | iwl_mvm_sta_alloc_queue(mvm, txq->sta, txq->ac, tid); |
| 1401 | list_del_init(&mvmtxq->list); | 1401 | list_del_init(&mvmtxq->list); |
| 1402 | local_bh_disable(); | ||
| 1402 | iwl_mvm_mac_itxq_xmit(mvm->hw, txq); | 1403 | iwl_mvm_mac_itxq_xmit(mvm->hw, txq); |
| 1404 | local_bh_enable(); | ||
| 1403 | } | 1405 | } |
| 1404 | 1406 | ||
| 1405 | mutex_unlock(&mvm->mutex); | 1407 | mutex_unlock(&mvm->mutex); |
| @@ -2333,21 +2335,6 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
| 2333 | iwl_mvm_enable_txq(mvm, NULL, mvmvif->cab_queue, 0, &cfg, | 2335 | iwl_mvm_enable_txq(mvm, NULL, mvmvif->cab_queue, 0, &cfg, |
| 2334 | timeout); | 2336 | timeout); |
| 2335 | 2337 | ||
| 2336 | if (mvmvif->ap_wep_key) { | ||
| 2337 | u8 key_offset = iwl_mvm_set_fw_key_idx(mvm); | ||
| 2338 | |||
| 2339 | __set_bit(key_offset, mvm->fw_key_table); | ||
| 2340 | |||
| 2341 | if (key_offset == STA_KEY_IDX_INVALID) | ||
| 2342 | return -ENOSPC; | ||
| 2343 | |||
| 2344 | ret = iwl_mvm_send_sta_key(mvm, mvmvif->mcast_sta.sta_id, | ||
| 2345 | mvmvif->ap_wep_key, true, 0, NULL, 0, | ||
| 2346 | key_offset, 0); | ||
| 2347 | if (ret) | ||
| 2348 | return ret; | ||
| 2349 | } | ||
| 2350 | |||
| 2351 | return 0; | 2338 | return 0; |
| 2352 | } | 2339 | } |
| 2353 | 2340 | ||
| @@ -2419,28 +2406,6 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
| 2419 | 2406 | ||
| 2420 | iwl_mvm_disable_txq(mvm, NULL, mvmvif->cab_queue, 0, 0); | 2407 | iwl_mvm_disable_txq(mvm, NULL, mvmvif->cab_queue, 0, 0); |
| 2421 | 2408 | ||
| 2422 | if (mvmvif->ap_wep_key) { | ||
| 2423 | int i; | ||
| 2424 | |||
| 2425 | if (!__test_and_clear_bit(mvmvif->ap_wep_key->hw_key_idx, | ||
| 2426 | mvm->fw_key_table)) { | ||
| 2427 | IWL_ERR(mvm, "offset %d not used in fw key table.\n", | ||
| 2428 | mvmvif->ap_wep_key->hw_key_idx); | ||
| 2429 | return -ENOENT; | ||
| 2430 | } | ||
| 2431 | |||
| 2432 | /* track which key was deleted last */ | ||
| 2433 | for (i = 0; i < STA_KEY_MAX_NUM; i++) { | ||
| 2434 | if (mvm->fw_key_deleted[i] < U8_MAX) | ||
| 2435 | mvm->fw_key_deleted[i]++; | ||
| 2436 | } | ||
| 2437 | mvm->fw_key_deleted[mvmvif->ap_wep_key->hw_key_idx] = 0; | ||
| 2438 | ret = __iwl_mvm_remove_sta_key(mvm, mvmvif->mcast_sta.sta_id, | ||
| 2439 | mvmvif->ap_wep_key, true); | ||
| 2440 | if (ret) | ||
| 2441 | return ret; | ||
| 2442 | } | ||
| 2443 | |||
| 2444 | ret = iwl_mvm_rm_sta_common(mvm, mvmvif->mcast_sta.sta_id); | 2409 | ret = iwl_mvm_rm_sta_common(mvm, mvmvif->mcast_sta.sta_id); |
| 2445 | if (ret) | 2410 | if (ret) |
| 2446 | IWL_WARN(mvm, "Failed sending remove station\n"); | 2411 | IWL_WARN(mvm, "Failed sending remove station\n"); |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h index 79700c7310a1..b4d4071b865d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
| 9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
| 10 | * Copyright(c) 2015 - 2016 Intel Deutschland GmbH | 10 | * Copyright(c) 2015 - 2016 Intel Deutschland GmbH |
| 11 | * Copyright(c) 2018 Intel Corporation | 11 | * Copyright(c) 2018 - 2019 Intel Corporation |
| 12 | * | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of version 2 of the GNU General Public License as | 14 | * it under the terms of version 2 of the GNU General Public License as |
| @@ -31,7 +31,7 @@ | |||
| 31 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 31 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
| 32 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 32 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
| 33 | * Copyright(c) 2015 - 2016 Intel Deutschland GmbH | 33 | * Copyright(c) 2015 - 2016 Intel Deutschland GmbH |
| 34 | * Copyright(c) 2018 Intel Corporation | 34 | * Copyright(c) 2018 - 2019 Intel Corporation |
| 35 | * All rights reserved. | 35 | * All rights reserved. |
| 36 | * | 36 | * |
| 37 | * Redistribution and use in source and binary forms, with or without | 37 | * Redistribution and use in source and binary forms, with or without |
| @@ -394,7 +394,6 @@ struct iwl_mvm_rxq_dup_data { | |||
| 394 | * the BA window. To be used for UAPSD only. | 394 | * the BA window. To be used for UAPSD only. |
| 395 | * @ptk_pn: per-queue PTK PN data structures | 395 | * @ptk_pn: per-queue PTK PN data structures |
| 396 | * @dup_data: per queue duplicate packet detection data | 396 | * @dup_data: per queue duplicate packet detection data |
| 397 | * @wep_key: used in AP mode. Is a duplicate of the WEP key. | ||
| 398 | * @deferred_traffic_tid_map: indication bitmap of deferred traffic per-TID | 397 | * @deferred_traffic_tid_map: indication bitmap of deferred traffic per-TID |
| 399 | * @tx_ant: the index of the antenna to use for data tx to this station. Only | 398 | * @tx_ant: the index of the antenna to use for data tx to this station. Only |
| 400 | * used during connection establishment (e.g. for the 4 way handshake | 399 | * used during connection establishment (e.g. for the 4 way handshake |
| @@ -426,8 +425,6 @@ struct iwl_mvm_sta { | |||
| 426 | struct iwl_mvm_key_pn __rcu *ptk_pn[4]; | 425 | struct iwl_mvm_key_pn __rcu *ptk_pn[4]; |
| 427 | struct iwl_mvm_rxq_dup_data *dup_data; | 426 | struct iwl_mvm_rxq_dup_data *dup_data; |
| 428 | 427 | ||
| 429 | struct ieee80211_key_conf *wep_key; | ||
| 430 | |||
| 431 | u8 reserved_queue; | 428 | u8 reserved_queue; |
| 432 | 429 | ||
| 433 | /* Temporary, until the new TLC will control the Tx protection */ | 430 | /* Temporary, until the new TLC will control the Tx protection */ |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c index 2b94e4cef56c..9f1af8da9dc1 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c | |||
| @@ -953,14 +953,15 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
| 953 | {IWL_PCI_DEVICE(0xA0F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)}, | 953 | {IWL_PCI_DEVICE(0xA0F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)}, |
| 954 | {IWL_PCI_DEVICE(0xA0F0, 0x4070, iwl_ax101_cfg_qu_hr)}, | 954 | {IWL_PCI_DEVICE(0xA0F0, 0x4070, iwl_ax101_cfg_qu_hr)}, |
| 955 | 955 | ||
| 956 | {IWL_PCI_DEVICE(0x2723, 0x0080, iwl22260_2ax_cfg)}, | 956 | {IWL_PCI_DEVICE(0x2723, 0x0080, iwl_ax200_cfg_cc)}, |
| 957 | {IWL_PCI_DEVICE(0x2723, 0x0084, iwl22260_2ax_cfg)}, | 957 | {IWL_PCI_DEVICE(0x2723, 0x0084, iwl_ax200_cfg_cc)}, |
| 958 | {IWL_PCI_DEVICE(0x2723, 0x0088, iwl22260_2ax_cfg)}, | 958 | {IWL_PCI_DEVICE(0x2723, 0x0088, iwl_ax200_cfg_cc)}, |
| 959 | {IWL_PCI_DEVICE(0x2723, 0x008C, iwl22260_2ax_cfg)}, | 959 | {IWL_PCI_DEVICE(0x2723, 0x008C, iwl_ax200_cfg_cc)}, |
| 960 | {IWL_PCI_DEVICE(0x2723, 0x1653, killer1650w_2ax_cfg)}, | 960 | {IWL_PCI_DEVICE(0x2723, 0x1653, killer1650w_2ax_cfg)}, |
| 961 | {IWL_PCI_DEVICE(0x2723, 0x1654, killer1650x_2ax_cfg)}, | 961 | {IWL_PCI_DEVICE(0x2723, 0x1654, killer1650x_2ax_cfg)}, |
| 962 | {IWL_PCI_DEVICE(0x2723, 0x4080, iwl22260_2ax_cfg)}, | 962 | {IWL_PCI_DEVICE(0x2723, 0x2080, iwl_ax200_cfg_cc)}, |
| 963 | {IWL_PCI_DEVICE(0x2723, 0x4088, iwl22260_2ax_cfg)}, | 963 | {IWL_PCI_DEVICE(0x2723, 0x4080, iwl_ax200_cfg_cc)}, |
| 964 | {IWL_PCI_DEVICE(0x2723, 0x4088, iwl_ax200_cfg_cc)}, | ||
| 964 | 965 | ||
| 965 | {IWL_PCI_DEVICE(0x1a56, 0x1653, killer1650w_2ax_cfg)}, | 966 | {IWL_PCI_DEVICE(0x1a56, 0x1653, killer1650w_2ax_cfg)}, |
| 966 | {IWL_PCI_DEVICE(0x1a56, 0x1654, killer1650x_2ax_cfg)}, | 967 | {IWL_PCI_DEVICE(0x1a56, 0x1654, killer1650x_2ax_cfg)}, |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h index bf8b61a476c5..59213164f35e 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h | |||
| @@ -1043,7 +1043,7 @@ static inline bool iwl_pcie_dbg_on(struct iwl_trans *trans) | |||
| 1043 | 1043 | ||
| 1044 | void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state); | 1044 | void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state); |
| 1045 | void iwl_trans_pcie_dump_regs(struct iwl_trans *trans); | 1045 | void iwl_trans_pcie_dump_regs(struct iwl_trans *trans); |
| 1046 | void iwl_trans_sync_nmi(struct iwl_trans *trans); | 1046 | void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans); |
| 1047 | 1047 | ||
| 1048 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1048 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 1049 | int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans); | 1049 | int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans); |
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index fe8269d023de..c4375b868901 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c | |||
| @@ -3318,7 +3318,8 @@ static void iwl_trans_pcie_resume(struct iwl_trans *trans) | |||
| 3318 | .unref = iwl_trans_pcie_unref, \ | 3318 | .unref = iwl_trans_pcie_unref, \ |
| 3319 | .dump_data = iwl_trans_pcie_dump_data, \ | 3319 | .dump_data = iwl_trans_pcie_dump_data, \ |
| 3320 | .d3_suspend = iwl_trans_pcie_d3_suspend, \ | 3320 | .d3_suspend = iwl_trans_pcie_d3_suspend, \ |
| 3321 | .d3_resume = iwl_trans_pcie_d3_resume | 3321 | .d3_resume = iwl_trans_pcie_d3_resume, \ |
| 3322 | .sync_nmi = iwl_trans_pcie_sync_nmi | ||
| 3322 | 3323 | ||
| 3323 | #ifdef CONFIG_PM_SLEEP | 3324 | #ifdef CONFIG_PM_SLEEP |
| 3324 | #define IWL_TRANS_PM_OPS \ | 3325 | #define IWL_TRANS_PM_OPS \ |
| @@ -3542,6 +3543,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
| 3542 | } | 3543 | } |
| 3543 | } else if (cfg == &iwl_ax101_cfg_qu_hr) { | 3544 | } else if (cfg == &iwl_ax101_cfg_qu_hr) { |
| 3544 | if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == | 3545 | if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == |
| 3546 | CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) && | ||
| 3547 | trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0) { | ||
| 3548 | trans->cfg = &iwl22000_2ax_cfg_qnj_hr_b0; | ||
| 3549 | } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == | ||
| 3545 | CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR)) { | 3550 | CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR)) { |
| 3546 | trans->cfg = &iwl_ax101_cfg_qu_hr; | 3551 | trans->cfg = &iwl_ax101_cfg_qu_hr; |
| 3547 | } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == | 3552 | } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == |
| @@ -3560,7 +3565,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, | |||
| 3560 | } | 3565 | } |
| 3561 | } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == | 3566 | } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) == |
| 3562 | CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) && | 3567 | CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) && |
| 3563 | (trans->cfg != &iwl22260_2ax_cfg || | 3568 | (trans->cfg != &iwl_ax200_cfg_cc || |
| 3564 | trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0)) { | 3569 | trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0)) { |
| 3565 | u32 hw_status; | 3570 | u32 hw_status; |
| 3566 | 3571 | ||
| @@ -3637,22 +3642,29 @@ out_no_pci: | |||
| 3637 | return ERR_PTR(ret); | 3642 | return ERR_PTR(ret); |
| 3638 | } | 3643 | } |
| 3639 | 3644 | ||
| 3640 | void iwl_trans_sync_nmi(struct iwl_trans *trans) | 3645 | void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans) |
| 3641 | { | 3646 | { |
| 3647 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
| 3642 | unsigned long timeout = jiffies + IWL_TRANS_NMI_TIMEOUT; | 3648 | unsigned long timeout = jiffies + IWL_TRANS_NMI_TIMEOUT; |
| 3649 | u32 inta_addr, sw_err_bit; | ||
| 3650 | |||
| 3651 | if (trans_pcie->msix_enabled) { | ||
| 3652 | inta_addr = CSR_MSIX_HW_INT_CAUSES_AD; | ||
| 3653 | sw_err_bit = MSIX_HW_INT_CAUSES_REG_SW_ERR; | ||
| 3654 | } else { | ||
| 3655 | inta_addr = CSR_INT; | ||
| 3656 | sw_err_bit = CSR_INT_BIT_SW_ERR; | ||
| 3657 | } | ||
| 3643 | 3658 | ||
| 3644 | iwl_disable_interrupts(trans); | 3659 | iwl_disable_interrupts(trans); |
| 3645 | iwl_force_nmi(trans); | 3660 | iwl_force_nmi(trans); |
| 3646 | while (time_after(timeout, jiffies)) { | 3661 | while (time_after(timeout, jiffies)) { |
| 3647 | u32 inta_hw = iwl_read32(trans, | 3662 | u32 inta_hw = iwl_read32(trans, inta_addr); |
| 3648 | CSR_MSIX_HW_INT_CAUSES_AD); | ||
| 3649 | 3663 | ||
| 3650 | /* Error detected by uCode */ | 3664 | /* Error detected by uCode */ |
| 3651 | if (inta_hw & MSIX_HW_INT_CAUSES_REG_SW_ERR) { | 3665 | if (inta_hw & sw_err_bit) { |
| 3652 | /* Clear causes register */ | 3666 | /* Clear causes register */ |
| 3653 | iwl_write32(trans, CSR_MSIX_HW_INT_CAUSES_AD, | 3667 | iwl_write32(trans, inta_addr, inta_hw & sw_err_bit); |
| 3654 | inta_hw & | ||
| 3655 | MSIX_HW_INT_CAUSES_REG_SW_ERR); | ||
| 3656 | break; | 3668 | break; |
| 3657 | } | 3669 | } |
| 3658 | 3670 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c index 88530d9f4a54..38d110338987 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c | |||
| @@ -965,7 +965,7 @@ static int iwl_pcie_gen2_send_hcmd_sync(struct iwl_trans *trans, | |||
| 965 | cmd_str); | 965 | cmd_str); |
| 966 | ret = -ETIMEDOUT; | 966 | ret = -ETIMEDOUT; |
| 967 | 967 | ||
| 968 | iwl_trans_sync_nmi(trans); | 968 | iwl_trans_pcie_sync_nmi(trans); |
| 969 | goto cancel; | 969 | goto cancel; |
| 970 | } | 970 | } |
| 971 | 971 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c index 9fbd37d23e85..7be73e2c4681 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c | |||
| @@ -1960,7 +1960,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans, | |||
| 1960 | iwl_get_cmd_string(trans, cmd->id)); | 1960 | iwl_get_cmd_string(trans, cmd->id)); |
| 1961 | ret = -ETIMEDOUT; | 1961 | ret = -ETIMEDOUT; |
| 1962 | 1962 | ||
| 1963 | iwl_trans_sync_nmi(trans); | 1963 | iwl_trans_pcie_sync_nmi(trans); |
| 1964 | goto cancel; | 1964 | goto cancel; |
| 1965 | } | 1965 | } |
| 1966 | 1966 | ||
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 0838af04d681..524eb5805995 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
| @@ -2644,7 +2644,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, | |||
| 2644 | enum nl80211_band band; | 2644 | enum nl80211_band band; |
| 2645 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; | 2645 | const struct ieee80211_ops *ops = &mac80211_hwsim_ops; |
| 2646 | struct net *net; | 2646 | struct net *net; |
| 2647 | int idx; | 2647 | int idx, i; |
| 2648 | int n_limits = 0; | 2648 | int n_limits = 0; |
| 2649 | 2649 | ||
| 2650 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) | 2650 | if (WARN_ON(param->channels > 1 && !param->use_chanctx)) |
| @@ -2768,12 +2768,23 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, | |||
| 2768 | goto failed_hw; | 2768 | goto failed_hw; |
| 2769 | } | 2769 | } |
| 2770 | 2770 | ||
| 2771 | data->if_combination.max_interfaces = 0; | ||
| 2772 | for (i = 0; i < n_limits; i++) | ||
| 2773 | data->if_combination.max_interfaces += | ||
| 2774 | data->if_limits[i].max; | ||
| 2775 | |||
| 2771 | data->if_combination.n_limits = n_limits; | 2776 | data->if_combination.n_limits = n_limits; |
| 2772 | data->if_combination.max_interfaces = 2048; | ||
| 2773 | data->if_combination.limits = data->if_limits; | 2777 | data->if_combination.limits = data->if_limits; |
| 2774 | 2778 | ||
| 2775 | hw->wiphy->iface_combinations = &data->if_combination; | 2779 | /* |
| 2776 | hw->wiphy->n_iface_combinations = 1; | 2780 | * If we actually were asked to support combinations, |
| 2781 | * advertise them - if there's only a single thing like | ||
| 2782 | * only IBSS then don't advertise it as combinations. | ||
| 2783 | */ | ||
| 2784 | if (data->if_combination.max_interfaces > 1) { | ||
| 2785 | hw->wiphy->iface_combinations = &data->if_combination; | ||
| 2786 | hw->wiphy->n_iface_combinations = 1; | ||
| 2787 | } | ||
| 2777 | 2788 | ||
| 2778 | if (param->ciphers) { | 2789 | if (param->ciphers) { |
| 2779 | memcpy(data->ciphers, param->ciphers, | 2790 | memcpy(data->ciphers, param->ciphers, |
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index a85648342d15..d5a70340a945 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c | |||
| @@ -181,7 +181,7 @@ static int mwifiex_sdio_resume(struct device *dev) | |||
| 181 | 181 | ||
| 182 | adapter = card->adapter; | 182 | adapter = card->adapter; |
| 183 | 183 | ||
| 184 | if (test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { | 184 | if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { |
| 185 | mwifiex_dbg(adapter, WARN, | 185 | mwifiex_dbg(adapter, WARN, |
| 186 | "device already resumed\n"); | 186 | "device already resumed\n"); |
| 187 | return 0; | 187 | return 0; |
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c index d54dda67d036..3af45949e868 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c | |||
| @@ -510,6 +510,8 @@ int mt7603_register_device(struct mt7603_dev *dev) | |||
| 510 | bus_ops->rmw = mt7603_rmw; | 510 | bus_ops->rmw = mt7603_rmw; |
| 511 | dev->mt76.bus = bus_ops; | 511 | dev->mt76.bus = bus_ops; |
| 512 | 512 | ||
| 513 | spin_lock_init(&dev->ps_lock); | ||
| 514 | |||
| 513 | INIT_DELAYED_WORK(&dev->mac_work, mt7603_mac_work); | 515 | INIT_DELAYED_WORK(&dev->mac_work, mt7603_mac_work); |
| 514 | tasklet_init(&dev->pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet, | 516 | tasklet_init(&dev->pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet, |
| 515 | (unsigned long)dev); | 517 | (unsigned long)dev); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c index 5e31d7da96fc..5abc02b57818 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c | |||
| @@ -343,7 +343,7 @@ void mt7603_mac_rx_ba_reset(struct mt7603_dev *dev, void *addr, u8 tid) | |||
| 343 | MT_BA_CONTROL_1_RESET)); | 343 | MT_BA_CONTROL_1_RESET)); |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, int ssn, | 346 | void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, |
| 347 | int ba_size) | 347 | int ba_size) |
| 348 | { | 348 | { |
| 349 | u32 addr = mt7603_wtbl2_addr(wcid); | 349 | u32 addr = mt7603_wtbl2_addr(wcid); |
| @@ -358,43 +358,6 @@ void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, int ssn, | |||
| 358 | mt76_clear(dev, addr + (15 * 4), tid_mask); | 358 | mt76_clear(dev, addr + (15 * 4), tid_mask); |
| 359 | return; | 359 | return; |
| 360 | } | 360 | } |
| 361 | mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, 0, 5000); | ||
| 362 | |||
| 363 | mt7603_mac_stop(dev); | ||
| 364 | switch (tid) { | ||
| 365 | case 0: | ||
| 366 | mt76_rmw_field(dev, addr + (2 * 4), MT_WTBL2_W2_TID0_SN, ssn); | ||
| 367 | break; | ||
| 368 | case 1: | ||
| 369 | mt76_rmw_field(dev, addr + (2 * 4), MT_WTBL2_W2_TID1_SN, ssn); | ||
| 370 | break; | ||
| 371 | case 2: | ||
| 372 | mt76_rmw_field(dev, addr + (2 * 4), MT_WTBL2_W2_TID2_SN_LO, | ||
| 373 | ssn); | ||
| 374 | mt76_rmw_field(dev, addr + (3 * 4), MT_WTBL2_W3_TID2_SN_HI, | ||
| 375 | ssn >> 8); | ||
| 376 | break; | ||
| 377 | case 3: | ||
| 378 | mt76_rmw_field(dev, addr + (3 * 4), MT_WTBL2_W3_TID3_SN, ssn); | ||
| 379 | break; | ||
| 380 | case 4: | ||
| 381 | mt76_rmw_field(dev, addr + (3 * 4), MT_WTBL2_W3_TID4_SN, ssn); | ||
| 382 | break; | ||
| 383 | case 5: | ||
| 384 | mt76_rmw_field(dev, addr + (3 * 4), MT_WTBL2_W3_TID5_SN_LO, | ||
| 385 | ssn); | ||
| 386 | mt76_rmw_field(dev, addr + (4 * 4), MT_WTBL2_W4_TID5_SN_HI, | ||
| 387 | ssn >> 4); | ||
| 388 | break; | ||
| 389 | case 6: | ||
| 390 | mt76_rmw_field(dev, addr + (4 * 4), MT_WTBL2_W4_TID6_SN, ssn); | ||
| 391 | break; | ||
| 392 | case 7: | ||
| 393 | mt76_rmw_field(dev, addr + (4 * 4), MT_WTBL2_W4_TID7_SN, ssn); | ||
| 394 | break; | ||
| 395 | } | ||
| 396 | mt7603_wtbl_update(dev, wcid, MT_WTBL_UPDATE_WTBL2); | ||
| 397 | mt7603_mac_start(dev); | ||
| 398 | 361 | ||
| 399 | for (i = 7; i > 0; i--) { | 362 | for (i = 7; i > 0; i--) { |
| 400 | if (ba_size >= MT_AGG_SIZE_LIMIT(i)) | 363 | if (ba_size >= MT_AGG_SIZE_LIMIT(i)) |
| @@ -827,6 +790,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi, | |||
| 827 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 790 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 828 | struct ieee80211_tx_rate *rate = &info->control.rates[0]; | 791 | struct ieee80211_tx_rate *rate = &info->control.rates[0]; |
| 829 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 792 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
| 793 | struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data; | ||
| 830 | struct ieee80211_vif *vif = info->control.vif; | 794 | struct ieee80211_vif *vif = info->control.vif; |
| 831 | struct mt7603_vif *mvif; | 795 | struct mt7603_vif *mvif; |
| 832 | int wlan_idx; | 796 | int wlan_idx; |
| @@ -834,6 +798,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi, | |||
| 834 | int tx_count = 8; | 798 | int tx_count = 8; |
| 835 | u8 frame_type, frame_subtype; | 799 | u8 frame_type, frame_subtype; |
| 836 | u16 fc = le16_to_cpu(hdr->frame_control); | 800 | u16 fc = le16_to_cpu(hdr->frame_control); |
| 801 | u16 seqno = 0; | ||
| 837 | u8 vif_idx = 0; | 802 | u8 vif_idx = 0; |
| 838 | u32 val; | 803 | u32 val; |
| 839 | u8 bw; | 804 | u8 bw; |
| @@ -919,7 +884,17 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi, | |||
| 919 | tx_count = 0x1f; | 884 | tx_count = 0x1f; |
| 920 | 885 | ||
| 921 | val = FIELD_PREP(MT_TXD3_REM_TX_COUNT, tx_count) | | 886 | val = FIELD_PREP(MT_TXD3_REM_TX_COUNT, tx_count) | |
| 922 | FIELD_PREP(MT_TXD3_SEQ, le16_to_cpu(hdr->seq_ctrl)); | 887 | MT_TXD3_SN_VALID; |
| 888 | |||
| 889 | if (ieee80211_is_data_qos(hdr->frame_control)) | ||
| 890 | seqno = le16_to_cpu(hdr->seq_ctrl); | ||
| 891 | else if (ieee80211_is_back_req(hdr->frame_control)) | ||
| 892 | seqno = le16_to_cpu(bar->start_seq_num); | ||
| 893 | else | ||
| 894 | val &= ~MT_TXD3_SN_VALID; | ||
| 895 | |||
| 896 | val |= FIELD_PREP(MT_TXD3_SEQ, seqno >> 4); | ||
| 897 | |||
| 923 | txwi[3] = cpu_to_le32(val); | 898 | txwi[3] = cpu_to_le32(val); |
| 924 | 899 | ||
| 925 | if (key) { | 900 | if (key) { |
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c index cc0fe0933b2d..a3c4ef198bfe 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c | |||
| @@ -372,7 +372,7 @@ mt7603_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps) | |||
| 372 | struct mt7603_sta *msta = (struct mt7603_sta *)sta->drv_priv; | 372 | struct mt7603_sta *msta = (struct mt7603_sta *)sta->drv_priv; |
| 373 | struct sk_buff_head list; | 373 | struct sk_buff_head list; |
| 374 | 374 | ||
| 375 | mt76_stop_tx_queues(&dev->mt76, sta, false); | 375 | mt76_stop_tx_queues(&dev->mt76, sta, true); |
| 376 | mt7603_wtbl_set_ps(dev, msta, ps); | 376 | mt7603_wtbl_set_ps(dev, msta, ps); |
| 377 | if (ps) | 377 | if (ps) |
| 378 | return; | 378 | return; |
| @@ -584,13 +584,13 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
| 584 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 584 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
| 585 | mtxq->aggr = true; | 585 | mtxq->aggr = true; |
| 586 | mtxq->send_bar = false; | 586 | mtxq->send_bar = false; |
| 587 | mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, *ssn, ba_size); | 587 | mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, ba_size); |
| 588 | break; | 588 | break; |
| 589 | case IEEE80211_AMPDU_TX_STOP_FLUSH: | 589 | case IEEE80211_AMPDU_TX_STOP_FLUSH: |
| 590 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: | 590 | case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: |
| 591 | mtxq->aggr = false; | 591 | mtxq->aggr = false; |
| 592 | ieee80211_send_bar(vif, sta->addr, tid, mtxq->agg_ssn); | 592 | ieee80211_send_bar(vif, sta->addr, tid, mtxq->agg_ssn); |
| 593 | mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, *ssn, -1); | 593 | mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1); |
| 594 | break; | 594 | break; |
| 595 | case IEEE80211_AMPDU_TX_START: | 595 | case IEEE80211_AMPDU_TX_START: |
| 596 | mtxq->agg_ssn = *ssn << 4; | 596 | mtxq->agg_ssn = *ssn << 4; |
| @@ -598,7 +598,7 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
| 598 | break; | 598 | break; |
| 599 | case IEEE80211_AMPDU_TX_STOP_CONT: | 599 | case IEEE80211_AMPDU_TX_STOP_CONT: |
| 600 | mtxq->aggr = false; | 600 | mtxq->aggr = false; |
| 601 | mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, *ssn, -1); | 601 | mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1); |
| 602 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 602 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
| 603 | break; | 603 | break; |
| 604 | } | 604 | } |
diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h index 79f332429432..6049f3b7c8fe 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h | |||
| @@ -200,7 +200,7 @@ void mt7603_beacon_set_timer(struct mt7603_dev *dev, int idx, int intval); | |||
| 200 | int mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb); | 200 | int mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb); |
| 201 | void mt7603_mac_add_txs(struct mt7603_dev *dev, void *data); | 201 | void mt7603_mac_add_txs(struct mt7603_dev *dev, void *data); |
| 202 | void mt7603_mac_rx_ba_reset(struct mt7603_dev *dev, void *addr, u8 tid); | 202 | void mt7603_mac_rx_ba_reset(struct mt7603_dev *dev, void *addr, u8 tid); |
| 203 | void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, int ssn, | 203 | void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, |
| 204 | int ba_size); | 204 | int ba_size); |
| 205 | 205 | ||
| 206 | void mt7603_pse_client_reset(struct mt7603_dev *dev); | 206 | void mt7603_pse_client_reset(struct mt7603_dev *dev); |
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index 9ed231abe916..4fe5a83ca5a4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | |||
| @@ -466,7 +466,6 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev, | |||
| 466 | return; | 466 | return; |
| 467 | 467 | ||
| 468 | rcu_read_lock(); | 468 | rcu_read_lock(); |
| 469 | mt76_tx_status_lock(mdev, &list); | ||
| 470 | 469 | ||
| 471 | if (stat->wcid < ARRAY_SIZE(dev->mt76.wcid)) | 470 | if (stat->wcid < ARRAY_SIZE(dev->mt76.wcid)) |
| 472 | wcid = rcu_dereference(dev->mt76.wcid[stat->wcid]); | 471 | wcid = rcu_dereference(dev->mt76.wcid[stat->wcid]); |
| @@ -479,6 +478,8 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev, | |||
| 479 | drv_priv); | 478 | drv_priv); |
| 480 | } | 479 | } |
| 481 | 480 | ||
| 481 | mt76_tx_status_lock(mdev, &list); | ||
| 482 | |||
| 482 | if (wcid) { | 483 | if (wcid) { |
| 483 | if (stat->pktid >= MT_PACKET_ID_FIRST) | 484 | if (stat->pktid >= MT_PACKET_ID_FIRST) |
| 484 | status.skb = mt76_tx_status_skb_get(mdev, wcid, | 485 | status.skb = mt76_tx_status_skb_get(mdev, wcid, |
| @@ -498,7 +499,9 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev, | |||
| 498 | if (*update == 0 && stat_val == stat_cache && | 499 | if (*update == 0 && stat_val == stat_cache && |
| 499 | stat->wcid == msta->status.wcid && msta->n_frames < 32) { | 500 | stat->wcid == msta->status.wcid && msta->n_frames < 32) { |
| 500 | msta->n_frames++; | 501 | msta->n_frames++; |
| 501 | goto out; | 502 | mt76_tx_status_unlock(mdev, &list); |
| 503 | rcu_read_unlock(); | ||
| 504 | return; | ||
| 502 | } | 505 | } |
| 503 | 506 | ||
| 504 | mt76x02_mac_fill_tx_status(dev, status.info, &msta->status, | 507 | mt76x02_mac_fill_tx_status(dev, status.info, &msta->status, |
| @@ -514,11 +517,10 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev, | |||
| 514 | 517 | ||
| 515 | if (status.skb) | 518 | if (status.skb) |
| 516 | mt76_tx_status_skb_done(mdev, status.skb, &list); | 519 | mt76_tx_status_skb_done(mdev, status.skb, &list); |
| 517 | else | ||
| 518 | ieee80211_tx_status_ext(mt76_hw(dev), &status); | ||
| 519 | |||
| 520 | out: | ||
| 521 | mt76_tx_status_unlock(mdev, &list); | 520 | mt76_tx_status_unlock(mdev, &list); |
| 521 | |||
| 522 | if (!status.skb) | ||
| 523 | ieee80211_tx_status_ext(mt76_hw(dev), &status); | ||
| 522 | rcu_read_unlock(); | 524 | rcu_read_unlock(); |
| 523 | } | 525 | } |
| 524 | 526 | ||
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h index 4b1744e9fb78..50b92ca92bd7 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h | |||
| @@ -673,7 +673,6 @@ enum rt2x00_state_flags { | |||
| 673 | CONFIG_CHANNEL_HT40, | 673 | CONFIG_CHANNEL_HT40, |
| 674 | CONFIG_POWERSAVING, | 674 | CONFIG_POWERSAVING, |
| 675 | CONFIG_HT_DISABLED, | 675 | CONFIG_HT_DISABLED, |
| 676 | CONFIG_QOS_DISABLED, | ||
| 677 | CONFIG_MONITORING, | 676 | CONFIG_MONITORING, |
| 678 | 677 | ||
| 679 | /* | 678 | /* |
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c index 2825560e2424..e8462f25d252 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | |||
| @@ -642,19 +642,9 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, | |||
| 642 | rt2x00dev->intf_associated--; | 642 | rt2x00dev->intf_associated--; |
| 643 | 643 | ||
| 644 | rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated); | 644 | rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated); |
| 645 | |||
| 646 | clear_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags); | ||
| 647 | } | 645 | } |
| 648 | 646 | ||
| 649 | /* | 647 | /* |
| 650 | * Check for access point which do not support 802.11e . We have to | ||
| 651 | * generate data frames sequence number in S/W for such AP, because | ||
| 652 | * of H/W bug. | ||
| 653 | */ | ||
| 654 | if (changes & BSS_CHANGED_QOS && !bss_conf->qos) | ||
| 655 | set_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags); | ||
| 656 | |||
| 657 | /* | ||
| 658 | * When the erp information has changed, we should perform | 648 | * When the erp information has changed, we should perform |
| 659 | * additional configuration steps. For all other changes we are done. | 649 | * additional configuration steps. For all other changes we are done. |
| 660 | */ | 650 | */ |
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c index 92ddc19e7bf7..4834b4eb0206 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | |||
| @@ -201,15 +201,18 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev, | |||
| 201 | if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_SW_SEQNO)) { | 201 | if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_SW_SEQNO)) { |
| 202 | /* | 202 | /* |
| 203 | * rt2800 has a H/W (or F/W) bug, device incorrectly increase | 203 | * rt2800 has a H/W (or F/W) bug, device incorrectly increase |
| 204 | * seqno on retransmited data (non-QOS) frames. To workaround | 204 | * seqno on retransmitted data (non-QOS) and management frames. |
| 205 | * the problem let's generate seqno in software if QOS is | 205 | * To workaround the problem let's generate seqno in software. |
| 206 | * disabled. | 206 | * Except for beacons which are transmitted periodically by H/W |
| 207 | * hence hardware has to assign seqno for them. | ||
| 207 | */ | 208 | */ |
| 208 | if (test_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags)) | 209 | if (ieee80211_is_beacon(hdr->frame_control)) { |
| 209 | __clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); | 210 | __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); |
| 210 | else | ||
| 211 | /* H/W will generate sequence number */ | 211 | /* H/W will generate sequence number */ |
| 212 | return; | 212 | return; |
| 213 | } | ||
| 214 | |||
| 215 | __clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); | ||
| 213 | } | 216 | } |
| 214 | 217 | ||
| 215 | /* | 218 | /* |
diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c index 2b26f762fbc3..01acb6e53365 100644 --- a/drivers/nfc/st95hf/core.c +++ b/drivers/nfc/st95hf/core.c | |||
| @@ -1074,6 +1074,12 @@ static const struct spi_device_id st95hf_id[] = { | |||
| 1074 | }; | 1074 | }; |
| 1075 | MODULE_DEVICE_TABLE(spi, st95hf_id); | 1075 | MODULE_DEVICE_TABLE(spi, st95hf_id); |
| 1076 | 1076 | ||
| 1077 | static const struct of_device_id st95hf_spi_of_match[] = { | ||
| 1078 | { .compatible = "st,st95hf" }, | ||
| 1079 | { }, | ||
| 1080 | }; | ||
| 1081 | MODULE_DEVICE_TABLE(of, st95hf_spi_of_match); | ||
| 1082 | |||
| 1077 | static int st95hf_probe(struct spi_device *nfc_spi_dev) | 1083 | static int st95hf_probe(struct spi_device *nfc_spi_dev) |
| 1078 | { | 1084 | { |
| 1079 | int ret; | 1085 | int ret; |
| @@ -1260,6 +1266,7 @@ static struct spi_driver st95hf_driver = { | |||
| 1260 | .driver = { | 1266 | .driver = { |
| 1261 | .name = "st95hf", | 1267 | .name = "st95hf", |
| 1262 | .owner = THIS_MODULE, | 1268 | .owner = THIS_MODULE, |
| 1269 | .of_match_table = of_match_ptr(st95hf_spi_of_match), | ||
| 1263 | }, | 1270 | }, |
| 1264 | .id_table = st95hf_id, | 1271 | .id_table = st95hf_id, |
| 1265 | .probe = st95hf_probe, | 1272 | .probe = st95hf_probe, |
diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index b72a303176c7..9486acc08402 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c | |||
| @@ -198,14 +198,15 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, | |||
| 198 | return NULL; | 198 | return NULL; |
| 199 | 199 | ||
| 200 | nd_btt->id = ida_simple_get(&nd_region->btt_ida, 0, 0, GFP_KERNEL); | 200 | nd_btt->id = ida_simple_get(&nd_region->btt_ida, 0, 0, GFP_KERNEL); |
| 201 | if (nd_btt->id < 0) { | 201 | if (nd_btt->id < 0) |
| 202 | kfree(nd_btt); | 202 | goto out_nd_btt; |
| 203 | return NULL; | ||
| 204 | } | ||
| 205 | 203 | ||
| 206 | nd_btt->lbasize = lbasize; | 204 | nd_btt->lbasize = lbasize; |
| 207 | if (uuid) | 205 | if (uuid) { |
| 208 | uuid = kmemdup(uuid, 16, GFP_KERNEL); | 206 | uuid = kmemdup(uuid, 16, GFP_KERNEL); |
| 207 | if (!uuid) | ||
| 208 | goto out_put_id; | ||
| 209 | } | ||
| 209 | nd_btt->uuid = uuid; | 210 | nd_btt->uuid = uuid; |
| 210 | dev = &nd_btt->dev; | 211 | dev = &nd_btt->dev; |
| 211 | dev_set_name(dev, "btt%d.%d", nd_region->id, nd_btt->id); | 212 | dev_set_name(dev, "btt%d.%d", nd_region->id, nd_btt->id); |
| @@ -220,6 +221,13 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, | |||
| 220 | return NULL; | 221 | return NULL; |
| 221 | } | 222 | } |
| 222 | return dev; | 223 | return dev; |
| 224 | |||
| 225 | out_put_id: | ||
| 226 | ida_simple_remove(&nd_region->btt_ida, nd_btt->id); | ||
| 227 | |||
| 228 | out_nd_btt: | ||
| 229 | kfree(nd_btt); | ||
| 230 | return NULL; | ||
| 223 | } | 231 | } |
| 224 | 232 | ||
| 225 | struct device *nd_btt_create(struct nd_region *nd_region) | 233 | struct device *nd_btt_create(struct nd_region *nd_region) |
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index 7849bf1812c4..f293556cbbf6 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c | |||
| @@ -2249,9 +2249,12 @@ static struct device *create_namespace_blk(struct nd_region *nd_region, | |||
| 2249 | if (!nsblk->uuid) | 2249 | if (!nsblk->uuid) |
| 2250 | goto blk_err; | 2250 | goto blk_err; |
| 2251 | memcpy(name, nd_label->name, NSLABEL_NAME_LEN); | 2251 | memcpy(name, nd_label->name, NSLABEL_NAME_LEN); |
| 2252 | if (name[0]) | 2252 | if (name[0]) { |
| 2253 | nsblk->alt_name = kmemdup(name, NSLABEL_NAME_LEN, | 2253 | nsblk->alt_name = kmemdup(name, NSLABEL_NAME_LEN, |
| 2254 | GFP_KERNEL); | 2254 | GFP_KERNEL); |
| 2255 | if (!nsblk->alt_name) | ||
| 2256 | goto blk_err; | ||
| 2257 | } | ||
| 2255 | res = nsblk_add_resource(nd_region, ndd, nsblk, | 2258 | res = nsblk_add_resource(nd_region, ndd, nsblk, |
| 2256 | __le64_to_cpu(nd_label->dpa)); | 2259 | __le64_to_cpu(nd_label->dpa)); |
| 2257 | if (!res) | 2260 | if (!res) |
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index bc2f700feef8..0279eb1da3ef 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c | |||
| @@ -113,13 +113,13 @@ static void write_pmem(void *pmem_addr, struct page *page, | |||
| 113 | 113 | ||
| 114 | while (len) { | 114 | while (len) { |
| 115 | mem = kmap_atomic(page); | 115 | mem = kmap_atomic(page); |
| 116 | chunk = min_t(unsigned int, len, PAGE_SIZE); | 116 | chunk = min_t(unsigned int, len, PAGE_SIZE - off); |
| 117 | memcpy_flushcache(pmem_addr, mem + off, chunk); | 117 | memcpy_flushcache(pmem_addr, mem + off, chunk); |
| 118 | kunmap_atomic(mem); | 118 | kunmap_atomic(mem); |
| 119 | len -= chunk; | 119 | len -= chunk; |
| 120 | off = 0; | 120 | off = 0; |
| 121 | page++; | 121 | page++; |
| 122 | pmem_addr += PAGE_SIZE; | 122 | pmem_addr += chunk; |
| 123 | } | 123 | } |
| 124 | } | 124 | } |
| 125 | 125 | ||
| @@ -132,7 +132,7 @@ static blk_status_t read_pmem(struct page *page, unsigned int off, | |||
| 132 | 132 | ||
| 133 | while (len) { | 133 | while (len) { |
| 134 | mem = kmap_atomic(page); | 134 | mem = kmap_atomic(page); |
| 135 | chunk = min_t(unsigned int, len, PAGE_SIZE); | 135 | chunk = min_t(unsigned int, len, PAGE_SIZE - off); |
| 136 | rem = memcpy_mcsafe(mem + off, pmem_addr, chunk); | 136 | rem = memcpy_mcsafe(mem + off, pmem_addr, chunk); |
| 137 | kunmap_atomic(mem); | 137 | kunmap_atomic(mem); |
| 138 | if (rem) | 138 | if (rem) |
| @@ -140,7 +140,7 @@ static blk_status_t read_pmem(struct page *page, unsigned int off, | |||
| 140 | len -= chunk; | 140 | len -= chunk; |
| 141 | off = 0; | 141 | off = 0; |
| 142 | page++; | 142 | page++; |
| 143 | pmem_addr += PAGE_SIZE; | 143 | pmem_addr += chunk; |
| 144 | } | 144 | } |
| 145 | return BLK_STS_OK; | 145 | return BLK_STS_OK; |
| 146 | } | 146 | } |
diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c index f8bb746a549f..a570f2263a42 100644 --- a/drivers/nvdimm/security.c +++ b/drivers/nvdimm/security.c | |||
| @@ -22,6 +22,8 @@ static bool key_revalidate = true; | |||
| 22 | module_param(key_revalidate, bool, 0444); | 22 | module_param(key_revalidate, bool, 0444); |
| 23 | MODULE_PARM_DESC(key_revalidate, "Require key validation at init."); | 23 | MODULE_PARM_DESC(key_revalidate, "Require key validation at init."); |
| 24 | 24 | ||
| 25 | static const char zero_key[NVDIMM_PASSPHRASE_LEN]; | ||
| 26 | |||
| 25 | static void *key_data(struct key *key) | 27 | static void *key_data(struct key *key) |
| 26 | { | 28 | { |
| 27 | struct encrypted_key_payload *epayload = dereference_key_locked(key); | 29 | struct encrypted_key_payload *epayload = dereference_key_locked(key); |
| @@ -75,6 +77,16 @@ static struct key *nvdimm_request_key(struct nvdimm *nvdimm) | |||
| 75 | return key; | 77 | return key; |
| 76 | } | 78 | } |
| 77 | 79 | ||
| 80 | static const void *nvdimm_get_key_payload(struct nvdimm *nvdimm, | ||
| 81 | struct key **key) | ||
| 82 | { | ||
| 83 | *key = nvdimm_request_key(nvdimm); | ||
| 84 | if (!*key) | ||
| 85 | return zero_key; | ||
| 86 | |||
| 87 | return key_data(*key); | ||
| 88 | } | ||
| 89 | |||
| 78 | static struct key *nvdimm_lookup_user_key(struct nvdimm *nvdimm, | 90 | static struct key *nvdimm_lookup_user_key(struct nvdimm *nvdimm, |
| 79 | key_serial_t id, int subclass) | 91 | key_serial_t id, int subclass) |
| 80 | { | 92 | { |
| @@ -105,36 +117,57 @@ static struct key *nvdimm_lookup_user_key(struct nvdimm *nvdimm, | |||
| 105 | return key; | 117 | return key; |
| 106 | } | 118 | } |
| 107 | 119 | ||
| 108 | static struct key *nvdimm_key_revalidate(struct nvdimm *nvdimm) | 120 | static const void *nvdimm_get_user_key_payload(struct nvdimm *nvdimm, |
| 121 | key_serial_t id, int subclass, struct key **key) | ||
| 122 | { | ||
| 123 | *key = NULL; | ||
| 124 | if (id == 0) { | ||
| 125 | if (subclass == NVDIMM_BASE_KEY) | ||
| 126 | return zero_key; | ||
| 127 | else | ||
| 128 | return NULL; | ||
| 129 | } | ||
| 130 | |||
| 131 | *key = nvdimm_lookup_user_key(nvdimm, id, subclass); | ||
| 132 | if (!*key) | ||
| 133 | return NULL; | ||
| 134 | |||
| 135 | return key_data(*key); | ||
| 136 | } | ||
| 137 | |||
| 138 | |||
| 139 | static int nvdimm_key_revalidate(struct nvdimm *nvdimm) | ||
| 109 | { | 140 | { |
| 110 | struct key *key; | 141 | struct key *key; |
| 111 | int rc; | 142 | int rc; |
| 143 | const void *data; | ||
| 112 | 144 | ||
| 113 | if (!nvdimm->sec.ops->change_key) | 145 | if (!nvdimm->sec.ops->change_key) |
| 114 | return NULL; | 146 | return -EOPNOTSUPP; |
| 115 | 147 | ||
| 116 | key = nvdimm_request_key(nvdimm); | 148 | data = nvdimm_get_key_payload(nvdimm, &key); |
| 117 | if (!key) | ||
| 118 | return NULL; | ||
| 119 | 149 | ||
| 120 | /* | 150 | /* |
| 121 | * Send the same key to the hardware as new and old key to | 151 | * Send the same key to the hardware as new and old key to |
| 122 | * verify that the key is good. | 152 | * verify that the key is good. |
| 123 | */ | 153 | */ |
| 124 | rc = nvdimm->sec.ops->change_key(nvdimm, key_data(key), | 154 | rc = nvdimm->sec.ops->change_key(nvdimm, data, data, NVDIMM_USER); |
| 125 | key_data(key), NVDIMM_USER); | ||
| 126 | if (rc < 0) { | 155 | if (rc < 0) { |
| 127 | nvdimm_put_key(key); | 156 | nvdimm_put_key(key); |
| 128 | key = NULL; | 157 | return rc; |
| 129 | } | 158 | } |
| 130 | return key; | 159 | |
| 160 | nvdimm_put_key(key); | ||
| 161 | nvdimm->sec.state = nvdimm_security_state(nvdimm, NVDIMM_USER); | ||
| 162 | return 0; | ||
| 131 | } | 163 | } |
| 132 | 164 | ||
| 133 | static int __nvdimm_security_unlock(struct nvdimm *nvdimm) | 165 | static int __nvdimm_security_unlock(struct nvdimm *nvdimm) |
| 134 | { | 166 | { |
| 135 | struct device *dev = &nvdimm->dev; | 167 | struct device *dev = &nvdimm->dev; |
| 136 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); | 168 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); |
| 137 | struct key *key = NULL; | 169 | struct key *key; |
| 170 | const void *data; | ||
| 138 | int rc; | 171 | int rc; |
| 139 | 172 | ||
| 140 | /* The bus lock should be held at the top level of the call stack */ | 173 | /* The bus lock should be held at the top level of the call stack */ |
| @@ -160,16 +193,11 @@ static int __nvdimm_security_unlock(struct nvdimm *nvdimm) | |||
| 160 | if (!key_revalidate) | 193 | if (!key_revalidate) |
| 161 | return 0; | 194 | return 0; |
| 162 | 195 | ||
| 163 | key = nvdimm_key_revalidate(nvdimm); | 196 | return nvdimm_key_revalidate(nvdimm); |
| 164 | if (!key) | ||
| 165 | return nvdimm_security_freeze(nvdimm); | ||
| 166 | } else | 197 | } else |
| 167 | key = nvdimm_request_key(nvdimm); | 198 | data = nvdimm_get_key_payload(nvdimm, &key); |
| 168 | 199 | ||
| 169 | if (!key) | 200 | rc = nvdimm->sec.ops->unlock(nvdimm, data); |
| 170 | return -ENOKEY; | ||
| 171 | |||
| 172 | rc = nvdimm->sec.ops->unlock(nvdimm, key_data(key)); | ||
| 173 | dev_dbg(dev, "key: %d unlock: %s\n", key_serial(key), | 201 | dev_dbg(dev, "key: %d unlock: %s\n", key_serial(key), |
| 174 | rc == 0 ? "success" : "fail"); | 202 | rc == 0 ? "success" : "fail"); |
| 175 | 203 | ||
| @@ -195,6 +223,7 @@ int nvdimm_security_disable(struct nvdimm *nvdimm, unsigned int keyid) | |||
| 195 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); | 223 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); |
| 196 | struct key *key; | 224 | struct key *key; |
| 197 | int rc; | 225 | int rc; |
| 226 | const void *data; | ||
| 198 | 227 | ||
| 199 | /* The bus lock should be held at the top level of the call stack */ | 228 | /* The bus lock should be held at the top level of the call stack */ |
| 200 | lockdep_assert_held(&nvdimm_bus->reconfig_mutex); | 229 | lockdep_assert_held(&nvdimm_bus->reconfig_mutex); |
| @@ -214,11 +243,12 @@ int nvdimm_security_disable(struct nvdimm *nvdimm, unsigned int keyid) | |||
| 214 | return -EBUSY; | 243 | return -EBUSY; |
| 215 | } | 244 | } |
| 216 | 245 | ||
| 217 | key = nvdimm_lookup_user_key(nvdimm, keyid, NVDIMM_BASE_KEY); | 246 | data = nvdimm_get_user_key_payload(nvdimm, keyid, |
| 218 | if (!key) | 247 | NVDIMM_BASE_KEY, &key); |
| 248 | if (!data) | ||
| 219 | return -ENOKEY; | 249 | return -ENOKEY; |
| 220 | 250 | ||
| 221 | rc = nvdimm->sec.ops->disable(nvdimm, key_data(key)); | 251 | rc = nvdimm->sec.ops->disable(nvdimm, data); |
| 222 | dev_dbg(dev, "key: %d disable: %s\n", key_serial(key), | 252 | dev_dbg(dev, "key: %d disable: %s\n", key_serial(key), |
| 223 | rc == 0 ? "success" : "fail"); | 253 | rc == 0 ? "success" : "fail"); |
| 224 | 254 | ||
| @@ -235,6 +265,7 @@ int nvdimm_security_update(struct nvdimm *nvdimm, unsigned int keyid, | |||
| 235 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); | 265 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); |
| 236 | struct key *key, *newkey; | 266 | struct key *key, *newkey; |
| 237 | int rc; | 267 | int rc; |
| 268 | const void *data, *newdata; | ||
| 238 | 269 | ||
| 239 | /* The bus lock should be held at the top level of the call stack */ | 270 | /* The bus lock should be held at the top level of the call stack */ |
| 240 | lockdep_assert_held(&nvdimm_bus->reconfig_mutex); | 271 | lockdep_assert_held(&nvdimm_bus->reconfig_mutex); |
| @@ -249,22 +280,19 @@ int nvdimm_security_update(struct nvdimm *nvdimm, unsigned int keyid, | |||
| 249 | return -EIO; | 280 | return -EIO; |
| 250 | } | 281 | } |
| 251 | 282 | ||
| 252 | if (keyid == 0) | 283 | data = nvdimm_get_user_key_payload(nvdimm, keyid, |
| 253 | key = NULL; | 284 | NVDIMM_BASE_KEY, &key); |
| 254 | else { | 285 | if (!data) |
| 255 | key = nvdimm_lookup_user_key(nvdimm, keyid, NVDIMM_BASE_KEY); | 286 | return -ENOKEY; |
| 256 | if (!key) | ||
| 257 | return -ENOKEY; | ||
| 258 | } | ||
| 259 | 287 | ||
| 260 | newkey = nvdimm_lookup_user_key(nvdimm, new_keyid, NVDIMM_NEW_KEY); | 288 | newdata = nvdimm_get_user_key_payload(nvdimm, new_keyid, |
| 261 | if (!newkey) { | 289 | NVDIMM_NEW_KEY, &newkey); |
| 290 | if (!newdata) { | ||
| 262 | nvdimm_put_key(key); | 291 | nvdimm_put_key(key); |
| 263 | return -ENOKEY; | 292 | return -ENOKEY; |
| 264 | } | 293 | } |
| 265 | 294 | ||
| 266 | rc = nvdimm->sec.ops->change_key(nvdimm, key ? key_data(key) : NULL, | 295 | rc = nvdimm->sec.ops->change_key(nvdimm, data, newdata, pass_type); |
| 267 | key_data(newkey), pass_type); | ||
| 268 | dev_dbg(dev, "key: %d %d update%s: %s\n", | 296 | dev_dbg(dev, "key: %d %d update%s: %s\n", |
| 269 | key_serial(key), key_serial(newkey), | 297 | key_serial(key), key_serial(newkey), |
| 270 | pass_type == NVDIMM_MASTER ? "(master)" : "(user)", | 298 | pass_type == NVDIMM_MASTER ? "(master)" : "(user)", |
| @@ -286,8 +314,9 @@ int nvdimm_security_erase(struct nvdimm *nvdimm, unsigned int keyid, | |||
| 286 | { | 314 | { |
| 287 | struct device *dev = &nvdimm->dev; | 315 | struct device *dev = &nvdimm->dev; |
| 288 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); | 316 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); |
| 289 | struct key *key; | 317 | struct key *key = NULL; |
| 290 | int rc; | 318 | int rc; |
| 319 | const void *data; | ||
| 291 | 320 | ||
| 292 | /* The bus lock should be held at the top level of the call stack */ | 321 | /* The bus lock should be held at the top level of the call stack */ |
| 293 | lockdep_assert_held(&nvdimm_bus->reconfig_mutex); | 322 | lockdep_assert_held(&nvdimm_bus->reconfig_mutex); |
| @@ -319,11 +348,12 @@ int nvdimm_security_erase(struct nvdimm *nvdimm, unsigned int keyid, | |||
| 319 | return -EOPNOTSUPP; | 348 | return -EOPNOTSUPP; |
| 320 | } | 349 | } |
| 321 | 350 | ||
| 322 | key = nvdimm_lookup_user_key(nvdimm, keyid, NVDIMM_BASE_KEY); | 351 | data = nvdimm_get_user_key_payload(nvdimm, keyid, |
| 323 | if (!key) | 352 | NVDIMM_BASE_KEY, &key); |
| 353 | if (!data) | ||
| 324 | return -ENOKEY; | 354 | return -ENOKEY; |
| 325 | 355 | ||
| 326 | rc = nvdimm->sec.ops->erase(nvdimm, key_data(key), pass_type); | 356 | rc = nvdimm->sec.ops->erase(nvdimm, data, pass_type); |
| 327 | dev_dbg(dev, "key: %d erase%s: %s\n", key_serial(key), | 357 | dev_dbg(dev, "key: %d erase%s: %s\n", key_serial(key), |
| 328 | pass_type == NVDIMM_MASTER ? "(master)" : "(user)", | 358 | pass_type == NVDIMM_MASTER ? "(master)" : "(user)", |
| 329 | rc == 0 ? "success" : "fail"); | 359 | rc == 0 ? "success" : "fail"); |
| @@ -337,8 +367,9 @@ int nvdimm_security_overwrite(struct nvdimm *nvdimm, unsigned int keyid) | |||
| 337 | { | 367 | { |
| 338 | struct device *dev = &nvdimm->dev; | 368 | struct device *dev = &nvdimm->dev; |
| 339 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); | 369 | struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); |
| 340 | struct key *key; | 370 | struct key *key = NULL; |
| 341 | int rc; | 371 | int rc; |
| 372 | const void *data; | ||
| 342 | 373 | ||
| 343 | /* The bus lock should be held at the top level of the call stack */ | 374 | /* The bus lock should be held at the top level of the call stack */ |
| 344 | lockdep_assert_held(&nvdimm_bus->reconfig_mutex); | 375 | lockdep_assert_held(&nvdimm_bus->reconfig_mutex); |
| @@ -368,15 +399,12 @@ int nvdimm_security_overwrite(struct nvdimm *nvdimm, unsigned int keyid) | |||
| 368 | return -EBUSY; | 399 | return -EBUSY; |
| 369 | } | 400 | } |
| 370 | 401 | ||
| 371 | if (keyid == 0) | 402 | data = nvdimm_get_user_key_payload(nvdimm, keyid, |
| 372 | key = NULL; | 403 | NVDIMM_BASE_KEY, &key); |
| 373 | else { | 404 | if (!data) |
| 374 | key = nvdimm_lookup_user_key(nvdimm, keyid, NVDIMM_BASE_KEY); | 405 | return -ENOKEY; |
| 375 | if (!key) | ||
| 376 | return -ENOKEY; | ||
| 377 | } | ||
| 378 | 406 | ||
| 379 | rc = nvdimm->sec.ops->overwrite(nvdimm, key ? key_data(key) : NULL); | 407 | rc = nvdimm->sec.ops->overwrite(nvdimm, data); |
| 380 | dev_dbg(dev, "key: %d overwrite submission: %s\n", key_serial(key), | 408 | dev_dbg(dev, "key: %d overwrite submission: %s\n", key_serial(key), |
| 381 | rc == 0 ? "success" : "fail"); | 409 | rc == 0 ? "success" : "fail"); |
| 382 | 410 | ||
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 470601980794..2c43e12b70af 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
| @@ -288,7 +288,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) | |||
| 288 | "Cancelling I/O %d", req->tag); | 288 | "Cancelling I/O %d", req->tag); |
| 289 | 289 | ||
| 290 | nvme_req(req)->status = NVME_SC_ABORT_REQ; | 290 | nvme_req(req)->status = NVME_SC_ABORT_REQ; |
| 291 | blk_mq_complete_request(req); | 291 | blk_mq_complete_request_sync(req); |
| 292 | return true; | 292 | return true; |
| 293 | } | 293 | } |
| 294 | EXPORT_SYMBOL_GPL(nvme_cancel_request); | 294 | EXPORT_SYMBOL_GPL(nvme_cancel_request); |
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index f3b9d91ba0df..6d8451356eac 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c | |||
| @@ -1845,7 +1845,7 @@ nvme_fc_init_queue(struct nvme_fc_ctrl *ctrl, int idx) | |||
| 1845 | memset(queue, 0, sizeof(*queue)); | 1845 | memset(queue, 0, sizeof(*queue)); |
| 1846 | queue->ctrl = ctrl; | 1846 | queue->ctrl = ctrl; |
| 1847 | queue->qnum = idx; | 1847 | queue->qnum = idx; |
| 1848 | atomic_set(&queue->csn, 1); | 1848 | atomic_set(&queue->csn, 0); |
| 1849 | queue->dev = ctrl->dev; | 1849 | queue->dev = ctrl->dev; |
| 1850 | 1850 | ||
| 1851 | if (idx > 0) | 1851 | if (idx > 0) |
| @@ -1887,7 +1887,7 @@ nvme_fc_free_queue(struct nvme_fc_queue *queue) | |||
| 1887 | */ | 1887 | */ |
| 1888 | 1888 | ||
| 1889 | queue->connection_id = 0; | 1889 | queue->connection_id = 0; |
| 1890 | atomic_set(&queue->csn, 1); | 1890 | atomic_set(&queue->csn, 0); |
| 1891 | } | 1891 | } |
| 1892 | 1892 | ||
| 1893 | static void | 1893 | static void |
| @@ -2183,7 +2183,6 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, | |||
| 2183 | { | 2183 | { |
| 2184 | struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu; | 2184 | struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu; |
| 2185 | struct nvme_command *sqe = &cmdiu->sqe; | 2185 | struct nvme_command *sqe = &cmdiu->sqe; |
| 2186 | u32 csn; | ||
| 2187 | int ret, opstate; | 2186 | int ret, opstate; |
| 2188 | 2187 | ||
| 2189 | /* | 2188 | /* |
| @@ -2198,8 +2197,6 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, | |||
| 2198 | 2197 | ||
| 2199 | /* format the FC-NVME CMD IU and fcp_req */ | 2198 | /* format the FC-NVME CMD IU and fcp_req */ |
| 2200 | cmdiu->connection_id = cpu_to_be64(queue->connection_id); | 2199 | cmdiu->connection_id = cpu_to_be64(queue->connection_id); |
| 2201 | csn = atomic_inc_return(&queue->csn); | ||
| 2202 | cmdiu->csn = cpu_to_be32(csn); | ||
| 2203 | cmdiu->data_len = cpu_to_be32(data_len); | 2200 | cmdiu->data_len = cpu_to_be32(data_len); |
| 2204 | switch (io_dir) { | 2201 | switch (io_dir) { |
| 2205 | case NVMEFC_FCP_WRITE: | 2202 | case NVMEFC_FCP_WRITE: |
| @@ -2257,11 +2254,24 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, | |||
| 2257 | if (!(op->flags & FCOP_FLAGS_AEN)) | 2254 | if (!(op->flags & FCOP_FLAGS_AEN)) |
| 2258 | blk_mq_start_request(op->rq); | 2255 | blk_mq_start_request(op->rq); |
| 2259 | 2256 | ||
| 2257 | cmdiu->csn = cpu_to_be32(atomic_inc_return(&queue->csn)); | ||
| 2260 | ret = ctrl->lport->ops->fcp_io(&ctrl->lport->localport, | 2258 | ret = ctrl->lport->ops->fcp_io(&ctrl->lport->localport, |
| 2261 | &ctrl->rport->remoteport, | 2259 | &ctrl->rport->remoteport, |
| 2262 | queue->lldd_handle, &op->fcp_req); | 2260 | queue->lldd_handle, &op->fcp_req); |
| 2263 | 2261 | ||
| 2264 | if (ret) { | 2262 | if (ret) { |
| 2263 | /* | ||
| 2264 | * If the lld fails to send the command is there an issue with | ||
| 2265 | * the csn value? If the command that fails is the Connect, | ||
| 2266 | * no - as the connection won't be live. If it is a command | ||
| 2267 | * post-connect, it's possible a gap in csn may be created. | ||
| 2268 | * Does this matter? As Linux initiators don't send fused | ||
| 2269 | * commands, no. The gap would exist, but as there's nothing | ||
| 2270 | * that depends on csn order to be delivered on the target | ||
| 2271 | * side, it shouldn't hurt. It would be difficult for a | ||
| 2272 | * target to even detect the csn gap as it has no idea when the | ||
| 2273 | * cmd with the csn was supposed to arrive. | ||
| 2274 | */ | ||
| 2265 | opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE); | 2275 | opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE); |
| 2266 | __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); | 2276 | __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); |
| 2267 | 2277 | ||
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 76250181fee0..9f72d515fc4b 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c | |||
| @@ -24,6 +24,11 @@ u32 nvmet_get_log_page_len(struct nvme_command *cmd) | |||
| 24 | return len; | 24 | return len; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | u64 nvmet_get_log_page_offset(struct nvme_command *cmd) | ||
| 28 | { | ||
| 29 | return le64_to_cpu(cmd->get_log_page.lpo); | ||
| 30 | } | ||
| 31 | |||
| 27 | static void nvmet_execute_get_log_page_noop(struct nvmet_req *req) | 32 | static void nvmet_execute_get_log_page_noop(struct nvmet_req *req) |
| 28 | { | 33 | { |
| 29 | nvmet_req_complete(req, nvmet_zero_sgl(req, 0, req->data_len)); | 34 | nvmet_req_complete(req, nvmet_zero_sgl(req, 0, req->data_len)); |
diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c index c872b47a88f3..33ed95e72d6b 100644 --- a/drivers/nvme/target/discovery.c +++ b/drivers/nvme/target/discovery.c | |||
| @@ -131,54 +131,76 @@ static void nvmet_set_disc_traddr(struct nvmet_req *req, struct nvmet_port *port | |||
| 131 | memcpy(traddr, port->disc_addr.traddr, NVMF_TRADDR_SIZE); | 131 | memcpy(traddr, port->disc_addr.traddr, NVMF_TRADDR_SIZE); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | static size_t discovery_log_entries(struct nvmet_req *req) | ||
| 135 | { | ||
| 136 | struct nvmet_ctrl *ctrl = req->sq->ctrl; | ||
| 137 | struct nvmet_subsys_link *p; | ||
| 138 | struct nvmet_port *r; | ||
| 139 | size_t entries = 0; | ||
| 140 | |||
| 141 | list_for_each_entry(p, &req->port->subsystems, entry) { | ||
| 142 | if (!nvmet_host_allowed(p->subsys, ctrl->hostnqn)) | ||
| 143 | continue; | ||
| 144 | entries++; | ||
| 145 | } | ||
| 146 | list_for_each_entry(r, &req->port->referrals, entry) | ||
| 147 | entries++; | ||
| 148 | return entries; | ||
| 149 | } | ||
| 150 | |||
| 134 | static void nvmet_execute_get_disc_log_page(struct nvmet_req *req) | 151 | static void nvmet_execute_get_disc_log_page(struct nvmet_req *req) |
| 135 | { | 152 | { |
| 136 | const int entry_size = sizeof(struct nvmf_disc_rsp_page_entry); | 153 | const int entry_size = sizeof(struct nvmf_disc_rsp_page_entry); |
| 137 | struct nvmet_ctrl *ctrl = req->sq->ctrl; | 154 | struct nvmet_ctrl *ctrl = req->sq->ctrl; |
| 138 | struct nvmf_disc_rsp_page_hdr *hdr; | 155 | struct nvmf_disc_rsp_page_hdr *hdr; |
| 156 | u64 offset = nvmet_get_log_page_offset(req->cmd); | ||
| 139 | size_t data_len = nvmet_get_log_page_len(req->cmd); | 157 | size_t data_len = nvmet_get_log_page_len(req->cmd); |
| 140 | size_t alloc_len = max(data_len, sizeof(*hdr)); | 158 | size_t alloc_len; |
| 141 | int residual_len = data_len - sizeof(*hdr); | ||
| 142 | struct nvmet_subsys_link *p; | 159 | struct nvmet_subsys_link *p; |
| 143 | struct nvmet_port *r; | 160 | struct nvmet_port *r; |
| 144 | u32 numrec = 0; | 161 | u32 numrec = 0; |
| 145 | u16 status = 0; | 162 | u16 status = 0; |
| 163 | void *buffer; | ||
| 164 | |||
| 165 | /* Spec requires dword aligned offsets */ | ||
| 166 | if (offset & 0x3) { | ||
| 167 | status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; | ||
| 168 | goto out; | ||
| 169 | } | ||
| 146 | 170 | ||
| 147 | /* | 171 | /* |
| 148 | * Make sure we're passing at least a buffer of response header size. | 172 | * Make sure we're passing at least a buffer of response header size. |
| 149 | * If host provided data len is less than the header size, only the | 173 | * If host provided data len is less than the header size, only the |
| 150 | * number of bytes requested by host will be sent to host. | 174 | * number of bytes requested by host will be sent to host. |
| 151 | */ | 175 | */ |
| 152 | hdr = kzalloc(alloc_len, GFP_KERNEL); | 176 | down_read(&nvmet_config_sem); |
| 153 | if (!hdr) { | 177 | alloc_len = sizeof(*hdr) + entry_size * discovery_log_entries(req); |
| 178 | buffer = kzalloc(alloc_len, GFP_KERNEL); | ||
| 179 | if (!buffer) { | ||
| 180 | up_read(&nvmet_config_sem); | ||
| 154 | status = NVME_SC_INTERNAL; | 181 | status = NVME_SC_INTERNAL; |
| 155 | goto out; | 182 | goto out; |
| 156 | } | 183 | } |
| 157 | 184 | ||
| 158 | down_read(&nvmet_config_sem); | 185 | hdr = buffer; |
| 159 | list_for_each_entry(p, &req->port->subsystems, entry) { | 186 | list_for_each_entry(p, &req->port->subsystems, entry) { |
| 187 | char traddr[NVMF_TRADDR_SIZE]; | ||
| 188 | |||
| 160 | if (!nvmet_host_allowed(p->subsys, ctrl->hostnqn)) | 189 | if (!nvmet_host_allowed(p->subsys, ctrl->hostnqn)) |
| 161 | continue; | 190 | continue; |
| 162 | if (residual_len >= entry_size) { | 191 | |
| 163 | char traddr[NVMF_TRADDR_SIZE]; | 192 | nvmet_set_disc_traddr(req, req->port, traddr); |
| 164 | 193 | nvmet_format_discovery_entry(hdr, req->port, | |
| 165 | nvmet_set_disc_traddr(req, req->port, traddr); | 194 | p->subsys->subsysnqn, traddr, |
| 166 | nvmet_format_discovery_entry(hdr, req->port, | 195 | NVME_NQN_NVME, numrec); |
| 167 | p->subsys->subsysnqn, traddr, | ||
| 168 | NVME_NQN_NVME, numrec); | ||
| 169 | residual_len -= entry_size; | ||
| 170 | } | ||
| 171 | numrec++; | 196 | numrec++; |
| 172 | } | 197 | } |
| 173 | 198 | ||
| 174 | list_for_each_entry(r, &req->port->referrals, entry) { | 199 | list_for_each_entry(r, &req->port->referrals, entry) { |
| 175 | if (residual_len >= entry_size) { | 200 | nvmet_format_discovery_entry(hdr, r, |
| 176 | nvmet_format_discovery_entry(hdr, r, | 201 | NVME_DISC_SUBSYS_NAME, |
| 177 | NVME_DISC_SUBSYS_NAME, | 202 | r->disc_addr.traddr, |
| 178 | r->disc_addr.traddr, | 203 | NVME_NQN_DISC, numrec); |
| 179 | NVME_NQN_DISC, numrec); | ||
| 180 | residual_len -= entry_size; | ||
| 181 | } | ||
| 182 | numrec++; | 204 | numrec++; |
| 183 | } | 205 | } |
| 184 | 206 | ||
| @@ -190,8 +212,8 @@ static void nvmet_execute_get_disc_log_page(struct nvmet_req *req) | |||
| 190 | 212 | ||
| 191 | up_read(&nvmet_config_sem); | 213 | up_read(&nvmet_config_sem); |
| 192 | 214 | ||
| 193 | status = nvmet_copy_to_sgl(req, 0, hdr, data_len); | 215 | status = nvmet_copy_to_sgl(req, 0, buffer + offset, data_len); |
| 194 | kfree(hdr); | 216 | kfree(buffer); |
| 195 | out: | 217 | out: |
| 196 | nvmet_req_complete(req, status); | 218 | nvmet_req_complete(req, status); |
| 197 | } | 219 | } |
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index 51e49efd7849..1653d19b187f 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h | |||
| @@ -428,6 +428,7 @@ u16 nvmet_copy_from_sgl(struct nvmet_req *req, off_t off, void *buf, | |||
| 428 | u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len); | 428 | u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len); |
| 429 | 429 | ||
| 430 | u32 nvmet_get_log_page_len(struct nvme_command *cmd); | 430 | u32 nvmet_get_log_page_len(struct nvme_command *cmd); |
| 431 | u64 nvmet_get_log_page_offset(struct nvme_command *cmd); | ||
| 431 | 432 | ||
| 432 | extern struct list_head *nvmet_ports; | 433 | extern struct list_head *nvmet_ports; |
| 433 | void nvmet_port_disc_changed(struct nvmet_port *port, | 434 | void nvmet_port_disc_changed(struct nvmet_port *port, |
diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c index 810ab0fbcccb..d820f3edd431 100644 --- a/drivers/of/of_net.c +++ b/drivers/of/of_net.c | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | */ | 7 | */ |
| 8 | #include <linux/etherdevice.h> | 8 | #include <linux/etherdevice.h> |
| 9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 10 | #include <linux/nvmem-consumer.h> | ||
| 11 | #include <linux/of_net.h> | 10 | #include <linux/of_net.h> |
| 12 | #include <linux/phy.h> | 11 | #include <linux/phy.h> |
| 13 | #include <linux/export.h> | 12 | #include <linux/export.h> |
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 1be571c20062..6bad04cbb1d3 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
| @@ -157,8 +157,12 @@ | |||
| 157 | #define DBG_IRT(x...) | 157 | #define DBG_IRT(x...) |
| 158 | #endif | 158 | #endif |
| 159 | 159 | ||
| 160 | #ifdef CONFIG_64BIT | ||
| 161 | #define COMPARE_IRTE_ADDR(irte, hpa) ((irte)->dest_iosapic_addr == (hpa)) | ||
| 162 | #else | ||
| 160 | #define COMPARE_IRTE_ADDR(irte, hpa) \ | 163 | #define COMPARE_IRTE_ADDR(irte, hpa) \ |
| 161 | ((irte)->dest_iosapic_addr == F_EXTEND(hpa)) | 164 | ((irte)->dest_iosapic_addr == ((hpa) | 0xffffffff00000000ULL)) |
| 165 | #endif | ||
| 162 | 166 | ||
| 163 | #define IOSAPIC_REG_SELECT 0x00 | 167 | #define IOSAPIC_REG_SELECT 0x00 |
| 164 | #define IOSAPIC_REG_WINDOW 0x10 | 168 | #define IOSAPIC_REG_WINDOW 0x10 |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 3f3df4c29f6e..905282a8ddaa 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
| @@ -115,6 +115,10 @@ static void remove_board(struct controller *ctrl, bool safe_removal) | |||
| 115 | * removed from the slot/adapter. | 115 | * removed from the slot/adapter. |
| 116 | */ | 116 | */ |
| 117 | msleep(1000); | 117 | msleep(1000); |
| 118 | |||
| 119 | /* Ignore link or presence changes caused by power off */ | ||
| 120 | atomic_and(~(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC), | ||
| 121 | &ctrl->pending_events); | ||
| 118 | } | 122 | } |
| 119 | 123 | ||
| 120 | /* turn off Green LED */ | 124 | /* turn off Green LED */ |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7c1b362f599a..766f5779db92 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -6262,8 +6262,7 @@ static int __init pci_setup(char *str) | |||
| 6262 | } else if (!strncmp(str, "pcie_scan_all", 13)) { | 6262 | } else if (!strncmp(str, "pcie_scan_all", 13)) { |
| 6263 | pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS); | 6263 | pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS); |
| 6264 | } else if (!strncmp(str, "disable_acs_redir=", 18)) { | 6264 | } else if (!strncmp(str, "disable_acs_redir=", 18)) { |
| 6265 | disable_acs_redir_param = | 6265 | disable_acs_redir_param = str + 18; |
| 6266 | kstrdup(str + 18, GFP_KERNEL); | ||
| 6267 | } else { | 6266 | } else { |
| 6268 | printk(KERN_ERR "PCI: Unknown option `%s'\n", | 6267 | printk(KERN_ERR "PCI: Unknown option `%s'\n", |
| 6269 | str); | 6268 | str); |
| @@ -6274,3 +6273,19 @@ static int __init pci_setup(char *str) | |||
| 6274 | return 0; | 6273 | return 0; |
| 6275 | } | 6274 | } |
| 6276 | early_param("pci", pci_setup); | 6275 | early_param("pci", pci_setup); |
| 6276 | |||
| 6277 | /* | ||
| 6278 | * 'disable_acs_redir_param' is initialized in pci_setup(), above, to point | ||
| 6279 | * to data in the __initdata section which will be freed after the init | ||
| 6280 | * sequence is complete. We can't allocate memory in pci_setup() because some | ||
| 6281 | * architectures do not have any memory allocation service available during | ||
| 6282 | * an early_param() call. So we allocate memory and copy the variable here | ||
| 6283 | * before the init section is freed. | ||
| 6284 | */ | ||
| 6285 | static int __init pci_realloc_setup_params(void) | ||
| 6286 | { | ||
| 6287 | disable_acs_redir_param = kstrdup(disable_acs_redir_param, GFP_KERNEL); | ||
| 6288 | |||
| 6289 | return 0; | ||
| 6290 | } | ||
| 6291 | pure_initcall(pci_realloc_setup_params); | ||
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 5cbdbca904ac..362eb8cfa53b 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig | |||
| @@ -142,3 +142,11 @@ config PCIE_PTM | |||
| 142 | 142 | ||
| 143 | This is only useful if you have devices that support PTM, but it | 143 | This is only useful if you have devices that support PTM, but it |
| 144 | is safe to enable even if you don't. | 144 | is safe to enable even if you don't. |
| 145 | |||
| 146 | config PCIE_BW | ||
| 147 | bool "PCI Express Bandwidth Change Notification" | ||
| 148 | depends on PCIEPORTBUS | ||
| 149 | help | ||
| 150 | This enables PCI Express Bandwidth Change Notification. If | ||
| 151 | you know link width or rate changes occur only to correct | ||
| 152 | unreliable links, you may answer Y. | ||
diff --git a/drivers/pci/pcie/Makefile b/drivers/pci/pcie/Makefile index f1d7bc1e5efa..efb9d2e71e9e 100644 --- a/drivers/pci/pcie/Makefile +++ b/drivers/pci/pcie/Makefile | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | # Makefile for PCI Express features and port driver | 3 | # Makefile for PCI Express features and port driver |
| 4 | 4 | ||
| 5 | pcieportdrv-y := portdrv_core.o portdrv_pci.o err.o | 5 | pcieportdrv-y := portdrv_core.o portdrv_pci.o err.o |
| 6 | pcieportdrv-y += bw_notification.o | ||
| 7 | 6 | ||
| 8 | obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o | 7 | obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o |
| 9 | 8 | ||
| @@ -13,3 +12,4 @@ obj-$(CONFIG_PCIEAER_INJECT) += aer_inject.o | |||
| 13 | obj-$(CONFIG_PCIE_PME) += pme.o | 12 | obj-$(CONFIG_PCIE_PME) += pme.o |
| 14 | obj-$(CONFIG_PCIE_DPC) += dpc.o | 13 | obj-$(CONFIG_PCIE_DPC) += dpc.o |
| 15 | obj-$(CONFIG_PCIE_PTM) += ptm.o | 14 | obj-$(CONFIG_PCIE_PTM) += ptm.o |
| 15 | obj-$(CONFIG_PCIE_BW) += bw_notification.o | ||
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h index 1d50dc58ac40..944827a8c7d3 100644 --- a/drivers/pci/pcie/portdrv.h +++ b/drivers/pci/pcie/portdrv.h | |||
| @@ -49,7 +49,11 @@ int pcie_dpc_init(void); | |||
| 49 | static inline int pcie_dpc_init(void) { return 0; } | 49 | static inline int pcie_dpc_init(void) { return 0; } |
| 50 | #endif | 50 | #endif |
| 51 | 51 | ||
| 52 | #ifdef CONFIG_PCIE_BW | ||
| 52 | int pcie_bandwidth_notification_init(void); | 53 | int pcie_bandwidth_notification_init(void); |
| 54 | #else | ||
| 55 | static inline int pcie_bandwidth_notification_init(void) { return 0; } | ||
| 56 | #endif | ||
| 53 | 57 | ||
| 54 | /* Port Type */ | 58 | /* Port Type */ |
| 55 | #define PCIE_ANY_PORT (~0) | 59 | #define PCIE_ANY_PORT (~0) |
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 7d04f9d087a6..1b330129089f 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
| @@ -55,7 +55,8 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask, | |||
| 55 | * 7.8.2, 7.10.10, 7.31.2. | 55 | * 7.8.2, 7.10.10, 7.31.2. |
| 56 | */ | 56 | */ |
| 57 | 57 | ||
| 58 | if (mask & (PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP)) { | 58 | if (mask & (PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP | |
| 59 | PCIE_PORT_SERVICE_BWNOTIF)) { | ||
| 59 | pcie_capability_read_word(dev, PCI_EXP_FLAGS, ®16); | 60 | pcie_capability_read_word(dev, PCI_EXP_FLAGS, ®16); |
| 60 | *pme = (reg16 & PCI_EXP_FLAGS_IRQ) >> 9; | 61 | *pme = (reg16 & PCI_EXP_FLAGS_IRQ) >> 9; |
| 61 | nvec = *pme + 1; | 62 | nvec = *pme + 1; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index a59ad09ce911..a077f67fe1da 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -3877,6 +3877,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, | |||
| 3877 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ | 3877 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ |
| 3878 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130, | 3878 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130, |
| 3879 | quirk_dma_func1_alias); | 3879 | quirk_dma_func1_alias); |
| 3880 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9170, | ||
| 3881 | quirk_dma_func1_alias); | ||
| 3880 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c47 + c57 */ | 3882 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c47 + c57 */ |
| 3881 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9172, | 3883 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9172, |
| 3882 | quirk_dma_func1_alias); | 3884 | quirk_dma_func1_alias); |
diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c index 8f018b3f3cd4..c7039f52ad51 100644 --- a/drivers/platform/x86/pmc_atom.c +++ b/drivers/platform/x86/pmc_atom.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | #include <linux/debugfs.h> | 18 | #include <linux/debugfs.h> |
| 19 | #include <linux/device.h> | 19 | #include <linux/device.h> |
| 20 | #include <linux/dmi.h> | ||
| 20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 21 | #include <linux/io.h> | 22 | #include <linux/io.h> |
| 22 | #include <linux/platform_data/x86/clk-pmc-atom.h> | 23 | #include <linux/platform_data/x86/clk-pmc-atom.h> |
| @@ -391,11 +392,27 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc) | |||
| 391 | } | 392 | } |
| 392 | #endif /* CONFIG_DEBUG_FS */ | 393 | #endif /* CONFIG_DEBUG_FS */ |
| 393 | 394 | ||
| 395 | /* | ||
| 396 | * Some systems need one or more of their pmc_plt_clks to be | ||
| 397 | * marked as critical. | ||
| 398 | */ | ||
| 399 | static const struct dmi_system_id critclk_systems[] = { | ||
| 400 | { | ||
| 401 | .ident = "MPL CEC1x", | ||
| 402 | .matches = { | ||
| 403 | DMI_MATCH(DMI_SYS_VENDOR, "MPL AG"), | ||
| 404 | DMI_MATCH(DMI_PRODUCT_NAME, "CEC10 Family"), | ||
| 405 | }, | ||
| 406 | }, | ||
| 407 | { /*sentinel*/ } | ||
| 408 | }; | ||
| 409 | |||
| 394 | static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap, | 410 | static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap, |
| 395 | const struct pmc_data *pmc_data) | 411 | const struct pmc_data *pmc_data) |
| 396 | { | 412 | { |
| 397 | struct platform_device *clkdev; | 413 | struct platform_device *clkdev; |
| 398 | struct pmc_clk_data *clk_data; | 414 | struct pmc_clk_data *clk_data; |
| 415 | const struct dmi_system_id *d = dmi_first_match(critclk_systems); | ||
| 399 | 416 | ||
| 400 | clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); | 417 | clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); |
| 401 | if (!clk_data) | 418 | if (!clk_data) |
| @@ -403,6 +420,10 @@ static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap, | |||
| 403 | 420 | ||
| 404 | clk_data->base = pmc_regmap; /* offset is added by client */ | 421 | clk_data->base = pmc_regmap; /* offset is added by client */ |
| 405 | clk_data->clks = pmc_data->clks; | 422 | clk_data->clks = pmc_data->clks; |
| 423 | if (d) { | ||
| 424 | clk_data->critical = true; | ||
| 425 | pr_info("%s critclks quirk enabled\n", d->ident); | ||
| 426 | } | ||
| 406 | 427 | ||
| 407 | clkdev = platform_device_register_data(&pdev->dev, "clk-pmc-atom", | 428 | clkdev = platform_device_register_data(&pdev->dev, "clk-pmc-atom", |
| 408 | PLATFORM_DEVID_NONE, | 429 | PLATFORM_DEVID_NONE, |
diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c index 08d5037fd052..6887870ba32c 100644 --- a/drivers/power/supply/cpcap-battery.c +++ b/drivers/power/supply/cpcap-battery.c | |||
| @@ -221,6 +221,9 @@ static int cpcap_battery_cc_raw_div(struct cpcap_battery_ddata *ddata, | |||
| 221 | int avg_current; | 221 | int avg_current; |
| 222 | u32 cc_lsb; | 222 | u32 cc_lsb; |
| 223 | 223 | ||
| 224 | if (!divider) | ||
| 225 | return 0; | ||
| 226 | |||
| 224 | sample &= 0xffffff; /* 24-bits, unsigned */ | 227 | sample &= 0xffffff; /* 24-bits, unsigned */ |
| 225 | offset &= 0x7ff; /* 10-bits, signed */ | 228 | offset &= 0x7ff; /* 10-bits, signed */ |
| 226 | 229 | ||
diff --git a/drivers/power/supply/goldfish_battery.c b/drivers/power/supply/goldfish_battery.c index ad969d9fc981..c2644a9fe80f 100644 --- a/drivers/power/supply/goldfish_battery.c +++ b/drivers/power/supply/goldfish_battery.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Power supply driver for the goldfish emulator | 3 | * Power supply driver for the goldfish emulator |
| 4 | * | 4 | * |
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index dce24f596160..5358a80d854f 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c | |||
| @@ -383,15 +383,11 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 383 | char *prop_buf; | 383 | char *prop_buf; |
| 384 | char *attrname; | 384 | char *attrname; |
| 385 | 385 | ||
| 386 | dev_dbg(dev, "uevent\n"); | ||
| 387 | |||
| 388 | if (!psy || !psy->desc) { | 386 | if (!psy || !psy->desc) { |
| 389 | dev_dbg(dev, "No power supply yet\n"); | 387 | dev_dbg(dev, "No power supply yet\n"); |
| 390 | return ret; | 388 | return ret; |
| 391 | } | 389 | } |
| 392 | 390 | ||
| 393 | dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->desc->name); | ||
| 394 | |||
| 395 | ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name); | 391 | ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name); |
| 396 | if (ret) | 392 | if (ret) |
| 397 | return ret; | 393 | return ret; |
| @@ -427,8 +423,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 427 | goto out; | 423 | goto out; |
| 428 | } | 424 | } |
| 429 | 425 | ||
| 430 | dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf); | ||
| 431 | |||
| 432 | ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf); | 426 | ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf); |
| 433 | kfree(attrname); | 427 | kfree(attrname); |
| 434 | if (ret) | 428 | if (ret) |
diff --git a/drivers/reset/reset-meson-audio-arb.c b/drivers/reset/reset-meson-audio-arb.c index 91751617b37a..c53a2185a039 100644 --- a/drivers/reset/reset-meson-audio-arb.c +++ b/drivers/reset/reset-meson-audio-arb.c | |||
| @@ -130,6 +130,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev) | |||
| 130 | arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits); | 130 | arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits); |
| 131 | arb->rstc.ops = &meson_audio_arb_rstc_ops; | 131 | arb->rstc.ops = &meson_audio_arb_rstc_ops; |
| 132 | arb->rstc.of_node = dev->of_node; | 132 | arb->rstc.of_node = dev->of_node; |
| 133 | arb->rstc.owner = THIS_MODULE; | ||
| 133 | 134 | ||
| 134 | /* | 135 | /* |
| 135 | * Enable general : | 136 | * Enable general : |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index a71734c41693..f933c06bff4f 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
| @@ -667,9 +667,9 @@ config RTC_DRV_S5M | |||
| 667 | will be called rtc-s5m. | 667 | will be called rtc-s5m. |
| 668 | 668 | ||
| 669 | config RTC_DRV_SD3078 | 669 | config RTC_DRV_SD3078 |
| 670 | tristate "ZXW Crystal SD3078" | 670 | tristate "ZXW Shenzhen whwave SD3078" |
| 671 | help | 671 | help |
| 672 | If you say yes here you get support for the ZXW Crystal | 672 | If you say yes here you get support for the ZXW Shenzhen whwave |
| 673 | SD3078 RTC chips. | 673 | SD3078 RTC chips. |
| 674 | 674 | ||
| 675 | This driver can also be built as a module. If so, the module | 675 | This driver can also be built as a module. If so, the module |
diff --git a/drivers/rtc/rtc-cros-ec.c b/drivers/rtc/rtc-cros-ec.c index e5444296075e..4d6bf9304ceb 100644 --- a/drivers/rtc/rtc-cros-ec.c +++ b/drivers/rtc/rtc-cros-ec.c | |||
| @@ -298,7 +298,7 @@ static int cros_ec_rtc_suspend(struct device *dev) | |||
| 298 | struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev); | 298 | struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev); |
| 299 | 299 | ||
| 300 | if (device_may_wakeup(dev)) | 300 | if (device_may_wakeup(dev)) |
| 301 | enable_irq_wake(cros_ec_rtc->cros_ec->irq); | 301 | return enable_irq_wake(cros_ec_rtc->cros_ec->irq); |
| 302 | 302 | ||
| 303 | return 0; | 303 | return 0; |
| 304 | } | 304 | } |
| @@ -309,7 +309,7 @@ static int cros_ec_rtc_resume(struct device *dev) | |||
| 309 | struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev); | 309 | struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev); |
| 310 | 310 | ||
| 311 | if (device_may_wakeup(dev)) | 311 | if (device_may_wakeup(dev)) |
| 312 | disable_irq_wake(cros_ec_rtc->cros_ec->irq); | 312 | return disable_irq_wake(cros_ec_rtc->cros_ec->irq); |
| 313 | 313 | ||
| 314 | return 0; | 314 | return 0; |
| 315 | } | 315 | } |
diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c index b4e054c64bad..69b54e5556c0 100644 --- a/drivers/rtc/rtc-da9063.c +++ b/drivers/rtc/rtc-da9063.c | |||
| @@ -480,6 +480,13 @@ static int da9063_rtc_probe(struct platform_device *pdev) | |||
| 480 | da9063_data_to_tm(data, &rtc->alarm_time, rtc); | 480 | da9063_data_to_tm(data, &rtc->alarm_time, rtc); |
| 481 | rtc->rtc_sync = false; | 481 | rtc->rtc_sync = false; |
| 482 | 482 | ||
| 483 | /* | ||
| 484 | * TODO: some models have alarms on a minute boundary but still support | ||
| 485 | * real hardware interrupts. Add this once the core supports it. | ||
| 486 | */ | ||
| 487 | if (config->rtc_data_start != RTC_SEC) | ||
| 488 | rtc->rtc_dev->uie_unsupported = 1; | ||
| 489 | |||
| 483 | irq_alarm = platform_get_irq_byname(pdev, "ALARM"); | 490 | irq_alarm = platform_get_irq_byname(pdev, "ALARM"); |
| 484 | ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL, | 491 | ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL, |
| 485 | da9063_alarm_event, | 492 | da9063_alarm_event, |
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index d417b203cbc5..1d3de2a3d1a4 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
| @@ -374,7 +374,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
| 374 | static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) | 374 | static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) |
| 375 | { | 375 | { |
| 376 | unsigned int byte; | 376 | unsigned int byte; |
| 377 | int value = 0xff; /* return 0xff for ignored values */ | 377 | int value = -1; /* return -1 for ignored values */ |
| 378 | 378 | ||
| 379 | byte = readb(rtc->regbase + reg_off); | 379 | byte = readb(rtc->regbase + reg_off); |
| 380 | if (byte & AR_ENB) { | 380 | if (byte & AR_ENB) { |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 6e294b4d3635..f89f9d02e788 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
| @@ -2004,14 +2004,14 @@ static int dasd_eckd_end_analysis(struct dasd_block *block) | |||
| 2004 | blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); | 2004 | blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); |
| 2005 | 2005 | ||
| 2006 | raw: | 2006 | raw: |
| 2007 | block->blocks = (private->real_cyl * | 2007 | block->blocks = ((unsigned long) private->real_cyl * |
| 2008 | private->rdc_data.trk_per_cyl * | 2008 | private->rdc_data.trk_per_cyl * |
| 2009 | blk_per_trk); | 2009 | blk_per_trk); |
| 2010 | 2010 | ||
| 2011 | dev_info(&device->cdev->dev, | 2011 | dev_info(&device->cdev->dev, |
| 2012 | "DASD with %d KB/block, %d KB total size, %d KB/track, " | 2012 | "DASD with %u KB/block, %lu KB total size, %u KB/track, " |
| 2013 | "%s\n", (block->bp_block >> 10), | 2013 | "%s\n", (block->bp_block >> 10), |
| 2014 | ((private->real_cyl * | 2014 | (((unsigned long) private->real_cyl * |
| 2015 | private->rdc_data.trk_per_cyl * | 2015 | private->rdc_data.trk_per_cyl * |
| 2016 | blk_per_trk * (block->bp_block >> 9)) >> 1), | 2016 | blk_per_trk * (block->bp_block >> 9)) >> 1), |
| 2017 | ((blk_per_trk * block->bp_block) >> 10), | 2017 | ((blk_per_trk * block->bp_block) >> 10), |
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c index fd2146bcc0ad..e17364e13d2f 100644 --- a/drivers/s390/char/con3270.c +++ b/drivers/s390/char/con3270.c | |||
| @@ -629,7 +629,7 @@ con3270_init(void) | |||
| 629 | (void (*)(unsigned long)) con3270_read_tasklet, | 629 | (void (*)(unsigned long)) con3270_read_tasklet, |
| 630 | (unsigned long) condev->read); | 630 | (unsigned long) condev->read); |
| 631 | 631 | ||
| 632 | raw3270_add_view(&condev->view, &con3270_fn, 1); | 632 | raw3270_add_view(&condev->view, &con3270_fn, 1, RAW3270_VIEW_LOCK_IRQ); |
| 633 | 633 | ||
| 634 | INIT_LIST_HEAD(&condev->freemem); | 634 | INIT_LIST_HEAD(&condev->freemem); |
| 635 | for (i = 0; i < CON3270_STRING_PAGES; i++) { | 635 | for (i = 0; i < CON3270_STRING_PAGES; i++) { |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 8f3a2eeb28dc..8b48ba9c598e 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
| @@ -463,7 +463,8 @@ fs3270_open(struct inode *inode, struct file *filp) | |||
| 463 | 463 | ||
| 464 | init_waitqueue_head(&fp->wait); | 464 | init_waitqueue_head(&fp->wait); |
| 465 | fp->fs_pid = get_pid(task_pid(current)); | 465 | fp->fs_pid = get_pid(task_pid(current)); |
| 466 | rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); | 466 | rc = raw3270_add_view(&fp->view, &fs3270_fn, minor, |
| 467 | RAW3270_VIEW_LOCK_BH); | ||
| 467 | if (rc) { | 468 | if (rc) { |
| 468 | fs3270_free_view(&fp->view); | 469 | fs3270_free_view(&fp->view); |
| 469 | goto out; | 470 | goto out; |
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index f8cd2935fbfd..63a41b168761 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
| @@ -920,7 +920,7 @@ raw3270_deactivate_view(struct raw3270_view *view) | |||
| 920 | * Add view to device with minor "minor". | 920 | * Add view to device with minor "minor". |
| 921 | */ | 921 | */ |
| 922 | int | 922 | int |
| 923 | raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) | 923 | raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor, int subclass) |
| 924 | { | 924 | { |
| 925 | unsigned long flags; | 925 | unsigned long flags; |
| 926 | struct raw3270 *rp; | 926 | struct raw3270 *rp; |
| @@ -942,6 +942,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) | |||
| 942 | view->cols = rp->cols; | 942 | view->cols = rp->cols; |
| 943 | view->ascebc = rp->ascebc; | 943 | view->ascebc = rp->ascebc; |
| 944 | spin_lock_init(&view->lock); | 944 | spin_lock_init(&view->lock); |
| 945 | lockdep_set_subclass(&view->lock, subclass); | ||
| 945 | list_add(&view->list, &rp->view_list); | 946 | list_add(&view->list, &rp->view_list); |
| 946 | rc = 0; | 947 | rc = 0; |
| 947 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); | 948 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); |
diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h index 114ca7cbf889..3afaa35f7351 100644 --- a/drivers/s390/char/raw3270.h +++ b/drivers/s390/char/raw3270.h | |||
| @@ -150,6 +150,8 @@ struct raw3270_fn { | |||
| 150 | struct raw3270_view { | 150 | struct raw3270_view { |
| 151 | struct list_head list; | 151 | struct list_head list; |
| 152 | spinlock_t lock; | 152 | spinlock_t lock; |
| 153 | #define RAW3270_VIEW_LOCK_IRQ 0 | ||
| 154 | #define RAW3270_VIEW_LOCK_BH 1 | ||
| 153 | atomic_t ref_count; | 155 | atomic_t ref_count; |
| 154 | struct raw3270 *dev; | 156 | struct raw3270 *dev; |
| 155 | struct raw3270_fn *fn; | 157 | struct raw3270_fn *fn; |
| @@ -158,7 +160,7 @@ struct raw3270_view { | |||
| 158 | unsigned char *ascebc; /* ascii -> ebcdic table */ | 160 | unsigned char *ascebc; /* ascii -> ebcdic table */ |
| 159 | }; | 161 | }; |
| 160 | 162 | ||
| 161 | int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int); | 163 | int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int, int); |
| 162 | int raw3270_activate_view(struct raw3270_view *); | 164 | int raw3270_activate_view(struct raw3270_view *); |
| 163 | void raw3270_del_view(struct raw3270_view *); | 165 | void raw3270_del_view(struct raw3270_view *); |
| 164 | void raw3270_deactivate_view(struct raw3270_view *); | 166 | void raw3270_deactivate_view(struct raw3270_view *); |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 2b0c36c2c568..98d7fc152e32 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
| @@ -980,7 +980,8 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
| 980 | return PTR_ERR(tp); | 980 | return PTR_ERR(tp); |
| 981 | 981 | ||
| 982 | rc = raw3270_add_view(&tp->view, &tty3270_fn, | 982 | rc = raw3270_add_view(&tp->view, &tty3270_fn, |
| 983 | tty->index + RAW3270_FIRSTMINOR); | 983 | tty->index + RAW3270_FIRSTMINOR, |
| 984 | RAW3270_VIEW_LOCK_BH); | ||
| 984 | if (rc) { | 985 | if (rc) { |
| 985 | tty3270_free_view(tp); | 986 | tty3270_free_view(tp); |
| 986 | return rc; | 987 | return rc; |
diff --git a/drivers/s390/crypto/ap_queue.c b/drivers/s390/crypto/ap_queue.c index 6a340f2c3556..5ea83dc4f1d7 100644 --- a/drivers/s390/crypto/ap_queue.c +++ b/drivers/s390/crypto/ap_queue.c | |||
| @@ -751,8 +751,8 @@ void ap_queue_prepare_remove(struct ap_queue *aq) | |||
| 751 | __ap_flush_queue(aq); | 751 | __ap_flush_queue(aq); |
| 752 | /* set REMOVE state to prevent new messages are queued in */ | 752 | /* set REMOVE state to prevent new messages are queued in */ |
| 753 | aq->state = AP_STATE_REMOVE; | 753 | aq->state = AP_STATE_REMOVE; |
| 754 | del_timer_sync(&aq->timeout); | ||
| 755 | spin_unlock_bh(&aq->lock); | 754 | spin_unlock_bh(&aq->lock); |
| 755 | del_timer_sync(&aq->timeout); | ||
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | void ap_queue_remove(struct ap_queue *aq) | 758 | void ap_queue_remove(struct ap_queue *aq) |
diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c index 3e85d665c572..45eb0c14b880 100644 --- a/drivers/s390/crypto/pkey_api.c +++ b/drivers/s390/crypto/pkey_api.c | |||
| @@ -51,7 +51,8 @@ static debug_info_t *debug_info; | |||
| 51 | 51 | ||
| 52 | static void __init pkey_debug_init(void) | 52 | static void __init pkey_debug_init(void) |
| 53 | { | 53 | { |
| 54 | debug_info = debug_register("pkey", 1, 1, 4 * sizeof(long)); | 54 | /* 5 arguments per dbf entry (including the format string ptr) */ |
| 55 | debug_info = debug_register("pkey", 1, 1, 5 * sizeof(long)); | ||
| 55 | debug_register_view(debug_info, &debug_sprintf_view); | 56 | debug_register_view(debug_info, &debug_sprintf_view); |
| 56 | debug_set_level(debug_info, 3); | 57 | debug_set_level(debug_info, 3); |
| 57 | } | 58 | } |
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 7617d21cb296..f63c5c871d3d 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c | |||
| @@ -1595,6 +1595,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
| 1595 | if (priv->channel[direction] == NULL) { | 1595 | if (priv->channel[direction] == NULL) { |
| 1596 | if (direction == CTCM_WRITE) | 1596 | if (direction == CTCM_WRITE) |
| 1597 | channel_free(priv->channel[CTCM_READ]); | 1597 | channel_free(priv->channel[CTCM_READ]); |
| 1598 | result = -ENODEV; | ||
| 1598 | goto out_dev; | 1599 | goto out_dev; |
| 1599 | } | 1600 | } |
| 1600 | priv->channel[direction]->netdev = dev; | 1601 | priv->channel[direction]->netdev = dev; |
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c index 3d401d02c019..bdd177e3d762 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c | |||
| @@ -91,6 +91,7 @@ aic7770_probe(struct device *dev) | |||
| 91 | ahc = ahc_alloc(&aic7xxx_driver_template, name); | 91 | ahc = ahc_alloc(&aic7xxx_driver_template, name); |
| 92 | if (ahc == NULL) | 92 | if (ahc == NULL) |
| 93 | return (ENOMEM); | 93 | return (ENOMEM); |
| 94 | ahc->dev = dev; | ||
| 94 | error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, | 95 | error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, |
| 95 | eisaBase); | 96 | eisaBase); |
| 96 | if (error != 0) { | 97 | if (error != 0) { |
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h index 5614921b4041..88b90f9806c9 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.h +++ b/drivers/scsi/aic7xxx/aic7xxx.h | |||
| @@ -943,6 +943,7 @@ struct ahc_softc { | |||
| 943 | * Platform specific device information. | 943 | * Platform specific device information. |
| 944 | */ | 944 | */ |
| 945 | ahc_dev_softc_t dev_softc; | 945 | ahc_dev_softc_t dev_softc; |
| 946 | struct device *dev; | ||
| 946 | 947 | ||
| 947 | /* | 948 | /* |
| 948 | * Bus specific device information. | 949 | * Bus specific device information. |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 3c9c17450bb3..d5c4a0d23706 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
| @@ -860,8 +860,8 @@ int | |||
| 860 | ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr, | 860 | ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr, |
| 861 | int flags, bus_dmamap_t *mapp) | 861 | int flags, bus_dmamap_t *mapp) |
| 862 | { | 862 | { |
| 863 | *vaddr = pci_alloc_consistent(ahc->dev_softc, | 863 | /* XXX: check if we really need the GFP_ATOMIC and unwind this mess! */ |
| 864 | dmat->maxsize, mapp); | 864 | *vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC); |
| 865 | if (*vaddr == NULL) | 865 | if (*vaddr == NULL) |
| 866 | return ENOMEM; | 866 | return ENOMEM; |
| 867 | return 0; | 867 | return 0; |
| @@ -871,8 +871,7 @@ void | |||
| 871 | ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat, | 871 | ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat, |
| 872 | void* vaddr, bus_dmamap_t map) | 872 | void* vaddr, bus_dmamap_t map) |
| 873 | { | 873 | { |
| 874 | pci_free_consistent(ahc->dev_softc, dmat->maxsize, | 874 | dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map); |
| 875 | vaddr, map); | ||
| 876 | } | 875 | } |
| 877 | 876 | ||
| 878 | int | 877 | int |
| @@ -1123,8 +1122,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa | |||
| 1123 | 1122 | ||
| 1124 | host->transportt = ahc_linux_transport_template; | 1123 | host->transportt = ahc_linux_transport_template; |
| 1125 | 1124 | ||
| 1126 | retval = scsi_add_host(host, | 1125 | retval = scsi_add_host(host, ahc->dev); |
| 1127 | (ahc->dev_softc ? &ahc->dev_softc->dev : NULL)); | ||
| 1128 | if (retval) { | 1126 | if (retval) { |
| 1129 | printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n"); | 1127 | printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n"); |
| 1130 | scsi_host_put(host); | 1128 | scsi_host_put(host); |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 0fc14dac7070..717d8d1082ce 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | |||
| @@ -250,6 +250,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | ahc->dev_softc = pci; | 252 | ahc->dev_softc = pci; |
| 253 | ahc->dev = &pci->dev; | ||
| 253 | error = ahc_pci_config(ahc, entry); | 254 | error = ahc_pci_config(ahc, entry); |
| 254 | if (error != 0) { | 255 | if (error != 0) { |
| 255 | ahc_free(ahc); | 256 | ahc_free(ahc); |
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c index 462560b2855e..469d0bc9f5fe 100644 --- a/drivers/scsi/csiostor/csio_scsi.c +++ b/drivers/scsi/csiostor/csio_scsi.c | |||
| @@ -1713,8 +1713,11 @@ csio_scsi_err_handler(struct csio_hw *hw, struct csio_ioreq *req) | |||
| 1713 | } | 1713 | } |
| 1714 | 1714 | ||
| 1715 | out: | 1715 | out: |
| 1716 | if (req->nsge > 0) | 1716 | if (req->nsge > 0) { |
| 1717 | scsi_dma_unmap(cmnd); | 1717 | scsi_dma_unmap(cmnd); |
| 1718 | if (req->dcopy && (host_status == DID_OK)) | ||
| 1719 | host_status = csio_scsi_copy_to_sgl(hw, req); | ||
| 1720 | } | ||
| 1718 | 1721 | ||
| 1719 | cmnd->result = (((host_status) << 16) | scsi_status); | 1722 | cmnd->result = (((host_status) << 16) | scsi_status); |
| 1720 | cmnd->scsi_done(cmnd); | 1723 | cmnd->scsi_done(cmnd); |
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index dfba4921b265..5bf61431434b 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c | |||
| @@ -2162,7 +2162,6 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp) | |||
| 2162 | FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", | 2162 | FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", |
| 2163 | fc_rport_state(rdata)); | 2163 | fc_rport_state(rdata)); |
| 2164 | 2164 | ||
| 2165 | rdata->flags &= ~FC_RP_STARTED; | ||
| 2166 | fc_rport_enter_delete(rdata, RPORT_EV_STOP); | 2165 | fc_rport_enter_delete(rdata, RPORT_EV_STOP); |
| 2167 | mutex_unlock(&rdata->rp_mutex); | 2166 | mutex_unlock(&rdata->rp_mutex); |
| 2168 | kref_put(&rdata->kref, fc_rport_destroy); | 2167 | kref_put(&rdata->kref, fc_rport_destroy); |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c98f264f1d83..a497b2c0cb79 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
| @@ -3878,10 +3878,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
| 3878 | * wake up the thread. | 3878 | * wake up the thread. |
| 3879 | */ | 3879 | */ |
| 3880 | spin_lock(&lpfc_cmd->buf_lock); | 3880 | spin_lock(&lpfc_cmd->buf_lock); |
| 3881 | if (unlikely(lpfc_cmd->cur_iocbq.iocb_flag & LPFC_DRIVER_ABORTED)) { | 3881 | lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED; |
| 3882 | lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED; | 3882 | if (lpfc_cmd->waitq) { |
| 3883 | if (lpfc_cmd->waitq) | 3883 | wake_up(lpfc_cmd->waitq); |
| 3884 | wake_up(lpfc_cmd->waitq); | ||
| 3885 | lpfc_cmd->waitq = NULL; | 3884 | lpfc_cmd->waitq = NULL; |
| 3886 | } | 3885 | } |
| 3887 | spin_unlock(&lpfc_cmd->buf_lock); | 3886 | spin_unlock(&lpfc_cmd->buf_lock); |
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index e74a62448ba4..e5db9a9954dc 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c | |||
| @@ -1392,10 +1392,8 @@ static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi) | |||
| 1392 | 1392 | ||
| 1393 | static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi) | 1393 | static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi) |
| 1394 | { | 1394 | { |
| 1395 | struct qedi_nvm_iscsi_image nvm_image; | ||
| 1396 | |||
| 1397 | qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev, | 1395 | qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev, |
| 1398 | sizeof(nvm_image), | 1396 | sizeof(struct qedi_nvm_iscsi_image), |
| 1399 | &qedi->nvm_buf_dma, GFP_KERNEL); | 1397 | &qedi->nvm_buf_dma, GFP_KERNEL); |
| 1400 | if (!qedi->iscsi_image) { | 1398 | if (!qedi->iscsi_image) { |
| 1401 | QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n"); | 1399 | QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n"); |
| @@ -2236,14 +2234,13 @@ static void qedi_boot_release(void *data) | |||
| 2236 | static int qedi_get_boot_info(struct qedi_ctx *qedi) | 2234 | static int qedi_get_boot_info(struct qedi_ctx *qedi) |
| 2237 | { | 2235 | { |
| 2238 | int ret = 1; | 2236 | int ret = 1; |
| 2239 | struct qedi_nvm_iscsi_image nvm_image; | ||
| 2240 | 2237 | ||
| 2241 | QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, | 2238 | QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, |
| 2242 | "Get NVM iSCSI CFG image\n"); | 2239 | "Get NVM iSCSI CFG image\n"); |
| 2243 | ret = qedi_ops->common->nvm_get_image(qedi->cdev, | 2240 | ret = qedi_ops->common->nvm_get_image(qedi->cdev, |
| 2244 | QED_NVM_IMAGE_ISCSI_CFG, | 2241 | QED_NVM_IMAGE_ISCSI_CFG, |
| 2245 | (char *)qedi->iscsi_image, | 2242 | (char *)qedi->iscsi_image, |
| 2246 | sizeof(nvm_image)); | 2243 | sizeof(struct qedi_nvm_iscsi_image)); |
| 2247 | if (ret) | 2244 | if (ret) |
| 2248 | QEDI_ERR(&qedi->dbg_ctx, | 2245 | QEDI_ERR(&qedi->dbg_ctx, |
| 2249 | "Could not get NVM image. ret = %d\n", ret); | 2246 | "Could not get NVM image. ret = %d\n", ret); |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index c4cbfd07b916..a08ff3bd6310 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
| @@ -238,6 +238,7 @@ static struct { | |||
| 238 | {"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | 238 | {"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
| 239 | {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | 239 | {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
| 240 | {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | 240 | {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
| 241 | {"LENOVO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
| 241 | {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, | 242 | {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, |
| 242 | {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, | 243 | {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, |
| 243 | {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ | 244 | {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ |
diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c index 5a58cbf3a75d..c14006ac98f9 100644 --- a/drivers/scsi/scsi_dh.c +++ b/drivers/scsi/scsi_dh.c | |||
| @@ -75,6 +75,7 @@ static const struct scsi_dh_blist scsi_dh_blist[] = { | |||
| 75 | {"NETAPP", "INF-01-00", "rdac", }, | 75 | {"NETAPP", "INF-01-00", "rdac", }, |
| 76 | {"LSI", "INF-01-00", "rdac", }, | 76 | {"LSI", "INF-01-00", "rdac", }, |
| 77 | {"ENGENIO", "INF-01-00", "rdac", }, | 77 | {"ENGENIO", "INF-01-00", "rdac", }, |
| 78 | {"LENOVO", "DE_Series", "rdac", }, | ||
| 78 | {NULL, NULL, NULL }, | 79 | {NULL, NULL, NULL }, |
| 79 | }; | 80 | }; |
| 80 | 81 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 601b9f1de267..07dfc17d4824 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -1706,8 +1706,12 @@ out_put_budget: | |||
| 1706 | ret = BLK_STS_DEV_RESOURCE; | 1706 | ret = BLK_STS_DEV_RESOURCE; |
| 1707 | break; | 1707 | break; |
| 1708 | default: | 1708 | default: |
| 1709 | if (unlikely(!scsi_device_online(sdev))) | ||
| 1710 | scsi_req(req)->result = DID_NO_CONNECT << 16; | ||
| 1711 | else | ||
| 1712 | scsi_req(req)->result = DID_ERROR << 16; | ||
| 1709 | /* | 1713 | /* |
| 1710 | * Make sure to release all allocated ressources when | 1714 | * Make sure to release all allocated resources when |
| 1711 | * we hit an error, as we will never see this command | 1715 | * we hit an error, as we will never see this command |
| 1712 | * again. | 1716 | * again. |
| 1713 | */ | 1717 | */ |
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 84380bae20f1..8472de1007ff 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c | |||
| @@ -385,7 +385,7 @@ enum storvsc_request_type { | |||
| 385 | * This is the end of Protocol specific defines. | 385 | * This is the end of Protocol specific defines. |
| 386 | */ | 386 | */ |
| 387 | 387 | ||
| 388 | static int storvsc_ringbuffer_size = (256 * PAGE_SIZE); | 388 | static int storvsc_ringbuffer_size = (128 * 1024); |
| 389 | static u32 max_outstanding_req_per_channel; | 389 | static u32 max_outstanding_req_per_channel; |
| 390 | 390 | ||
| 391 | static int storvsc_vcpus_per_sub_channel = 4; | 391 | static int storvsc_vcpus_per_sub_channel = 4; |
| @@ -668,13 +668,22 @@ static void handle_multichannel_storage(struct hv_device *device, int max_chns) | |||
| 668 | { | 668 | { |
| 669 | struct device *dev = &device->device; | 669 | struct device *dev = &device->device; |
| 670 | struct storvsc_device *stor_device; | 670 | struct storvsc_device *stor_device; |
| 671 | int num_cpus = num_online_cpus(); | ||
| 672 | int num_sc; | 671 | int num_sc; |
| 673 | struct storvsc_cmd_request *request; | 672 | struct storvsc_cmd_request *request; |
| 674 | struct vstor_packet *vstor_packet; | 673 | struct vstor_packet *vstor_packet; |
| 675 | int ret, t; | 674 | int ret, t; |
| 676 | 675 | ||
| 677 | num_sc = ((max_chns > num_cpus) ? num_cpus : max_chns); | 676 | /* |
| 677 | * If the number of CPUs is artificially restricted, such as | ||
| 678 | * with maxcpus=1 on the kernel boot line, Hyper-V could offer | ||
| 679 | * sub-channels >= the number of CPUs. These sub-channels | ||
| 680 | * should not be created. The primary channel is already created | ||
| 681 | * and assigned to one CPU, so check against # CPUs - 1. | ||
| 682 | */ | ||
| 683 | num_sc = min((int)(num_online_cpus() - 1), max_chns); | ||
| 684 | if (!num_sc) | ||
| 685 | return; | ||
| 686 | |||
| 678 | stor_device = get_out_stor_device(device); | 687 | stor_device = get_out_stor_device(device); |
| 679 | if (!stor_device) | 688 | if (!stor_device) |
| 680 | return; | 689 | return; |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 8af01777d09c..f8cb7c23305b 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
| @@ -793,6 +793,7 @@ static int virtscsi_probe(struct virtio_device *vdev) | |||
| 793 | 793 | ||
| 794 | /* We need to know how many queues before we allocate. */ | 794 | /* We need to know how many queues before we allocate. */ |
| 795 | num_queues = virtscsi_config_get(vdev, num_queues) ? : 1; | 795 | num_queues = virtscsi_config_get(vdev, num_queues) ? : 1; |
| 796 | num_queues = min_t(unsigned int, nr_cpu_ids, num_queues); | ||
| 796 | 797 | ||
| 797 | num_targets = virtscsi_config_get(vdev, max_target) + 1; | 798 | num_targets = virtscsi_config_get(vdev, max_target) + 1; |
| 798 | 799 | ||
diff --git a/drivers/staging/comedi/drivers/ni_usb6501.c b/drivers/staging/comedi/drivers/ni_usb6501.c index 808ed92ed66f..1bb1cb651349 100644 --- a/drivers/staging/comedi/drivers/ni_usb6501.c +++ b/drivers/staging/comedi/drivers/ni_usb6501.c | |||
| @@ -463,10 +463,8 @@ static int ni6501_alloc_usb_buffers(struct comedi_device *dev) | |||
| 463 | 463 | ||
| 464 | size = usb_endpoint_maxp(devpriv->ep_tx); | 464 | size = usb_endpoint_maxp(devpriv->ep_tx); |
| 465 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); | 465 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); |
| 466 | if (!devpriv->usb_tx_buf) { | 466 | if (!devpriv->usb_tx_buf) |
| 467 | kfree(devpriv->usb_rx_buf); | ||
| 468 | return -ENOMEM; | 467 | return -ENOMEM; |
| 469 | } | ||
| 470 | 468 | ||
| 471 | return 0; | 469 | return 0; |
| 472 | } | 470 | } |
| @@ -518,6 +516,9 @@ static int ni6501_auto_attach(struct comedi_device *dev, | |||
| 518 | if (!devpriv) | 516 | if (!devpriv) |
| 519 | return -ENOMEM; | 517 | return -ENOMEM; |
| 520 | 518 | ||
| 519 | mutex_init(&devpriv->mut); | ||
| 520 | usb_set_intfdata(intf, devpriv); | ||
| 521 | |||
| 521 | ret = ni6501_find_endpoints(dev); | 522 | ret = ni6501_find_endpoints(dev); |
| 522 | if (ret) | 523 | if (ret) |
| 523 | return ret; | 524 | return ret; |
| @@ -526,9 +527,6 @@ static int ni6501_auto_attach(struct comedi_device *dev, | |||
| 526 | if (ret) | 527 | if (ret) |
| 527 | return ret; | 528 | return ret; |
| 528 | 529 | ||
| 529 | mutex_init(&devpriv->mut); | ||
| 530 | usb_set_intfdata(intf, devpriv); | ||
| 531 | |||
| 532 | ret = comedi_alloc_subdevices(dev, 2); | 530 | ret = comedi_alloc_subdevices(dev, 2); |
| 533 | if (ret) | 531 | if (ret) |
| 534 | return ret; | 532 | return ret; |
diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index 6234b649d887..65dc6c51037e 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c | |||
| @@ -682,10 +682,8 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev) | |||
| 682 | 682 | ||
| 683 | size = usb_endpoint_maxp(devpriv->ep_tx); | 683 | size = usb_endpoint_maxp(devpriv->ep_tx); |
| 684 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); | 684 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); |
| 685 | if (!devpriv->usb_tx_buf) { | 685 | if (!devpriv->usb_tx_buf) |
| 686 | kfree(devpriv->usb_rx_buf); | ||
| 687 | return -ENOMEM; | 686 | return -ENOMEM; |
| 688 | } | ||
| 689 | 687 | ||
| 690 | return 0; | 688 | return 0; |
| 691 | } | 689 | } |
| @@ -800,6 +798,8 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, | |||
| 800 | 798 | ||
| 801 | devpriv->model = board->model; | 799 | devpriv->model = board->model; |
| 802 | 800 | ||
| 801 | sema_init(&devpriv->limit_sem, 8); | ||
| 802 | |||
| 803 | ret = vmk80xx_find_usb_endpoints(dev); | 803 | ret = vmk80xx_find_usb_endpoints(dev); |
| 804 | if (ret) | 804 | if (ret) |
| 805 | return ret; | 805 | return ret; |
| @@ -808,8 +808,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, | |||
| 808 | if (ret) | 808 | if (ret) |
| 809 | return ret; | 809 | return ret; |
| 810 | 810 | ||
| 811 | sema_init(&devpriv->limit_sem, 8); | ||
| 812 | |||
| 813 | usb_set_intfdata(intf, devpriv); | 811 | usb_set_intfdata(intf, devpriv); |
| 814 | 812 | ||
| 815 | if (devpriv->model == VMK8055_MODEL) | 813 | if (devpriv->model == VMK8055_MODEL) |
diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c index 526e0dbea5b5..81af768e7248 100644 --- a/drivers/staging/erofs/data.c +++ b/drivers/staging/erofs/data.c | |||
| @@ -298,7 +298,7 @@ submit_bio_retry: | |||
| 298 | *last_block = current_block; | 298 | *last_block = current_block; |
| 299 | 299 | ||
| 300 | /* shift in advance in case of it followed by too many gaps */ | 300 | /* shift in advance in case of it followed by too many gaps */ |
| 301 | if (unlikely(bio->bi_vcnt >= bio->bi_max_vecs)) { | 301 | if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) { |
| 302 | /* err should reassign to 0 after submitting */ | 302 | /* err should reassign to 0 after submitting */ |
| 303 | err = 0; | 303 | err = 0; |
| 304 | goto submit_bio_out; | 304 | goto submit_bio_out; |
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index acdbc07fd259..2fc8bc22b57b 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c | |||
| @@ -109,10 +109,10 @@ | |||
| 109 | #define AD7192_CH_AIN3 BIT(6) /* AIN3 - AINCOM */ | 109 | #define AD7192_CH_AIN3 BIT(6) /* AIN3 - AINCOM */ |
| 110 | #define AD7192_CH_AIN4 BIT(7) /* AIN4 - AINCOM */ | 110 | #define AD7192_CH_AIN4 BIT(7) /* AIN4 - AINCOM */ |
| 111 | 111 | ||
| 112 | #define AD7193_CH_AIN1P_AIN2M 0x000 /* AIN1(+) - AIN2(-) */ | 112 | #define AD7193_CH_AIN1P_AIN2M 0x001 /* AIN1(+) - AIN2(-) */ |
| 113 | #define AD7193_CH_AIN3P_AIN4M 0x001 /* AIN3(+) - AIN4(-) */ | 113 | #define AD7193_CH_AIN3P_AIN4M 0x002 /* AIN3(+) - AIN4(-) */ |
| 114 | #define AD7193_CH_AIN5P_AIN6M 0x002 /* AIN5(+) - AIN6(-) */ | 114 | #define AD7193_CH_AIN5P_AIN6M 0x004 /* AIN5(+) - AIN6(-) */ |
| 115 | #define AD7193_CH_AIN7P_AIN8M 0x004 /* AIN7(+) - AIN8(-) */ | 115 | #define AD7193_CH_AIN7P_AIN8M 0x008 /* AIN7(+) - AIN8(-) */ |
| 116 | #define AD7193_CH_TEMP 0x100 /* Temp senseor */ | 116 | #define AD7193_CH_TEMP 0x100 /* Temp senseor */ |
| 117 | #define AD7193_CH_AIN2P_AIN2M 0x200 /* AIN2(+) - AIN2(-) */ | 117 | #define AD7193_CH_AIN2P_AIN2M 0x200 /* AIN2(+) - AIN2(-) */ |
| 118 | #define AD7193_CH_AIN1 0x401 /* AIN1 - AINCOM */ | 118 | #define AD7193_CH_AIN1 0x401 /* AIN1 - AINCOM */ |
diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c index 029c3bf42d4d..07774c000c5a 100644 --- a/drivers/staging/iio/meter/ade7854.c +++ b/drivers/staging/iio/meter/ade7854.c | |||
| @@ -269,7 +269,7 @@ static IIO_DEV_ATTR_VPEAK(0644, | |||
| 269 | static IIO_DEV_ATTR_IPEAK(0644, | 269 | static IIO_DEV_ATTR_IPEAK(0644, |
| 270 | ade7854_read_32bit, | 270 | ade7854_read_32bit, |
| 271 | ade7854_write_32bit, | 271 | ade7854_write_32bit, |
| 272 | ADE7854_VPEAK); | 272 | ADE7854_IPEAK); |
| 273 | static IIO_DEV_ATTR_APHCAL(0644, | 273 | static IIO_DEV_ATTR_APHCAL(0644, |
| 274 | ade7854_read_16bit, | 274 | ade7854_read_16bit, |
| 275 | ade7854_write_16bit, | 275 | ade7854_write_16bit, |
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 18936cdb1083..956daf8c3bd2 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c | |||
| @@ -1431,7 +1431,7 @@ int most_register_interface(struct most_interface *iface) | |||
| 1431 | 1431 | ||
| 1432 | INIT_LIST_HEAD(&iface->p->channel_list); | 1432 | INIT_LIST_HEAD(&iface->p->channel_list); |
| 1433 | iface->p->dev_id = id; | 1433 | iface->p->dev_id = id; |
| 1434 | snprintf(iface->p->name, STRING_SIZE, "mdev%d", id); | 1434 | strcpy(iface->p->name, iface->description); |
| 1435 | iface->dev.init_name = iface->p->name; | 1435 | iface->dev.init_name = iface->p->name; |
| 1436 | iface->dev.bus = &mc.bus; | 1436 | iface->dev.bus = &mc.bus; |
| 1437 | iface->dev.parent = &mc.dev; | 1437 | iface->dev.parent = &mc.dev; |
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 09a183dfc526..a31db15cd7c0 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c | |||
| @@ -1520,11 +1520,13 @@ static int __init sc16is7xx_init(void) | |||
| 1520 | #endif | 1520 | #endif |
| 1521 | return ret; | 1521 | return ret; |
| 1522 | 1522 | ||
| 1523 | #ifdef CONFIG_SERIAL_SC16IS7XX_SPI | ||
| 1523 | err_spi: | 1524 | err_spi: |
| 1525 | #endif | ||
| 1524 | #ifdef CONFIG_SERIAL_SC16IS7XX_I2C | 1526 | #ifdef CONFIG_SERIAL_SC16IS7XX_I2C |
| 1525 | i2c_del_driver(&sc16is7xx_i2c_uart_driver); | 1527 | i2c_del_driver(&sc16is7xx_i2c_uart_driver); |
| 1526 | #endif | ||
| 1527 | err_i2c: | 1528 | err_i2c: |
| 1529 | #endif | ||
| 1528 | uart_unregister_driver(&sc16is7xx_uart); | 1530 | uart_unregister_driver(&sc16is7xx_uart); |
| 1529 | return ret; | 1531 | return ret; |
| 1530 | } | 1532 | } |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 2d1c626312cd..3cd139752d3f 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
| @@ -2512,14 +2512,16 @@ done: | |||
| 2512 | * center of the last stop bit in sampling clocks. | 2512 | * center of the last stop bit in sampling clocks. |
| 2513 | */ | 2513 | */ |
| 2514 | int last_stop = bits * 2 - 1; | 2514 | int last_stop = bits * 2 - 1; |
| 2515 | int deviation = min_err * srr * last_stop / 2 / baud; | 2515 | int deviation = DIV_ROUND_CLOSEST(min_err * last_stop * |
| 2516 | (int)(srr + 1), | ||
| 2517 | 2 * (int)baud); | ||
| 2516 | 2518 | ||
| 2517 | if (abs(deviation) >= 2) { | 2519 | if (abs(deviation) >= 2) { |
| 2518 | /* At least two sampling clocks off at the | 2520 | /* At least two sampling clocks off at the |
| 2519 | * last stop bit; we can increase the error | 2521 | * last stop bit; we can increase the error |
| 2520 | * margin by shifting the sampling point. | 2522 | * margin by shifting the sampling point. |
| 2521 | */ | 2523 | */ |
| 2522 | int shift = min(-8, max(7, deviation / 2)); | 2524 | int shift = clamp(deviation / 2, -8, 7); |
| 2523 | 2525 | ||
| 2524 | hssrr |= (shift << HSCIF_SRHP_SHIFT) & | 2526 | hssrr |= (shift << HSCIF_SRHP_SHIFT) & |
| 2525 | HSCIF_SRHP_MASK; | 2527 | HSCIF_SRHP_MASK; |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index d34984aa646d..650c66886c80 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
| @@ -1520,7 +1520,8 @@ static void csi_J(struct vc_data *vc, int vpar) | |||
| 1520 | return; | 1520 | return; |
| 1521 | } | 1521 | } |
| 1522 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); | 1522 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); |
| 1523 | update_region(vc, (unsigned long) start, count); | 1523 | if (con_should_update(vc)) |
| 1524 | do_update_region(vc, (unsigned long) start, count); | ||
| 1524 | vc->vc_need_wrap = 0; | 1525 | vc->vc_need_wrap = 0; |
| 1525 | } | 1526 | } |
| 1526 | 1527 | ||
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 8987cec9549d..ebcadaad89d1 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
| @@ -473,11 +473,6 @@ static int usb_unbind_interface(struct device *dev) | |||
| 473 | pm_runtime_disable(dev); | 473 | pm_runtime_disable(dev); |
| 474 | pm_runtime_set_suspended(dev); | 474 | pm_runtime_set_suspended(dev); |
| 475 | 475 | ||
| 476 | /* Undo any residual pm_autopm_get_interface_* calls */ | ||
| 477 | for (r = atomic_read(&intf->pm_usage_cnt); r > 0; --r) | ||
| 478 | usb_autopm_put_interface_no_suspend(intf); | ||
| 479 | atomic_set(&intf->pm_usage_cnt, 0); | ||
| 480 | |||
| 481 | if (!error) | 476 | if (!error) |
| 482 | usb_autosuspend_device(udev); | 477 | usb_autosuspend_device(udev); |
| 483 | 478 | ||
| @@ -1633,7 +1628,6 @@ void usb_autopm_put_interface(struct usb_interface *intf) | |||
| 1633 | int status; | 1628 | int status; |
| 1634 | 1629 | ||
| 1635 | usb_mark_last_busy(udev); | 1630 | usb_mark_last_busy(udev); |
| 1636 | atomic_dec(&intf->pm_usage_cnt); | ||
| 1637 | status = pm_runtime_put_sync(&intf->dev); | 1631 | status = pm_runtime_put_sync(&intf->dev); |
| 1638 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", | 1632 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", |
| 1639 | __func__, atomic_read(&intf->dev.power.usage_count), | 1633 | __func__, atomic_read(&intf->dev.power.usage_count), |
| @@ -1662,7 +1656,6 @@ void usb_autopm_put_interface_async(struct usb_interface *intf) | |||
| 1662 | int status; | 1656 | int status; |
| 1663 | 1657 | ||
| 1664 | usb_mark_last_busy(udev); | 1658 | usb_mark_last_busy(udev); |
| 1665 | atomic_dec(&intf->pm_usage_cnt); | ||
| 1666 | status = pm_runtime_put(&intf->dev); | 1659 | status = pm_runtime_put(&intf->dev); |
| 1667 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", | 1660 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", |
| 1668 | __func__, atomic_read(&intf->dev.power.usage_count), | 1661 | __func__, atomic_read(&intf->dev.power.usage_count), |
| @@ -1684,7 +1677,6 @@ void usb_autopm_put_interface_no_suspend(struct usb_interface *intf) | |||
| 1684 | struct usb_device *udev = interface_to_usbdev(intf); | 1677 | struct usb_device *udev = interface_to_usbdev(intf); |
| 1685 | 1678 | ||
| 1686 | usb_mark_last_busy(udev); | 1679 | usb_mark_last_busy(udev); |
| 1687 | atomic_dec(&intf->pm_usage_cnt); | ||
| 1688 | pm_runtime_put_noidle(&intf->dev); | 1680 | pm_runtime_put_noidle(&intf->dev); |
| 1689 | } | 1681 | } |
| 1690 | EXPORT_SYMBOL_GPL(usb_autopm_put_interface_no_suspend); | 1682 | EXPORT_SYMBOL_GPL(usb_autopm_put_interface_no_suspend); |
| @@ -1715,8 +1707,6 @@ int usb_autopm_get_interface(struct usb_interface *intf) | |||
| 1715 | status = pm_runtime_get_sync(&intf->dev); | 1707 | status = pm_runtime_get_sync(&intf->dev); |
| 1716 | if (status < 0) | 1708 | if (status < 0) |
| 1717 | pm_runtime_put_sync(&intf->dev); | 1709 | pm_runtime_put_sync(&intf->dev); |
| 1718 | else | ||
| 1719 | atomic_inc(&intf->pm_usage_cnt); | ||
| 1720 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", | 1710 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", |
| 1721 | __func__, atomic_read(&intf->dev.power.usage_count), | 1711 | __func__, atomic_read(&intf->dev.power.usage_count), |
| 1722 | status); | 1712 | status); |
| @@ -1750,8 +1740,6 @@ int usb_autopm_get_interface_async(struct usb_interface *intf) | |||
| 1750 | status = pm_runtime_get(&intf->dev); | 1740 | status = pm_runtime_get(&intf->dev); |
| 1751 | if (status < 0 && status != -EINPROGRESS) | 1741 | if (status < 0 && status != -EINPROGRESS) |
| 1752 | pm_runtime_put_noidle(&intf->dev); | 1742 | pm_runtime_put_noidle(&intf->dev); |
| 1753 | else | ||
| 1754 | atomic_inc(&intf->pm_usage_cnt); | ||
| 1755 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", | 1743 | dev_vdbg(&intf->dev, "%s: cnt %d -> %d\n", |
| 1756 | __func__, atomic_read(&intf->dev.power.usage_count), | 1744 | __func__, atomic_read(&intf->dev.power.usage_count), |
| 1757 | status); | 1745 | status); |
| @@ -1775,7 +1763,6 @@ void usb_autopm_get_interface_no_resume(struct usb_interface *intf) | |||
| 1775 | struct usb_device *udev = interface_to_usbdev(intf); | 1763 | struct usb_device *udev = interface_to_usbdev(intf); |
| 1776 | 1764 | ||
| 1777 | usb_mark_last_busy(udev); | 1765 | usb_mark_last_busy(udev); |
| 1778 | atomic_inc(&intf->pm_usage_cnt); | ||
| 1779 | pm_runtime_get_noresume(&intf->dev); | 1766 | pm_runtime_get_noresume(&intf->dev); |
| 1780 | } | 1767 | } |
| 1781 | EXPORT_SYMBOL_GPL(usb_autopm_get_interface_no_resume); | 1768 | EXPORT_SYMBOL_GPL(usb_autopm_get_interface_no_resume); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 82239f27c4cc..e844bb7b5676 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
| @@ -820,9 +820,11 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) | |||
| 820 | 820 | ||
| 821 | if (dev->state == USB_STATE_SUSPENDED) | 821 | if (dev->state == USB_STATE_SUSPENDED) |
| 822 | return -EHOSTUNREACH; | 822 | return -EHOSTUNREACH; |
| 823 | if (size <= 0 || !buf || !index) | 823 | if (size <= 0 || !buf) |
| 824 | return -EINVAL; | 824 | return -EINVAL; |
| 825 | buf[0] = 0; | 825 | buf[0] = 0; |
| 826 | if (index <= 0 || index >= 256) | ||
| 827 | return -EINVAL; | ||
| 826 | tbuf = kmalloc(256, GFP_NOIO); | 828 | tbuf = kmalloc(256, GFP_NOIO); |
| 827 | if (!tbuf) | 829 | if (!tbuf) |
| 828 | return -ENOMEM; | 830 | return -ENOMEM; |
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index baf72f95f0f1..213b52508621 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c | |||
| @@ -979,8 +979,18 @@ static int dummy_udc_start(struct usb_gadget *g, | |||
| 979 | struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g); | 979 | struct dummy_hcd *dum_hcd = gadget_to_dummy_hcd(g); |
| 980 | struct dummy *dum = dum_hcd->dum; | 980 | struct dummy *dum = dum_hcd->dum; |
| 981 | 981 | ||
| 982 | if (driver->max_speed == USB_SPEED_UNKNOWN) | 982 | switch (g->speed) { |
| 983 | /* All the speeds we support */ | ||
| 984 | case USB_SPEED_LOW: | ||
| 985 | case USB_SPEED_FULL: | ||
| 986 | case USB_SPEED_HIGH: | ||
| 987 | case USB_SPEED_SUPER: | ||
| 988 | break; | ||
| 989 | default: | ||
| 990 | dev_err(dummy_dev(dum_hcd), "Unsupported driver max speed %d\n", | ||
| 991 | driver->max_speed); | ||
| 983 | return -EINVAL; | 992 | return -EINVAL; |
| 993 | } | ||
| 984 | 994 | ||
| 985 | /* | 995 | /* |
| 986 | * SLAVE side init ... the layer above hardware, which | 996 | * SLAVE side init ... the layer above hardware, which |
| @@ -1784,9 +1794,10 @@ static void dummy_timer(struct timer_list *t) | |||
| 1784 | /* Bus speed is 500000 bytes/ms, so use a little less */ | 1794 | /* Bus speed is 500000 bytes/ms, so use a little less */ |
| 1785 | total = 490000; | 1795 | total = 490000; |
| 1786 | break; | 1796 | break; |
| 1787 | default: | 1797 | default: /* Can't happen */ |
| 1788 | dev_err(dummy_dev(dum_hcd), "bogus device speed\n"); | 1798 | dev_err(dummy_dev(dum_hcd), "bogus device speed\n"); |
| 1789 | return; | 1799 | total = 0; |
| 1800 | break; | ||
| 1790 | } | 1801 | } |
| 1791 | 1802 | ||
| 1792 | /* FIXME if HZ != 1000 this will probably misbehave ... */ | 1803 | /* FIXME if HZ != 1000 this will probably misbehave ... */ |
| @@ -1828,7 +1839,7 @@ restart: | |||
| 1828 | 1839 | ||
| 1829 | /* Used up this frame's bandwidth? */ | 1840 | /* Used up this frame's bandwidth? */ |
| 1830 | if (total <= 0) | 1841 | if (total <= 0) |
| 1831 | break; | 1842 | continue; |
| 1832 | 1843 | ||
| 1833 | /* find the gadget's ep for this request (if configured) */ | 1844 | /* find the gadget's ep for this request (if configured) */ |
| 1834 | address = usb_pipeendpoint (urb->pipe); | 1845 | address = usb_pipeendpoint (urb->pipe); |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 6d9fd5f64903..7b306aa22d25 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
| @@ -314,6 +314,7 @@ static void yurex_disconnect(struct usb_interface *interface) | |||
| 314 | usb_deregister_dev(interface, &yurex_class); | 314 | usb_deregister_dev(interface, &yurex_class); |
| 315 | 315 | ||
| 316 | /* prevent more I/O from starting */ | 316 | /* prevent more I/O from starting */ |
| 317 | usb_poison_urb(dev->urb); | ||
| 317 | mutex_lock(&dev->io_mutex); | 318 | mutex_lock(&dev->io_mutex); |
| 318 | dev->interface = NULL; | 319 | dev->interface = NULL; |
| 319 | mutex_unlock(&dev->io_mutex); | 320 | mutex_unlock(&dev->io_mutex); |
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 31b024441938..cc794e25a0b6 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c | |||
| @@ -763,18 +763,16 @@ static void rts51x_suspend_timer_fn(struct timer_list *t) | |||
| 763 | break; | 763 | break; |
| 764 | case RTS51X_STAT_IDLE: | 764 | case RTS51X_STAT_IDLE: |
| 765 | case RTS51X_STAT_SS: | 765 | case RTS51X_STAT_SS: |
| 766 | usb_stor_dbg(us, "RTS51X_STAT_SS, intf->pm_usage_cnt:%d, power.usage:%d\n", | 766 | usb_stor_dbg(us, "RTS51X_STAT_SS, power.usage:%d\n", |
| 767 | atomic_read(&us->pusb_intf->pm_usage_cnt), | ||
| 768 | atomic_read(&us->pusb_intf->dev.power.usage_count)); | 767 | atomic_read(&us->pusb_intf->dev.power.usage_count)); |
| 769 | 768 | ||
| 770 | if (atomic_read(&us->pusb_intf->pm_usage_cnt) > 0) { | 769 | if (atomic_read(&us->pusb_intf->dev.power.usage_count) > 0) { |
| 771 | usb_stor_dbg(us, "Ready to enter SS state\n"); | 770 | usb_stor_dbg(us, "Ready to enter SS state\n"); |
| 772 | rts51x_set_stat(chip, RTS51X_STAT_SS); | 771 | rts51x_set_stat(chip, RTS51X_STAT_SS); |
| 773 | /* ignore mass storage interface's children */ | 772 | /* ignore mass storage interface's children */ |
| 774 | pm_suspend_ignore_children(&us->pusb_intf->dev, true); | 773 | pm_suspend_ignore_children(&us->pusb_intf->dev, true); |
| 775 | usb_autopm_put_interface_async(us->pusb_intf); | 774 | usb_autopm_put_interface_async(us->pusb_intf); |
| 776 | usb_stor_dbg(us, "RTS51X_STAT_SS 01, intf->pm_usage_cnt:%d, power.usage:%d\n", | 775 | usb_stor_dbg(us, "RTS51X_STAT_SS 01, power.usage:%d\n", |
| 777 | atomic_read(&us->pusb_intf->pm_usage_cnt), | ||
| 778 | atomic_read(&us->pusb_intf->dev.power.usage_count)); | 776 | atomic_read(&us->pusb_intf->dev.power.usage_count)); |
| 779 | } | 777 | } |
| 780 | break; | 778 | break; |
| @@ -807,11 +805,10 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
| 807 | int ret; | 805 | int ret; |
| 808 | 806 | ||
| 809 | if (working_scsi(srb)) { | 807 | if (working_scsi(srb)) { |
| 810 | usb_stor_dbg(us, "working scsi, intf->pm_usage_cnt:%d, power.usage:%d\n", | 808 | usb_stor_dbg(us, "working scsi, power.usage:%d\n", |
| 811 | atomic_read(&us->pusb_intf->pm_usage_cnt), | ||
| 812 | atomic_read(&us->pusb_intf->dev.power.usage_count)); | 809 | atomic_read(&us->pusb_intf->dev.power.usage_count)); |
| 813 | 810 | ||
| 814 | if (atomic_read(&us->pusb_intf->pm_usage_cnt) <= 0) { | 811 | if (atomic_read(&us->pusb_intf->dev.power.usage_count) <= 0) { |
| 815 | ret = usb_autopm_get_interface(us->pusb_intf); | 812 | ret = usb_autopm_get_interface(us->pusb_intf); |
| 816 | usb_stor_dbg(us, "working scsi, ret=%d\n", ret); | 813 | usb_stor_dbg(us, "working scsi, ret=%d\n", ret); |
| 817 | } | 814 | } |
diff --git a/drivers/usb/usbip/stub_rx.c b/drivers/usb/usbip/stub_rx.c index 97b09a42a10c..dbfb2f24d71e 100644 --- a/drivers/usb/usbip/stub_rx.c +++ b/drivers/usb/usbip/stub_rx.c | |||
| @@ -361,16 +361,10 @@ static int get_pipe(struct stub_device *sdev, struct usbip_header *pdu) | |||
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | if (usb_endpoint_xfer_isoc(epd)) { | 363 | if (usb_endpoint_xfer_isoc(epd)) { |
| 364 | /* validate packet size and number of packets */ | 364 | /* validate number of packets */ |
| 365 | unsigned int maxp, packets, bytes; | ||
| 366 | |||
| 367 | maxp = usb_endpoint_maxp(epd); | ||
| 368 | maxp *= usb_endpoint_maxp_mult(epd); | ||
| 369 | bytes = pdu->u.cmd_submit.transfer_buffer_length; | ||
| 370 | packets = DIV_ROUND_UP(bytes, maxp); | ||
| 371 | |||
| 372 | if (pdu->u.cmd_submit.number_of_packets < 0 || | 365 | if (pdu->u.cmd_submit.number_of_packets < 0 || |
| 373 | pdu->u.cmd_submit.number_of_packets > packets) { | 366 | pdu->u.cmd_submit.number_of_packets > |
| 367 | USBIP_MAX_ISO_PACKETS) { | ||
| 374 | dev_err(&sdev->udev->dev, | 368 | dev_err(&sdev->udev->dev, |
| 375 | "CMD_SUBMIT: isoc invalid num packets %d\n", | 369 | "CMD_SUBMIT: isoc invalid num packets %d\n", |
| 376 | pdu->u.cmd_submit.number_of_packets); | 370 | pdu->u.cmd_submit.number_of_packets); |
diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h index bf8afe9b5883..8be857a4fa13 100644 --- a/drivers/usb/usbip/usbip_common.h +++ b/drivers/usb/usbip/usbip_common.h | |||
| @@ -121,6 +121,13 @@ extern struct device_attribute dev_attr_usbip_debug; | |||
| 121 | #define USBIP_DIR_OUT 0x00 | 121 | #define USBIP_DIR_OUT 0x00 |
| 122 | #define USBIP_DIR_IN 0x01 | 122 | #define USBIP_DIR_IN 0x01 |
| 123 | 123 | ||
| 124 | /* | ||
| 125 | * Arbitrary limit for the maximum number of isochronous packets in an URB, | ||
| 126 | * compare for example the uhci_submit_isochronous function in | ||
| 127 | * drivers/usb/host/uhci-q.c | ||
| 128 | */ | ||
| 129 | #define USBIP_MAX_ISO_PACKETS 1024 | ||
| 130 | |||
| 124 | /** | 131 | /** |
| 125 | * struct usbip_header_basic - data pertinent to every request | 132 | * struct usbip_header_basic - data pertinent to every request |
| 126 | * @command: the usbip request type | 133 | * @command: the usbip request type |
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index a25659b5a5d1..3fa20e95a6bb 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
| @@ -1661,11 +1661,11 @@ static void __init vfio_pci_fill_ids(void) | |||
| 1661 | rc = pci_add_dynid(&vfio_pci_driver, vendor, device, | 1661 | rc = pci_add_dynid(&vfio_pci_driver, vendor, device, |
| 1662 | subvendor, subdevice, class, class_mask, 0); | 1662 | subvendor, subdevice, class, class_mask, 0); |
| 1663 | if (rc) | 1663 | if (rc) |
| 1664 | pr_warn("failed to add dynamic id [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x (%d)\n", | 1664 | pr_warn("failed to add dynamic id [%04x:%04x[%04x:%04x]] class %#08x/%08x (%d)\n", |
| 1665 | vendor, device, subvendor, subdevice, | 1665 | vendor, device, subvendor, subdevice, |
| 1666 | class, class_mask, rc); | 1666 | class, class_mask, rc); |
| 1667 | else | 1667 | else |
| 1668 | pr_info("add [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x\n", | 1668 | pr_info("add [%04x:%04x[%04x:%04x]] class %#08x/%08x\n", |
| 1669 | vendor, device, subvendor, subdevice, | 1669 | vendor, device, subvendor, subdevice, |
| 1670 | class, class_mask); | 1670 | class, class_mask); |
| 1671 | } | 1671 | } |
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 8dbb270998f4..6b64e45a5269 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c | |||
| @@ -1398,7 +1398,7 @@ unlock_exit: | |||
| 1398 | mutex_unlock(&container->lock); | 1398 | mutex_unlock(&container->lock); |
| 1399 | } | 1399 | } |
| 1400 | 1400 | ||
| 1401 | const struct vfio_iommu_driver_ops tce_iommu_driver_ops = { | 1401 | static const struct vfio_iommu_driver_ops tce_iommu_driver_ops = { |
| 1402 | .name = "iommu-vfio-powerpc", | 1402 | .name = "iommu-vfio-powerpc", |
| 1403 | .owner = THIS_MODULE, | 1403 | .owner = THIS_MODULE, |
| 1404 | .open = tce_iommu_open, | 1404 | .open = tce_iommu_open, |
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 73652e21efec..d0f731c9920a 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c | |||
| @@ -58,12 +58,18 @@ module_param_named(disable_hugepages, | |||
| 58 | MODULE_PARM_DESC(disable_hugepages, | 58 | MODULE_PARM_DESC(disable_hugepages, |
| 59 | "Disable VFIO IOMMU support for IOMMU hugepages."); | 59 | "Disable VFIO IOMMU support for IOMMU hugepages."); |
| 60 | 60 | ||
| 61 | static unsigned int dma_entry_limit __read_mostly = U16_MAX; | ||
| 62 | module_param_named(dma_entry_limit, dma_entry_limit, uint, 0644); | ||
| 63 | MODULE_PARM_DESC(dma_entry_limit, | ||
| 64 | "Maximum number of user DMA mappings per container (65535)."); | ||
| 65 | |||
| 61 | struct vfio_iommu { | 66 | struct vfio_iommu { |
| 62 | struct list_head domain_list; | 67 | struct list_head domain_list; |
| 63 | struct vfio_domain *external_domain; /* domain for external user */ | 68 | struct vfio_domain *external_domain; /* domain for external user */ |
| 64 | struct mutex lock; | 69 | struct mutex lock; |
| 65 | struct rb_root dma_list; | 70 | struct rb_root dma_list; |
| 66 | struct blocking_notifier_head notifier; | 71 | struct blocking_notifier_head notifier; |
| 72 | unsigned int dma_avail; | ||
| 67 | bool v2; | 73 | bool v2; |
| 68 | bool nesting; | 74 | bool nesting; |
| 69 | }; | 75 | }; |
| @@ -836,6 +842,7 @@ static void vfio_remove_dma(struct vfio_iommu *iommu, struct vfio_dma *dma) | |||
| 836 | vfio_unlink_dma(iommu, dma); | 842 | vfio_unlink_dma(iommu, dma); |
| 837 | put_task_struct(dma->task); | 843 | put_task_struct(dma->task); |
| 838 | kfree(dma); | 844 | kfree(dma); |
| 845 | iommu->dma_avail++; | ||
| 839 | } | 846 | } |
| 840 | 847 | ||
| 841 | static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu) | 848 | static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu) |
| @@ -1081,12 +1088,18 @@ static int vfio_dma_do_map(struct vfio_iommu *iommu, | |||
| 1081 | goto out_unlock; | 1088 | goto out_unlock; |
| 1082 | } | 1089 | } |
| 1083 | 1090 | ||
| 1091 | if (!iommu->dma_avail) { | ||
| 1092 | ret = -ENOSPC; | ||
| 1093 | goto out_unlock; | ||
| 1094 | } | ||
| 1095 | |||
| 1084 | dma = kzalloc(sizeof(*dma), GFP_KERNEL); | 1096 | dma = kzalloc(sizeof(*dma), GFP_KERNEL); |
| 1085 | if (!dma) { | 1097 | if (!dma) { |
| 1086 | ret = -ENOMEM; | 1098 | ret = -ENOMEM; |
| 1087 | goto out_unlock; | 1099 | goto out_unlock; |
| 1088 | } | 1100 | } |
| 1089 | 1101 | ||
| 1102 | iommu->dma_avail--; | ||
| 1090 | dma->iova = iova; | 1103 | dma->iova = iova; |
| 1091 | dma->vaddr = vaddr; | 1104 | dma->vaddr = vaddr; |
| 1092 | dma->prot = prot; | 1105 | dma->prot = prot; |
| @@ -1583,6 +1596,7 @@ static void *vfio_iommu_type1_open(unsigned long arg) | |||
| 1583 | 1596 | ||
| 1584 | INIT_LIST_HEAD(&iommu->domain_list); | 1597 | INIT_LIST_HEAD(&iommu->domain_list); |
| 1585 | iommu->dma_list = RB_ROOT; | 1598 | iommu->dma_list = RB_ROOT; |
| 1599 | iommu->dma_avail = dma_entry_limit; | ||
| 1586 | mutex_init(&iommu->lock); | 1600 | mutex_init(&iommu->lock); |
| 1587 | BLOCKING_INIT_NOTIFIER_HEAD(&iommu->notifier); | 1601 | BLOCKING_INIT_NOTIFIER_HEAD(&iommu->notifier); |
| 1588 | 1602 | ||
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 5ace833de746..351af88231ad 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
| @@ -911,8 +911,12 @@ static int vhost_new_umem_range(struct vhost_umem *umem, | |||
| 911 | u64 start, u64 size, u64 end, | 911 | u64 start, u64 size, u64 end, |
| 912 | u64 userspace_addr, int perm) | 912 | u64 userspace_addr, int perm) |
| 913 | { | 913 | { |
| 914 | struct vhost_umem_node *tmp, *node = kmalloc(sizeof(*node), GFP_ATOMIC); | 914 | struct vhost_umem_node *tmp, *node; |
| 915 | 915 | ||
| 916 | if (!size) | ||
| 917 | return -EFAULT; | ||
| 918 | |||
| 919 | node = kmalloc(sizeof(*node), GFP_ATOMIC); | ||
| 916 | if (!node) | 920 | if (!node) |
| 917 | return -ENOMEM; | 921 | return -ENOMEM; |
| 918 | 922 | ||
diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c index d0584c040c60..7a0398bb84f7 100644 --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c | |||
| @@ -255,9 +255,11 @@ void vp_del_vqs(struct virtio_device *vdev) | |||
| 255 | for (i = 0; i < vp_dev->msix_used_vectors; ++i) | 255 | for (i = 0; i < vp_dev->msix_used_vectors; ++i) |
| 256 | free_irq(pci_irq_vector(vp_dev->pci_dev, i), vp_dev); | 256 | free_irq(pci_irq_vector(vp_dev->pci_dev, i), vp_dev); |
| 257 | 257 | ||
| 258 | for (i = 0; i < vp_dev->msix_vectors; i++) | 258 | if (vp_dev->msix_affinity_masks) { |
| 259 | if (vp_dev->msix_affinity_masks[i]) | 259 | for (i = 0; i < vp_dev->msix_vectors; i++) |
| 260 | free_cpumask_var(vp_dev->msix_affinity_masks[i]); | 260 | if (vp_dev->msix_affinity_masks[i]) |
| 261 | free_cpumask_var(vp_dev->msix_affinity_masks[i]); | ||
| 262 | } | ||
| 261 | 263 | ||
| 262 | if (vp_dev->msix_enabled) { | 264 | if (vp_dev->msix_enabled) { |
| 263 | /* Disable the vector used for configuration */ | 265 | /* Disable the vector used for configuration */ |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 18846afb39da..5df92c308286 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
| @@ -882,6 +882,8 @@ static struct virtqueue *vring_create_virtqueue_split( | |||
| 882 | GFP_KERNEL|__GFP_NOWARN|__GFP_ZERO); | 882 | GFP_KERNEL|__GFP_NOWARN|__GFP_ZERO); |
| 883 | if (queue) | 883 | if (queue) |
| 884 | break; | 884 | break; |
| 885 | if (!may_reduce_num) | ||
| 886 | return NULL; | ||
| 885 | } | 887 | } |
| 886 | 888 | ||
| 887 | if (!num) | 889 | if (!num) |
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index 0f4ecfcdb549..a9fb77585272 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c | |||
| @@ -1016,15 +1016,15 @@ static int ds_probe(struct usb_interface *intf, | |||
| 1016 | /* alternative 3, 1ms interrupt (greatly speeds search), 64 byte bulk */ | 1016 | /* alternative 3, 1ms interrupt (greatly speeds search), 64 byte bulk */ |
| 1017 | alt = 3; | 1017 | alt = 3; |
| 1018 | err = usb_set_interface(dev->udev, | 1018 | err = usb_set_interface(dev->udev, |
| 1019 | intf->altsetting[alt].desc.bInterfaceNumber, alt); | 1019 | intf->cur_altsetting->desc.bInterfaceNumber, alt); |
| 1020 | if (err) { | 1020 | if (err) { |
| 1021 | dev_err(&dev->udev->dev, "Failed to set alternative setting %d " | 1021 | dev_err(&dev->udev->dev, "Failed to set alternative setting %d " |
| 1022 | "for %d interface: err=%d.\n", alt, | 1022 | "for %d interface: err=%d.\n", alt, |
| 1023 | intf->altsetting[alt].desc.bInterfaceNumber, err); | 1023 | intf->cur_altsetting->desc.bInterfaceNumber, err); |
| 1024 | goto err_out_clear; | 1024 | goto err_out_clear; |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | iface_desc = &intf->altsetting[alt]; | 1027 | iface_desc = intf->cur_altsetting; |
| 1028 | if (iface_desc->desc.bNumEndpoints != NUM_EP-1) { | 1028 | if (iface_desc->desc.bNumEndpoints != NUM_EP-1) { |
| 1029 | pr_info("Num endpoints=%d. It is not DS9490R.\n", | 1029 | pr_info("Num endpoints=%d. It is not DS9490R.\n", |
| 1030 | iface_desc->desc.bNumEndpoints); | 1030 | iface_desc->desc.bNumEndpoints); |
diff --git a/drivers/xen/privcmd-buf.c b/drivers/xen/privcmd-buf.c index de01a6d0059d..a1c61e351d3f 100644 --- a/drivers/xen/privcmd-buf.c +++ b/drivers/xen/privcmd-buf.c | |||
| @@ -140,8 +140,7 @@ static int privcmd_buf_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 140 | if (!(vma->vm_flags & VM_SHARED)) | 140 | if (!(vma->vm_flags & VM_SHARED)) |
| 141 | return -EINVAL; | 141 | return -EINVAL; |
| 142 | 142 | ||
| 143 | vma_priv = kzalloc(sizeof(*vma_priv) + count * sizeof(void *), | 143 | vma_priv = kzalloc(struct_size(vma_priv, pages, count), GFP_KERNEL); |
| 144 | GFP_KERNEL); | ||
| 145 | if (!vma_priv) | 144 | if (!vma_priv) |
| 146 | return -ENOMEM; | 145 | return -ENOMEM; |
| 147 | 146 | ||
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index c3e201025ef0..0782ff3c2273 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
| @@ -622,9 +622,7 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) | |||
| 622 | if (xen_store_evtchn == 0) | 622 | if (xen_store_evtchn == 0) |
| 623 | return -ENOENT; | 623 | return -ENOENT; |
| 624 | 624 | ||
| 625 | nonseekable_open(inode, filp); | 625 | stream_open(inode, filp); |
| 626 | |||
| 627 | filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */ | ||
| 628 | 626 | ||
| 629 | u = kzalloc(sizeof(*u), GFP_KERNEL); | 627 | u = kzalloc(sizeof(*u), GFP_KERNEL); |
| 630 | if (u == NULL) | 628 | if (u == NULL) |
